@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
|
@@ -51,7 +51,7 @@ export type Unenforced<_DesiredExtendsConstraint> = unknown;
|
|
|
51
51
|
/**
|
|
52
52
|
* {@link Unenforced} version of `ObjectFromSchemaRecord`.
|
|
53
53
|
* @remarks
|
|
54
|
-
* Do
|
|
54
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
55
55
|
* @system @public
|
|
56
56
|
*/
|
|
57
57
|
export type ObjectFromSchemaRecordUnsafe<
|
|
@@ -121,7 +121,7 @@ export interface TreeNodeSchemaNonClassUnsafe<
|
|
|
121
121
|
/**
|
|
122
122
|
* {@link Unenforced} version of {@link TreeObjectNode}.
|
|
123
123
|
* @remarks
|
|
124
|
-
* Do
|
|
124
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
125
125
|
* @system @public
|
|
126
126
|
*/
|
|
127
127
|
export type TreeObjectNodeUnsafe<
|
|
@@ -132,7 +132,7 @@ export type TreeObjectNodeUnsafe<
|
|
|
132
132
|
/**
|
|
133
133
|
* {@link Unenforced} version of {@link TreeFieldFromImplicitField}.
|
|
134
134
|
* @remarks
|
|
135
|
-
* Do
|
|
135
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
136
136
|
* @system @public
|
|
137
137
|
*/
|
|
138
138
|
export type TreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> =
|
|
@@ -153,7 +153,7 @@ export type AllowedTypesUnsafe = readonly LazyItem<TreeNodeSchemaUnsafe>[];
|
|
|
153
153
|
/**
|
|
154
154
|
* {@link Unenforced} version of {@link TreeNodeFromImplicitAllowedTypes}.
|
|
155
155
|
* @remarks
|
|
156
|
-
* Do
|
|
156
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
157
157
|
* @system @public
|
|
158
158
|
*/
|
|
159
159
|
export type TreeNodeFromImplicitAllowedTypesUnsafe<
|
|
@@ -168,7 +168,7 @@ export type TreeNodeFromImplicitAllowedTypesUnsafe<
|
|
|
168
168
|
* {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.
|
|
169
169
|
* @see {@link Input}
|
|
170
170
|
* @remarks
|
|
171
|
-
* Do
|
|
171
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
172
172
|
* @system @public
|
|
173
173
|
*/
|
|
174
174
|
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<
|
|
@@ -197,7 +197,7 @@ export type InsertableTreeNodeFromAllowedTypesUnsafe<
|
|
|
197
197
|
* {@link Unenforced} version of {@link InsertableTypedNode}.
|
|
198
198
|
* @see {@link Input}
|
|
199
199
|
* @remarks
|
|
200
|
-
* Do
|
|
200
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
201
201
|
* @privateRemarks
|
|
202
202
|
* TODO:
|
|
203
203
|
* This is less strict than InsertableTypedNode when given non-exact schema to avoid compilation issues.
|
|
@@ -216,7 +216,7 @@ export type InsertableTypedNodeUnsafe<
|
|
|
216
216
|
/**
|
|
217
217
|
* {@link Unenforced} version of {@link NodeFromSchema}.
|
|
218
218
|
* @remarks
|
|
219
|
-
* Do
|
|
219
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
220
220
|
* @system @public
|
|
221
221
|
*/
|
|
222
222
|
export type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> =
|
|
@@ -225,7 +225,7 @@ export type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> =
|
|
|
225
225
|
/**
|
|
226
226
|
* {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.
|
|
227
227
|
* @remarks
|
|
228
|
-
* Do
|
|
228
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
229
229
|
* @system @public
|
|
230
230
|
*/
|
|
231
231
|
export type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> =
|
|
@@ -234,7 +234,7 @@ export type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> =
|
|
|
234
234
|
/**
|
|
235
235
|
* {@link Unenforced} version of {@link (TreeArrayNode:interface)}.
|
|
236
236
|
* @remarks
|
|
237
|
-
* Do
|
|
237
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
238
238
|
* @system @sealed @public
|
|
239
239
|
*/
|
|
240
240
|
export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>>
|
|
@@ -247,7 +247,7 @@ export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAl
|
|
|
247
247
|
/**
|
|
248
248
|
* {@link Unenforced} version of {@link TreeMapNode}.
|
|
249
249
|
* @remarks
|
|
250
|
-
* Do
|
|
250
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
251
251
|
* @system @sealed @public
|
|
252
252
|
*/
|
|
253
253
|
export interface TreeMapNodeUnsafe<T extends Unenforced<ImplicitAllowedTypes>>
|
|
@@ -271,7 +271,7 @@ export interface TreeMapNodeUnsafe<T extends Unenforced<ImplicitAllowedTypes>>
|
|
|
271
271
|
* Copy of TypeScript's ReadonlyMap, but with `TreeNodeFromImplicitAllowedTypesUnsafe<T>` inlined into it.
|
|
272
272
|
* Using this instead of ReadonlyMap in TreeMapNodeUnsafe is necessary to make recursive map schema not generate compile errors in the d.ts files when exported.
|
|
273
273
|
* @remarks
|
|
274
|
-
* Do
|
|
274
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
275
275
|
* @privateRemarks
|
|
276
276
|
* This is the same as `ReadonlyMap<K, TreeNodeFromImplicitAllowedTypesUnsafe<T>>` (Checked in test),
|
|
277
277
|
* except that it avoids the above mentioned compile error.
|
|
@@ -313,7 +313,7 @@ export interface ReadonlyMapInlined<K, T extends Unenforced<ImplicitAllowedTypes
|
|
|
313
313
|
/**
|
|
314
314
|
* {@link Unenforced} version of `FieldHasDefault`.
|
|
315
315
|
* @remarks
|
|
316
|
-
* Do
|
|
316
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
317
317
|
* @system @sealed @public
|
|
318
318
|
*/
|
|
319
319
|
export type FieldHasDefaultUnsafe<T extends Unenforced<ImplicitFieldSchema>> =
|
|
@@ -328,7 +328,7 @@ export type FieldHasDefaultUnsafe<T extends Unenforced<ImplicitFieldSchema>> =
|
|
|
328
328
|
* {@link Unenforced} version of `InsertableObjectFromSchemaRecord`.
|
|
329
329
|
* @see {@link Input}
|
|
330
330
|
* @remarks
|
|
331
|
-
* Do
|
|
331
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
332
332
|
* @system @public
|
|
333
333
|
*/
|
|
334
334
|
export type InsertableObjectFromSchemaRecordUnsafe<
|
|
@@ -350,7 +350,7 @@ export type InsertableObjectFromSchemaRecordUnsafe<
|
|
|
350
350
|
* {@link Unenforced} version of {@link InsertableTreeFieldFromImplicitField}.
|
|
351
351
|
* @see {@link Input}
|
|
352
352
|
* @remarks
|
|
353
|
-
* Do
|
|
353
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
354
354
|
* @system @public
|
|
355
355
|
*/
|
|
356
356
|
export type InsertableTreeFieldFromImplicitFieldUnsafe<
|
|
@@ -365,7 +365,7 @@ export type InsertableTreeFieldFromImplicitFieldUnsafe<
|
|
|
365
365
|
/**
|
|
366
366
|
* {@link Unenforced} version of {@link FieldSchema}.
|
|
367
367
|
* @remarks
|
|
368
|
-
* Do
|
|
368
|
+
* Do not use this type directly: it's only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
|
|
369
369
|
* @public
|
|
370
370
|
*/
|
|
371
371
|
export interface FieldSchemaUnsafe<
|
|
@@ -39,9 +39,10 @@ import {
|
|
|
39
39
|
import { isObjectNodeSchema } from "../objectNodeTypes.js";
|
|
40
40
|
import {
|
|
41
41
|
customFromCursor,
|
|
42
|
+
replaceHandles,
|
|
42
43
|
type CustomTreeNode,
|
|
43
|
-
type CustomTreeValue,
|
|
44
44
|
type EncodeOptions,
|
|
45
|
+
type HandleConverter,
|
|
45
46
|
} from "./customTree.js";
|
|
46
47
|
import { getUnhydratedContext } from "../createContext.js";
|
|
47
48
|
|
|
@@ -110,20 +111,10 @@ export interface VerboseTreeNode<THandle = IFluidHandle> {
|
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
/**
|
|
113
|
-
* Options for how to interpret a `VerboseTree
|
|
114
|
+
* Options for how to interpret a `VerboseTree` when schema information is available.
|
|
114
115
|
* @alpha
|
|
115
116
|
*/
|
|
116
|
-
export interface ParseOptions
|
|
117
|
-
/**
|
|
118
|
-
* Fixup custom input formats.
|
|
119
|
-
* @remarks
|
|
120
|
-
* Main usage is to handle IFluidHandles.
|
|
121
|
-
* When targeting JSON compatibility,
|
|
122
|
-
* this may be by throwing an error or including a placeholder.
|
|
123
|
-
* Since IFluidHandles are special references to FLuid data which is garbage collected when not referenced by the container for long enough,
|
|
124
|
-
* any scheme for encoding handles for storage outside the container (or in formats the container does not understand) is unreliable.
|
|
125
|
-
*/
|
|
126
|
-
valueConverter(data: VerboseTree<TCustom>): TreeLeafValue | VerboseTreeNode<TCustom>;
|
|
117
|
+
export interface ParseOptions {
|
|
127
118
|
/**
|
|
128
119
|
* If true, interpret the input keys of object nodes as stored keys.
|
|
129
120
|
* If false, interpret them as property keys.
|
|
@@ -133,15 +124,9 @@ export interface ParseOptions<TCustom> {
|
|
|
133
124
|
}
|
|
134
125
|
|
|
135
126
|
/**
|
|
136
|
-
* Options for how to interpret a `VerboseTree
|
|
127
|
+
* Options for how to interpret a `VerboseTree` without relying on schema.
|
|
137
128
|
*/
|
|
138
|
-
export interface SchemalessParseOptions
|
|
139
|
-
/**
|
|
140
|
-
* Fixup custom input formats.
|
|
141
|
-
* @remarks
|
|
142
|
-
* See note on {@link ParseOptions.valueConverter}.
|
|
143
|
-
*/
|
|
144
|
-
valueConverter(data: VerboseTree<TCustom>): TreeLeafValue | VerboseTreeNode<TCustom>;
|
|
129
|
+
export interface SchemalessParseOptions {
|
|
145
130
|
/**
|
|
146
131
|
* Converts stored keys into whatever key the tree is using in its encoding.
|
|
147
132
|
*/
|
|
@@ -154,11 +139,11 @@ export interface SchemalessParseOptions<TCustom> {
|
|
|
154
139
|
/**
|
|
155
140
|
* Use info from `schema` to convert `options` to {@link SchemalessParseOptions}.
|
|
156
141
|
*/
|
|
157
|
-
export function applySchemaToParserOptions
|
|
142
|
+
export function applySchemaToParserOptions(
|
|
158
143
|
schema: ImplicitFieldSchema,
|
|
159
|
-
options: ParseOptions
|
|
160
|
-
): SchemalessParseOptions
|
|
161
|
-
const config: Required<ParseOptions
|
|
144
|
+
options: ParseOptions,
|
|
145
|
+
): SchemalessParseOptions {
|
|
146
|
+
const config: Required<ParseOptions> = {
|
|
162
147
|
useStoredKeys: false,
|
|
163
148
|
...options,
|
|
164
149
|
};
|
|
@@ -166,7 +151,6 @@ export function applySchemaToParserOptions<TCustom>(
|
|
|
166
151
|
const context = getUnhydratedContext(schema);
|
|
167
152
|
|
|
168
153
|
return {
|
|
169
|
-
valueConverter: config.valueConverter,
|
|
170
154
|
keyConverter: config.useStoredKeys
|
|
171
155
|
? undefined
|
|
172
156
|
: {
|
|
@@ -213,9 +197,9 @@ export function applySchemaToParserOptions<TCustom>(
|
|
|
213
197
|
*
|
|
214
198
|
* @returns an {@link ITreeCursorSynchronous} for a single node in nodes mode.
|
|
215
199
|
*/
|
|
216
|
-
export function cursorFromVerbose
|
|
217
|
-
data: VerboseTree
|
|
218
|
-
options: SchemalessParseOptions
|
|
200
|
+
export function cursorFromVerbose(
|
|
201
|
+
data: VerboseTree,
|
|
202
|
+
options: SchemalessParseOptions,
|
|
219
203
|
): ITreeCursorSynchronous {
|
|
220
204
|
return stackTreeNodeCursor(verboseTreeAdapter(options), data);
|
|
221
205
|
}
|
|
@@ -225,9 +209,9 @@ export function cursorFromVerbose<TCustom>(
|
|
|
225
209
|
*
|
|
226
210
|
* @returns an {@link ITreeCursorSynchronous} for a single field in fields mode.
|
|
227
211
|
*/
|
|
228
|
-
export function fieldCursorFromVerbose
|
|
229
|
-
data: VerboseTree
|
|
230
|
-
options: SchemalessParseOptions
|
|
212
|
+
export function fieldCursorFromVerbose(
|
|
213
|
+
data: VerboseTree[],
|
|
214
|
+
options: SchemalessParseOptions,
|
|
231
215
|
): ITreeCursorSynchronous {
|
|
232
216
|
return stackTreeFieldCursor(
|
|
233
217
|
verboseTreeAdapter(options),
|
|
@@ -236,16 +220,12 @@ export function fieldCursorFromVerbose<TCustom>(
|
|
|
236
220
|
);
|
|
237
221
|
}
|
|
238
222
|
|
|
239
|
-
function verboseTreeAdapter<
|
|
240
|
-
options: SchemalessParseOptions<TCustom>,
|
|
241
|
-
): CursorAdapter<VerboseTree<TCustom>> {
|
|
223
|
+
function verboseTreeAdapter(options: SchemalessParseOptions): CursorAdapter<VerboseTree> {
|
|
242
224
|
return {
|
|
243
|
-
value: (
|
|
244
|
-
const node = options.valueConverter(input);
|
|
225
|
+
value: (node: VerboseTree) => {
|
|
245
226
|
return isTreeValue(node) ? node : undefined;
|
|
246
227
|
},
|
|
247
|
-
type: (
|
|
248
|
-
const node = options.valueConverter(input);
|
|
228
|
+
type: (node: VerboseTree) => {
|
|
249
229
|
switch (typeof node) {
|
|
250
230
|
case "number":
|
|
251
231
|
return numberSchema.identifier as TreeNodeSchemaIdentifier;
|
|
@@ -263,8 +243,7 @@ function verboseTreeAdapter<TCustom>(
|
|
|
263
243
|
return node.type as TreeNodeSchemaIdentifier;
|
|
264
244
|
}
|
|
265
245
|
},
|
|
266
|
-
keysFromNode: (
|
|
267
|
-
const node = options.valueConverter(input);
|
|
246
|
+
keysFromNode: (node: VerboseTree): readonly FieldKey[] => {
|
|
268
247
|
switch (typeof node) {
|
|
269
248
|
case "object": {
|
|
270
249
|
if (node === null) {
|
|
@@ -288,11 +267,7 @@ function verboseTreeAdapter<TCustom>(
|
|
|
288
267
|
return [];
|
|
289
268
|
}
|
|
290
269
|
},
|
|
291
|
-
getFieldFromNode: (
|
|
292
|
-
input: VerboseTree<TCustom>,
|
|
293
|
-
key: FieldKey,
|
|
294
|
-
): readonly VerboseTree<TCustom>[] => {
|
|
295
|
-
const node = options.valueConverter(input);
|
|
270
|
+
getFieldFromNode: (node: VerboseTree, key: FieldKey): readonly VerboseTree[] => {
|
|
296
271
|
// Object.prototype.hasOwnProperty can return true for strings (ex: with key "0"), so we have to filter them out.
|
|
297
272
|
// Rather than just special casing strings, we can handle them with an early return for all primitives.
|
|
298
273
|
if (typeof node !== "object") {
|
|
@@ -327,12 +302,12 @@ function verboseTreeAdapter<TCustom>(
|
|
|
327
302
|
/**
|
|
328
303
|
* Used to read a node cursor as a VerboseTree.
|
|
329
304
|
*/
|
|
330
|
-
export function verboseFromCursor
|
|
305
|
+
export function verboseFromCursor(
|
|
331
306
|
reader: ITreeCursor,
|
|
332
307
|
rootSchema: ImplicitAllowedTypes,
|
|
333
|
-
options: EncodeOptions
|
|
334
|
-
): VerboseTree
|
|
335
|
-
const config: Required<EncodeOptions
|
|
308
|
+
options: EncodeOptions,
|
|
309
|
+
): VerboseTree {
|
|
310
|
+
const config: Required<EncodeOptions> = {
|
|
336
311
|
useStoredKeys: false,
|
|
337
312
|
...options,
|
|
338
313
|
};
|
|
@@ -342,20 +317,33 @@ export function verboseFromCursor<TCustom>(
|
|
|
342
317
|
return verboseFromCursorInner(reader, config, schemaMap);
|
|
343
318
|
}
|
|
344
319
|
|
|
345
|
-
function verboseFromCursorInner
|
|
320
|
+
function verboseFromCursorInner(
|
|
346
321
|
reader: ITreeCursor,
|
|
347
|
-
options: Required<EncodeOptions
|
|
322
|
+
options: Required<EncodeOptions>,
|
|
348
323
|
schema: ReadonlyMap<string, TreeNodeSchema>,
|
|
349
|
-
): VerboseTree
|
|
324
|
+
): VerboseTree {
|
|
350
325
|
const fields = customFromCursor(reader, options, schema, verboseFromCursorInner);
|
|
351
326
|
const nodeSchema =
|
|
352
327
|
schema.get(reader.type) ?? fail(0xb3c /* missing schema for type in cursor */);
|
|
353
328
|
if (nodeSchema.kind === NodeKind.Leaf) {
|
|
354
|
-
return fields as
|
|
329
|
+
return fields as TreeLeafValue;
|
|
355
330
|
}
|
|
356
331
|
|
|
357
332
|
return {
|
|
358
333
|
type: reader.type,
|
|
359
|
-
fields: fields as CustomTreeNode<
|
|
334
|
+
fields: fields as CustomTreeNode<VerboseTree>,
|
|
360
335
|
};
|
|
361
336
|
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Clones tree, replacing any handles.
|
|
340
|
+
* @remarks
|
|
341
|
+
* A strongly types version of {@link replaceHandles}.
|
|
342
|
+
* @alpha
|
|
343
|
+
*/
|
|
344
|
+
export function replaceVerboseTreeHandles<T>(
|
|
345
|
+
tree: VerboseTree,
|
|
346
|
+
replacer: HandleConverter<T>,
|
|
347
|
+
): VerboseTree<T> {
|
|
348
|
+
return replaceHandles(tree, replacer) as VerboseTree<T>;
|
|
349
|
+
}
|
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
type ExclusiveMapTree,
|
|
16
16
|
type FieldKey,
|
|
17
17
|
type FieldKindIdentifier,
|
|
18
|
-
type FieldUpPath,
|
|
19
18
|
forbiddenFieldKindIdentifier,
|
|
20
19
|
type ITreeCursorSynchronous,
|
|
21
20
|
type MapTree,
|
|
21
|
+
type NormalizedFieldUpPath,
|
|
22
22
|
type SchemaPolicy,
|
|
23
23
|
type TreeNodeSchemaIdentifier,
|
|
24
24
|
type TreeNodeStoredSchema,
|
|
@@ -394,7 +394,7 @@ class UnhydratedFlexTreeField implements FlexTreeField {
|
|
|
394
394
|
this.onEdit?.();
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
-
public getFieldPath():
|
|
397
|
+
public getFieldPath(): NormalizedFieldUpPath {
|
|
398
398
|
throw unsupportedUsageError("Editing an array");
|
|
399
399
|
}
|
|
400
400
|
|
|
@@ -44,28 +44,18 @@ export function markEager<T>(t: T): T {
|
|
|
44
44
|
* By default, items that are of type `"function"` will be considered lazy and all other items will be considered eager.
|
|
45
45
|
* To force a `"function"` item to be treated as an eager item, call `markEager` before putting it in the list.
|
|
46
46
|
* This is necessary e.g. when the eager list items are function types and the lazy items are functions that _return_ function types.
|
|
47
|
-
*
|
|
47
|
+
* Our one use of FlexList has some special normalization logic, see {@link normalizeAllowedTypes}.
|
|
48
48
|
* @system @public
|
|
49
49
|
*/
|
|
50
50
|
export type FlexList<Item = unknown> = readonly LazyItem<Item>[];
|
|
51
51
|
|
|
52
|
-
/**
|
|
53
|
-
* Given a `FlexList` of eager and lazy items, return an equivalent list where all items are eager.
|
|
54
|
-
*/
|
|
55
|
-
export function normalizeFlexListEager<T>(t: FlexList<T>): T[] {
|
|
56
|
-
const data: T[] = t.map((value: LazyItem<T>) => {
|
|
57
|
-
if (isLazy(value)) {
|
|
58
|
-
return value();
|
|
59
|
-
}
|
|
60
|
-
return value;
|
|
61
|
-
});
|
|
62
|
-
return data;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
52
|
/**
|
|
66
53
|
* An "eager" or "lazy" Item in a `FlexList`.
|
|
67
54
|
* Lazy items are wrapped in a function to allow referring to themselves before they are declared.
|
|
68
55
|
* This makes recursive and co-recursive items possible.
|
|
56
|
+
* @privateRemarks
|
|
57
|
+
* `schemaTypes.ts`'s `evaluateLazySchema` (via {@link normalizeAllowedTypes})
|
|
58
|
+
* applies caching for the only current use of this type.
|
|
69
59
|
* @public
|
|
70
60
|
*/
|
|
71
61
|
export type LazyItem<Item = unknown> = Item | (() => Item);
|
package/src/simple-tree/index.ts
CHANGED
|
@@ -136,6 +136,11 @@ export {
|
|
|
136
136
|
type TransactionResultSuccess,
|
|
137
137
|
type TransactionResultFailed,
|
|
138
138
|
rollback,
|
|
139
|
+
generateSchemaFromSimpleSchema,
|
|
140
|
+
replaceConciseTreeHandles,
|
|
141
|
+
replaceHandles,
|
|
142
|
+
replaceVerboseTreeHandles,
|
|
143
|
+
type HandleConverter,
|
|
139
144
|
} from "./api/index.js";
|
|
140
145
|
export {
|
|
141
146
|
type NodeFromSchema,
|
|
@@ -170,6 +175,7 @@ export {
|
|
|
170
175
|
type ReadSchema,
|
|
171
176
|
type NodeSchemaOptions,
|
|
172
177
|
type NodeSchemaMetadata,
|
|
178
|
+
evaluateLazySchema,
|
|
173
179
|
} from "./schemaTypes.js";
|
|
174
180
|
export {
|
|
175
181
|
getTreeNodeForField,
|
|
@@ -340,6 +340,9 @@ export function objectSchema<
|
|
|
340
340
|
metadata?: NodeSchemaMetadata<TCustomMetadata>,
|
|
341
341
|
): ObjectNodeSchema<TName, T, ImplicitlyConstructable, TCustomMetadata> &
|
|
342
342
|
ObjectNodeSchemaInternalData {
|
|
343
|
+
// Field set can't be modified after this since derived data is stored in maps.
|
|
344
|
+
Object.freeze(info);
|
|
345
|
+
|
|
343
346
|
// Ensure no collisions between final set of property keys, and final set of stored keys (including those
|
|
344
347
|
// implicitly derived from property keys)
|
|
345
348
|
assertUniqueKeys(identifier, info);
|
|
@@ -7,7 +7,7 @@ import type { ErasedType, IFluidHandle } from "@fluidframework/core-interfaces";
|
|
|
7
7
|
import { Lazy } from "@fluidframework/core-utils/internal";
|
|
8
8
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
9
9
|
|
|
10
|
-
import type {
|
|
10
|
+
import type { NodeIdentifierManager } from "../feature-libraries/index.js";
|
|
11
11
|
import {
|
|
12
12
|
type MakeNominal,
|
|
13
13
|
brand,
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
compareSets,
|
|
17
17
|
type requireTrue,
|
|
18
18
|
type areOnlyKeys,
|
|
19
|
+
getOrCreate,
|
|
19
20
|
} from "../util/index.js";
|
|
20
21
|
import type {
|
|
21
22
|
Unhydrated,
|
|
@@ -26,9 +27,12 @@ import type {
|
|
|
26
27
|
TreeNodeSchemaCore,
|
|
27
28
|
TreeNodeSchemaNonClass,
|
|
28
29
|
} from "./core/index.js";
|
|
30
|
+
import { inPrototypeChain } from "./core/index.js";
|
|
29
31
|
import type { FieldKey } from "../core/index.js";
|
|
30
32
|
import type { InsertableContent } from "./toMapTree.js";
|
|
31
33
|
import { isLazy, type FlexListToUnion, type LazyItem } from "./flexList.js";
|
|
34
|
+
import { LeafNodeSchema } from "./leafNodeSchema.js";
|
|
35
|
+
import { TreeNodeValid } from "./treeNodeValid.js";
|
|
32
36
|
|
|
33
37
|
/**
|
|
34
38
|
* Returns true if the given schema is a {@link TreeNodeSchemaClass}, or otherwise false if it is a {@link TreeNodeSchemaNonClass}.
|
|
@@ -69,6 +73,8 @@ export function isTreeNodeSchemaClass<
|
|
|
69
73
|
* way to declare and manipulate unordered sets of types in TypeScript.
|
|
70
74
|
*
|
|
71
75
|
* Not intended for direct use outside of package.
|
|
76
|
+
* @privateRemarks
|
|
77
|
+
* Code reading data from this should use `normalizeAllowedTypes` to ensure consistent handling, caching, nice errors etc.
|
|
72
78
|
* @system @public
|
|
73
79
|
*/
|
|
74
80
|
export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
|
|
@@ -202,7 +208,7 @@ export interface FieldProps<TCustomMetadata = unknown> {
|
|
|
202
208
|
* A {@link FieldProvider} which requires additional context in order to produce its content
|
|
203
209
|
*/
|
|
204
210
|
export type ContextualFieldProvider = (
|
|
205
|
-
context:
|
|
211
|
+
context: NodeIdentifierManager,
|
|
206
212
|
) => InsertableContent | undefined;
|
|
207
213
|
/**
|
|
208
214
|
* A {@link FieldProvider} which can produce its content in a vacuum
|
|
@@ -379,6 +385,8 @@ export function normalizeAllowedTypes(
|
|
|
379
385
|
): ReadonlySet<TreeNodeSchema> {
|
|
380
386
|
const normalized = new Set<TreeNodeSchema>();
|
|
381
387
|
if (isReadonlyArray(types)) {
|
|
388
|
+
// Types array must not be modified after it is normalized since that would result in the user of the normalized data having wrong (out of date) content.
|
|
389
|
+
Object.freeze(types);
|
|
382
390
|
for (const lazyType of types) {
|
|
383
391
|
normalized.add(evaluateLazySchema(lazyType));
|
|
384
392
|
}
|
|
@@ -469,16 +477,72 @@ function areMetadataEqual(
|
|
|
469
477
|
return a?.custom === b?.custom && a?.description === b?.description;
|
|
470
478
|
}
|
|
471
479
|
|
|
472
|
-
|
|
473
|
-
|
|
480
|
+
const cachedLazyItem = new WeakMap<() => unknown, unknown>();
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Returns the schema referenced by the {@link LazyItem}.
|
|
484
|
+
* @remarks
|
|
485
|
+
* Caches results to handle {@link LazyItem}s which compute their resulting schema.
|
|
486
|
+
* @alpha
|
|
487
|
+
*/
|
|
488
|
+
export function evaluateLazySchema<T extends TreeNodeSchema>(value: LazyItem<T>): T {
|
|
489
|
+
const evaluatedSchema = isLazy(value)
|
|
490
|
+
? (getOrCreate(cachedLazyItem, value, value) as T)
|
|
491
|
+
: value;
|
|
474
492
|
if (evaluatedSchema === undefined) {
|
|
475
493
|
throw new UsageError(
|
|
476
494
|
`Encountered an undefined schema. This could indicate that some referenced schema has not yet been instantiated.`,
|
|
477
495
|
);
|
|
478
496
|
}
|
|
497
|
+
markSchemaMostDerived(evaluatedSchema);
|
|
479
498
|
return evaluatedSchema;
|
|
480
499
|
}
|
|
481
500
|
|
|
501
|
+
/**
|
|
502
|
+
* Indicates that the provided schema is the "most derived" version in its class hierarchy.
|
|
503
|
+
*
|
|
504
|
+
* @param oneTimeInitialize - If true this runs {@link TreeNodeValid.oneTimeInitialize} which does even more initialization and validation.
|
|
505
|
+
* `oneTimeInitialize` can't safely be run until all transitively referenced schema are defined, so which cases can safely use it are more limited.
|
|
506
|
+
* When legal for the caller to set this to true, it is preferred, but it is often not safe due to possible forward references.
|
|
507
|
+
* @remarks
|
|
508
|
+
* See {@link MostDerivedData} and {@link SchemaFactory} for details on what a "most derived" schema is and why it matters.
|
|
509
|
+
*
|
|
510
|
+
* This is a helper for invoking {@link TreeNodeValid.markMostDerived} for {@link TreeNodeSchema}.
|
|
511
|
+
*
|
|
512
|
+
* Calling this helps with error messages about invalid schema usage (See {@link SchemaFactory} for the rules, some of which this helps validate).
|
|
513
|
+
* Typically this should be called for each schema as early as practical to improve error reporting for invalid usages of schema
|
|
514
|
+
* (using two different schema derived from the same {@link SchemaFactory} produced base class).
|
|
515
|
+
*
|
|
516
|
+
* Note that construction of actual {@link TreeNode} instances or use of a schema transitively in a {@link TreeViewConfiguration} already do this,
|
|
517
|
+
* so any calls to this that is unconditionally after that point for the given schema is not needed.
|
|
518
|
+
* Instead most usages of this should be from those cases, and from miscellaneous cases where a schema is passed into an public API where theoretically someone could accidentally
|
|
519
|
+
* pass in a base class of a schema instead of the most derived one.
|
|
520
|
+
*/
|
|
521
|
+
export function markSchemaMostDerived(
|
|
522
|
+
schema: TreeNodeSchema,
|
|
523
|
+
oneTimeInitialize = false,
|
|
524
|
+
): void {
|
|
525
|
+
if (schema instanceof LeafNodeSchema) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if (!inPrototypeChain(schema, TreeNodeValid)) {
|
|
530
|
+
// Use JSON.stringify to quote and escape identifier string.
|
|
531
|
+
throw new UsageError(
|
|
532
|
+
`Schema for ${JSON.stringify(
|
|
533
|
+
schema.identifier,
|
|
534
|
+
)} does not extend a SchemaFactory generated class. This is invalid.`,
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
const schemaValid = schema as typeof TreeNodeValid & TreeNodeSchema;
|
|
539
|
+
if (oneTimeInitialize) {
|
|
540
|
+
schemaValid.oneTimeInitialize();
|
|
541
|
+
} else {
|
|
542
|
+
schemaValid.markMostDerived();
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
482
546
|
/**
|
|
483
547
|
* Types of {@link TreeNode|TreeNodes} or {@link TreeLeafValue|TreeLeafValues} allowed at a location in a tree.
|
|
484
548
|
* @remarks
|
|
@@ -508,6 +572,8 @@ function evaluateLazySchema(value: LazyItem<TreeNodeSchema>): TreeNodeSchema {
|
|
|
508
572
|
* class A extends sf.array("example", [() => B]) {}
|
|
509
573
|
* class B extends sf.array("Inner", sf.number) {}
|
|
510
574
|
* ```
|
|
575
|
+
* @privateRemarks
|
|
576
|
+
* Code reading data from this should use `normalizeAllowedTypes` to ensure consistent handling, caching, nice errors etc.
|
|
511
577
|
* @public
|
|
512
578
|
*/
|
|
513
579
|
export type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
isTreeValue,
|
|
21
21
|
valueSchemaAllows,
|
|
22
|
-
type
|
|
22
|
+
type NodeIdentifierManager,
|
|
23
23
|
} from "../feature-libraries/index.js";
|
|
24
24
|
import { brand, fail, isReadonlyArray, find, hasSome, hasSingle } from "../util/index.js";
|
|
25
25
|
|
|
@@ -104,19 +104,19 @@ import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
|
104
104
|
export function mapTreeFromNodeData(
|
|
105
105
|
data: InsertableContent,
|
|
106
106
|
allowedTypes: ImplicitAllowedTypes,
|
|
107
|
-
context?:
|
|
107
|
+
context?: NodeIdentifierManager,
|
|
108
108
|
schemaValidationPolicy?: SchemaAndPolicy,
|
|
109
109
|
): ExclusiveMapTree;
|
|
110
110
|
export function mapTreeFromNodeData(
|
|
111
111
|
data: InsertableContent | undefined,
|
|
112
112
|
allowedTypes: ImplicitFieldSchema,
|
|
113
|
-
context?:
|
|
113
|
+
context?: NodeIdentifierManager,
|
|
114
114
|
schemaValidationPolicy?: SchemaAndPolicy,
|
|
115
115
|
): ExclusiveMapTree | undefined;
|
|
116
116
|
export function mapTreeFromNodeData(
|
|
117
117
|
data: InsertableContent | undefined,
|
|
118
118
|
allowedTypes: ImplicitFieldSchema,
|
|
119
|
-
context?:
|
|
119
|
+
context?: NodeIdentifierManager,
|
|
120
120
|
schemaValidationPolicy?: SchemaAndPolicy,
|
|
121
121
|
): ExclusiveMapTree | undefined {
|
|
122
122
|
const normalizedFieldSchema = normalizeFieldSchema(allowedTypes);
|
|
@@ -638,7 +638,7 @@ function allowsValue(schema: TreeNodeSchema, value: TreeValue): boolean {
|
|
|
638
638
|
export function addDefaultsToMapTree(
|
|
639
639
|
mapTree: ExclusiveMapTree,
|
|
640
640
|
allowedTypes: ImplicitAllowedTypes,
|
|
641
|
-
context:
|
|
641
|
+
context: NodeIdentifierManager | undefined,
|
|
642
642
|
): void {
|
|
643
643
|
const schema =
|
|
644
644
|
find(normalizeAllowedTypes(allowedTypes), (s) => s.identifier === mapTree.type) ??
|
|
@@ -695,7 +695,7 @@ export function addDefaultsToMapTree(
|
|
|
695
695
|
*/
|
|
696
696
|
function provideDefault(
|
|
697
697
|
fieldProvider: FieldProvider,
|
|
698
|
-
context:
|
|
698
|
+
context: NodeIdentifierManager | undefined,
|
|
699
699
|
): InsertableContent | undefined {
|
|
700
700
|
if (context !== undefined) {
|
|
701
701
|
return fieldProvider(context);
|
|
@@ -20,18 +20,18 @@ import {
|
|
|
20
20
|
type TreeTypeSet,
|
|
21
21
|
} from "../core/index.js";
|
|
22
22
|
import { FieldKinds, type FlexFieldKind } from "../feature-libraries/index.js";
|
|
23
|
-
import { brand, fail, getOrCreate
|
|
23
|
+
import { brand, fail, getOrCreate } from "../util/index.js";
|
|
24
24
|
import { NodeKind, type TreeNodeSchema } from "./core/index.js";
|
|
25
25
|
import {
|
|
26
26
|
FieldKind,
|
|
27
27
|
FieldSchema,
|
|
28
|
+
normalizeAllowedTypes,
|
|
28
29
|
type ImplicitAllowedTypes,
|
|
29
30
|
type ImplicitFieldSchema,
|
|
30
31
|
} from "./schemaTypes.js";
|
|
31
32
|
import { walkFieldSchema } from "./walkFieldSchema.js";
|
|
32
33
|
import { LeafNodeSchema } from "./leafNodeSchema.js";
|
|
33
34
|
import { isObjectNodeSchema } from "./objectNodeTypes.js";
|
|
34
|
-
import { normalizeFlexListEager } from "./flexList.js";
|
|
35
35
|
|
|
36
36
|
const viewToStoredCache = new WeakMap<ImplicitFieldSchema, TreeStoredSchema>();
|
|
37
37
|
|
|
@@ -92,10 +92,7 @@ const convertFieldKind = new Map<FieldKind, FlexFieldKind>([
|
|
|
92
92
|
* Normalizes an {@link ImplicitAllowedTypes} into an {@link TreeTypeSet}.
|
|
93
93
|
*/
|
|
94
94
|
export function convertAllowedTypes(schema: ImplicitAllowedTypes): TreeTypeSet {
|
|
95
|
-
|
|
96
|
-
return new Set(normalizeFlexListEager(schema).map((item) => brand(item.identifier)));
|
|
97
|
-
}
|
|
98
|
-
return new Set([brand(schema.identifier)]);
|
|
95
|
+
return new Set([...normalizeAllowedTypes(schema)].map((item) => brand(item.identifier)));
|
|
99
96
|
}
|
|
100
97
|
|
|
101
98
|
/**
|