@fluidframework/tree 2.42.0 → 2.43.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 +189 -0
- package/api-report/tree.alpha.api.md +72 -25
- package/api-report/tree.beta.api.md +34 -0
- package/api-report/tree.legacy.alpha.api.md +1 -0
- package/api-report/tree.legacy.public.api.md +1 -0
- package/api-report/tree.public.api.md +1 -0
- package/dist/alpha.d.ts +12 -6
- package/dist/beta.d.ts +6 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +5 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/schema-stored/formatV2.d.ts +80 -0
- package/dist/core/schema-stored/formatV2.d.ts.map +1 -0
- package/dist/core/schema-stored/formatV2.js +55 -0
- package/dist/core/schema-stored/formatV2.js.map +1 -0
- package/dist/core/schema-stored/index.d.ts +3 -1
- package/dist/core/schema-stored/index.d.ts.map +1 -1
- package/dist/core/schema-stored/index.js +5 -2
- package/dist/core/schema-stored/index.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +49 -17
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +65 -22
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +9 -7
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +13 -9
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +3 -3
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +6 -6
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +3 -3
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +8 -3
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js +2 -5
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +24 -25
- 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/index.d.ts +0 -1
- package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/index.js +1 -7
- package/dist/feature-libraries/flex-tree/index.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +2 -2
- package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyEntity.js +3 -0
- package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts +1 -2
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +2 -5
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts +5 -5
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.js +15 -7
- package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +8 -3
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +2 -5
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +2 -2
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +1 -2
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/mapTreeCursor.d.ts +16 -2
- package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
- package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js +2 -0
- package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +2 -0
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -4
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -36
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.js +3 -3
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +59 -9
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV1.d.ts +1 -1
- package/dist/feature-libraries/schema-index/formatV2.d.ts +42 -0
- package/dist/feature-libraries/schema-index/formatV2.d.ts.map +1 -0
- package/dist/feature-libraries/schema-index/formatV2.js +26 -0
- package/dist/feature-libraries/schema-index/formatV2.js.map +1 -0
- package/dist/feature-libraries/schema-index/index.d.ts +2 -1
- package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/index.js +4 -2
- package/dist/feature-libraries/schema-index/index.js.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +7 -2
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js +6 -6
- package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -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/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +1 -0
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +3 -3
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +5 -1
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +34 -5
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +39 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +117 -11
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.d.ts +8 -3
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +2 -5
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +18 -7
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +15 -2
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/configuration.d.ts +15 -3
- package/dist/simple-tree/api/configuration.d.ts.map +1 -1
- package/dist/simple-tree/api/configuration.js +40 -22
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +4 -4
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
- package/dist/simple-tree/api/schemaCreationUtilities.js +3 -3
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +15 -11
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +4 -0
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +41 -11
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +31 -4
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +2 -2
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.d.ts +8 -3
- package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts +3 -0
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +1 -1
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +5 -0
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/dist/simple-tree/core/context.d.ts +3 -3
- package/dist/simple-tree/core/context.d.ts.map +1 -1
- package/dist/simple-tree/core/context.js.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.d.ts +9 -0
- package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.js +12 -1
- package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +2 -2
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +3 -1
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +2 -2
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +68 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js +24 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +5 -9
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +12 -31
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/core/walkSchema.d.ts +3 -3
- package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/walkSchema.js +9 -5
- package/dist/simple-tree/core/walkSchema.js.map +1 -1
- package/dist/simple-tree/createContext.js +1 -1
- package/dist/simple-tree/createContext.js.map +1 -1
- package/dist/simple-tree/getTreeNodeForField.d.ts +1 -1
- package/dist/simple-tree/getTreeNodeForField.d.ts.map +1 -1
- package/dist/simple-tree/getTreeNodeForField.js +3 -3
- package/dist/simple-tree/getTreeNodeForField.js.map +1 -1
- package/dist/simple-tree/index.d.ts +6 -6
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +8 -5
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +4 -1
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +1 -0
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +3 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +21 -16
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts +3 -2
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +11 -5
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts +3 -2
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +12 -7
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/dist/simple-tree/prepareForInsertion.js +5 -1
- package/dist/simple-tree/prepareForInsertion.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +63 -30
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +73 -40
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/simpleSchema.d.ts +22 -4
- package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchema.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts +4 -0
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +15 -4
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +1 -2
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/simple-tree/walkFieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/walkFieldSchema.js +1 -1
- package/dist/simple-tree/walkFieldSchema.js.map +1 -1
- package/dist/tableSchema.d.ts +1 -1
- package/dist/util/typeUtils.d.ts +2 -2
- package/dist/util/typeUtils.js.map +1 -1
- package/dist/util/utils.d.ts +2 -0
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +12 -6
- package/lib/beta.d.ts +6 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/schema-stored/formatV2.d.ts +80 -0
- package/lib/core/schema-stored/formatV2.d.ts.map +1 -0
- package/lib/core/schema-stored/formatV2.js +52 -0
- package/lib/core/schema-stored/formatV2.js.map +1 -0
- package/lib/core/schema-stored/index.d.ts +3 -1
- package/lib/core/schema-stored/index.d.ts.map +1 -1
- package/lib/core/schema-stored/index.js +3 -1
- package/lib/core/schema-stored/index.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +49 -17
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +63 -21
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +9 -7
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +11 -7
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +3 -3
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +7 -7
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +3 -3
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +8 -3
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js +2 -5
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +24 -25
- 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/index.d.ts +0 -1
- package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/index.js +0 -1
- package/lib/feature-libraries/flex-tree/index.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +2 -2
- package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyEntity.js +3 -0
- package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts +1 -2
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +3 -6
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts +5 -5
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js +15 -7
- package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +8 -3
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +2 -5
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +2 -2
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/mapTreeCursor.d.ts +16 -2
- package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
- package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js +2 -0
- package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +2 -0
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -4
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -36
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.js +3 -3
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +60 -10
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV1.d.ts +1 -1
- package/lib/feature-libraries/schema-index/formatV2.d.ts +42 -0
- package/lib/feature-libraries/schema-index/formatV2.d.ts.map +1 -0
- package/lib/feature-libraries/schema-index/formatV2.js +23 -0
- package/lib/feature-libraries/schema-index/formatV2.js.map +1 -0
- package/lib/feature-libraries/schema-index/index.d.ts +2 -1
- package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/index.js +2 -1
- package/lib/feature-libraries/schema-index/index.js.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +7 -2
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js +6 -6
- package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -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/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +1 -0
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +4 -4
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +5 -1
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +34 -5
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +39 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +111 -5
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.d.ts +8 -3
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +2 -5
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +18 -7
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +15 -2
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/configuration.d.ts +15 -3
- package/lib/simple-tree/api/configuration.d.ts.map +1 -1
- package/lib/simple-tree/api/configuration.js +42 -24
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.js +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
- package/lib/simple-tree/api/schemaCreationUtilities.js +3 -3
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +15 -11
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +4 -0
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +41 -11
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +31 -4
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +2 -2
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.d.ts +8 -3
- package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts +3 -0
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +2 -2
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +5 -0
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/lib/simple-tree/core/context.d.ts +3 -3
- package/lib/simple-tree/core/context.d.ts.map +1 -1
- package/lib/simple-tree/core/context.js.map +1 -1
- package/lib/simple-tree/core/getOrCreateNode.d.ts +9 -0
- package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
- package/lib/simple-tree/core/getOrCreateNode.js +10 -0
- package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +2 -2
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +2 -2
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +2 -2
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +68 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js +21 -0
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +5 -9
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +15 -34
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/core/walkSchema.d.ts +3 -3
- package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/walkSchema.js +9 -5
- package/lib/simple-tree/core/walkSchema.js.map +1 -1
- package/lib/simple-tree/createContext.js +1 -1
- package/lib/simple-tree/createContext.js.map +1 -1
- package/lib/simple-tree/getTreeNodeForField.d.ts +1 -1
- package/lib/simple-tree/getTreeNodeForField.d.ts.map +1 -1
- package/lib/simple-tree/getTreeNodeForField.js +1 -1
- package/lib/simple-tree/getTreeNodeForField.js.map +1 -1
- package/lib/simple-tree/index.d.ts +6 -6
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +4 -4
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +4 -1
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +2 -1
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +3 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +13 -8
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts +3 -2
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +14 -8
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts +3 -2
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +14 -9
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/lib/simple-tree/prepareForInsertion.js +5 -1
- package/lib/simple-tree/prepareForInsertion.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +63 -30
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +70 -36
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/simpleSchema.d.ts +22 -4
- package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchema.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts +4 -0
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +15 -4
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +1 -2
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/simple-tree/walkFieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/walkFieldSchema.js +1 -1
- package/lib/simple-tree/walkFieldSchema.js.map +1 -1
- package/lib/tableSchema.d.ts +1 -1
- package/lib/util/typeUtils.d.ts +2 -2
- package/lib/util/typeUtils.js.map +1 -1
- package/lib/util/utils.d.ts +2 -0
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js.map +1 -1
- package/package.json +23 -23
- package/src/core/index.ts +3 -1
- package/src/core/schema-stored/formatV2.ts +78 -0
- package/src/core/schema-stored/index.ts +4 -1
- package/src/core/schema-stored/schema.ts +123 -33
- package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +16 -11
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +16 -7
- package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +4 -4
- package/src/feature-libraries/detachedFieldIndexSummarizer.ts +9 -16
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +33 -30
- package/src/feature-libraries/flex-tree/index.ts +0 -8
- package/src/feature-libraries/flex-tree/lazyEntity.ts +5 -1
- package/src/feature-libraries/flex-tree/lazyField.ts +5 -8
- package/src/feature-libraries/flex-tree/lazyNode.ts +17 -8
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +9 -16
- package/src/feature-libraries/index.ts +1 -1
- package/src/feature-libraries/mapTreeCursor.ts +17 -8
- package/src/feature-libraries/modular-schema/fieldKindWithEditor.ts +2 -0
- package/src/feature-libraries/object-forest/objectForest.ts +3 -0
- package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +11 -6
- package/src/feature-libraries/schema-edits/schemaChangeFormat.ts +3 -3
- package/src/feature-libraries/schema-index/codec.ts +73 -14
- package/src/feature-libraries/schema-index/formatV2.ts +30 -0
- package/src/feature-libraries/schema-index/index.ts +2 -1
- package/src/feature-libraries/schema-index/schemaSummarizer.ts +11 -18
- package/src/index.ts +6 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/schematizeTree.ts +1 -0
- package/src/shared-tree/schematizingTreeView.ts +8 -5
- package/src/shared-tree/sharedTree.ts +42 -12
- package/src/shared-tree/treeAlpha.ts +196 -6
- package/src/shared-tree-core/editManagerSummarizer.ts +9 -16
- package/src/shared-tree-core/sharedTreeCore.ts +33 -24
- package/src/simple-tree/api/configuration.ts +59 -27
- package/src/simple-tree/api/index.ts +3 -3
- package/src/simple-tree/api/schemaCompatibilityTester.ts +1 -1
- package/src/simple-tree/api/schemaCreationUtilities.ts +3 -3
- package/src/simple-tree/api/schemaFactory.ts +16 -11
- package/src/simple-tree/api/schemaFactoryAlpha.ts +53 -8
- package/src/simple-tree/api/storedSchema.ts +4 -4
- package/src/simple-tree/api/treeChangeEvents.ts +8 -3
- package/src/simple-tree/api/treeNodeApi.ts +5 -2
- package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +5 -0
- package/src/simple-tree/core/context.ts +3 -3
- package/src/simple-tree/core/getOrCreateNode.ts +14 -0
- package/src/simple-tree/core/index.ts +7 -1
- package/src/simple-tree/core/treeNodeKernel.ts +2 -2
- package/src/simple-tree/core/treeNodeSchema.ts +113 -1
- package/src/simple-tree/core/unhydratedFlexTree.ts +22 -44
- package/src/simple-tree/core/walkSchema.ts +16 -7
- package/src/simple-tree/createContext.ts +1 -1
- package/src/simple-tree/getTreeNodeForField.ts +3 -1
- package/src/simple-tree/index.ts +12 -5
- package/src/simple-tree/leafNodeSchema.ts +9 -1
- package/src/simple-tree/node-kinds/array/arrayNode.ts +20 -9
- package/src/simple-tree/node-kinds/map/mapNode.ts +21 -6
- package/src/simple-tree/node-kinds/object/objectNode.ts +29 -12
- package/src/simple-tree/prepareForInsertion.ts +5 -1
- package/src/simple-tree/schemaTypes.ts +151 -71
- package/src/simple-tree/simpleSchema.ts +27 -5
- package/src/simple-tree/toStoredSchema.ts +17 -4
- package/src/simple-tree/treeNodeValid.ts +1 -1
- package/src/simple-tree/walkFieldSchema.ts +5 -1
- package/src/util/typeUtils.ts +2 -2
- package/src/util/utils.ts +2 -0
- package/dist/feature-libraries/flex-tree/navigation.d.ts +0 -46
- package/dist/feature-libraries/flex-tree/navigation.d.ts.map +0 -1
- package/dist/feature-libraries/flex-tree/navigation.js +0 -104
- package/dist/feature-libraries/flex-tree/navigation.js.map +0 -1
- package/lib/feature-libraries/flex-tree/navigation.d.ts +0 -46
- package/lib/feature-libraries/flex-tree/navigation.d.ts.map +0 -1
- package/lib/feature-libraries/flex-tree/navigation.js +0 -97
- package/lib/feature-libraries/flex-tree/navigation.js.map +0 -1
- package/src/feature-libraries/flex-tree/navigation.ts +0 -121
|
@@ -6,16 +6,27 @@
|
|
|
6
6
|
import { fail } from "@fluidframework/core-utils/internal";
|
|
7
7
|
|
|
8
8
|
import { DiscriminatedUnionDispatcher } from "../../codec/index.js";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
type JsonCompatibleReadOnlyObject,
|
|
11
|
+
type MakeNominal,
|
|
12
|
+
brand,
|
|
13
|
+
invertMap,
|
|
14
|
+
} from "../../util/index.js";
|
|
10
15
|
|
|
11
16
|
import {
|
|
12
17
|
type FieldKey,
|
|
13
18
|
type FieldKindIdentifier,
|
|
14
|
-
type FieldSchemaFormat,
|
|
19
|
+
type FieldSchemaFormat as FieldSchemaFormatV1,
|
|
15
20
|
PersistedValueSchema,
|
|
16
|
-
type TreeNodeSchemaDataFormat,
|
|
21
|
+
type TreeNodeSchemaDataFormat as TreeNodeSchemaDataFormatV1,
|
|
17
22
|
type TreeNodeSchemaIdentifier,
|
|
18
23
|
} from "./formatV1.js";
|
|
24
|
+
import type {
|
|
25
|
+
FieldSchemaFormat as FieldSchemaFormatV2,
|
|
26
|
+
PersistedMetadataFormat,
|
|
27
|
+
TreeNodeSchemaUnionFormat,
|
|
28
|
+
TreeNodeSchemaDataFormat as TreeNodeSchemaDataFormatV2,
|
|
29
|
+
} from "./formatV2.js";
|
|
19
30
|
import type { Multiplicity } from "./multiplicity.js";
|
|
20
31
|
|
|
21
32
|
/**
|
|
@@ -23,8 +34,14 @@ import type { Multiplicity } from "./multiplicity.js";
|
|
|
23
34
|
*/
|
|
24
35
|
export enum SchemaVersion {
|
|
25
36
|
v1 = 1,
|
|
37
|
+
/**
|
|
38
|
+
* Adds persisted metadata to the node schema and field schema.
|
|
39
|
+
*/
|
|
40
|
+
v2 = 2,
|
|
26
41
|
}
|
|
27
42
|
|
|
43
|
+
type FieldSchemaFormat = FieldSchemaFormatV1 | FieldSchemaFormatV2;
|
|
44
|
+
|
|
28
45
|
/**
|
|
29
46
|
* Schema for what {@link TreeLeafValue} is allowed on a Leaf node.
|
|
30
47
|
* @privateRemarks
|
|
@@ -128,6 +145,15 @@ export interface TreeFieldStoredSchema {
|
|
|
128
145
|
* If not specified, types are unconstrained.
|
|
129
146
|
*/
|
|
130
147
|
readonly types: TreeTypeSet;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Portion of the metadata which can be persisted.
|
|
151
|
+
* @remarks
|
|
152
|
+
* Discarded when encoding to {@link SchemaFormatVersion.V1}.
|
|
153
|
+
* @privateRemarks
|
|
154
|
+
* This field corresponds to the `metadata` field in the persisted schema format.
|
|
155
|
+
*/
|
|
156
|
+
readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined;
|
|
131
157
|
}
|
|
132
158
|
|
|
133
159
|
/**
|
|
@@ -151,6 +177,7 @@ export const storedEmptyFieldSchema: TreeFieldStoredSchema = {
|
|
|
151
177
|
kind: brand(forbiddenFieldKindIdentifier),
|
|
152
178
|
// This type set also forces the field to be empty not not allowing any types as all.
|
|
153
179
|
types: new Set(),
|
|
180
|
+
persistedMetadata: undefined,
|
|
154
181
|
};
|
|
155
182
|
|
|
156
183
|
/**
|
|
@@ -164,12 +191,21 @@ export abstract class TreeNodeStoredSchema {
|
|
|
164
191
|
protected _typeCheck!: MakeNominal;
|
|
165
192
|
|
|
166
193
|
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
|
|
170
|
-
|
|
194
|
+
* Constructor for a TreeNodeStoredSchema.
|
|
195
|
+
* @param metadata - Persisted metadata for this node schema.
|
|
196
|
+
*/
|
|
197
|
+
public constructor(public readonly metadata: PersistedMetadataFormat | undefined) {}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Encode in the v1 schema format.
|
|
171
201
|
*/
|
|
172
|
-
public abstract
|
|
202
|
+
public abstract encodeV1(): TreeNodeSchemaDataFormatV1;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Encode in the v2 schema format.
|
|
206
|
+
* @remarks Post-condition: if metadata was specified on the input schema, it will be present in the output.
|
|
207
|
+
*/
|
|
208
|
+
public abstract encodeV2(): TreeNodeSchemaDataFormatV2;
|
|
173
209
|
|
|
174
210
|
/**
|
|
175
211
|
* Returns the schema for the provided field.
|
|
@@ -190,11 +226,35 @@ export class ObjectNodeStoredSchema extends TreeNodeStoredSchema {
|
|
|
190
226
|
*/
|
|
191
227
|
public constructor(
|
|
192
228
|
public readonly objectNodeFields: ReadonlyMap<FieldKey, TreeFieldStoredSchema>,
|
|
229
|
+
metadata?: PersistedMetadataFormat | undefined,
|
|
193
230
|
) {
|
|
194
|
-
super();
|
|
231
|
+
super(metadata);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
public override encodeV1(): TreeNodeSchemaDataFormatV1 {
|
|
235
|
+
const fieldsObject: Record<string, FieldSchemaFormat> =
|
|
236
|
+
this.encodeFieldsObject(encodeFieldSchemaV1);
|
|
237
|
+
|
|
238
|
+
return {
|
|
239
|
+
object: fieldsObject,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
public override encodeV2(): TreeNodeSchemaDataFormatV2 {
|
|
244
|
+
const fieldsObject: Record<string, FieldSchemaFormat> =
|
|
245
|
+
this.encodeFieldsObject(encodeFieldSchemaV2);
|
|
246
|
+
const kind = { object: fieldsObject };
|
|
247
|
+
|
|
248
|
+
return { kind, metadata: this.metadata };
|
|
195
249
|
}
|
|
196
250
|
|
|
197
|
-
public override
|
|
251
|
+
public override getFieldSchema(field: FieldKey): TreeFieldStoredSchema {
|
|
252
|
+
return this.objectNodeFields.get(field) ?? storedEmptyFieldSchema;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
private encodeFieldsObject(
|
|
256
|
+
encodeFieldSchema: (storedFieldSchema: TreeFieldStoredSchema) => FieldSchemaFormat,
|
|
257
|
+
): Record<string, FieldSchemaFormat> {
|
|
198
258
|
const fieldsObject: Record<string, FieldSchemaFormat> = Object.create(null);
|
|
199
259
|
// Sort fields to ensure output is identical for for equivalent schema (since field order is not considered significant).
|
|
200
260
|
// This makes comparing schema easier, and ensures chunk reuse for schema summaries isn't needlessly broken.
|
|
@@ -208,13 +268,7 @@ export class ObjectNodeStoredSchema extends TreeNodeStoredSchema {
|
|
|
208
268
|
),
|
|
209
269
|
});
|
|
210
270
|
}
|
|
211
|
-
return
|
|
212
|
-
object: fieldsObject,
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
public override getFieldSchema(field: FieldKey): TreeFieldStoredSchema {
|
|
217
|
-
return this.objectNodeFields.get(field) ?? storedEmptyFieldSchema;
|
|
271
|
+
return fieldsObject;
|
|
218
272
|
}
|
|
219
273
|
}
|
|
220
274
|
|
|
@@ -229,16 +283,24 @@ export class MapNodeStoredSchema extends TreeNodeStoredSchema {
|
|
|
229
283
|
* since no nodes can ever be in schema if you use `FieldKind.Value` here
|
|
230
284
|
* (that would require infinite children).
|
|
231
285
|
*/
|
|
232
|
-
public constructor(
|
|
233
|
-
|
|
286
|
+
public constructor(
|
|
287
|
+
public readonly mapFields: TreeFieldStoredSchema,
|
|
288
|
+
metadata?: PersistedMetadataFormat | undefined,
|
|
289
|
+
) {
|
|
290
|
+
super(metadata);
|
|
234
291
|
}
|
|
235
292
|
|
|
236
|
-
public override
|
|
293
|
+
public override encodeV1(): TreeNodeSchemaDataFormatV1 {
|
|
237
294
|
return {
|
|
238
|
-
map:
|
|
295
|
+
map: encodeFieldSchemaV1(this.mapFields),
|
|
239
296
|
};
|
|
240
297
|
}
|
|
241
298
|
|
|
299
|
+
public override encodeV2(): TreeNodeSchemaDataFormatV2 {
|
|
300
|
+
const kind = { map: encodeFieldSchemaV2(this.mapFields) };
|
|
301
|
+
return { kind, metadata: this.metadata };
|
|
302
|
+
}
|
|
303
|
+
|
|
242
304
|
public override getFieldSchema(field: FieldKey): TreeFieldStoredSchema {
|
|
243
305
|
return this.mapFields;
|
|
244
306
|
}
|
|
@@ -260,36 +322,54 @@ export class LeafNodeStoredSchema extends TreeNodeStoredSchema {
|
|
|
260
322
|
* This is simply one approach that can work for modeling them in the internal schema representation.
|
|
261
323
|
*/
|
|
262
324
|
public constructor(public readonly leafValue: ValueSchema) {
|
|
263
|
-
|
|
325
|
+
// No metadata for leaf nodes.
|
|
326
|
+
super(undefined);
|
|
264
327
|
}
|
|
265
328
|
|
|
266
|
-
public override
|
|
329
|
+
public override encodeV1(): TreeNodeSchemaDataFormatV1 {
|
|
267
330
|
return {
|
|
268
331
|
leaf: encodeValueSchema(this.leafValue),
|
|
269
332
|
};
|
|
270
333
|
}
|
|
271
334
|
|
|
335
|
+
public override encodeV2(): TreeNodeSchemaDataFormatV2 {
|
|
336
|
+
return {
|
|
337
|
+
// No metadata for leaf nodes, so don't emit a metadata field.
|
|
338
|
+
kind: {
|
|
339
|
+
leaf: encodeValueSchema(this.leafValue),
|
|
340
|
+
},
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
272
344
|
public override getFieldSchema(field: FieldKey): TreeFieldStoredSchema {
|
|
273
345
|
return storedEmptyFieldSchema;
|
|
274
346
|
}
|
|
275
347
|
}
|
|
276
348
|
|
|
349
|
+
/**
|
|
350
|
+
* Decoder wrapper function for {@link TreeNodeStoredSchema} implementations.
|
|
351
|
+
* Curries the constructor so that the caller can inject metadata.
|
|
352
|
+
*/
|
|
353
|
+
type StoredSchemaDecoder = (
|
|
354
|
+
metadata: PersistedMetadataFormat | undefined,
|
|
355
|
+
) => TreeNodeStoredSchema;
|
|
356
|
+
|
|
277
357
|
export const storedSchemaDecodeDispatcher: DiscriminatedUnionDispatcher<
|
|
278
|
-
|
|
358
|
+
TreeNodeSchemaUnionFormat,
|
|
279
359
|
[],
|
|
280
|
-
|
|
360
|
+
StoredSchemaDecoder
|
|
281
361
|
> = new DiscriminatedUnionDispatcher({
|
|
282
|
-
leaf: (data: PersistedValueSchema) =>
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
): TreeNodeStoredSchema => {
|
|
362
|
+
leaf: (data: PersistedValueSchema) => (metadata) =>
|
|
363
|
+
new LeafNodeStoredSchema(decodeValueSchema(data)),
|
|
364
|
+
object: (data: Record<TreeNodeSchemaIdentifier, FieldSchemaFormat>) => (metadata) => {
|
|
286
365
|
const map = new Map();
|
|
287
366
|
for (const [key, value] of Object.entries(data)) {
|
|
288
367
|
map.set(key, decodeFieldSchema(value));
|
|
289
368
|
}
|
|
290
|
-
return new ObjectNodeStoredSchema(map);
|
|
369
|
+
return new ObjectNodeStoredSchema(map, metadata);
|
|
291
370
|
},
|
|
292
|
-
map: (data: FieldSchemaFormat) =>
|
|
371
|
+
map: (data: FieldSchemaFormat) => (metadata) =>
|
|
372
|
+
new MapNodeStoredSchema(decodeFieldSchema(data), metadata),
|
|
293
373
|
});
|
|
294
374
|
|
|
295
375
|
const valueSchemaEncode = new Map([
|
|
@@ -310,7 +390,7 @@ function decodeValueSchema(inMemory: PersistedValueSchema): ValueSchema {
|
|
|
310
390
|
return valueSchemaDecode.get(inMemory) ?? fail(0xae9 /* missing ValueSchema */);
|
|
311
391
|
}
|
|
312
392
|
|
|
313
|
-
export function
|
|
393
|
+
export function encodeFieldSchemaV1(schema: TreeFieldStoredSchema): FieldSchemaFormatV1 {
|
|
314
394
|
return {
|
|
315
395
|
kind: schema.kind,
|
|
316
396
|
// Types are sorted by identifier to improve stability of persisted data to increase chance of schema blob reuse.
|
|
@@ -318,11 +398,21 @@ export function encodeFieldSchema(schema: TreeFieldStoredSchema): FieldSchemaFor
|
|
|
318
398
|
};
|
|
319
399
|
}
|
|
320
400
|
|
|
321
|
-
export function
|
|
401
|
+
export function encodeFieldSchemaV2(schema: TreeFieldStoredSchema): FieldSchemaFormatV2 {
|
|
402
|
+
const fieldSchema: FieldSchemaFormatV1 = encodeFieldSchemaV1(schema);
|
|
403
|
+
|
|
404
|
+
// Omit metadata from the output if it is undefined
|
|
405
|
+
return schema.persistedMetadata !== undefined
|
|
406
|
+
? { ...fieldSchema, metadata: schema.persistedMetadata }
|
|
407
|
+
: { ...fieldSchema };
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export function decodeFieldSchema(schema: FieldSchemaFormatV2): TreeFieldStoredSchema {
|
|
322
411
|
const out: TreeFieldStoredSchema = {
|
|
323
412
|
// TODO: maybe provide actual FieldKind objects here, error on unrecognized kinds.
|
|
324
413
|
kind: schema.kind,
|
|
325
414
|
types: new Set(schema.types),
|
|
415
|
+
persistedMetadata: schema.metadata,
|
|
326
416
|
};
|
|
327
417
|
return out;
|
|
328
418
|
}
|
|
@@ -43,13 +43,14 @@ export type BufferFormat<TEncodedShape> = (
|
|
|
43
43
|
)[];
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* Takes already encoded content in `buffer` and deeply searches, replacing each `IdentifierToken` and `Shape`
|
|
47
|
+
* with references to their encodings in the returned `EncodedFieldBatchGeneric`.
|
|
47
48
|
*
|
|
48
49
|
* This looks inside nested arrays (including transitively) but not inside objects.
|
|
49
50
|
*
|
|
50
51
|
* Note that this modifies `buffer` to avoid having to copy it.
|
|
51
52
|
*/
|
|
52
|
-
export function
|
|
53
|
+
export function updateShapesAndIdentifiersEncoding<TEncodedShape>(
|
|
53
54
|
version: number,
|
|
54
55
|
buffer: BufferFormat<TEncodedShape>[],
|
|
55
56
|
identifierFilter: CounterFilter<string> = jsonMinimizingFilter,
|
|
@@ -68,6 +69,9 @@ export function handleShapesAndIdentifiers<TEncodedShape>(
|
|
|
68
69
|
}
|
|
69
70
|
};
|
|
70
71
|
|
|
72
|
+
// A collection of all arrays transitively reachable (via arrays) from buffer.
|
|
73
|
+
// These are all the arrays whose contents are searched for shapes and identifiers which are then replaced
|
|
74
|
+
// with references. This uses a breadth first traversal, but the actual order is not important.
|
|
71
75
|
const arrays: BufferFormat<TEncodedShape>[] = [buffer];
|
|
72
76
|
for (const array of arrays) {
|
|
73
77
|
for (const item of array) {
|
|
@@ -93,9 +97,9 @@ export function handleShapesAndIdentifiers<TEncodedShape>(
|
|
|
93
97
|
|
|
94
98
|
// Traverse shape graph, discovering and counting all shape to shape and shape to identifier references.
|
|
95
99
|
{
|
|
96
|
-
let
|
|
97
|
-
while ((
|
|
98
|
-
|
|
100
|
+
let shape: Shape<TEncodedShape> | undefined;
|
|
101
|
+
while ((shape = shapeToCount.pop()) !== undefined) {
|
|
102
|
+
shape.countReferencedShapesAndIdentifiers(identifiers, shapeDiscovered);
|
|
99
103
|
}
|
|
100
104
|
}
|
|
101
105
|
|
|
@@ -143,8 +147,8 @@ export function handleShapesAndIdentifiers<TEncodedShape>(
|
|
|
143
147
|
* Comparison by content would be difficult due to shape containing references to other shapes.
|
|
144
148
|
*
|
|
145
149
|
* @privateRemarks
|
|
146
|
-
* Unlike with identifiers, conversion from the initial form (this class / IdentifierToken) is done by the `encodeShape` method, not by general purpose logic in `
|
|
147
|
-
* For `
|
|
150
|
+
* Unlike with identifiers, conversion from the initial form (this class / IdentifierToken) is done by the `encodeShape` method, not by general purpose logic in `updateShapesAndIdentifiersEncoding`.
|
|
151
|
+
* For `updateShapesAndIdentifiersEncoding` to do the conversion without help from `encodeShape`,
|
|
148
152
|
* instances of this Shape class would have to either be or output an object that is identical to the `TEncodedShape` format except with all shape references as object references instead of indexes.
|
|
149
153
|
* Those objects would have to be deeply traversed looking for shape objects to replace with reference indexes.
|
|
150
154
|
* This is possible, but making it type safe would involve generating derived types from the `TEncodedShape` deeply replacing any shape references, as well as requiring deep traversal of all objects in the encoded output.
|
|
@@ -152,18 +156,19 @@ export function handleShapesAndIdentifiers<TEncodedShape>(
|
|
|
152
156
|
*/
|
|
153
157
|
export abstract class Shape<TEncodedShape> {
|
|
154
158
|
/**
|
|
155
|
-
*
|
|
159
|
+
* Enumerate all contents of this shape that can get replaced with references (for better compression/deduplication) during encoding.
|
|
160
|
+
* This currently includes shapes and identifiers.
|
|
156
161
|
*
|
|
157
162
|
* Used to discover referenced shapes (to ensure they are included in the `shapes` passed to `encodeShape`),
|
|
158
163
|
* as well as count usages of shapes and identifiers for more efficient dictionary encoding. See {@link Counter}.
|
|
159
164
|
*
|
|
160
|
-
* @param
|
|
165
|
+
* @param shapeDiscovered - must be invoked with each directly referenced shape (which must be provided to `encodeShape`).
|
|
161
166
|
* Can be invoked multiple times if a shape is referenced more than once for more efficient dictionary encoding.
|
|
162
167
|
* Should not be invoked with `this` unless this shape references itself.
|
|
163
168
|
*/
|
|
164
|
-
public abstract
|
|
169
|
+
public abstract countReferencedShapesAndIdentifiers(
|
|
165
170
|
identifiers: Counter<string>,
|
|
166
|
-
|
|
171
|
+
shapeDiscovered: (shape: Shape<TEncodedShape>) => void,
|
|
167
172
|
): void;
|
|
168
173
|
|
|
169
174
|
/**
|
|
@@ -23,7 +23,7 @@ import type { Counter, DeduplicationTable } from "./chunkCodecUtilities.js";
|
|
|
23
23
|
import {
|
|
24
24
|
type BufferFormat as BufferFormatGeneric,
|
|
25
25
|
Shape as ShapeGeneric,
|
|
26
|
-
|
|
26
|
+
updateShapesAndIdentifiersEncoding,
|
|
27
27
|
} from "./chunkEncodingGeneric.js";
|
|
28
28
|
import type { FieldBatch } from "./fieldBatch.js";
|
|
29
29
|
import {
|
|
@@ -55,7 +55,7 @@ export function compressedEncode(
|
|
|
55
55
|
anyFieldEncoder.encodeField(cursor, cache, buffer);
|
|
56
56
|
batchBuffer.push(buffer);
|
|
57
57
|
}
|
|
58
|
-
return
|
|
58
|
+
return updateShapesAndIdentifiersEncoding(version, batchBuffer);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
export type BufferFormat = BufferFormatGeneric<EncodedChunkShape>;
|
|
@@ -175,7 +175,10 @@ export class AnyShape extends ShapeGeneric<EncodedChunkShape> {
|
|
|
175
175
|
return { d: encodedAnyShape };
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
public
|
|
178
|
+
public countReferencedShapesAndIdentifiers(
|
|
179
|
+
identifiers: Counter<string>,
|
|
180
|
+
shapeDiscovered: (shape: Shape) => void,
|
|
181
|
+
): void {}
|
|
179
182
|
|
|
180
183
|
public static encodeField(
|
|
181
184
|
cursor: ITreeCursorSynchronous,
|
|
@@ -329,8 +332,11 @@ export class InlineArrayShape
|
|
|
329
332
|
};
|
|
330
333
|
}
|
|
331
334
|
|
|
332
|
-
public
|
|
333
|
-
|
|
335
|
+
public countReferencedShapesAndIdentifiers(
|
|
336
|
+
identifiers: Counter<string>,
|
|
337
|
+
shapeDiscovered: (shape: Shape) => void,
|
|
338
|
+
): void {
|
|
339
|
+
shapeDiscovered(this.inner.shape);
|
|
334
340
|
}
|
|
335
341
|
|
|
336
342
|
public get shape(): this {
|
|
@@ -387,8 +393,11 @@ export class NestedArrayShape extends ShapeGeneric<EncodedChunkShape> implements
|
|
|
387
393
|
};
|
|
388
394
|
}
|
|
389
395
|
|
|
390
|
-
public
|
|
391
|
-
|
|
396
|
+
public countReferencedShapesAndIdentifiers(
|
|
397
|
+
identifiers: Counter<string>,
|
|
398
|
+
shapeDiscovered: (shape: Shape) => void,
|
|
399
|
+
): void {
|
|
400
|
+
shapeDiscovered(this.inner.shape);
|
|
392
401
|
}
|
|
393
402
|
}
|
|
394
403
|
|
|
@@ -121,9 +121,9 @@ export class NodeShape extends Shape<EncodedChunkShape> implements NodeEncoder {
|
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
public
|
|
124
|
+
public countReferencedShapesAndIdentifiers(
|
|
125
125
|
identifiers: Counter<string>,
|
|
126
|
-
|
|
126
|
+
shapeDiscovered: (shape: Shape<EncodedChunkShape>) => void,
|
|
127
127
|
): void {
|
|
128
128
|
if (this.type !== undefined) {
|
|
129
129
|
identifiers.add(this.type);
|
|
@@ -131,11 +131,11 @@ export class NodeShape extends Shape<EncodedChunkShape> implements NodeEncoder {
|
|
|
131
131
|
|
|
132
132
|
for (const fieldEncoder of this.specializedFieldEncoders) {
|
|
133
133
|
identifiers.add(fieldEncoder.key);
|
|
134
|
-
|
|
134
|
+
shapeDiscovered(fieldEncoder.encoder.shape);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
if (this.otherFieldsEncoder !== undefined) {
|
|
138
|
-
|
|
138
|
+
shapeDiscovered(this.otherFieldsEncoder.shape);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { bufferToString } from "@fluid-internal/client-utils";
|
|
7
7
|
import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
|
|
8
8
|
import type {
|
|
9
|
+
IExperimentalIncrementalSummaryContext,
|
|
9
10
|
ISummaryTreeWithStats,
|
|
10
11
|
ITelemetryContext,
|
|
11
12
|
} from "@fluidframework/runtime-definitions/internal";
|
|
@@ -32,23 +33,15 @@ export class DetachedFieldIndexSummarizer implements Summarizable {
|
|
|
32
33
|
|
|
33
34
|
public constructor(private readonly detachedFieldIndex: DetachedFieldIndex) {}
|
|
34
35
|
|
|
35
|
-
public
|
|
36
|
-
stringify: SummaryElementStringifier
|
|
37
|
-
fullTree?: boolean
|
|
38
|
-
trackState?: boolean
|
|
39
|
-
telemetryContext?: ITelemetryContext
|
|
40
|
-
|
|
36
|
+
public summarize(props: {
|
|
37
|
+
stringify: SummaryElementStringifier;
|
|
38
|
+
fullTree?: boolean;
|
|
39
|
+
trackState?: boolean;
|
|
40
|
+
telemetryContext?: ITelemetryContext;
|
|
41
|
+
incrementalSummaryContext?: IExperimentalIncrementalSummaryContext;
|
|
42
|
+
}): ISummaryTreeWithStats {
|
|
41
43
|
const data = this.detachedFieldIndex.encode();
|
|
42
|
-
return createSingleBlobSummary(detachedFieldIndexBlobKey, stringify(data));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public async summarize(
|
|
46
|
-
stringify: SummaryElementStringifier,
|
|
47
|
-
fullTree?: boolean,
|
|
48
|
-
trackState?: boolean,
|
|
49
|
-
telemetryContext?: ITelemetryContext,
|
|
50
|
-
): Promise<ISummaryTreeWithStats> {
|
|
51
|
-
return this.getAttachSummary(stringify, fullTree, trackState, telemetryContext);
|
|
44
|
+
return createSingleBlobSummary(detachedFieldIndexBlobKey, props.stringify(data));
|
|
52
45
|
}
|
|
53
46
|
|
|
54
47
|
public async load(
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
type FieldKindIdentifier,
|
|
10
10
|
type ITreeCursorSynchronous,
|
|
11
11
|
type NormalizedFieldUpPath,
|
|
12
|
-
type TreeNodeSchemaIdentifier,
|
|
13
12
|
type TreeValue,
|
|
14
13
|
anchorSlot,
|
|
15
14
|
} from "../../core/index.js";
|
|
@@ -19,7 +18,12 @@ import type {
|
|
|
19
18
|
ValueFieldEditBuilder,
|
|
20
19
|
OptionalFieldEditBuilder,
|
|
21
20
|
} from "../default-schema/index.js";
|
|
22
|
-
import type {
|
|
21
|
+
import type {
|
|
22
|
+
MapTreeFieldViewGeneric,
|
|
23
|
+
MapTreeNodeViewGeneric,
|
|
24
|
+
MinimalFieldMap,
|
|
25
|
+
MinimalMapTreeNodeView,
|
|
26
|
+
} from "../mapTreeCursor.js";
|
|
23
27
|
import type { FlexFieldKind } from "../modular-schema/index.js";
|
|
24
28
|
|
|
25
29
|
import type { FlexTreeContext, FlexTreeHydratedContext } from "./context.js";
|
|
@@ -75,6 +79,14 @@ export interface FlexTreeEntity {
|
|
|
75
79
|
* A common context of FlexTrees.
|
|
76
80
|
*/
|
|
77
81
|
readonly context: FlexTreeContext;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Get a cursor for the underlying data.
|
|
85
|
+
* @remarks
|
|
86
|
+
* This cursor might be one the node uses in its implementation, and thus must be returned to its original location before using any other APIs to interact with the tree.
|
|
87
|
+
* Must not be held onto across edits or any other tree API use.
|
|
88
|
+
*/
|
|
89
|
+
borrowCursor(): ITreeCursorSynchronous;
|
|
78
90
|
}
|
|
79
91
|
|
|
80
92
|
/**
|
|
@@ -142,14 +154,9 @@ export enum TreeStatus {
|
|
|
142
154
|
* @remarks
|
|
143
155
|
* All editing is actually done via {@link FlexTreeField}s: the nodes are immutable other than that they contain mutable fields.
|
|
144
156
|
*/
|
|
145
|
-
export interface FlexTreeNode extends FlexTreeEntity {
|
|
157
|
+
export interface FlexTreeNode extends FlexTreeEntity, MapTreeNodeViewGeneric<FlexTreeNode> {
|
|
146
158
|
readonly [flexTreeMarker]: FlexTreeEntityKind.Node;
|
|
147
159
|
|
|
148
|
-
/**
|
|
149
|
-
* Value stored on this node.
|
|
150
|
-
*/
|
|
151
|
-
readonly value?: TreeValue;
|
|
152
|
-
|
|
153
160
|
/**
|
|
154
161
|
* Gets a field of this node, if it is not empty.
|
|
155
162
|
*/
|
|
@@ -162,16 +169,30 @@ export interface FlexTreeNode extends FlexTreeEntity {
|
|
|
162
169
|
* @remarks
|
|
163
170
|
* All fields implicitly exist, so `getBoxed` can be called with any key and will always return a field.
|
|
164
171
|
* Even if the field is empty, it will still be returned, and can be edited to insert content if allowed by the field kind.
|
|
165
|
-
* See {@link FlexTreeNode.tryGetField} for a variant that does not allocate
|
|
172
|
+
* See {@link FlexTreeNode.tryGetField} for a variant that does not allocate a field in the empty case.
|
|
166
173
|
*/
|
|
167
174
|
getBoxed(key: FieldKey): FlexTreeField;
|
|
168
175
|
|
|
169
176
|
/**
|
|
170
177
|
* The field this tree is in, and the index within that field.
|
|
178
|
+
* @remarks
|
|
179
|
+
* The behavior of this at the root (especially removed and unhydrated roots) is currently not very consistent.
|
|
180
|
+
* Since very little relies on this, limit what it exposes to reduce the potential impact of inconsistent root handling.
|
|
171
181
|
*/
|
|
172
|
-
readonly parentField: {
|
|
182
|
+
readonly parentField: {
|
|
183
|
+
readonly parent: Pick<FlexTreeField, "parent" | "schema" | "key">;
|
|
184
|
+
readonly index: number;
|
|
185
|
+
};
|
|
173
186
|
|
|
174
|
-
|
|
187
|
+
/**
|
|
188
|
+
* The non-empty fields on this node.
|
|
189
|
+
*/
|
|
190
|
+
readonly fields: MinimalFieldMap<FlexTreeField>;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The non-empty fields on this node.
|
|
194
|
+
*/
|
|
195
|
+
[Symbol.iterator](): IterableIterator<FlexTreeField>;
|
|
175
196
|
|
|
176
197
|
/**
|
|
177
198
|
* Returns an iterable of keys for non-empty fields.
|
|
@@ -183,20 +204,6 @@ export interface FlexTreeNode extends FlexTreeEntity {
|
|
|
183
204
|
*/
|
|
184
205
|
keys(): IterableIterator<FieldKey>;
|
|
185
206
|
|
|
186
|
-
/**
|
|
187
|
-
* Schema for this entity.
|
|
188
|
-
* If well-formed, it must follow this schema.
|
|
189
|
-
*/
|
|
190
|
-
readonly schema: TreeNodeSchemaIdentifier;
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Get a cursor for the underlying data.
|
|
194
|
-
* @remarks
|
|
195
|
-
* This cursor might be one the node uses in its implementation, and thus must be returned to its original location before using any other APIs to interact with the tree.
|
|
196
|
-
* Must not be held onto across edits or any other tree API use.
|
|
197
|
-
*/
|
|
198
|
-
borrowCursor(): ITreeCursorSynchronous;
|
|
199
|
-
|
|
200
207
|
/**
|
|
201
208
|
* If true, this node is a {@link HydratedFlexTreeNode}.
|
|
202
209
|
*
|
|
@@ -243,7 +250,7 @@ export interface HydratedFlexTreeNode extends FlexTreeNode {
|
|
|
243
250
|
* All content in the tree is accessible without down-casting, but if the schema is known,
|
|
244
251
|
* the schema aware API may be more ergonomic.
|
|
245
252
|
*/
|
|
246
|
-
export interface FlexTreeField extends FlexTreeEntity {
|
|
253
|
+
export interface FlexTreeField extends FlexTreeEntity, MapTreeFieldViewGeneric<FlexTreeNode> {
|
|
247
254
|
readonly [flexTreeMarker]: FlexTreeEntityKind.Field;
|
|
248
255
|
|
|
249
256
|
/**
|
|
@@ -268,8 +275,6 @@ export interface FlexTreeField extends FlexTreeEntity {
|
|
|
268
275
|
*/
|
|
269
276
|
is<TKind extends FlexFieldKind>(kind: TKind): this is FlexTreeTypedField<TKind>;
|
|
270
277
|
|
|
271
|
-
boxedIterator(): IterableIterator<FlexTreeNode>;
|
|
272
|
-
|
|
273
278
|
/**
|
|
274
279
|
* Gets a node of this field by its index without unboxing.
|
|
275
280
|
* @param index - Zero-based index of the item to retrieve. Negative values are interpreted from the end of the sequence.
|
|
@@ -350,8 +355,6 @@ export interface FlexTreeSequenceField extends FlexTreeField {
|
|
|
350
355
|
* Get an editor for this sequence.
|
|
351
356
|
*/
|
|
352
357
|
readonly editor: SequenceFieldEditBuilder<FlexibleFieldContent>;
|
|
353
|
-
|
|
354
|
-
boxedIterator(): IterableIterator<FlexTreeNode>;
|
|
355
358
|
}
|
|
356
359
|
|
|
357
360
|
/**
|
|
@@ -22,14 +22,6 @@ export {
|
|
|
22
22
|
type HydratedFlexTreeNode,
|
|
23
23
|
} from "./flexTreeTypes.js";
|
|
24
24
|
|
|
25
|
-
export {
|
|
26
|
-
visitBipartiteIterableTree,
|
|
27
|
-
Skip,
|
|
28
|
-
visitBipartiteIterableTreeWithState,
|
|
29
|
-
visitIterableTree,
|
|
30
|
-
visitIterableTreeWithState,
|
|
31
|
-
} from "./navigation.js";
|
|
32
|
-
|
|
33
25
|
export {
|
|
34
26
|
type FlexTreeContext,
|
|
35
27
|
type FlexTreeHydratedContext,
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
|
+
type ITreeCursorSynchronous,
|
|
9
10
|
type ITreeSubscriptionCursor,
|
|
10
11
|
ITreeSubscriptionCursorState,
|
|
11
12
|
TreeNavigationResult,
|
|
@@ -48,7 +49,10 @@ export abstract class LazyEntity<TAnchor = unknown> implements FlexTreeEntity, I
|
|
|
48
49
|
this.context.withAnchors.add(this);
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
public
|
|
52
|
+
public borrowCursor(): ITreeCursorSynchronous {
|
|
53
|
+
return this.cursor as ITreeCursorSynchronous;
|
|
54
|
+
}
|
|
55
|
+
|
|
52
56
|
public abstract get [flexTreeMarker](): FlexTreeEntityKind;
|
|
53
57
|
|
|
54
58
|
public [disposeSymbol](): void {
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
type TreeNavigationResult,
|
|
20
20
|
inCursorNode,
|
|
21
21
|
iterateCursorField,
|
|
22
|
+
mapCursorField,
|
|
22
23
|
rootFieldKey,
|
|
23
24
|
} from "../../core/index.js";
|
|
24
25
|
import { disposeSymbol, getOrCreate } from "../../util/index.js";
|
|
@@ -206,19 +207,15 @@ export abstract class LazyField extends LazyEntity<FieldAnchor> implements FlexT
|
|
|
206
207
|
}
|
|
207
208
|
|
|
208
209
|
public map<U>(callbackfn: (value: FlexTreeUnknownUnboxed, index: number) => U): U[] {
|
|
209
|
-
return
|
|
210
|
+
return mapCursorField(this.cursor, (cursor) =>
|
|
211
|
+
callbackfn(unboxedFlexNode(this.context, cursor, this.anchor), cursor.fieldIndex),
|
|
212
|
+
);
|
|
210
213
|
}
|
|
211
214
|
|
|
212
|
-
public
|
|
215
|
+
public [Symbol.iterator](): IterableIterator<HydratedFlexTreeNode> {
|
|
213
216
|
return iterateCursorField(this.cursor, (cursor) => makeTree(this.context, cursor));
|
|
214
217
|
}
|
|
215
218
|
|
|
216
|
-
public [Symbol.iterator](): IterableIterator<FlexTreeUnknownUnboxed> {
|
|
217
|
-
return iterateCursorField(this.cursor, (cursor) =>
|
|
218
|
-
unboxedFlexNode(this.context, cursor, this.anchor),
|
|
219
|
-
);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
219
|
public getFieldPath(): NormalizedFieldUpPath {
|
|
223
220
|
return { parent: this.parent?.anchorNode, field: this.key };
|
|
224
221
|
}
|