@itwin/presentation-hierarchies 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +96 -0
- package/README.md +44 -47
- package/lib/cjs/hierarchies/HierarchyFiltering.d.ts +64 -0
- package/lib/cjs/hierarchies/HierarchyFiltering.d.ts.map +1 -0
- package/lib/cjs/hierarchies/HierarchyFiltering.js +80 -0
- package/lib/cjs/hierarchies/HierarchyFiltering.js.map +1 -0
- package/lib/cjs/hierarchies/HierarchyNode.d.ts +29 -233
- package/lib/cjs/hierarchies/HierarchyNode.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNode.js +25 -8
- package/lib/cjs/hierarchies/HierarchyNode.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeIdentifier.d.ts +7 -11
- package/lib/cjs/hierarchies/HierarchyNodeIdentifier.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeIdentifier.js +9 -8
- package/lib/cjs/hierarchies/HierarchyNodeIdentifier.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts +31 -6
- package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeKey.js +26 -23
- package/lib/cjs/hierarchies/HierarchyNodeKey.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyProvider.d.ts +24 -89
- package/lib/cjs/hierarchies/HierarchyProvider.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyProvider.js +24 -381
- package/lib/cjs/hierarchies/HierarchyProvider.js.map +1 -1
- package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/FilteringHierarchyDefinition.d.ts +9 -9
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/FilteringHierarchyDefinition.js +35 -73
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/HierarchyCache.d.ts +18 -0
- package/lib/cjs/hierarchies/imodel/HierarchyCache.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{internal/ChildNodeObservablesCache.js → imodel/HierarchyCache.js} +4 -4
- package/lib/cjs/hierarchies/imodel/HierarchyCache.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts +121 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js +21 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.d.ts +234 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.js +29 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts +77 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js +428 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{LimitingECSqlQueryExecutor.js → imodel/LimitingECSqlQueryExecutor.js} +3 -3
- package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.js.map +1 -0
- package/lib/{esm/hierarchies → cjs/hierarchies/imodel}/NodeSelectQueryFactory.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts +140 -0
- package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{HierarchyDefinition.js → imodel/PredicateBasedHierarchyDefinition.js} +26 -36
- package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -0
- package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/TreeNodesReader.d.ts +6 -6
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/TreeNodesReader.js +2 -2
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/Utils.d.ts +4 -0
- package/lib/cjs/hierarchies/imodel/Utils.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/Utils.js +59 -0
- package/lib/cjs/hierarchies/imodel/Utils.js.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/DetermineChildren.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/DetermineChildren.js +3 -3
- package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.js.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/Grouping.d.ts +2 -1
- package/lib/cjs/hierarchies/imodel/operators/Grouping.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/Grouping.js +5 -5
- package/lib/cjs/hierarchies/imodel/operators/Grouping.js.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/HideIfNoChildren.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/HideIfNoChildren.js +5 -5
- package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -0
- package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/operators/HideNodesInHierarchy.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/HideNodesInHierarchy.js +22 -9
- package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/operators/grouping/AutoExpand.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/operators/grouping/AutoExpand.js.map +1 -0
- package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/operators/grouping/BaseClassGrouping.d.ts +2 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -0
- package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/operators/grouping/ClassGrouping.d.ts +2 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.js.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/LabelGrouping.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/LabelGrouping.js +2 -2
- package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.js.map +1 -0
- package/lib/{esm/hierarchies/internal → cjs/hierarchies/imodel}/operators/grouping/PropertiesGrouping.d.ts +2 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -0
- package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/Shared.d.ts +1 -1
- package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.js.map +1 -0
- package/lib/cjs/hierarchies/internal/Common.d.ts +7 -4
- package/lib/cjs/hierarchies/internal/Common.d.ts.map +1 -1
- package/lib/cjs/hierarchies/internal/Common.js +0 -66
- package/lib/cjs/hierarchies/internal/Common.js.map +1 -1
- package/lib/cjs/hierarchies/internal/operators/Sorting.d.ts +3 -2
- package/lib/cjs/hierarchies/internal/operators/Sorting.d.ts.map +1 -1
- package/lib/cjs/hierarchies/internal/operators/Sorting.js.map +1 -1
- package/lib/cjs/presentation-hierarchies.d.ts +10 -6
- package/lib/cjs/presentation-hierarchies.d.ts.map +1 -1
- package/lib/cjs/presentation-hierarchies.js +18 -10
- package/lib/cjs/presentation-hierarchies.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyFiltering.d.ts +64 -0
- package/lib/esm/hierarchies/HierarchyFiltering.d.ts.map +1 -0
- package/lib/esm/hierarchies/HierarchyFiltering.js +76 -0
- package/lib/esm/hierarchies/HierarchyFiltering.js.map +1 -0
- package/lib/esm/hierarchies/HierarchyNode.d.ts +29 -233
- package/lib/esm/hierarchies/HierarchyNode.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNode.js +24 -7
- package/lib/esm/hierarchies/HierarchyNode.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeIdentifier.d.ts +7 -11
- package/lib/esm/hierarchies/HierarchyNodeIdentifier.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeIdentifier.js +9 -8
- package/lib/esm/hierarchies/HierarchyNodeIdentifier.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeKey.d.ts +31 -6
- package/lib/esm/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeKey.js +26 -23
- package/lib/esm/hierarchies/HierarchyNodeKey.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyProvider.d.ts +24 -89
- package/lib/esm/hierarchies/HierarchyProvider.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyProvider.js +25 -382
- package/lib/esm/hierarchies/HierarchyProvider.js.map +1 -1
- package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/FilteringHierarchyDefinition.d.ts +9 -9
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/FilteringHierarchyDefinition.js +36 -74
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -0
- package/lib/esm/hierarchies/imodel/HierarchyCache.d.ts +18 -0
- package/lib/esm/hierarchies/imodel/HierarchyCache.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal/ChildNodeObservablesCache.js → imodel/HierarchyCache.js} +2 -2
- package/lib/esm/hierarchies/imodel/HierarchyCache.js.map +1 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts +121 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.js +18 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyNode.d.ts +234 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyNode.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyNode.js +26 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyNode.js.map +1 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts +77 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js +425 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -0
- package/lib/esm/hierarchies/imodel/LimitingECSqlQueryExecutor.d.ts.map +1 -0
- package/lib/esm/hierarchies/{LimitingECSqlQueryExecutor.js → imodel/LimitingECSqlQueryExecutor.js} +3 -3
- package/lib/esm/hierarchies/imodel/LimitingECSqlQueryExecutor.js.map +1 -0
- package/lib/{cjs/hierarchies → esm/hierarchies/imodel}/NodeSelectQueryFactory.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -0
- package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts +140 -0
- package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -0
- package/lib/esm/hierarchies/{HierarchyDefinition.js → imodel/PredicateBasedHierarchyDefinition.js} +25 -34
- package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -0
- package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/TreeNodesReader.d.ts +6 -6
- package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/TreeNodesReader.js +2 -2
- package/lib/esm/hierarchies/imodel/TreeNodesReader.js.map +1 -0
- package/lib/esm/hierarchies/imodel/Utils.d.ts +4 -0
- package/lib/esm/hierarchies/imodel/Utils.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/Utils.js +56 -0
- package/lib/esm/hierarchies/imodel/Utils.js.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/DetermineChildren.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/operators/DetermineChildren.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/DetermineChildren.js +3 -3
- package/lib/esm/hierarchies/imodel/operators/DetermineChildren.js.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/Grouping.d.ts +2 -1
- package/lib/esm/hierarchies/imodel/operators/Grouping.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/Grouping.js +6 -6
- package/lib/esm/hierarchies/imodel/operators/Grouping.js.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/HideIfNoChildren.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/HideIfNoChildren.js +5 -5
- package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -0
- package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/operators/HideNodesInHierarchy.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/HideNodesInHierarchy.js +22 -9
- package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.js.map +1 -0
- package/lib/esm/hierarchies/imodel/operators/grouping/AutoExpand.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/operators/grouping/AutoExpand.js.map +1 -0
- package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/operators/grouping/BaseClassGrouping.d.ts +2 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -0
- package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/operators/grouping/ClassGrouping.d.ts +2 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -0
- package/lib/esm/hierarchies/imodel/operators/grouping/GroupHiding.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/operators/grouping/GroupHiding.js.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/LabelGrouping.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/LabelGrouping.js +2 -2
- package/lib/esm/hierarchies/imodel/operators/grouping/LabelGrouping.js.map +1 -0
- package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/operators/grouping/PropertiesGrouping.d.ts +2 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/PropertiesGrouping.js +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -0
- package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/Shared.d.ts +1 -1
- package/lib/esm/hierarchies/imodel/operators/grouping/Shared.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/operators/grouping/Shared.js.map +1 -0
- package/lib/esm/hierarchies/internal/Common.d.ts +7 -4
- package/lib/esm/hierarchies/internal/Common.d.ts.map +1 -1
- package/lib/esm/hierarchies/internal/Common.js +0 -65
- package/lib/esm/hierarchies/internal/Common.js.map +1 -1
- package/lib/esm/hierarchies/internal/operators/Sorting.d.ts +3 -2
- package/lib/esm/hierarchies/internal/operators/Sorting.d.ts.map +1 -1
- package/lib/esm/hierarchies/internal/operators/Sorting.js.map +1 -1
- package/lib/esm/presentation-hierarchies.d.ts +10 -6
- package/lib/esm/presentation-hierarchies.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies.js +8 -4
- package/lib/esm/presentation-hierarchies.js.map +1 -1
- package/package.json +3 -2
- package/lib/cjs/hierarchies/HierarchyDefinition.d.ts +0 -251
- package/lib/cjs/hierarchies/HierarchyDefinition.d.ts.map +0 -1
- package/lib/cjs/hierarchies/HierarchyDefinition.js.map +0 -1
- package/lib/cjs/hierarchies/LimitingECSqlQueryExecutor.d.ts.map +0 -1
- package/lib/cjs/hierarchies/LimitingECSqlQueryExecutor.js.map +0 -1
- package/lib/cjs/hierarchies/NodeSelectQueryFactory.d.ts.map +0 -1
- package/lib/cjs/hierarchies/NodeSelectQueryFactory.js.map +0 -1
- package/lib/cjs/hierarchies/internal/ChildNodeObservablesCache.d.ts +0 -40
- package/lib/cjs/hierarchies/internal/ChildNodeObservablesCache.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/ChildNodeObservablesCache.js.map +0 -1
- package/lib/cjs/hierarchies/internal/FilteringHierarchyDefinition.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/FilteringHierarchyDefinition.js.map +0 -1
- package/lib/cjs/hierarchies/internal/TreeNodesReader.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/TreeNodesReader.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/DetermineChildren.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/DetermineChildren.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/Grouping.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/Grouping.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/HideIfNoChildren.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/HideIfNoChildren.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/HideNodesInHierarchy.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/HideNodesInHierarchy.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/AutoExpand.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/AutoExpand.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/BaseClassGrouping.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/BaseClassGrouping.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/ClassGrouping.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/ClassGrouping.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/GroupHiding.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/GroupHiding.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/LabelGrouping.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/LabelGrouping.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/PropertiesGrouping.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/PropertiesGrouping.js.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/Shared.d.ts.map +0 -1
- package/lib/cjs/hierarchies/internal/operators/grouping/Shared.js.map +0 -1
- package/lib/esm/hierarchies/HierarchyDefinition.d.ts +0 -251
- package/lib/esm/hierarchies/HierarchyDefinition.d.ts.map +0 -1
- package/lib/esm/hierarchies/HierarchyDefinition.js.map +0 -1
- package/lib/esm/hierarchies/LimitingECSqlQueryExecutor.d.ts.map +0 -1
- package/lib/esm/hierarchies/LimitingECSqlQueryExecutor.js.map +0 -1
- package/lib/esm/hierarchies/NodeSelectQueryFactory.d.ts.map +0 -1
- package/lib/esm/hierarchies/NodeSelectQueryFactory.js.map +0 -1
- package/lib/esm/hierarchies/internal/ChildNodeObservablesCache.d.ts +0 -40
- package/lib/esm/hierarchies/internal/ChildNodeObservablesCache.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/ChildNodeObservablesCache.js.map +0 -1
- package/lib/esm/hierarchies/internal/FilteringHierarchyDefinition.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/FilteringHierarchyDefinition.js.map +0 -1
- package/lib/esm/hierarchies/internal/TreeNodesReader.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/TreeNodesReader.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/DetermineChildren.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/DetermineChildren.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/Grouping.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/Grouping.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/HideIfNoChildren.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/HideIfNoChildren.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/HideNodesInHierarchy.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/HideNodesInHierarchy.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/AutoExpand.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/AutoExpand.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/BaseClassGrouping.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/BaseClassGrouping.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/ClassGrouping.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/ClassGrouping.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/GroupHiding.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/GroupHiding.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/LabelGrouping.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/LabelGrouping.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/PropertiesGrouping.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/PropertiesGrouping.js.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/Shared.d.ts.map +0 -1
- package/lib/esm/hierarchies/internal/operators/grouping/Shared.js.map +0 -1
- /package/lib/cjs/hierarchies/{LimitingECSqlQueryExecutor.d.ts → imodel/LimitingECSqlQueryExecutor.d.ts} +0 -0
- /package/lib/cjs/hierarchies/{NodeSelectQueryFactory.js → imodel/NodeSelectQueryFactory.js} +0 -0
- /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/AutoExpand.d.ts +0 -0
- /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/AutoExpand.js +0 -0
- /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/BaseClassGrouping.js +0 -0
- /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/ClassGrouping.js +0 -0
- /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/GroupHiding.d.ts +0 -0
- /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/GroupHiding.js +0 -0
- /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/PropertiesGrouping.js +0 -0
- /package/lib/cjs/hierarchies/{internal → imodel}/operators/grouping/Shared.js +0 -0
- /package/lib/esm/hierarchies/{LimitingECSqlQueryExecutor.d.ts → imodel/LimitingECSqlQueryExecutor.d.ts} +0 -0
- /package/lib/esm/hierarchies/{NodeSelectQueryFactory.js → imodel/NodeSelectQueryFactory.js} +0 -0
- /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/AutoExpand.d.ts +0 -0
- /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/AutoExpand.js +0 -0
- /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/BaseClassGrouping.js +0 -0
- /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/ClassGrouping.js +0 -0
- /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/GroupHiding.d.ts +0 -0
- /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/GroupHiding.js +0 -0
- /package/lib/esm/hierarchies/{internal → imodel}/operators/grouping/Shared.js +0 -0
|
@@ -2,395 +2,38 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { createDefaultValueFormatter, formatConcatenatedValue, normalizeFullClassName, } from "@itwin/presentation-shared";
|
|
8
|
-
import { HierarchyNodesDefinition } from "./HierarchyDefinition";
|
|
9
|
-
import { RowsLimitExceededError } from "./HierarchyErrors";
|
|
10
|
-
import { HierarchyNode, } from "./HierarchyNode";
|
|
11
|
-
import { ChildNodeObservablesCache } from "./internal/ChildNodeObservablesCache";
|
|
12
|
-
import { LOGGING_NAMESPACE as BASE_LOGGING_NAMESPACE, LOGGING_NAMESPACE_INTERNAL as BASE_LOGGING_NAMESPACE_INTERNAL, LOGGING_NAMESPACE_PERFORMANCE as BASE_LOGGING_NAMESPACE_PERFORMANCE, createNodeIdentifierForLogging, hasChildren, } from "./internal/Common";
|
|
5
|
+
import { filter, first, from, map, mergeMap, of } from "rxjs";
|
|
6
|
+
import { BeEvent, isIDisposable } from "@itwin/core-bentley";
|
|
13
7
|
import { eachValueFrom } from "./internal/EachValueFrom";
|
|
14
|
-
import { FilteringHierarchyDefinition } from "./internal/FilteringHierarchyDefinition";
|
|
15
|
-
import { doLog, log } from "./internal/LoggingUtils";
|
|
16
|
-
import { createDetermineChildrenOperator } from "./internal/operators/DetermineChildren";
|
|
17
|
-
import { createGroupingOperator } from "./internal/operators/Grouping";
|
|
18
|
-
import { createHideIfNoChildrenOperator } from "./internal/operators/HideIfNoChildren";
|
|
19
|
-
import { createHideNodesInHierarchyOperator } from "./internal/operators/HideNodesInHierarchy";
|
|
20
|
-
import { partition } from "./internal/operators/Partition";
|
|
21
|
-
import { reduceToMergeMapList } from "./internal/operators/ReduceToMergeMap";
|
|
22
|
-
import { shareReplayWithErrors } from "./internal/operators/ShareReplayWithErrors";
|
|
23
8
|
import { sortNodesByLabelOperator } from "./internal/operators/Sorting";
|
|
24
|
-
import { SubscriptionScheduler } from "./internal/SubscriptionScheduler";
|
|
25
|
-
import { readNodes } from "./internal/TreeNodesReader";
|
|
26
|
-
import { NodeSelectClauseColumnNames } from "./NodeSelectQueryFactory";
|
|
27
|
-
const LOGGING_NAMESPACE = `${BASE_LOGGING_NAMESPACE}.Provider`;
|
|
28
|
-
const LOGGING_NAMESPACE_INTERNAL = `${BASE_LOGGING_NAMESPACE_INTERNAL}.Provider`;
|
|
29
|
-
const LOGGING_NAMESPACE_PERFORMANCE = `${BASE_LOGGING_NAMESPACE_PERFORMANCE}.Provider`;
|
|
30
|
-
const DEFAULT_QUERY_CONCURRENCY = 10;
|
|
31
|
-
const DEFAULT_QUERY_CACHE_SIZE = 1;
|
|
32
9
|
/**
|
|
33
|
-
* Creates
|
|
34
|
-
* a hierarchy definition, which defines each hierarchy level through ECSQL queries.
|
|
35
|
-
*
|
|
10
|
+
* Creates a single, merged, hierarchy provider from multiple given providers.
|
|
36
11
|
* @beta
|
|
37
12
|
*/
|
|
38
|
-
export function
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* Hierarchy level definitions factory used by this provider.
|
|
49
|
-
*
|
|
50
|
-
* @note This does not necessarily match the `hierarchyDefinition` passed through props when constructing
|
|
51
|
-
* the provider. For example, it may be a factory that decorates given `hierarchyDefinition` with filtering
|
|
52
|
-
* features.
|
|
53
|
-
*/
|
|
54
|
-
hierarchyDefinition;
|
|
55
|
-
/**
|
|
56
|
-
* A limiting ECSQL query executor used by this provider.
|
|
57
|
-
* @see HierarchyProviderProps.queryExecutor
|
|
58
|
-
*/
|
|
59
|
-
get queryExecutor() {
|
|
60
|
-
return this._imodelAccess;
|
|
61
|
-
}
|
|
62
|
-
constructor(props) {
|
|
63
|
-
this._imodelAccess = props.imodelAccess;
|
|
64
|
-
this.hierarchyDefinition = props.hierarchyDefinition;
|
|
65
|
-
if (props.filtering) {
|
|
66
|
-
const filteringDefinition = new FilteringHierarchyDefinition({
|
|
67
|
-
classHierarchy: this._imodelAccess,
|
|
68
|
-
source: this.hierarchyDefinition,
|
|
69
|
-
nodeIdentifierPaths: props.filtering.paths,
|
|
70
|
-
});
|
|
71
|
-
this.hierarchyDefinition = filteringDefinition;
|
|
72
|
-
}
|
|
73
|
-
this._valuesFormatter = props?.formatter ?? createDefaultValueFormatter();
|
|
74
|
-
this._localizedStrings = { other: "Other", unspecified: "Not specified", ...props?.localizedStrings };
|
|
75
|
-
this._queryScheduler = new SubscriptionScheduler(props.queryConcurrency ?? DEFAULT_QUERY_CONCURRENCY);
|
|
76
|
-
const queryCacheSize = props.queryCacheSize ?? DEFAULT_QUERY_CACHE_SIZE;
|
|
77
|
-
if (queryCacheSize !== 0) {
|
|
78
|
-
this._nodesCache = new ChildNodeObservablesCache({
|
|
79
|
-
// we divide the size by 2, because each variation also counts as a query that we cache
|
|
80
|
-
size: Math.ceil(queryCacheSize / 2),
|
|
81
|
-
variationsCount: 1,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Sets `HierarchyProvider` values formatter that formats nodes' labels. If provided `undefined`, then defaults to the
|
|
87
|
-
* result of `createDefaultValueFormatter` called with default parameters.
|
|
88
|
-
*/
|
|
89
|
-
setFormatter(formatter) {
|
|
90
|
-
this._valuesFormatter = formatter ?? createDefaultValueFormatter();
|
|
91
|
-
}
|
|
92
|
-
onGroupingNodeCreated(groupingNode, props) {
|
|
93
|
-
this._nodesCache?.set({ ...props, parentNode: groupingNode }, { observable: from(groupingNode.children), processingStatus: "pre-processed" });
|
|
94
|
-
}
|
|
95
|
-
createParsedQueryNodesObservable(props) {
|
|
96
|
-
doLog({
|
|
97
|
-
category: LOGGING_NAMESPACE_PERFORMANCE,
|
|
98
|
-
message: /* istanbul ignore next */ () => `Requesting hierarchy level definitions for ${createNodeIdentifierForLogging(props.parentNode)}`,
|
|
99
|
-
});
|
|
100
|
-
// stream hierarchy level definitions
|
|
101
|
-
const definitions = from(defer(async () => this.hierarchyDefinition.defineHierarchyLevel(props))).pipe(mergeAll(), finalize(() => doLog({
|
|
102
|
-
category: LOGGING_NAMESPACE_PERFORMANCE,
|
|
103
|
-
message: /* istanbul ignore next */ () => `Received all hierarchy level definitions for ${createNodeIdentifierForLogging(props.parentNode)}`,
|
|
104
|
-
})));
|
|
105
|
-
// pipe definitions to nodes and put "share replay" on it
|
|
106
|
-
return definitions.pipe(mergeMap((def) => {
|
|
107
|
-
if (HierarchyNodesDefinition.isCustomNode(def)) {
|
|
108
|
-
return of(def.node);
|
|
109
|
-
}
|
|
110
|
-
return this._queryScheduler.scheduleSubscription(of(def.query).pipe(map((query) => filterQueryByInstanceKeys(query, props.filteredInstanceKeys)), mergeMap((query) => readNodes({ queryExecutor: this.queryExecutor, query, limit: props.hierarchyLevelSizeLimit, parser: this.hierarchyDefinition.parseNode }))));
|
|
111
|
-
}), finalize(() => doLog({
|
|
112
|
-
category: LOGGING_NAMESPACE_PERFORMANCE,
|
|
113
|
-
message: /* istanbul ignore next */ () => `Read all child nodes ${createNodeIdentifierForLogging(props.parentNode)}`,
|
|
114
|
-
})), shareReplayWithErrors());
|
|
115
|
-
}
|
|
116
|
-
createInitializedNodesObservable(nodes, parentNode) {
|
|
117
|
-
return nodes.pipe(
|
|
118
|
-
// we're going to be mutating the nodes, but don't want to mutate the original one, so just clone it here once
|
|
119
|
-
map((node) => ({ ...node })),
|
|
120
|
-
// set parent node keys on the parsed node
|
|
121
|
-
map((node) => Object.assign(node, { parentKeys: createParentNodeKeysList(parentNode) })),
|
|
122
|
-
// format `ConcatenatedValue` labels into string labels
|
|
123
|
-
mergeMap(async (node) => applyLabelsFormatting(node, this._valuesFormatter)),
|
|
124
|
-
// we have `ProcessedHierarchyNode` from here
|
|
125
|
-
preProcessNodes(this.hierarchyDefinition), finalize(() => doLog({
|
|
126
|
-
category: LOGGING_NAMESPACE_PERFORMANCE,
|
|
127
|
-
message: /* istanbul ignore next */ () => `Finished initializing child nodes for ${createNodeIdentifierForLogging(parentNode)}`,
|
|
128
|
-
})), shareReplayWithErrors());
|
|
129
|
-
}
|
|
130
|
-
createPreProcessedNodesObservable(queryNodesObservable, props) {
|
|
131
|
-
return this.createInitializedNodesObservable(queryNodesObservable, props.parentNode).pipe(createHideIfNoChildrenOperator((n) => this.getChildNodesObservables({ parentNode: n }).hasNodes), createHideNodesInHierarchyOperator(
|
|
132
|
-
// note: for child nodes created because of hidden parent, we want to use parent's request props (instance filter, limit)
|
|
133
|
-
(n) => this.getChildNodesObservables({ ...props, parentNode: n }).processedNodes, false), finalize(() => doLog({
|
|
134
|
-
category: LOGGING_NAMESPACE_PERFORMANCE,
|
|
135
|
-
message: /* istanbul ignore next */ () => `Finished pre-processing child nodes for ${createNodeIdentifierForLogging(props.parentNode)}`,
|
|
136
|
-
})));
|
|
137
|
-
}
|
|
138
|
-
createProcessedNodesObservable(preprocessedNodesObservable, props) {
|
|
139
|
-
return preprocessedNodesObservable.pipe(createGroupingOperator(this._imodelAccess, props.parentNode, this._valuesFormatter, this._localizedStrings, (gn) => this.onGroupingNodeCreated(gn, props)), finalize(() => doLog({
|
|
140
|
-
category: LOGGING_NAMESPACE_PERFORMANCE,
|
|
141
|
-
message: /* istanbul ignore next */ () => `Finished grouping child nodes for ${createNodeIdentifierForLogging(props.parentNode)}`,
|
|
142
|
-
})));
|
|
143
|
-
}
|
|
144
|
-
createFinalizedNodesObservable(processedNodesObservable, props) {
|
|
145
|
-
return processedNodesObservable.pipe(createDetermineChildrenOperator((n) => this.getChildNodesObservables({ parentNode: n }).hasNodes), postProcessNodes(this.hierarchyDefinition), sortNodesByLabelOperator, map((n) => {
|
|
146
|
-
if (HierarchyNode.isCustom(n) || HierarchyNode.isInstancesNode(n)) {
|
|
147
|
-
delete n.processingParams;
|
|
148
|
-
}
|
|
149
|
-
return Object.assign(n, {
|
|
150
|
-
children: hasChildren(n),
|
|
151
|
-
});
|
|
152
|
-
}), finalize(() => doLog({
|
|
153
|
-
category: LOGGING_NAMESPACE_PERFORMANCE,
|
|
154
|
-
message: /* istanbul ignore next */ () => `Finished finalizing child nodes for ${createNodeIdentifierForLogging(props.parentNode)}`,
|
|
155
|
-
})));
|
|
156
|
-
}
|
|
157
|
-
createHasNodesObservable(preprocessedNodesObservable, possiblyKnownChildrenObservable) {
|
|
158
|
-
const loggingCategory = `${LOGGING_NAMESPACE_INTERNAL}.HasNodes`;
|
|
159
|
-
return concat((possiblyKnownChildrenObservable ?? EMPTY).pipe(filter((n) => hasChildren(n))), preprocessedNodesObservable).pipe(log({ category: loggingCategory, message: /* istanbul ignore next */ (n) => `Node before mapping to 'true': ${createNodeIdentifierForLogging(n)}` }), take(1), map(() => true), defaultIfEmpty(false), catchError((e) => {
|
|
160
|
-
doLog({ category: loggingCategory, message: /* istanbul ignore next */ () => `Error while determining children: ${e.message}` });
|
|
161
|
-
if (e instanceof RowsLimitExceededError) {
|
|
162
|
-
return of(true);
|
|
163
|
-
}
|
|
164
|
-
throw e;
|
|
165
|
-
}), log({ category: loggingCategory, message: /* istanbul ignore next */ (r) => `Result: ${r}` }));
|
|
166
|
-
}
|
|
167
|
-
getCachedObservableEntry(props) {
|
|
168
|
-
const loggingCategory = `${LOGGING_NAMESPACE}.QueryResultsCache`;
|
|
169
|
-
const { parentNode, ...restProps } = props;
|
|
170
|
-
const cached = props.ignoreCache || !this._nodesCache ? undefined : this._nodesCache.get(props);
|
|
171
|
-
if (cached) {
|
|
172
|
-
// istanbul ignore next
|
|
173
|
-
doLog({
|
|
174
|
-
category: loggingCategory,
|
|
175
|
-
message: /* istanbul ignore next */ () => `Found query nodes observable for ${createNodeIdentifierForLogging(parentNode)}`,
|
|
176
|
-
});
|
|
177
|
-
return cached;
|
|
178
|
-
}
|
|
179
|
-
// if we don't find an entry for a grouping node, we load its instances by getting a query and applying
|
|
180
|
-
// a filter based on grouped instance keys
|
|
181
|
-
let filteredInstanceKeys;
|
|
182
|
-
let parentNonGroupingNode;
|
|
183
|
-
if (parentNode) {
|
|
184
|
-
if (HierarchyNode.isGroupingNode(parentNode)) {
|
|
185
|
-
parentNonGroupingNode = parentNode.nonGroupingAncestor;
|
|
186
|
-
filteredInstanceKeys = parentNode.groupedInstanceKeys;
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
// not sure why type checker doesn't pick this up
|
|
190
|
-
assert(HierarchyNode.isCustom(parentNode) || HierarchyNode.isInstancesNode(parentNode));
|
|
191
|
-
parentNonGroupingNode = parentNode;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
const nonGroupingNodeChildrenRequestProps = {
|
|
195
|
-
...restProps,
|
|
196
|
-
parentNode: parentNonGroupingNode,
|
|
197
|
-
...(filteredInstanceKeys ? { filteredInstanceKeys } : undefined),
|
|
198
|
-
};
|
|
199
|
-
const value = { observable: this.createParsedQueryNodesObservable(nonGroupingNodeChildrenRequestProps), processingStatus: "none" };
|
|
200
|
-
this._nodesCache?.set(nonGroupingNodeChildrenRequestProps, value);
|
|
201
|
-
doLog({
|
|
202
|
-
category: loggingCategory,
|
|
203
|
-
message: /* istanbul ignore next */ () => `Saved query nodes observable for ${createNodeIdentifierForLogging(parentNode)}`,
|
|
204
|
-
});
|
|
205
|
-
return value;
|
|
206
|
-
}
|
|
207
|
-
getChildNodesObservables(props) {
|
|
208
|
-
const entry = this.getCachedObservableEntry(props);
|
|
209
|
-
switch (entry.processingStatus) {
|
|
210
|
-
case "none": {
|
|
211
|
-
const pre = this.createPreProcessedNodesObservable(entry.observable, props);
|
|
212
|
-
const post = this.createProcessedNodesObservable(pre, props);
|
|
213
|
-
return {
|
|
214
|
-
processedNodes: post,
|
|
215
|
-
hasNodes: this.createHasNodesObservable(pre, entry.observable),
|
|
216
|
-
finalizedNodes: this.createFinalizedNodesObservable(post, props),
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
case "pre-processed": {
|
|
220
|
-
const post = this.createProcessedNodesObservable(entry.observable, props);
|
|
221
|
-
return {
|
|
222
|
-
processedNodes: post,
|
|
223
|
-
hasNodes: this.createHasNodesObservable(entry.observable),
|
|
224
|
-
finalizedNodes: this.createFinalizedNodesObservable(post, props),
|
|
225
|
-
};
|
|
13
|
+
export function mergeProviders({ providers }) {
|
|
14
|
+
const hierarchyChanged = new BeEvent();
|
|
15
|
+
providers.forEach((p) => {
|
|
16
|
+
p.hierarchyChanged.addListener(() => hierarchyChanged.raiseEvent());
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
hierarchyChanged,
|
|
20
|
+
getNodes: (props) => eachValueFrom(from(providers).pipe(mergeMap((provider) => from(provider.getNodes(props)).pipe(mergeMap((node) => {
|
|
21
|
+
if (node.children) {
|
|
22
|
+
return of(node);
|
|
226
23
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
category: loggingCategory,
|
|
239
|
-
message: /* istanbul ignore next */ () => `Requesting child nodes for ${createNodeIdentifierForLogging(props.parentNode)}`,
|
|
240
|
-
});
|
|
241
|
-
return eachValueFrom(this.getChildNodesObservables(props).finalizedNodes.pipe(tap(() => ++nodesCount), catchError((e) => {
|
|
242
|
-
error = e;
|
|
243
|
-
throw e;
|
|
244
|
-
}), finalize(() => {
|
|
245
|
-
doLog({
|
|
246
|
-
category: loggingCategory,
|
|
247
|
-
message: /* istanbul ignore next */ () => error
|
|
248
|
-
? `Error creating child nodes for ${createNodeIdentifierForLogging(props.parentNode)}: ${error instanceof Error ? error.message : error.toString()}`
|
|
249
|
-
: `Returned ${nodesCount} child nodes for ${createNodeIdentifierForLogging(props.parentNode)} in ${timer.currentSeconds.toFixed(2)} s.`,
|
|
250
|
-
});
|
|
251
|
-
})));
|
|
252
|
-
}
|
|
253
|
-
getNodeInstanceKeysObs(props) {
|
|
254
|
-
const { parentNode, instanceFilter, hierarchyLevelSizeLimit = "unbounded" } = props;
|
|
255
|
-
if (parentNode && HierarchyNode.isGroupingNode(parentNode)) {
|
|
256
|
-
return from(parentNode.groupedInstanceKeys);
|
|
257
|
-
}
|
|
258
|
-
assert(!parentNode || HierarchyNode.isCustom(parentNode) || HierarchyNode.isInstancesNode(parentNode));
|
|
259
|
-
// split the definitions based on whether they're for custom nodes or for instance nodes
|
|
260
|
-
const [customDefs, instanceDefs] = partition(from(this.hierarchyDefinition.defineHierarchyLevel({ parentNode, instanceFilter })).pipe(mergeAll()), HierarchyNodesDefinition.isCustomNode);
|
|
261
|
-
// query instance keys and a flag whether they should be hidden
|
|
262
|
-
const instanceKeys = instanceDefs.pipe(mergeMap((def) => this._queryScheduler.scheduleSubscription(of(def.query).pipe(mergeMap(async (query) => {
|
|
263
|
-
const ecsql = `
|
|
264
|
-
SELECT
|
|
265
|
-
${NodeSelectClauseColumnNames.FullClassName},
|
|
266
|
-
${NodeSelectClauseColumnNames.ECInstanceId},
|
|
267
|
-
${NodeSelectClauseColumnNames.HideNodeInHierarchy}
|
|
268
|
-
FROM (
|
|
269
|
-
${query.ecsql}
|
|
270
|
-
)
|
|
271
|
-
`;
|
|
272
|
-
const reader = this.queryExecutor.createQueryReader({ ...query, ecsql }, { rowFormat: "Indexes", limit: hierarchyLevelSizeLimit });
|
|
273
|
-
return from(reader).pipe(map((row) => ({
|
|
274
|
-
key: {
|
|
275
|
-
className: normalizeFullClassName(row[0]),
|
|
276
|
-
id: row[1],
|
|
277
|
-
},
|
|
278
|
-
hide: !!row[2],
|
|
279
|
-
})));
|
|
280
|
-
}), mergeAll()))));
|
|
281
|
-
// split the instance keys observable based on whether they should be hidden or not
|
|
282
|
-
const [visibleNodeInstanceKeys, hiddenNodeInstanceKeys] = partition(instanceKeys, ({ hide }) => !hide);
|
|
283
|
-
// hidden items' handling:
|
|
284
|
-
// - if a custom node is hidden, we'll want to retrieve instance keys of its children, otherwise we don't care about it,
|
|
285
|
-
// - if an instance key is hidden, we want to create a merged node similar to what we do in `createHideNodesInHierarchyOperator`
|
|
286
|
-
const hiddenParentNodes = merge(customDefs.pipe(mergeMap((def) => (def.node.processingParams?.hideInHierarchy ? this.createInitializedNodesObservable(of(def.node), parentNode) : EMPTY))), hiddenNodeInstanceKeys.pipe(
|
|
287
|
-
// first merge all keys by class
|
|
288
|
-
reduceToMergeMapList(({ key }) => key.className, ({ key }) => key.id),
|
|
289
|
-
// then, for each class, create a temp node
|
|
290
|
-
mergeMap((mergedMap) => [...mergedMap.entries()].map(([className, ids]) => ({
|
|
291
|
-
key: {
|
|
292
|
-
type: "instances",
|
|
293
|
-
instanceKeys: ids.map((id) => ({ className, id })),
|
|
294
|
-
},
|
|
295
|
-
parentKeys: [],
|
|
296
|
-
label: "",
|
|
297
|
-
})))));
|
|
298
|
-
// merge visible instance keys from this level & the ones we get recursively requesting from deeper levels
|
|
299
|
-
return merge(visibleNodeInstanceKeys.pipe(map(({ key }) => key)), hiddenParentNodes.pipe(mergeMap((hiddenNode) => this.getNodeInstanceKeysObs({ parentNode: hiddenNode }))));
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Creates an iterator for all child hierarchy level instance keys, taking into account any hidden hierarchy levels
|
|
303
|
-
* that there may be under the given parent node.
|
|
304
|
-
*/
|
|
305
|
-
getNodeInstanceKeys(props) {
|
|
306
|
-
const loggingCategory = `${LOGGING_NAMESPACE}.GetNodeInstanceKeys`;
|
|
307
|
-
const timer = new StopWatch(undefined, true);
|
|
308
|
-
doLog({
|
|
309
|
-
category: loggingCategory,
|
|
310
|
-
message: /* istanbul ignore next */ () => `Requesting keys for ${createNodeIdentifierForLogging(props.parentNode)}`,
|
|
311
|
-
});
|
|
312
|
-
let error;
|
|
313
|
-
let keysCount = 0;
|
|
314
|
-
return eachValueFrom(this.getNodeInstanceKeysObs(props).pipe(tap(() => ++keysCount), catchError((e) => {
|
|
315
|
-
error = e;
|
|
316
|
-
throw e;
|
|
317
|
-
}), finalize(() => {
|
|
318
|
-
doLog({
|
|
319
|
-
category: loggingCategory,
|
|
320
|
-
message: /* istanbul ignore next */ () => error
|
|
321
|
-
? `Error creating node instance keys for ${createNodeIdentifierForLogging(props.parentNode)}: ${error instanceof Error ? error.message : error.toString()}`
|
|
322
|
-
: `Returned ${keysCount} instance keys for ${createNodeIdentifierForLogging(props.parentNode)} in ${timer.currentSeconds.toFixed(2)} s.`,
|
|
24
|
+
// each provider only considers its own data when determining node's children - in case it says
|
|
25
|
+
// the node has no children, we have to check against the other providers too
|
|
26
|
+
return from(providers).pipe(filter((p) => p !== provider), mergeMap((p) => p.getNodes({ parentNode: node })), map(() => true), first(undefined, false), map((hasChildren) => ({ ...node, children: hasChildren })));
|
|
27
|
+
}))), sortNodesByLabelOperator)),
|
|
28
|
+
getNodeInstanceKeys: (props) => eachValueFrom(from(providers).pipe(mergeMap((p) => p.getNodeInstanceKeys(props)))),
|
|
29
|
+
setFormatter: (formatter) => providers.forEach((p) => p.setFormatter(formatter)),
|
|
30
|
+
setHierarchyFilter: (props) => providers.forEach((p) => p.setHierarchyFilter(props)),
|
|
31
|
+
dispose: () => {
|
|
32
|
+
hierarchyChanged.clear();
|
|
33
|
+
providers.forEach((p) => {
|
|
34
|
+
isIDisposable(p) && p.dispose();
|
|
323
35
|
});
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* A function that should be called when the underlying data source, used by `HierarchyProviderProps.schemaProvider`,
|
|
328
|
-
* `HierarchyProviderProps.queryExecutor` or `HierarchyProviderProps.hierarchyDefinition`, changes.
|
|
329
|
-
*
|
|
330
|
-
* Calling the function invalidates internal caches to make sure fresh data is retrieved on new requests.
|
|
331
|
-
*/
|
|
332
|
-
notifyDataSourceChanged() {
|
|
333
|
-
doLog({
|
|
334
|
-
category: `${LOGGING_NAMESPACE}.Events`,
|
|
335
|
-
message: /* istanbul ignore next */ () => `Data source changed: clear query results cache`,
|
|
336
|
-
});
|
|
337
|
-
this._nodesCache?.clear();
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
function preProcessNodes(hierarchyFactory) {
|
|
341
|
-
return hierarchyFactory.preProcessNode
|
|
342
|
-
? processNodes(hierarchyFactory.preProcessNode.bind(hierarchyFactory))
|
|
343
|
-
: (o) => o;
|
|
344
|
-
}
|
|
345
|
-
function postProcessNodes(hierarchyFactory) {
|
|
346
|
-
return hierarchyFactory.postProcessNode
|
|
347
|
-
? processNodes(hierarchyFactory.postProcessNode.bind(hierarchyFactory))
|
|
348
|
-
: (o) => o;
|
|
349
|
-
}
|
|
350
|
-
function processNodes(processor) {
|
|
351
|
-
return (nodes) => nodes.pipe(mergeMap(processor), filter((n) => !!n));
|
|
352
|
-
}
|
|
353
|
-
async function applyLabelsFormatting(node, valueFormatter) {
|
|
354
|
-
return {
|
|
355
|
-
...node,
|
|
356
|
-
label: await formatConcatenatedValue({
|
|
357
|
-
value: node.label,
|
|
358
|
-
valueFormatter,
|
|
359
|
-
}),
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
function createParentNodeKeysList(parentNode) {
|
|
363
|
-
if (!parentNode) {
|
|
364
|
-
return [];
|
|
365
|
-
}
|
|
366
|
-
return [...parentNode.parentKeys, parentNode.key];
|
|
367
|
-
}
|
|
368
|
-
function filterQueryByInstanceKeys(query, filteredInstanceKeys) {
|
|
369
|
-
if (!filteredInstanceKeys || !filteredInstanceKeys.length) {
|
|
370
|
-
return query;
|
|
371
|
-
}
|
|
372
|
-
const MAX_ALLOWED_BINDINGS = 1000;
|
|
373
|
-
// istanbul ignore else
|
|
374
|
-
if (filteredInstanceKeys.length < MAX_ALLOWED_BINDINGS) {
|
|
375
|
-
return {
|
|
376
|
-
...query,
|
|
377
|
-
ecsql: `
|
|
378
|
-
SELECT *
|
|
379
|
-
FROM (${query.ecsql}) q
|
|
380
|
-
WHERE q.ECInstanceId IN (${filteredInstanceKeys.map(() => "?").join(",")})
|
|
381
|
-
`,
|
|
382
|
-
bindings: [...(query.bindings ?? []), ...filteredInstanceKeys.map((k) => ({ type: "id", value: k.id }))],
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
// istanbul ignore next
|
|
386
|
-
return {
|
|
387
|
-
...query,
|
|
388
|
-
ecsql: `
|
|
389
|
-
SELECT *
|
|
390
|
-
FROM (${query.ecsql}) q
|
|
391
|
-
WHERE InVirtualSet(?, q.ECInstanceId)
|
|
392
|
-
`,
|
|
393
|
-
bindings: [...(query.bindings ?? []), { type: "idset", value: filteredInstanceKeys.map((k) => k.id) }],
|
|
36
|
+
},
|
|
394
37
|
};
|
|
395
38
|
}
|
|
396
39
|
//# sourceMappingURL=HierarchyProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchyProvider.js","sourceR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AAC,GAAG,CAAC,CAAC,CAAC,EAAgB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;SACvH,CAAC;IACJ,CAAC;IACD,uBAAuB;IACvB,OAAO;QACL,GAAG,KAAK;QACR,KAAK,EAAE;;cAEG,KAAK,CAAC,KAAK;;KAEpB;QACD,QAAQ,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;KACvG,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport {\n catchError,\n concat,\n defaultIfEmpty,\n defer,\n EMPTY,\n filter,\n finalize,\n from,\n map,\n merge,\n mergeAll,\n mergeMap,\n Observable,\n ObservableInput,\n of,\n take,\n tap,\n} from \"rxjs\";\nimport { assert, StopWatch } from \"@itwin/core-bentley\";\nimport { GenericInstanceFilter } from \"@itwin/core-common\";\nimport {\n ConcatenatedValue,\n createDefaultValueFormatter,\n ECClassHierarchyInspector,\n ECSchemaProvider,\n ECSqlBinding,\n ECSqlQueryDef,\n formatConcatenatedValue,\n InstanceKey,\n IPrimitiveValueFormatter,\n normalizeFullClassName,\n} from \"@itwin/presentation-shared\";\nimport { DefineHierarchyLevelProps, HierarchyDefinition, HierarchyNodesDefinition } from \"./HierarchyDefinition\";\nimport { RowsLimitExceededError } from \"./HierarchyErrors\";\nimport {\n HierarchyNode,\n NonGroupingHierarchyNode,\n ParentHierarchyNode,\n ParsedHierarchyNode,\n ProcessedCustomHierarchyNode,\n ProcessedGroupingHierarchyNode,\n ProcessedHierarchyNode,\n ProcessedInstanceHierarchyNode,\n} from \"./HierarchyNode\";\nimport { HierarchyNodeIdentifiersPath } from \"./HierarchyNodeIdentifier\";\nimport { GroupingNodeKey, InstancesNodeKey } from \"./HierarchyNodeKey\";\nimport { CachedNodesObservableEntry, ChildNodeObservablesCache, ParsedQueryNodesObservable } from \"./internal/ChildNodeObservablesCache\";\nimport {\n LOGGING_NAMESPACE as BASE_LOGGING_NAMESPACE,\n LOGGING_NAMESPACE_INTERNAL as BASE_LOGGING_NAMESPACE_INTERNAL,\n LOGGING_NAMESPACE_PERFORMANCE as BASE_LOGGING_NAMESPACE_PERFORMANCE,\n createNodeIdentifierForLogging,\n hasChildren,\n} from \"./internal/Common\";\nimport { eachValueFrom } from \"./internal/EachValueFrom\";\nimport { FilteringHierarchyDefinition } from \"./internal/FilteringHierarchyDefinition\";\nimport { doLog, log } from \"./internal/LoggingUtils\";\nimport { createDetermineChildrenOperator } from \"./internal/operators/DetermineChildren\";\nimport { createGroupingOperator } from \"./internal/operators/Grouping\";\nimport { createHideIfNoChildrenOperator } from \"./internal/operators/HideIfNoChildren\";\nimport { createHideNodesInHierarchyOperator } from \"./internal/operators/HideNodesInHierarchy\";\nimport { partition } from \"./internal/operators/Partition\";\nimport { reduceToMergeMapList } from \"./internal/operators/ReduceToMergeMap\";\nimport { shareReplayWithErrors } from \"./internal/operators/ShareReplayWithErrors\";\nimport { sortNodesByLabelOperator } from \"./internal/operators/Sorting\";\nimport { SubscriptionScheduler } from \"./internal/SubscriptionScheduler\";\nimport { readNodes } from \"./internal/TreeNodesReader\";\nimport { LimitingECSqlQueryExecutor } from \"./LimitingECSqlQueryExecutor\";\nimport { NodeSelectClauseColumnNames } from \"./NodeSelectQueryFactory\";\n\nconst LOGGING_NAMESPACE = `${BASE_LOGGING_NAMESPACE}.Provider`;\nconst LOGGING_NAMESPACE_INTERNAL = `${BASE_LOGGING_NAMESPACE_INTERNAL}.Provider`;\nconst LOGGING_NAMESPACE_PERFORMANCE = `${BASE_LOGGING_NAMESPACE_PERFORMANCE}.Provider`;\n\nconst DEFAULT_QUERY_CONCURRENCY = 10;\nconst DEFAULT_QUERY_CACHE_SIZE = 1;\n\n/**\n * Props for the `HierarchyProvider.getNodes` call.\n * @beta\n */\nexport interface GetHierarchyNodesProps {\n /** Parent node to get children for. Pass `undefined` to get root nodes. */\n parentNode: ParentHierarchyNode | undefined;\n\n /** Optional hierarchy level filter. Has no effect if `parentNode` is a `GroupingNode`. */\n instanceFilter?: GenericInstanceFilter;\n\n /**\n * Optional hierarchy level size limit override. This value is passed to `LimitingECSqlQueryExecutor` used\n * by this provider to override query rows limit per hierarchy level. If not provided, defaults to whatever\n * is used by the limiting query executor.\n *\n * Has no effect if `parentNode` is a `GroupingNode`.\n */\n hierarchyLevelSizeLimit?: number | \"unbounded\";\n\n /** When set to true ignores the cache and fetches the nodes again. */\n ignoreCache?: boolean;\n}\n\n/**\n * An interface for a hierarchy provider knows how to create child nodes for a given parent node.\n * @beta\n */\nexport interface HierarchyProvider {\n /** Gets nodes for the specified parent node. */\n getNodes(props: GetHierarchyNodesProps): AsyncIterableIterator<HierarchyNode>;\n\n /** Gets instance keys for the specified parent node. */\n getNodeInstanceKeys(props: Omit<GetHierarchyNodesProps, \"ignoreCache\">): AsyncIterableIterator<InstanceKey>;\n\n /** Notifies the provider that the underlying data source has changed and caches should be invalidated. */\n notifyDataSourceChanged(): void;\n\n /**\n * Overrides the property value formatter used by the hierarchy provider. Setting to `undefined`\n * resets the formatter to the result of `createDefaultValueFormatter` called with default parameters.\n */\n setFormatter(formatter: IPrimitiveValueFormatter | undefined): void;\n}\n\n/**\n * Defines the strings used by hierarchy provider.\n * @beta\n */\ninterface HierarchyProviderLocalizedStrings {\n /**\n * A string for \"Unspecified\". Used for labels of property grouping nodes\n * that group by an empty value.\n */\n unspecified: string;\n\n /**\n * A string for \"Other\". Used for label of a range property grouping node that\n * groups values which don't fit into any other range.\n */\n other: string;\n}\n\n/** @beta */\nexport interface FilterTargetGroupingNodeInfo {\n /** Key of the grouping node. */\n key: GroupingNodeKey;\n\n /**\n * Depth of the grouping node in the hierarchy.\n * Generally, it can be retrieved from `parentKeys.length`.\n */\n depth: number;\n}\n\n/** @beta */\nexport interface HierarchyFilteringPathOptions {\n /**\n * This option specifies the way `autoExpand` flag should be assigned to nodes in the filtered hierarchy.\n * - If it's `false` or `undefined`, nodes have no 'autoExpand' flag.\n * - If it's `true`, then all nodes up to the filter target will have `autoExpand` flag.\n * - If it's an instance of `FilterTargetGroupingNodeInfo`, then all nodes up to the grouping node that matches this property,\n * will have `autoExpand` flag.\n */\n autoExpand?: boolean | FilterTargetGroupingNodeInfo;\n}\n\n/**\n * A path of hierarchy node identifiers for filtering the hierarchy with additional options.\n * @beta\n */\nexport type HierarchyFilteringPath = HierarchyNodeIdentifiersPath | { path: HierarchyNodeIdentifiersPath; options: HierarchyFilteringPathOptions };\n\n/**\n * Props for `createHierarchyProvider`.\n * @beta\n */\ninterface HierarchyProviderProps {\n /**\n * An object that provides access to iModel's data and metadata.\n *\n * @see `ECSchemaProvider`\n * @see `LimitingECSqlQueryExecutor`\n * @see `ECClassHierarchyInspector`\n */\n imodelAccess: ECSchemaProvider & LimitingECSqlQueryExecutor & ECClassHierarchyInspector;\n\n /**\n * A function that returns a hierarchy definition, describing how the hierarchy that the provider should be create. The\n * function is called once during the provider's construction.\n */\n hierarchyDefinition: HierarchyDefinition;\n\n /** Maximum number of queries that the provider attempts to execute in parallel. Defaults to `10`. */\n queryConcurrency?: number;\n /**\n * The amount of queries whose results are stored in-memory for quick retrieval. Defaults to `1`,\n * which means only results of the last run query are cached.\n */\n queryCacheSize?: number;\n\n /**\n * A values formatter for formatting node labels. Defaults to the\n * result of `createDefaultValueFormatter` called with default parameters.\n */\n formatter?: IPrimitiveValueFormatter;\n\n /** A set of localized strings to use. Defaults to English strings. */\n localizedStrings?: Partial<HierarchyProviderLocalizedStrings>;\n\n /** Props for filtering the hierarchy. */\n filtering?: {\n /** A list of node identifiers from root to target node. */\n paths: HierarchyFilteringPath[];\n };\n}\n\n/**\n * Creates an instance of `HierarchyProvider` that creates a hierarchy based on given iModel and\n * a hierarchy definition, which defines each hierarchy level through ECSQL queries.\n *\n * @beta\n */\nexport function createHierarchyProvider(props: HierarchyProviderProps): HierarchyProvider {\n return new HierarchyProviderImpl(props);\n}\n\nclass HierarchyProviderImpl implements HierarchyProvider {\n private _imodelAccess: ECSchemaProvider & LimitingECSqlQueryExecutor & ECClassHierarchyInspector;\n private _valuesFormatter: IPrimitiveValueFormatter;\n private _localizedStrings: HierarchyProviderLocalizedStrings;\n private _queryScheduler: SubscriptionScheduler;\n private _nodesCache?: ChildNodeObservablesCache;\n\n /**\n * Hierarchy level definitions factory used by this provider.\n *\n * @note This does not necessarily match the `hierarchyDefinition` passed through props when constructing\n * the provider. For example, it may be a factory that decorates given `hierarchyDefinition` with filtering\n * features.\n */\n public readonly hierarchyDefinition: HierarchyDefinition;\n\n /**\n * A limiting ECSQL query executor used by this provider.\n * @see HierarchyProviderProps.queryExecutor\n */\n public get queryExecutor(): LimitingECSqlQueryExecutor {\n return this._imodelAccess;\n }\n\n public constructor(props: HierarchyProviderProps) {\n this._imodelAccess = props.imodelAccess;\n this.hierarchyDefinition = props.hierarchyDefinition;\n if (props.filtering) {\n const filteringDefinition = new FilteringHierarchyDefinition({\n classHierarchy: this._imodelAccess,\n source: this.hierarchyDefinition,\n nodeIdentifierPaths: props.filtering.paths,\n });\n this.hierarchyDefinition = filteringDefinition;\n }\n this._valuesFormatter = props?.formatter ?? createDefaultValueFormatter();\n this._localizedStrings = { other: \"Other\", unspecified: \"Not specified\", ...props?.localizedStrings };\n this._queryScheduler = new SubscriptionScheduler(props.queryConcurrency ?? DEFAULT_QUERY_CONCURRENCY);\n\n const queryCacheSize = props.queryCacheSize ?? DEFAULT_QUERY_CACHE_SIZE;\n if (queryCacheSize !== 0) {\n this._nodesCache = new ChildNodeObservablesCache({\n // we divide the size by 2, because each variation also counts as a query that we cache\n size: Math.ceil(queryCacheSize / 2),\n variationsCount: 1,\n });\n }\n }\n\n /**\n * Sets `HierarchyProvider` values formatter that formats nodes' labels. If provided `undefined`, then defaults to the\n * result of `createDefaultValueFormatter` called with default parameters.\n */\n public setFormatter(formatter: IPrimitiveValueFormatter | undefined) {\n this._valuesFormatter = formatter ?? createDefaultValueFormatter();\n }\n\n private onGroupingNodeCreated(groupingNode: ProcessedGroupingHierarchyNode, props: GetHierarchyNodesProps) {\n this._nodesCache?.set({ ...props, parentNode: groupingNode }, { observable: from(groupingNode.children), processingStatus: \"pre-processed\" });\n }\n\n private createParsedQueryNodesObservable(\n props: DefineHierarchyLevelProps & { hierarchyLevelSizeLimit?: number | \"unbounded\"; filteredInstanceKeys?: InstanceKey[] },\n ): ParsedQueryNodesObservable {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* istanbul ignore next */ () => `Requesting hierarchy level definitions for ${createNodeIdentifierForLogging(props.parentNode)}`,\n });\n // stream hierarchy level definitions\n const definitions = from(defer(async () => this.hierarchyDefinition.defineHierarchyLevel(props))).pipe(\n mergeAll(),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* istanbul ignore next */ () => `Received all hierarchy level definitions for ${createNodeIdentifierForLogging(props.parentNode)}`,\n }),\n ),\n );\n // pipe definitions to nodes and put \"share replay\" on it\n return definitions.pipe(\n mergeMap((def): ObservableInput<ParsedHierarchyNode> => {\n if (HierarchyNodesDefinition.isCustomNode(def)) {\n return of(def.node);\n }\n return this._queryScheduler.scheduleSubscription(\n of(def.query).pipe(\n map((query) => filterQueryByInstanceKeys(query, props.filteredInstanceKeys)),\n mergeMap((query) =>\n readNodes({ queryExecutor: this.queryExecutor, query, limit: props.hierarchyLevelSizeLimit, parser: this.hierarchyDefinition.parseNode }),\n ),\n ),\n );\n }),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* istanbul ignore next */ () => `Read all child nodes ${createNodeIdentifierForLogging(props.parentNode)}`,\n }),\n ),\n shareReplayWithErrors(),\n );\n }\n\n private createInitializedNodesObservable(nodes: Observable<ParsedHierarchyNode>, parentNode: ParentHierarchyNode | undefined) {\n return nodes.pipe(\n // we're going to be mutating the nodes, but don't want to mutate the original one, so just clone it here once\n map((node) => ({ ...node })),\n // set parent node keys on the parsed node\n map((node) => Object.assign(node, { parentKeys: createParentNodeKeysList(parentNode) })),\n // format `ConcatenatedValue` labels into string labels\n mergeMap(async (node) => applyLabelsFormatting(node, this._valuesFormatter)),\n // we have `ProcessedHierarchyNode` from here\n preProcessNodes(this.hierarchyDefinition),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* istanbul ignore next */ () => `Finished initializing child nodes for ${createNodeIdentifierForLogging(parentNode)}`,\n }),\n ),\n shareReplayWithErrors(),\n );\n }\n\n private createPreProcessedNodesObservable(\n queryNodesObservable: ParsedQueryNodesObservable,\n props: GetHierarchyNodesProps,\n ): Observable<ProcessedHierarchyNode> {\n return this.createInitializedNodesObservable(queryNodesObservable, props.parentNode).pipe(\n createHideIfNoChildrenOperator((n) => this.getChildNodesObservables({ parentNode: n }).hasNodes),\n createHideNodesInHierarchyOperator(\n // note: for child nodes created because of hidden parent, we want to use parent's request props (instance filter, limit)\n (n) => this.getChildNodesObservables({ ...props, parentNode: n }).processedNodes,\n false,\n ),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* istanbul ignore next */ () => `Finished pre-processing child nodes for ${createNodeIdentifierForLogging(props.parentNode)}`,\n }),\n ),\n );\n }\n\n private createProcessedNodesObservable(\n preprocessedNodesObservable: Observable<ProcessedHierarchyNode>,\n props: GetHierarchyNodesProps,\n ): Observable<ProcessedHierarchyNode> {\n return preprocessedNodesObservable.pipe(\n createGroupingOperator(this._imodelAccess, props.parentNode, this._valuesFormatter, this._localizedStrings, (gn) =>\n this.onGroupingNodeCreated(gn, props),\n ),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* istanbul ignore next */ () => `Finished grouping child nodes for ${createNodeIdentifierForLogging(props.parentNode)}`,\n }),\n ),\n );\n }\n\n private createFinalizedNodesObservable(\n processedNodesObservable: Observable<ProcessedHierarchyNode>,\n props: GetHierarchyNodesProps,\n ): Observable<HierarchyNode> {\n return processedNodesObservable.pipe(\n createDetermineChildrenOperator((n) => this.getChildNodesObservables({ parentNode: n }).hasNodes),\n postProcessNodes(this.hierarchyDefinition),\n sortNodesByLabelOperator,\n map((n): HierarchyNode => {\n if (HierarchyNode.isCustom(n) || HierarchyNode.isInstancesNode(n)) {\n delete n.processingParams;\n }\n return Object.assign(n, {\n children: hasChildren(n),\n });\n }),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* istanbul ignore next */ () => `Finished finalizing child nodes for ${createNodeIdentifierForLogging(props.parentNode)}`,\n }),\n ),\n );\n }\n\n private createHasNodesObservable(\n preprocessedNodesObservable: Observable<ProcessedHierarchyNode>,\n possiblyKnownChildrenObservable?: ParsedQueryNodesObservable,\n ): Observable<boolean> {\n const loggingCategory = `${LOGGING_NAMESPACE_INTERNAL}.HasNodes`;\n return concat((possiblyKnownChildrenObservable ?? EMPTY).pipe(filter((n) => hasChildren(n))), preprocessedNodesObservable).pipe(\n log({ category: loggingCategory, message: /* istanbul ignore next */ (n) => `Node before mapping to 'true': ${createNodeIdentifierForLogging(n)}` }),\n take(1),\n map(() => true),\n defaultIfEmpty(false),\n catchError((e: Error) => {\n doLog({ category: loggingCategory, message: /* istanbul ignore next */ () => `Error while determining children: ${e.message}` });\n if (e instanceof RowsLimitExceededError) {\n return of(true);\n }\n throw e;\n }),\n log({ category: loggingCategory, message: /* istanbul ignore next */ (r) => `Result: ${r}` }),\n );\n }\n\n private getCachedObservableEntry(props: GetHierarchyNodesProps): CachedNodesObservableEntry {\n const loggingCategory = `${LOGGING_NAMESPACE}.QueryResultsCache`;\n const { parentNode, ...restProps } = props;\n const cached = props.ignoreCache || !this._nodesCache ? undefined : this._nodesCache.get(props);\n if (cached) {\n // istanbul ignore next\n doLog({\n category: loggingCategory,\n message: /* istanbul ignore next */ () => `Found query nodes observable for ${createNodeIdentifierForLogging(parentNode)}`,\n });\n return cached;\n }\n\n // if we don't find an entry for a grouping node, we load its instances by getting a query and applying\n // a filter based on grouped instance keys\n let filteredInstanceKeys: InstanceKey[] | undefined;\n let parentNonGroupingNode: ParentHierarchyNode<NonGroupingHierarchyNode> | undefined;\n if (parentNode) {\n if (HierarchyNode.isGroupingNode(parentNode)) {\n parentNonGroupingNode = parentNode.nonGroupingAncestor;\n filteredInstanceKeys = parentNode.groupedInstanceKeys;\n } else {\n // not sure why type checker doesn't pick this up\n assert(HierarchyNode.isCustom(parentNode) || HierarchyNode.isInstancesNode(parentNode));\n parentNonGroupingNode = parentNode;\n }\n }\n\n const nonGroupingNodeChildrenRequestProps = {\n ...restProps,\n parentNode: parentNonGroupingNode,\n ...(filteredInstanceKeys ? { filteredInstanceKeys } : undefined),\n };\n const value = { observable: this.createParsedQueryNodesObservable(nonGroupingNodeChildrenRequestProps), processingStatus: \"none\" as const };\n this._nodesCache?.set(nonGroupingNodeChildrenRequestProps, value);\n doLog({\n category: loggingCategory,\n message: /* istanbul ignore next */ () => `Saved query nodes observable for ${createNodeIdentifierForLogging(parentNode)}`,\n });\n return value;\n }\n\n private getChildNodesObservables(props: GetHierarchyNodesProps & { hierarchyLevelSizeLimit?: number | \"unbounded\" }) {\n const entry = this.getCachedObservableEntry(props);\n switch (entry.processingStatus) {\n case \"none\": {\n const pre = this.createPreProcessedNodesObservable(entry.observable, props);\n const post = this.createProcessedNodesObservable(pre, props);\n return {\n processedNodes: post,\n hasNodes: this.createHasNodesObservable(pre, entry.observable),\n finalizedNodes: this.createFinalizedNodesObservable(post, props),\n };\n }\n case \"pre-processed\": {\n const post = this.createProcessedNodesObservable(entry.observable, props);\n return {\n processedNodes: post,\n hasNodes: this.createHasNodesObservable(entry.observable),\n finalizedNodes: this.createFinalizedNodesObservable(post, props),\n };\n }\n }\n }\n\n /**\n * Creates and runs a query based on provided props, then processes retrieved nodes and returns them.\n */\n public getNodes(props: GetHierarchyNodesProps): AsyncIterableIterator<HierarchyNode> {\n const loggingCategory = `${LOGGING_NAMESPACE}.GetNodes`;\n const timer = new StopWatch(undefined, true);\n let error: any;\n let nodesCount = 0;\n doLog({\n category: loggingCategory,\n message: /* istanbul ignore next */ () => `Requesting child nodes for ${createNodeIdentifierForLogging(props.parentNode)}`,\n });\n return eachValueFrom(\n this.getChildNodesObservables(props).finalizedNodes.pipe(\n tap(() => ++nodesCount),\n catchError((e) => {\n error = e;\n throw e;\n }),\n finalize(() => {\n doLog({\n category: loggingCategory,\n message: /* istanbul ignore next */ () =>\n error\n ? `Error creating child nodes for ${createNodeIdentifierForLogging(props.parentNode)}: ${error instanceof Error ? error.message : error.toString()}`\n : `Returned ${nodesCount} child nodes for ${createNodeIdentifierForLogging(props.parentNode)} in ${timer.currentSeconds.toFixed(2)} s.`,\n });\n }),\n ),\n );\n }\n\n private getNodeInstanceKeysObs(props: Omit<GetHierarchyNodesProps, \"ignoreCache\">): Observable<InstanceKey> {\n const { parentNode, instanceFilter, hierarchyLevelSizeLimit = \"unbounded\" } = props;\n\n if (parentNode && HierarchyNode.isGroupingNode(parentNode)) {\n return from(parentNode.groupedInstanceKeys);\n }\n\n assert(!parentNode || HierarchyNode.isCustom(parentNode) || HierarchyNode.isInstancesNode(parentNode));\n\n // split the definitions based on whether they're for custom nodes or for instance nodes\n const [customDefs, instanceDefs] = partition(\n from(this.hierarchyDefinition.defineHierarchyLevel({ parentNode, instanceFilter })).pipe(mergeAll()),\n HierarchyNodesDefinition.isCustomNode,\n );\n\n // query instance keys and a flag whether they should be hidden\n const instanceKeys = instanceDefs.pipe(\n mergeMap((def) =>\n this._queryScheduler.scheduleSubscription(\n of(def.query).pipe(\n mergeMap(async (query) => {\n const ecsql = `\n SELECT\n ${NodeSelectClauseColumnNames.FullClassName},\n ${NodeSelectClauseColumnNames.ECInstanceId},\n ${NodeSelectClauseColumnNames.HideNodeInHierarchy}\n FROM (\n ${query.ecsql}\n )\n `;\n const reader = this.queryExecutor.createQueryReader({ ...query, ecsql }, { rowFormat: \"Indexes\", limit: hierarchyLevelSizeLimit });\n return from(reader).pipe(\n map((row) => ({\n key: {\n className: normalizeFullClassName(row[0]),\n id: row[1],\n },\n hide: !!row[2],\n })),\n );\n }),\n mergeAll(),\n ),\n ),\n ),\n );\n // split the instance keys observable based on whether they should be hidden or not\n const [visibleNodeInstanceKeys, hiddenNodeInstanceKeys] = partition(instanceKeys, ({ hide }) => !hide);\n\n // hidden items' handling:\n // - if a custom node is hidden, we'll want to retrieve instance keys of its children, otherwise we don't care about it,\n // - if an instance key is hidden, we want to create a merged node similar to what we do in `createHideNodesInHierarchyOperator`\n const hiddenParentNodes = merge(\n customDefs.pipe(\n mergeMap((def) => (def.node.processingParams?.hideInHierarchy ? this.createInitializedNodesObservable(of(def.node), parentNode) : EMPTY)),\n ),\n hiddenNodeInstanceKeys.pipe(\n // first merge all keys by class\n reduceToMergeMapList(\n ({ key }) => key.className,\n ({ key }) => key.id,\n ),\n // then, for each class, create a temp node\n mergeMap(\n (mergedMap): Array<ParentHierarchyNode & { key: InstancesNodeKey }> =>\n [...mergedMap.entries()].map(([className, ids]) => ({\n key: {\n type: \"instances\",\n instanceKeys: ids.map((id) => ({ className, id })),\n },\n parentKeys: [],\n label: \"\",\n })),\n ),\n ),\n );\n\n // merge visible instance keys from this level & the ones we get recursively requesting from deeper levels\n return merge(\n visibleNodeInstanceKeys.pipe(map(({ key }) => key)),\n hiddenParentNodes.pipe(mergeMap((hiddenNode) => this.getNodeInstanceKeysObs({ parentNode: hiddenNode }))),\n );\n }\n\n /**\n * Creates an iterator for all child hierarchy level instance keys, taking into account any hidden hierarchy levels\n * that there may be under the given parent node.\n */\n public getNodeInstanceKeys(props: Omit<GetHierarchyNodesProps, \"ignoreCache\">): AsyncIterableIterator<InstanceKey> {\n const loggingCategory = `${LOGGING_NAMESPACE}.GetNodeInstanceKeys`;\n const timer = new StopWatch(undefined, true);\n doLog({\n category: loggingCategory,\n message: /* istanbul ignore next */ () => `Requesting keys for ${createNodeIdentifierForLogging(props.parentNode)}`,\n });\n let error: any;\n let keysCount = 0;\n return eachValueFrom(\n this.getNodeInstanceKeysObs(props).pipe(\n tap(() => ++keysCount),\n catchError((e) => {\n error = e;\n throw e;\n }),\n finalize(() => {\n doLog({\n category: loggingCategory,\n message: /* istanbul ignore next */ () =>\n error\n ? `Error creating node instance keys for ${createNodeIdentifierForLogging(props.parentNode)}: ${error instanceof Error ? error.message : error.toString()}`\n : `Returned ${keysCount} instance keys for ${createNodeIdentifierForLogging(props.parentNode)} in ${timer.currentSeconds.toFixed(2)} s.`,\n });\n }),\n ),\n );\n }\n\n /**\n * A function that should be called when the underlying data source, used by `HierarchyProviderProps.schemaProvider`,\n * `HierarchyProviderProps.queryExecutor` or `HierarchyProviderProps.hierarchyDefinition`, changes.\n *\n * Calling the function invalidates internal caches to make sure fresh data is retrieved on new requests.\n */\n public notifyDataSourceChanged() {\n doLog({\n category: `${LOGGING_NAMESPACE}.Events`,\n message: /* istanbul ignore next */ () => `Data source changed: clear query results cache`,\n });\n this._nodesCache?.clear();\n }\n}\n\nfunction preProcessNodes(hierarchyFactory: HierarchyDefinition) {\n return hierarchyFactory.preProcessNode\n ? processNodes(hierarchyFactory.preProcessNode.bind(hierarchyFactory))\n : (o: Observable<ProcessedCustomHierarchyNode | ProcessedInstanceHierarchyNode>) => o;\n}\n\nfunction postProcessNodes(hierarchyFactory: HierarchyDefinition) {\n return hierarchyFactory.postProcessNode\n ? processNodes(hierarchyFactory.postProcessNode.bind(hierarchyFactory))\n : (o: Observable<ProcessedHierarchyNode>) => o;\n}\n\nfunction processNodes<TNode>(processor: (node: TNode) => Promise<TNode | undefined>) {\n return (nodes: Observable<TNode>) =>\n nodes.pipe(\n mergeMap(processor),\n filter((n): n is TNode => !!n),\n );\n}\n\nasync function applyLabelsFormatting<TNode extends { label: string | ConcatenatedValue }>(\n node: TNode,\n valueFormatter: IPrimitiveValueFormatter,\n): Promise<TNode & { label: string }> {\n return {\n ...node,\n label: await formatConcatenatedValue({\n value: node.label,\n valueFormatter,\n }),\n };\n}\n\nfunction createParentNodeKeysList(parentNode: ParentHierarchyNode | undefined) {\n if (!parentNode) {\n return [];\n }\n return [...parentNode.parentKeys, parentNode.key];\n}\n\nfunction filterQueryByInstanceKeys(query: ECSqlQueryDef, filteredInstanceKeys: InstanceKey[] | undefined): ECSqlQueryDef {\n if (!filteredInstanceKeys || !filteredInstanceKeys.length) {\n return query;\n }\n const MAX_ALLOWED_BINDINGS = 1000;\n // istanbul ignore else\n if (filteredInstanceKeys.length < MAX_ALLOWED_BINDINGS) {\n return {\n ...query,\n ecsql: `\n SELECT *\n FROM (${query.ecsql}) q\n WHERE q.ECInstanceId IN (${filteredInstanceKeys.map(() => \"?\").join(\",\")})\n `,\n bindings: [...(query.bindings ?? []), ...filteredInstanceKeys.map((k): ECSqlBinding => ({ type: \"id\", value: k.id }))],\n };\n }\n // istanbul ignore next\n return {\n ...query,\n ecsql: `\n SELECT *\n FROM (${query.ecsql}) q\n WHERE InVirtualSet(?, q.ECInstanceId)\n `,\n bindings: [...(query.bindings ?? []), { type: \"idset\", value: filteredInstanceKeys.map((k) => k.id) }],\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"HierarchyProvider.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAK7D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACz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CACH,CACF,EACD,wBAAwB,CAEzB,CACF;QACH,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAClH,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAChF,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACpF,OAAO,EAAE,GAAG,EAAE;YACZ,gBAAgB,CAAC,KAAK,EAAE,CAAC;YACzB,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBACtB,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;YAClC,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { filter, first, from, map, mergeMap, of } from \"rxjs\";\nimport { BeEvent, isIDisposable } from \"@itwin/core-bentley\";\nimport { GenericInstanceFilter } from \"@itwin/core-common\";\nimport { Event, InstanceKey, IPrimitiveValueFormatter } from \"@itwin/presentation-shared\";\nimport { HierarchyFilteringPath } from \"./HierarchyFiltering\";\nimport { HierarchyNode, ParentHierarchyNode } from \"./HierarchyNode\";\nimport { eachValueFrom } from \"./internal/EachValueFrom\";\nimport { sortNodesByLabelOperator } from \"./internal/operators/Sorting\";\n\n/**\n * Props for the `HierarchyProvider.getNodes` call.\n * @beta\n */\nexport interface GetHierarchyNodesProps {\n /** Parent node to get children for. Pass `undefined` to get root nodes. */\n parentNode: ParentHierarchyNode | undefined;\n\n /** Optional hierarchy level filter. Has no effect if `parentNode` is a `GroupingNode`. */\n instanceFilter?: GenericInstanceFilter;\n\n /**\n * Optional hierarchy level size limit override. This value is passed to `LimitingECSqlQueryExecutor` used\n * by this provider to override query rows limit per hierarchy level. If not provided, defaults to whatever\n * is used by the limiting query executor.\n *\n * Has no effect if `parentNode` is a `GroupingNode`.\n */\n hierarchyLevelSizeLimit?: number | \"unbounded\";\n\n /** When set to true ignores the cache and fetches the nodes again. */\n ignoreCache?: boolean;\n}\n\n/**\n * An interface for a hierarchy provider that knows how to create child nodes for a given parent node.\n * @beta\n */\nexport interface HierarchyProvider {\n /**\n * An event that provider raises when the internal data source changes, resulting in a\n * hierarchy change.\n *\n * Consumers are expected to subscribe to this event and reload the hierarchy when it's raised.\n */\n readonly hierarchyChanged: Event<() => void>;\n\n /** Gets nodes for the specified parent node. */\n getNodes(props: GetHierarchyNodesProps): AsyncIterableIterator<HierarchyNode>;\n\n /** Gets instance keys for the specified parent node. */\n getNodeInstanceKeys(props: Omit<GetHierarchyNodesProps, \"ignoreCache\">): AsyncIterableIterator<InstanceKey>;\n\n /**\n * Overrides the property value formatter used by the hierarchy provider. Setting to `undefined`\n * resets the formatter to the result of `createDefaultValueFormatter` called with default parameters.\n */\n setFormatter(formatter: IPrimitiveValueFormatter | undefined): void;\n\n /**\n * Sets the hierarchy filter used by this hierarchy provider. Setting to `undefined`\n * removes the filter.\n */\n setHierarchyFilter(\n props:\n | {\n /** A list of node identifiers from root to target node. */\n paths: HierarchyFilteringPath[];\n }\n | undefined,\n ): void;\n}\n\n/**\n * Props for `mergeProviders` function.\n * @beta\n */\ninterface MergeHierarchyProvidersProps {\n /** List of providers to merge. */\n providers: HierarchyProvider[];\n}\n\n/**\n * Creates a single, merged, hierarchy provider from multiple given providers.\n * @beta\n */\nexport function mergeProviders({ providers }: MergeHierarchyProvidersProps): HierarchyProvider & { dispose: () => void } {\n const hierarchyChanged = new BeEvent<() => void>();\n providers.forEach((p) => {\n p.hierarchyChanged.addListener(() => hierarchyChanged.raiseEvent());\n });\n\n return {\n hierarchyChanged,\n getNodes: (props) =>\n eachValueFrom(\n from(providers).pipe(\n mergeMap((provider) =>\n from(provider.getNodes(props)).pipe(\n mergeMap((node) => {\n if (node.children) {\n return of(node);\n }\n // each provider only considers its own data when determining node's children - in case it says\n // the node has no children, we have to check against the other providers too\n return from(providers).pipe(\n filter((p) => p !== provider),\n mergeMap((p) => p.getNodes({ parentNode: node })),\n map(() => true),\n first(undefined, false),\n map((hasChildren) => ({ ...node, children: hasChildren })),\n );\n }),\n ),\n ),\n sortNodesByLabelOperator,\n // TODO: consider merging similar nodes\n ),\n ),\n getNodeInstanceKeys: (props) => eachValueFrom(from(providers).pipe(mergeMap((p) => p.getNodeInstanceKeys(props)))),\n setFormatter: (formatter) => providers.forEach((p) => p.setFormatter(formatter)),\n setHierarchyFilter: (props) => providers.forEach((p) => p.setHierarchyFilter(props)),\n dispose: () => {\n hierarchyChanged.clear();\n providers.forEach((p) => {\n isIDisposable(p) && p.dispose();\n });\n },\n };\n}\n"]}
|
package/lib/{cjs/hierarchies/internal → esm/hierarchies/imodel}/FilteringHierarchyDefinition.d.ts
RENAMED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { ECClassHierarchyInspector, InstanceKey } from "@itwin/presentation-shared";
|
|
2
|
-
import {
|
|
2
|
+
import { HierarchyFilteringPath, HierarchyFilteringPathOptions } from "../HierarchyFiltering";
|
|
3
3
|
import { HierarchyNodeIdentifier } from "../HierarchyNodeIdentifier";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { DefineHierarchyLevelProps, HierarchyDefinition, HierarchyLevelDefinition, InstanceNodesQueryDefinition, NodeParser, NodePostProcessor, NodePreProcessor } from "./IModelHierarchyDefinition";
|
|
5
|
+
interface FilteringHierarchyDefinitionProps {
|
|
6
|
+
imodelAccess: ECClassHierarchyInspector & {
|
|
7
|
+
imodelKey: string;
|
|
8
|
+
};
|
|
8
9
|
source: HierarchyDefinition;
|
|
9
10
|
nodeIdentifierPaths: HierarchyFilteringPath[];
|
|
10
11
|
}
|
|
11
12
|
/** @internal */
|
|
12
13
|
export declare class FilteringHierarchyDefinition implements HierarchyDefinition {
|
|
13
|
-
private
|
|
14
|
+
private _imodelAccess;
|
|
14
15
|
private _source;
|
|
15
16
|
private _nodeIdentifierPaths;
|
|
16
|
-
constructor(props:
|
|
17
|
+
constructor(props: FilteringHierarchyDefinitionProps);
|
|
17
18
|
get preProcessNode(): NodePreProcessor;
|
|
18
19
|
private shouldExpandGroupingNode;
|
|
19
20
|
get postProcessNode(): NodePostProcessor;
|
|
20
21
|
get parseNode(): NodeParser;
|
|
21
22
|
defineHierarchyLevel(props: DefineHierarchyLevelProps): Promise<HierarchyLevelDefinition>;
|
|
22
|
-
private getFilteringProps;
|
|
23
23
|
}
|
|
24
24
|
type MatchedFilter<TIdentifier extends HierarchyNodeIdentifier> = {
|
|
25
25
|
id: TIdentifier;
|
|
@@ -39,6 +39,6 @@ export declare const ECSQL_COLUMN_NAME_FilterTargetOptions = "FilterTargetOption
|
|
|
39
39
|
/** @internal */
|
|
40
40
|
export declare const ECSQL_COLUMN_NAME_HasFilterTargetAncestor = "HasFilterTargetAncestor";
|
|
41
41
|
/** @internal */
|
|
42
|
-
export declare function applyECInstanceIdsFilter(def: InstanceNodesQueryDefinition, matchingFilters: Array<MatchedFilter<InstanceKey>>,
|
|
42
|
+
export declare function applyECInstanceIdsFilter(def: InstanceNodesQueryDefinition, matchingFilters: Array<MatchedFilter<InstanceKey>>, hasFilterTargetAncestor: boolean): InstanceNodesQueryDefinition;
|
|
43
43
|
export {};
|
|
44
44
|
//# sourceMappingURL=FilteringHierarchyDefinition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilteringHierarchyDefinition.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/FilteringHierarchyDefinition.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAyB,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAErH,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,EACL,yBAAyB,EAEzB,mBAAmB,EACnB,wBAAwB,EAExB,4BAA4B,EAC5B,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,6BAA6B,CAAC;AAIrC,UAAU,iCAAiC;IACzC,YAAY,EAAE,yBAAyB,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAChE,MAAM,EAAE,mBAAmB,CAAC;IAC5B,mBAAmB,EAAE,sBAAsB,EAAE,CAAC;CAC/C;AAED,gBAAgB;AAChB,qBAAa,4BAA6B,YAAW,mBAAmB;IACtE,OAAO,CAAC,aAAa,CAAoD;IACzE,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,oBAAoB,CAA2B;gBAEpC,KAAK,EAAE,iCAAiC;IAM3D,IAAW,cAAc,IAAI,gBAAgB,CAS5C;IAED,OAAO,CAAC,wBAAwB;IA2ChC,IAAW,eAAe,IAAI,iBAAiB,CAS9C;IAED,IAAW,SAAS,IAAI,UAAU,CAmBjC;IAEY,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,wBAAwB,CAAC;CA6DvG;AAED,KAAK,aAAa,CAAC,WAAW,SAAS,uBAAuB,IAAI;IAChE,EAAE,EAAE,WAAW,CAAC;IAChB,uBAAuB,EAAE,sBAAsB,EAAE,CAAC;CACnD,GAAG,CAAC;IAAE,cAAc,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,cAAc,EAAE,IA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