@fluidframework/tree 2.42.0 → 2.43.0-343119
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/api-report/tree.alpha.api.md +59 -21
- package/api-report/tree.beta.api.md +33 -0
- package/dist/alpha.d.ts +11 -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 +23 -24
- 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.d.ts.map +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/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 +1 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +12 -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/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/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/treeNodeKernel.js +1 -1
- package/dist/simple-tree/core/treeNodeKernel.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/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +2 -0
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- 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 +3 -1
- 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 +4 -2
- 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 +3 -1
- 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 +50 -3
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +28 -1
- 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 +2 -0
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +13 -4
- package/dist/simple-tree/toStoredSchema.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 +11 -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 +23 -24
- 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.d.ts.map +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/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 +1 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +3 -2
- 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/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/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/treeNodeKernel.js +1 -1
- package/lib/simple-tree/core/treeNodeKernel.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/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +2 -0
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -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 +3 -1
- 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 +5 -3
- 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 +3 -1
- 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 +50 -3
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +28 -1
- 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 +2 -0
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +13 -4
- package/lib/simple-tree/toStoredSchema.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 +21 -21
- 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 +32 -29
- 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 +5 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/schematizeTree.ts +1 -0
- package/src/shared-tree/sharedTree.ts +42 -12
- package/src/shared-tree/treeAlpha.ts +8 -3
- package/src/shared-tree-core/editManagerSummarizer.ts +9 -16
- package/src/shared-tree-core/sharedTreeCore.ts +33 -24
- 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/viewSchemaToSimpleSchema.ts +5 -0
- package/src/simple-tree/core/treeNodeKernel.ts +1 -1
- package/src/simple-tree/core/unhydratedFlexTree.ts +22 -44
- package/src/simple-tree/index.ts +3 -0
- package/src/simple-tree/leafNodeSchema.ts +2 -0
- package/src/simple-tree/node-kinds/array/arrayNode.ts +5 -0
- package/src/simple-tree/node-kinds/map/mapNode.ts +11 -2
- package/src/simple-tree/node-kinds/object/objectNode.ts +9 -1
- package/src/simple-tree/prepareForInsertion.ts +5 -1
- package/src/simple-tree/schemaTypes.ts +96 -7
- package/src/simple-tree/simpleSchema.ts +27 -5
- package/src/simple-tree/toStoredSchema.ts +15 -4
- 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
|
@@ -54,6 +54,7 @@ import type {
|
|
|
54
54
|
ArrayNodeCustomizableSchema,
|
|
55
55
|
ArrayNodePojoEmulationSchema,
|
|
56
56
|
} from "./arrayNodeTypes.js";
|
|
57
|
+
import type { JsonCompatibleReadOnlyObject } from "../../../util/index.js";
|
|
57
58
|
|
|
58
59
|
/**
|
|
59
60
|
* A covariant base type for {@link (TreeArrayNode:interface)}.
|
|
@@ -1082,6 +1083,7 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>
|
|
|
1082
1083
|
* Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.
|
|
1083
1084
|
*
|
|
1084
1085
|
* @param name - Unique identifier for this schema including the factory's scope.
|
|
1086
|
+
* @param persistedMetadata - Optional persisted metadata for the object node schema.
|
|
1085
1087
|
*/
|
|
1086
1088
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
1087
1089
|
export function arraySchema<
|
|
@@ -1095,6 +1097,7 @@ export function arraySchema<
|
|
|
1095
1097
|
implicitlyConstructable: ImplicitlyConstructable,
|
|
1096
1098
|
customizable: boolean,
|
|
1097
1099
|
metadata?: NodeSchemaMetadata<TCustomMetadata>,
|
|
1100
|
+
persistedMetadata?: JsonCompatibleReadOnlyObject | undefined,
|
|
1098
1101
|
) {
|
|
1099
1102
|
type Output = ArrayNodeCustomizableSchema<
|
|
1100
1103
|
TName,
|
|
@@ -1190,6 +1193,8 @@ export function arraySchema<
|
|
|
1190
1193
|
return lazyChildTypes.value;
|
|
1191
1194
|
}
|
|
1192
1195
|
public static readonly metadata: NodeSchemaMetadata<TCustomMetadata> = metadata ?? {};
|
|
1196
|
+
public static readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined =
|
|
1197
|
+
persistedMetadata;
|
|
1193
1198
|
|
|
1194
1199
|
// eslint-disable-next-line import/no-deprecated
|
|
1195
1200
|
public get [typeNameSymbol](): TName {
|
|
@@ -43,7 +43,12 @@ import {
|
|
|
43
43
|
type InsertableContent,
|
|
44
44
|
} from "../../unhydratedFlexTreeFromInsertable.js";
|
|
45
45
|
import { prepareForInsertion } from "../../prepareForInsertion.js";
|
|
46
|
-
import {
|
|
46
|
+
import {
|
|
47
|
+
brand,
|
|
48
|
+
count,
|
|
49
|
+
type JsonCompatibleReadOnlyObject,
|
|
50
|
+
type RestrictiveStringRecord,
|
|
51
|
+
} from "../../../util/index.js";
|
|
47
52
|
import { TreeNodeValid, type MostDerivedData } from "../../treeNodeValid.js";
|
|
48
53
|
import { getUnhydratedContext } from "../../createContext.js";
|
|
49
54
|
import type { MapNodeCustomizableSchema, MapNodePojoEmulationSchema } from "./mapNodeTypes.js";
|
|
@@ -215,7 +220,7 @@ abstract class CustomMapNodeBase<const T extends ImplicitAllowedTypes> extends T
|
|
|
215
220
|
callbackFn: (value: TreeNodeFromImplicitAllowedTypes<T>, key: string, map: TThis) => void,
|
|
216
221
|
thisArg?: unknown,
|
|
217
222
|
): void {
|
|
218
|
-
for (const field of getOrCreateInnerNode(this)
|
|
223
|
+
for (const field of getOrCreateInnerNode(this)) {
|
|
219
224
|
const node = getTreeNodeForField(field) as TreeNodeFromImplicitAllowedTypes<T>;
|
|
220
225
|
callbackFn.call(thisArg, node, field.key, this);
|
|
221
226
|
}
|
|
@@ -228,6 +233,7 @@ abstract class CustomMapNodeBase<const T extends ImplicitAllowedTypes> extends T
|
|
|
228
233
|
*
|
|
229
234
|
* @param base - base schema type to extend.
|
|
230
235
|
* @param useMapPrototype - should this type emulate a ES6 Map object (by faking its prototype with a proxy).
|
|
236
|
+
* @param persistedMetadata - Optional persisted metadata for the object node schema.
|
|
231
237
|
*/
|
|
232
238
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
233
239
|
export function mapSchema<
|
|
@@ -241,6 +247,7 @@ export function mapSchema<
|
|
|
241
247
|
implicitlyConstructable: ImplicitlyConstructable,
|
|
242
248
|
useMapPrototype: boolean,
|
|
243
249
|
metadata?: NodeSchemaMetadata<TCustomMetadata>,
|
|
250
|
+
persistedMetadata?: JsonCompatibleReadOnlyObject | undefined,
|
|
244
251
|
) {
|
|
245
252
|
const lazyChildTypes = new Lazy(() =>
|
|
246
253
|
normalizeAllowedTypes(unannotateImplicitAllowedTypes(info)),
|
|
@@ -294,6 +301,8 @@ export function mapSchema<
|
|
|
294
301
|
return lazyChildTypes.value;
|
|
295
302
|
}
|
|
296
303
|
public static readonly metadata: NodeSchemaMetadata<TCustomMetadata> = metadata ?? {};
|
|
304
|
+
public static readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined =
|
|
305
|
+
persistedMetadata;
|
|
297
306
|
|
|
298
307
|
// eslint-disable-next-line import/no-deprecated
|
|
299
308
|
public get [typeNameSymbol](): TName {
|
|
@@ -14,7 +14,11 @@ import {
|
|
|
14
14
|
type FlexTreeOptionalField,
|
|
15
15
|
type FlexTreeRequiredField,
|
|
16
16
|
} from "../../../feature-libraries/index.js";
|
|
17
|
-
import type {
|
|
17
|
+
import type {
|
|
18
|
+
RestrictiveStringRecord,
|
|
19
|
+
FlattenKeys,
|
|
20
|
+
JsonCompatibleReadOnlyObject,
|
|
21
|
+
} from "../../../util/index.js";
|
|
18
22
|
|
|
19
23
|
import {
|
|
20
24
|
type TreeNodeSchema,
|
|
@@ -349,6 +353,7 @@ abstract class CustomObjectNodeBase<
|
|
|
349
353
|
*
|
|
350
354
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
351
355
|
* @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.
|
|
356
|
+
* @param persistedMetadata - Optional persisted metadata for the object node schema.
|
|
352
357
|
*/
|
|
353
358
|
export function objectSchema<
|
|
354
359
|
TName extends string,
|
|
@@ -361,6 +366,7 @@ export function objectSchema<
|
|
|
361
366
|
implicitlyConstructable: ImplicitlyConstructable,
|
|
362
367
|
allowUnknownOptionalFields: boolean,
|
|
363
368
|
metadata?: NodeSchemaMetadata<TCustomMetadata>,
|
|
369
|
+
persistedMetadata?: JsonCompatibleReadOnlyObject | undefined,
|
|
364
370
|
): ObjectNodeSchema<TName, T, ImplicitlyConstructable, TCustomMetadata> &
|
|
365
371
|
ObjectNodeSchemaInternalData {
|
|
366
372
|
// Field set can't be modified after this since derived data is stored in maps.
|
|
@@ -504,6 +510,8 @@ export function objectSchema<
|
|
|
504
510
|
return lazyChildTypes.value;
|
|
505
511
|
}
|
|
506
512
|
public static readonly metadata: NodeSchemaMetadata<TCustomMetadata> = metadata ?? {};
|
|
513
|
+
public static readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined =
|
|
514
|
+
persistedMetadata;
|
|
507
515
|
|
|
508
516
|
// eslint-disable-next-line import/no-deprecated
|
|
509
517
|
public get [typeNameSymbol](): TName {
|
|
@@ -84,7 +84,11 @@ export function prepareArrayContentForInsertion(
|
|
|
84
84
|
validateAndPrepare(
|
|
85
85
|
getSchemaAndPolicy(destinationContext),
|
|
86
86
|
destinationContext.isHydrated() ? destinationContext : undefined,
|
|
87
|
-
{
|
|
87
|
+
{
|
|
88
|
+
kind: FieldKinds.sequence.identifier,
|
|
89
|
+
types: fieldSchema.types,
|
|
90
|
+
persistedMetadata: undefined,
|
|
91
|
+
},
|
|
88
92
|
mapTrees,
|
|
89
93
|
);
|
|
90
94
|
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
getOrCreate,
|
|
21
21
|
type RestrictiveStringRecord,
|
|
22
22
|
type IsUnion,
|
|
23
|
+
type JsonCompatibleReadOnlyObject,
|
|
23
24
|
} from "../util/index.js";
|
|
24
25
|
|
|
25
26
|
import type {
|
|
@@ -297,7 +298,23 @@ export interface FieldProps<TCustomMetadata = unknown> {
|
|
|
297
298
|
}
|
|
298
299
|
|
|
299
300
|
/**
|
|
300
|
-
*
|
|
301
|
+
* {@link FieldProps} extended with additional `alpha` options.
|
|
302
|
+
*
|
|
303
|
+
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
304
|
+
* See {@link FieldSchemaMetadata.custom}.
|
|
305
|
+
*
|
|
306
|
+
* @alpha @input
|
|
307
|
+
*/
|
|
308
|
+
export interface FieldPropsAlpha<TCustomMetadata = unknown>
|
|
309
|
+
extends FieldProps<TCustomMetadata> {
|
|
310
|
+
/**
|
|
311
|
+
* The persisted metadata for this schema element.
|
|
312
|
+
*/
|
|
313
|
+
readonly persistedMetadata?: JsonCompatibleReadOnlyObject | undefined;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* A {@link FieldProvider} which requires additional context in order to produce its content
|
|
301
318
|
*/
|
|
302
319
|
export type ContextualFieldProvider = (
|
|
303
320
|
context: FlexTreeHydratedContextMinimal | "UseGlobalContext",
|
|
@@ -361,6 +378,22 @@ export interface FieldSchemaMetadata<TCustomMetadata = unknown> {
|
|
|
361
378
|
readonly description?: string | undefined;
|
|
362
379
|
}
|
|
363
380
|
|
|
381
|
+
/**
|
|
382
|
+
* Metadata associated with a {@link FieldSchema}. Includes fields used by alpha features.
|
|
383
|
+
*
|
|
384
|
+
* @remarks Specified via {@link FieldProps.metadata}.
|
|
385
|
+
*
|
|
386
|
+
* @sealed
|
|
387
|
+
* @alpha
|
|
388
|
+
*/
|
|
389
|
+
export interface FieldSchemaMetadataAlpha<TCustomMetadata = unknown>
|
|
390
|
+
extends FieldSchemaMetadata<TCustomMetadata> {
|
|
391
|
+
/**
|
|
392
|
+
* The persisted metadata for this schema element.
|
|
393
|
+
*/
|
|
394
|
+
readonly persistedMetadata?: JsonCompatibleReadOnlyObject | undefined;
|
|
395
|
+
}
|
|
396
|
+
|
|
364
397
|
/**
|
|
365
398
|
* Package internal construction API.
|
|
366
399
|
*/
|
|
@@ -509,12 +542,20 @@ export class FieldSchemaAlpha<
|
|
|
509
542
|
{
|
|
510
543
|
private readonly lazyIdentifiers: Lazy<ReadonlySet<string>>;
|
|
511
544
|
private readonly lazyAnnotatedTypes: Lazy<ReadonlyMap<TreeNodeSchema, AllowedTypeMetadata>>;
|
|
545
|
+
private readonly propsAlpha: FieldPropsAlpha<TCustomMetadata> | undefined;
|
|
512
546
|
|
|
513
547
|
/**
|
|
514
548
|
* Metadata on the types of tree nodes allowed on this field.
|
|
515
549
|
*/
|
|
516
550
|
public readonly allowedTypesMetadata: AllowedTypesMetadata;
|
|
517
551
|
|
|
552
|
+
/**
|
|
553
|
+
* Persisted metadata for this field schema.
|
|
554
|
+
*/
|
|
555
|
+
public get persistedMetadata(): JsonCompatibleReadOnlyObject | undefined {
|
|
556
|
+
return this.propsAlpha?.persistedMetadata;
|
|
557
|
+
}
|
|
558
|
+
|
|
518
559
|
static {
|
|
519
560
|
createFieldSchemaPrivate = <
|
|
520
561
|
Kind2 extends FieldKind,
|
|
@@ -523,7 +564,7 @@ export class FieldSchemaAlpha<
|
|
|
523
564
|
>(
|
|
524
565
|
kind: Kind2,
|
|
525
566
|
annotatedAllowedTypes: Types2,
|
|
526
|
-
props?:
|
|
567
|
+
props?: FieldPropsAlpha<TCustomMetadata2>,
|
|
527
568
|
) =>
|
|
528
569
|
new FieldSchemaAlpha(
|
|
529
570
|
kind,
|
|
@@ -537,7 +578,7 @@ export class FieldSchemaAlpha<
|
|
|
537
578
|
kind: Kind,
|
|
538
579
|
types: Types,
|
|
539
580
|
public readonly annotatedAllowedTypes: ImplicitAnnotatedAllowedTypes,
|
|
540
|
-
props?:
|
|
581
|
+
props?: FieldPropsAlpha<TCustomMetadata>,
|
|
541
582
|
) {
|
|
542
583
|
super(kind, types, props);
|
|
543
584
|
|
|
@@ -550,6 +591,7 @@ export class FieldSchemaAlpha<
|
|
|
550
591
|
this.lazyIdentifiers = new Lazy(
|
|
551
592
|
() => new Set([...this.allowedTypeSet].map((t) => t.identifier)),
|
|
552
593
|
);
|
|
594
|
+
this.propsAlpha = props;
|
|
553
595
|
}
|
|
554
596
|
|
|
555
597
|
public get allowedTypesIdentifiers(): ReadonlySet<string> {
|
|
@@ -775,17 +817,48 @@ function areFieldPropsEqual(a: FieldProps | undefined, b: FieldProps | undefined
|
|
|
775
817
|
* @remarks FieldSchemaMetadata are considered equivalent if their custom data and descriptions are (respectively) reference equal.
|
|
776
818
|
*/
|
|
777
819
|
function areMetadataEqual(
|
|
778
|
-
a:
|
|
779
|
-
b:
|
|
820
|
+
a: FieldSchemaMetadataAlpha | undefined,
|
|
821
|
+
b: FieldSchemaMetadataAlpha | undefined,
|
|
780
822
|
): boolean {
|
|
781
823
|
// If any new fields are added to FieldSchemaMetadata, this check will stop compiling as a reminder that this function needs to be updated.
|
|
782
|
-
type _keys = requireTrue<
|
|
824
|
+
type _keys = requireTrue<
|
|
825
|
+
areOnlyKeys<FieldSchemaMetadataAlpha, "custom" | "description" | "persistedMetadata">
|
|
826
|
+
>;
|
|
783
827
|
|
|
784
828
|
if (a === b) {
|
|
785
829
|
return true;
|
|
786
830
|
}
|
|
787
831
|
|
|
788
|
-
return
|
|
832
|
+
return (
|
|
833
|
+
Object.is(a?.custom, b?.custom) &&
|
|
834
|
+
a?.description === b?.description &&
|
|
835
|
+
arePersistedMetadataEqual(a?.persistedMetadata, b?.persistedMetadata)
|
|
836
|
+
);
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Returns true if the given persisted metadata fields are equivalent, otherwise false.
|
|
841
|
+
* @remarks
|
|
842
|
+
* Currently only handles shallow equality in the case where the keys are in the same order. This is acceptable for current use cases.
|
|
843
|
+
*/
|
|
844
|
+
function arePersistedMetadataEqual(
|
|
845
|
+
a: JsonCompatibleReadOnlyObject | undefined,
|
|
846
|
+
b: JsonCompatibleReadOnlyObject | undefined,
|
|
847
|
+
): boolean {
|
|
848
|
+
if (Object.is(a, b)) {
|
|
849
|
+
return true;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
if (a === undefined || b === undefined) {
|
|
853
|
+
return false;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
// Note that the key order matters. If `a` and `b` have the same content but the keys are in a different order,
|
|
857
|
+
// this method will return false.
|
|
858
|
+
const aStringified = JSON.stringify(a);
|
|
859
|
+
const bStringified = JSON.stringify(b);
|
|
860
|
+
|
|
861
|
+
return aStringified === bStringified;
|
|
789
862
|
}
|
|
790
863
|
|
|
791
864
|
const cachedLazyItem = new WeakMap<() => unknown, unknown>();
|
|
@@ -1313,6 +1386,22 @@ export interface NodeSchemaOptions<out TCustomMetadata = unknown> {
|
|
|
1313
1386
|
readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
|
|
1314
1387
|
}
|
|
1315
1388
|
|
|
1389
|
+
/**
|
|
1390
|
+
* Additional information to provide to Node Schema creation. Includes fields for alpha features.
|
|
1391
|
+
*
|
|
1392
|
+
* @typeParam TCustomMetadata - Custom metadata properties to associate with the Node Schema.
|
|
1393
|
+
* See {@link NodeSchemaMetadata.custom}.
|
|
1394
|
+
*
|
|
1395
|
+
* @alpha
|
|
1396
|
+
*/
|
|
1397
|
+
export interface NodeSchemaOptionsAlpha<out TCustomMetadata = unknown>
|
|
1398
|
+
extends NodeSchemaOptions<TCustomMetadata> {
|
|
1399
|
+
/**
|
|
1400
|
+
* The persisted metadata for this schema element.
|
|
1401
|
+
*/
|
|
1402
|
+
readonly persistedMetadata?: JsonCompatibleReadOnlyObject | undefined;
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1316
1405
|
/**
|
|
1317
1406
|
* Metadata associated with a Node Schema.
|
|
1318
1407
|
*
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { ValueSchema } from "../core/index.js";
|
|
7
|
-
|
|
7
|
+
import type { JsonCompatibleReadOnlyObject } from "../util/index.js";
|
|
8
8
|
import type { NodeKind } from "./core/index.js";
|
|
9
9
|
import type { FieldKind, FieldSchemaMetadata, NodeSchemaMetadata } from "./schemaTypes.js";
|
|
10
10
|
|
|
@@ -37,6 +37,23 @@ export interface SimpleNodeSchemaBase<
|
|
|
37
37
|
readonly metadata: NodeSchemaMetadata<TCustomMetadata>;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* A {@link SimpleNodeSchema} containing fields for alpha features.
|
|
42
|
+
*
|
|
43
|
+
* @system
|
|
44
|
+
* @alpha
|
|
45
|
+
* @sealed
|
|
46
|
+
*/
|
|
47
|
+
export interface SimpleNodeSchemaBaseAlpha<
|
|
48
|
+
out TNodeKind extends NodeKind,
|
|
49
|
+
out TCustomMetadata = unknown,
|
|
50
|
+
> extends SimpleNodeSchemaBase<TNodeKind, TCustomMetadata> {
|
|
51
|
+
/**
|
|
52
|
+
* Persisted metadata for this node schema.
|
|
53
|
+
*/
|
|
54
|
+
readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined;
|
|
55
|
+
}
|
|
56
|
+
|
|
40
57
|
/**
|
|
41
58
|
* A {@link SimpleNodeSchema} for an object node.
|
|
42
59
|
*
|
|
@@ -44,7 +61,7 @@ export interface SimpleNodeSchemaBase<
|
|
|
44
61
|
* @sealed
|
|
45
62
|
*/
|
|
46
63
|
export interface SimpleObjectNodeSchema<out TCustomMetadata = unknown>
|
|
47
|
-
extends
|
|
64
|
+
extends SimpleNodeSchemaBaseAlpha<NodeKind.Object, TCustomMetadata> {
|
|
48
65
|
/**
|
|
49
66
|
* Schemas for each of the object's fields, keyed off of schema's keys.
|
|
50
67
|
* @remarks
|
|
@@ -82,7 +99,7 @@ export interface SimpleObjectFieldSchema extends SimpleFieldSchema {
|
|
|
82
99
|
* @sealed
|
|
83
100
|
*/
|
|
84
101
|
export interface SimpleArrayNodeSchema<out TCustomMetadata = unknown>
|
|
85
|
-
extends
|
|
102
|
+
extends SimpleNodeSchemaBaseAlpha<NodeKind.Array, TCustomMetadata> {
|
|
86
103
|
/**
|
|
87
104
|
* The types allowed in the array.
|
|
88
105
|
*
|
|
@@ -99,7 +116,7 @@ export interface SimpleArrayNodeSchema<out TCustomMetadata = unknown>
|
|
|
99
116
|
* @sealed
|
|
100
117
|
*/
|
|
101
118
|
export interface SimpleMapNodeSchema<out TCustomMetadata = unknown>
|
|
102
|
-
extends
|
|
119
|
+
extends SimpleNodeSchemaBaseAlpha<NodeKind.Map, TCustomMetadata> {
|
|
103
120
|
/**
|
|
104
121
|
* The types allowed as values in the map.
|
|
105
122
|
*
|
|
@@ -115,7 +132,7 @@ export interface SimpleMapNodeSchema<out TCustomMetadata = unknown>
|
|
|
115
132
|
* @alpha
|
|
116
133
|
* @sealed
|
|
117
134
|
*/
|
|
118
|
-
export interface SimpleLeafNodeSchema extends
|
|
135
|
+
export interface SimpleLeafNodeSchema extends SimpleNodeSchemaBaseAlpha<NodeKind.Leaf> {
|
|
119
136
|
/**
|
|
120
137
|
* The kind of leaf node.
|
|
121
138
|
*/
|
|
@@ -170,6 +187,11 @@ export interface SimpleFieldSchema {
|
|
|
170
187
|
* {@inheritDoc FieldSchemaMetadata}
|
|
171
188
|
*/
|
|
172
189
|
readonly metadata: FieldSchemaMetadata;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Persisted metadata for this field schema.
|
|
193
|
+
*/
|
|
194
|
+
readonly persistedMetadata?: JsonCompatibleReadOnlyObject | undefined;
|
|
173
195
|
}
|
|
174
196
|
|
|
175
197
|
/**
|
|
@@ -90,7 +90,7 @@ export function convertField(schema: SimpleFieldSchema): TreeFieldStoredSchema {
|
|
|
90
90
|
const kind: FieldKindIdentifier =
|
|
91
91
|
convertFieldKind.get(schema.kind)?.identifier ?? fail(0xae3 /* Invalid field kind */);
|
|
92
92
|
const types: TreeTypeSet = schema.allowedTypesIdentifiers as TreeTypeSet;
|
|
93
|
-
return { kind, types };
|
|
93
|
+
return { kind, types, persistedMetadata: schema.persistedMetadata };
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
/**
|
|
@@ -107,6 +107,8 @@ export const convertFieldKind: ReadonlyMap<FieldKind, FlexFieldKind> = new Map<
|
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* Converts a {@link TreeNodeSchema} into a {@link TreeNodeStoredSchema}.
|
|
110
|
+
* @privateRemarks
|
|
111
|
+
* TODO: Persist node metadata once schema FormatV2 is supported.
|
|
110
112
|
*/
|
|
111
113
|
export function getStoredSchema(schema: SimpleNodeSchema): TreeNodeStoredSchema {
|
|
112
114
|
const kind = schema.kind;
|
|
@@ -117,23 +119,32 @@ export function getStoredSchema(schema: SimpleNodeSchema): TreeNodeStoredSchema
|
|
|
117
119
|
}
|
|
118
120
|
case NodeKind.Map: {
|
|
119
121
|
const types = schema.allowedTypesIdentifiers as TreeTypeSet;
|
|
120
|
-
return new MapNodeStoredSchema(
|
|
122
|
+
return new MapNodeStoredSchema(
|
|
123
|
+
{
|
|
124
|
+
kind: FieldKinds.optional.identifier,
|
|
125
|
+
types,
|
|
126
|
+
persistedMetadata: schema.persistedMetadata,
|
|
127
|
+
},
|
|
128
|
+
// TODO: Find a way to avoid injecting persistedMetadata twice in these constructor calls.
|
|
129
|
+
schema.persistedMetadata,
|
|
130
|
+
);
|
|
121
131
|
}
|
|
122
132
|
case NodeKind.Array: {
|
|
123
133
|
const types = schema.allowedTypesIdentifiers as TreeTypeSet;
|
|
124
134
|
const field = {
|
|
125
135
|
kind: FieldKinds.sequence.identifier,
|
|
126
136
|
types,
|
|
137
|
+
persistedMetadata: schema.persistedMetadata,
|
|
127
138
|
};
|
|
128
139
|
const fields = new Map([[EmptyKey, field]]);
|
|
129
|
-
return new ObjectNodeStoredSchema(fields);
|
|
140
|
+
return new ObjectNodeStoredSchema(fields, schema.persistedMetadata);
|
|
130
141
|
}
|
|
131
142
|
case NodeKind.Object: {
|
|
132
143
|
const fields: Map<FieldKey, TreeFieldStoredSchema> = new Map();
|
|
133
144
|
for (const fieldSchema of schema.fields.values()) {
|
|
134
145
|
fields.set(brand(fieldSchema.storedKey), convertField(fieldSchema));
|
|
135
146
|
}
|
|
136
|
-
return new ObjectNodeStoredSchema(fields);
|
|
147
|
+
return new ObjectNodeStoredSchema(fields, schema.persistedMetadata);
|
|
137
148
|
}
|
|
138
149
|
default:
|
|
139
150
|
unreachableCase(kind);
|
package/src/util/typeUtils.ts
CHANGED
|
@@ -168,7 +168,7 @@ export type UnionToIntersection<T> = (T extends T ? (k: T) => unknown : never) e
|
|
|
168
168
|
*
|
|
169
169
|
* @typeparam Union - The union to convert.
|
|
170
170
|
* @typeparam AsOverloadedFunction - Implementation detail: do not specify.
|
|
171
|
-
* @system @
|
|
171
|
+
* @system @beta
|
|
172
172
|
*/
|
|
173
173
|
export type PopUnion<
|
|
174
174
|
Union,
|
|
@@ -189,7 +189,7 @@ export type PopUnion<
|
|
|
189
189
|
*
|
|
190
190
|
* https://www.hacklewayne.com/typescript-convert-union-to-tuple-array-yes-but-how and https://catchts.com/union-array both explain the general approach this uses pretty well.
|
|
191
191
|
* This implementation is inspired to those, but slightly different in implementation.
|
|
192
|
-
* @
|
|
192
|
+
* @system @beta
|
|
193
193
|
*/
|
|
194
194
|
export type UnionToTuple<
|
|
195
195
|
Union,
|
package/src/util/utils.ts
CHANGED
|
@@ -317,6 +317,7 @@ export type JsonCompatibleObject<TExtra = never> = { [P in string]?: JsonCompati
|
|
|
317
317
|
* @remarks
|
|
318
318
|
* This does not robustly forbid non json comparable data via type checking,
|
|
319
319
|
* but instead mostly restricts access to it.
|
|
320
|
+
* @alpha
|
|
320
321
|
*/
|
|
321
322
|
export type JsonCompatibleReadOnly =
|
|
322
323
|
| string
|
|
@@ -332,6 +333,7 @@ export type JsonCompatibleReadOnly =
|
|
|
332
333
|
* @remarks
|
|
333
334
|
* This does not robustly forbid non json comparable data via type checking,
|
|
334
335
|
* but instead mostly restricts access to it.
|
|
336
|
+
* @alpha
|
|
335
337
|
*/
|
|
336
338
|
export type JsonCompatibleReadOnlyObject = { readonly [P in string]?: JsonCompatibleReadOnly };
|
|
337
339
|
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
export declare const Skip: unique symbol;
|
|
6
|
-
export type Skip = typeof Skip;
|
|
7
|
-
/**
|
|
8
|
-
* Visit iterable tree.
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* Non-recursive depth first traversal.
|
|
12
|
-
*/
|
|
13
|
-
export declare function visitIterableTree<T>(root: T, iterator: (t: T) => Iterable<T>, visitor: (item: T) => Skip | void): void;
|
|
14
|
-
/**
|
|
15
|
-
* Visit iterable tree.
|
|
16
|
-
* Allows state to be computed in parents and passed to children.
|
|
17
|
-
*
|
|
18
|
-
* @remarks
|
|
19
|
-
* Non-recursive depth first traversal.
|
|
20
|
-
*/
|
|
21
|
-
export declare function visitIterableTreeWithState<T extends Iterable<T>, StatePassedDown>(root: T, initial: StatePassedDown, visitor: (item: T, fromAbove: StatePassedDown) => Skip | StatePassedDown): void;
|
|
22
|
-
/**
|
|
23
|
-
* Visit bipartite iterable tree.
|
|
24
|
-
*
|
|
25
|
-
* @remarks
|
|
26
|
-
* Non-recursive depth first traversal.
|
|
27
|
-
*
|
|
28
|
-
* Particularly useful for processing trees with their alternating node and field levels.
|
|
29
|
-
*/
|
|
30
|
-
export declare function visitBipartiteIterableTree<A extends Iterable<B>, B extends Iterable<A>>(root: A, visitorA: (item: A) => Skip | undefined, visitorB: (item: B) => Skip | undefined): void;
|
|
31
|
-
/**
|
|
32
|
-
* Visit bipartite iterable tree.
|
|
33
|
-
* Allows state to be computed in parents and passed to children.
|
|
34
|
-
*
|
|
35
|
-
* @remarks
|
|
36
|
-
* Non-recursive depth first traversal.
|
|
37
|
-
*
|
|
38
|
-
* Particularly useful for processing trees with their alternating node and field levels.
|
|
39
|
-
*
|
|
40
|
-
* @privateRemarks
|
|
41
|
-
* Other traversal cases, like ones passing data up (via map or reduce patterns) could be supported by extending this or adding more utilities.
|
|
42
|
-
* Such utility functions really only provide an improvement of hand coding each cases if the non-recessiveness is required.
|
|
43
|
-
* Since supporting very deeps trees hasn't been a priority, such visitors are also not a priority, and are thus not included here for now.
|
|
44
|
-
*/
|
|
45
|
-
export declare function visitBipartiteIterableTreeWithState<A, B, StateA, StateB>(root: A, fromAbove: StateA, iterateA: (a: A) => Iterable<B>, iterateB: (b: B) => Iterable<A>, visitorA: (item: A, fromAbove: StateA) => Skip | StateB, visitorB: (item: B, fromAbove: StateB) => Skip | StateA): void;
|
|
46
|
-
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/navigation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,IAAI,eAAiB,CAAC;AACnC,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC;AAE/B;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAClC,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,EAC/B,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,IAAI,GAC/B,IAAI,CAUN;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,eAAe,EAChF,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,eAAe,KAAK,IAAI,GAAG,eAAe,GACtE,IAAI,CAYN;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EACtF,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,SAAS,EACvC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,SAAS,GACrC,IAAI,CAcN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mCAAmC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EACvE,IAAI,EAAE,CAAC,EACP,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,EAC/B,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,EAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,EACvD,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,GACrD,IAAI,CAgBN"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.visitBipartiteIterableTreeWithState = exports.visitBipartiteIterableTree = exports.visitIterableTreeWithState = exports.visitIterableTree = exports.Skip = void 0;
|
|
8
|
-
exports.Skip = Symbol("Skip");
|
|
9
|
-
/**
|
|
10
|
-
* Visit iterable tree.
|
|
11
|
-
*
|
|
12
|
-
* @remarks
|
|
13
|
-
* Non-recursive depth first traversal.
|
|
14
|
-
*/
|
|
15
|
-
function visitIterableTree(root, iterator, visitor) {
|
|
16
|
-
const queue = [[root]];
|
|
17
|
-
let next;
|
|
18
|
-
while ((next = queue.pop())) {
|
|
19
|
-
for (const child of next) {
|
|
20
|
-
if (visitor(child) !== exports.Skip) {
|
|
21
|
-
queue.push(iterator(child));
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.visitIterableTree = visitIterableTree;
|
|
27
|
-
/**
|
|
28
|
-
* Visit iterable tree.
|
|
29
|
-
* Allows state to be computed in parents and passed to children.
|
|
30
|
-
*
|
|
31
|
-
* @remarks
|
|
32
|
-
* Non-recursive depth first traversal.
|
|
33
|
-
*/
|
|
34
|
-
function visitIterableTreeWithState(root, initial, visitor) {
|
|
35
|
-
const queue = [[initial, root]];
|
|
36
|
-
let next;
|
|
37
|
-
while ((next = queue.pop())) {
|
|
38
|
-
const [state, nestItem] = next;
|
|
39
|
-
for (const child of nestItem) {
|
|
40
|
-
const result = visitor(child, state);
|
|
41
|
-
if (result !== exports.Skip) {
|
|
42
|
-
queue.push([result, child]);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.visitIterableTreeWithState = visitIterableTreeWithState;
|
|
48
|
-
/**
|
|
49
|
-
* Visit bipartite iterable tree.
|
|
50
|
-
*
|
|
51
|
-
* @remarks
|
|
52
|
-
* Non-recursive depth first traversal.
|
|
53
|
-
*
|
|
54
|
-
* Particularly useful for processing trees with their alternating node and field levels.
|
|
55
|
-
*/
|
|
56
|
-
function visitBipartiteIterableTree(root, visitorA, visitorB) {
|
|
57
|
-
const queueA = [root];
|
|
58
|
-
let nextA;
|
|
59
|
-
while ((nextA = queueA.pop())) {
|
|
60
|
-
if (visitorA(nextA) !== exports.Skip) {
|
|
61
|
-
for (const nextB of nextA) {
|
|
62
|
-
if (visitorB(nextB) !== exports.Skip) {
|
|
63
|
-
for (const child of nextB) {
|
|
64
|
-
queueA.push(child);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.visitBipartiteIterableTree = visitBipartiteIterableTree;
|
|
72
|
-
/**
|
|
73
|
-
* Visit bipartite iterable tree.
|
|
74
|
-
* Allows state to be computed in parents and passed to children.
|
|
75
|
-
*
|
|
76
|
-
* @remarks
|
|
77
|
-
* Non-recursive depth first traversal.
|
|
78
|
-
*
|
|
79
|
-
* Particularly useful for processing trees with their alternating node and field levels.
|
|
80
|
-
*
|
|
81
|
-
* @privateRemarks
|
|
82
|
-
* Other traversal cases, like ones passing data up (via map or reduce patterns) could be supported by extending this or adding more utilities.
|
|
83
|
-
* Such utility functions really only provide an improvement of hand coding each cases if the non-recessiveness is required.
|
|
84
|
-
* Since supporting very deeps trees hasn't been a priority, such visitors are also not a priority, and are thus not included here for now.
|
|
85
|
-
*/
|
|
86
|
-
function visitBipartiteIterableTreeWithState(root, fromAbove, iterateA, iterateB, visitorA, visitorB) {
|
|
87
|
-
const queueA = [[root, fromAbove]];
|
|
88
|
-
let next;
|
|
89
|
-
while ((next = queueA.pop())) {
|
|
90
|
-
const result = visitorA(...next);
|
|
91
|
-
if (result !== exports.Skip) {
|
|
92
|
-
for (const nextB of iterateA(next[0])) {
|
|
93
|
-
const resultB = visitorB(nextB, result);
|
|
94
|
-
if (resultB !== exports.Skip) {
|
|
95
|
-
for (const child of iterateB(nextB)) {
|
|
96
|
-
queueA.push([child, resultB]);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
exports.visitBipartiteIterableTreeWithState = visitBipartiteIterableTreeWithState;
|
|
104
|
-
//# sourceMappingURL=navigation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/navigation.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEU,QAAA,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAGnC;;;;;GAKG;AACH,SAAgB,iBAAiB,CAChC,IAAO,EACP,QAA+B,EAC/B,OAAiC;IAEjC,MAAM,KAAK,GAAkB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,IAAI,IAA6B,CAAC;IAClC,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;QAC7B,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;YAC1B,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,YAAI,EAAE,CAAC;gBAC7B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC;AAdD,8CAcC;AAED;;;;;;GAMG;AACH,SAAgB,0BAA0B,CACzC,IAAO,EACP,OAAwB,EACxB,OAAwE;IAExE,MAAM,KAAK,GAAqC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAClE,IAAI,IAAgD,CAAC;IACrD,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;QAC7B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC;QAC/B,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;YAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACrC,IAAI,MAAM,KAAK,YAAI,EAAE,CAAC;gBACrB,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC;AAhBD,gEAgBC;AAED;;;;;;;GAOG;AACH,SAAgB,0BAA0B,CACzC,IAAO,EACP,QAAuC,EACvC,QAAuC;IAEvC,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC;IACtB,IAAI,KAAoB,CAAC;IACzB,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;QAC/B,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,YAAI,EAAE,CAAC;YAC9B,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;gBAC3B,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,YAAI,EAAE,CAAC;oBAC9B,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;wBAC3B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;oBACpB,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC;AAlBD,gEAkBC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAgB,mCAAmC,CAClD,IAAO,EACP,SAAiB,EACjB,QAA+B,EAC/B,QAA+B,EAC/B,QAAuD,EACvD,QAAuD;IAEvD,MAAM,MAAM,GAAkB,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IAClD,IAAI,IAA6B,CAAC;IAClC,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,YAAI,EAAE,CAAC;YACrB,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvC,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBACxC,IAAI,OAAO,KAAK,YAAI,EAAE,CAAC;oBACtB,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;wBACrC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;oBAC/B,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC;AAvBD,kFAuBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport const Skip = Symbol(\"Skip\");\nexport type Skip = typeof Skip;\n\n/**\n * Visit iterable tree.\n *\n * @remarks\n * Non-recursive depth first traversal.\n */\nexport function visitIterableTree<T>(\n\troot: T,\n\titerator: (t: T) => Iterable<T>,\n\tvisitor: (item: T) => Skip | void,\n): void {\n\tconst queue: Iterable<T>[] = [[root]];\n\tlet next: Iterable<T> | undefined;\n\twhile ((next = queue.pop())) {\n\t\tfor (const child of next) {\n\t\t\tif (visitor(child) !== Skip) {\n\t\t\t\tqueue.push(iterator(child));\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Visit iterable tree.\n * Allows state to be computed in parents and passed to children.\n *\n * @remarks\n * Non-recursive depth first traversal.\n */\nexport function visitIterableTreeWithState<T extends Iterable<T>, StatePassedDown>(\n\troot: T,\n\tinitial: StatePassedDown,\n\tvisitor: (item: T, fromAbove: StatePassedDown) => Skip | StatePassedDown,\n): void {\n\tconst queue: [StatePassedDown, Iterable<T>][] = [[initial, root]];\n\tlet next: [StatePassedDown, Iterable<T>] | undefined;\n\twhile ((next = queue.pop())) {\n\t\tconst [state, nestItem] = next;\n\t\tfor (const child of nestItem) {\n\t\t\tconst result = visitor(child, state);\n\t\t\tif (result !== Skip) {\n\t\t\t\tqueue.push([result, child]);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Visit bipartite iterable tree.\n *\n * @remarks\n * Non-recursive depth first traversal.\n *\n * Particularly useful for processing trees with their alternating node and field levels.\n */\nexport function visitBipartiteIterableTree<A extends Iterable<B>, B extends Iterable<A>>(\n\troot: A,\n\tvisitorA: (item: A) => Skip | undefined,\n\tvisitorB: (item: B) => Skip | undefined,\n): void {\n\tconst queueA = [root];\n\tlet nextA: A | undefined;\n\twhile ((nextA = queueA.pop())) {\n\t\tif (visitorA(nextA) !== Skip) {\n\t\t\tfor (const nextB of nextA) {\n\t\t\t\tif (visitorB(nextB) !== Skip) {\n\t\t\t\t\tfor (const child of nextB) {\n\t\t\t\t\t\tqueueA.push(child);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Visit bipartite iterable tree.\n * Allows state to be computed in parents and passed to children.\n *\n * @remarks\n * Non-recursive depth first traversal.\n *\n * Particularly useful for processing trees with their alternating node and field levels.\n *\n * @privateRemarks\n * Other traversal cases, like ones passing data up (via map or reduce patterns) could be supported by extending this or adding more utilities.\n * Such utility functions really only provide an improvement of hand coding each cases if the non-recessiveness is required.\n * Since supporting very deeps trees hasn't been a priority, such visitors are also not a priority, and are thus not included here for now.\n */\nexport function visitBipartiteIterableTreeWithState<A, B, StateA, StateB>(\n\troot: A,\n\tfromAbove: StateA,\n\titerateA: (a: A) => Iterable<B>,\n\titerateB: (b: B) => Iterable<A>,\n\tvisitorA: (item: A, fromAbove: StateA) => Skip | StateB,\n\tvisitorB: (item: B, fromAbove: StateB) => Skip | StateA,\n): void {\n\tconst queueA: [A, StateA][] = [[root, fromAbove]];\n\tlet next: [A, StateA] | undefined;\n\twhile ((next = queueA.pop())) {\n\t\tconst result = visitorA(...next);\n\t\tif (result !== Skip) {\n\t\t\tfor (const nextB of iterateA(next[0])) {\n\t\t\t\tconst resultB = visitorB(nextB, result);\n\t\t\t\tif (resultB !== Skip) {\n\t\t\t\t\tfor (const child of iterateB(nextB)) {\n\t\t\t\t\t\tqueueA.push([child, resultB]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|