@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
|
@@ -8,12 +8,8 @@ import { assert } from "@fluidframework/core-utils/internal";
|
|
|
8
8
|
import { type NestedMap, setInNestedMap, tryGetFromNestedMap } from "../../util/index.js";
|
|
9
9
|
import type { FieldKey } from "../schema-stored/index.js";
|
|
10
10
|
|
|
11
|
-
import type
|
|
12
|
-
// eslint-disable-next-line import/no-duplicates
|
|
11
|
+
import { mapCursorField, type ITreeCursorSynchronous } from "./cursor.js";
|
|
13
12
|
import type * as Delta from "./delta.js";
|
|
14
|
-
// Since ProtoNodes is reexported, import it directly to avoid forcing Delta to be reexported.
|
|
15
|
-
// eslint-disable-next-line import/no-duplicates
|
|
16
|
-
import type { ProtoNodes } from "./delta.js";
|
|
17
13
|
import {
|
|
18
14
|
areDetachedNodeIdsEqual,
|
|
19
15
|
isAttachMark,
|
|
@@ -24,7 +20,7 @@ import {
|
|
|
24
20
|
import type { DetachedFieldIndex } from "./detachedFieldIndex.js";
|
|
25
21
|
import type { ForestRootId, Major, Minor } from "./detachedFieldIndexTypes.js";
|
|
26
22
|
import type { NodeIndex, PlaceIndex, Range } from "./pathTree.js";
|
|
27
|
-
import type { RevisionTag } from "../index.js";
|
|
23
|
+
import type { RevisionTag, TreeChunk } from "../index.js";
|
|
28
24
|
|
|
29
25
|
/**
|
|
30
26
|
* Implementation notes:
|
|
@@ -59,7 +55,7 @@ import type { RevisionTag } from "../index.js";
|
|
|
59
55
|
* This needs to happen last to allow modifications to detached roots to be applied before they are destroyed.
|
|
60
56
|
*
|
|
61
57
|
* The details of the delta visit algorithm can impact how/when events are emitted by the objects that own the visitors.
|
|
62
|
-
* For example, as of 2024-03-27, the
|
|
58
|
+
* For example, as of 2024-03-27, the subtreeChanged event of an AnchorNode is emitted when exiting a node during a
|
|
63
59
|
* delta visit, and thus the two-pass nature of the algorithm means the event fires twice for any given change.
|
|
64
60
|
* This two-pass nature also means that the event may fire at a time where no change is visible in the tree. E.g.,
|
|
65
61
|
* if a node is being replaced, when the event fires during the detach pass no change in the tree has happened so the
|
|
@@ -89,9 +85,10 @@ export function visitDelta(
|
|
|
89
85
|
const rootDestructions: Delta.DetachedNodeDestruction[] = [];
|
|
90
86
|
const refreshers: NestedMap<Major, Minor, ITreeCursorSynchronous> = new Map();
|
|
91
87
|
delta.refreshers?.forEach(({ id: { major, minor }, trees }) => {
|
|
92
|
-
|
|
88
|
+
const treeCursors = nodeCursorsFromChunk(trees);
|
|
89
|
+
for (let i = 0; i < trees.topLevelLength; i += 1) {
|
|
93
90
|
const offsettedId = minor + i;
|
|
94
|
-
setInNestedMap(refreshers, major, offsettedId,
|
|
91
|
+
setInNestedMap(refreshers, major, offsettedId, treeCursors[i]);
|
|
95
92
|
}
|
|
96
93
|
});
|
|
97
94
|
const detachConfig: PassConfig = {
|
|
@@ -236,7 +233,7 @@ function transferRoots(
|
|
|
236
233
|
const oldField = detachedFieldIndex.toFieldKey(oldRootId);
|
|
237
234
|
const newField = detachedFieldIndex.toFieldKey(newRootId);
|
|
238
235
|
visitor.enterField(oldField);
|
|
239
|
-
visitor.detach({ start: 0, end: 1 }, newField);
|
|
236
|
+
visitor.detach({ start: 0, end: 1 }, newField, newId);
|
|
240
237
|
visitor.exitField(oldField);
|
|
241
238
|
detachedFieldIndex.deleteEntry(oldId);
|
|
242
239
|
}
|
|
@@ -266,7 +263,7 @@ export interface DeltaVisitor {
|
|
|
266
263
|
* @param destination - The key for a new detached field.
|
|
267
264
|
* A field with this key must not already exist.
|
|
268
265
|
*/
|
|
269
|
-
create(content:
|
|
266
|
+
create(content: readonly ITreeCursorSynchronous[], destination: FieldKey): void;
|
|
270
267
|
/**
|
|
271
268
|
* Recursively destroys the given detached field and all of the nodes within it.
|
|
272
269
|
* @param detachedField - The key for the detached field to destroy.
|
|
@@ -287,8 +284,9 @@ export interface DeltaVisitor {
|
|
|
287
284
|
* @param source - The bounds of the range of nodes to detach.
|
|
288
285
|
* @param destination - The key for a new detached field.
|
|
289
286
|
* A field with this key must not already exist.
|
|
287
|
+
* @param id - The ID assigned to the first detached node as a result of the detach. The other nodes in the detached range are assigned subsequent IDs.
|
|
290
288
|
*/
|
|
291
|
-
detach(source: Range, destination: FieldKey): void;
|
|
289
|
+
detach(source: Range, destination: FieldKey, id: Delta.DetachedNodeId): void;
|
|
292
290
|
/**
|
|
293
291
|
* Replaces a range of nodes in the current field by transferring them out to a new detached field
|
|
294
292
|
* and transferring in all the nodes from an existing detached field in their place.
|
|
@@ -296,8 +294,14 @@ export interface DeltaVisitor {
|
|
|
296
294
|
* @param newContentSource - The detached field to transfer the new nodes from.
|
|
297
295
|
* @param range - The bounds of the range of nodes to replace.
|
|
298
296
|
* @param oldContentDestination - The key for a new detached field to transfer the old nodes to.
|
|
297
|
+
* @param oldContentId - The ID assigned to the first replaced node as a result of the replace. The other nodes in the replaced range are assigned subsequent IDs.
|
|
299
298
|
*/
|
|
300
|
-
replace(
|
|
299
|
+
replace(
|
|
300
|
+
newContentSource: FieldKey,
|
|
301
|
+
range: Range,
|
|
302
|
+
oldContentDestination: FieldKey,
|
|
303
|
+
oldContentId: Delta.DetachedNodeId,
|
|
304
|
+
): void;
|
|
301
305
|
|
|
302
306
|
/**
|
|
303
307
|
* Tells the visitor that it should update its "current location" to be the Node at the specified index
|
|
@@ -444,7 +448,7 @@ function detachPass(
|
|
|
444
448
|
config.attachPassRoots.set(root, mark.fields);
|
|
445
449
|
}
|
|
446
450
|
const field = config.detachedFieldIndex.toFieldKey(root);
|
|
447
|
-
visitor.detach({ start: index, end: index + 1 }, field);
|
|
451
|
+
visitor.detach({ start: index, end: index + 1 }, field, id);
|
|
448
452
|
}
|
|
449
453
|
} else if (!isAttachMark(mark)) {
|
|
450
454
|
index += mark.count;
|
|
@@ -476,7 +480,13 @@ function processBuilds(
|
|
|
476
480
|
): void {
|
|
477
481
|
if (builds !== undefined) {
|
|
478
482
|
for (const { id, trees } of builds) {
|
|
479
|
-
buildTrees(
|
|
483
|
+
buildTrees(
|
|
484
|
+
id,
|
|
485
|
+
nodeCursorsFromChunk(trees),
|
|
486
|
+
config.detachedFieldIndex,
|
|
487
|
+
config.latestRevision,
|
|
488
|
+
visitor,
|
|
489
|
+
);
|
|
480
490
|
}
|
|
481
491
|
}
|
|
482
492
|
}
|
|
@@ -558,9 +568,10 @@ function attachPass(
|
|
|
558
568
|
const sourceField = config.detachedFieldIndex.toFieldKey(sourceRoot);
|
|
559
569
|
const offsetIndex = index + i;
|
|
560
570
|
if (isReplaceMark(mark)) {
|
|
571
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
572
|
+
const destinationId = offsetDetachId(mark.detach!, i);
|
|
561
573
|
const rootDestination = config.detachedFieldIndex.createEntry(
|
|
562
|
-
|
|
563
|
-
offsetDetachId(mark.detach!, i),
|
|
574
|
+
destinationId,
|
|
564
575
|
config.latestRevision,
|
|
565
576
|
);
|
|
566
577
|
const destinationField = config.detachedFieldIndex.toFieldKey(rootDestination);
|
|
@@ -568,6 +579,7 @@ function attachPass(
|
|
|
568
579
|
sourceField,
|
|
569
580
|
{ start: offsetIndex, end: offsetIndex + 1 },
|
|
570
581
|
destinationField,
|
|
582
|
+
destinationId,
|
|
571
583
|
);
|
|
572
584
|
// We may need to do a second pass on the detached nodes
|
|
573
585
|
if (mark.fields !== undefined) {
|
|
@@ -592,3 +604,12 @@ function attachPass(
|
|
|
592
604
|
}
|
|
593
605
|
}
|
|
594
606
|
}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Converts a chunk of trees into an array of cursors.
|
|
610
|
+
*
|
|
611
|
+
* TODO: Update the visitDelta logic and downstream APIs to avoid splitting up sequences into individual nodes.
|
|
612
|
+
*/
|
|
613
|
+
function nodeCursorsFromChunk(trees: TreeChunk): ITreeCursorSynchronous[] {
|
|
614
|
+
return mapCursorField(trees.cursor(), (c) => c.fork());
|
|
615
|
+
}
|
|
@@ -10,12 +10,13 @@ import { type IdAllocator, idAllocatorFromMaxId } from "../../util/index.js";
|
|
|
10
10
|
import type { RevisionTag, RevisionTagCodec } from "../rebase/index.js";
|
|
11
11
|
import type { FieldKey } from "../schema-stored/index.js";
|
|
12
12
|
|
|
13
|
-
import type {
|
|
13
|
+
import type { DetachedNodeId, Root } from "./delta.js";
|
|
14
14
|
import { DetachedFieldIndex } from "./detachedFieldIndex.js";
|
|
15
15
|
import type { ForestRootId } from "./detachedFieldIndexTypes.js";
|
|
16
|
-
import type {
|
|
16
|
+
import type { PlaceIndex, Range } from "./pathTree.js";
|
|
17
17
|
import { type DeltaVisitor, visitDelta } from "./visitDelta.js";
|
|
18
18
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
19
|
+
import type { ITreeCursorSynchronous } from "./cursor.js";
|
|
19
20
|
|
|
20
21
|
export function makeDetachedFieldIndex(
|
|
21
22
|
prefix: string = "Temp",
|
|
@@ -86,21 +87,31 @@ export function combineVisitors(
|
|
|
86
87
|
announcedVisitors.forEach((v) => v.beforeAttach(source, count, destination));
|
|
87
88
|
visitors.forEach((v) => v.attach(source, count, destination));
|
|
88
89
|
announcedVisitors.forEach((v) =>
|
|
89
|
-
v.afterAttach(source, {
|
|
90
|
+
v.afterAttach(source, {
|
|
91
|
+
start: destination,
|
|
92
|
+
end: destination + count,
|
|
93
|
+
}),
|
|
90
94
|
);
|
|
91
95
|
},
|
|
92
|
-
detach: (source: Range, destination: FieldKey) => {
|
|
96
|
+
detach: (source: Range, destination: FieldKey, id: DetachedNodeId) => {
|
|
93
97
|
announcedVisitors.forEach((v) => v.beforeDetach(source, destination));
|
|
94
|
-
visitors.forEach((v) => v.detach(source, destination));
|
|
98
|
+
visitors.forEach((v) => v.detach(source, destination, id));
|
|
95
99
|
announcedVisitors.forEach((v) =>
|
|
96
100
|
v.afterDetach(source.start, source.end - source.start, destination),
|
|
97
101
|
);
|
|
98
102
|
},
|
|
99
|
-
replace: (
|
|
103
|
+
replace: (
|
|
104
|
+
newContent: FieldKey,
|
|
105
|
+
oldContent: Range,
|
|
106
|
+
oldContentDestination: FieldKey,
|
|
107
|
+
oldContentId: DetachedNodeId,
|
|
108
|
+
) => {
|
|
100
109
|
announcedVisitors.forEach((v) =>
|
|
101
110
|
v.beforeReplace(newContent, oldContent, oldContentDestination),
|
|
102
111
|
);
|
|
103
|
-
visitors.forEach((v) =>
|
|
112
|
+
visitors.forEach((v) =>
|
|
113
|
+
v.replace(newContent, oldContent, oldContentDestination, oldContentId),
|
|
114
|
+
);
|
|
104
115
|
announcedVisitors.forEach((v) =>
|
|
105
116
|
v.afterReplace(newContent, oldContent, oldContentDestination),
|
|
106
117
|
);
|
|
@@ -120,7 +131,7 @@ export interface AnnouncedVisitor extends DeltaVisitor {
|
|
|
120
131
|
/**
|
|
121
132
|
* A hook that is called after all nodes have been created.
|
|
122
133
|
*/
|
|
123
|
-
afterCreate(content:
|
|
134
|
+
afterCreate(content: readonly ITreeCursorSynchronous[], destination: FieldKey): void;
|
|
124
135
|
beforeDestroy(field: FieldKey, count: number): void;
|
|
125
136
|
beforeAttach(source: FieldKey, count: number, destination: PlaceIndex): void;
|
|
126
137
|
afterAttach(source: FieldKey, destination: Range): void;
|
|
@@ -138,34 +149,9 @@ export interface AnnouncedVisitor extends DeltaVisitor {
|
|
|
138
149
|
* Creates an announced visitor with only the provided functions and uses a no op for the rest.
|
|
139
150
|
* This is provided to make some of the delta visitor definitions cleaner.
|
|
140
151
|
*/
|
|
141
|
-
export function createAnnouncedVisitor(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
afterCreate?: (content: ProtoNodes, destination: FieldKey) => void;
|
|
145
|
-
beforeDestroy?: (field: FieldKey, count: number) => void;
|
|
146
|
-
destroy?: (detachedField: FieldKey, count: number) => void;
|
|
147
|
-
beforeAttach?: (source: FieldKey, count: number, destination: PlaceIndex) => void;
|
|
148
|
-
attach?: (source: FieldKey, count: number, destination: PlaceIndex) => void;
|
|
149
|
-
afterAttach?: (source: FieldKey, destination: Range) => void;
|
|
150
|
-
beforeDetach?: (source: Range, destination: FieldKey) => void;
|
|
151
|
-
afterDetach?: (source: PlaceIndex, count: number, destination: FieldKey) => void;
|
|
152
|
-
detach?: (source: Range, destination: FieldKey) => void;
|
|
153
|
-
beforeReplace?: (
|
|
154
|
-
newContent: FieldKey,
|
|
155
|
-
oldContent: Range,
|
|
156
|
-
oldContentDestination: FieldKey,
|
|
157
|
-
) => void;
|
|
158
|
-
replace?: (
|
|
159
|
-
newContentSource: FieldKey,
|
|
160
|
-
range: Range,
|
|
161
|
-
oldContentDestination: FieldKey,
|
|
162
|
-
) => void;
|
|
163
|
-
afterReplace?: (newContentSource: FieldKey, newContent: Range, oldContent: FieldKey) => void;
|
|
164
|
-
enterNode?: (index: NodeIndex) => void;
|
|
165
|
-
exitNode?: (index: NodeIndex) => void;
|
|
166
|
-
enterField?: (key: FieldKey) => void;
|
|
167
|
-
exitField?: (key: FieldKey) => void;
|
|
168
|
-
}): AnnouncedVisitor {
|
|
152
|
+
export function createAnnouncedVisitor(
|
|
153
|
+
visitorFunctions: Partial<AnnouncedVisitor>,
|
|
154
|
+
): AnnouncedVisitor {
|
|
169
155
|
const noOp = (): void => {};
|
|
170
156
|
return {
|
|
171
157
|
free: visitorFunctions.free ?? noOp,
|
|
@@ -84,7 +84,7 @@ export type SiblingsOrKey = readonly TreeChunk[] | readonly FieldKey[];
|
|
|
84
84
|
* Cursor over basic chunks.
|
|
85
85
|
*
|
|
86
86
|
* @remarks This implementation is similar to StackCursor, however it is distinct because:
|
|
87
|
-
* 1. The children are chunks, which might have a top level length that greater than 1.
|
|
87
|
+
* 1. The children are chunks, which might have a top level length that's greater than 1.
|
|
88
88
|
* 2. It needs to be able to delegate to cursors of other chunk formats it does not natively understand (See TODO below).
|
|
89
89
|
*
|
|
90
90
|
* TODO:
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { assert, oob } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { assert, debugAssert, oob } from "@fluidframework/core-utils/internal";
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
CursorLocationType,
|
|
@@ -30,7 +30,7 @@ import type { FullSchemaPolicy } from "../modular-schema/index.js";
|
|
|
30
30
|
import { BasicChunk } from "./basicChunk.js";
|
|
31
31
|
import { SequenceChunk } from "./sequenceChunk.js";
|
|
32
32
|
import { type FieldShape, TreeShape, UniformChunk } from "./uniformChunk.js";
|
|
33
|
-
import {
|
|
33
|
+
import { isStableNodeIdentifier } from "../node-identifier/index.js";
|
|
34
34
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
35
35
|
|
|
36
36
|
export interface Disposable {
|
|
@@ -175,7 +175,9 @@ export function chunkField(
|
|
|
175
175
|
): TreeChunk[] {
|
|
176
176
|
const length = cursor.getFieldLength();
|
|
177
177
|
const started = cursor.firstNode();
|
|
178
|
-
|
|
178
|
+
debugAssert(
|
|
179
|
+
() => started === (length !== 0) || "only 0 length fields should not have nodes",
|
|
180
|
+
);
|
|
179
181
|
return chunkRange(cursor, policy, length, false);
|
|
180
182
|
}
|
|
181
183
|
|
|
@@ -373,10 +375,12 @@ function newBasicChunkTree(
|
|
|
373
375
|
}
|
|
374
376
|
|
|
375
377
|
/**
|
|
376
|
-
*
|
|
378
|
+
* Chunk a portion of a field.
|
|
379
|
+
*
|
|
380
|
+
* @param cursor - cursor at the starting node in the field.
|
|
377
381
|
* @param policy - heuristics to impact chunking
|
|
378
|
-
* @param length - how many nodes to process (at the top level)
|
|
379
|
-
* @param skipLastNavigation - if true, leaves the cursor at the last node instead of moving off of it.
|
|
382
|
+
* @param length - how many nodes to process (at the top level). When 0, the cursor is not moved, and may be at the end of the field (and thus in Fields mode)
|
|
383
|
+
* @param skipLastNavigation - if true, leaves the cursor at the last node instead of moving off of it. Invalid if length is 0.
|
|
380
384
|
*/
|
|
381
385
|
export function chunkRange(
|
|
382
386
|
cursor: ITreeCursorSynchronous,
|
|
@@ -384,7 +388,14 @@ export function chunkRange(
|
|
|
384
388
|
length: number,
|
|
385
389
|
skipLastNavigation: boolean,
|
|
386
390
|
): TreeChunk[] {
|
|
387
|
-
assert(
|
|
391
|
+
assert(
|
|
392
|
+
!(skipLastNavigation && length === 0),
|
|
393
|
+
0xb58 /* Cannot skip last navigation if length is 0 and thus last navigation already occurred. */,
|
|
394
|
+
);
|
|
395
|
+
assert(
|
|
396
|
+
(cursor.mode === CursorLocationType.Nodes) === length > 0,
|
|
397
|
+
0xb59 /* Should be in nodes mode if not past end */,
|
|
398
|
+
);
|
|
388
399
|
let output: TreeChunk[] = [];
|
|
389
400
|
let remaining = length;
|
|
390
401
|
while (remaining > 0) {
|
|
@@ -498,7 +509,7 @@ export function insertValues(
|
|
|
498
509
|
if (
|
|
499
510
|
typeof cursor.value === "string" &&
|
|
500
511
|
idCompressor !== undefined &&
|
|
501
|
-
|
|
512
|
+
isStableNodeIdentifier(cursor.value)
|
|
502
513
|
) {
|
|
503
514
|
values.push(idCompressor.tryRecompress(cursor.value) ?? cursor.value);
|
|
504
515
|
} else {
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
type ITreeSubscriptionCursor,
|
|
22
22
|
ITreeSubscriptionCursorState,
|
|
23
23
|
type PlaceIndex,
|
|
24
|
-
type ProtoNodes,
|
|
25
24
|
type Range,
|
|
26
25
|
TreeNavigationResult,
|
|
27
26
|
type TreeStoredSchemaSubscription,
|
|
@@ -33,6 +32,7 @@ import {
|
|
|
33
32
|
rootFieldKey,
|
|
34
33
|
type ChunkedCursor,
|
|
35
34
|
type TreeChunk,
|
|
35
|
+
type DeltaDetachedNodeId,
|
|
36
36
|
} from "../../core/index.js";
|
|
37
37
|
import {
|
|
38
38
|
assertValidRange,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
} from "../../util/index.js";
|
|
45
45
|
|
|
46
46
|
import { BasicChunk, BasicChunkCursor, type SiblingsOrKey } from "./basicChunk.js";
|
|
47
|
-
import { type IChunker, basicChunkTree, chunkTree } from "./chunkTree.js";
|
|
47
|
+
import { type IChunker, basicChunkTree, chunkFieldSingle, chunkTree } from "./chunkTree.js";
|
|
48
48
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
49
49
|
|
|
50
50
|
function makeRoot(): BasicChunk {
|
|
@@ -91,6 +91,10 @@ export class ChunkedForest implements IEditableForest {
|
|
|
91
91
|
return new ChunkedForest(this.roots, schema, this.chunker.clone(schema), anchors);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
public chunkField(cursor: ITreeCursorSynchronous): TreeChunk {
|
|
95
|
+
return chunkFieldSingle(cursor, { idCompressor: this.idCompressor, policy: this.chunker });
|
|
96
|
+
}
|
|
97
|
+
|
|
94
98
|
public forgetAnchor(anchor: Anchor): void {
|
|
95
99
|
this.anchors.forget(anchor);
|
|
96
100
|
}
|
|
@@ -136,7 +140,7 @@ export class ChunkedForest implements IEditableForest {
|
|
|
136
140
|
this.forest.#events.emit("beforeChange");
|
|
137
141
|
this.forest.roots.fields.delete(detachedField);
|
|
138
142
|
},
|
|
139
|
-
create(content:
|
|
143
|
+
create(content: readonly ITreeCursorSynchronous[], destination: FieldKey): void {
|
|
140
144
|
this.forest.#events.emit("beforeChange");
|
|
141
145
|
const chunks: TreeChunk[] = content.map((c) =>
|
|
142
146
|
chunkTree(c, {
|
|
@@ -150,7 +154,7 @@ export class ChunkedForest implements IEditableForest {
|
|
|
150
154
|
attach(source: FieldKey, count: number, destination: PlaceIndex): void {
|
|
151
155
|
this.attachEdit(source, count, destination);
|
|
152
156
|
},
|
|
153
|
-
detach(source: Range, destination: FieldKey): void {
|
|
157
|
+
detach(source: Range, destination: FieldKey, id: DeltaDetachedNodeId): void {
|
|
154
158
|
this.detachEdit(source, destination);
|
|
155
159
|
},
|
|
156
160
|
/**
|
|
@@ -210,6 +214,7 @@ export class ChunkedForest implements IEditableForest {
|
|
|
210
214
|
newContentSource: FieldKey,
|
|
211
215
|
range: Range,
|
|
212
216
|
oldContentDestination: FieldKey,
|
|
217
|
+
oldContentId: DeltaDetachedNodeId,
|
|
213
218
|
): void {
|
|
214
219
|
assert(
|
|
215
220
|
newContentSource !== oldContentDestination,
|
|
@@ -8,8 +8,8 @@ Two main algorithms are used:
|
|
|
8
8
|
|
|
9
9
|
- Shape based encoding: Trees are split into "Shape" information and "Data".
|
|
10
10
|
"Shape" can (but does not have to) contain information like type, which fields exist, and how many nodes are in them and the shapes of those nodes.
|
|
11
|
-
- [Dictionary Coding](https://go-compression.github.io/algorithms/dictionary/) using `Counter` from [
|
|
12
|
-
is applied to Identifiers (such
|
|
11
|
+
- [Dictionary Coding](https://go-compression.github.io/algorithms/dictionary/) using `Counter` from [chunkCodecUtilities.ts](./chunkCodecUtilities.ts)
|
|
12
|
+
is applied to Identifiers (such as type names and field keys) and Shapes.
|
|
13
13
|
|
|
14
14
|
The main challenge is deciding what shapes to use: if too much information is captured in the shape, there will be more shapes which take up more space,
|
|
15
15
|
but if too little information is captured in the shapes, the size of the encoded tree will be large.
|
|
@@ -20,7 +20,7 @@ A few implementations are included which make different choices here:
|
|
|
20
20
|
- [uncompressedEncode.ts](uncompressedEncode.ts): the simplest implementation, which captures nothing in the shape and does no Dictionary Coding of identifiers.
|
|
21
21
|
This makes for more human readable data as well as a simple reference implementation.
|
|
22
22
|
- [compressedEncode.ts](compressedEncode.ts): some utilities for actual compressed encoding, but does not contain any advanced strategies (instead they must be provided to it via the `EncoderCache`)
|
|
23
|
-
- [
|
|
23
|
+
- [schemaBasedEncode.ts](schemaBasedEncode.ts): a strategy for compressedEncode using schema to infer commonly used shapes.
|
|
24
24
|
|
|
25
25
|
### Future Optimizations
|
|
26
26
|
|
|
@@ -17,7 +17,7 @@ import { TreeCompressionStrategy } from "../../treeCompressionUtils.js";
|
|
|
17
17
|
import { decode } from "./chunkDecoding.js";
|
|
18
18
|
import type { FieldBatch } from "./fieldBatch.js";
|
|
19
19
|
import { EncodedFieldBatch, validVersions } from "./format.js";
|
|
20
|
-
import { schemaCompressedEncode } from "./
|
|
20
|
+
import { schemaCompressedEncode } from "./schemaBasedEncode.js";
|
|
21
21
|
import { uncompressedEncode } from "./uncompressedEncode.js";
|
|
22
22
|
import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
|
|
23
23
|
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* Encode data from `FieldBatch`
|
|
40
|
+
* Encode data from `FieldBatch` into an `EncodedChunk`.
|
|
41
41
|
*
|
|
42
42
|
* Optimized for encoded size and encoding performance.
|
|
43
43
|
*
|
|
@@ -233,9 +233,10 @@ class OffsetShape {
|
|
|
233
233
|
/**
|
|
234
234
|
* @param shape - the shape of each child in this field
|
|
235
235
|
* @param topLevelLength - number of top level nodes in this sequence chunk (either field within a chunk, or top level chunk)
|
|
236
|
-
* @param offset - number of nodes before this in the parent's subtree
|
|
236
|
+
* @param offset - number of nodes before this in the parent's subtree. The nodes are considered in depth first pre order
|
|
237
|
+
* traversal, so a parent is the first node in its subtree (before its children) with offset 0
|
|
237
238
|
* @param key - field key
|
|
238
|
-
* @param indexOfParentField - index
|
|
239
|
+
* @param indexOfParentField - index to this shape in the parent's array of fields
|
|
239
240
|
*/
|
|
240
241
|
public constructor(
|
|
241
242
|
public readonly shape: TreeShape,
|
|
@@ -13,13 +13,14 @@ import {
|
|
|
13
13
|
type ChangeFamily,
|
|
14
14
|
type ChangeFamilyEditor,
|
|
15
15
|
type ChangeRebaser,
|
|
16
|
-
CursorLocationType,
|
|
17
16
|
type DeltaDetachedNodeId,
|
|
18
17
|
type DeltaRoot,
|
|
19
18
|
type FieldUpPath,
|
|
20
|
-
type
|
|
19
|
+
type NormalizedFieldUpPath,
|
|
20
|
+
type NormalizedUpPath,
|
|
21
21
|
type RevisionTag,
|
|
22
22
|
type TaggedChange,
|
|
23
|
+
type TreeChunk,
|
|
23
24
|
type UpPath,
|
|
24
25
|
compareFieldUpPaths,
|
|
25
26
|
topDownPath,
|
|
@@ -43,7 +44,6 @@ import {
|
|
|
43
44
|
sequence,
|
|
44
45
|
required as valueFieldKind,
|
|
45
46
|
} from "./defaultFieldKinds.js";
|
|
46
|
-
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
47
47
|
import type { CellId } from "../sequence-field/index.js";
|
|
48
48
|
|
|
49
49
|
export type DefaultChangeset = ModularChangeset;
|
|
@@ -120,14 +120,14 @@ export function relevantRemovedRoots(change: ModularChangeset): Iterable<DeltaDe
|
|
|
120
120
|
* If/when such a mechanism becomes available, an evaluation should be done to determine if any existing editing operations should be changed to leverage it
|
|
121
121
|
* (Possibly by adding opt ins at the view schema layer).
|
|
122
122
|
*/
|
|
123
|
-
export interface IDefaultEditBuilder {
|
|
123
|
+
export interface IDefaultEditBuilder<TContent = TreeChunk> {
|
|
124
124
|
/**
|
|
125
125
|
* @param field - the value field which is being edited under the parent node
|
|
126
126
|
* @returns An object with methods to edit the given field of the given parent.
|
|
127
127
|
* The returned object can be used (i.e., have its methods called) multiple times but its lifetime
|
|
128
128
|
* is bounded by the lifetime of this edit builder.
|
|
129
129
|
*/
|
|
130
|
-
valueField(field:
|
|
130
|
+
valueField(field: NormalizedFieldUpPath): ValueFieldEditBuilder<TContent>;
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* @param field - the optional field which is being edited under the parent node
|
|
@@ -135,7 +135,7 @@ export interface IDefaultEditBuilder {
|
|
|
135
135
|
* The returned object can be used (i.e., have its methods called) multiple times but its lifetime
|
|
136
136
|
* is bounded by the lifetime of this edit builder.
|
|
137
137
|
*/
|
|
138
|
-
optionalField(field:
|
|
138
|
+
optionalField(field: NormalizedFieldUpPath): OptionalFieldEditBuilder<TContent>;
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
141
|
* @param field - the sequence field which is being edited under the parent node
|
|
@@ -144,7 +144,7 @@ export interface IDefaultEditBuilder {
|
|
|
144
144
|
* The returned object can be used (i.e., have its methods called) multiple times but its lifetime
|
|
145
145
|
* is bounded by the lifetime of this edit builder.
|
|
146
146
|
*/
|
|
147
|
-
sequenceField(field:
|
|
147
|
+
sequenceField(field: NormalizedFieldUpPath): SequenceFieldEditBuilder<TContent>;
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
150
|
* Moves a subsequence from one sequence field to another sequence field.
|
|
@@ -153,10 +153,10 @@ export interface IDefaultEditBuilder {
|
|
|
153
153
|
* For example, `move(field, 0, 1, field, 2)` changes `[A, B, C]` to `[B, A, C]`.
|
|
154
154
|
*/
|
|
155
155
|
move(
|
|
156
|
-
sourceField:
|
|
156
|
+
sourceField: NormalizedFieldUpPath,
|
|
157
157
|
sourceIndex: number,
|
|
158
158
|
count: number,
|
|
159
|
-
destinationField:
|
|
159
|
+
destinationField: NormalizedFieldUpPath,
|
|
160
160
|
destinationIndex: number,
|
|
161
161
|
): void;
|
|
162
162
|
|
|
@@ -164,13 +164,13 @@ export interface IDefaultEditBuilder {
|
|
|
164
164
|
* Add a constraint that the node at the given path must exist.
|
|
165
165
|
* @param path - The path to the node that must exist.
|
|
166
166
|
*/
|
|
167
|
-
addNodeExistsConstraint(path:
|
|
167
|
+
addNodeExistsConstraint(path: NormalizedUpPath): void;
|
|
168
168
|
|
|
169
169
|
/**
|
|
170
170
|
* Add a constraint that the node at the given path must exist when reverting a change.
|
|
171
171
|
* @param path - The path to the node that must exist when reverting a change.
|
|
172
172
|
*/
|
|
173
|
-
addNodeExistsConstraintOnRevert(path:
|
|
173
|
+
addNodeExistsConstraintOnRevert(path: NormalizedUpPath): void;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
/**
|
|
@@ -184,7 +184,6 @@ export class DefaultEditBuilder implements ChangeFamilyEditor, IDefaultEditBuild
|
|
|
184
184
|
family: ChangeFamily<ChangeFamilyEditor, DefaultChangeset>,
|
|
185
185
|
private readonly mintRevisionTag: () => RevisionTag,
|
|
186
186
|
changeReceiver: (change: TaggedChange<DefaultChangeset>) => void,
|
|
187
|
-
private readonly idCompressor?: IIdCompressor,
|
|
188
187
|
) {
|
|
189
188
|
this.modularBuilder = new ModularEditBuilder(family, fieldKinds, changeReceiver);
|
|
190
189
|
}
|
|
@@ -204,18 +203,13 @@ export class DefaultEditBuilder implements ChangeFamilyEditor, IDefaultEditBuild
|
|
|
204
203
|
this.modularBuilder.addNodeExistsConstraintOnRevert(path, this.mintRevisionTag());
|
|
205
204
|
}
|
|
206
205
|
|
|
207
|
-
public valueField(field: FieldUpPath): ValueFieldEditBuilder<
|
|
206
|
+
public valueField(field: FieldUpPath): ValueFieldEditBuilder<TreeChunk> {
|
|
208
207
|
return {
|
|
209
|
-
set: (newContent:
|
|
208
|
+
set: (newContent: TreeChunk): void => {
|
|
210
209
|
const revision = this.mintRevisionTag();
|
|
211
210
|
const fill: ChangeAtomId = { localId: this.modularBuilder.generateId(), revision };
|
|
212
211
|
const detach: ChangeAtomId = { localId: this.modularBuilder.generateId(), revision };
|
|
213
|
-
const build = this.modularBuilder.buildTrees(
|
|
214
|
-
fill.localId,
|
|
215
|
-
newContent,
|
|
216
|
-
revision,
|
|
217
|
-
this.idCompressor,
|
|
218
|
-
);
|
|
212
|
+
const build = this.modularBuilder.buildTrees(fill.localId, newContent, revision);
|
|
219
213
|
const change: FieldChangeset = brand(
|
|
220
214
|
valueFieldKind.changeHandler.editor.set({
|
|
221
215
|
fill,
|
|
@@ -235,21 +229,16 @@ export class DefaultEditBuilder implements ChangeFamilyEditor, IDefaultEditBuild
|
|
|
235
229
|
};
|
|
236
230
|
}
|
|
237
231
|
|
|
238
|
-
public optionalField(field: FieldUpPath): OptionalFieldEditBuilder<
|
|
232
|
+
public optionalField(field: FieldUpPath): OptionalFieldEditBuilder<TreeChunk> {
|
|
239
233
|
return {
|
|
240
|
-
set: (newContent:
|
|
234
|
+
set: (newContent: TreeChunk | undefined, wasEmpty: boolean): void => {
|
|
241
235
|
const edits: EditDescription[] = [];
|
|
242
236
|
let optionalChange: OptionalChangeset;
|
|
243
237
|
const revision = this.mintRevisionTag();
|
|
244
238
|
const detach: ChangeAtomId = { localId: this.modularBuilder.generateId(), revision };
|
|
245
239
|
if (newContent !== undefined) {
|
|
246
240
|
const fill: ChangeAtomId = { localId: this.modularBuilder.generateId(), revision };
|
|
247
|
-
const build = this.modularBuilder.buildTrees(
|
|
248
|
-
fill.localId,
|
|
249
|
-
newContent,
|
|
250
|
-
revision,
|
|
251
|
-
this.idCompressor,
|
|
252
|
-
);
|
|
241
|
+
const build = this.modularBuilder.buildTrees(fill.localId, newContent, revision);
|
|
253
242
|
edits.push(build);
|
|
254
243
|
|
|
255
244
|
optionalChange = optional.changeHandler.editor.set(wasEmpty, {
|
|
@@ -381,23 +370,17 @@ export class DefaultEditBuilder implements ChangeFamilyEditor, IDefaultEditBuild
|
|
|
381
370
|
}
|
|
382
371
|
}
|
|
383
372
|
|
|
384
|
-
public sequenceField(field: FieldUpPath): SequenceFieldEditBuilder<
|
|
373
|
+
public sequenceField(field: FieldUpPath): SequenceFieldEditBuilder<TreeChunk> {
|
|
385
374
|
return {
|
|
386
|
-
insert: (index: number, content:
|
|
387
|
-
const length =
|
|
388
|
-
content.mode === CursorLocationType.Fields ? content.getFieldLength() : 1;
|
|
375
|
+
insert: (index: number, content: TreeChunk): void => {
|
|
376
|
+
const length = content.topLevelLength;
|
|
389
377
|
if (length === 0) {
|
|
390
378
|
return;
|
|
391
379
|
}
|
|
392
380
|
|
|
393
381
|
const revision = this.mintRevisionTag();
|
|
394
382
|
const firstId: CellId = { localId: this.modularBuilder.generateId(length), revision };
|
|
395
|
-
const build = this.modularBuilder.buildTrees(
|
|
396
|
-
firstId.localId,
|
|
397
|
-
content,
|
|
398
|
-
revision,
|
|
399
|
-
this.idCompressor,
|
|
400
|
-
);
|
|
383
|
+
const build = this.modularBuilder.buildTrees(firstId.localId, content, revision);
|
|
401
384
|
const change: FieldChangeset = brand(
|
|
402
385
|
sequence.changeHandler.editor.insert(index, length, firstId, revision),
|
|
403
386
|
);
|