@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
|
@@ -2,8 +2,26 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* An object which counts the number of users / references to it.
|
|
7
|
+
* @remarks
|
|
8
|
+
* This implements the [Reference counting](https://en.wikipedia.org/wiki/Reference_counting) pattern.
|
|
9
|
+
* Getting the reference count correct is difficult in TypeScript and great care must be used.
|
|
10
|
+
* Because of this, this interface should not be used in the public API.
|
|
11
|
+
*/
|
|
5
12
|
export interface ReferenceCounted {
|
|
13
|
+
/**
|
|
14
|
+
* Called to increase the reference count tracked by this object.
|
|
15
|
+
* @remarks
|
|
16
|
+
* When a user of this object allows something else to use it,
|
|
17
|
+
* this should be called.
|
|
18
|
+
*/
|
|
6
19
|
referenceAdded(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Called to decrease the reference count tracked by this object.
|
|
22
|
+
* @remarks
|
|
23
|
+
* When a user of this object will no longer use it, this should be called.
|
|
24
|
+
*/
|
|
7
25
|
referenceRemoved(): void;
|
|
8
26
|
/**
|
|
9
27
|
* @returns true if mutating this object may impact other users of it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"referenceCounting.d.ts","sourceRoot":"","sources":["../../src/util/referenceCounting.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,gBAAgB;IAChC,cAAc,IAAI,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"referenceCounting.d.ts","sourceRoot":"","sources":["../../src/util/referenceCounting.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;OAKG;IACH,cAAc,IAAI,IAAI,CAAC;IACvB;;;;OAIG;IACH,gBAAgB,IAAI,IAAI,CAAC;IAEzB;;;;OAIG;IACH,QAAQ,IAAI,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,8BAAsB,oBAAqB,YAAW,gBAAgB;IAC/C,OAAO,CAAC,QAAQ;IAAtC,SAAS,aAAqB,QAAQ,GAAE,MAAU;IAE3C,cAAc,CAAC,KAAK,SAAI,GAAG,IAAI;IAI/B,gBAAgB,CAAC,KAAK,SAAI,GAAG,IAAI;IAQjC,QAAQ,IAAI,OAAO;IAInB,cAAc,IAAI,OAAO;IAIhC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,cAAc,IAAI,IAAI;CACzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"referenceCounting.js","sourceRoot":"","sources":["../../src/util/referenceCounting.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"referenceCounting.js","sourceRoot":"","sources":["../../src/util/referenceCounting.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAgC7D;;GAEG;AACH,MAAM,OAAgB,oBAAoB;IACzC,YAA8B,WAAmB,CAAC;QAApB,aAAQ,GAAR,QAAQ,CAAY;IAAG,CAAC;IAE/C,cAAc,CAAC,KAAK,GAAG,CAAC;QAC9B,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;IACxB,CAAC;IAEM,gBAAgB,CAAC,KAAK,GAAG,CAAC;QAChC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;QACvB,MAAM,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC3D,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,cAAc,EAAE,CAAC;QACvB,CAAC;IACF,CAAC;IAEM,QAAQ;QACd,OAAO,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC1B,CAAC;IAEM,cAAc;QACpB,OAAO,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC;IAC5B,CAAC;CAMD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\n/**\n * An object which counts the number of users / references to it.\n * @remarks\n * This implements the [Reference counting](https://en.wikipedia.org/wiki/Reference_counting) pattern.\n * Getting the reference count correct is difficult in TypeScript and great care must be used.\n * Because of this, this interface should not be used in the public API.\n */\nexport interface ReferenceCounted {\n\t/**\n\t * Called to increase the reference count tracked by this object.\n\t * @remarks\n\t * When a user of this object allows something else to use it,\n\t * this should be called.\n\t */\n\treferenceAdded(): void;\n\t/**\n\t * Called to decrease the reference count tracked by this object.\n\t * @remarks\n\t * When a user of this object will no longer use it, this should be called.\n\t */\n\treferenceRemoved(): void;\n\n\t/**\n\t * @returns true if mutating this object may impact other users of it.\n\t *\n\t * Implementations can return true if the refcount is 1 OR the content is logically immutable.\n\t */\n\tisShared(): boolean;\n}\n\n/**\n * Base class to assist with implementing ReferenceCounted.\n */\nexport abstract class ReferenceCountedBase implements ReferenceCounted {\n\tprotected constructor(private refCount: number = 1) {}\n\n\tpublic referenceAdded(count = 1): void {\n\t\tthis.refCount += count;\n\t}\n\n\tpublic referenceRemoved(count = 1): void {\n\t\tthis.refCount -= count;\n\t\tassert(this.refCount >= 0, 0x4c4 /* Negative ref count */);\n\t\tif (this.refCount === 0) {\n\t\t\tthis.onUnreferenced();\n\t\t}\n\t}\n\n\tpublic isShared(): boolean {\n\t\treturn this.refCount > 1;\n\t}\n\n\tpublic isUnreferenced(): boolean {\n\t\treturn this.refCount === 0;\n\t}\n\n\t/**\n\t * Called when refcount reaches 0.\n\t */\n\tprotected abstract onUnreferenced(): void;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/tree",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.30.0",
|
|
4
4
|
"description": "Distributed tree",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -89,17 +89,17 @@
|
|
|
89
89
|
"temp-directory": "nyc/.nyc_output"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@fluid-internal/client-utils": "~2.
|
|
93
|
-
"@fluidframework/container-runtime": "~2.
|
|
94
|
-
"@fluidframework/core-interfaces": "~2.
|
|
95
|
-
"@fluidframework/core-utils": "~2.
|
|
96
|
-
"@fluidframework/datastore-definitions": "~2.
|
|
97
|
-
"@fluidframework/driver-definitions": "~2.
|
|
98
|
-
"@fluidframework/id-compressor": "~2.
|
|
99
|
-
"@fluidframework/runtime-definitions": "~2.
|
|
100
|
-
"@fluidframework/runtime-utils": "~2.
|
|
101
|
-
"@fluidframework/shared-object-base": "~2.
|
|
102
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
92
|
+
"@fluid-internal/client-utils": "~2.30.0",
|
|
93
|
+
"@fluidframework/container-runtime": "~2.30.0",
|
|
94
|
+
"@fluidframework/core-interfaces": "~2.30.0",
|
|
95
|
+
"@fluidframework/core-utils": "~2.30.0",
|
|
96
|
+
"@fluidframework/datastore-definitions": "~2.30.0",
|
|
97
|
+
"@fluidframework/driver-definitions": "~2.30.0",
|
|
98
|
+
"@fluidframework/id-compressor": "~2.30.0",
|
|
99
|
+
"@fluidframework/runtime-definitions": "~2.30.0",
|
|
100
|
+
"@fluidframework/runtime-utils": "~2.30.0",
|
|
101
|
+
"@fluidframework/shared-object-base": "~2.30.0",
|
|
102
|
+
"@fluidframework/telemetry-utils": "~2.30.0",
|
|
103
103
|
"@sinclair/typebox": "^0.34.13",
|
|
104
104
|
"@tylerbu/sorted-btree-es6": "^1.8.0",
|
|
105
105
|
"@types/ungap__structured-clone": "^1.2.0",
|
|
@@ -109,20 +109,20 @@
|
|
|
109
109
|
"devDependencies": {
|
|
110
110
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
111
111
|
"@biomejs/biome": "~1.9.3",
|
|
112
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
113
|
-
"@fluid-private/stochastic-test-utils": "~2.
|
|
114
|
-
"@fluid-private/test-dds-utils": "~2.
|
|
115
|
-
"@fluid-private/test-drivers": "~2.
|
|
112
|
+
"@fluid-internal/mocha-test-setup": "~2.30.0",
|
|
113
|
+
"@fluid-private/stochastic-test-utils": "~2.30.0",
|
|
114
|
+
"@fluid-private/test-dds-utils": "~2.30.0",
|
|
115
|
+
"@fluid-private/test-drivers": "~2.30.0",
|
|
116
116
|
"@fluid-tools/benchmark": "^0.50.0",
|
|
117
117
|
"@fluid-tools/build-cli": "^0.54.0",
|
|
118
118
|
"@fluidframework/build-common": "^2.0.3",
|
|
119
119
|
"@fluidframework/build-tools": "^0.54.0",
|
|
120
|
-
"@fluidframework/container-definitions": "~2.
|
|
121
|
-
"@fluidframework/container-loader": "~2.
|
|
120
|
+
"@fluidframework/container-definitions": "~2.30.0",
|
|
121
|
+
"@fluidframework/container-loader": "~2.30.0",
|
|
122
122
|
"@fluidframework/eslint-config-fluid": "^5.7.3",
|
|
123
|
-
"@fluidframework/test-runtime-utils": "~2.
|
|
124
|
-
"@fluidframework/test-utils": "~2.
|
|
125
|
-
"@fluidframework/tree-previous": "npm:@fluidframework/tree@2.
|
|
123
|
+
"@fluidframework/test-runtime-utils": "~2.30.0",
|
|
124
|
+
"@fluidframework/test-utils": "~2.30.0",
|
|
125
|
+
"@fluidframework/tree-previous": "npm:@fluidframework/tree@2.23.0",
|
|
126
126
|
"@microsoft/api-extractor": "7.47.8",
|
|
127
127
|
"@types/diff": "^3.5.1",
|
|
128
128
|
"@types/easy-table": "^0.0.32",
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
"easy-table": "^1.1.1",
|
|
141
141
|
"eslint": "~8.55.0",
|
|
142
142
|
"eslint-config-prettier": "~9.0.0",
|
|
143
|
-
"mocha": "^10.2
|
|
143
|
+
"mocha": "^10.8.2",
|
|
144
144
|
"mocha-multi-reporters": "^1.5.1",
|
|
145
145
|
"moment": "^2.21.0",
|
|
146
146
|
"prettier": "~3.0.3",
|
|
@@ -3,22 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { SessionSpaceCompressedId, IIdCompressor } from "@fluidframework/id-compressor";
|
|
7
|
-
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
|
-
|
|
9
|
-
import type { RevisionTagCodec } from "../rebase/index.js";
|
|
10
6
|
import type { FieldKey } from "../schema-stored/index.js";
|
|
11
|
-
import {
|
|
12
|
-
type Anchor,
|
|
13
|
-
type DeltaRoot,
|
|
14
|
-
type DeltaVisitor,
|
|
15
|
-
type DetachedField,
|
|
16
|
-
type ITreeCursorSynchronous,
|
|
17
|
-
combineVisitors,
|
|
18
|
-
deltaForRootInitialization,
|
|
19
|
-
makeDetachedFieldIndex,
|
|
20
|
-
visitDelta,
|
|
21
|
-
} from "../tree/index.js";
|
|
7
|
+
import type { Anchor, DeltaVisitor, DetachedField } from "../tree/index.js";
|
|
22
8
|
|
|
23
9
|
import type { IForestSubscription, ITreeSubscriptionCursor } from "./forest.js";
|
|
24
10
|
|
|
@@ -39,43 +25,6 @@ export interface IEditableForest extends IForestSubscription {
|
|
|
39
25
|
acquireVisitor(): DeltaVisitor;
|
|
40
26
|
}
|
|
41
27
|
|
|
42
|
-
/**
|
|
43
|
-
* Initializes the given forest with the given content.
|
|
44
|
-
* @remarks The forest must be empty when this function is called.
|
|
45
|
-
* This does not perform an edit in the typical sense.
|
|
46
|
-
* Instead, it creates a delta expressing a creation and insertion of the `content` under the {@link rootFieldKey}, and then applies the delta to the forest.
|
|
47
|
-
* If `visitAnchors` is enabled, then the delta will also be applied to the forest's {@link AnchorSet} (in which case there must be no existing anchors when this function is called).
|
|
48
|
-
*
|
|
49
|
-
* @remarks
|
|
50
|
-
* This does not perform an edit: it updates the forest content as if there was an edit that did that.
|
|
51
|
-
*/
|
|
52
|
-
export function initializeForest(
|
|
53
|
-
forest: IEditableForest,
|
|
54
|
-
content: readonly ITreeCursorSynchronous[],
|
|
55
|
-
revisionTagCodec: RevisionTagCodec,
|
|
56
|
-
idCompressor: IIdCompressor,
|
|
57
|
-
visitAnchors = false,
|
|
58
|
-
): void {
|
|
59
|
-
assert(forest.isEmpty, 0x747 /* forest must be empty */);
|
|
60
|
-
const delta: DeltaRoot = deltaForRootInitialization(content);
|
|
61
|
-
let visitor = forest.acquireVisitor();
|
|
62
|
-
if (visitAnchors) {
|
|
63
|
-
assert(forest.anchors.isEmpty(), 0x9b7 /* anchor set must be empty */);
|
|
64
|
-
const anchorVisitor = forest.anchors.acquireVisitor();
|
|
65
|
-
visitor = combineVisitors([visitor, anchorVisitor]);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// any detached trees built here are immediately attached so the revision used here doesn't matter
|
|
69
|
-
// we use a dummy revision to make correctness checks in the detached field index easier
|
|
70
|
-
visitDelta(
|
|
71
|
-
delta,
|
|
72
|
-
visitor,
|
|
73
|
-
makeDetachedFieldIndex("init", revisionTagCodec, idCompressor),
|
|
74
|
-
0 as SessionSpaceCompressedId,
|
|
75
|
-
);
|
|
76
|
-
visitor.free();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
28
|
// TODO: Types below here may be useful for input into edit building APIs, but are no longer used here directly.
|
|
80
29
|
|
|
81
30
|
/**
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
type DetachedField,
|
|
15
15
|
type ITreeCursor,
|
|
16
16
|
type ITreeCursorSynchronous,
|
|
17
|
+
type TreeChunk,
|
|
17
18
|
type UpPath,
|
|
18
19
|
detachedFieldAsKey,
|
|
19
20
|
rootField,
|
|
@@ -82,6 +83,17 @@ export interface IForestSubscription {
|
|
|
82
83
|
*/
|
|
83
84
|
clone(schema: TreeStoredSchemaSubscription, anchors: AnchorSet): IEditableForest;
|
|
84
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Generate a TreeChunk for the content in the given field cursor.
|
|
88
|
+
* This can be used to chunk data that is then inserted into the forest.
|
|
89
|
+
*
|
|
90
|
+
* @remarks
|
|
91
|
+
* Like {@link chunkField}, but forces the results into a single TreeChunk.
|
|
92
|
+
* While any TreeChunk is compatible with any forest, this method creates one optimized for this specific forest.
|
|
93
|
+
* The provided data must be compatible with the forest's current schema.
|
|
94
|
+
*/
|
|
95
|
+
chunkField(cursor: ITreeCursorSynchronous): TreeChunk;
|
|
96
|
+
|
|
85
97
|
/**
|
|
86
98
|
* Allocates a cursor in the "cleared" state.
|
|
87
99
|
* @param source - optional string identifying the source of the cursor for debugging purposes when cursors are not properly cleaned up.
|
|
@@ -112,7 +124,7 @@ export interface IForestSubscription {
|
|
|
112
124
|
): TreeNavigationResult;
|
|
113
125
|
|
|
114
126
|
/**
|
|
115
|
-
* Set `cursorToMove` to
|
|
127
|
+
* Set `cursorToMove` to the {@link CursorLocationType.node} described by path.
|
|
116
128
|
* This is NOT a relative move: current position is discarded.
|
|
117
129
|
* Path must point to existing node.
|
|
118
130
|
*/
|
|
@@ -147,6 +159,7 @@ export interface IForestSubscription {
|
|
|
147
159
|
}
|
|
148
160
|
|
|
149
161
|
/**
|
|
162
|
+
* Returns an anchor to the given field.
|
|
150
163
|
* @param field - defaults to {@link rootField}.
|
|
151
164
|
* @returns anchor to `field`.
|
|
152
165
|
*/
|
|
@@ -158,8 +171,10 @@ export function rootAnchor(field: DetachedField = rootField): FieldAnchor {
|
|
|
158
171
|
}
|
|
159
172
|
|
|
160
173
|
/**
|
|
174
|
+
* Moves the given cursor to the given detached fields in the given forest.
|
|
175
|
+
* @param forest - forest to move cursor in.
|
|
176
|
+
* @param cursorToMove - cursor to move, must be allocated by the given forest
|
|
161
177
|
* @param field - defaults to {@link rootField}.
|
|
162
|
-
* @returns anchor to `field`.
|
|
163
178
|
*/
|
|
164
179
|
export function moveToDetachedField(
|
|
165
180
|
forest: IForestSubscription,
|
package/src/core/forest/index.ts
CHANGED
package/src/core/index.ts
CHANGED
|
@@ -11,6 +11,9 @@ export {
|
|
|
11
11
|
AnchorSet,
|
|
12
12
|
type DetachedField,
|
|
13
13
|
type UpPath,
|
|
14
|
+
type NormalizedUpPath,
|
|
15
|
+
type INormalizedUpPath,
|
|
16
|
+
type NormalizedFieldUpPath,
|
|
14
17
|
type Range,
|
|
15
18
|
type RangeUpPath,
|
|
16
19
|
type PlaceUpPath,
|
|
@@ -71,6 +74,7 @@ export {
|
|
|
71
74
|
type AnchorNode,
|
|
72
75
|
anchorSlot,
|
|
73
76
|
type UpPathDefault,
|
|
77
|
+
isDetachedUpPath,
|
|
74
78
|
inCursorField,
|
|
75
79
|
inCursorNode,
|
|
76
80
|
type AnchorEvents,
|
|
@@ -83,7 +87,6 @@ export {
|
|
|
83
87
|
getDetachedFieldContainingPath,
|
|
84
88
|
aboveRootPlaceholder,
|
|
85
89
|
type DeltaRoot,
|
|
86
|
-
type DeltaProtoNode,
|
|
87
90
|
type DeltaMark,
|
|
88
91
|
type DeltaDetachedNodeId,
|
|
89
92
|
type DeltaFieldMap,
|
|
@@ -110,7 +113,6 @@ export {
|
|
|
110
113
|
type ForestLocation,
|
|
111
114
|
type ITreeSubscriptionCursor,
|
|
112
115
|
ITreeSubscriptionCursorState,
|
|
113
|
-
initializeForest,
|
|
114
116
|
type FieldAnchor,
|
|
115
117
|
moveToDetachedField,
|
|
116
118
|
type ForestEvents,
|
|
@@ -24,9 +24,18 @@ import {
|
|
|
24
24
|
import type { FieldKey } from "../schema-stored/index.js";
|
|
25
25
|
|
|
26
26
|
import type * as Delta from "./delta.js";
|
|
27
|
-
import
|
|
27
|
+
import {
|
|
28
|
+
isDetachedUpPathRoot,
|
|
29
|
+
type INormalizedUpPath,
|
|
30
|
+
type NormalizedUpPath,
|
|
31
|
+
type PlaceIndex,
|
|
32
|
+
type Range,
|
|
33
|
+
type UpPath,
|
|
34
|
+
} from "./pathTree.js";
|
|
28
35
|
import { EmptyKey } from "./types.js";
|
|
29
36
|
import type { DeltaVisitor } from "./visitDelta.js";
|
|
37
|
+
import { offsetDetachId } from "./deltaUtil.js";
|
|
38
|
+
import type { ITreeCursorSynchronous } from "./cursor.js";
|
|
30
39
|
|
|
31
40
|
/**
|
|
32
41
|
* A way to refer to a particular tree location within an {@link AnchorSet}.
|
|
@@ -198,7 +207,7 @@ export interface AnchorSetRootEvents {
|
|
|
198
207
|
/**
|
|
199
208
|
* Node in a tree of anchors.
|
|
200
209
|
*/
|
|
201
|
-
export interface AnchorNode extends
|
|
210
|
+
export interface AnchorNode extends INormalizedUpPath<AnchorNode> {
|
|
202
211
|
/**
|
|
203
212
|
* Events for this anchor node.
|
|
204
213
|
*/
|
|
@@ -569,6 +578,13 @@ export class AnchorSet implements AnchorLocator {
|
|
|
569
578
|
node.parentIndex += destination.parentIndex - coupleInfo.startParentIndex;
|
|
570
579
|
node.parentPath = destinationPath;
|
|
571
580
|
node.parentField = destination.parentField;
|
|
581
|
+
// If the destination is a detached root, propagate its detachedNodeId, otherwise remove any existing one
|
|
582
|
+
node.detachedNodeId = isDetachedUpPathRoot(destination)
|
|
583
|
+
? offsetDetachId(
|
|
584
|
+
destination.detachedNodeId,
|
|
585
|
+
node.parentIndex - destination.parentIndex,
|
|
586
|
+
)
|
|
587
|
+
: undefined;
|
|
572
588
|
}
|
|
573
589
|
|
|
574
590
|
// Update new parent to add children
|
|
@@ -821,25 +837,34 @@ export class AnchorSet implements AnchorLocator {
|
|
|
821
837
|
this.anchorSet.moveChildren(sourcePath, destinationPath, count);
|
|
822
838
|
this.depthThresholdForSubtreeChanged = this.currentDepth;
|
|
823
839
|
},
|
|
824
|
-
detach(
|
|
840
|
+
detach(
|
|
841
|
+
source: Range,
|
|
842
|
+
destination: FieldKey,
|
|
843
|
+
detachedNodeId: Delta.DetachedNodeId,
|
|
844
|
+
): void {
|
|
825
845
|
this.notifyChildrenChanging();
|
|
826
|
-
this.detachEdit(source, destination);
|
|
846
|
+
this.detachEdit(source, destination, detachedNodeId);
|
|
827
847
|
this.notifyChildrenChanged();
|
|
828
848
|
},
|
|
829
|
-
detachEdit(
|
|
849
|
+
detachEdit(
|
|
850
|
+
source: Range,
|
|
851
|
+
destination: FieldKey,
|
|
852
|
+
detachedNodeId: Delta.DetachedNodeId,
|
|
853
|
+
): void {
|
|
830
854
|
assert(
|
|
831
855
|
this.parentField !== undefined,
|
|
832
856
|
0x7a5 /* Must be in a field in order to detach */,
|
|
833
857
|
);
|
|
834
|
-
const sourcePath = {
|
|
858
|
+
const sourcePath: UpPath = {
|
|
835
859
|
parent: this.parent,
|
|
836
860
|
parentField: this.parentField,
|
|
837
861
|
parentIndex: source.start,
|
|
838
862
|
};
|
|
839
|
-
const destinationPath = {
|
|
863
|
+
const destinationPath: NormalizedUpPath = {
|
|
840
864
|
parent: this.anchorSet.root,
|
|
841
865
|
parentField: destination,
|
|
842
866
|
parentIndex: 0,
|
|
867
|
+
detachedNodeId,
|
|
843
868
|
};
|
|
844
869
|
this.anchorSet.moveChildren(sourcePath, destinationPath, source.end - source.start);
|
|
845
870
|
this.depthThresholdForSubtreeChanged = this.currentDepth;
|
|
@@ -848,9 +873,10 @@ export class AnchorSet implements AnchorLocator {
|
|
|
848
873
|
newContentSource: FieldKey,
|
|
849
874
|
range: Range,
|
|
850
875
|
oldContentDestination: FieldKey,
|
|
876
|
+
destinationDetachedNodeId: Delta.DetachedNodeId,
|
|
851
877
|
): void {
|
|
852
878
|
this.notifyChildrenChanging();
|
|
853
|
-
this.detachEdit(range, oldContentDestination);
|
|
879
|
+
this.detachEdit(range, oldContentDestination, destinationDetachedNodeId);
|
|
854
880
|
this.attachEdit(newContentSource, range.end - range.start, range.start);
|
|
855
881
|
this.notifyChildrenChanged();
|
|
856
882
|
},
|
|
@@ -864,7 +890,7 @@ export class AnchorSet implements AnchorLocator {
|
|
|
864
890
|
count,
|
|
865
891
|
);
|
|
866
892
|
},
|
|
867
|
-
create(content:
|
|
893
|
+
create(content: ITreeCursorSynchronous[], destination: FieldKey): void {
|
|
868
894
|
// Nothing to do since content can only be created in a new detached field,
|
|
869
895
|
// which cannot contain any anchors.
|
|
870
896
|
},
|
|
@@ -969,7 +995,7 @@ enum Status {
|
|
|
969
995
|
* 2. refcount is non-zero.
|
|
970
996
|
* 3. events are registered.
|
|
971
997
|
*/
|
|
972
|
-
class PathNode extends ReferenceCountedBase implements
|
|
998
|
+
class PathNode extends ReferenceCountedBase implements AnchorNode {
|
|
973
999
|
public status: Status = Status.Alive;
|
|
974
1000
|
/**
|
|
975
1001
|
* Event emitter for this anchor.
|
|
@@ -992,6 +1018,11 @@ class PathNode extends ReferenceCountedBase implements UpPath<PathNode>, AnchorN
|
|
|
992
1018
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
993
1019
|
public readonly slots: BrandedMapSubset<AnchorSlot<any>> = new Map();
|
|
994
1020
|
|
|
1021
|
+
/**
|
|
1022
|
+
* {@inheritdoc UpPath.detachedNodeId}
|
|
1023
|
+
*/
|
|
1024
|
+
public detachedNodeId: Delta.DetachedNodeId | undefined;
|
|
1025
|
+
|
|
995
1026
|
/**
|
|
996
1027
|
* Construct a PathNode with refcount 1.
|
|
997
1028
|
* @param anchorSet - used to determine if this PathNode is already part of a specific anchorSet
|
package/src/core/tree/delta.ts
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import type { RevisionTag } from "../rebase/index.js";
|
|
7
7
|
import type { FieldKey } from "../schema-stored/index.js";
|
|
8
|
-
|
|
9
|
-
import type { ITreeCursorSynchronous } from "./cursor.js";
|
|
8
|
+
import type { TreeChunk } from "./chunk.js";
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* This format describes changes that must be applied to a forest in order to update it.
|
|
@@ -70,7 +69,7 @@ import type { ITreeCursorSynchronous } from "./cursor.js";
|
|
|
70
69
|
* Represents the change made to a document.
|
|
71
70
|
* Immutable, therefore safe to retain for async processing.
|
|
72
71
|
*/
|
|
73
|
-
export interface Root<
|
|
72
|
+
export interface Root<TTrees = ProtoNodes> {
|
|
74
73
|
/**
|
|
75
74
|
* Changes to apply to the root fields.
|
|
76
75
|
*/
|
|
@@ -83,7 +82,7 @@ export interface Root<TTree = ProtoNode> {
|
|
|
83
82
|
* For example, if one wishes to build a tree which is being renamed from ID A to ID B,
|
|
84
83
|
* then the build should be listed under ID A.
|
|
85
84
|
*/
|
|
86
|
-
readonly build?: readonly DetachedNodeBuild<
|
|
85
|
+
readonly build?: readonly DetachedNodeBuild<TTrees>[];
|
|
87
86
|
/**
|
|
88
87
|
* New detached nodes to be destroyed.
|
|
89
88
|
* The ordering has no significance.
|
|
@@ -97,7 +96,7 @@ export interface Root<TTree = ProtoNode> {
|
|
|
97
96
|
* Refreshers for detached nodes that may need to be recreated.
|
|
98
97
|
* The ordering has no significance.
|
|
99
98
|
*/
|
|
100
|
-
readonly refreshers?: readonly DetachedNodeBuild<
|
|
99
|
+
readonly refreshers?: readonly DetachedNodeBuild<TTrees>[];
|
|
101
100
|
/**
|
|
102
101
|
* Changes to apply to detached nodes.
|
|
103
102
|
* The ordering has no significance.
|
|
@@ -117,25 +116,9 @@ export interface Root<TTree = ProtoNode> {
|
|
|
117
116
|
}
|
|
118
117
|
|
|
119
118
|
/**
|
|
120
|
-
* The default representation for inserted content.
|
|
121
|
-
*
|
|
122
|
-
* TODO:
|
|
123
|
-
* Ownership and lifetime of data referenced by this cursor is unclear,
|
|
124
|
-
* so it is a poor abstraction for this use-case which needs to hold onto the data in a non-exclusive (readonly) way.
|
|
125
|
-
* Cursors can be one supported way to input data, but aren't a good storage format.
|
|
126
|
-
*/
|
|
127
|
-
export type ProtoNode = ITreeCursorSynchronous;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* The default representation a chunk (sub-sequence) of inserted content.
|
|
131
|
-
*
|
|
132
|
-
* TODO:
|
|
133
|
-
* See issue TODO with ProtoNode.
|
|
134
|
-
* Additionally, Cursors support sequences, so if using cursors, there are better ways to handle this than an array of cursors,
|
|
135
|
-
* like using a cursor over all the content (starting in fields mode).
|
|
136
|
-
* Long term something like TreeChunk should probably be used here.
|
|
119
|
+
* The default representation for a chunk (sub-sequence) of inserted content.
|
|
137
120
|
*/
|
|
138
|
-
export type ProtoNodes =
|
|
121
|
+
export type ProtoNodes = TreeChunk;
|
|
139
122
|
|
|
140
123
|
/**
|
|
141
124
|
* Represents a change being made to a part of the document tree.
|
|
@@ -192,9 +175,9 @@ export interface DetachedNodeChanges {
|
|
|
192
175
|
* Tree creation is idempotent: if a tree with the same ID already exists,
|
|
193
176
|
* then this build is ignored in favor of the existing tree.
|
|
194
177
|
*/
|
|
195
|
-
export interface DetachedNodeBuild<
|
|
178
|
+
export interface DetachedNodeBuild<TTrees = ProtoNodes> {
|
|
196
179
|
readonly id: DetachedNodeId;
|
|
197
|
-
readonly trees:
|
|
180
|
+
readonly trees: TTrees;
|
|
198
181
|
}
|
|
199
182
|
|
|
200
183
|
/**
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
import type { Mutable } from "../../util/index.js";
|
|
7
7
|
import type { FieldKey } from "../schema-stored/index.js";
|
|
8
|
+
import type { TreeChunk } from "./chunk.js";
|
|
8
9
|
|
|
9
|
-
import type { ITreeCursorSynchronous } from "./cursor.js";
|
|
10
10
|
import type { DetachedNodeId, FieldChanges, Mark, Root } from "./delta.js";
|
|
11
11
|
import { rootFieldKey } from "./types.js";
|
|
12
12
|
|
|
13
|
-
export const emptyDelta: Root
|
|
13
|
+
export const emptyDelta: Root = {};
|
|
14
14
|
|
|
15
15
|
export function isAttachMark(mark: Mark): boolean {
|
|
16
16
|
return mark.attach !== undefined && mark.detach === undefined;
|
|
@@ -24,15 +24,15 @@ export function isReplaceMark(mark: Mark): boolean {
|
|
|
24
24
|
return mark.detach !== undefined && mark.attach !== undefined;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export function deltaForRootInitialization(content:
|
|
28
|
-
if (content.
|
|
27
|
+
export function deltaForRootInitialization(content: TreeChunk): Root {
|
|
28
|
+
if (content.topLevelLength === 0) {
|
|
29
29
|
return emptyDelta;
|
|
30
30
|
}
|
|
31
31
|
const buildId = { minor: 0 };
|
|
32
32
|
const delta: Root = {
|
|
33
33
|
build: [{ id: buildId, trees: content }],
|
|
34
34
|
fields: new Map<FieldKey, FieldChanges>([
|
|
35
|
-
[rootFieldKey, [{ count: content.
|
|
35
|
+
[rootFieldKey, [{ count: content.topLevelLength, attach: buildId }]],
|
|
36
36
|
]),
|
|
37
37
|
};
|
|
38
38
|
return delta;
|
package/src/core/tree/index.ts
CHANGED
|
@@ -33,7 +33,6 @@ export {
|
|
|
33
33
|
export type {
|
|
34
34
|
ProtoNodes,
|
|
35
35
|
Root as DeltaRoot,
|
|
36
|
-
ProtoNode as DeltaProtoNode,
|
|
37
36
|
Mark as DeltaMark,
|
|
38
37
|
DetachedNodeId as DeltaDetachedNodeId,
|
|
39
38
|
FieldMap as DeltaFieldMap,
|
|
@@ -49,6 +48,9 @@ export {
|
|
|
49
48
|
topDownPath,
|
|
50
49
|
getDepth,
|
|
51
50
|
type UpPath,
|
|
51
|
+
type NormalizedUpPath,
|
|
52
|
+
type INormalizedUpPath,
|
|
53
|
+
type NormalizedFieldUpPath,
|
|
52
54
|
type FieldUpPath,
|
|
53
55
|
type Range,
|
|
54
56
|
type RangeUpPath,
|
|
@@ -57,6 +59,7 @@ export {
|
|
|
57
59
|
type NodeIndex,
|
|
58
60
|
compareUpPaths,
|
|
59
61
|
compareFieldUpPaths,
|
|
62
|
+
isDetachedUpPathRoot as isDetachedUpPath,
|
|
60
63
|
getDetachedFieldContainingPath,
|
|
61
64
|
type UpPathDefault,
|
|
62
65
|
} from "./pathTree.js";
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { FieldKey } from "../schema-stored/index.js";
|
|
7
|
+
import type { DetachedNodeId } from "./delta.js";
|
|
7
8
|
|
|
8
9
|
import { type DetachedField, keyAsDetachedField } from "./types.js";
|
|
9
10
|
|
|
@@ -41,12 +42,73 @@ export interface UpPath<TParent = UpPathDefault> {
|
|
|
41
42
|
readonly parentIndex: NodeIndex;
|
|
42
43
|
}
|
|
43
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Identical to {@link INormalizedUpPath}, but a duplicate declaration is needed to make the default type parameter compile.
|
|
47
|
+
*/
|
|
48
|
+
export type INormalizedUpPathDefault = INormalizedUpPath;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Identical to {@link UpPath}, but a with a {@link DetachedNodeId} to specify the ID of detached roots.
|
|
52
|
+
* Note that document roots (i.e., any node in the root field) are not considered detached roots and therefore do not have an associated ID.
|
|
53
|
+
*
|
|
54
|
+
* Use this interface for implementing a class that needs to be used as a {@link NormalizedUpPath}.
|
|
55
|
+
*/
|
|
56
|
+
export interface INormalizedUpPath<TParent = INormalizedUpPathDefault>
|
|
57
|
+
extends UpPath<TParent> {
|
|
58
|
+
readonly detachedNodeId: DetachedNodeId | undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Identical to {@link UpPath}, but a with a {@link DetachedNodeId} to specify the ID of detached roots.
|
|
63
|
+
* Note that document roots (i.e., any node in the root field) are not considered detached roots and therefore do not have an associated ID.
|
|
64
|
+
*
|
|
65
|
+
* Prefer this type over {@link INormalizedUpPath} except when implementing a class that needs to be used as a {@link NormalizedUpPath}.
|
|
66
|
+
*/
|
|
67
|
+
export type NormalizedUpPath =
|
|
68
|
+
| INormalizedUpPath<NormalizedUpPath>
|
|
69
|
+
| NormalizedUpPathInterior<NormalizedUpPath>
|
|
70
|
+
| NormalizedUpPathRoot;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The root element of a {@link NormalizedUpPath}.
|
|
74
|
+
*/
|
|
75
|
+
export interface NormalizedUpPathRoot extends UpPath<undefined> {
|
|
76
|
+
/**
|
|
77
|
+
* The ID associated with this node if it is a detached root.
|
|
78
|
+
*/
|
|
79
|
+
readonly detachedNodeId: DetachedNodeId | undefined;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Identical to {@link NormalizedUpPathInterior}, but a duplicate declaration is needed to make the default type parameter compile.
|
|
84
|
+
*/
|
|
85
|
+
export type NormalizedUpPathInteriorDefault = NormalizedUpPathInterior;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* An interior (i.e., non-root) element of a {@link NormalizedUpPath}.
|
|
89
|
+
*/
|
|
90
|
+
export interface NormalizedUpPathInterior<
|
|
91
|
+
TParent = NormalizedUpPathInteriorDefault | NormalizedUpPathRoot,
|
|
92
|
+
> extends UpPath<TParent> {
|
|
93
|
+
/**
|
|
94
|
+
* The parent.
|
|
95
|
+
*/
|
|
96
|
+
readonly parent: TParent;
|
|
97
|
+
}
|
|
98
|
+
|
|
44
99
|
/**
|
|
45
100
|
* Path from a field in the tree upward.
|
|
46
101
|
*
|
|
47
102
|
* See {@link UpPath}.
|
|
48
103
|
*/
|
|
49
|
-
export
|
|
104
|
+
export type NormalizedFieldUpPath<TParent = NormalizedUpPath> = FieldUpPath<TParent>;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Path from a field in the tree upward.
|
|
108
|
+
*
|
|
109
|
+
* See {@link FieldUpPath} and {@link NormalizedUpPath}.
|
|
110
|
+
*/
|
|
111
|
+
export interface FieldUpPath<TUpPath = UpPath> {
|
|
50
112
|
/**
|
|
51
113
|
* The parent, or undefined in the case where this path is to a detached sequence.
|
|
52
114
|
*/
|
|
@@ -59,6 +121,15 @@ export interface FieldUpPath<TUpPath extends UpPath = UpPath> {
|
|
|
59
121
|
readonly field: FieldKey; // TODO: Type information, including when in DetachedField.
|
|
60
122
|
}
|
|
61
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Given an {@link UpPath}, checks if it is a path to a detached root.
|
|
126
|
+
*/
|
|
127
|
+
export function isDetachedUpPathRoot<T>(
|
|
128
|
+
path: UpPath<T> | NormalizedUpPath,
|
|
129
|
+
): path is NormalizedUpPathRoot {
|
|
130
|
+
return (path as NormalizedUpPathRoot).detachedNodeId !== undefined;
|
|
131
|
+
}
|
|
132
|
+
|
|
62
133
|
/**
|
|
63
134
|
* Delimits the extend of a range.
|
|
64
135
|
*/
|