@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,7 +8,12 @@ import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
|
8
8
|
import type { ITreeCursor } from "../../core/index.js";
|
|
9
9
|
import type { TreeLeafValue, ImplicitAllowedTypes } from "../schemaTypes.js";
|
|
10
10
|
import type { TreeNodeSchema } from "../core/index.js";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
customFromCursor,
|
|
13
|
+
replaceHandles,
|
|
14
|
+
type EncodeOptions,
|
|
15
|
+
type HandleConverter,
|
|
16
|
+
} from "./customTree.js";
|
|
12
17
|
import { getUnhydratedContext } from "../createContext.js";
|
|
13
18
|
|
|
14
19
|
/**
|
|
@@ -36,12 +41,12 @@ export type ConciseTree<THandle = IFluidHandle> =
|
|
|
36
41
|
/**
|
|
37
42
|
* Used to read a node cursor as a ConciseTree.
|
|
38
43
|
*/
|
|
39
|
-
export function conciseFromCursor
|
|
44
|
+
export function conciseFromCursor(
|
|
40
45
|
reader: ITreeCursor,
|
|
41
46
|
rootSchema: ImplicitAllowedTypes,
|
|
42
|
-
options: EncodeOptions
|
|
43
|
-
): ConciseTree
|
|
44
|
-
const config: Required<EncodeOptions
|
|
47
|
+
options: EncodeOptions,
|
|
48
|
+
): ConciseTree {
|
|
49
|
+
const config: Required<EncodeOptions> = {
|
|
45
50
|
useStoredKeys: false,
|
|
46
51
|
...options,
|
|
47
52
|
};
|
|
@@ -50,10 +55,22 @@ export function conciseFromCursor<TCustom>(
|
|
|
50
55
|
return conciseFromCursorInner(reader, config, schemaMap);
|
|
51
56
|
}
|
|
52
57
|
|
|
53
|
-
function conciseFromCursorInner
|
|
58
|
+
function conciseFromCursorInner(
|
|
54
59
|
reader: ITreeCursor,
|
|
55
|
-
options: Required<EncodeOptions
|
|
60
|
+
options: Required<EncodeOptions>,
|
|
56
61
|
schema: ReadonlyMap<string, TreeNodeSchema>,
|
|
57
|
-
): ConciseTree
|
|
62
|
+
): ConciseTree {
|
|
58
63
|
return customFromCursor(reader, options, schema, conciseFromCursorInner);
|
|
59
64
|
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Clones tree, replacing any handles.
|
|
68
|
+
* @remarks A strongly typed version of {@link replaceHandles}.
|
|
69
|
+
* @alpha
|
|
70
|
+
*/
|
|
71
|
+
export function replaceConciseTreeHandles<T>(
|
|
72
|
+
tree: ConciseTree,
|
|
73
|
+
replacer: HandleConverter<T>,
|
|
74
|
+
): ConciseTree<T> {
|
|
75
|
+
return replaceHandles(tree, replacer) as ConciseTree<T>;
|
|
76
|
+
}
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
defaultSchemaPolicy,
|
|
27
27
|
FieldKinds,
|
|
28
28
|
mapTreeFromCursor,
|
|
29
|
-
type
|
|
29
|
+
type NodeIdentifierManager,
|
|
30
30
|
} from "../../feature-libraries/index.js";
|
|
31
31
|
import { isFieldInSchema } from "../../feature-libraries/index.js";
|
|
32
32
|
import { toStoredSchema } from "../toStoredSchema.js";
|
|
@@ -53,7 +53,7 @@ export function createFromInsertable<
|
|
|
53
53
|
? ImplicitFieldSchema
|
|
54
54
|
: TSchema & ImplicitFieldSchema,
|
|
55
55
|
data: InsertableField<TSchema>,
|
|
56
|
-
context?:
|
|
56
|
+
context?: NodeIdentifierManager | undefined,
|
|
57
57
|
): Unhydrated<
|
|
58
58
|
TSchema extends ImplicitFieldSchema
|
|
59
59
|
? TreeFieldFromImplicitField<TSchema>
|
|
@@ -84,7 +84,7 @@ export function cursorFromInsertable<
|
|
|
84
84
|
? ImplicitFieldSchema
|
|
85
85
|
: TSchema & ImplicitFieldSchema,
|
|
86
86
|
data: InsertableField<TSchema>,
|
|
87
|
-
context?:
|
|
87
|
+
context?: NodeIdentifierManager | undefined,
|
|
88
88
|
):
|
|
89
89
|
| ITreeCursorSynchronous
|
|
90
90
|
| (TSchema extends FieldSchema<FieldKind.Optional> ? undefined : never) {
|
|
@@ -14,11 +14,12 @@ import {
|
|
|
14
14
|
LeafNodeStoredSchema,
|
|
15
15
|
mapCursorField,
|
|
16
16
|
ObjectNodeStoredSchema,
|
|
17
|
+
type FieldKey,
|
|
17
18
|
type ITreeCursor,
|
|
18
19
|
type TreeNodeSchemaIdentifier,
|
|
19
20
|
type TreeNodeStoredSchema,
|
|
20
21
|
} from "../../core/index.js";
|
|
21
|
-
import { fail } from "../../util/index.js";
|
|
22
|
+
import { fail, cloneWithReplacements } from "../../util/index.js";
|
|
22
23
|
import type { TreeLeafValue } from "../schemaTypes.js";
|
|
23
24
|
import { NodeKind, type TreeNodeSchema } from "../core/index.js";
|
|
24
25
|
import {
|
|
@@ -35,13 +36,7 @@ import { FieldKinds, valueSchemaAllows } from "../../feature-libraries/index.js"
|
|
|
35
36
|
* Options for how to encode a tree.
|
|
36
37
|
* @alpha
|
|
37
38
|
*/
|
|
38
|
-
export interface EncodeOptions
|
|
39
|
-
/**
|
|
40
|
-
* How to encode any {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles} in the tree.
|
|
41
|
-
* @remarks
|
|
42
|
-
* See note on {@link ParseOptions.valueConverter}.
|
|
43
|
-
*/
|
|
44
|
-
valueConverter(data: IFluidHandle): TCustom;
|
|
39
|
+
export interface EncodeOptions {
|
|
45
40
|
/**
|
|
46
41
|
* If true, interpret the input keys of object nodes as stored keys.
|
|
47
42
|
* If false, interpret them as property keys.
|
|
@@ -50,15 +45,36 @@ export interface EncodeOptions<TCustom> {
|
|
|
50
45
|
readonly useStoredKeys?: boolean;
|
|
51
46
|
}
|
|
52
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Options for how to transcode handles.
|
|
50
|
+
* @remarks
|
|
51
|
+
* Can be applied using {@link replaceHandles}.
|
|
52
|
+
* @alpha
|
|
53
|
+
*/
|
|
54
|
+
export type HandleConverter<TCustom> = (data: IFluidHandle) => TCustom;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Options for how to interpret a `ConciseTree<TCustom>` without relying on schema.
|
|
58
|
+
*/
|
|
59
|
+
export interface SchemalessParseOptions {
|
|
60
|
+
/**
|
|
61
|
+
* Converts stored keys into whatever key the tree is using in its encoding.
|
|
62
|
+
*/
|
|
63
|
+
keyConverter?: {
|
|
64
|
+
parse(type: string, inputKey: string): FieldKey;
|
|
65
|
+
encode(type: string, key: FieldKey): string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
53
69
|
/**
|
|
54
70
|
* Tree representation with fields as properties and customized handle and child representations.
|
|
55
71
|
*/
|
|
56
|
-
export type CustomTree<TChild
|
|
72
|
+
export type CustomTree<TChild> = CustomTreeNode<TChild> | CustomTreeValue;
|
|
57
73
|
|
|
58
74
|
/**
|
|
59
75
|
* TreeLeafValue except the handle type is customized.
|
|
60
76
|
*/
|
|
61
|
-
export type CustomTreeValue
|
|
77
|
+
export type CustomTreeValue = TreeLeafValue;
|
|
62
78
|
|
|
63
79
|
/**
|
|
64
80
|
* Tree node representation with fields as properties and customized child representation.
|
|
@@ -68,16 +84,16 @@ export type CustomTreeNode<TChild> = TChild[] | { [key: string]: TChild };
|
|
|
68
84
|
/**
|
|
69
85
|
* Builds an {@link CustomTree} from a cursor in Nodes mode.
|
|
70
86
|
*/
|
|
71
|
-
export function customFromCursor<TChild
|
|
87
|
+
export function customFromCursor<TChild>(
|
|
72
88
|
reader: ITreeCursor,
|
|
73
|
-
options: Required<EncodeOptions
|
|
89
|
+
options: Required<EncodeOptions>,
|
|
74
90
|
schema: ReadonlyMap<string, TreeNodeSchema>,
|
|
75
91
|
childHandler: (
|
|
76
92
|
reader: ITreeCursor,
|
|
77
|
-
options: Required<EncodeOptions
|
|
93
|
+
options: Required<EncodeOptions>,
|
|
78
94
|
schema: ReadonlyMap<string, TreeNodeSchema>,
|
|
79
95
|
) => TChild,
|
|
80
|
-
): CustomTree<TChild
|
|
96
|
+
): CustomTree<TChild> {
|
|
81
97
|
const type = reader.type;
|
|
82
98
|
const nodeSchema = schema.get(type) ?? fail(0xb2e /* missing schema for type in cursor */);
|
|
83
99
|
|
|
@@ -92,7 +108,7 @@ export function customFromCursor<TChild, THandle>(
|
|
|
92
108
|
case handleSchema.identifier:
|
|
93
109
|
assert(reader.value !== undefined, 0xa52 /* out of schema: missing value */);
|
|
94
110
|
assert(isFluidHandle(reader.value), 0xa53 /* out of schema: expected FluidHandle */);
|
|
95
|
-
return
|
|
111
|
+
return reader.value;
|
|
96
112
|
default: {
|
|
97
113
|
assert(reader.value === undefined, 0xa54 /* out of schema: unexpected value */);
|
|
98
114
|
if (nodeSchema.kind === NodeKind.Array) {
|
|
@@ -136,7 +152,7 @@ export function customFromCursorStored<TChild>(
|
|
|
136
152
|
reader: ITreeCursor,
|
|
137
153
|
schema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,
|
|
138
154
|
) => TChild,
|
|
139
|
-
): CustomTree<TChild
|
|
155
|
+
): CustomTree<TChild> {
|
|
140
156
|
const type = reader.type;
|
|
141
157
|
const nodeSchema = schema.get(type) ?? fail(0xb30 /* missing schema for type in cursor */);
|
|
142
158
|
|
|
@@ -186,3 +202,30 @@ export function tryStoredSchemaAsArray(
|
|
|
186
202
|
}
|
|
187
203
|
}
|
|
188
204
|
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Clones tree, replacing any handles.
|
|
208
|
+
* @remarks
|
|
209
|
+
* This can be useful converting data containing handles to JSON compatible formats,
|
|
210
|
+
* or just asserting that data does not contain handles.
|
|
211
|
+
*
|
|
212
|
+
* Reversing this replacement depends on how the replacer encodes handles, and can often be impossible if the replacer
|
|
213
|
+
* does not have all the necessary context to restore the handles
|
|
214
|
+
* (e.g. if the handles are something insufficiently descriptive,
|
|
215
|
+
* if data referenced by the handle got garbage collected,
|
|
216
|
+
* if the encoded form of the handle can't be differentiated from other data,
|
|
217
|
+
* or the replacer doesn't have access to the correct Fluid container to to restore them from).
|
|
218
|
+
*
|
|
219
|
+
* Code attempting to reverse this replacement may want to use {@link cloneWithReplacements}.
|
|
220
|
+
* @alpha
|
|
221
|
+
*/
|
|
222
|
+
export function replaceHandles<T>(tree: unknown, replacer: HandleConverter<T>): unknown {
|
|
223
|
+
return cloneWithReplacements(tree, "", (key, value) => {
|
|
224
|
+
// eslint-disable-next-line unicorn/prefer-ternary
|
|
225
|
+
if (isFluidHandle(value)) {
|
|
226
|
+
return { clone: false, value: replacer(value) };
|
|
227
|
+
} else {
|
|
228
|
+
return { clone: true, value };
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
@@ -95,6 +95,7 @@ export {
|
|
|
95
95
|
applySchemaToParserOptions,
|
|
96
96
|
cursorFromVerbose,
|
|
97
97
|
verboseFromCursor,
|
|
98
|
+
replaceVerboseTreeHandles,
|
|
98
99
|
} from "./verboseTree.js";
|
|
99
100
|
|
|
100
101
|
export {
|
|
@@ -103,9 +104,15 @@ export {
|
|
|
103
104
|
type CustomTreeNode,
|
|
104
105
|
type CustomTreeValue,
|
|
105
106
|
tryStoredSchemaAsArray,
|
|
107
|
+
replaceHandles,
|
|
108
|
+
type HandleConverter,
|
|
106
109
|
} from "./customTree.js";
|
|
107
110
|
|
|
108
|
-
export {
|
|
111
|
+
export {
|
|
112
|
+
type ConciseTree,
|
|
113
|
+
conciseFromCursor,
|
|
114
|
+
replaceConciseTreeHandles,
|
|
115
|
+
} from "./conciseTree.js";
|
|
109
116
|
|
|
110
117
|
export { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from "./treeApiBeta.js";
|
|
111
118
|
export { createSimpleTreeIndex, type SimpleTreeIndex } from "./simpleTreeIndex.js";
|
|
@@ -133,6 +140,8 @@ export {
|
|
|
133
140
|
rollback,
|
|
134
141
|
} from "./transactionTypes.js";
|
|
135
142
|
|
|
143
|
+
export { generateSchemaFromSimpleSchema } from "./schemaFromSimple.js";
|
|
144
|
+
|
|
136
145
|
// Exporting the schema (RecursiveObject) to test that recursive types are working correctly.
|
|
137
146
|
// These are `@internal` so they can't be included in the `InternalClassTreeTypes` due to https://github.com/microsoft/rushstack/issues/3639
|
|
138
147
|
export {
|
|
@@ -8,11 +8,10 @@ import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
|
8
8
|
// which degrades the API-Extractor report quality since API-Extractor can not tell the inline import is the same as the non-inline one.
|
|
9
9
|
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
10
10
|
import type { IFluidHandle as _dummyImport } from "@fluidframework/core-interfaces";
|
|
11
|
-
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
12
11
|
import { isFluidHandle } from "@fluidframework/runtime-utils/internal";
|
|
13
12
|
|
|
14
13
|
import type { TreeValue } from "../../core/index.js";
|
|
15
|
-
import type {
|
|
14
|
+
import type { NodeIdentifierManager } from "../../feature-libraries/index.js";
|
|
16
15
|
import {
|
|
17
16
|
type RestrictiveStringRecord,
|
|
18
17
|
getOrCreate,
|
|
@@ -25,7 +24,6 @@ import type { TreeAlpha } from "../../shared-tree/index.js";
|
|
|
25
24
|
import {
|
|
26
25
|
booleanSchema,
|
|
27
26
|
handleSchema,
|
|
28
|
-
LeafNodeSchema,
|
|
29
27
|
nullSchema,
|
|
30
28
|
numberSchema,
|
|
31
29
|
stringSchema,
|
|
@@ -41,8 +39,8 @@ import {
|
|
|
41
39
|
type DefaultProvider,
|
|
42
40
|
getDefaultProvider,
|
|
43
41
|
type NodeSchemaOptions,
|
|
42
|
+
markSchemaMostDerived,
|
|
44
43
|
} from "../schemaTypes.js";
|
|
45
|
-
import { inPrototypeChain } from "../core/index.js";
|
|
46
44
|
import type {
|
|
47
45
|
NodeKind,
|
|
48
46
|
WithType,
|
|
@@ -76,7 +74,6 @@ import type {
|
|
|
76
74
|
Unenforced,
|
|
77
75
|
} from "./typesUnsafe.js";
|
|
78
76
|
import { createFieldSchemaUnsafe } from "./schemaFactoryRecursive.js";
|
|
79
|
-
import { TreeNodeValid } from "../treeNodeValid.js";
|
|
80
77
|
import { isLazy } from "../flexList.js";
|
|
81
78
|
|
|
82
79
|
/**
|
|
@@ -145,7 +142,7 @@ export interface SchemaFactoryObjectOptions<TCustomMetadata = unknown>
|
|
|
145
142
|
* ```
|
|
146
143
|
*
|
|
147
144
|
* If an application wants to be particularly careful to preserve all data on a node when editing it, it can use
|
|
148
|
-
* {@link TreeAlpha.
|
|
145
|
+
* {@link TreeAlpha.importVerbose|import}/{@link TreeAlpha.exportVerbose|export} APIs with persistent keys.
|
|
149
146
|
*
|
|
150
147
|
* Note that public API methods which operate on entire nodes (such as `moveTo`, `moveToEnd`, etc. on arrays) do not encounter
|
|
151
148
|
* this problem as SharedTree's implementation stores the entire node in its lower layers. It's only when application code
|
|
@@ -329,6 +326,17 @@ export const schemaStatics = {
|
|
|
329
326
|
* On the other hand, two calls to `array(name, allowedTypes)` will always return different {@link TreeNodeSchema} instances
|
|
330
327
|
* and it is an error to use both in the same tree (since their identifiers are not unique).
|
|
331
328
|
*
|
|
329
|
+
* For "customizable" schema (those which can be subclassed to customize them, see details below) some additional rules must be followed:
|
|
330
|
+
*
|
|
331
|
+
* 1. Only a single {@link TreeNodeSchema|schema} can be used from the class hierarchy deriving from the base class produced by this factory.
|
|
332
|
+
* It is legal to subclass the returned class, and even subclass that class,
|
|
333
|
+
* but only a single class from that class hierarchy can ever be instantiated or passed to any API as a {@link TreeNodeSchema|schema}.
|
|
334
|
+
* These base classes can be used with `instanceof`, but not with schema based APIs like `Tree.is`.
|
|
335
|
+
* 2. If overriding the constructor, the constructor must accept the same argument as the base constructor `super` and forward it to `super` unchanged.
|
|
336
|
+
* 3. Properties for fields defined in the schema should not be overridden.
|
|
337
|
+
* 4. Additional static members added to schema should pick relatively unique keys to reduce the risk of colliding with implementation details what are not exposed in the API.
|
|
338
|
+
* 5. If exporting the schema from a package which uses API-Extractor, export the base class and derived class separately to work around [a known limitation](https://github.com/microsoft/rushstack/issues/4429).
|
|
339
|
+
*
|
|
332
340
|
* Note:
|
|
333
341
|
* POJO stands for Plain Old JavaScript Object.
|
|
334
342
|
* This means an object that works like a `{}` style object literal.
|
|
@@ -901,8 +909,10 @@ export class SchemaFactory<
|
|
|
901
909
|
*/
|
|
902
910
|
public get identifier(): FieldSchema<FieldKind.Identifier, typeof this.string> {
|
|
903
911
|
const defaultIdentifierProvider: DefaultProvider = getDefaultProvider(
|
|
904
|
-
(nodeKeyManager:
|
|
905
|
-
return nodeKeyManager.
|
|
912
|
+
(nodeKeyManager: NodeIdentifierManager) => {
|
|
913
|
+
return nodeKeyManager.stabilizeNodeIdentifier(
|
|
914
|
+
nodeKeyManager.generateLocalNodeIdentifier(),
|
|
915
|
+
);
|
|
906
916
|
},
|
|
907
917
|
);
|
|
908
918
|
return createFieldSchema(FieldKind.Identifier, this.string, {
|
|
@@ -1070,27 +1080,3 @@ export function structuralName<const T extends string>(
|
|
|
1070
1080
|
}
|
|
1071
1081
|
return `${collectionName}<${inner}>`;
|
|
1072
1082
|
}
|
|
1073
|
-
|
|
1074
|
-
/**
|
|
1075
|
-
* Indicates that a schema is the "most derived" version which is allowed to be used, see {@link MostDerivedData}.
|
|
1076
|
-
* Calling helps with error messages about invalid schema usage (using more than one type from single schema factor produced type,
|
|
1077
|
-
* and thus calling this for one than one subclass).
|
|
1078
|
-
* @remarks
|
|
1079
|
-
* Helper for invoking {@link TreeNodeValid.markMostDerived} for any {@link TreeNodeSchema} if it needed.
|
|
1080
|
-
*/
|
|
1081
|
-
export function markSchemaMostDerived(schema: TreeNodeSchema): void {
|
|
1082
|
-
if (schema instanceof LeafNodeSchema) {
|
|
1083
|
-
return;
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
if (!inPrototypeChain(schema, TreeNodeValid)) {
|
|
1087
|
-
// Use JSON.stringify to quote and escape identifier string.
|
|
1088
|
-
throw new UsageError(
|
|
1089
|
-
`Schema for ${JSON.stringify(
|
|
1090
|
-
schema.identifier,
|
|
1091
|
-
)} does not extend a SchemaFactory generated class. This is invalid.`,
|
|
1092
|
-
);
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
(schema as typeof TreeNodeValid & TreeNodeSchema).markMostDerived();
|
|
1096
|
-
}
|
|
@@ -250,4 +250,16 @@ export class SchemaFactoryAlpha<
|
|
|
250
250
|
TCustomMetadata
|
|
251
251
|
>;
|
|
252
252
|
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Create a {@link SchemaFactory} with a {@link SchemaFactory.scope|scope} which is a combination of this factory's scope and the provided name.
|
|
256
|
+
* @remarks
|
|
257
|
+
* The main use-case for this is when creating a collection of related schema (for example using a function that creates multiple schema).
|
|
258
|
+
* Creating such related schema using a sub-scope helps ensure they won't collide with other schema in the parent scope.
|
|
259
|
+
*/
|
|
260
|
+
public scopedFactory<const T extends TName, TNameInner extends number | string = string>(
|
|
261
|
+
name: T,
|
|
262
|
+
): SchemaFactoryAlpha<ScopedSchemaName<TScope, T>, TNameInner> {
|
|
263
|
+
return new SchemaFactoryAlpha(this.scoped2(name));
|
|
264
|
+
}
|
|
253
265
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { unreachableCase } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import { fail } from "../../util/index.js";
|
|
8
|
+
import { NodeKind, type TreeNodeSchema } from "../core/index.js";
|
|
9
|
+
import { createFieldSchema, type FieldSchema, type AllowedTypes } from "../schemaTypes.js";
|
|
10
|
+
import { SchemaFactory } from "./schemaFactory.js";
|
|
11
|
+
import type { SimpleFieldSchema, SimpleNodeSchema, SimpleTreeSchema } from "./simpleSchema.js";
|
|
12
|
+
|
|
13
|
+
const factory = new SchemaFactory(undefined);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Create {@link FieldSchema} from a SimpleTreeSchema.
|
|
17
|
+
* @remarks
|
|
18
|
+
* Only use this API if hand written schema (produced using {@link SchemaFactory} cannot be provided.
|
|
19
|
+
*
|
|
20
|
+
* Using generated schema with schema aware APIs (designed to work with strongly typed schema) like {@link TreeViewConfiguration}
|
|
21
|
+
* will produce a poor TypeScript typing experience which is subject to change.
|
|
22
|
+
*
|
|
23
|
+
* Editing through a view produced using this schema can easily violate invariants other users of the document might expect and must be done with great care.
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export function generateSchemaFromSimpleSchema(simple: SimpleTreeSchema): FieldSchema {
|
|
27
|
+
const context: Context = new Map(
|
|
28
|
+
[...simple.definitions].map(([id, schema]): [string, () => TreeNodeSchema] => [
|
|
29
|
+
id,
|
|
30
|
+
// This relies on the caching in evaluateLazySchema so that it only runs once.
|
|
31
|
+
() => generateNode(id, schema, context),
|
|
32
|
+
]),
|
|
33
|
+
);
|
|
34
|
+
return generateFieldSchema(simple, context);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
type Context = ReadonlyMap<string, () => TreeNodeSchema>;
|
|
38
|
+
|
|
39
|
+
function generateFieldSchema(simple: SimpleFieldSchema, context: Context): FieldSchema {
|
|
40
|
+
return createFieldSchema(simple.kind, generateAllowedTypes(simple.allowedTypes, context));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function generateAllowedTypes(allowed: ReadonlySet<string>, context: Context): AllowedTypes {
|
|
44
|
+
return [...allowed].map((id) => context.get(id) ?? fail(0xb5a /* Missing schema */));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function generateNode(id: string, schema: SimpleNodeSchema, context: Context): TreeNodeSchema {
|
|
48
|
+
switch (schema.kind) {
|
|
49
|
+
case NodeKind.Object: {
|
|
50
|
+
const fields: Record<string, FieldSchema> = {};
|
|
51
|
+
for (const [key, field] of Object.entries(schema.fields)) {
|
|
52
|
+
fields[key] = generateFieldSchema(field, context);
|
|
53
|
+
}
|
|
54
|
+
return factory.object(id, fields);
|
|
55
|
+
}
|
|
56
|
+
case NodeKind.Array:
|
|
57
|
+
return factory.array(id, generateAllowedTypes(schema.allowedTypes, context));
|
|
58
|
+
case NodeKind.Map:
|
|
59
|
+
return factory.map(id, generateAllowedTypes(schema.allowedTypes, context));
|
|
60
|
+
case NodeKind.Leaf:
|
|
61
|
+
return (
|
|
62
|
+
SchemaFactory.leaves.find((leaf) => leaf.identifier === id) ??
|
|
63
|
+
fail(0xb5b /* Missing schema */)
|
|
64
|
+
);
|
|
65
|
+
default:
|
|
66
|
+
return unreachableCase(schema);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -7,6 +7,13 @@ import type { ValueSchema } from "../../core/index.js";
|
|
|
7
7
|
import type { NodeKind } from "../core/index.js";
|
|
8
8
|
import type { FieldKind, FieldSchemaMetadata, NodeSchemaMetadata } from "../schemaTypes.js";
|
|
9
9
|
|
|
10
|
+
/*
|
|
11
|
+
* TODO:
|
|
12
|
+
* - Make TreeNodeSchema implement these interfaces directly.
|
|
13
|
+
* - Customize their JSON serialization to use these formats or provide some other serialization scheme.
|
|
14
|
+
* - Promote these to alpha
|
|
15
|
+
*/
|
|
16
|
+
|
|
10
17
|
/**
|
|
11
18
|
* Base interface for all {@link SimpleNodeSchema} implementations.
|
|
12
19
|
*
|
|
@@ -38,6 +45,9 @@ export interface SimpleObjectNodeSchema extends SimpleNodeSchemaBase<NodeKind.Ob
|
|
|
38
45
|
* Schemas for each of the object's fields, keyed off of schema's keys.
|
|
39
46
|
* @remarks
|
|
40
47
|
* Depending on how this schema was exported, the string keys may be either the property keys or the stored keys.
|
|
48
|
+
* @privateRemarks
|
|
49
|
+
* TODO: if these are supposed to be JSON compatible,
|
|
50
|
+
* then using a record here makes sense, but if not, this should use a map, and the allowedTypes sets elsewhere should be arrays for JSON compatibility.
|
|
41
51
|
*/
|
|
42
52
|
readonly fields: Record<string, SimpleFieldSchema>;
|
|
43
53
|
}
|
|
@@ -27,13 +27,13 @@ import {
|
|
|
27
27
|
type TreeFieldFromImplicitField,
|
|
28
28
|
type UnsafeUnknownSchema,
|
|
29
29
|
FieldKind,
|
|
30
|
+
markSchemaMostDerived,
|
|
30
31
|
} from "../schemaTypes.js";
|
|
31
32
|
import { NodeKind, type TreeNodeSchema } from "../core/index.js";
|
|
32
33
|
import { toStoredSchema } from "../toStoredSchema.js";
|
|
33
34
|
import { LeafNodeSchema } from "../leafNodeSchema.js";
|
|
34
35
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
35
36
|
import { isObjectNodeSchema, type ObjectNodeSchema } from "../objectNodeTypes.js";
|
|
36
|
-
import { markSchemaMostDerived } from "./schemaFactory.js";
|
|
37
37
|
import { fail, getOrCreate } from "../../util/index.js";
|
|
38
38
|
import type { MakeNominal } from "../../util/index.js";
|
|
39
39
|
import { walkFieldSchema } from "../walkFieldSchema.js";
|
|
@@ -264,7 +264,17 @@ export class TreeViewConfiguration<
|
|
|
264
264
|
public readonly preventAmbiguity: boolean;
|
|
265
265
|
|
|
266
266
|
/**
|
|
267
|
+
* Construct a new {@link TreeViewConfiguration}.
|
|
268
|
+
*
|
|
267
269
|
* @param props - Property bag of configuration options.
|
|
270
|
+
*
|
|
271
|
+
* @remarks
|
|
272
|
+
* Performing this construction deeply validates the provided schema.
|
|
273
|
+
* This means that when this constructor is called, all {@link LazyItem} {@link TreeNodeSchema} references will be evaluated (using {@link evaluateLazySchema}).
|
|
274
|
+
* This means that the declarations for all transitively reachable {@link TreeNodeSchema} must be available at this time.
|
|
275
|
+
*
|
|
276
|
+
* For example, a schema reachable from this configuration cannot reference this configuration during its declaration,
|
|
277
|
+
* since this would be a cyclic dependency that will cause an error when constructing this configuration.
|
|
268
278
|
*/
|
|
269
279
|
public constructor(props: ITreeViewConfiguration<TSchema>) {
|
|
270
280
|
const config = { ...defaultTreeConfigurationOptions, ...props };
|
|
@@ -280,7 +290,7 @@ export class TreeViewConfiguration<
|
|
|
280
290
|
// This ensures if multiple schema extending the same schema factory generated class are present (or have been constructed, or get constructed in the future),
|
|
281
291
|
// an error is reported.
|
|
282
292
|
|
|
283
|
-
node: markSchemaMostDerived,
|
|
293
|
+
node: (schema) => markSchemaMostDerived(schema, true),
|
|
284
294
|
allowedTypes(types): void {
|
|
285
295
|
if (config.preventAmbiguity) {
|
|
286
296
|
checkUnion(types, ambiguityErrors);
|
|
@@ -725,12 +735,7 @@ export interface SchemaCompatibilityStatus {
|
|
|
725
735
|
* Events for {@link TreeBranch}.
|
|
726
736
|
* @sealed @alpha
|
|
727
737
|
*/
|
|
728
|
-
export interface TreeBranchEvents {
|
|
729
|
-
/**
|
|
730
|
-
* The stored schema for the document has changed.
|
|
731
|
-
*/
|
|
732
|
-
schemaChanged(): void;
|
|
733
|
-
|
|
738
|
+
export interface TreeBranchEvents extends Omit<TreeViewEvents, "commitApplied"> {
|
|
734
739
|
/**
|
|
735
740
|
* Fired when a change is made to the branch. Includes data about the change that is made which listeners
|
|
736
741
|
* can use to filter on changes they care about (e.g. local vs. remote changes).
|
|
@@ -7,13 +7,14 @@ import { assert, oob } from "@fluidframework/core-utils/internal";
|
|
|
7
7
|
|
|
8
8
|
import { EmptyKey, rootFieldKey } from "../../core/index.js";
|
|
9
9
|
import { type TreeStatus, isTreeValue, FieldKinds } from "../../feature-libraries/index.js";
|
|
10
|
-
import { fail, extractFromOpaque
|
|
10
|
+
import { fail, extractFromOpaque } from "../../util/index.js";
|
|
11
11
|
import {
|
|
12
12
|
type TreeLeafValue,
|
|
13
13
|
type ImplicitFieldSchema,
|
|
14
14
|
FieldSchema,
|
|
15
15
|
type ImplicitAllowedTypes,
|
|
16
16
|
type TreeNodeFromImplicitAllowedTypes,
|
|
17
|
+
normalizeAllowedTypes,
|
|
17
18
|
} from "../schemaTypes.js";
|
|
18
19
|
import {
|
|
19
20
|
booleanSchema,
|
|
@@ -39,8 +40,6 @@ import {
|
|
|
39
40
|
getOrCreateInnerNode,
|
|
40
41
|
} from "../core/index.js";
|
|
41
42
|
import { isObjectNodeSchema } from "../objectNodeTypes.js";
|
|
42
|
-
import { isLazy, type LazyItem } from "../flexList.js";
|
|
43
|
-
import { markSchemaMostDerived } from "./schemaFactory.js";
|
|
44
43
|
|
|
45
44
|
/**
|
|
46
45
|
* Provides various functions for analyzing {@link TreeNode}s.
|
|
@@ -212,19 +211,7 @@ export const treeNodeApi: TreeNodeApi = {
|
|
|
212
211
|
if (actualSchema === undefined) {
|
|
213
212
|
return false;
|
|
214
213
|
}
|
|
215
|
-
|
|
216
|
-
for (const singleSchema of schema) {
|
|
217
|
-
const testSchema = isLazy(singleSchema) ? singleSchema() : singleSchema;
|
|
218
|
-
markSchemaMostDerived(testSchema);
|
|
219
|
-
if (testSchema === actualSchema) {
|
|
220
|
-
return true;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
return false;
|
|
224
|
-
} else {
|
|
225
|
-
markSchemaMostDerived(schema);
|
|
226
|
-
return schema === actualSchema;
|
|
227
|
-
}
|
|
214
|
+
return normalizeAllowedTypes(schema).has(actualSchema);
|
|
228
215
|
},
|
|
229
216
|
schema(node: TreeNode | TreeLeafValue): TreeNodeSchema {
|
|
230
217
|
return tryGetSchema(node) ?? fail(0xb37 /* Not a tree node */);
|
|
@@ -258,7 +245,7 @@ export const treeNodeApi: TreeNodeApi = {
|
|
|
258
245
|
const identifierValue = identifier.value as string;
|
|
259
246
|
|
|
260
247
|
const localNodeKey =
|
|
261
|
-
identifier.context.nodeKeyManager.
|
|
248
|
+
identifier.context.nodeKeyManager.tryLocalizeNodeIdentifier(identifierValue);
|
|
262
249
|
return localNodeKey !== undefined ? extractFromOpaque(localNodeKey) : identifierValue;
|
|
263
250
|
}
|
|
264
251
|
default:
|