@itwin/presentation-hierarchies 2.0.0-alpha.13 → 2.0.0-alpha.15

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.
Files changed (190) hide show
  1. package/CHANGELOG.md +132 -4
  2. package/README.md +19 -18
  3. package/lib/cjs/hierarchies/HierarchyMerge.d.ts +1 -1
  4. package/lib/cjs/hierarchies/HierarchyMerge.d.ts.map +1 -1
  5. package/lib/cjs/hierarchies/HierarchyMerge.js +1 -1
  6. package/lib/cjs/hierarchies/HierarchyMerge.js.map +1 -1
  7. package/lib/cjs/hierarchies/HierarchyNode.d.ts.map +1 -1
  8. package/lib/cjs/hierarchies/HierarchyNode.js.map +1 -1
  9. package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
  10. package/lib/cjs/hierarchies/HierarchyNodeKey.js.map +1 -1
  11. package/lib/cjs/hierarchies/HierarchyProvider.d.ts.map +1 -1
  12. package/lib/cjs/hierarchies/HierarchyProvider.js +7 -3
  13. package/lib/cjs/hierarchies/HierarchyProvider.js.map +1 -1
  14. package/lib/cjs/hierarchies/HierarchySearch.d.ts +24 -2
  15. package/lib/cjs/hierarchies/HierarchySearch.d.ts.map +1 -1
  16. package/lib/cjs/hierarchies/HierarchySearch.js +33 -16
  17. package/lib/cjs/hierarchies/HierarchySearch.js.map +1 -1
  18. package/lib/cjs/hierarchies/Logging.js +1 -1
  19. package/lib/cjs/hierarchies/Logging.js.map +1 -1
  20. package/lib/cjs/hierarchies/imodel/HierarchyCache.d.ts.map +1 -1
  21. package/lib/cjs/hierarchies/imodel/HierarchyCache.js +1 -4
  22. package/lib/cjs/hierarchies/imodel/HierarchyCache.js.map +1 -1
  23. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts +35 -2
  24. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -1
  25. package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
  26. package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.d.ts.map +1 -1
  27. package/lib/cjs/hierarchies/imodel/IModelHierarchyNode.js.map +1 -1
  28. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
  29. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js +144 -78
  30. package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
  31. package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.d.ts.map +1 -1
  32. package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.js +6 -7
  33. package/lib/cjs/hierarchies/imodel/LimitingECSqlQueryExecutor.js.map +1 -1
  34. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -1
  35. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js +33 -62
  36. package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
  37. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -1
  38. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.js +2 -1
  39. package/lib/cjs/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -1
  40. package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.d.ts.map +1 -1
  41. package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.js +11 -4
  42. package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.js.map +1 -1
  43. package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -1
  44. package/lib/cjs/hierarchies/imodel/TreeNodesReader.js +3 -5
  45. package/lib/cjs/hierarchies/imodel/TreeNodesReader.js.map +1 -1
  46. package/lib/cjs/hierarchies/imodel/Utils.d.ts.map +1 -1
  47. package/lib/cjs/hierarchies/imodel/Utils.js +19 -7
  48. package/lib/cjs/hierarchies/imodel/Utils.js.map +1 -1
  49. package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.d.ts.map +1 -1
  50. package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.js +10 -4
  51. package/lib/cjs/hierarchies/imodel/operators/DetermineChildren.js.map +1 -1
  52. package/lib/cjs/hierarchies/imodel/operators/Grouping.d.ts.map +1 -1
  53. package/lib/cjs/hierarchies/imodel/operators/Grouping.js +32 -18
  54. package/lib/cjs/hierarchies/imodel/operators/Grouping.js.map +1 -1
  55. package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -1
  56. package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.js +31 -9
  57. package/lib/cjs/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -1
  58. package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts.map +1 -1
  59. package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.js +30 -14
  60. package/lib/cjs/hierarchies/imodel/operators/HideNodesInHierarchy.js.map +1 -1
  61. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +1 -1
  62. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.js +4 -6
  63. package/lib/cjs/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -1
  64. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -1
  65. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js +4 -9
  66. package/lib/cjs/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -1
  67. package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.d.ts.map +1 -1
  68. package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.js +1 -5
  69. package/lib/cjs/hierarchies/imodel/operators/grouping/GroupHiding.js.map +1 -1
  70. package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts.map +1 -1
  71. package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.js +2 -10
  72. package/lib/cjs/hierarchies/imodel/operators/grouping/LabelGrouping.js.map +1 -1
  73. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -1
  74. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.js +24 -28
  75. package/lib/cjs/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -1
  76. package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.d.ts.map +1 -1
  77. package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.js +3 -1
  78. package/lib/cjs/hierarchies/imodel/operators/grouping/Shared.js.map +1 -1
  79. package/lib/cjs/hierarchies/internal/Common.d.ts.map +1 -1
  80. package/lib/cjs/hierarchies/internal/Common.js +2 -2
  81. package/lib/cjs/hierarchies/internal/Common.js.map +1 -1
  82. package/lib/cjs/hierarchies/internal/EachValueFrom.d.ts.map +1 -1
  83. package/lib/cjs/hierarchies/internal/EachValueFrom.js +0 -2
  84. package/lib/cjs/hierarchies/internal/EachValueFrom.js.map +1 -1
  85. package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.d.ts.map +1 -1
  86. package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.js +3 -1
  87. package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.js.map +1 -1
  88. package/lib/cjs/hierarchies/internal/SubscriptionScheduler.d.ts.map +1 -1
  89. package/lib/cjs/hierarchies/internal/SubscriptionScheduler.js +1 -4
  90. package/lib/cjs/hierarchies/internal/SubscriptionScheduler.js.map +1 -1
  91. package/lib/cjs/hierarchies/internal/operators/Partition.d.ts.map +1 -1
  92. package/lib/cjs/hierarchies/internal/operators/Partition.js.map +1 -1
  93. package/lib/cjs/presentation-hierarchies.d.ts +3 -3
  94. package/lib/cjs/presentation-hierarchies.d.ts.map +1 -1
  95. package/lib/cjs/presentation-hierarchies.js.map +1 -1
  96. package/lib/esm/hierarchies/HierarchyMerge.d.ts +1 -1
  97. package/lib/esm/hierarchies/HierarchyMerge.d.ts.map +1 -1
  98. package/lib/esm/hierarchies/HierarchyMerge.js +1 -1
  99. package/lib/esm/hierarchies/HierarchyMerge.js.map +1 -1
  100. package/lib/esm/hierarchies/HierarchyNode.d.ts.map +1 -1
  101. package/lib/esm/hierarchies/HierarchyNode.js.map +1 -1
  102. package/lib/esm/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
  103. package/lib/esm/hierarchies/HierarchyNodeKey.js.map +1 -1
  104. package/lib/esm/hierarchies/HierarchyProvider.d.ts.map +1 -1
  105. package/lib/esm/hierarchies/HierarchyProvider.js +7 -3
  106. package/lib/esm/hierarchies/HierarchyProvider.js.map +1 -1
  107. package/lib/esm/hierarchies/HierarchySearch.d.ts +24 -2
  108. package/lib/esm/hierarchies/HierarchySearch.d.ts.map +1 -1
  109. package/lib/esm/hierarchies/HierarchySearch.js +33 -16
  110. package/lib/esm/hierarchies/HierarchySearch.js.map +1 -1
  111. package/lib/esm/hierarchies/Logging.js +1 -1
  112. package/lib/esm/hierarchies/Logging.js.map +1 -1
  113. package/lib/esm/hierarchies/imodel/HierarchyCache.d.ts.map +1 -1
  114. package/lib/esm/hierarchies/imodel/HierarchyCache.js +1 -4
  115. package/lib/esm/hierarchies/imodel/HierarchyCache.js.map +1 -1
  116. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts +35 -2
  117. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -1
  118. package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
  119. package/lib/esm/hierarchies/imodel/IModelHierarchyNode.d.ts.map +1 -1
  120. package/lib/esm/hierarchies/imodel/IModelHierarchyNode.js.map +1 -1
  121. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
  122. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js +147 -81
  123. package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
  124. package/lib/esm/hierarchies/imodel/LimitingECSqlQueryExecutor.d.ts.map +1 -1
  125. package/lib/esm/hierarchies/imodel/LimitingECSqlQueryExecutor.js +7 -8
  126. package/lib/esm/hierarchies/imodel/LimitingECSqlQueryExecutor.js.map +1 -1
  127. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts.map +1 -1
  128. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js +34 -63
  129. package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
  130. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.d.ts.map +1 -1
  131. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.js +2 -1
  132. package/lib/esm/hierarchies/imodel/PredicateBasedHierarchyDefinition.js.map +1 -1
  133. package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.d.ts.map +1 -1
  134. package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.js +11 -4
  135. package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.js.map +1 -1
  136. package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -1
  137. package/lib/esm/hierarchies/imodel/TreeNodesReader.js +3 -5
  138. package/lib/esm/hierarchies/imodel/TreeNodesReader.js.map +1 -1
  139. package/lib/esm/hierarchies/imodel/Utils.d.ts.map +1 -1
  140. package/lib/esm/hierarchies/imodel/Utils.js +19 -7
  141. package/lib/esm/hierarchies/imodel/Utils.js.map +1 -1
  142. package/lib/esm/hierarchies/imodel/operators/DetermineChildren.d.ts.map +1 -1
  143. package/lib/esm/hierarchies/imodel/operators/DetermineChildren.js +11 -5
  144. package/lib/esm/hierarchies/imodel/operators/DetermineChildren.js.map +1 -1
  145. package/lib/esm/hierarchies/imodel/operators/Grouping.d.ts.map +1 -1
  146. package/lib/esm/hierarchies/imodel/operators/Grouping.js +33 -19
  147. package/lib/esm/hierarchies/imodel/operators/Grouping.js.map +1 -1
  148. package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.d.ts.map +1 -1
  149. package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.js +32 -10
  150. package/lib/esm/hierarchies/imodel/operators/HideIfNoChildren.js.map +1 -1
  151. package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.d.ts.map +1 -1
  152. package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.js +31 -15
  153. package/lib/esm/hierarchies/imodel/operators/HideNodesInHierarchy.js.map +1 -1
  154. package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.d.ts.map +1 -1
  155. package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.js +5 -7
  156. package/lib/esm/hierarchies/imodel/operators/grouping/BaseClassGrouping.js.map +1 -1
  157. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.d.ts.map +1 -1
  158. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.js +5 -10
  159. package/lib/esm/hierarchies/imodel/operators/grouping/ClassGrouping.js.map +1 -1
  160. package/lib/esm/hierarchies/imodel/operators/grouping/GroupHiding.d.ts.map +1 -1
  161. package/lib/esm/hierarchies/imodel/operators/grouping/GroupHiding.js +1 -5
  162. package/lib/esm/hierarchies/imodel/operators/grouping/GroupHiding.js.map +1 -1
  163. package/lib/esm/hierarchies/imodel/operators/grouping/LabelGrouping.d.ts.map +1 -1
  164. package/lib/esm/hierarchies/imodel/operators/grouping/LabelGrouping.js +2 -10
  165. package/lib/esm/hierarchies/imodel/operators/grouping/LabelGrouping.js.map +1 -1
  166. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.d.ts.map +1 -1
  167. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.js +24 -28
  168. package/lib/esm/hierarchies/imodel/operators/grouping/PropertiesGrouping.js.map +1 -1
  169. package/lib/esm/hierarchies/imodel/operators/grouping/Shared.d.ts.map +1 -1
  170. package/lib/esm/hierarchies/imodel/operators/grouping/Shared.js +3 -1
  171. package/lib/esm/hierarchies/imodel/operators/grouping/Shared.js.map +1 -1
  172. package/lib/esm/hierarchies/internal/Common.d.ts.map +1 -1
  173. package/lib/esm/hierarchies/internal/Common.js +2 -2
  174. package/lib/esm/hierarchies/internal/Common.js.map +1 -1
  175. package/lib/esm/hierarchies/internal/EachValueFrom.d.ts.map +1 -1
  176. package/lib/esm/hierarchies/internal/EachValueFrom.js +0 -2
  177. package/lib/esm/hierarchies/internal/EachValueFrom.js.map +1 -1
  178. package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.d.ts.map +1 -1
  179. package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.js +3 -1
  180. package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.js.map +1 -1
  181. package/lib/esm/hierarchies/internal/SubscriptionScheduler.d.ts.map +1 -1
  182. package/lib/esm/hierarchies/internal/SubscriptionScheduler.js +1 -4
  183. package/lib/esm/hierarchies/internal/SubscriptionScheduler.js.map +1 -1
  184. package/lib/esm/hierarchies/internal/operators/Partition.d.ts.map +1 -1
  185. package/lib/esm/hierarchies/internal/operators/Partition.js.map +1 -1
  186. package/lib/esm/presentation-hierarchies.d.ts +3 -3
  187. package/lib/esm/presentation-hierarchies.d.ts.map +1 -1
  188. package/lib/esm/presentation-hierarchies.js +3 -3
  189. package/lib/esm/presentation-hierarchies.js.map +1 -1
  190. package/package.json +15 -23
@@ -2,7 +2,7 @@
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 { concat, concatAll, delay, EMPTY, expand, finalize, from, last, map, merge, mergeMap, of, reduce, tap, toArray } from "rxjs";
5
+ import { concat, concatAll, delay, EMPTY, expand, finalize, from, last, map, merge, mergeMap, of, reduce, tap, toArray, } from "rxjs";
6
6
  import { assert, StopWatch } from "@itwin/core-bentley";
7
7
  import { HierarchyNode } from "../../HierarchyNode.js";
8
8
  import { LOGGING_NAMESPACE_PERFORMANCE as BASE_LOGGING_NAMESPACE_PERFORMANCE, LOGGING_NAMESPACE_PERFORMANCE_INTERNAL as BASE_LOGGING_NAMESPACE_PERFORMANCE_INTERNAL, createNodeIdentifierForLogging, createOperatorLoggingNamespace, LOGGING_NAMESPACE_INTERNAL, } from "../../internal/Common.js";
@@ -23,10 +23,13 @@ const LOGGING_NAMESPACE_PERFORMANCE_INTERNAL = createOperatorLoggingNamespace(OP
23
23
  /** @internal */
24
24
  export function createGroupingOperator(imodelAccess, parentNode, valueFormatter, localizedStrings, onNodesGrouped, onGroupingNodeCreated, groupingHandlers) {
25
25
  return function (nodes) {
26
- return nodes.pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }), tapOnce(() => {
26
+ return nodes.pipe(
27
+ /* v8 ignore next -- @preserve */
28
+ log({ category: LOGGING_NAMESPACE, message: (n) => `in: ${createNodeIdentifierForLogging(n)}` }), tapOnce(() => {
29
+ /* v8 ignore next -- @preserve */
27
30
  doLog({
28
31
  category: LOGGING_NAMESPACE_PERFORMANCE,
29
- message: /* c8 ignore next */ () => `Starting grouping (parent: ${createNodeIdentifierForLogging(parentNode)})`,
32
+ message: () => `Starting grouping (parent: ${createNodeIdentifierForLogging(parentNode)})`,
30
33
  });
31
34
  }), reduce((resolvedNodes, node) => {
32
35
  if (HierarchyNode.isInstancesNode(node)) {
@@ -37,27 +40,30 @@ export function createGroupingOperator(imodelAccess, parentNode, valueFormatter,
37
40
  }
38
41
  return resolvedNodes;
39
42
  }, { instanceNodes: [], restNodes: [] }), tap(({ instanceNodes, restNodes }) => {
43
+ /* v8 ignore next -- @preserve */
40
44
  doLog({
41
45
  category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,
42
- message: /* c8 ignore next */ () => `Nodes partitioned. Got ${instanceNodes.length} instance nodes and ${restNodes.length} rest nodes.`,
46
+ message: () => `Nodes partitioned. Got ${instanceNodes.length} instance nodes and ${restNodes.length} rest nodes.`,
43
47
  });
44
48
  }), mergeMap((res) => {
45
49
  const out = of(res);
46
50
  const totalNodes = res.instanceNodes.length + res.restNodes.length;
47
- /* c8 ignore next */
48
- return totalNodes <= 1000 ? out : out.pipe(delay(0));
51
+ return totalNodes <= 1000 ? out : /* v8 ignore next -- @preserve */ out.pipe(delay(0));
49
52
  }), mergeMap(({ instanceNodes, restNodes }) => {
50
53
  const timer = new StopWatch(undefined, true);
51
54
  const groupingHandlersObs = groupingHandlers
52
55
  ? from(groupingHandlers)
53
56
  : createGroupingHandlers(imodelAccess, parentNode, instanceNodes, valueFormatter, localizedStrings);
54
57
  return merge(groupingHandlersObs.pipe(toArray(), mergeMap((createdGroupingHandlers) => groupInstanceNodes(instanceNodes, restNodes.length, createdGroupingHandlers, parentNode, onNodesGrouped, onGroupingNodeCreated)), finalize(() => {
58
+ /* v8 ignore next -- @preserve */
55
59
  doLog({
56
60
  category: LOGGING_NAMESPACE_PERFORMANCE,
57
- message: /* c8 ignore next */ () => `Grouping ${instanceNodes.length} nodes took ${timer.elapsedSeconds.toFixed(3)} s`,
61
+ message: () => `Grouping ${instanceNodes.length} nodes took ${timer.elapsedSeconds.toFixed(3)} s`,
58
62
  });
59
63
  })), from(restNodes));
60
- }), releaseMainThreadOnItemsCount(500), log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }));
64
+ }), releaseMainThreadOnItemsCount(500),
65
+ /* v8 ignore next -- @preserve */
66
+ log({ category: LOGGING_NAMESPACE, message: (n) => `out: ${createNodeIdentifierForLogging(n)}` }));
61
67
  };
62
68
  }
63
69
  function groupInstanceNodes(nodes, extraSiblings, groupingHandlers, parentNode, onNodesGrouped, onGroupingNodeCreated) {
@@ -70,9 +76,11 @@ function groupInstanceNodes(nodes, extraSiblings, groupingHandlers, parentNode,
70
76
  }
71
77
  const timer = new StopWatch(undefined, true);
72
78
  const currentHandler = groupingHandlers[handlerIndex];
73
- return from(currentHandler(curr?.ungrouped ?? nodes, curr?.grouped ?? [])).pipe(log({
79
+ return from(currentHandler(curr?.ungrouped ?? nodes, curr?.grouped ?? [])).pipe(
80
+ /* v8 ignore next -- @preserve */
81
+ log({
74
82
  category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,
75
- message: /* c8 ignore next */ () => `Grouping handler ${handlerIndex} exclusively took ${timer.elapsedSeconds.toFixed(3)} s.`,
83
+ message: () => `Grouping handler ${handlerIndex} exclusively took ${timer.elapsedSeconds.toFixed(3)} s.`,
76
84
  }), tap((result) => {
77
85
  onNodesGrouped?.(result, currentHandler);
78
86
  }), mergeMap((result) => {
@@ -80,13 +88,20 @@ function groupInstanceNodes(nodes, extraSiblings, groupingHandlers, parentNode,
80
88
  return of({ handlerIndex: handlerIndex + 1, result: { ...result, grouped: curr?.grouped ?? [] } });
81
89
  }
82
90
  const groupingPostProcessingTimer = new StopWatch(undefined, true);
83
- return of(result).pipe(map((r) => applyGroupHidingParams(r, extraSiblings)), map((r) => assignAutoExpand(r)), map((r) => ({ handlerIndex: handlerIndex + 1, result: { ...r, grouped: mergeInPlace(curr?.grouped, r.grouped) } })), log({
91
+ return of(result).pipe(map((r) => applyGroupHidingParams(r, extraSiblings)), map((r) => assignAutoExpand(r)), map((r) => ({
92
+ handlerIndex: handlerIndex + 1,
93
+ result: { ...r, grouped: mergeInPlace(curr?.grouped, r.grouped) },
94
+ })),
95
+ /* v8 ignore next -- @preserve */
96
+ log({
84
97
  category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,
85
- message: /* c8 ignore next */ () => `Post-processing grouping handler ${handlerIndex} exclusively took ${groupingPostProcessingTimer.elapsedSeconds.toFixed(3)} s.`,
98
+ message: () => `Post-processing grouping handler ${handlerIndex} exclusively took ${groupingPostProcessingTimer.elapsedSeconds.toFixed(3)} s.`,
86
99
  }), delay(0));
87
- }), log({
100
+ }),
101
+ /* v8 ignore next -- @preserve */
102
+ log({
88
103
  category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,
89
- message: /* c8 ignore next */ () => `Total time for grouping handler ${handlerIndex}: ${timer.elapsedSeconds.toFixed(3)} s.`,
104
+ message: () => `Total time for grouping handler ${handlerIndex}: ${timer.elapsedSeconds.toFixed(3)} s.`,
90
105
  }));
91
106
  }), last(), mergeMap(({ result }) => {
92
107
  result.grouped.forEach((groupingNode) => {
@@ -123,16 +138,15 @@ function createGroupingHandlers(imodelAccess, parentNode, processedInstanceNodes
123
138
  ? from(createPropertiesGroupingHandlers(imodelAccess, parentNode, processedInstanceNodes, valueFormatter, localizedStrings)).pipe(concatAll())
124
139
  : EMPTY, groupingLevel < GroupingLevel.Label ? of(async (allNodes) => createLabelGroups(allNodes)) : EMPTY).pipe(tap({
125
140
  subscribe: () => {
126
- doLog({
127
- category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,
128
- message: /* c8 ignore next */ () => `Start creating grouping handlers`,
129
- });
141
+ /* v8 ignore next -- @preserve */
142
+ doLog({ category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL, message: () => `Start creating grouping handlers` });
130
143
  timer.start();
131
144
  },
132
145
  }), finalize(() => {
146
+ /* v8 ignore next -- @preserve */
133
147
  doLog({
134
148
  category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,
135
- message: /* c8 ignore next */ () => `Creating grouping handlers took ${timer.elapsedSeconds.toFixed(3)} s`,
149
+ message: () => `Creating grouping handlers took ${timer.elapsedSeconds.toFixed(3)} s`,
136
150
  });
137
151
  }));
138
152
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Grouping.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/Grouping.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrI,OAAO,EAAE,MAAM,EAAE,SAAS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,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;QACpD,OAAO,aAAa,CAAC,KAAK,CAAC;IAC7B,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,CAAC;AAC5B,CAAC;AAED,IAAK,aAKJ;AALD,WAAK,aAAa;IAChB,iDAAQ,CAAA;IACR,mDAAS,CAAA;IACT,yDAAY,CAAA;IACZ,mDAAS,CAAA;AACX,CAAC,EALI,aAAa,KAAb,aAAa,QAKjB","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 { concat, concatAll, delay, EMPTY, expand, finalize, from, last, map, merge, mergeMap, of, reduce, tap, toArray } from \"rxjs\";\nimport { assert, StopWatch } from \"@itwin/core-bentley\";\nimport { HierarchyNode } from \"../../HierarchyNode.js\";\nimport {\n LOGGING_NAMESPACE_PERFORMANCE as BASE_LOGGING_NAMESPACE_PERFORMANCE,\n LOGGING_NAMESPACE_PERFORMANCE_INTERNAL as BASE_LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n createNodeIdentifierForLogging,\n createOperatorLoggingNamespace,\n LOGGING_NAMESPACE_INTERNAL,\n} from \"../../internal/Common.js\";\nimport { doLog, log } from \"../../internal/LoggingUtils.js\";\nimport { releaseMainThreadOnItemsCount } from \"../../internal/operators/ReleaseMainThread.js\";\nimport { tapOnce } from \"../../internal/operators/TapOnce.js\";\nimport { assignAutoExpand } from \"./grouping/AutoExpand.js\";\nimport { createBaseClassGroupingHandlers } from \"./grouping/BaseClassGrouping.js\";\nimport { createClassGroups } from \"./grouping/ClassGrouping.js\";\nimport { applyGroupHidingParams } from \"./grouping/GroupHiding.js\";\nimport { createLabelGroups } from \"./grouping/LabelGrouping.js\";\nimport { createPropertiesGroupingHandlers } from \"./grouping/PropertiesGrouping.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { ECClassHierarchyInspector, ECSchemaProvider, IPrimitiveValueFormatter } from \"@itwin/presentation-shared\";\nimport type { ParentHierarchyNode } from \"../../HierarchyNode.js\";\nimport type { ProcessedGroupingHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode } from \"../IModelHierarchyNode.js\";\nimport type { PropertiesGroupingLocalizedStrings } from \"./grouping/PropertiesGrouping.js\";\n\nconst OPERATOR_NAME = \"Grouping\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, LOGGING_NAMESPACE_INTERNAL);\nconst LOGGING_NAMESPACE_PERFORMANCE = createOperatorLoggingNamespace(OPERATOR_NAME, BASE_LOGGING_NAMESPACE_PERFORMANCE);\nconst LOGGING_NAMESPACE_PERFORMANCE_INTERNAL = createOperatorLoggingNamespace(OPERATOR_NAME, BASE_LOGGING_NAMESPACE_PERFORMANCE_INTERNAL);\n\n/** @internal */\nexport function createGroupingOperator(\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector,\n parentNode: ParentHierarchyNode | undefined,\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\n onNodesGrouped?: (groupingResult: GroupingHandlerResult | undefined, handler: GroupingHandler) => void,\n onGroupingNodeCreated?: (groupingNode: ProcessedGroupingHierarchyNode) => void,\n groupingHandlers?: GroupingHandler[],\n) {\n return function (nodes: Observable<ProcessedHierarchyNode>): Observable<ProcessedHierarchyNode> {\n return nodes.pipe(\n log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }),\n tapOnce(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () => `Starting grouping (parent: ${createNodeIdentifierForLogging(parentNode)})`,\n });\n }),\n reduce<ProcessedHierarchyNode, { instanceNodes: ProcessedInstanceHierarchyNode[]; restNodes: ProcessedHierarchyNode[] }>(\n (resolvedNodes, node) => {\n if (HierarchyNode.isInstancesNode(node)) {\n resolvedNodes.instanceNodes.push(node);\n } else {\n resolvedNodes.restNodes.push(node);\n }\n return resolvedNodes;\n },\n { instanceNodes: [], restNodes: [] },\n ),\n tap(({ instanceNodes, restNodes }) => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Nodes partitioned. Got ${instanceNodes.length} instance nodes and ${restNodes.length} rest nodes.`,\n });\n }),\n mergeMap((res) => {\n const out = of(res);\n const totalNodes = res.instanceNodes.length + res.restNodes.length;\n /* c8 ignore next */\n return totalNodes <= 1000 ? out : out.pipe(delay(0));\n }),\n mergeMap(({ instanceNodes, restNodes }): Observable<ProcessedHierarchyNode> => {\n const timer = new StopWatch(undefined, true);\n const groupingHandlersObs: Observable<GroupingHandler> = groupingHandlers\n ? from(groupingHandlers)\n : createGroupingHandlers(imodelAccess, parentNode, instanceNodes, valueFormatter, localizedStrings);\n return merge(\n groupingHandlersObs.pipe(\n toArray(),\n mergeMap((createdGroupingHandlers) =>\n groupInstanceNodes(instanceNodes, restNodes.length, createdGroupingHandlers, parentNode, onNodesGrouped, onGroupingNodeCreated),\n ),\n finalize(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () => `Grouping ${instanceNodes.length} nodes took ${timer.elapsedSeconds.toFixed(3)} s`,\n });\n }),\n ),\n from(restNodes),\n );\n }),\n releaseMainThreadOnItemsCount(500),\n log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }),\n );\n };\n}\n\n/** @internal */\nexport type ProcessedInstancesGroupingHierarchyNode = Omit<ProcessedGroupingHierarchyNode, \"children\"> & { children: ProcessedInstanceHierarchyNode[] };\n\n/** @internal */\nexport interface GroupingHandlerResult {\n /** Expected to be sorted by label. */\n grouped: Array<ProcessedInstancesGroupingHierarchyNode>;\n /** Expected to be sorted by label. */\n ungrouped: ProcessedInstanceHierarchyNode[];\n groupingType: GroupingType;\n}\n\n/** @internal */\nexport type GroupingType = \"label\" | \"class\" | \"base-class\" | \"property\";\n\n/** @internal */\nexport type GroupingHandler = (\n nodesToGroup: ProcessedInstanceHierarchyNode[],\n nodesAlreadyGrouped: ProcessedInstancesGroupingHierarchyNode[],\n) => Promise<GroupingHandlerResult>;\n\nfunction groupInstanceNodes(\n nodes: ProcessedInstanceHierarchyNode[],\n extraSiblings: number,\n groupingHandlers: GroupingHandler[],\n parentNode: ParentHierarchyNode | undefined,\n onNodesGrouped?: (groupingResult: GroupingHandlerResult | undefined, handler: GroupingHandler) => void,\n onGroupingNodeCreated?: (groupingNode: ProcessedGroupingHierarchyNode) => void,\n): Observable<ProcessedGroupingHierarchyNode | ProcessedInstanceHierarchyNode> {\n if (groupingHandlers.length === 0) {\n return from(nodes);\n }\n return of<{ handlerIndex: number; result?: GroupingHandlerResult | undefined }>({ handlerIndex: 0 }).pipe(\n expand(({ handlerIndex, result: curr }) => {\n if (handlerIndex >= groupingHandlers.length) {\n return EMPTY;\n }\n const timer = new StopWatch(undefined, true);\n const currentHandler = groupingHandlers[handlerIndex];\n return from(currentHandler(curr?.ungrouped ?? nodes, curr?.grouped ?? [])).pipe(\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Grouping handler ${handlerIndex} exclusively took ${timer.elapsedSeconds.toFixed(3)} s.`,\n }),\n tap((result) => {\n onNodesGrouped?.(result, currentHandler);\n }),\n mergeMap((result) => {\n if (result.grouped.length === 0) {\n return of({ handlerIndex: handlerIndex + 1, result: { ...result, grouped: curr?.grouped ?? [] } });\n }\n const groupingPostProcessingTimer = new StopWatch(undefined, true);\n return of(result).pipe(\n map((r) => applyGroupHidingParams(r, extraSiblings)),\n map((r) => assignAutoExpand(r)),\n map((r) => ({ handlerIndex: handlerIndex + 1, result: { ...r, grouped: mergeInPlace(curr?.grouped, r.grouped) } })),\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () =>\n `Post-processing grouping handler ${handlerIndex} exclusively took ${groupingPostProcessingTimer.elapsedSeconds.toFixed(3)} s.`,\n }),\n delay(0),\n );\n }),\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Total time for grouping handler ${handlerIndex}: ${timer.elapsedSeconds.toFixed(3)} s.`,\n }),\n );\n }),\n last(),\n mergeMap(({ result }) => {\n result.grouped.forEach((groupingNode) => {\n onGroupingNodeCreated?.(groupingNode);\n if (!parentNode) {\n return;\n }\n if (HierarchyNode.isGroupingNode(parentNode)) {\n groupingNode.nonGroupingAncestor = parentNode.nonGroupingAncestor;\n return;\n }\n // not sure why type checker doesn't pick this up\n assert(HierarchyNode.isGeneric(parentNode) || HierarchyNode.isInstancesNode(parentNode));\n groupingNode.nonGroupingAncestor = parentNode;\n });\n return mergeInPlace<ProcessedGroupingHierarchyNode | ProcessedInstanceHierarchyNode>(result.grouped, result.ungrouped);\n }),\n );\n}\n\nfunction mergeInPlace<T>(target: T[] | undefined, source: T[]) {\n if (!target || target.length === 0) {\n return source;\n }\n for (const item of source) {\n target.push(item);\n }\n return target;\n}\n\nfunction createGroupingHandlers(\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector,\n parentNode: ParentHierarchyNode | undefined,\n processedInstanceNodes: ProcessedInstanceHierarchyNode[],\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\n): Observable<GroupingHandler> {\n const timer = new StopWatch();\n const groupingLevel = getNodeGroupingLevel(parentNode);\n return concat(\n groupingLevel <= GroupingLevel.Class\n ? concat(\n from(createBaseClassGroupingHandlers(imodelAccess, parentNode, processedInstanceNodes)).pipe(concatAll()),\n of<GroupingHandler>(async (allNodes) => createClassGroups(imodelAccess, parentNode, allNodes)),\n )\n : EMPTY,\n groupingLevel <= GroupingLevel.Property\n ? from(createPropertiesGroupingHandlers(imodelAccess, parentNode, processedInstanceNodes, valueFormatter, localizedStrings)).pipe(concatAll())\n : EMPTY,\n groupingLevel < GroupingLevel.Label ? of<GroupingHandler>(async (allNodes) => createLabelGroups(allNodes)) : EMPTY,\n ).pipe(\n tap({\n subscribe: () => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Start creating grouping handlers`,\n });\n timer.start();\n },\n }),\n finalize(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Creating grouping handlers took ${timer.elapsedSeconds.toFixed(3)} s`,\n });\n }),\n );\n}\n\nfunction getNodeGroupingLevel(node: ParentHierarchyNode | undefined): GroupingLevel {\n if (node && HierarchyNode.isClassGroupingNode(node)) {\n return GroupingLevel.Class;\n }\n if (node && HierarchyNode.isPropertyGroupingNode(node)) {\n return GroupingLevel.Property;\n }\n if (node && HierarchyNode.isLabelGroupingNode(node)) {\n return GroupingLevel.Label;\n }\n return GroupingLevel.None;\n}\n\nenum GroupingLevel {\n None = 0,\n Class = 2,\n Property = 3,\n Label = 4,\n}\n"]}
1
+ {"version":3,"file":"Grouping.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/Grouping.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,KAAK,EACL,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,KAAK,EACL,QAAQ,EACR,EAAE,EACF,MAAM,EACN,GAAG,EACH,OAAO,GACR,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACL,6BAA6B,IAAI,kCAAkC,EACnE,sCAAsC,IAAI,2CAA2C,EACrF,8BAA8B,EAC9B,8BAA8B,EAC9B,0BAA0B,GAC3B,MAAM,0BAA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Y,CAAA;IACZ,mDAAS,CAAA;AACX,CAAC,EALI,aAAa,KAAb,aAAa,QAKjB","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 concat,\n concatAll,\n delay,\n EMPTY,\n expand,\n finalize,\n from,\n last,\n map,\n merge,\n mergeMap,\n of,\n reduce,\n tap,\n toArray,\n} from \"rxjs\";\nimport { assert, StopWatch } from \"@itwin/core-bentley\";\nimport { HierarchyNode } from \"../../HierarchyNode.js\";\nimport {\n LOGGING_NAMESPACE_PERFORMANCE as BASE_LOGGING_NAMESPACE_PERFORMANCE,\n LOGGING_NAMESPACE_PERFORMANCE_INTERNAL as BASE_LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n createNodeIdentifierForLogging,\n createOperatorLoggingNamespace,\n LOGGING_NAMESPACE_INTERNAL,\n} from \"../../internal/Common.js\";\nimport { doLog, log } from \"../../internal/LoggingUtils.js\";\nimport { releaseMainThreadOnItemsCount } from \"../../internal/operators/ReleaseMainThread.js\";\nimport { tapOnce } from \"../../internal/operators/TapOnce.js\";\nimport { assignAutoExpand } from \"./grouping/AutoExpand.js\";\nimport { createBaseClassGroupingHandlers } from \"./grouping/BaseClassGrouping.js\";\nimport { createClassGroups } from \"./grouping/ClassGrouping.js\";\nimport { applyGroupHidingParams } from \"./grouping/GroupHiding.js\";\nimport { createLabelGroups } from \"./grouping/LabelGrouping.js\";\nimport { createPropertiesGroupingHandlers } from \"./grouping/PropertiesGrouping.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { ECClassHierarchyInspector, ECSchemaProvider, IPrimitiveValueFormatter } from \"@itwin/presentation-shared\";\nimport type { ParentHierarchyNode } from \"../../HierarchyNode.js\";\nimport type {\n ProcessedGroupingHierarchyNode,\n ProcessedHierarchyNode,\n ProcessedInstanceHierarchyNode,\n} from \"../IModelHierarchyNode.js\";\nimport type { PropertiesGroupingLocalizedStrings } from \"./grouping/PropertiesGrouping.js\";\n\nconst OPERATOR_NAME = \"Grouping\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, LOGGING_NAMESPACE_INTERNAL);\nconst LOGGING_NAMESPACE_PERFORMANCE = createOperatorLoggingNamespace(OPERATOR_NAME, BASE_LOGGING_NAMESPACE_PERFORMANCE);\nconst LOGGING_NAMESPACE_PERFORMANCE_INTERNAL = createOperatorLoggingNamespace(\n OPERATOR_NAME,\n BASE_LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n);\n\n/** @internal */\nexport function createGroupingOperator(\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector,\n parentNode: ParentHierarchyNode | undefined,\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\n onNodesGrouped?: (groupingResult: GroupingHandlerResult | undefined, handler: GroupingHandler) => void,\n onGroupingNodeCreated?: (groupingNode: ProcessedGroupingHierarchyNode) => void,\n groupingHandlers?: GroupingHandler[],\n) {\n return function (nodes: Observable<ProcessedHierarchyNode>): Observable<ProcessedHierarchyNode> {\n return nodes.pipe(\n /* v8 ignore next -- @preserve */\n log({ category: LOGGING_NAMESPACE, message: (n) => `in: ${createNodeIdentifierForLogging(n)}` }),\n tapOnce(() => {\n /* v8 ignore next -- @preserve */\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: () => `Starting grouping (parent: ${createNodeIdentifierForLogging(parentNode)})`,\n });\n }),\n reduce<\n ProcessedHierarchyNode,\n { instanceNodes: ProcessedInstanceHierarchyNode[]; restNodes: ProcessedHierarchyNode[] }\n >(\n (resolvedNodes, node) => {\n if (HierarchyNode.isInstancesNode(node)) {\n resolvedNodes.instanceNodes.push(node);\n } else {\n resolvedNodes.restNodes.push(node);\n }\n return resolvedNodes;\n },\n { instanceNodes: [], restNodes: [] },\n ),\n tap(({ instanceNodes, restNodes }) => {\n /* v8 ignore next -- @preserve */\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: () =>\n `Nodes partitioned. Got ${instanceNodes.length} instance nodes and ${restNodes.length} rest nodes.`,\n });\n }),\n mergeMap((res) => {\n const out = of(res);\n const totalNodes = res.instanceNodes.length + res.restNodes.length;\n\n return totalNodes <= 1000 ? out : /* v8 ignore next -- @preserve */ out.pipe(delay(0));\n }),\n mergeMap(({ instanceNodes, restNodes }): Observable<ProcessedHierarchyNode> => {\n const timer = new StopWatch(undefined, true);\n const groupingHandlersObs: Observable<GroupingHandler> = groupingHandlers\n ? from(groupingHandlers)\n : createGroupingHandlers(imodelAccess, parentNode, instanceNodes, valueFormatter, localizedStrings);\n return merge(\n groupingHandlersObs.pipe(\n toArray(),\n mergeMap((createdGroupingHandlers) =>\n groupInstanceNodes(\n instanceNodes,\n restNodes.length,\n createdGroupingHandlers,\n parentNode,\n onNodesGrouped,\n onGroupingNodeCreated,\n ),\n ),\n finalize(() => {\n /* v8 ignore next -- @preserve */\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: () => `Grouping ${instanceNodes.length} nodes took ${timer.elapsedSeconds.toFixed(3)} s`,\n });\n }),\n ),\n from(restNodes),\n );\n }),\n releaseMainThreadOnItemsCount(500),\n /* v8 ignore next -- @preserve */\n log({ category: LOGGING_NAMESPACE, message: (n) => `out: ${createNodeIdentifierForLogging(n)}` }),\n );\n };\n}\n\n/** @internal */\nexport type ProcessedInstancesGroupingHierarchyNode = Omit<ProcessedGroupingHierarchyNode, \"children\"> & {\n children: ProcessedInstanceHierarchyNode[];\n};\n\n/** @internal */\nexport interface GroupingHandlerResult {\n /** Expected to be sorted by label. */\n grouped: Array<ProcessedInstancesGroupingHierarchyNode>;\n /** Expected to be sorted by label. */\n ungrouped: ProcessedInstanceHierarchyNode[];\n groupingType: GroupingType;\n}\n\n/** @internal */\nexport type GroupingType = \"label\" | \"class\" | \"base-class\" | \"property\";\n\n/** @internal */\nexport type GroupingHandler = (\n nodesToGroup: ProcessedInstanceHierarchyNode[],\n nodesAlreadyGrouped: ProcessedInstancesGroupingHierarchyNode[],\n) => Promise<GroupingHandlerResult>;\n\nfunction groupInstanceNodes(\n nodes: ProcessedInstanceHierarchyNode[],\n extraSiblings: number,\n groupingHandlers: GroupingHandler[],\n parentNode: ParentHierarchyNode | undefined,\n onNodesGrouped?: (groupingResult: GroupingHandlerResult | undefined, handler: GroupingHandler) => void,\n onGroupingNodeCreated?: (groupingNode: ProcessedGroupingHierarchyNode) => void,\n): Observable<ProcessedGroupingHierarchyNode | ProcessedInstanceHierarchyNode> {\n if (groupingHandlers.length === 0) {\n return from(nodes);\n }\n return of<{ handlerIndex: number; result?: GroupingHandlerResult | undefined }>({ handlerIndex: 0 }).pipe(\n expand(({ handlerIndex, result: curr }) => {\n if (handlerIndex >= groupingHandlers.length) {\n return EMPTY;\n }\n const timer = new StopWatch(undefined, true);\n const currentHandler = groupingHandlers[handlerIndex];\n return from(currentHandler(curr?.ungrouped ?? nodes, curr?.grouped ?? [])).pipe(\n /* v8 ignore next -- @preserve */\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: () => `Grouping handler ${handlerIndex} exclusively took ${timer.elapsedSeconds.toFixed(3)} s.`,\n }),\n tap((result) => {\n onNodesGrouped?.(result, currentHandler);\n }),\n mergeMap((result) => {\n if (result.grouped.length === 0) {\n return of({ handlerIndex: handlerIndex + 1, result: { ...result, grouped: curr?.grouped ?? [] } });\n }\n const groupingPostProcessingTimer = new StopWatch(undefined, true);\n return of(result).pipe(\n map((r) => applyGroupHidingParams(r, extraSiblings)),\n map((r) => assignAutoExpand(r)),\n map((r) => ({\n handlerIndex: handlerIndex + 1,\n result: { ...r, grouped: mergeInPlace(curr?.grouped, r.grouped) },\n })),\n /* v8 ignore next -- @preserve */\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: () =>\n `Post-processing grouping handler ${handlerIndex} exclusively took ${groupingPostProcessingTimer.elapsedSeconds.toFixed(3)} s.`,\n }),\n delay(0),\n );\n }),\n /* v8 ignore next -- @preserve */\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: () => `Total time for grouping handler ${handlerIndex}: ${timer.elapsedSeconds.toFixed(3)} s.`,\n }),\n );\n }),\n last(),\n mergeMap(({ result }) => {\n result.grouped.forEach((groupingNode) => {\n onGroupingNodeCreated?.(groupingNode);\n if (!parentNode) {\n return;\n }\n if (HierarchyNode.isGroupingNode(parentNode)) {\n groupingNode.nonGroupingAncestor = parentNode.nonGroupingAncestor;\n return;\n }\n // not sure why type checker doesn't pick this up\n assert(HierarchyNode.isGeneric(parentNode) || HierarchyNode.isInstancesNode(parentNode));\n groupingNode.nonGroupingAncestor = parentNode;\n });\n return mergeInPlace<ProcessedGroupingHierarchyNode | ProcessedInstanceHierarchyNode>(\n result.grouped,\n result.ungrouped,\n );\n }),\n );\n}\n\nfunction mergeInPlace<T>(target: T[] | undefined, source: T[]) {\n if (!target || target.length === 0) {\n return source;\n }\n for (const item of source) {\n target.push(item);\n }\n return target;\n}\n\nfunction createGroupingHandlers(\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector,\n parentNode: ParentHierarchyNode | undefined,\n processedInstanceNodes: ProcessedInstanceHierarchyNode[],\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\n): Observable<GroupingHandler> {\n const timer = new StopWatch();\n const groupingLevel = getNodeGroupingLevel(parentNode);\n return concat(\n groupingLevel <= GroupingLevel.Class\n ? concat(\n from(createBaseClassGroupingHandlers(imodelAccess, parentNode, processedInstanceNodes)).pipe(concatAll()),\n of<GroupingHandler>(async (allNodes) => createClassGroups(imodelAccess, parentNode, allNodes)),\n )\n : EMPTY,\n groupingLevel <= GroupingLevel.Property\n ? from(\n createPropertiesGroupingHandlers(\n imodelAccess,\n parentNode,\n processedInstanceNodes,\n valueFormatter,\n localizedStrings,\n ),\n ).pipe(concatAll())\n : EMPTY,\n groupingLevel < GroupingLevel.Label ? of<GroupingHandler>(async (allNodes) => createLabelGroups(allNodes)) : EMPTY,\n ).pipe(\n tap({\n subscribe: () => {\n /* v8 ignore next -- @preserve */\n doLog({ category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL, message: () => `Start creating grouping handlers` });\n timer.start();\n },\n }),\n finalize(() => {\n /* v8 ignore next -- @preserve */\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: () => `Creating grouping handlers took ${timer.elapsedSeconds.toFixed(3)} s`,\n });\n }),\n );\n}\n\nfunction getNodeGroupingLevel(node: ParentHierarchyNode | undefined): GroupingLevel {\n if (node && HierarchyNode.isClassGroupingNode(node)) {\n return GroupingLevel.Class;\n }\n if (node && HierarchyNode.isPropertyGroupingNode(node)) {\n return GroupingLevel.Property;\n }\n if (node && HierarchyNode.isLabelGroupingNode(node)) {\n return GroupingLevel.Label;\n }\n return GroupingLevel.None;\n}\n\nenum GroupingLevel {\n None = 0,\n Class = 2,\n Property = 3,\n Label = 4,\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"HideIfNoChildren.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/HideIfNoChildren.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAMvC,gBAAgB;AAChB,eAAO,MAAM,iBAAiB,QAA4E,CAAC;AAE3G;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,UAAU,CAAC,OAAO,CAAC,WACpF,UAAU,CAAC,sBAAsB,CAAC,KAAG,UAAU,CAAC,sBAAsB,CAAC,CAkDhG"}
1
+ {"version":3,"file":"HideIfNoChildren.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/HideIfNoChildren.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAMvC,gBAAgB;AAChB,eAAO,MAAM,iBAAiB,QAA4E,CAAC;AAE3G;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,UAAU,CAAC,OAAO,CAAC,WACpF,UAAU,CAAC,sBAAsB,CAAC,KAAG,UAAU,CAAC,sBAAsB,CAAC,CAwEhG"}
@@ -3,7 +3,7 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import { defer, filter, map, merge, mergeMap } from "rxjs";
6
- import { createNodeIdentifierForLogging, createOperatorLoggingNamespace, hasChildren, LOGGING_NAMESPACE_INTERNAL } from "../../internal/Common.js";
6
+ import { createNodeIdentifierForLogging, createOperatorLoggingNamespace, hasChildren, LOGGING_NAMESPACE_INTERNAL, } from "../../internal/Common.js";
7
7
  import { doLog, log } from "../../internal/LoggingUtils.js";
8
8
  import { partition } from "../../internal/operators/Partition.js";
9
9
  import { ProcessedHierarchyNode } from "../IModelHierarchyNode.js";
@@ -18,21 +18,39 @@ export const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, L
18
18
  */
19
19
  export function createHideIfNoChildrenOperator(hasNodes) {
20
20
  return function (nodes) {
21
- const inputNodes = nodes.pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }));
21
+ const inputNodes = nodes.pipe(
22
+ /* v8 ignore next -- @preserve */
23
+ log({ category: LOGGING_NAMESPACE, message: (n) => `in: ${createNodeIdentifierForLogging(n)}` }));
22
24
  // split input into 3 pieces:
23
25
  // - `doesntNeedHide` - nodes without the flag (return no matter if they have children or not)
24
26
  // - `determinedChildren` - nodes with the flag and known children
25
27
  // - `undeterminedChildren` - nodes with the flag and unknown children
26
- const [needsHide, doesntNeedHide] = partition(inputNodes, (n) => (ProcessedHierarchyNode.isGeneric(n) || ProcessedHierarchyNode.isInstancesNode(n)) && !!n.processingParams?.hideIfNoChildren);
28
+ const [needsHide, doesntNeedHide] = partition(inputNodes, (n) => (ProcessedHierarchyNode.isGeneric(n) || ProcessedHierarchyNode.isInstancesNode(n)) &&
29
+ !!n.processingParams?.hideIfNoChildren);
27
30
  const [determinedChildren, undeterminedChildren] = partition(needsHide, (n) => n.children !== undefined);
28
- return merge(doesntNeedHide.pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: doesn't need hide` })), merge(determinedChildren.pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: needs hide, has children` })), undeterminedChildren.pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: needs hide, needs children` }), mergeMap((n) => defer(() => {
31
+ return merge(doesntNeedHide.pipe(
32
+ /* v8 ignore next -- @preserve */
33
+ log({ category: LOGGING_NAMESPACE, message: (n) => `${createNodeIdentifierForLogging(n)}: doesn't need hide` })), merge(determinedChildren.pipe(
34
+ /* v8 ignore next -- @preserve */
35
+ log({
36
+ category: LOGGING_NAMESPACE,
37
+ message: (n) => `${createNodeIdentifierForLogging(n)}: needs hide, has children`,
38
+ })), undeterminedChildren.pipe(
39
+ /* v8 ignore next -- @preserve */
40
+ log({
41
+ category: LOGGING_NAMESPACE,
42
+ message: (n) => `${createNodeIdentifierForLogging(n)}: needs hide, needs children`,
43
+ }), mergeMap((n) => defer(() => {
44
+ /* v8 ignore next -- @preserve */
29
45
  doLog({
30
46
  category: LOGGING_NAMESPACE,
31
- message: /* c8 ignore next */ () => `${createNodeIdentifierForLogging(n)}: requesting children flag`,
47
+ message: () => `${createNodeIdentifierForLogging(n)}: requesting children flag`,
32
48
  });
33
- return hasNodes(n).pipe(log({
49
+ return hasNodes(n).pipe(
50
+ /* v8 ignore next -- @preserve */
51
+ log({
34
52
  category: LOGGING_NAMESPACE,
35
- message: /* c8 ignore next */ (childrenFlag) => `${createNodeIdentifierForLogging(n)}: determined children: ${childrenFlag}`,
53
+ message: (childrenFlag) => `${createNodeIdentifierForLogging(n)}: determined children: ${childrenFlag}`,
36
54
  }), map((children) => Object.assign(n, { children })));
37
55
  }),
38
56
  // Sending child check requests for all nodes without any limit greatly slows down
@@ -40,10 +58,14 @@ export function createHideIfNoChildrenOperator(hasNodes) {
40
58
  // - NodeX (determining children) -> ... lots of children with "hide if no children" -> ...
41
59
  // We check the nodes with "hide if no children" at most 2 at a time to prefer going deep into
42
60
  // the hierarchy, where we're more likely to find an answer, rather than going wide.
43
- 2), log({
61
+ 2),
62
+ /* v8 ignore next -- @preserve */
63
+ log({
44
64
  category: LOGGING_NAMESPACE,
45
- message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: needs hide, determined children: ${hasChildren(n)}`,
46
- }))).pipe(filter(hasChildren))).pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }));
65
+ message: (n) => `${createNodeIdentifierForLogging(n)}: needs hide, determined children: ${hasChildren(n)}`,
66
+ }))).pipe(filter(hasChildren))).pipe(
67
+ /* v8 ignore next -- @preserve */
68
+ log({ category: LOGGING_NAMESPACE, message: (n) => `out: ${createNodeIdentifierForLogging(n)}` }));
47
69
  };
48
70
  }
49
71
  //# sourceMappingURL=HideIfNoChildren.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HideIfNoChildren.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/HideIfNoChildren.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;A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;QACpF,CAAC,CACF,EACD,GAAG,CAAC;YACF,QAAQ,EAAE,iBAAiB;YAC3B,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,8BAA8B,CAAC,CAAC,CAAC,sCAAsC,WAAW,CAAC,CAAC,CAAC,EAAE;SAChI,CAAC,CACH,CACF,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAC5B,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,8BAA8B,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACjI,CAAC,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 { defer, filter, map, merge, mergeMap } from \"rxjs\";\nimport { createNodeIdentifierForLogging, createOperatorLoggingNamespace, hasChildren, LOGGING_NAMESPACE_INTERNAL } from \"../../internal/Common.js\";\nimport { doLog, log } from \"../../internal/LoggingUtils.js\";\nimport { partition } from \"../../internal/operators/Partition.js\";\nimport { ProcessedHierarchyNode } from \"../IModelHierarchyNode.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { ProcessedGenericHierarchyNode, ProcessedInstanceHierarchyNode } from \"../IModelHierarchyNode.js\";\n\n// cspell:words doesnt\n\nconst OPERATOR_NAME = \"HideIfNoChildren\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, LOGGING_NAMESPACE_INTERNAL);\n\n/**\n * Creates an operator that hides nodes with no children if they have a `hideIfNoChildren` handling param.\n *\n * @internal\n */\nexport function createHideIfNoChildrenOperator(hasNodes: (node: ProcessedHierarchyNode) => Observable<boolean>) {\n return function (nodes: Observable<ProcessedHierarchyNode>): Observable<ProcessedHierarchyNode> {\n const inputNodes = nodes.pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }));\n // split input into 3 pieces:\n // - `doesntNeedHide` - nodes without the flag (return no matter if they have children or not)\n // - `determinedChildren` - nodes with the flag and known children\n // - `undeterminedChildren` - nodes with the flag and unknown children\n const [needsHide, doesntNeedHide] = partition(\n inputNodes,\n (n): n is ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode =>\n (ProcessedHierarchyNode.isGeneric(n) || ProcessedHierarchyNode.isInstancesNode(n)) && !!n.processingParams?.hideIfNoChildren,\n );\n const [determinedChildren, undeterminedChildren] = partition(needsHide, (n) => n.children !== undefined);\n return merge(\n doesntNeedHide.pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: doesn't need hide` })),\n merge(\n determinedChildren.pipe(\n log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: needs hide, has children` }),\n ),\n undeterminedChildren.pipe(\n log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: needs hide, needs children` }),\n mergeMap(\n (n) =>\n defer(() => {\n doLog({\n category: LOGGING_NAMESPACE,\n message: /* c8 ignore next */ () => `${createNodeIdentifierForLogging(n)}: requesting children flag`,\n });\n return hasNodes(n).pipe(\n log({\n category: LOGGING_NAMESPACE,\n message: /* c8 ignore next */ (childrenFlag) => `${createNodeIdentifierForLogging(n)}: determined children: ${childrenFlag}`,\n }),\n map((children) => Object.assign(n, { children })),\n );\n }),\n // Sending child check requests for all nodes without any limit greatly slows down\n // the following case:\n // - NodeX (determining children) -> ... lots of children with \"hide if no children\" -> ...\n // We check the nodes with \"hide if no children\" at most 2 at a time to prefer going deep into\n // the hierarchy, where we're more likely to find an answer, rather than going wide.\n 2,\n ),\n log({\n category: LOGGING_NAMESPACE,\n message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: needs hide, determined children: ${hasChildren(n)}`,\n }),\n ),\n ).pipe(filter(hasChildren)),\n ).pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }));\n };\n}\n"]}
1
+ {"version":3,"file":"HideIfNoChildren.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/HideIfNoChildren.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAC3D,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,EAC9B,WAAW,EACX,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAKnE,sBAAsB;AAEtB,MAAM,aAAa,GAAG,kBAAkB,CAAC;AACzC,gBAAgB;AAChB,MAAM,CAAC,MAAM,iBAAiB,GAAG,8BAA8B,CAAC,aAAa,EAAE,0BAA0B,CAAC,CAAC;AAE3G;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAAC,QAA+D;IAC5G,OAAO,UAAU,KAAyC;QACxD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI;QAC3B,iCAAiC;QACjC,GAAG,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,8BAA8B,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACjG,CAAC;QACF,6BAA6B;QAC7B,8FAA8F;QAC9F,kEAAkE;QAClE,sEAAsE;QACtE,MAAM,CAAC,SAAS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,CAAC,CAAC,CAAC,CAAC,IAAI;YACrB,iCAAiC;YACjC,GAAG,CAAC;gBACF,QAAQ,EAAE,iBAAiB;gBAC3B,OAAO,EAAE,CAAC,YAAY,EAAE,EAAE,CACxB,GAAG,8BAA8B,CAAC,CAAC,CAAC,0BAA0B,YAAY,EAAE;aAC/E,CAAC,EACF,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,CAClD,CAAC;QACJ,CAAC,CAAC;QACJ,kFAAkF;QAClF,sBAAsB;QACtB,2FAA2F;QAC3F,8FAA8F;QAC9F,oFAAoF;QACpF,CAAC,CACF;QACD,iCAAiC;QACjC,GAAG,CAAC;YACF,QAAQ,EAAE,iBAAiB;YAC3B,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,8BAA8B,CAAC,CAAC,CAAC,sCAAsC,WAAW,CAAC,CAAC,CAAC,EAAE;SAC3G,CAAC,CACH,CACF,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAC5B,CAAC,IAAI;QACJ,iCAAiC;QACjC,GAAG,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,8BAA8B,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAClG,CAAC;IACJ,CAAC,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 { defer, filter, map, merge, mergeMap } from \"rxjs\";\nimport {\n createNodeIdentifierForLogging,\n createOperatorLoggingNamespace,\n hasChildren,\n LOGGING_NAMESPACE_INTERNAL,\n} from \"../../internal/Common.js\";\nimport { doLog, log } from \"../../internal/LoggingUtils.js\";\nimport { partition } from \"../../internal/operators/Partition.js\";\nimport { ProcessedHierarchyNode } from \"../IModelHierarchyNode.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { ProcessedGenericHierarchyNode, ProcessedInstanceHierarchyNode } from \"../IModelHierarchyNode.js\";\n\n// cspell:words doesnt\n\nconst OPERATOR_NAME = \"HideIfNoChildren\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, LOGGING_NAMESPACE_INTERNAL);\n\n/**\n * Creates an operator that hides nodes with no children if they have a `hideIfNoChildren` handling param.\n *\n * @internal\n */\nexport function createHideIfNoChildrenOperator(hasNodes: (node: ProcessedHierarchyNode) => Observable<boolean>) {\n return function (nodes: Observable<ProcessedHierarchyNode>): Observable<ProcessedHierarchyNode> {\n const inputNodes = nodes.pipe(\n /* v8 ignore next -- @preserve */\n log({ category: LOGGING_NAMESPACE, message: (n) => `in: ${createNodeIdentifierForLogging(n)}` }),\n );\n // split input into 3 pieces:\n // - `doesntNeedHide` - nodes without the flag (return no matter if they have children or not)\n // - `determinedChildren` - nodes with the flag and known children\n // - `undeterminedChildren` - nodes with the flag and unknown children\n const [needsHide, doesntNeedHide] = partition(\n inputNodes,\n (n): n is ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode =>\n (ProcessedHierarchyNode.isGeneric(n) || ProcessedHierarchyNode.isInstancesNode(n)) &&\n !!n.processingParams?.hideIfNoChildren,\n );\n const [determinedChildren, undeterminedChildren] = partition(needsHide, (n) => n.children !== undefined);\n return merge(\n doesntNeedHide.pipe(\n /* v8 ignore next -- @preserve */\n log({ category: LOGGING_NAMESPACE, message: (n) => `${createNodeIdentifierForLogging(n)}: doesn't need hide` }),\n ),\n merge(\n determinedChildren.pipe(\n /* v8 ignore next -- @preserve */\n log({\n category: LOGGING_NAMESPACE,\n message: (n) => `${createNodeIdentifierForLogging(n)}: needs hide, has children`,\n }),\n ),\n undeterminedChildren.pipe(\n /* v8 ignore next -- @preserve */\n log({\n category: LOGGING_NAMESPACE,\n message: (n) => `${createNodeIdentifierForLogging(n)}: needs hide, needs children`,\n }),\n mergeMap(\n (n) =>\n defer(() => {\n /* v8 ignore next -- @preserve */\n doLog({\n category: LOGGING_NAMESPACE,\n message: () => `${createNodeIdentifierForLogging(n)}: requesting children flag`,\n });\n return hasNodes(n).pipe(\n /* v8 ignore next -- @preserve */\n log({\n category: LOGGING_NAMESPACE,\n message: (childrenFlag) =>\n `${createNodeIdentifierForLogging(n)}: determined children: ${childrenFlag}`,\n }),\n map((children) => Object.assign(n, { children })),\n );\n }),\n // Sending child check requests for all nodes without any limit greatly slows down\n // the following case:\n // - NodeX (determining children) -> ... lots of children with \"hide if no children\" -> ...\n // We check the nodes with \"hide if no children\" at most 2 at a time to prefer going deep into\n // the hierarchy, where we're more likely to find an answer, rather than going wide.\n 2,\n ),\n /* v8 ignore next -- @preserve */\n log({\n category: LOGGING_NAMESPACE,\n message: (n) => `${createNodeIdentifierForLogging(n)}: needs hide, determined children: ${hasChildren(n)}`,\n }),\n ),\n ).pipe(filter(hasChildren)),\n ).pipe(\n /* v8 ignore next -- @preserve */\n log({ category: LOGGING_NAMESPACE, message: (n) => `out: ${createNodeIdentifierForLogging(n)}` }),\n );\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"HideNodesInHierarchy.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/HideNodesInHierarchy.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAKvC,gBAAgB;AAChB,eAAO,MAAM,iBAAiB,QAA4E,CAAC;AAE3G;;;;GAIG;AACH,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,CAAC,UAAU,EAAE,sBAAsB,KAAK,UAAU,CAAC,sBAAsB,CAAC,EACpF,gBAAgB,EAAE,OAAO,WAED,UAAU,CAAC,sBAAsB,CAAC,KAAG,UAAU,CAAC,sBAAsB,CAAC,CAqEhG"}
1
+ {"version":3,"file":"HideNodesInHierarchy.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/HideNodesInHierarchy.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAKvC,gBAAgB;AAChB,eAAO,MAAM,iBAAiB,QAA4E,CAAC;AAE3G;;;;GAIG;AACH,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,CAAC,UAAU,EAAE,sBAAsB,KAAK,UAAU,CAAC,sBAAsB,CAAC,EACpF,gBAAgB,EAAE,OAAO,WAED,UAAU,CAAC,sBAAsB,CAAC,KAAG,UAAU,CAAC,sBAAsB,CAAC,CAiFhG"}
@@ -5,7 +5,7 @@
5
5
  import { concat, defer, EMPTY, filter, finalize, map, merge, mergeAll, mergeMap, take } from "rxjs";
6
6
  import { assert } from "@itwin/core-bentley";
7
7
  import { HierarchyNodeKey } from "../../HierarchyNodeKey.js";
8
- import { createNodeIdentifierForLogging, createOperatorLoggingNamespace, hasChildren, LOGGING_NAMESPACE_INTERNAL } from "../../internal/Common.js";
8
+ import { createNodeIdentifierForLogging, createOperatorLoggingNamespace, hasChildren, LOGGING_NAMESPACE_INTERNAL, } from "../../internal/Common.js";
9
9
  import { doLog, log } from "../../internal/LoggingUtils.js";
10
10
  import { partition } from "../../internal/operators/Partition.js";
11
11
  import { reduceToMergeMapItem } from "../../internal/operators/ReduceToMergeMap.js";
@@ -21,12 +21,17 @@ export const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, L
21
21
  */
22
22
  export function createHideNodesInHierarchyOperator(getNodes, stopOnFirstChild) {
23
23
  return function (nodes) {
24
- const inputNodes = nodes.pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }));
25
- const [withFlag, withoutFlag] = partition(inputNodes, (n) => (ProcessedHierarchyNode.isGeneric(n) || ProcessedHierarchyNode.isInstancesNode(n)) && !!n.processingParams?.hideInHierarchy);
24
+ const inputNodes = nodes.pipe(
25
+ /* v8 ignore next -- @preserve */
26
+ log({ category: LOGGING_NAMESPACE, message: (n) => `in: ${createNodeIdentifierForLogging(n)}` }));
27
+ const [withFlag, withoutFlag] = partition(inputNodes, (n) => (ProcessedHierarchyNode.isGeneric(n) || ProcessedHierarchyNode.isInstancesNode(n)) &&
28
+ !!n.processingParams?.hideInHierarchy);
26
29
  // Defer to create a new seed for reduce on every subscribe
27
- const withLoadedChildren = defer(() => withFlag.pipe(log({
30
+ const withLoadedChildren = defer(() => withFlag.pipe(
31
+ /* v8 ignore next -- @preserve */
32
+ log({
28
33
  category: LOGGING_NAMESPACE,
29
- message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)} needs hide and needs children to be loaded`,
34
+ message: (n) => `${createNodeIdentifierForLogging(n)} needs hide and needs children to be loaded`,
30
35
  }), filter((node) => node.children !== false), reduceToMergeMapItem((node) => createMergeMapKey(node), (node, mergedNode) => {
31
36
  if (mergedNode) {
32
37
  if (ProcessedHierarchyNode.isGeneric(mergedNode)) {
@@ -37,22 +42,33 @@ export function createHideNodesInHierarchyOperator(getNodes, stopOnFirstChild) {
37
42
  return mergeInstanceNodes(mergedNode, node);
38
43
  }
39
44
  return node;
40
- }), log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (mm) => `created a merge map of size ${mm.size}` }), mergeMap((mm) => [...mm.values()].map((mergedNode) => defer(() => getNodes(mergedNode)))), mergeAll(), map((n) => n)));
41
- return merge(withoutFlag.pipe(log({
45
+ }),
46
+ /* v8 ignore next -- @preserve */
47
+ log({ category: LOGGING_NAMESPACE, message: (mm) => `created a merge map of size ${mm.size}` }), mergeMap((mm) => [...mm.values()].map((mergedNode) => defer(() => getNodes(mergedNode)))), mergeAll(), map((n) => n)));
48
+ return merge(withoutFlag.pipe(
49
+ /* v8 ignore next -- @preserve */
50
+ log({
42
51
  category: LOGGING_NAMESPACE,
43
- message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)} doesn't need hide, return the node`,
52
+ message: (n) => `${createNodeIdentifierForLogging(n)} doesn't need hide, return the node`,
44
53
  })), stopOnFirstChild
45
54
  ? concat(
46
55
  // a small hack to handle situation when we're here to only check if parent node has children and one of them has `hideIfNoChildren` flag
47
56
  // with a `hasChildren = true` - we just return the hidden node itself in that case to avoid digging deeper into the hierarchy
48
- inputNodes.pipe(filter(hasChildren), log({
57
+ inputNodes.pipe(filter(hasChildren),
58
+ /* v8 ignore next -- @preserve */
59
+ log({
49
60
  category: LOGGING_NAMESPACE,
50
- message: /* c8 ignore next */ (n) => `\`stopOnFirstChild = true\` and node ${createNodeIdentifierForLogging(n)} is set to always have nodes - return the hidden node without loading children`,
51
- })), EMPTY.pipe(finalize(() => doLog({
52
- category: LOGGING_NAMESPACE,
53
- message: /* c8 ignore next */ () => `\`stopOnFirstChild = true\` but none of the nodes had children determined to \`true\` - do load children`,
54
- }))), withLoadedChildren).pipe(take(1))
55
- : withLoadedChildren).pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }));
61
+ message: (n) => `\`stopOnFirstChild = true\` and node ${createNodeIdentifierForLogging(n)} is set to always have nodes - return the hidden node without loading children`,
62
+ })), EMPTY.pipe(finalize(() => {
63
+ /* v8 ignore next -- @preserve */
64
+ doLog({
65
+ category: LOGGING_NAMESPACE,
66
+ message: () => `\`stopOnFirstChild = true\` but none of the nodes had children determined to \`true\` - do load children`,
67
+ });
68
+ })), withLoadedChildren).pipe(take(1))
69
+ : withLoadedChildren).pipe(
70
+ /* v8 ignore next -- @preserve */
71
+ log({ category: LOGGING_NAMESPACE, message: (n) => `out: ${createNodeIdentifierForLogging(n)}` }));
56
72
  };
57
73
  }
58
74
  function createMergeMapKey(node) {
@@ -1 +1 @@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AACJ,CAAC;AAED,SAAS,iBAAiB,CAA2D,IAAW;IAC9F,IAAI,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACzC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;IACzE,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5C,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 { concat, defer, EMPTY, filter, finalize, map, merge, mergeAll, mergeMap, take } from \"rxjs\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { HierarchyNodeKey } from \"../../HierarchyNodeKey.js\";\nimport { createNodeIdentifierForLogging, createOperatorLoggingNamespace, hasChildren, LOGGING_NAMESPACE_INTERNAL } from \"../../internal/Common.js\";\nimport { doLog, log } from \"../../internal/LoggingUtils.js\";\nimport { partition } from \"../../internal/operators/Partition.js\";\nimport { reduceToMergeMapItem } from \"../../internal/operators/ReduceToMergeMap.js\";\nimport { ProcessedHierarchyNode } from \"../IModelHierarchyNode.js\";\nimport { mergeInstanceNodes } from \"../Utils.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { GenericNodeKey, InstancesNodeKey } from \"../../HierarchyNodeKey.js\";\nimport type { ProcessedGenericHierarchyNode, ProcessedInstanceHierarchyNode } from \"../IModelHierarchyNode.js\";\n\nconst OPERATOR_NAME = \"HideNodesInHierarchy\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, LOGGING_NAMESPACE_INTERNAL);\n\n/**\n * Creates an operator that hides nodes and instead returns their children if the nodes have a `hideInHierarchy` handling param.\n *\n * @internal\n */\nexport function createHideNodesInHierarchyOperator(\n getNodes: (parentNode: ProcessedHierarchyNode) => Observable<ProcessedHierarchyNode>,\n stopOnFirstChild: boolean,\n) {\n return function (nodes: Observable<ProcessedHierarchyNode>): Observable<ProcessedHierarchyNode> {\n const inputNodes = nodes.pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }));\n const [withFlag, withoutFlag] = partition(\n inputNodes,\n (n): n is ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode =>\n (ProcessedHierarchyNode.isGeneric(n) || ProcessedHierarchyNode.isInstancesNode(n)) && !!n.processingParams?.hideInHierarchy,\n );\n // Defer to create a new seed for reduce on every subscribe\n const withLoadedChildren = defer(() =>\n withFlag.pipe(\n log({\n category: LOGGING_NAMESPACE,\n message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)} needs hide and needs children to be loaded`,\n }),\n filter((node) => node.children !== false),\n reduceToMergeMapItem(\n (node) => createMergeMapKey(node),\n (node, mergedNode: ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode | undefined) => {\n if (mergedNode) {\n if (ProcessedHierarchyNode.isGeneric(mergedNode)) {\n // we don't merge generic nodes, just return the first one\n return mergedNode;\n }\n assert(ProcessedHierarchyNode.isInstancesNode(node));\n return mergeInstanceNodes(mergedNode, node);\n }\n return node;\n },\n ),\n log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (mm) => `created a merge map of size ${mm.size}` }),\n mergeMap((mm) => [...mm.values()].map((mergedNode) => defer(() => getNodes(mergedNode)))),\n mergeAll(),\n map((n): ProcessedHierarchyNode => n),\n ),\n );\n\n return merge(\n withoutFlag.pipe(\n log({\n category: LOGGING_NAMESPACE,\n message: /* c8 ignore next */ (n) => `${createNodeIdentifierForLogging(n)} doesn't need hide, return the node`,\n }),\n ),\n stopOnFirstChild\n ? concat(\n // a small hack to handle situation when we're here to only check if parent node has children and one of them has `hideIfNoChildren` flag\n // with a `hasChildren = true` - we just return the hidden node itself in that case to avoid digging deeper into the hierarchy\n inputNodes.pipe(\n filter(hasChildren),\n log({\n category: LOGGING_NAMESPACE,\n message: /* c8 ignore next */ (n) =>\n `\\`stopOnFirstChild = true\\` and node ${createNodeIdentifierForLogging(n)} is set to always have nodes - return the hidden node without loading children`,\n }),\n ),\n EMPTY.pipe(\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE,\n message: /* c8 ignore next */ () =>\n `\\`stopOnFirstChild = true\\` but none of the nodes had children determined to \\`true\\` - do load children`,\n }),\n ),\n ),\n withLoadedChildren,\n ).pipe(take(1))\n : withLoadedChildren,\n ).pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }));\n };\n}\n\nfunction createMergeMapKey<TNode extends { key: InstancesNodeKey | GenericNodeKey }>(node: TNode): string {\n if (HierarchyNodeKey.isGeneric(node.key)) {\n return `${node.key.source ? `${node.key.source}:` : \"\"}${node.key.id}`;\n }\n return node.key.instanceKeys[0].className;\n}\n"]}
1
+ {"version":3,"file":"HideNodesInHierarchy.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/HideNodesInHierarchy.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACpG,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,EAC9B,WAAW,EACX,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,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,8HAA8H;YAC9H,UAAU,CAAC,IAAI,CACb,MAAM,CAAC,WAAW,CAAC;YACnB,iCAAiC;YACjC,GAAG,CAAC;gBACF,QAAQ,EAAE,iBAAiB;gBAC3B,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CACb,wCAAwC,8BAA8B,CAAC,CAAC,CAAC,gFAAgF;aAC5J,CAAC,CACH,EACD,KAAK,CAAC,IAAI,CACR,QAAQ,CAAC,GAAG,EAAE;gBACZ,iCAAiC;gBACjC,KAAK,CAAC;oBACJ,QAAQ,EAAE,iBAAiB;oBAC3B,OAAO,EAAE,GAAG,EAAE,CACZ,0GAA0G;iBAC7G,CAAC,CAAC;YACL,CAAC,CAAC,CACH,EACD,kBAAkB,CACnB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACjB,CAAC,CAAC,kBAAkB,CACvB,CAAC,IAAI;QACJ,iCAAiC;QACjC,GAAG,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,8BAA8B,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAClG,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAA2D,IAAW;IAC9F,IAAI,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACzC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;IACzE,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5C,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 { concat, defer, EMPTY, filter, finalize, map, merge, mergeAll, mergeMap, take } from \"rxjs\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { HierarchyNodeKey } from \"../../HierarchyNodeKey.js\";\nimport {\n createNodeIdentifierForLogging,\n createOperatorLoggingNamespace,\n hasChildren,\n LOGGING_NAMESPACE_INTERNAL,\n} from \"../../internal/Common.js\";\nimport { doLog, log } from \"../../internal/LoggingUtils.js\";\nimport { partition } from \"../../internal/operators/Partition.js\";\nimport { reduceToMergeMapItem } from \"../../internal/operators/ReduceToMergeMap.js\";\nimport { ProcessedHierarchyNode } from \"../IModelHierarchyNode.js\";\nimport { mergeInstanceNodes } from \"../Utils.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { GenericNodeKey, InstancesNodeKey } from \"../../HierarchyNodeKey.js\";\nimport type { ProcessedGenericHierarchyNode, ProcessedInstanceHierarchyNode } from \"../IModelHierarchyNode.js\";\n\nconst OPERATOR_NAME = \"HideNodesInHierarchy\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, LOGGING_NAMESPACE_INTERNAL);\n\n/**\n * Creates an operator that hides nodes and instead returns their children if the nodes have a `hideInHierarchy` handling param.\n *\n * @internal\n */\nexport function createHideNodesInHierarchyOperator(\n getNodes: (parentNode: ProcessedHierarchyNode) => Observable<ProcessedHierarchyNode>,\n stopOnFirstChild: boolean,\n) {\n return function (nodes: Observable<ProcessedHierarchyNode>): Observable<ProcessedHierarchyNode> {\n const inputNodes = nodes.pipe(\n /* v8 ignore next -- @preserve */\n log({ category: LOGGING_NAMESPACE, message: (n) => `in: ${createNodeIdentifierForLogging(n)}` }),\n );\n const [withFlag, withoutFlag] = partition(\n inputNodes,\n (n): n is ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode =>\n (ProcessedHierarchyNode.isGeneric(n) || ProcessedHierarchyNode.isInstancesNode(n)) &&\n !!n.processingParams?.hideInHierarchy,\n );\n // Defer to create a new seed for reduce on every subscribe\n const withLoadedChildren = defer(() =>\n withFlag.pipe(\n /* v8 ignore next -- @preserve */\n log({\n category: LOGGING_NAMESPACE,\n message: (n) => `${createNodeIdentifierForLogging(n)} needs hide and needs children to be loaded`,\n }),\n filter((node) => node.children !== false),\n reduceToMergeMapItem(\n (node) => createMergeMapKey(node),\n (node, mergedNode: ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode | undefined) => {\n if (mergedNode) {\n if (ProcessedHierarchyNode.isGeneric(mergedNode)) {\n // we don't merge generic nodes, just return the first one\n return mergedNode;\n }\n assert(ProcessedHierarchyNode.isInstancesNode(node));\n return mergeInstanceNodes(mergedNode, node);\n }\n return node;\n },\n ),\n /* v8 ignore next -- @preserve */\n log({ category: LOGGING_NAMESPACE, message: (mm) => `created a merge map of size ${mm.size}` }),\n mergeMap((mm) => [...mm.values()].map((mergedNode) => defer(() => getNodes(mergedNode)))),\n mergeAll(),\n map((n): ProcessedHierarchyNode => n),\n ),\n );\n\n return merge(\n withoutFlag.pipe(\n /* v8 ignore next -- @preserve */\n log({\n category: LOGGING_NAMESPACE,\n message: (n) => `${createNodeIdentifierForLogging(n)} doesn't need hide, return the node`,\n }),\n ),\n stopOnFirstChild\n ? concat(\n // a small hack to handle situation when we're here to only check if parent node has children and one of them has `hideIfNoChildren` flag\n // with a `hasChildren = true` - we just return the hidden node itself in that case to avoid digging deeper into the hierarchy\n inputNodes.pipe(\n filter(hasChildren),\n /* v8 ignore next -- @preserve */\n log({\n category: LOGGING_NAMESPACE,\n message: (n) =>\n `\\`stopOnFirstChild = true\\` and node ${createNodeIdentifierForLogging(n)} is set to always have nodes - return the hidden node without loading children`,\n }),\n ),\n EMPTY.pipe(\n finalize(() => {\n /* v8 ignore next -- @preserve */\n doLog({\n category: LOGGING_NAMESPACE,\n message: () =>\n `\\`stopOnFirstChild = true\\` but none of the nodes had children determined to \\`true\\` - do load children`,\n });\n }),\n ),\n withLoadedChildren,\n ).pipe(take(1))\n : withLoadedChildren,\n ).pipe(\n /* v8 ignore next -- @preserve */\n log({ category: LOGGING_NAMESPACE, message: (n) => `out: ${createNodeIdentifierForLogging(n)}` }),\n );\n };\n}\n\nfunction createMergeMapKey<TNode extends { key: InstancesNodeKey | GenericNodeKey }>(node: TNode): string {\n if (HierarchyNodeKey.isGeneric(node.key)) {\n return `${node.key.source ? `${node.key.source}:` : \"\"}${node.key.id}`;\n }\n return node.key.instanceKeys[0].className;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BaseClassGrouping.d.ts","sourceRoot":"","sources":["../../../../../../src/hierarchies/imodel/operators/grouping/BaseClassGrouping.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,EAAE,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAClG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE7E,gBAAgB;AAChB,wBAAsB,6BAA6B,CACjD,cAAc,EAAE,gBAAgB,EAChC,UAAU,EAAE,mBAAmB,GAAG,SAAS,EAC3C,KAAK,EAAE,8BAA8B,EAAE,GACtC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAyBrB;AAED,gBAAgB;AAChB,wBAAsB,uCAAuC,CAC3D,KAAK,EAAE,8BAA8B,EAAE,EACvC,WAAW,EAAE,EAAE,CAAC,KAAK,EACrB,uBAAuB,EAAE,yBAAyB,GACjD,OAAO,CAAC,qBAAqB,CAAC,CA0ChC;AAsCD,gBAAgB;AAChB,wBAAsB,+BAA+B,CACnD,YAAY,EAAE,gBAAgB,GAAG,yBAAyB,EAC1D,UAAU,EAAE,mBAAmB,GAAG,SAAS,EAC3C,KAAK,EAAE,8BAA8B,EAAE,GACtC,OAAO,CAAC,eAAe,EAAE,CAAC,CAG5B"}
1
+ {"version":3,"file":"BaseClassGrouping.d.ts","sourceRoot":"","sources":["../../../../../../src/hierarchies/imodel/operators/grouping/BaseClassGrouping.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,EAAE,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAClG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE7E,gBAAgB;AAChB,wBAAsB,6BAA6B,CACjD,cAAc,EAAE,gBAAgB,EAChC,UAAU,EAAE,mBAAmB,GAAG,SAAS,EAC3C,KAAK,EAAE,8BAA8B,EAAE,GACtC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CA6BrB;AAED,gBAAgB;AAChB,wBAAsB,uCAAuC,CAC3D,KAAK,EAAE,8BAA8B,EAAE,EACvC,WAAW,EAAE,EAAE,CAAC,KAAK,EACrB,uBAAuB,EAAE,yBAAyB,GACjD,OAAO,CAAC,qBAAqB,CAAC,CA4ChC;AAsCD,gBAAgB;AAChB,wBAAsB,+BAA+B,CACnD,YAAY,EAAE,gBAAgB,GAAG,yBAAyB,EAC1D,UAAU,EAAE,mBAAmB,GAAG,SAAS,EAC3C,KAAK,EAAE,8BAA8B,EAAE,GACtC,OAAO,CAAC,eAAe,EAAE,CAAC,CAK5B"}
@@ -3,7 +3,7 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import { SortedArray } from "@itwin/core-bentley";
6
- import { compareFullClassNames, createMainThreadReleaseOnTimePassedHandler, getClass } from "@itwin/presentation-shared";
6
+ import { compareFullClassNames, createMainThreadReleaseOnTimePassedHandler, getClass, } from "@itwin/presentation-shared";
7
7
  import { HierarchyNode } from "../../../HierarchyNode.js";
8
8
  /** @internal */
9
9
  export async function getBaseClassGroupingECClasses(schemaProvider, parentNode, nodes) {
@@ -44,8 +44,9 @@ export async function createBaseClassGroupsForSingleBaseClass(nodes, baseECClass
44
44
  }
45
45
  const fullCurrentNodeClassName = node.key.instanceKeys[0].className;
46
46
  const baseCheckerResult = classHierarchyInspector.classDerivesFrom(fullCurrentNodeClassName, baseClassFullName);
47
- /* c8 ignore next */
48
- const isCurrentNodeClassOfBase = baseCheckerResult instanceof Promise ? await baseCheckerResult : baseCheckerResult;
47
+ const isCurrentNodeClassOfBase = baseCheckerResult instanceof Promise
48
+ ? await baseCheckerResult
49
+ : /* v8 ignore next -- @preserve */ baseCheckerResult;
49
50
  if (isCurrentNodeClassOfBase) {
50
51
  groupedNodes.push(node);
51
52
  }
@@ -55,10 +56,7 @@ export async function createBaseClassGroupsForSingleBaseClass(nodes, baseECClass
55
56
  }
56
57
  const result = { grouped: [], ungrouped: ungroupedNodes, groupingType: "base-class" };
57
58
  if (groupedNodes.length > 0) {
58
- const groupingNodeKey = {
59
- type: "class-grouping",
60
- className: baseClassFullName,
61
- };
59
+ const groupingNodeKey = { type: "class-grouping", className: baseClassFullName };
62
60
  result.grouped.push({
63
61
  label: baseECClass.label ?? baseECClass.name,
64
62
  key: groupingNodeKey,
@@ -1 +1 @@
1
- {"version":3,"file":"BaseClassGrouping.js","sourceRoot":"","sources":["../../../../../../src/hierarchies/imodel/operators/grouping/BaseClassGrouping.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,0CAA0C,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACzH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAQ1D,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,6BAA6B,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AAC","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 { SortedArray } from \"@itwin/core-bentley\";\nimport { compareFullClassNames, createMainThreadReleaseOnTimePassedHandler, getClass } from \"@itwin/presentation-shared\";\nimport { HierarchyNode } from \"../../../HierarchyNode.js\";\n\nimport type { EC, ECClassHierarchyInspector, ECSchemaProvider } from \"@itwin/presentation-shared\";\nimport type { ParentHierarchyNode } from \"../../../HierarchyNode.js\";\nimport type { ClassGroupingNodeKey } from \"../../../HierarchyNodeKey.js\";\nimport type { ProcessedInstanceHierarchyNode } from \"../../IModelHierarchyNode.js\";\nimport type { GroupingHandler, GroupingHandlerResult } from \"../Grouping.js\";\n\n/** @internal */\nexport async function getBaseClassGroupingECClasses(\n schemaProvider: ECSchemaProvider,\n parentNode: ParentHierarchyNode | undefined,\n nodes: ProcessedInstanceHierarchyNode[],\n): Promise<EC.Class[]> {\n // Get all base class names that are provided in the grouping information\n const baseClassesFullClassNames = await getGroupingBaseClassNames(nodes);\n if (baseClassesFullClassNames.length === 0) {\n return [];\n }\n\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n const baseClasses = [];\n for (const fullName of baseClassesFullClassNames) {\n await releaseMainThread();\n baseClasses.push(await getClass(schemaProvider, fullName));\n }\n const sortedClasses = await sortByBaseClass(baseClasses.filter((baseClass) => baseClass.isRelationshipClass() || baseClass.isEntityClass()));\n\n if (parentNode && HierarchyNode.isClassGroupingNode(parentNode)) {\n // if we have a class grouping node, we can cut the front of sortedClasses up to a point where our grouping class is\n const cutPosition = sortedClasses.findIndex((c) => compareFullClassNames(c.fullName, parentNode.key.className) === 0);\n if (cutPosition >= 0) {\n return sortedClasses.slice(cutPosition + 1);\n }\n return [];\n }\n\n return sortedClasses;\n}\n\n/** @internal */\nexport async function createBaseClassGroupsForSingleBaseClass(\n nodes: ProcessedInstanceHierarchyNode[],\n baseECClass: EC.Class,\n classHierarchyInspector: ECClassHierarchyInspector,\n): Promise<GroupingHandlerResult> {\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n const groupedNodes = new Array<ProcessedInstanceHierarchyNode>();\n const ungroupedNodes = new Array<ProcessedInstanceHierarchyNode>();\n const baseClassFullName = baseECClass.fullName;\n for (const node of nodes) {\n await releaseMainThread();\n if (\n !node.processingParams?.grouping?.byBaseClasses ||\n !node.processingParams.grouping.byBaseClasses.fullClassNames.some((className) => compareFullClassNames(className, baseClassFullName) === 0)\n ) {\n ungroupedNodes.push(node);\n continue;\n }\n const fullCurrentNodeClassName = node.key.instanceKeys[0].className;\n\n const baseCheckerResult = classHierarchyInspector.classDerivesFrom(fullCurrentNodeClassName, baseClassFullName);\n /* c8 ignore next */\n const isCurrentNodeClassOfBase = baseCheckerResult instanceof Promise ? await baseCheckerResult : baseCheckerResult;\n\n if (isCurrentNodeClassOfBase) {\n groupedNodes.push(node);\n } else {\n ungroupedNodes.push(node);\n }\n }\n\n const result: GroupingHandlerResult = { grouped: [], ungrouped: ungroupedNodes, groupingType: \"base-class\" };\n if (groupedNodes.length > 0) {\n const groupingNodeKey: ClassGroupingNodeKey = {\n type: \"class-grouping\",\n className: baseClassFullName,\n };\n result.grouped.push({\n label: baseECClass.label ?? baseECClass.name,\n key: groupingNodeKey,\n parentKeys: [...groupedNodes[0].parentKeys],\n groupedInstanceKeys: groupedNodes.flatMap((groupedInstanceNode) => groupedInstanceNode.key.instanceKeys),\n children: groupedNodes.map((gn) => Object.assign(gn, { parentKeys: [...gn.parentKeys, groupingNodeKey] })),\n });\n }\n return result;\n}\n\nasync function getGroupingBaseClassNames(nodes: ProcessedInstanceHierarchyNode[]) {\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n const baseClasses = new SortedArray<EC.FullClassName>(compareFullClassNames, false);\n for (const node of nodes) {\n await releaseMainThread();\n if (node.processingParams?.grouping?.byBaseClasses) {\n for (const className of node.processingParams.grouping.byBaseClasses.fullClassNames) {\n baseClasses.insert(className);\n }\n }\n }\n return baseClasses;\n}\n\nasync function sortByBaseClass(classes: EC.Class[]): Promise<EC.Class[]> {\n if (classes.length === 0) {\n return classes;\n }\n const output: EC.Class[] = [classes[0]];\n for (let inputIndex = 1; inputIndex < classes.length; ++inputIndex) {\n let wasAdded = false;\n for (let outputIndex = output.length - 1; outputIndex >= 0; --outputIndex) {\n if (await classes[inputIndex].is(output[outputIndex])) {\n output.splice(outputIndex + 1, 0, classes[inputIndex]);\n wasAdded = true;\n break;\n }\n }\n if (!wasAdded) {\n output.splice(0, 0, classes[inputIndex]);\n }\n }\n\n return output;\n}\n\n/** @internal */\nexport async function createBaseClassGroupingHandlers(\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector,\n parentNode: ParentHierarchyNode | undefined,\n nodes: ProcessedInstanceHierarchyNode[],\n): Promise<GroupingHandler[]> {\n const baseClassGroupingECClasses = await getBaseClassGroupingECClasses(imodelAccess, parentNode, nodes);\n return baseClassGroupingECClasses.map((baseECClass) => async (allNodes) => createBaseClassGroupsForSingleBaseClass(allNodes, baseECClass, imodelAccess));\n}\n"]}
1
+ {"version":3,"file":"BaseClassGrouping.js","sourceRoot":"","sources":["../../../../../../src/hierarchies/imodel/operators/grouping/BaseClassGrouping.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EACL,qBAAqB,EACrB,0CAA0C,EAC1C,QAAQ,GACT,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAQ1D,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,cAAgC,EAChC,UAA2C,EAC3C,KAAuC;IAEvC,yEAAyE;IACzE,MAAM,yBAAyB,GAAG,MAAM,yBAAyB,CAAC,KAAK,CAAC,CAAC;IACzE,IAAI,yBAAyB,C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CAAC,CAAC;IACxC,KAAK,IAAI,UAAU,GAAG,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,UAAU,EAAE,CAAC;QACnE,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,KAAK,IAAI,WAAW,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,WAAW,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,CAAC;YAC1E,IAAI,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;gBACtD,MAAM,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;gBACvD,QAAQ,GAAG,IAAI,CAAC;gBAChB,MAAM;YACR,CAAC;QACH,CAAC;QACD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,YAA0D,EAC1D,UAA2C,EAC3C,KAAuC;IAEvC,MAAM,0BAA0B,GAAG,MAAM,6BAA6B,CAAC,YAAY,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACxG,OAAO,0BAA0B,CAAC,GAAG,CACnC,CAAC,WAAW,EAAE,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,uCAAuC,CAAC,QAAQ,EAAE,WAAW,EAAE,YAAY,CAAC,CAClH,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 { SortedArray } from \"@itwin/core-bentley\";\nimport {\n compareFullClassNames,\n createMainThreadReleaseOnTimePassedHandler,\n getClass,\n} from \"@itwin/presentation-shared\";\nimport { HierarchyNode } from \"../../../HierarchyNode.js\";\n\nimport type { EC, ECClassHierarchyInspector, ECSchemaProvider } from \"@itwin/presentation-shared\";\nimport type { ParentHierarchyNode } from \"../../../HierarchyNode.js\";\nimport type { ClassGroupingNodeKey } from \"../../../HierarchyNodeKey.js\";\nimport type { ProcessedInstanceHierarchyNode } from \"../../IModelHierarchyNode.js\";\nimport type { GroupingHandler, GroupingHandlerResult } from \"../Grouping.js\";\n\n/** @internal */\nexport async function getBaseClassGroupingECClasses(\n schemaProvider: ECSchemaProvider,\n parentNode: ParentHierarchyNode | undefined,\n nodes: ProcessedInstanceHierarchyNode[],\n): Promise<EC.Class[]> {\n // Get all base class names that are provided in the grouping information\n const baseClassesFullClassNames = await getGroupingBaseClassNames(nodes);\n if (baseClassesFullClassNames.length === 0) {\n return [];\n }\n\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n const baseClasses = [];\n for (const fullName of baseClassesFullClassNames) {\n await releaseMainThread();\n baseClasses.push(await getClass(schemaProvider, fullName));\n }\n const sortedClasses = await sortByBaseClass(\n baseClasses.filter((baseClass) => baseClass.isRelationshipClass() || baseClass.isEntityClass()),\n );\n\n if (parentNode && HierarchyNode.isClassGroupingNode(parentNode)) {\n // if we have a class grouping node, we can cut the front of sortedClasses up to a point where our grouping class is\n const cutPosition = sortedClasses.findIndex(\n (c) => compareFullClassNames(c.fullName, parentNode.key.className) === 0,\n );\n if (cutPosition >= 0) {\n return sortedClasses.slice(cutPosition + 1);\n }\n return [];\n }\n\n return sortedClasses;\n}\n\n/** @internal */\nexport async function createBaseClassGroupsForSingleBaseClass(\n nodes: ProcessedInstanceHierarchyNode[],\n baseECClass: EC.Class,\n classHierarchyInspector: ECClassHierarchyInspector,\n): Promise<GroupingHandlerResult> {\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n const groupedNodes = new Array<ProcessedInstanceHierarchyNode>();\n const ungroupedNodes = new Array<ProcessedInstanceHierarchyNode>();\n const baseClassFullName = baseECClass.fullName;\n for (const node of nodes) {\n await releaseMainThread();\n if (\n !node.processingParams?.grouping?.byBaseClasses ||\n !node.processingParams.grouping.byBaseClasses.fullClassNames.some(\n (className) => compareFullClassNames(className, baseClassFullName) === 0,\n )\n ) {\n ungroupedNodes.push(node);\n continue;\n }\n const fullCurrentNodeClassName = node.key.instanceKeys[0].className;\n\n const baseCheckerResult = classHierarchyInspector.classDerivesFrom(fullCurrentNodeClassName, baseClassFullName);\n\n const isCurrentNodeClassOfBase =\n baseCheckerResult instanceof Promise\n ? await baseCheckerResult\n : /* v8 ignore next -- @preserve */ baseCheckerResult;\n\n if (isCurrentNodeClassOfBase) {\n groupedNodes.push(node);\n } else {\n ungroupedNodes.push(node);\n }\n }\n\n const result: GroupingHandlerResult = { grouped: [], ungrouped: ungroupedNodes, groupingType: \"base-class\" };\n if (groupedNodes.length > 0) {\n const groupingNodeKey: ClassGroupingNodeKey = { type: \"class-grouping\", className: baseClassFullName };\n result.grouped.push({\n label: baseECClass.label ?? baseECClass.name,\n key: groupingNodeKey,\n parentKeys: [...groupedNodes[0].parentKeys],\n groupedInstanceKeys: groupedNodes.flatMap((groupedInstanceNode) => groupedInstanceNode.key.instanceKeys),\n children: groupedNodes.map((gn) => Object.assign(gn, { parentKeys: [...gn.parentKeys, groupingNodeKey] })),\n });\n }\n return result;\n}\n\nasync function getGroupingBaseClassNames(nodes: ProcessedInstanceHierarchyNode[]) {\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n const baseClasses = new SortedArray<EC.FullClassName>(compareFullClassNames, false);\n for (const node of nodes) {\n await releaseMainThread();\n if (node.processingParams?.grouping?.byBaseClasses) {\n for (const className of node.processingParams.grouping.byBaseClasses.fullClassNames) {\n baseClasses.insert(className);\n }\n }\n }\n return baseClasses;\n}\n\nasync function sortByBaseClass(classes: EC.Class[]): Promise<EC.Class[]> {\n if (classes.length === 0) {\n return classes;\n }\n const output: EC.Class[] = [classes[0]];\n for (let inputIndex = 1; inputIndex < classes.length; ++inputIndex) {\n let wasAdded = false;\n for (let outputIndex = output.length - 1; outputIndex >= 0; --outputIndex) {\n if (await classes[inputIndex].is(output[outputIndex])) {\n output.splice(outputIndex + 1, 0, classes[inputIndex]);\n wasAdded = true;\n break;\n }\n }\n if (!wasAdded) {\n output.splice(0, 0, classes[inputIndex]);\n }\n }\n\n return output;\n}\n\n/** @internal */\nexport async function createBaseClassGroupingHandlers(\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector,\n parentNode: ParentHierarchyNode | undefined,\n nodes: ProcessedInstanceHierarchyNode[],\n): Promise<GroupingHandler[]> {\n const baseClassGroupingECClasses = await getBaseClassGroupingECClasses(imodelAccess, parentNode, nodes);\n return baseClassGroupingECClasses.map(\n (baseECClass) => async (allNodes) => createBaseClassGroupsForSingleBaseClass(allNodes, baseECClass, imodelAccess),\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ClassGrouping.d.ts","sourceRoot":"","sources":["../../../../../../src/hierarchies/imodel/operators/grouping/ClassGrouping.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAM,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,KAAK,EAAE,qBAAqB,EAA2C,MAAM,gBAAgB,CAAC;AAarG,gBAAgB;AAChB,wBAAsB,iBAAiB,CACrC,cAAc,EAAE,gBAAgB,EAChC,UAAU,EAAE,mBAAmB,GAAG,SAAS,EAC3C,KAAK,EAAE,8BAA8B,EAAE,GACtC,OAAO,CAAC,qBAAqB,CAAC,CA0BhC"}
1
+ {"version":3,"file":"ClassGrouping.d.ts","sourceRoot":"","sources":["../../../../../../src/hierarchies/imodel/operators/grouping/ClassGrouping.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAM,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,KAAK,EAAE,qBAAqB,EAA2C,MAAM,gBAAgB,CAAC;AAarG,gBAAgB;AAChB,wBAAsB,iBAAiB,CACrC,cAAc,EAAE,gBAAgB,EAChC,UAAU,EAAE,mBAAmB,GAAG,SAAS,EAC3C,KAAK,EAAE,8BAA8B,EAAE,GACtC,OAAO,CAAC,qBAAqB,CAAC,CA6BhC"}