@fluidframework/tree 2.1.0-276985 → 2.1.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/.eslintrc.cjs +7 -0
- package/.vscode/Tree.code-workspace +9 -2
- package/CHANGELOG.md +38 -0
- package/README.md +55 -12
- package/api-report/tree.alpha.api.md +2 -1
- package/api-report/tree.beta.api.md +2 -1
- package/api-report/tree.public.api.md +2 -1
- package/beta.d.ts +1 -1
- package/dist/beta.d.ts +1 -1
- package/dist/core/forest/editableForest.d.ts +6 -3
- package/dist/core/forest/editableForest.d.ts.map +1 -1
- package/dist/core/forest/editableForest.js +16 -4
- package/dist/core/forest/editableForest.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +3 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +2 -0
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +9 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +1 -0
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +13 -0
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts +48 -11
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +144 -20
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodec.js +13 -4
- package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormat.d.ts +1 -1
- package/dist/core/tree/detachedFieldIndexFormat.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormat.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexTypes.d.ts +39 -4
- package/dist/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
- package/dist/core/tree/index.d.ts +2 -1
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts +3 -1
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +31 -15
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts +3 -3
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +4 -4
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/events/events.d.ts +4 -1
- package/dist/events/events.d.ts.map +1 -1
- package/dist/events/events.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -0
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/editableTreeBinder.js +1 -1
- package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +1 -10
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +0 -72
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +1 -51
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js +0 -2
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/flex-tree/index.d.ts +3 -2
- package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/index.js +5 -1
- package/dist/feature-libraries/flex-tree/index.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +1 -2
- package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts +1 -6
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +11 -32
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts +1 -5
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.js +0 -30
- package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +3 -3
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +6 -3
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +11 -0
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/dist/feature-libraries/modular-schema/discrepancies.d.ts +96 -0
- package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -0
- package/dist/feature-libraries/modular-schema/discrepancies.js +264 -0
- package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -0
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -2
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +3 -0
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +2 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +3 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +42 -26
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +51 -2
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +827 -245
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormat.js +2 -0
- package/dist/feature-libraries/modular-schema/modularChangeFormat.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +44 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/node-key/index.d.ts +0 -1
- package/dist/feature-libraries/node-key/index.d.ts.map +1 -1
- package/dist/feature-libraries/node-key/index.js +1 -3
- package/dist/feature-libraries/node-key/index.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts +3 -2
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +5 -4
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +1 -0
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/sequence-field/index.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/index.js +1 -2
- package/dist/feature-libraries/sequence-field/index.js.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +1 -1
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js +6 -1
- package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +1 -0
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.d.ts +2 -17
- package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +31 -39
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +1 -0
- package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
- package/dist/feature-libraries/typed-schema/typedTreeSchema.js +2 -0
- package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
- package/dist/index.d.ts +1 -1
- 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/public.d.ts +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +4 -2
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +240 -184
- 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 +157 -90
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/dist/shared-tree/treeApi.js +1 -1
- package/dist/shared-tree/treeApi.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +10 -1
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +47 -3
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree/treeView.d.ts.map +1 -1
- package/dist/shared-tree/treeView.js +7 -3
- package/dist/shared-tree/treeView.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +6 -0
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +3 -0
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +8 -6
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +271 -209
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts +4 -0
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js +36 -19
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/index.d.ts +3 -3
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +2 -1
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +22 -1
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +2 -1
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +2 -1
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/proxies.d.ts.map +1 -1
- package/dist/simple-tree/proxies.js +9 -25
- package/dist/simple-tree/proxies.js.map +1 -1
- package/dist/simple-tree/proxyBinding.d.ts +4 -0
- package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
- package/dist/simple-tree/proxyBinding.js +23 -1
- package/dist/simple-tree/proxyBinding.js.map +1 -1
- package/dist/simple-tree/schemaFactory.d.ts +16 -1
- package/dist/simple-tree/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/schemaFactory.js +32 -4
- package/dist/simple-tree/schemaFactory.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +36 -1
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/toFlexSchema.d.ts +2 -2
- package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
- package/dist/simple-tree/toFlexSchema.js +3 -2
- package/dist/simple-tree/toFlexSchema.js.map +1 -1
- package/dist/simple-tree/tree.d.ts +4 -1
- package/dist/simple-tree/tree.d.ts.map +1 -1
- package/dist/simple-tree/tree.js +48 -1
- package/dist/simple-tree/tree.js.map +1 -1
- package/dist/simple-tree/treeNodeApi.d.ts +2 -75
- package/dist/simple-tree/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/treeNodeApi.js +17 -25
- package/dist/simple-tree/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/treeNodeKernel.d.ts +26 -0
- package/dist/simple-tree/treeNodeKernel.d.ts.map +1 -0
- package/dist/simple-tree/treeNodeKernel.js +83 -0
- package/dist/simple-tree/treeNodeKernel.js.map +1 -0
- package/dist/simple-tree/types.d.ts +95 -3
- package/dist/simple-tree/types.d.ts.map +1 -1
- package/dist/simple-tree/types.js +120 -21
- package/dist/simple-tree/types.js.map +1 -1
- package/dist/util/breakable.d.ts +83 -0
- package/dist/util/breakable.d.ts.map +1 -0
- package/dist/util/breakable.js +178 -0
- package/dist/util/breakable.js.map +1 -0
- package/dist/util/index.d.ts +3 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +9 -2
- package/dist/util/index.js.map +1 -1
- package/dist/util/nestedMap.d.ts +17 -3
- package/dist/util/nestedMap.d.ts.map +1 -1
- package/dist/util/nestedMap.js +21 -1
- package/dist/util/nestedMap.js.map +1 -1
- package/dist/util/utils.d.ts +7 -0
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +15 -1
- package/dist/util/utils.js.map +1 -1
- package/internal.d.ts +1 -1
- package/lib/beta.d.ts +1 -1
- package/lib/core/forest/editableForest.d.ts +6 -3
- package/lib/core/forest/editableForest.d.ts.map +1 -1
- package/lib/core/forest/editableForest.js +17 -5
- package/lib/core/forest/editableForest.js.map +1 -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/rebase/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +2 -0
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +7 -1
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts +1 -0
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +13 -0
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts +48 -11
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +145 -21
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodec.js +13 -4
- package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormat.d.ts +1 -1
- package/lib/core/tree/detachedFieldIndexFormat.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormat.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexTypes.d.ts +39 -4
- package/lib/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
- package/lib/core/tree/index.d.ts +2 -1
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts +3 -1
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +31 -15
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts +3 -3
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +4 -4
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/events/events.d.ts +4 -1
- package/lib/events/events.d.ts.map +1 -1
- package/lib/events/events.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -0
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/editableTreeBinder.js +1 -1
- package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +1 -10
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +2 -74
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +1 -51
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js +0 -2
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/lib/feature-libraries/flex-tree/index.d.ts +3 -2
- package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/index.js +2 -1
- package/lib/feature-libraries/flex-tree/index.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +1 -2
- package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts +1 -6
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +13 -34
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts +1 -5
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js +3 -33
- package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +3 -3
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +3 -3
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +11 -0
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/lib/feature-libraries/modular-schema/discrepancies.d.ts +96 -0
- package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -0
- package/lib/feature-libraries/modular-schema/discrepancies.js +260 -0
- package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -0
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -2
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +3 -0
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +2 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +1 -0
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +42 -26
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +51 -2
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +826 -247
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormat.js +2 -0
- package/lib/feature-libraries/modular-schema/modularChangeFormat.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +44 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/node-key/index.d.ts +0 -1
- package/lib/feature-libraries/node-key/index.d.ts.map +1 -1
- package/lib/feature-libraries/node-key/index.js +0 -1
- package/lib/feature-libraries/node-key/index.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts +3 -2
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +5 -4
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +1 -0
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/sequence-field/index.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/index.js +1 -1
- package/lib/feature-libraries/sequence-field/index.js.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.js +1 -1
- package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.js +6 -1
- package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +2 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.d.ts +2 -17
- package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +31 -39
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +1 -0
- package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
- package/lib/feature-libraries/typed-schema/typedTreeSchema.js +4 -2
- package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
- package/lib/index.d.ts +1 -1
- 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/public.d.ts +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +4 -2
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +242 -185
- 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 +158 -90
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.js +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/lib/shared-tree/treeApi.js +1 -1
- package/lib/shared-tree/treeApi.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +10 -1
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +47 -3
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree/treeView.d.ts.map +1 -1
- package/lib/shared-tree/treeView.js +4 -0
- package/lib/shared-tree/treeView.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +6 -0
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +3 -0
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +8 -6
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +273 -210
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/arrayNode.d.ts +4 -0
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js +39 -22
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/index.d.ts +3 -3
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +22 -1
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +1 -1
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +3 -2
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/proxies.d.ts.map +1 -1
- package/lib/simple-tree/proxies.js +9 -25
- package/lib/simple-tree/proxies.js.map +1 -1
- package/lib/simple-tree/proxyBinding.d.ts +4 -0
- package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
- package/lib/simple-tree/proxyBinding.js +19 -0
- package/lib/simple-tree/proxyBinding.js.map +1 -1
- package/lib/simple-tree/schemaFactory.d.ts +16 -1
- package/lib/simple-tree/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/schemaFactory.js +30 -3
- package/lib/simple-tree/schemaFactory.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +36 -1
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/toFlexSchema.d.ts +2 -2
- package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
- package/lib/simple-tree/toFlexSchema.js +3 -2
- package/lib/simple-tree/toFlexSchema.js.map +1 -1
- package/lib/simple-tree/tree.d.ts +4 -1
- package/lib/simple-tree/tree.d.ts.map +1 -1
- package/lib/simple-tree/tree.js +44 -0
- package/lib/simple-tree/tree.js.map +1 -1
- package/lib/simple-tree/treeNodeApi.d.ts +2 -75
- package/lib/simple-tree/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/treeNodeApi.js +20 -28
- package/lib/simple-tree/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/treeNodeKernel.d.ts +26 -0
- package/lib/simple-tree/treeNodeKernel.d.ts.map +1 -0
- package/lib/simple-tree/treeNodeKernel.js +79 -0
- package/lib/simple-tree/treeNodeKernel.js.map +1 -0
- package/lib/simple-tree/types.d.ts +95 -3
- package/lib/simple-tree/types.d.ts.map +1 -1
- package/lib/simple-tree/types.js +121 -22
- package/lib/simple-tree/types.js.map +1 -1
- package/lib/util/breakable.d.ts +83 -0
- package/lib/util/breakable.d.ts.map +1 -0
- package/lib/util/breakable.js +171 -0
- package/lib/util/breakable.js.map +1 -0
- package/lib/util/index.d.ts +3 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +3 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/nestedMap.d.ts +17 -3
- package/lib/util/nestedMap.d.ts.map +1 -1
- package/lib/util/nestedMap.js +19 -0
- package/lib/util/nestedMap.js.map +1 -1
- package/lib/util/utils.d.ts +7 -0
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +13 -0
- package/lib/util/utils.js.map +1 -1
- package/package.json +29 -27
- package/src/core/forest/editableForest.ts +25 -4
- package/src/core/index.ts +2 -0
- package/src/core/rebase/index.ts +2 -0
- package/src/core/rebase/types.ts +17 -0
- package/src/core/tree/anchorSet.ts +14 -0
- package/src/core/tree/detachedFieldIndex.ts +217 -35
- package/src/core/tree/detachedFieldIndexCodec.ts +17 -8
- package/src/core/tree/detachedFieldIndexFormat.ts +1 -1
- package/src/core/tree/detachedFieldIndexTypes.ts +41 -5
- package/src/core/tree/index.ts +2 -1
- package/src/core/tree/visitDelta.ts +58 -16
- package/src/core/tree/visitorUtils.ts +7 -4
- package/src/events/events.ts +4 -2
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +1 -1
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -0
- package/src/feature-libraries/editableTreeBinder.ts +1 -1
- package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +1 -95
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +0 -62
- package/src/feature-libraries/flex-tree/index.ts +7 -2
- package/src/feature-libraries/flex-tree/lazyEntity.ts +0 -3
- package/src/feature-libraries/flex-tree/lazyField.ts +15 -47
- package/src/feature-libraries/flex-tree/lazyNode.ts +1 -48
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -0
- package/src/feature-libraries/index.ts +4 -2
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +18 -0
- package/src/feature-libraries/modular-schema/discrepancies.ts +395 -0
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +10 -2
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +3 -0
- package/src/feature-libraries/modular-schema/index.ts +2 -0
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +81 -35
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +1521 -444
- package/src/feature-libraries/modular-schema/modularChangeFormat.ts +2 -0
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +51 -0
- package/src/feature-libraries/node-key/index.ts +0 -1
- package/src/feature-libraries/object-forest/objectForest.ts +7 -3
- package/src/feature-libraries/optional-field/optionalField.ts +1 -0
- package/src/feature-libraries/sequence-field/index.ts +0 -2
- package/src/feature-libraries/sequence-field/invert.ts +1 -1
- package/src/feature-libraries/sequence-field/rebase.ts +7 -1
- package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +2 -1
- package/src/feature-libraries/sequence-field/utils.ts +37 -85
- package/src/feature-libraries/typed-schema/typedTreeSchema.ts +10 -0
- package/src/index.ts +0 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/schematizingTreeView.ts +6 -2
- package/src/shared-tree/sharedTree.ts +12 -1
- package/src/shared-tree/sharedTreeChangeEnricher.ts +1 -1
- package/src/shared-tree/treeApi.ts +1 -1
- package/src/shared-tree/treeCheckout.ts +60 -5
- package/src/shared-tree/treeView.ts +5 -0
- package/src/shared-tree-core/branch.ts +10 -0
- package/src/shared-tree-core/sharedTreeCore.ts +25 -6
- package/src/simple-tree/arrayNode.ts +50 -23
- package/src/simple-tree/index.ts +3 -3
- package/src/simple-tree/leafNodeSchema.ts +1 -1
- package/src/simple-tree/mapNode.ts +2 -2
- package/src/simple-tree/objectNode.ts +9 -3
- package/src/simple-tree/proxies.ts +10 -33
- package/src/simple-tree/proxyBinding.ts +23 -0
- package/src/simple-tree/schemaFactory.ts +37 -2
- package/src/simple-tree/schemaTypes.ts +36 -1
- package/src/simple-tree/toFlexSchema.ts +5 -4
- package/src/simple-tree/tree.ts +68 -4
- package/src/simple-tree/treeNodeApi.ts +29 -111
- package/src/simple-tree/treeNodeKernel.ts +91 -0
- package/src/simple-tree/types.ts +292 -31
- package/src/util/breakable.ts +214 -0
- package/src/util/index.ts +11 -0
- package/src/util/nestedMap.ts +33 -3
- package/src/util/utils.ts +17 -0
- package/dist/feature-libraries/node-key/nodeKeyIndex.d.ts +0 -41
- package/dist/feature-libraries/node-key/nodeKeyIndex.d.ts.map +0 -1
- package/dist/feature-libraries/node-key/nodeKeyIndex.js +0 -101
- package/dist/feature-libraries/node-key/nodeKeyIndex.js.map +0 -1
- package/lib/feature-libraries/node-key/nodeKeyIndex.d.ts +0 -41
- package/lib/feature-libraries/node-key/nodeKeyIndex.d.ts.map +0 -1
- package/lib/feature-libraries/node-key/nodeKeyIndex.js +0 -97
- package/lib/feature-libraries/node-key/nodeKeyIndex.js.map +0 -1
- package/src/feature-libraries/node-key/nodeKeyIndex.ts +0 -132
package/src/util/nestedMap.ts
CHANGED
|
@@ -16,6 +16,13 @@ import type { MapGetSet } from "./utils.js";
|
|
|
16
16
|
*/
|
|
17
17
|
export type NestedMap<Key1, Key2, Value> = Map<Key1, Map<Key2, Value>>;
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* A read-only version of {@link NestedMap}.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export type ReadonlyNestedMap<Key1, Key2, Value> = ReadonlyMap<Key1, ReadonlyMap<Key2, Value>>;
|
|
25
|
+
|
|
19
26
|
/**
|
|
20
27
|
* If (key1, key2) already has a value in the map, it is returned, otherwise value is added under (key1, key2) and undefined is returned.
|
|
21
28
|
*
|
|
@@ -51,7 +58,7 @@ export function tryAddToNestedMap<Key1, Key2, Value>(
|
|
|
51
58
|
* @internal
|
|
52
59
|
*/
|
|
53
60
|
export function populateNestedMap<Key1, Key2, Value>(
|
|
54
|
-
source:
|
|
61
|
+
source: ReadonlyNestedMap<Key1, Key2, Value>,
|
|
55
62
|
destination: NestedMap<Key1, Key2, Value>,
|
|
56
63
|
override: boolean,
|
|
57
64
|
): void {
|
|
@@ -187,7 +194,7 @@ export function deleteFromNestedMap<Key1, Key2, Value>(
|
|
|
187
194
|
* Converts a nested map to a flat list of triplets.
|
|
188
195
|
*/
|
|
189
196
|
export function nestedMapToFlatList<Key1, Key2, Value>(
|
|
190
|
-
map:
|
|
197
|
+
map: ReadonlyNestedMap<Key1, Key2, Value>,
|
|
191
198
|
): [Key1, Key2, Value][] {
|
|
192
199
|
const list: [Key1, Key2, Value][] = [];
|
|
193
200
|
map.forEach((innerMap, key1) => {
|
|
@@ -212,7 +219,7 @@ export function nestedMapFromFlatList<Key1, Key2, Value>(
|
|
|
212
219
|
}
|
|
213
220
|
|
|
214
221
|
export function forEachInNestedMap<Key1, Key2, Value>(
|
|
215
|
-
map:
|
|
222
|
+
map: ReadonlyNestedMap<Key1, Key2, Value>,
|
|
216
223
|
delegate: (value: Value, key1: Key1, key2: Key2) => void,
|
|
217
224
|
): void {
|
|
218
225
|
map.forEach((innerMap, keyFirst) => {
|
|
@@ -222,6 +229,29 @@ export function forEachInNestedMap<Key1, Key2, Value>(
|
|
|
222
229
|
});
|
|
223
230
|
}
|
|
224
231
|
|
|
232
|
+
/**
|
|
233
|
+
* Maps the `input` map values using the provided `delegate`.
|
|
234
|
+
*
|
|
235
|
+
* @param input - The `NestedMap` whose contents are being mapped.
|
|
236
|
+
* @param delegate - The delegate to use for mapping values,
|
|
237
|
+
* @returns A new `NestedMap` with the same keys as `input`, but with the values produced by `delegate`.
|
|
238
|
+
*/
|
|
239
|
+
export function mapNestedMap<Key1, Key2, ValueIn, ValueOut = ValueIn>(
|
|
240
|
+
input: ReadonlyNestedMap<Key1, Key2, ValueIn>,
|
|
241
|
+
delegate: (value: ValueIn, key1: Key1, key2: Key2) => ValueOut,
|
|
242
|
+
): NestedMap<Key1, Key2, ValueOut> {
|
|
243
|
+
const output = new Map<Key1, Map<Key2, ValueOut>>();
|
|
244
|
+
input.forEach((inputInnerMap, keyFirst) => {
|
|
245
|
+
const outputInnerMap = new Map<Key2, ValueOut>();
|
|
246
|
+
inputInnerMap.forEach((val, keySecond) => {
|
|
247
|
+
const mappedValue = delegate(val, keyFirst, keySecond);
|
|
248
|
+
outputInnerMap.set(keySecond, mappedValue);
|
|
249
|
+
});
|
|
250
|
+
output.set(keyFirst, outputInnerMap);
|
|
251
|
+
});
|
|
252
|
+
return output;
|
|
253
|
+
}
|
|
254
|
+
|
|
225
255
|
/**
|
|
226
256
|
* Map with two keys; same semantics as NestedMap, but maintains a size count for the entire collection.
|
|
227
257
|
* Note: undefined is not supported as a value, and will cause incorrect behavior.
|
package/src/util/utils.ts
CHANGED
|
@@ -174,6 +174,23 @@ export function* mapIterable<T, U>(
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
/**
|
|
178
|
+
* Filter one iterable into another
|
|
179
|
+
* @param iterable - the iterable to filter
|
|
180
|
+
* @param filter - the predicate function to run on each element of the iterable
|
|
181
|
+
* @returns a new iterable including only the elements that passed the filter predicate
|
|
182
|
+
*/
|
|
183
|
+
export function* filterIterable<T>(
|
|
184
|
+
iterable: Iterable<T>,
|
|
185
|
+
filter: (t: T) => boolean,
|
|
186
|
+
): IterableIterator<T> {
|
|
187
|
+
for (const t of iterable) {
|
|
188
|
+
if (filter(t)) {
|
|
189
|
+
yield t;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
177
194
|
/**
|
|
178
195
|
* Finds the first element in the given iterable that satisfies a predicate.
|
|
179
196
|
* @param iterable - The iterable to search for an eligible element
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { type FieldKey } from "../../core/index.js";
|
|
6
|
-
import type { FlexTreeContext, FlexTreeObjectNode } from "../flex-tree/index.js";
|
|
7
|
-
import { type FlexTreeSchema } from "../typed-schema/index.js";
|
|
8
|
-
import { type LocalNodeKey } from "./nodeKey.js";
|
|
9
|
-
/**
|
|
10
|
-
* The node key index records nodes with {@link LocalNodeKey}s and allows them to be looked up by key.
|
|
11
|
-
*/
|
|
12
|
-
export declare class NodeKeyIndex implements ReadonlyMap<LocalNodeKey, FlexTreeObjectNode> {
|
|
13
|
-
readonly fieldKey: FieldKey;
|
|
14
|
-
private readonly nodes;
|
|
15
|
-
constructor(fieldKey: FieldKey, keys?: Iterable<[LocalNodeKey, FlexTreeObjectNode]>);
|
|
16
|
-
/**
|
|
17
|
-
* Returns true if the given schema contains the node key type, otherwise false
|
|
18
|
-
*/
|
|
19
|
-
static hasNodeKeyTreeSchema(schema: FlexTreeSchema): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Search the tree for all nodes with keys, and record them in this index for lookup.
|
|
22
|
-
* This should be called each time the tree changes; each call to scan forgets all existing keys.
|
|
23
|
-
* @param context - the flex tree context in which to search for node keys
|
|
24
|
-
*/
|
|
25
|
-
scanKeys(context: FlexTreeContext): void;
|
|
26
|
-
/**
|
|
27
|
-
* Create a copy of this index which can be mutated without affecting this one.
|
|
28
|
-
*/
|
|
29
|
-
clone(context: FlexTreeContext): NodeKeyIndex;
|
|
30
|
-
forEach(callbackfn: (value: FlexTreeObjectNode, key: LocalNodeKey, map: ReadonlyMap<LocalNodeKey, FlexTreeObjectNode>) => void, thisArg?: unknown): void;
|
|
31
|
-
get(key: LocalNodeKey): FlexTreeObjectNode | undefined;
|
|
32
|
-
has(key: LocalNodeKey): boolean;
|
|
33
|
-
get size(): number;
|
|
34
|
-
entries(): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]>;
|
|
35
|
-
keys(): IterableIterator<LocalNodeKey>;
|
|
36
|
-
values(): IterableIterator<FlexTreeObjectNode>;
|
|
37
|
-
[Symbol.iterator](): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]>;
|
|
38
|
-
private findKeys;
|
|
39
|
-
private findKeysInField;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=nodeKeyIndex.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeKeyIndex.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/nodeKeyIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,QAAQ,EAAe,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EACX,eAAe,EAGf,kBAAkB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,KAAK,cAAc,EAGnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,KAAK,YAAY,EAAyB,MAAM,cAAc,CAAC;AAExE;;GAEG;AACH,qBAAa,YAAa,YAAW,WAAW,CAAC,YAAY,EAAE,kBAAkB,CAAC;aAKhE,QAAQ,EAAE,QAAQ;IAHnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwC;gBAG7C,QAAQ,EAAE,QAAQ,EAClC,IAAI,GAAE,QAAQ,CAAC,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAM;IAKxD;;OAEG;WACW,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO;IASnE;;;;OAIG;IAEI,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAa/C;;OAEG;IACI,KAAK,CAAC,OAAO,EAAE,eAAe,GAAG,YAAY;IAO7C,OAAO,CACb,UAAU,EAAE,CACX,KAAK,EAAE,kBAAkB,EACzB,GAAG,EAAE,YAAY,EACjB,GAAG,EAAE,WAAW,CAAC,YAAY,EAAE,kBAAkB,CAAC,KAC9C,IAAI,EACT,OAAO,CAAC,EAAE,OAAO,GACf,IAAI;IAGA,GAAG,CAAC,GAAG,EAAE,YAAY,GAAG,kBAAkB,GAAG,SAAS;IAGtD,GAAG,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO;IAGtC,IAAW,IAAI,IAAI,MAAM,CAExB;IACM,OAAO,IAAI,gBAAgB,CAAC,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;IAG/D,IAAI,IAAI,gBAAgB,CAAC,YAAY,CAAC;IAGtC,MAAM,IAAI,gBAAgB,CAAC,kBAAkB,CAAC;IAG9C,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;IAKhF,OAAO,CAAE,QAAQ;IAcjB,OAAO,CAAE,eAAe;CAOxB"}
|
|
@@ -1,101 +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.NodeKeyIndex = void 0;
|
|
8
|
-
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
|
-
const index_js_1 = require("../../core/index.js");
|
|
10
|
-
const index_js_2 = require("../typed-schema/index.js");
|
|
11
|
-
const nodeKey_js_1 = require("./nodeKey.js");
|
|
12
|
-
/**
|
|
13
|
-
* The node key index records nodes with {@link LocalNodeKey}s and allows them to be looked up by key.
|
|
14
|
-
*/
|
|
15
|
-
class NodeKeyIndex {
|
|
16
|
-
constructor(fieldKey, keys = []) {
|
|
17
|
-
this.fieldKey = fieldKey;
|
|
18
|
-
this.nodes = new Map(keys);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Returns true if the given schema contains the node key type, otherwise false
|
|
22
|
-
*/
|
|
23
|
-
static hasNodeKeyTreeSchema(schema) {
|
|
24
|
-
// TODO: make TreeStoredSchema contain ViewSchema and compare by reference to nodeKeyTreeSchema.
|
|
25
|
-
const treeSchema = schema.nodeSchema.get(nodeKey_js_1.nodeKeyTreeIdentifier);
|
|
26
|
-
if (!(treeSchema instanceof index_js_2.LeafNodeSchema)) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
return treeSchema.leafValue === index_js_1.ValueSchema.String;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Search the tree for all nodes with keys, and record them in this index for lookup.
|
|
33
|
-
* This should be called each time the tree changes; each call to scan forgets all existing keys.
|
|
34
|
-
* @param context - the flex tree context in which to search for node keys
|
|
35
|
-
*/
|
|
36
|
-
// TODO: This can be optimized by responding to deltas/changes to the tree, rather than rescanning the whole tree every time
|
|
37
|
-
scanKeys(context) {
|
|
38
|
-
this.nodes.clear();
|
|
39
|
-
if (NodeKeyIndex.hasNodeKeyTreeSchema(context.schema)) {
|
|
40
|
-
for (const [id, node] of this.findKeysInField(context.root)) {
|
|
41
|
-
// TODO:
|
|
42
|
-
// This invariant (that there is only one node with a given key) is not enforced by tree, so it should not assert.
|
|
43
|
-
// Multiple nodes (including deleted ones), might occur with the same key.
|
|
44
|
-
(0, internal_1.assert)(!this.nodes.has(id), 0x6e1 /* Encountered duplicate node key */);
|
|
45
|
-
this.nodes.set(id, node);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Create a copy of this index which can be mutated without affecting this one.
|
|
51
|
-
*/
|
|
52
|
-
clone(context) {
|
|
53
|
-
const indexClone = new NodeKeyIndex(this.fieldKey);
|
|
54
|
-
indexClone.scanKeys(context);
|
|
55
|
-
return indexClone;
|
|
56
|
-
}
|
|
57
|
-
// #region ReadonlyMap interface
|
|
58
|
-
forEach(callbackfn, thisArg) {
|
|
59
|
-
return this.nodes.forEach(callbackfn, thisArg);
|
|
60
|
-
}
|
|
61
|
-
get(key) {
|
|
62
|
-
return this.nodes.get(key);
|
|
63
|
-
}
|
|
64
|
-
has(key) {
|
|
65
|
-
return this.nodes.has(key);
|
|
66
|
-
}
|
|
67
|
-
get size() {
|
|
68
|
-
return this.nodes.size;
|
|
69
|
-
}
|
|
70
|
-
entries() {
|
|
71
|
-
return this.nodes.entries();
|
|
72
|
-
}
|
|
73
|
-
keys() {
|
|
74
|
-
return this.nodes.keys();
|
|
75
|
-
}
|
|
76
|
-
values() {
|
|
77
|
-
return this.nodes.values();
|
|
78
|
-
}
|
|
79
|
-
[Symbol.iterator]() {
|
|
80
|
-
return this.nodes[Symbol.iterator]();
|
|
81
|
-
}
|
|
82
|
-
// #endregion ReadonlyMap interface
|
|
83
|
-
*findKeys(node) {
|
|
84
|
-
if ((0, index_js_2.schemaIsObjectNode)(node.schema)) {
|
|
85
|
-
const key = node.localNodeKey;
|
|
86
|
-
if (key !== undefined) {
|
|
87
|
-
yield [key, node];
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
for (const f of node.boxedIterator()) {
|
|
91
|
-
yield* this.findKeysInField(f);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
*findKeysInField(f) {
|
|
95
|
-
for (const child of f.boxedIterator()) {
|
|
96
|
-
yield* this.findKeys(child);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
exports.NodeKeyIndex = NodeKeyIndex;
|
|
101
|
-
//# sourceMappingURL=nodeKeyIndex.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeKeyIndex.js","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/nodeKeyIndex.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport { type FieldKey, ValueSchema } from \"../../core/index.js\";\nimport type {\n\tFlexTreeContext,\n\tFlexTreeField,\n\tFlexTreeNode,\n\tFlexTreeObjectNode,\n} from \"../flex-tree/index.js\";\nimport {\n\ttype FlexTreeSchema,\n\tLeafNodeSchema,\n\tschemaIsObjectNode,\n} from \"../typed-schema/index.js\";\n\nimport { type LocalNodeKey, nodeKeyTreeIdentifier } from \"./nodeKey.js\";\n\n/**\n * The node key index records nodes with {@link LocalNodeKey}s and allows them to be looked up by key.\n */\nexport class NodeKeyIndex implements ReadonlyMap<LocalNodeKey, FlexTreeObjectNode> {\n\t// TODO: The data structure that holds the nodes can likely be optimized to better support cloning\n\tprivate readonly nodes: Map<LocalNodeKey, FlexTreeObjectNode>;\n\n\tpublic constructor(\n\t\tpublic readonly fieldKey: FieldKey,\n\t\tkeys: Iterable<[LocalNodeKey, FlexTreeObjectNode]> = [],\n\t) {\n\t\tthis.nodes = new Map(keys);\n\t}\n\n\t/**\n\t * Returns true if the given schema contains the node key type, otherwise false\n\t */\n\tpublic static hasNodeKeyTreeSchema(schema: FlexTreeSchema): boolean {\n\t\t// TODO: make TreeStoredSchema contain ViewSchema and compare by reference to nodeKeyTreeSchema.\n\t\tconst treeSchema = schema.nodeSchema.get(nodeKeyTreeIdentifier);\n\t\tif (!(treeSchema instanceof LeafNodeSchema)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn treeSchema.leafValue === ValueSchema.String;\n\t}\n\n\t/**\n\t * Search the tree for all nodes with keys, and record them in this index for lookup.\n\t * This should be called each time the tree changes; each call to scan forgets all existing keys.\n\t * @param context - the flex tree context in which to search for node keys\n\t */\n\t// TODO: This can be optimized by responding to deltas/changes to the tree, rather than rescanning the whole tree every time\n\tpublic scanKeys(context: FlexTreeContext): void {\n\t\tthis.nodes.clear();\n\t\tif (NodeKeyIndex.hasNodeKeyTreeSchema(context.schema)) {\n\t\t\tfor (const [id, node] of this.findKeysInField(context.root)) {\n\t\t\t\t// TODO:\n\t\t\t\t// This invariant (that there is only one node with a given key) is not enforced by tree, so it should not assert.\n\t\t\t\t// Multiple nodes (including deleted ones), might occur with the same key.\n\t\t\t\tassert(!this.nodes.has(id), 0x6e1 /* Encountered duplicate node key */);\n\t\t\t\tthis.nodes.set(id, node);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Create a copy of this index which can be mutated without affecting this one.\n\t */\n\tpublic clone(context: FlexTreeContext): NodeKeyIndex {\n\t\tconst indexClone = new NodeKeyIndex(this.fieldKey);\n\t\tindexClone.scanKeys(context);\n\t\treturn indexClone;\n\t}\n\n\t// #region ReadonlyMap interface\n\tpublic forEach(\n\t\tcallbackfn: (\n\t\t\tvalue: FlexTreeObjectNode,\n\t\t\tkey: LocalNodeKey,\n\t\t\tmap: ReadonlyMap<LocalNodeKey, FlexTreeObjectNode>,\n\t\t) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\treturn this.nodes.forEach(callbackfn, thisArg);\n\t}\n\tpublic get(key: LocalNodeKey): FlexTreeObjectNode | undefined {\n\t\treturn this.nodes.get(key);\n\t}\n\tpublic has(key: LocalNodeKey): boolean {\n\t\treturn this.nodes.has(key);\n\t}\n\tpublic get size(): number {\n\t\treturn this.nodes.size;\n\t}\n\tpublic entries(): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]> {\n\t\treturn this.nodes.entries();\n\t}\n\tpublic keys(): IterableIterator<LocalNodeKey> {\n\t\treturn this.nodes.keys();\n\t}\n\tpublic values(): IterableIterator<FlexTreeObjectNode> {\n\t\treturn this.nodes.values();\n\t}\n\tpublic [Symbol.iterator](): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]> {\n\t\treturn this.nodes[Symbol.iterator]();\n\t}\n\t// #endregion ReadonlyMap interface\n\n\tprivate *findKeys(\n\t\tnode: FlexTreeNode,\n\t): Iterable<[key: LocalNodeKey, node: FlexTreeObjectNode]> {\n\t\tif (schemaIsObjectNode(node.schema)) {\n\t\t\tconst key = (node as FlexTreeObjectNode).localNodeKey;\n\t\t\tif (key !== undefined) {\n\t\t\t\tyield [key, node as FlexTreeObjectNode];\n\t\t\t}\n\t\t}\n\t\tfor (const f of node.boxedIterator()) {\n\t\t\tyield* this.findKeysInField(f);\n\t\t}\n\t}\n\n\tprivate *findKeysInField(\n\t\tf: FlexTreeField,\n\t): Iterable<[key: LocalNodeKey, node: FlexTreeObjectNode]> {\n\t\tfor (const child of f.boxedIterator()) {\n\t\t\tyield* this.findKeys(child);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { type FieldKey } from "../../core/index.js";
|
|
6
|
-
import type { FlexTreeContext, FlexTreeObjectNode } from "../flex-tree/index.js";
|
|
7
|
-
import { type FlexTreeSchema } from "../typed-schema/index.js";
|
|
8
|
-
import { type LocalNodeKey } from "./nodeKey.js";
|
|
9
|
-
/**
|
|
10
|
-
* The node key index records nodes with {@link LocalNodeKey}s and allows them to be looked up by key.
|
|
11
|
-
*/
|
|
12
|
-
export declare class NodeKeyIndex implements ReadonlyMap<LocalNodeKey, FlexTreeObjectNode> {
|
|
13
|
-
readonly fieldKey: FieldKey;
|
|
14
|
-
private readonly nodes;
|
|
15
|
-
constructor(fieldKey: FieldKey, keys?: Iterable<[LocalNodeKey, FlexTreeObjectNode]>);
|
|
16
|
-
/**
|
|
17
|
-
* Returns true if the given schema contains the node key type, otherwise false
|
|
18
|
-
*/
|
|
19
|
-
static hasNodeKeyTreeSchema(schema: FlexTreeSchema): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Search the tree for all nodes with keys, and record them in this index for lookup.
|
|
22
|
-
* This should be called each time the tree changes; each call to scan forgets all existing keys.
|
|
23
|
-
* @param context - the flex tree context in which to search for node keys
|
|
24
|
-
*/
|
|
25
|
-
scanKeys(context: FlexTreeContext): void;
|
|
26
|
-
/**
|
|
27
|
-
* Create a copy of this index which can be mutated without affecting this one.
|
|
28
|
-
*/
|
|
29
|
-
clone(context: FlexTreeContext): NodeKeyIndex;
|
|
30
|
-
forEach(callbackfn: (value: FlexTreeObjectNode, key: LocalNodeKey, map: ReadonlyMap<LocalNodeKey, FlexTreeObjectNode>) => void, thisArg?: unknown): void;
|
|
31
|
-
get(key: LocalNodeKey): FlexTreeObjectNode | undefined;
|
|
32
|
-
has(key: LocalNodeKey): boolean;
|
|
33
|
-
get size(): number;
|
|
34
|
-
entries(): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]>;
|
|
35
|
-
keys(): IterableIterator<LocalNodeKey>;
|
|
36
|
-
values(): IterableIterator<FlexTreeObjectNode>;
|
|
37
|
-
[Symbol.iterator](): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]>;
|
|
38
|
-
private findKeys;
|
|
39
|
-
private findKeysInField;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=nodeKeyIndex.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeKeyIndex.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/nodeKeyIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,QAAQ,EAAe,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EACX,eAAe,EAGf,kBAAkB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,KAAK,cAAc,EAGnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,KAAK,YAAY,EAAyB,MAAM,cAAc,CAAC;AAExE;;GAEG;AACH,qBAAa,YAAa,YAAW,WAAW,CAAC,YAAY,EAAE,kBAAkB,CAAC;aAKhE,QAAQ,EAAE,QAAQ;IAHnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwC;gBAG7C,QAAQ,EAAE,QAAQ,EAClC,IAAI,GAAE,QAAQ,CAAC,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAM;IAKxD;;OAEG;WACW,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO;IASnE;;;;OAIG;IAEI,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAa/C;;OAEG;IACI,KAAK,CAAC,OAAO,EAAE,eAAe,GAAG,YAAY;IAO7C,OAAO,CACb,UAAU,EAAE,CACX,KAAK,EAAE,kBAAkB,EACzB,GAAG,EAAE,YAAY,EACjB,GAAG,EAAE,WAAW,CAAC,YAAY,EAAE,kBAAkB,CAAC,KAC9C,IAAI,EACT,OAAO,CAAC,EAAE,OAAO,GACf,IAAI;IAGA,GAAG,CAAC,GAAG,EAAE,YAAY,GAAG,kBAAkB,GAAG,SAAS;IAGtD,GAAG,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO;IAGtC,IAAW,IAAI,IAAI,MAAM,CAExB;IACM,OAAO,IAAI,gBAAgB,CAAC,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;IAG/D,IAAI,IAAI,gBAAgB,CAAC,YAAY,CAAC;IAGtC,MAAM,IAAI,gBAAgB,CAAC,kBAAkB,CAAC;IAG9C,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;IAKhF,OAAO,CAAE,QAAQ;IAcjB,OAAO,CAAE,eAAe;CAOxB"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { assert } from "@fluidframework/core-utils/internal";
|
|
6
|
-
import { ValueSchema } from "../../core/index.js";
|
|
7
|
-
import { LeafNodeSchema, schemaIsObjectNode, } from "../typed-schema/index.js";
|
|
8
|
-
import { nodeKeyTreeIdentifier } from "./nodeKey.js";
|
|
9
|
-
/**
|
|
10
|
-
* The node key index records nodes with {@link LocalNodeKey}s and allows them to be looked up by key.
|
|
11
|
-
*/
|
|
12
|
-
export class NodeKeyIndex {
|
|
13
|
-
constructor(fieldKey, keys = []) {
|
|
14
|
-
this.fieldKey = fieldKey;
|
|
15
|
-
this.nodes = new Map(keys);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Returns true if the given schema contains the node key type, otherwise false
|
|
19
|
-
*/
|
|
20
|
-
static hasNodeKeyTreeSchema(schema) {
|
|
21
|
-
// TODO: make TreeStoredSchema contain ViewSchema and compare by reference to nodeKeyTreeSchema.
|
|
22
|
-
const treeSchema = schema.nodeSchema.get(nodeKeyTreeIdentifier);
|
|
23
|
-
if (!(treeSchema instanceof LeafNodeSchema)) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
return treeSchema.leafValue === ValueSchema.String;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Search the tree for all nodes with keys, and record them in this index for lookup.
|
|
30
|
-
* This should be called each time the tree changes; each call to scan forgets all existing keys.
|
|
31
|
-
* @param context - the flex tree context in which to search for node keys
|
|
32
|
-
*/
|
|
33
|
-
// TODO: This can be optimized by responding to deltas/changes to the tree, rather than rescanning the whole tree every time
|
|
34
|
-
scanKeys(context) {
|
|
35
|
-
this.nodes.clear();
|
|
36
|
-
if (NodeKeyIndex.hasNodeKeyTreeSchema(context.schema)) {
|
|
37
|
-
for (const [id, node] of this.findKeysInField(context.root)) {
|
|
38
|
-
// TODO:
|
|
39
|
-
// This invariant (that there is only one node with a given key) is not enforced by tree, so it should not assert.
|
|
40
|
-
// Multiple nodes (including deleted ones), might occur with the same key.
|
|
41
|
-
assert(!this.nodes.has(id), 0x6e1 /* Encountered duplicate node key */);
|
|
42
|
-
this.nodes.set(id, node);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Create a copy of this index which can be mutated without affecting this one.
|
|
48
|
-
*/
|
|
49
|
-
clone(context) {
|
|
50
|
-
const indexClone = new NodeKeyIndex(this.fieldKey);
|
|
51
|
-
indexClone.scanKeys(context);
|
|
52
|
-
return indexClone;
|
|
53
|
-
}
|
|
54
|
-
// #region ReadonlyMap interface
|
|
55
|
-
forEach(callbackfn, thisArg) {
|
|
56
|
-
return this.nodes.forEach(callbackfn, thisArg);
|
|
57
|
-
}
|
|
58
|
-
get(key) {
|
|
59
|
-
return this.nodes.get(key);
|
|
60
|
-
}
|
|
61
|
-
has(key) {
|
|
62
|
-
return this.nodes.has(key);
|
|
63
|
-
}
|
|
64
|
-
get size() {
|
|
65
|
-
return this.nodes.size;
|
|
66
|
-
}
|
|
67
|
-
entries() {
|
|
68
|
-
return this.nodes.entries();
|
|
69
|
-
}
|
|
70
|
-
keys() {
|
|
71
|
-
return this.nodes.keys();
|
|
72
|
-
}
|
|
73
|
-
values() {
|
|
74
|
-
return this.nodes.values();
|
|
75
|
-
}
|
|
76
|
-
[Symbol.iterator]() {
|
|
77
|
-
return this.nodes[Symbol.iterator]();
|
|
78
|
-
}
|
|
79
|
-
// #endregion ReadonlyMap interface
|
|
80
|
-
*findKeys(node) {
|
|
81
|
-
if (schemaIsObjectNode(node.schema)) {
|
|
82
|
-
const key = node.localNodeKey;
|
|
83
|
-
if (key !== undefined) {
|
|
84
|
-
yield [key, node];
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
for (const f of node.boxedIterator()) {
|
|
88
|
-
yield* this.findKeysInField(f);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
*findKeysInField(f) {
|
|
92
|
-
for (const child of f.boxedIterator()) {
|
|
93
|
-
yield* this.findKeys(child);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
//# sourceMappingURL=nodeKeyIndex.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeKeyIndex.js","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/nodeKeyIndex.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport { type FieldKey, ValueSchema } from \"../../core/index.js\";\nimport type {\n\tFlexTreeContext,\n\tFlexTreeField,\n\tFlexTreeNode,\n\tFlexTreeObjectNode,\n} from \"../flex-tree/index.js\";\nimport {\n\ttype FlexTreeSchema,\n\tLeafNodeSchema,\n\tschemaIsObjectNode,\n} from \"../typed-schema/index.js\";\n\nimport { type LocalNodeKey, nodeKeyTreeIdentifier } from \"./nodeKey.js\";\n\n/**\n * The node key index records nodes with {@link LocalNodeKey}s and allows them to be looked up by key.\n */\nexport class NodeKeyIndex implements ReadonlyMap<LocalNodeKey, FlexTreeObjectNode> {\n\t// TODO: The data structure that holds the nodes can likely be optimized to better support cloning\n\tprivate readonly nodes: Map<LocalNodeKey, FlexTreeObjectNode>;\n\n\tpublic constructor(\n\t\tpublic readonly fieldKey: FieldKey,\n\t\tkeys: Iterable<[LocalNodeKey, FlexTreeObjectNode]> = [],\n\t) {\n\t\tthis.nodes = new Map(keys);\n\t}\n\n\t/**\n\t * Returns true if the given schema contains the node key type, otherwise false\n\t */\n\tpublic static hasNodeKeyTreeSchema(schema: FlexTreeSchema): boolean {\n\t\t// TODO: make TreeStoredSchema contain ViewSchema and compare by reference to nodeKeyTreeSchema.\n\t\tconst treeSchema = schema.nodeSchema.get(nodeKeyTreeIdentifier);\n\t\tif (!(treeSchema instanceof LeafNodeSchema)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn treeSchema.leafValue === ValueSchema.String;\n\t}\n\n\t/**\n\t * Search the tree for all nodes with keys, and record them in this index for lookup.\n\t * This should be called each time the tree changes; each call to scan forgets all existing keys.\n\t * @param context - the flex tree context in which to search for node keys\n\t */\n\t// TODO: This can be optimized by responding to deltas/changes to the tree, rather than rescanning the whole tree every time\n\tpublic scanKeys(context: FlexTreeContext): void {\n\t\tthis.nodes.clear();\n\t\tif (NodeKeyIndex.hasNodeKeyTreeSchema(context.schema)) {\n\t\t\tfor (const [id, node] of this.findKeysInField(context.root)) {\n\t\t\t\t// TODO:\n\t\t\t\t// This invariant (that there is only one node with a given key) is not enforced by tree, so it should not assert.\n\t\t\t\t// Multiple nodes (including deleted ones), might occur with the same key.\n\t\t\t\tassert(!this.nodes.has(id), 0x6e1 /* Encountered duplicate node key */);\n\t\t\t\tthis.nodes.set(id, node);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Create a copy of this index which can be mutated without affecting this one.\n\t */\n\tpublic clone(context: FlexTreeContext): NodeKeyIndex {\n\t\tconst indexClone = new NodeKeyIndex(this.fieldKey);\n\t\tindexClone.scanKeys(context);\n\t\treturn indexClone;\n\t}\n\n\t// #region ReadonlyMap interface\n\tpublic forEach(\n\t\tcallbackfn: (\n\t\t\tvalue: FlexTreeObjectNode,\n\t\t\tkey: LocalNodeKey,\n\t\t\tmap: ReadonlyMap<LocalNodeKey, FlexTreeObjectNode>,\n\t\t) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\treturn this.nodes.forEach(callbackfn, thisArg);\n\t}\n\tpublic get(key: LocalNodeKey): FlexTreeObjectNode | undefined {\n\t\treturn this.nodes.get(key);\n\t}\n\tpublic has(key: LocalNodeKey): boolean {\n\t\treturn this.nodes.has(key);\n\t}\n\tpublic get size(): number {\n\t\treturn this.nodes.size;\n\t}\n\tpublic entries(): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]> {\n\t\treturn this.nodes.entries();\n\t}\n\tpublic keys(): IterableIterator<LocalNodeKey> {\n\t\treturn this.nodes.keys();\n\t}\n\tpublic values(): IterableIterator<FlexTreeObjectNode> {\n\t\treturn this.nodes.values();\n\t}\n\tpublic [Symbol.iterator](): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]> {\n\t\treturn this.nodes[Symbol.iterator]();\n\t}\n\t// #endregion ReadonlyMap interface\n\n\tprivate *findKeys(\n\t\tnode: FlexTreeNode,\n\t): Iterable<[key: LocalNodeKey, node: FlexTreeObjectNode]> {\n\t\tif (schemaIsObjectNode(node.schema)) {\n\t\t\tconst key = (node as FlexTreeObjectNode).localNodeKey;\n\t\t\tif (key !== undefined) {\n\t\t\t\tyield [key, node as FlexTreeObjectNode];\n\t\t\t}\n\t\t}\n\t\tfor (const f of node.boxedIterator()) {\n\t\t\tyield* this.findKeysInField(f);\n\t\t}\n\t}\n\n\tprivate *findKeysInField(\n\t\tf: FlexTreeField,\n\t): Iterable<[key: LocalNodeKey, node: FlexTreeObjectNode]> {\n\t\tfor (const child of f.boxedIterator()) {\n\t\t\tyield* this.findKeys(child);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
-
|
|
8
|
-
import { type FieldKey, ValueSchema } from "../../core/index.js";
|
|
9
|
-
import type {
|
|
10
|
-
FlexTreeContext,
|
|
11
|
-
FlexTreeField,
|
|
12
|
-
FlexTreeNode,
|
|
13
|
-
FlexTreeObjectNode,
|
|
14
|
-
} from "../flex-tree/index.js";
|
|
15
|
-
import {
|
|
16
|
-
type FlexTreeSchema,
|
|
17
|
-
LeafNodeSchema,
|
|
18
|
-
schemaIsObjectNode,
|
|
19
|
-
} from "../typed-schema/index.js";
|
|
20
|
-
|
|
21
|
-
import { type LocalNodeKey, nodeKeyTreeIdentifier } from "./nodeKey.js";
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* The node key index records nodes with {@link LocalNodeKey}s and allows them to be looked up by key.
|
|
25
|
-
*/
|
|
26
|
-
export class NodeKeyIndex implements ReadonlyMap<LocalNodeKey, FlexTreeObjectNode> {
|
|
27
|
-
// TODO: The data structure that holds the nodes can likely be optimized to better support cloning
|
|
28
|
-
private readonly nodes: Map<LocalNodeKey, FlexTreeObjectNode>;
|
|
29
|
-
|
|
30
|
-
public constructor(
|
|
31
|
-
public readonly fieldKey: FieldKey,
|
|
32
|
-
keys: Iterable<[LocalNodeKey, FlexTreeObjectNode]> = [],
|
|
33
|
-
) {
|
|
34
|
-
this.nodes = new Map(keys);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Returns true if the given schema contains the node key type, otherwise false
|
|
39
|
-
*/
|
|
40
|
-
public static hasNodeKeyTreeSchema(schema: FlexTreeSchema): boolean {
|
|
41
|
-
// TODO: make TreeStoredSchema contain ViewSchema and compare by reference to nodeKeyTreeSchema.
|
|
42
|
-
const treeSchema = schema.nodeSchema.get(nodeKeyTreeIdentifier);
|
|
43
|
-
if (!(treeSchema instanceof LeafNodeSchema)) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
return treeSchema.leafValue === ValueSchema.String;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Search the tree for all nodes with keys, and record them in this index for lookup.
|
|
51
|
-
* This should be called each time the tree changes; each call to scan forgets all existing keys.
|
|
52
|
-
* @param context - the flex tree context in which to search for node keys
|
|
53
|
-
*/
|
|
54
|
-
// TODO: This can be optimized by responding to deltas/changes to the tree, rather than rescanning the whole tree every time
|
|
55
|
-
public scanKeys(context: FlexTreeContext): void {
|
|
56
|
-
this.nodes.clear();
|
|
57
|
-
if (NodeKeyIndex.hasNodeKeyTreeSchema(context.schema)) {
|
|
58
|
-
for (const [id, node] of this.findKeysInField(context.root)) {
|
|
59
|
-
// TODO:
|
|
60
|
-
// This invariant (that there is only one node with a given key) is not enforced by tree, so it should not assert.
|
|
61
|
-
// Multiple nodes (including deleted ones), might occur with the same key.
|
|
62
|
-
assert(!this.nodes.has(id), 0x6e1 /* Encountered duplicate node key */);
|
|
63
|
-
this.nodes.set(id, node);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Create a copy of this index which can be mutated without affecting this one.
|
|
70
|
-
*/
|
|
71
|
-
public clone(context: FlexTreeContext): NodeKeyIndex {
|
|
72
|
-
const indexClone = new NodeKeyIndex(this.fieldKey);
|
|
73
|
-
indexClone.scanKeys(context);
|
|
74
|
-
return indexClone;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// #region ReadonlyMap interface
|
|
78
|
-
public forEach(
|
|
79
|
-
callbackfn: (
|
|
80
|
-
value: FlexTreeObjectNode,
|
|
81
|
-
key: LocalNodeKey,
|
|
82
|
-
map: ReadonlyMap<LocalNodeKey, FlexTreeObjectNode>,
|
|
83
|
-
) => void,
|
|
84
|
-
thisArg?: unknown,
|
|
85
|
-
): void {
|
|
86
|
-
return this.nodes.forEach(callbackfn, thisArg);
|
|
87
|
-
}
|
|
88
|
-
public get(key: LocalNodeKey): FlexTreeObjectNode | undefined {
|
|
89
|
-
return this.nodes.get(key);
|
|
90
|
-
}
|
|
91
|
-
public has(key: LocalNodeKey): boolean {
|
|
92
|
-
return this.nodes.has(key);
|
|
93
|
-
}
|
|
94
|
-
public get size(): number {
|
|
95
|
-
return this.nodes.size;
|
|
96
|
-
}
|
|
97
|
-
public entries(): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]> {
|
|
98
|
-
return this.nodes.entries();
|
|
99
|
-
}
|
|
100
|
-
public keys(): IterableIterator<LocalNodeKey> {
|
|
101
|
-
return this.nodes.keys();
|
|
102
|
-
}
|
|
103
|
-
public values(): IterableIterator<FlexTreeObjectNode> {
|
|
104
|
-
return this.nodes.values();
|
|
105
|
-
}
|
|
106
|
-
public [Symbol.iterator](): IterableIterator<[LocalNodeKey, FlexTreeObjectNode]> {
|
|
107
|
-
return this.nodes[Symbol.iterator]();
|
|
108
|
-
}
|
|
109
|
-
// #endregion ReadonlyMap interface
|
|
110
|
-
|
|
111
|
-
private *findKeys(
|
|
112
|
-
node: FlexTreeNode,
|
|
113
|
-
): Iterable<[key: LocalNodeKey, node: FlexTreeObjectNode]> {
|
|
114
|
-
if (schemaIsObjectNode(node.schema)) {
|
|
115
|
-
const key = (node as FlexTreeObjectNode).localNodeKey;
|
|
116
|
-
if (key !== undefined) {
|
|
117
|
-
yield [key, node as FlexTreeObjectNode];
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
for (const f of node.boxedIterator()) {
|
|
121
|
-
yield* this.findKeysInField(f);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
private *findKeysInField(
|
|
126
|
-
f: FlexTreeField,
|
|
127
|
-
): Iterable<[key: LocalNodeKey, node: FlexTreeObjectNode]> {
|
|
128
|
-
for (const child of f.boxedIterator()) {
|
|
129
|
-
yield* this.findKeys(child);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|