@fluidframework/tree 2.23.0 → 2.30.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/CHANGELOG.md +38 -0
- package/api-report/tree.alpha.api.md +28 -12
- package/dist/alpha.d.ts +6 -0
- package/dist/core/forest/editableForest.d.ts +1 -14
- package/dist/core/forest/editableForest.d.ts.map +1 -1
- package/dist/core/forest/editableForest.js +1 -28
- package/dist/core/forest/editableForest.js.map +1 -1
- package/dist/core/forest/forest.d.ts +16 -3
- package/dist/core/forest/forest.d.ts.map +1 -1
- package/dist/core/forest/forest.js +4 -1
- package/dist/core/forest/forest.js.map +1 -1
- package/dist/core/forest/index.d.ts +1 -1
- package/dist/core/forest/index.d.ts.map +1 -1
- package/dist/core/forest/index.js +1 -2
- package/dist/core/forest/index.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +8 -3
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +12 -5
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/delta.d.ts +8 -23
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts +3 -3
- package/dist/core/tree/deltaUtil.d.ts.map +1 -1
- package/dist/core/tree/deltaUtil.js +2 -2
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/index.d.ts +2 -2
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +2 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/pathTree.d.ts +54 -1
- package/dist/core/tree/pathTree.d.ts.map +1 -1
- package/dist/core/tree/pathTree.js +8 -1
- package/dist/core/tree/pathTree.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts +7 -5
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +19 -9
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts +5 -23
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +8 -5
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts +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/chunkTree.d.ts +5 -3
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +10 -7
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -0
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +5 -2
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.d.ts → schemaBasedEncode.d.ts} +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.js → schemaBasedEncode.js} +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +3 -2
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +3 -2
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -14
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +5 -6
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +1 -0
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js +3 -1
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +21 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js +57 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -0
- package/dist/feature-libraries/deltaUtils.js +1 -1
- package/dist/feature-libraries/deltaUtils.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.d.ts +5 -5
- package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -2
- 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/lazyField.d.ts +5 -4
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +9 -6
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -5
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +2 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +9 -7
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/initializeForest.d.ts +18 -0
- package/dist/feature-libraries/initializeForest.d.ts.map +1 -0
- package/dist/feature-libraries/initializeForest.js +35 -0
- package/dist/feature-libraries/initializeForest.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -5
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +9 -15
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/node-identifier/index.d.ts +8 -0
- package/dist/feature-libraries/node-identifier/index.d.ts.map +1 -0
- package/dist/feature-libraries/node-identifier/index.js +16 -0
- package/dist/feature-libraries/node-identifier/index.js.map +1 -0
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts +22 -0
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -0
- package/dist/feature-libraries/{node-key/mockNodeKeyManager.js → node-identifier/mockNodeIdentifierManager.js} +18 -18
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifier.d.ts +38 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifier.d.ts.map +1 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifier.js +26 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifier.js.map +1 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.d.ts +37 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js +48 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -0
- package/dist/feature-libraries/object-forest/objectForest.d.ts +2 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +6 -2
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +1 -1
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/checkoutFlexTreeView.d.ts +3 -3
- package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
- package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +3 -18
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +2 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +3 -2
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +4 -4
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +1 -0
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +11 -7
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts +1 -2
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.js +2 -2
- package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/dist/shared-tree/treeApiAlpha.d.ts +6 -31
- package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeApiAlpha.js +3 -18
- package/dist/shared-tree/treeApiAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.js +1 -1
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/simple-tree/api/conciseTree.d.ts +8 -2
- package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/conciseTree.js +10 -1
- package/dist/simple-tree/api/conciseTree.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts +3 -3
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/customTree.d.ts +42 -12
- package/dist/simple-tree/api/customTree.d.ts.map +1 -1
- package/dist/simple-tree/api/customTree.js +30 -2
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +4 -3
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +6 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +12 -9
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +16 -26
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +7 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +9 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts +19 -0
- package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -0
- package/dist/simple-tree/api/schemaFromSimple.js +60 -0
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -0
- package/dist/simple-tree/api/simpleSchema.d.ts +3 -0
- package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +11 -5
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js +11 -2
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +2 -17
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +15 -15
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.d.ts +16 -25
- package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +15 -10
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +2 -2
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/flexList.d.ts +4 -5
- package/dist/simple-tree/flexList.d.ts.map +1 -1
- package/dist/simple-tree/flexList.js +1 -14
- package/dist/simple-tree/flexList.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +7 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +2 -0
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +34 -2
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +55 -2
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/toMapTree.d.ts +4 -4
- package/dist/simple-tree/toMapTree.d.ts.map +1 -1
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +1 -5
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.d.ts +7 -1
- package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +13 -5
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/util/cloneWithReplacements.d.ts +21 -0
- package/dist/util/cloneWithReplacements.d.ts.map +1 -0
- package/dist/util/cloneWithReplacements.js +38 -0
- package/dist/util/cloneWithReplacements.js.map +1 -0
- package/dist/util/index.d.ts +1 -0
- 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/referenceCounting.d.ts +18 -0
- package/dist/util/referenceCounting.d.ts.map +1 -1
- package/dist/util/referenceCounting.js.map +1 -1
- package/lib/alpha.d.ts +6 -0
- package/lib/core/forest/editableForest.d.ts +1 -14
- package/lib/core/forest/editableForest.d.ts.map +1 -1
- package/lib/core/forest/editableForest.js +0 -26
- package/lib/core/forest/editableForest.js.map +1 -1
- package/lib/core/forest/forest.d.ts +16 -3
- package/lib/core/forest/forest.d.ts.map +1 -1
- package/lib/core/forest/forest.js +4 -1
- package/lib/core/forest/forest.js.map +1 -1
- package/lib/core/forest/index.d.ts +1 -1
- package/lib/core/forest/index.d.ts.map +1 -1
- package/lib/core/forest/index.js +1 -1
- package/lib/core/forest/index.js.map +1 -1
- package/lib/core/index.d.ts +2 -2
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +2 -2
- package/lib/core/index.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts +8 -3
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +12 -5
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/delta.d.ts +8 -23
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/deltaUtil.d.ts +3 -3
- package/lib/core/tree/deltaUtil.d.ts.map +1 -1
- package/lib/core/tree/deltaUtil.js +2 -2
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/index.d.ts +2 -2
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/pathTree.d.ts +54 -1
- package/lib/core/tree/pathTree.d.ts.map +1 -1
- package/lib/core/tree/pathTree.js +6 -0
- package/lib/core/tree/pathTree.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts +7 -5
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +19 -9
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts +5 -23
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +8 -5
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts +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/chunkTree.d.ts +5 -3
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +11 -8
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -0
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +6 -3
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.d.ts → schemaBasedEncode.d.ts} +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.js → schemaBasedEncode.js} +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +3 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +3 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -14
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +5 -6
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -0
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js +1 -0
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +21 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js +53 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -0
- package/lib/feature-libraries/deltaUtils.js +1 -1
- package/lib/feature-libraries/deltaUtils.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.d.ts +5 -5
- package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -2
- 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/lazyField.d.ts +5 -4
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +11 -8
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +6 -7
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +2 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +2 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/initializeForest.d.ts +18 -0
- package/lib/feature-libraries/initializeForest.d.ts.map +1 -0
- package/lib/feature-libraries/initializeForest.js +31 -0
- package/lib/feature-libraries/initializeForest.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -5
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +10 -16
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/node-identifier/index.d.ts +8 -0
- package/lib/feature-libraries/node-identifier/index.d.ts.map +1 -0
- package/lib/feature-libraries/node-identifier/index.js +8 -0
- package/lib/feature-libraries/node-identifier/index.js.map +1 -0
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts +22 -0
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -0
- package/lib/feature-libraries/{node-key/mockNodeKeyManager.js → node-identifier/mockNodeIdentifierManager.js} +16 -16
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifier.d.ts +38 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifier.d.ts.map +1 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifier.js +22 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifier.js.map +1 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.d.ts +37 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js +43 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -0
- package/lib/feature-libraries/object-forest/objectForest.d.ts +2 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +6 -2
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +1 -1
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/checkoutFlexTreeView.d.ts +3 -3
- package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
- package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +5 -20
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +3 -2
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +4 -4
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +1 -0
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +9 -6
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts +1 -2
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.js +2 -2
- package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/lib/shared-tree/treeApiAlpha.d.ts +6 -31
- package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeApiAlpha.js +3 -18
- package/lib/shared-tree/treeApiAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.js +2 -2
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/simple-tree/api/conciseTree.d.ts +8 -2
- package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/conciseTree.js +9 -1
- package/lib/simple-tree/api/conciseTree.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts +3 -3
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/customTree.d.ts +42 -12
- package/lib/simple-tree/api/customTree.d.ts.map +1 -1
- package/lib/simple-tree/api/customTree.js +29 -2
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +4 -3
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +4 -3
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +12 -9
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +14 -23
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +7 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +9 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts +19 -0
- package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -0
- package/lib/simple-tree/api/schemaFromSimple.js +56 -0
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -0
- package/lib/simple-tree/api/simpleSchema.d.ts +3 -0
- package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +11 -5
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js +12 -3
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +4 -19
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +15 -15
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/api/verboseTree.d.ts +16 -25
- package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +14 -10
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +2 -2
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/flexList.d.ts +4 -5
- package/lib/simple-tree/flexList.d.ts.map +1 -1
- package/lib/simple-tree/flexList.js +0 -12
- package/lib/simple-tree/flexList.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +2 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +2 -0
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +34 -2
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +54 -3
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/toMapTree.d.ts +4 -4
- package/lib/simple-tree/toMapTree.d.ts.map +1 -1
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +3 -7
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.d.ts +7 -1
- package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +13 -5
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/util/cloneWithReplacements.d.ts +21 -0
- package/lib/util/cloneWithReplacements.d.ts.map +1 -0
- package/lib/util/cloneWithReplacements.js +34 -0
- package/lib/util/cloneWithReplacements.js.map +1 -0
- package/lib/util/index.d.ts +1 -0
- 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/referenceCounting.d.ts +18 -0
- package/lib/util/referenceCounting.d.ts.map +1 -1
- package/lib/util/referenceCounting.js.map +1 -1
- package/package.json +22 -22
- package/src/core/forest/editableForest.ts +1 -52
- package/src/core/forest/forest.ts +17 -2
- package/src/core/forest/index.ts +0 -1
- package/src/core/index.ts +4 -2
- package/src/core/tree/anchorSet.ts +41 -10
- package/src/core/tree/delta.ts +8 -25
- package/src/core/tree/deltaUtil.ts +5 -5
- package/src/core/tree/index.ts +4 -1
- package/src/core/tree/pathTree.ts +72 -1
- package/src/core/tree/visitDelta.ts +38 -17
- package/src/core/tree/visitorUtils.ts +22 -36
- package/src/feature-libraries/chunked-forest/basicChunk.ts +1 -1
- package/src/feature-libraries/chunked-forest/chunkTree.ts +19 -8
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +9 -4
- package/src/feature-libraries/chunked-forest/codec/README.md +3 -3
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +1 -1
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +3 -2
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +21 -38
- package/src/feature-libraries/default-schema/index.ts +2 -0
- package/src/feature-libraries/default-schema/mappedEditBuilder.ts +68 -0
- package/src/feature-libraries/deltaUtils.ts +1 -1
- package/src/feature-libraries/flex-tree/context.ts +4 -4
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +2 -2
- package/src/feature-libraries/flex-tree/lazyField.ts +19 -10
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +5 -9
- package/src/feature-libraries/index.ts +10 -8
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +2 -2
- package/src/feature-libraries/initializeForest.ts +55 -0
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +12 -28
- package/src/feature-libraries/node-identifier/README.md +11 -0
- package/src/feature-libraries/node-identifier/index.ts +17 -0
- package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +59 -0
- package/src/feature-libraries/node-identifier/nodeIdentifier.ts +50 -0
- package/src/feature-libraries/node-identifier/nodeIdentifierManager.ts +95 -0
- package/src/feature-libraries/object-forest/objectForest.ts +10 -3
- package/src/feature-libraries/treeCursorUtils.ts +1 -1
- package/src/index.ts +17 -10
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/checkoutFlexTreeView.ts +2 -2
- package/src/shared-tree/independentView.ts +5 -29
- package/src/shared-tree/index.ts +1 -0
- package/src/shared-tree/schematizeTree.ts +3 -2
- package/src/shared-tree/schematizingTreeView.ts +3 -3
- package/src/shared-tree/sharedTree.ts +13 -9
- package/src/shared-tree/sharedTreeChangeFamily.ts +0 -1
- package/src/shared-tree/sharedTreeEditBuilder.ts +5 -11
- package/src/shared-tree/treeApiAlpha.ts +15 -78
- package/src/shared-tree/treeCheckout.ts +2 -2
- package/src/simple-tree/api/conciseTree.ts +25 -8
- package/src/simple-tree/api/create.ts +3 -3
- package/src/simple-tree/api/customTree.ts +59 -16
- package/src/simple-tree/api/index.ts +10 -1
- package/src/simple-tree/api/schemaFactory.ts +18 -32
- package/src/simple-tree/api/schemaFactoryAlpha.ts +12 -0
- package/src/simple-tree/api/schemaFromSimple.ts +68 -0
- package/src/simple-tree/api/simpleSchema.ts +10 -0
- package/src/simple-tree/api/tree.ts +13 -8
- package/src/simple-tree/api/treeNodeApi.ts +4 -17
- package/src/simple-tree/api/typesUnsafe.ts +15 -15
- package/src/simple-tree/api/verboseTree.ts +43 -55
- package/src/simple-tree/core/unhydratedFlexTree.ts +2 -2
- package/src/simple-tree/flexList.ts +4 -14
- package/src/simple-tree/index.ts +6 -0
- package/src/simple-tree/objectNode.ts +3 -0
- package/src/simple-tree/schemaTypes.ts +70 -4
- package/src/simple-tree/toMapTree.ts +6 -6
- package/src/simple-tree/toStoredSchema.ts +3 -6
- package/src/simple-tree/treeNodeValid.ts +16 -5
- package/src/util/cloneWithReplacements.ts +41 -0
- package/src/util/index.ts +2 -0
- package/src/util/referenceCounting.ts +18 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +0 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +0 -1
- package/dist/feature-libraries/node-key/index.d.ts +0 -8
- package/dist/feature-libraries/node-key/index.d.ts.map +0 -1
- package/dist/feature-libraries/node-key/index.js +0 -16
- package/dist/feature-libraries/node-key/index.js.map +0 -1
- package/dist/feature-libraries/node-key/mockNodeKeyManager.d.ts +0 -22
- package/dist/feature-libraries/node-key/mockNodeKeyManager.d.ts.map +0 -1
- package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +0 -1
- package/dist/feature-libraries/node-key/nodeKey.d.ts +0 -38
- package/dist/feature-libraries/node-key/nodeKey.d.ts.map +0 -1
- package/dist/feature-libraries/node-key/nodeKey.js +0 -26
- package/dist/feature-libraries/node-key/nodeKey.js.map +0 -1
- package/dist/feature-libraries/node-key/nodeKeyManager.d.ts +0 -37
- package/dist/feature-libraries/node-key/nodeKeyManager.d.ts.map +0 -1
- package/dist/feature-libraries/node-key/nodeKeyManager.js +0 -48
- package/dist/feature-libraries/node-key/nodeKeyManager.js.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +0 -1
- package/lib/feature-libraries/node-key/index.d.ts +0 -8
- package/lib/feature-libraries/node-key/index.d.ts.map +0 -1
- package/lib/feature-libraries/node-key/index.js +0 -8
- package/lib/feature-libraries/node-key/index.js.map +0 -1
- package/lib/feature-libraries/node-key/mockNodeKeyManager.d.ts +0 -22
- package/lib/feature-libraries/node-key/mockNodeKeyManager.d.ts.map +0 -1
- package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +0 -1
- package/lib/feature-libraries/node-key/nodeKey.d.ts +0 -38
- package/lib/feature-libraries/node-key/nodeKey.d.ts.map +0 -1
- package/lib/feature-libraries/node-key/nodeKey.js +0 -22
- package/lib/feature-libraries/node-key/nodeKey.js.map +0 -1
- package/lib/feature-libraries/node-key/nodeKeyManager.d.ts +0 -37
- package/lib/feature-libraries/node-key/nodeKeyManager.d.ts.map +0 -1
- package/lib/feature-libraries/node-key/nodeKeyManager.js +0 -43
- package/lib/feature-libraries/node-key/nodeKeyManager.js.map +0 -1
- package/src/feature-libraries/node-key/README.md +0 -11
- package/src/feature-libraries/node-key/index.ts +0 -17
- package/src/feature-libraries/node-key/mockNodeKeyManager.ts +0 -54
- package/src/feature-libraries/node-key/nodeKey.ts +0 -47
- package/src/feature-libraries/node-key/nodeKeyManager.ts +0 -93
- /package/src/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.ts → schemaBasedEncode.ts} +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
8
|
+
import { assertIsStableId, isStableId } from "@fluidframework/id-compressor/internal";
|
|
9
|
+
|
|
10
|
+
import { brand, extractFromOpaque } from "../../util/index.js";
|
|
11
|
+
|
|
12
|
+
import type { LocalNodeIdentifier, StableNodeIdentifier } from "./nodeIdentifier.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* An object which handles the generation of node identifiers as well as conversion between their two types ({@link StableNodeIdentifier} and {@link LocalNodeIdentifier}).
|
|
16
|
+
*/
|
|
17
|
+
export interface NodeIdentifierManager {
|
|
18
|
+
/**
|
|
19
|
+
* Generate a {@link StableNodeIdentifier}.
|
|
20
|
+
*/
|
|
21
|
+
generateLocalNodeIdentifier(): LocalNodeIdentifier;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Convert the given {@link StableNodeIdentifier} into its {@link LocalNodeIdentifier} form.
|
|
25
|
+
*/
|
|
26
|
+
localizeNodeIdentifier(identifier: StableNodeIdentifier): LocalNodeIdentifier;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Convert the given {@link LocalNodeIdentifier} into its {@link StableNodeIdentifier} form.
|
|
30
|
+
*/
|
|
31
|
+
stabilizeNodeIdentifier(identifier: LocalNodeIdentifier): StableNodeIdentifier;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Attempts to recompress a {@link StableNodeIdentifier}.
|
|
35
|
+
* @param identifier - The identifier that is attempted to recompress.
|
|
36
|
+
* @returns The `{@link LocalNodeIdentifier}` associated with `identifier` or undefined if the identifier was not generated by any session known to this compressor.
|
|
37
|
+
*/
|
|
38
|
+
tryLocalizeNodeIdentifier(identifier: string): LocalNodeIdentifier | undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Creates a {@link NodeIdentifierManager} from the given {@link IIdCompressor}.
|
|
43
|
+
* @param idCompressor - the compressor to use for identifier generation, compression, and decompression.
|
|
44
|
+
* If undefined, then attempts to generate or convert identifiers will throw an error.
|
|
45
|
+
*/
|
|
46
|
+
export function createNodeIdentifierManager(
|
|
47
|
+
idCompressor?: IIdCompressor | undefined,
|
|
48
|
+
): NodeIdentifierManager {
|
|
49
|
+
return {
|
|
50
|
+
generateLocalNodeIdentifier: () => {
|
|
51
|
+
assert(
|
|
52
|
+
idCompressor !== undefined,
|
|
53
|
+
0x6e4 /* Runtime IdCompressor must be available to generate local node identifiers */,
|
|
54
|
+
);
|
|
55
|
+
return brand(idCompressor.generateCompressedId());
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
localizeNodeIdentifier: (identifier: StableNodeIdentifier) => {
|
|
59
|
+
assert(
|
|
60
|
+
idCompressor !== undefined,
|
|
61
|
+
0x6e5 /* Runtime IdCompressor must be available to convert node identifiers */,
|
|
62
|
+
);
|
|
63
|
+
return brand(idCompressor.recompress(identifier));
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
stabilizeNodeIdentifier: (identifier: LocalNodeIdentifier) => {
|
|
67
|
+
assert(
|
|
68
|
+
idCompressor !== undefined,
|
|
69
|
+
0x6e6 /* Runtime IdCompressor must be available to convert node identifiers */,
|
|
70
|
+
);
|
|
71
|
+
return brand(
|
|
72
|
+
// TODO: The assert below is required for type safety but is maybe slow
|
|
73
|
+
assertIsStableId(idCompressor.decompress(extractFromOpaque(identifier))),
|
|
74
|
+
);
|
|
75
|
+
},
|
|
76
|
+
tryLocalizeNodeIdentifier: (identifier: string) => {
|
|
77
|
+
assert(
|
|
78
|
+
idCompressor !== undefined,
|
|
79
|
+
0x6e9 /* Runtime IdCompressor must be available to convert node identifiers */,
|
|
80
|
+
);
|
|
81
|
+
if (isStableNodeIdentifier(identifier)) {
|
|
82
|
+
const compressedIdentifier = idCompressor.tryRecompress(identifier);
|
|
83
|
+
if (compressedIdentifier !== undefined) {
|
|
84
|
+
return brand(compressedIdentifier);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function isStableNodeIdentifier(
|
|
92
|
+
identifier: string,
|
|
93
|
+
): identifier is StableNodeIdentifier {
|
|
94
|
+
return isStableId(identifier);
|
|
95
|
+
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
AnchorSet,
|
|
13
13
|
type AnnouncedVisitor,
|
|
14
14
|
type CursorLocationType,
|
|
15
|
+
type DeltaDetachedNodeId,
|
|
15
16
|
type DeltaVisitor,
|
|
16
17
|
type DetachedField,
|
|
17
18
|
type FieldAnchor,
|
|
@@ -26,8 +27,8 @@ import {
|
|
|
26
27
|
type MapTree,
|
|
27
28
|
type PathRootPrefix,
|
|
28
29
|
type PlaceIndex,
|
|
29
|
-
type ProtoNodes,
|
|
30
30
|
type Range,
|
|
31
|
+
type TreeChunk,
|
|
31
32
|
TreeNavigationResult,
|
|
32
33
|
type TreeNodeSchemaIdentifier,
|
|
33
34
|
type TreeStoredSchemaSubscription,
|
|
@@ -46,6 +47,7 @@ import {
|
|
|
46
47
|
} from "../../util/index.js";
|
|
47
48
|
import { cursorForMapTreeNode, mapTreeFromCursor } from "../mapTreeCursor.js";
|
|
48
49
|
import { type CursorWithNode, SynchronousCursor } from "../treeCursorUtils.js";
|
|
50
|
+
import { chunkFieldSingle, defaultChunkPolicy } from "../chunked-forest/index.js";
|
|
49
51
|
|
|
50
52
|
/** A `MapTree` with mutable fields */
|
|
51
53
|
interface MutableMapTree extends MapTree {
|
|
@@ -107,6 +109,10 @@ export class ObjectForest implements IEditableForest {
|
|
|
107
109
|
return new ObjectForest(anchors, this.additionalAsserts, this.roots);
|
|
108
110
|
}
|
|
109
111
|
|
|
112
|
+
public chunkField(cursor: ITreeCursorSynchronous): TreeChunk {
|
|
113
|
+
return chunkFieldSingle(cursor, { idCompressor: undefined, policy: defaultChunkPolicy });
|
|
114
|
+
}
|
|
115
|
+
|
|
110
116
|
public forgetAnchor(anchor: Anchor): void {
|
|
111
117
|
this.anchors.forget(anchor);
|
|
112
118
|
}
|
|
@@ -163,7 +169,7 @@ export class ObjectForest implements IEditableForest {
|
|
|
163
169
|
preEdit();
|
|
164
170
|
this.forest.delete(detachedField);
|
|
165
171
|
}
|
|
166
|
-
public create(content:
|
|
172
|
+
public create(content: readonly ITreeCursorSynchronous[], destination: FieldKey): void {
|
|
167
173
|
preEdit();
|
|
168
174
|
this.forest.add(content, destination);
|
|
169
175
|
this.forest.#events.emit("afterRootFieldCreated", destination);
|
|
@@ -172,7 +178,7 @@ export class ObjectForest implements IEditableForest {
|
|
|
172
178
|
preEdit();
|
|
173
179
|
this.attachEdit(source, count, destination);
|
|
174
180
|
}
|
|
175
|
-
public detach(source: Range, destination: FieldKey): void {
|
|
181
|
+
public detach(source: Range, destination: FieldKey, id: DeltaDetachedNodeId): void {
|
|
176
182
|
preEdit();
|
|
177
183
|
this.detachEdit(source, destination);
|
|
178
184
|
}
|
|
@@ -235,6 +241,7 @@ export class ObjectForest implements IEditableForest {
|
|
|
235
241
|
newContentSource: FieldKey,
|
|
236
242
|
range: Range,
|
|
237
243
|
oldContentDestination: FieldKey,
|
|
244
|
+
oldContentId: DeltaDetachedNodeId,
|
|
238
245
|
): void {
|
|
239
246
|
preEdit();
|
|
240
247
|
assert(
|
|
@@ -182,7 +182,7 @@ class StackCursor<TNode> extends SynchronousCursor implements CursorWithNode<TNo
|
|
|
182
182
|
const siblings = this.getField();
|
|
183
183
|
if (!(index in siblings)) {
|
|
184
184
|
throw new UsageError(
|
|
185
|
-
|
|
185
|
+
`A child does not exist at index '${index}' in field containing ${siblings.length} nodes.`,
|
|
186
186
|
);
|
|
187
187
|
}
|
|
188
188
|
this.siblingStack.push(this.siblings);
|
package/src/index.ts
CHANGED
|
@@ -216,6 +216,12 @@ export {
|
|
|
216
216
|
type TransactionResultSuccess,
|
|
217
217
|
type TransactionResultFailed,
|
|
218
218
|
rollback,
|
|
219
|
+
generateSchemaFromSimpleSchema,
|
|
220
|
+
evaluateLazySchema,
|
|
221
|
+
replaceConciseTreeHandles,
|
|
222
|
+
replaceHandles,
|
|
223
|
+
replaceVerboseTreeHandles,
|
|
224
|
+
type HandleConverter,
|
|
219
225
|
} from "./simple-tree/index.js";
|
|
220
226
|
export {
|
|
221
227
|
SharedTree,
|
|
@@ -233,15 +239,18 @@ export {
|
|
|
233
239
|
export { noopValidator } from "./codec/index.js";
|
|
234
240
|
export { typeboxValidator } from "./external-utilities/index.js";
|
|
235
241
|
|
|
236
|
-
export {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
export type {
|
|
243
|
+
RestrictiveReadonlyRecord,
|
|
244
|
+
RestrictiveStringRecord,
|
|
245
|
+
MakeNominal,
|
|
246
|
+
IsUnion,
|
|
247
|
+
UnionToIntersection,
|
|
248
|
+
UnionToTuple,
|
|
249
|
+
PopUnion,
|
|
250
|
+
JsonCompatible,
|
|
251
|
+
JsonCompatibleObject,
|
|
244
252
|
} from "./util/index.js";
|
|
253
|
+
export { cloneWithReplacements } from "./util/index.js";
|
|
245
254
|
|
|
246
255
|
import * as InternalTypes from "./internalTypes.js";
|
|
247
256
|
export {
|
|
@@ -257,7 +266,5 @@ export {
|
|
|
257
266
|
// The inferred type of 'NodeMap' cannot be named without a reference to '../../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.
|
|
258
267
|
export type { MapNodeInsertableData } from "./simple-tree/index.js";
|
|
259
268
|
|
|
260
|
-
export type { JsonCompatible, JsonCompatibleObject } from "./util/index.js";
|
|
261
|
-
|
|
262
269
|
export { JsonAsTree } from "./jsonDomainSchema.js";
|
|
263
270
|
export { FluidSerializableAsTree } from "./serializableDomainSchema.js";
|
package/src/packageVersion.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { assert } from "@fluidframework/core-utils/internal";
|
|
|
7
7
|
import {
|
|
8
8
|
type Context,
|
|
9
9
|
type FlexTreeField,
|
|
10
|
-
type
|
|
10
|
+
type NodeIdentifierManager,
|
|
11
11
|
getTreeContext,
|
|
12
12
|
type FlexTreeHydratedContext,
|
|
13
13
|
type FullSchemaPolicy,
|
|
@@ -43,7 +43,7 @@ export class CheckoutFlexTreeView<out TCheckout extends ITreeCheckout = ITreeChe
|
|
|
43
43
|
*/
|
|
44
44
|
public readonly checkout: TCheckout,
|
|
45
45
|
public readonly schema: FullSchemaPolicy,
|
|
46
|
-
public readonly nodeKeyManager:
|
|
46
|
+
public readonly nodeKeyManager: NodeIdentifierManager,
|
|
47
47
|
private readonly onDispose?: () => void,
|
|
48
48
|
) {
|
|
49
49
|
this.context = getTreeContext(schema, this.checkout, nodeKeyManager);
|
|
@@ -14,19 +14,15 @@ import {
|
|
|
14
14
|
type RevisionTag,
|
|
15
15
|
RevisionTagCodec,
|
|
16
16
|
TreeStoredSchemaRepository,
|
|
17
|
-
initializeForest,
|
|
18
|
-
type ITreeCursorSynchronous,
|
|
19
|
-
mapCursorField,
|
|
20
17
|
} from "../core/index.js";
|
|
21
18
|
import {
|
|
22
|
-
|
|
19
|
+
createNodeIdentifierManager,
|
|
23
20
|
makeFieldBatchCodec,
|
|
24
21
|
makeSchemaCodec,
|
|
25
22
|
type FieldBatchEncodingContext,
|
|
26
23
|
defaultSchemaPolicy,
|
|
27
|
-
chunkTree,
|
|
28
|
-
defaultChunkPolicy,
|
|
29
24
|
TreeCompressionStrategy,
|
|
25
|
+
initializeForest,
|
|
30
26
|
} from "../feature-libraries/index.js";
|
|
31
27
|
// eslint-disable-next-line import/no-internal-modules
|
|
32
28
|
import type { Format } from "../feature-libraries/schema-index/format.js";
|
|
@@ -73,7 +69,7 @@ export function independentView<const TSchema extends ImplicitFieldSchema>(
|
|
|
73
69
|
const out: TreeViewAlpha<TSchema> = new SchematizingSimpleTreeView<TSchema>(
|
|
74
70
|
checkout,
|
|
75
71
|
config,
|
|
76
|
-
|
|
72
|
+
createNodeIdentifierManager(idCompressor),
|
|
77
73
|
);
|
|
78
74
|
return out;
|
|
79
75
|
}
|
|
@@ -116,9 +112,7 @@ export function independentInitializedView<const TSchema extends ImplicitFieldSc
|
|
|
116
112
|
assert(fieldCursors.length === 1, 0xa5b /* must have exactly 1 field in batch */);
|
|
117
113
|
// Checked above.
|
|
118
114
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
initializeForest(forest, cursors, revisionTagCodec, idCompressor, false);
|
|
115
|
+
initializeForest(forest, fieldCursors[0]!, revisionTagCodec, idCompressor, false);
|
|
122
116
|
|
|
123
117
|
const checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {
|
|
124
118
|
forest,
|
|
@@ -127,29 +121,11 @@ export function independentInitializedView<const TSchema extends ImplicitFieldSc
|
|
|
127
121
|
const out: TreeViewAlpha<TSchema> = new SchematizingSimpleTreeView<TSchema>(
|
|
128
122
|
checkout,
|
|
129
123
|
config,
|
|
130
|
-
|
|
124
|
+
createNodeIdentifierManager(idCompressor),
|
|
131
125
|
);
|
|
132
126
|
return out;
|
|
133
127
|
}
|
|
134
128
|
|
|
135
|
-
function fieldCursorToNodesCursors(
|
|
136
|
-
fieldCursor: ITreeCursorSynchronous,
|
|
137
|
-
): ITreeCursorSynchronous[] {
|
|
138
|
-
return mapCursorField(fieldCursor, copyNodeCursor);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* TODO: avoid needing this, or optimize it.
|
|
143
|
-
*/
|
|
144
|
-
function copyNodeCursor(cursor: ITreeCursorSynchronous): ITreeCursorSynchronous {
|
|
145
|
-
const copy = chunkTree(cursor, {
|
|
146
|
-
policy: defaultChunkPolicy,
|
|
147
|
-
idCompressor: undefined,
|
|
148
|
-
}).cursor();
|
|
149
|
-
copy.enterNode(0);
|
|
150
|
-
return copy;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
129
|
/**
|
|
154
130
|
* The portion of SharedTree data typically persisted by the container.
|
|
155
131
|
* Usable with {@link independentInitializedView} to create a {@link TreeView}
|
package/src/shared-tree/index.ts
CHANGED
|
@@ -180,6 +180,7 @@ export function initialize(checkout: ITreeCheckout, treeContent: TreeStoredConte
|
|
|
180
180
|
initializeContent(checkout, treeContent.schema, () => {
|
|
181
181
|
const field = { field: rootFieldKey, parent: undefined };
|
|
182
182
|
const content = normalizeNewFieldContent(treeContent.initialTree);
|
|
183
|
+
const contentChunk = checkout.forest.chunkField(content);
|
|
183
184
|
|
|
184
185
|
switch (checkout.storedSchema.rootFieldSchema.kind) {
|
|
185
186
|
case FieldKinds.optional.identifier: {
|
|
@@ -188,13 +189,13 @@ export function initialize(checkout: ITreeCheckout, treeContent: TreeStoredConte
|
|
|
188
189
|
content.getFieldLength() <= 1,
|
|
189
190
|
0x7f4 /* optional field content should normalize at most one item */,
|
|
190
191
|
);
|
|
191
|
-
fieldEditor.set(
|
|
192
|
+
fieldEditor.set(contentChunk.topLevelLength === 0 ? undefined : contentChunk, true);
|
|
192
193
|
break;
|
|
193
194
|
}
|
|
194
195
|
case FieldKinds.sequence.identifier: {
|
|
195
196
|
const fieldEditor = checkout.editor.sequenceField(field);
|
|
196
197
|
// TODO: should do an idempotent edit here.
|
|
197
|
-
fieldEditor.insert(0,
|
|
198
|
+
fieldEditor.insert(0, contentChunk);
|
|
198
199
|
break;
|
|
199
200
|
}
|
|
200
201
|
default: {
|
|
@@ -14,7 +14,7 @@ import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
|
14
14
|
|
|
15
15
|
import { AllowedUpdateType, anchorSlot, type SchemaPolicy } from "../core/index.js";
|
|
16
16
|
import {
|
|
17
|
-
type
|
|
17
|
+
type NodeIdentifierManager,
|
|
18
18
|
defaultSchemaPolicy,
|
|
19
19
|
ContextSlot,
|
|
20
20
|
cursorForMapTreeNode,
|
|
@@ -117,7 +117,7 @@ export class SchematizingSimpleTreeView<
|
|
|
117
117
|
public constructor(
|
|
118
118
|
public readonly checkout: TreeCheckout,
|
|
119
119
|
public readonly config: TreeViewConfiguration<ReadSchema<TRootSchema>>,
|
|
120
|
-
public readonly nodeKeyManager:
|
|
120
|
+
public readonly nodeKeyManager: NodeIdentifierManager,
|
|
121
121
|
private readonly onDispose?: () => void,
|
|
122
122
|
) {
|
|
123
123
|
this.breaker = checkout.breaker;
|
|
@@ -509,7 +509,7 @@ export function requireSchema(
|
|
|
509
509
|
checkout: ITreeCheckout,
|
|
510
510
|
viewSchema: ViewSchema,
|
|
511
511
|
onDispose: () => void,
|
|
512
|
-
nodeKeyManager:
|
|
512
|
+
nodeKeyManager: NodeIdentifierManager,
|
|
513
513
|
schemaPolicy: FullSchemaPolicy,
|
|
514
514
|
): CheckoutFlexTreeView {
|
|
515
515
|
const slots = checkout.forest.anchors.slots;
|
|
@@ -478,14 +478,7 @@ class SharedTreeKernel extends SharedTreeCore<SharedTreeEditBuilder, SharedTreeC
|
|
|
478
478
|
}
|
|
479
479
|
|
|
480
480
|
public exportSimpleSchema(): SimpleTreeSchema {
|
|
481
|
-
return
|
|
482
|
-
...exportSimpleFieldSchemaStored(this.storedSchema.rootFieldSchema),
|
|
483
|
-
definitions: new Map(
|
|
484
|
-
[...this.storedSchema.nodeSchema].map(([key, schema]) => {
|
|
485
|
-
return [key, exportSimpleNodeSchemaStored(schema)];
|
|
486
|
-
}),
|
|
487
|
-
),
|
|
488
|
-
};
|
|
481
|
+
return exportSimpleSchema(this.storedSchema);
|
|
489
482
|
}
|
|
490
483
|
|
|
491
484
|
@throwIfBroken
|
|
@@ -572,6 +565,17 @@ class SharedTreeKernel extends SharedTreeCore<SharedTreeEditBuilder, SharedTreeC
|
|
|
572
565
|
public onDisconnect(): void {}
|
|
573
566
|
}
|
|
574
567
|
|
|
568
|
+
export function exportSimpleSchema(storedSchema: TreeStoredSchema): SimpleTreeSchema {
|
|
569
|
+
return {
|
|
570
|
+
...exportSimpleFieldSchemaStored(storedSchema.rootFieldSchema),
|
|
571
|
+
definitions: new Map(
|
|
572
|
+
[...storedSchema.nodeSchema].map(([key, schema]) => {
|
|
573
|
+
return [key, exportSimpleNodeSchemaStored(schema)];
|
|
574
|
+
}),
|
|
575
|
+
),
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
|
|
575
579
|
/**
|
|
576
580
|
* Get a {@link BranchableTree} from a {@link ITree}.
|
|
577
581
|
* @remarks The branch can be used for "version control"-style coordination of edits on the tree.
|
|
@@ -770,7 +774,7 @@ function verboseFromCursor(
|
|
|
770
774
|
const nodeSchema =
|
|
771
775
|
schema.get(reader.type) ?? fail(0xac9 /* missing schema for type in cursor */);
|
|
772
776
|
if (nodeSchema instanceof LeafNodeStoredSchema) {
|
|
773
|
-
return fields as CustomTreeValue
|
|
777
|
+
return fields as CustomTreeValue;
|
|
774
778
|
}
|
|
775
779
|
|
|
776
780
|
return {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
7
6
|
import type {
|
|
8
7
|
ChangeFamilyEditor,
|
|
9
8
|
RevisionTag,
|
|
@@ -55,17 +54,12 @@ export class SharedTreeEditBuilder
|
|
|
55
54
|
modularChangeFamily: ModularChangeFamily,
|
|
56
55
|
mintRevisionTag: () => RevisionTag,
|
|
57
56
|
private readonly changeReceiver: (change: TaggedChange<SharedTreeChange>) => void,
|
|
58
|
-
idCompressor?: IIdCompressor,
|
|
59
57
|
) {
|
|
60
|
-
super(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
...taggedChange,
|
|
66
|
-
change: { changes: [{ type: "data", innerChange: taggedChange.change }] },
|
|
67
|
-
}),
|
|
68
|
-
idCompressor,
|
|
58
|
+
super(modularChangeFamily, mintRevisionTag, (taggedChange) =>
|
|
59
|
+
changeReceiver({
|
|
60
|
+
...taggedChange,
|
|
61
|
+
change: { changes: [{ type: "data", innerChange: taggedChange.change }] },
|
|
62
|
+
}),
|
|
69
63
|
);
|
|
70
64
|
|
|
71
65
|
this.schema = {
|
|
@@ -32,7 +32,6 @@ import {
|
|
|
32
32
|
verboseFromCursor,
|
|
33
33
|
type ParseOptions,
|
|
34
34
|
type VerboseTree,
|
|
35
|
-
type VerboseTreeNode,
|
|
36
35
|
toStoredSchema,
|
|
37
36
|
type EncodeOptions,
|
|
38
37
|
extractPersistedSchema,
|
|
@@ -126,65 +125,24 @@ export const TreeAlpha: {
|
|
|
126
125
|
* Construct tree content compatible with a field defined by the provided `schema`.
|
|
127
126
|
* @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.
|
|
128
127
|
* @param data - The data used to construct the field content. See {@link TreeAlpha.(exportVerbose:1)}.
|
|
129
|
-
* @remarks
|
|
130
|
-
* This overload requires that any {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles} are encoded as actual {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles} in the input.
|
|
131
128
|
*/
|
|
132
129
|
importVerbose<const TSchema extends ImplicitFieldSchema>(
|
|
133
130
|
schema: TSchema,
|
|
134
131
|
data: VerboseTree | undefined,
|
|
135
|
-
options?: Partial<ParseOptions
|
|
136
|
-
): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Construct tree content compatible with a field defined by the provided `schema`.
|
|
140
|
-
* @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.
|
|
141
|
-
* @param data - The data used to construct the field content. See {@link TreeAlpha.(exportVerbose:2)}.
|
|
142
|
-
*
|
|
143
|
-
* @typeparam THandle - How {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles} in the input `data` are encoded.
|
|
144
|
-
* A converter from this encoding to {@link @fluidframework/core-interfaces#IFluidHandle} is required in `options`.
|
|
145
|
-
*/
|
|
146
|
-
importVerbose<const TSchema extends ImplicitFieldSchema, THandle>(
|
|
147
|
-
schema: TSchema,
|
|
148
|
-
data: VerboseTree<THandle> | undefined,
|
|
149
|
-
options: ParseOptions<THandle>,
|
|
132
|
+
options?: Partial<ParseOptions>,
|
|
150
133
|
): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
151
134
|
|
|
152
|
-
/**
|
|
153
|
-
* Same as {@link TreeAlpha.(exportConcise:2)}, except leaves handles as is.
|
|
154
|
-
*/
|
|
155
|
-
exportConcise(
|
|
156
|
-
node: TreeNode | TreeLeafValue,
|
|
157
|
-
options?: Partial<EncodeOptions<IFluidHandle>>,
|
|
158
|
-
): ConciseTree;
|
|
159
|
-
|
|
160
135
|
/**
|
|
161
136
|
* Copy a snapshot of the current version of a TreeNode into a {@link ConciseTree}.
|
|
162
|
-
*
|
|
163
|
-
* @typeparam THandle - How {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles} in the output should be encoded.
|
|
164
|
-
* A converter from from {@link @fluidframework/core-interfaces#IFluidHandle} to this format is required in `options`.
|
|
165
137
|
*/
|
|
166
|
-
exportConcise
|
|
167
|
-
node: TreeNode | TreeLeafValue,
|
|
168
|
-
options: EncodeOptions<THandle>,
|
|
169
|
-
): ConciseTree<THandle>;
|
|
138
|
+
exportConcise(node: TreeNode | TreeLeafValue, options?: EncodeOptions): ConciseTree;
|
|
170
139
|
|
|
171
140
|
/**
|
|
172
|
-
*
|
|
173
|
-
|
|
174
|
-
exportVerbose(
|
|
175
|
-
node: TreeNode | TreeLeafValue,
|
|
176
|
-
options?: Partial<EncodeOptions<IFluidHandle>>,
|
|
177
|
-
): VerboseTree;
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Copy a snapshot of the current version of a TreeNode into a JSON compatible plain old JavaScript Object.
|
|
181
|
-
* Verbose tree format, with explicit type on every node.
|
|
182
|
-
*
|
|
183
|
-
* @typeparam THandle - How {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles} in the output should be encoded.
|
|
184
|
-
* A converter from from {@link @fluidframework/core-interfaces#IFluidHandle} to this format is required in `options`.
|
|
141
|
+
* Copy a snapshot of the current version of a TreeNode into a JSON compatible plain old JavaScript Object (except for {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles}).
|
|
142
|
+
* Uses the {@link VerboseTree} format, with an explicit type on every node.
|
|
185
143
|
*
|
|
186
144
|
* @remarks
|
|
187
|
-
* There are several cases this may be preferred to {@link TreeAlpha.
|
|
145
|
+
* There are several cases this may be preferred to {@link TreeAlpha.exportConcise}:
|
|
188
146
|
*
|
|
189
147
|
* 1. When not using {@link ITreeConfigurationOptions.preventAmbiguity} (or when using `useStableFieldKeys`), `exportConcise` can produce ambiguous data (the type may be unclear on some nodes).
|
|
190
148
|
* `exportVerbose` will always be unambiguous and thus lossless.
|
|
@@ -193,7 +151,7 @@ export const TreeAlpha: {
|
|
|
193
151
|
*
|
|
194
152
|
* 3. When easy access to the type is desired.
|
|
195
153
|
*/
|
|
196
|
-
exportVerbose
|
|
154
|
+
exportVerbose(node: TreeNode | TreeLeafValue, options?: EncodeOptions): VerboseTree;
|
|
197
155
|
|
|
198
156
|
/**
|
|
199
157
|
* Export the content of the provided `tree` in a compressed JSON compatible format.
|
|
@@ -274,17 +232,12 @@ export const TreeAlpha: {
|
|
|
274
232
|
>;
|
|
275
233
|
},
|
|
276
234
|
|
|
277
|
-
importVerbose<const TSchema extends ImplicitFieldSchema
|
|
235
|
+
importVerbose<const TSchema extends ImplicitFieldSchema>(
|
|
278
236
|
schema: TSchema,
|
|
279
|
-
data: VerboseTree
|
|
280
|
-
options?:
|
|
237
|
+
data: VerboseTree | undefined,
|
|
238
|
+
options?: ParseOptions,
|
|
281
239
|
): Unhydrated<TreeFieldFromImplicitField<TSchema>> {
|
|
282
|
-
const config: ParseOptions
|
|
283
|
-
valueConverter: (input: VerboseTree<THandle>) => {
|
|
284
|
-
return input as TreeLeafValue | VerboseTreeNode<THandle>;
|
|
285
|
-
},
|
|
286
|
-
...options,
|
|
287
|
-
};
|
|
240
|
+
const config: ParseOptions = { ...options };
|
|
288
241
|
// Create a config which is standalone, and thus can be used without having to refer back to the schema.
|
|
289
242
|
const schemalessConfig = applySchemaToParserOptions(schema, config);
|
|
290
243
|
if (data === undefined) {
|
|
@@ -294,20 +247,12 @@ export const TreeAlpha: {
|
|
|
294
247
|
}
|
|
295
248
|
return undefined as Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
296
249
|
}
|
|
297
|
-
const cursor = cursorFromVerbose
|
|
250
|
+
const cursor = cursorFromVerbose(data, schemalessConfig);
|
|
298
251
|
return createFromCursor(schema, cursor);
|
|
299
252
|
},
|
|
300
253
|
|
|
301
|
-
exportConcise
|
|
302
|
-
|
|
303
|
-
options?: Partial<EncodeOptions<T>>,
|
|
304
|
-
): ConciseTree<T> {
|
|
305
|
-
const config: EncodeOptions<T> = {
|
|
306
|
-
valueConverter(handle: IFluidHandle): T {
|
|
307
|
-
return handle as T;
|
|
308
|
-
},
|
|
309
|
-
...options,
|
|
310
|
-
};
|
|
254
|
+
exportConcise(node: TreeNode | TreeLeafValue, options?: EncodeOptions): ConciseTree {
|
|
255
|
+
const config: EncodeOptions = { ...options };
|
|
311
256
|
|
|
312
257
|
const cursor = borrowCursorFromTreeNodeOrValue(node);
|
|
313
258
|
return conciseFromCursor(
|
|
@@ -317,16 +262,8 @@ export const TreeAlpha: {
|
|
|
317
262
|
);
|
|
318
263
|
},
|
|
319
264
|
|
|
320
|
-
exportVerbose
|
|
321
|
-
|
|
322
|
-
options?: Partial<EncodeOptions<T>>,
|
|
323
|
-
): VerboseTree<T> {
|
|
324
|
-
const config: EncodeOptions<T> = {
|
|
325
|
-
valueConverter(handle: IFluidHandle): T {
|
|
326
|
-
return handle as T;
|
|
327
|
-
},
|
|
328
|
-
...options,
|
|
329
|
-
};
|
|
265
|
+
exportVerbose(node: TreeNode | TreeLeafValue, options?: EncodeOptions): VerboseTree {
|
|
266
|
+
const config: EncodeOptions = { ...options };
|
|
330
267
|
|
|
331
268
|
const cursor = borrowCursorFromTreeNodeOrValue(node);
|
|
332
269
|
return verboseFromCursor(
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
type FieldBatchCodec,
|
|
48
48
|
type TreeCompressionStrategy,
|
|
49
49
|
buildForest,
|
|
50
|
-
|
|
50
|
+
createNodeIdentifierManager,
|
|
51
51
|
intoDelta,
|
|
52
52
|
jsonableTreeFromCursor,
|
|
53
53
|
makeFieldBatchCodec,
|
|
@@ -662,7 +662,7 @@ export class TreeCheckout implements ITreeCheckoutFork {
|
|
|
662
662
|
const view = new SchematizingSimpleTreeView(
|
|
663
663
|
this,
|
|
664
664
|
config,
|
|
665
|
-
|
|
665
|
+
createNodeIdentifierManager(this.idCompressor),
|
|
666
666
|
() => {
|
|
667
667
|
this.views.delete(view);
|
|
668
668
|
},
|