@itwin/presentation-hierarchies 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +4 -4
  3. package/lib/cjs/hierarchies/HierarchyDefinition.js +2 -2
  4. package/lib/cjs/hierarchies/HierarchyDefinition.js.map +1 -1
  5. package/lib/cjs/hierarchies/HierarchyNode.d.ts +3 -3
  6. package/lib/cjs/hierarchies/HierarchyNode.d.ts.map +1 -1
  7. package/lib/cjs/hierarchies/HierarchyNode.js.map +1 -1
  8. package/lib/cjs/hierarchies/HierarchyProvider.d.ts +11 -1
  9. package/lib/cjs/hierarchies/HierarchyProvider.d.ts.map +1 -1
  10. package/lib/cjs/hierarchies/HierarchyProvider.js +33 -19
  11. package/lib/cjs/hierarchies/HierarchyProvider.js.map +1 -1
  12. package/lib/cjs/hierarchies/LimitingECSqlQueryExecutor.d.ts.map +1 -1
  13. package/lib/cjs/hierarchies/LimitingECSqlQueryExecutor.js +33 -13
  14. package/lib/cjs/hierarchies/LimitingECSqlQueryExecutor.js.map +1 -1
  15. package/lib/cjs/hierarchies/Logging.js +2 -3
  16. package/lib/cjs/hierarchies/Logging.js.map +1 -1
  17. package/lib/cjs/hierarchies/NodeSelectQueryFactory.d.ts +14 -2
  18. package/lib/cjs/hierarchies/NodeSelectQueryFactory.d.ts.map +1 -1
  19. package/lib/cjs/hierarchies/NodeSelectQueryFactory.js +7 -7
  20. package/lib/cjs/hierarchies/NodeSelectQueryFactory.js.map +1 -1
  21. package/lib/cjs/hierarchies/internal/ChildNodeObservablesCache.d.ts.map +1 -1
  22. package/lib/cjs/hierarchies/internal/ChildNodeObservablesCache.js +3 -3
  23. package/lib/cjs/hierarchies/internal/ChildNodeObservablesCache.js.map +1 -1
  24. package/lib/cjs/hierarchies/internal/Common.d.ts +25 -5
  25. package/lib/cjs/hierarchies/internal/Common.d.ts.map +1 -1
  26. package/lib/cjs/hierarchies/internal/Common.js +41 -21
  27. package/lib/cjs/hierarchies/internal/Common.js.map +1 -1
  28. package/lib/cjs/hierarchies/internal/EachValueFrom.js +1 -2
  29. package/lib/cjs/hierarchies/internal/EachValueFrom.js.map +1 -1
  30. package/lib/cjs/hierarchies/internal/FilteringHierarchyDefinition.d.ts +5 -4
  31. package/lib/cjs/hierarchies/internal/FilteringHierarchyDefinition.d.ts.map +1 -1
  32. package/lib/cjs/hierarchies/internal/FilteringHierarchyDefinition.js +29 -24
  33. package/lib/cjs/hierarchies/internal/FilteringHierarchyDefinition.js.map +1 -1
  34. package/lib/cjs/hierarchies/internal/LoggingUtils.d.ts +1 -3
  35. package/lib/cjs/hierarchies/internal/LoggingUtils.d.ts.map +1 -1
  36. package/lib/cjs/hierarchies/internal/LoggingUtils.js +2 -21
  37. package/lib/cjs/hierarchies/internal/LoggingUtils.js.map +1 -1
  38. package/lib/cjs/hierarchies/internal/TreeNodesReader.js +2 -3
  39. package/lib/cjs/hierarchies/internal/TreeNodesReader.js.map +1 -1
  40. package/lib/cjs/hierarchies/internal/operators/DetermineChildren.d.ts.map +1 -1
  41. package/lib/cjs/hierarchies/internal/operators/DetermineChildren.js +3 -3
  42. package/lib/cjs/hierarchies/internal/operators/DetermineChildren.js.map +1 -1
  43. package/lib/cjs/hierarchies/internal/operators/Grouping.d.ts.map +1 -1
  44. package/lib/cjs/hierarchies/internal/operators/Grouping.js +13 -12
  45. package/lib/cjs/hierarchies/internal/operators/Grouping.js.map +1 -1
  46. package/lib/cjs/hierarchies/internal/operators/HideIfNoChildren.d.ts.map +1 -1
  47. package/lib/cjs/hierarchies/internal/operators/HideIfNoChildren.js +3 -3
  48. package/lib/cjs/hierarchies/internal/operators/HideIfNoChildren.js.map +1 -1
  49. package/lib/cjs/hierarchies/internal/operators/HideNodesInHierarchy.d.ts.map +1 -1
  50. package/lib/cjs/hierarchies/internal/operators/HideNodesInHierarchy.js +3 -3
  51. package/lib/cjs/hierarchies/internal/operators/HideNodesInHierarchy.js.map +1 -1
  52. package/lib/cjs/hierarchies/internal/operators/Partition.js +1 -2
  53. package/lib/cjs/hierarchies/internal/operators/Partition.js.map +1 -1
  54. package/lib/cjs/hierarchies/internal/operators/ReduceToMergeMap.d.ts.map +1 -1
  55. package/lib/cjs/hierarchies/internal/operators/ReduceToMergeMap.js +2 -3
  56. package/lib/cjs/hierarchies/internal/operators/ReduceToMergeMap.js.map +1 -1
  57. package/lib/cjs/hierarchies/internal/operators/ReleaseMainThread.d.ts.map +1 -1
  58. package/lib/cjs/hierarchies/internal/operators/ReleaseMainThread.js +1 -2
  59. package/lib/cjs/hierarchies/internal/operators/ReleaseMainThread.js.map +1 -1
  60. package/lib/cjs/hierarchies/internal/operators/ShareReplayWithErrors.js +1 -2
  61. package/lib/cjs/hierarchies/internal/operators/ShareReplayWithErrors.js.map +1 -1
  62. package/lib/cjs/hierarchies/internal/operators/Sorting.js +1 -2
  63. package/lib/cjs/hierarchies/internal/operators/Sorting.js.map +1 -1
  64. package/lib/cjs/hierarchies/internal/operators/TapOnce.js +1 -2
  65. package/lib/cjs/hierarchies/internal/operators/TapOnce.js.map +1 -1
  66. package/lib/cjs/hierarchies/internal/operators/grouping/AutoExpand.js +1 -2
  67. package/lib/cjs/hierarchies/internal/operators/grouping/AutoExpand.js.map +1 -1
  68. package/lib/cjs/hierarchies/internal/operators/grouping/BaseClassGrouping.js +3 -4
  69. package/lib/cjs/hierarchies/internal/operators/grouping/BaseClassGrouping.js.map +1 -1
  70. package/lib/cjs/hierarchies/internal/operators/grouping/ClassGrouping.js +1 -2
  71. package/lib/cjs/hierarchies/internal/operators/grouping/ClassGrouping.js.map +1 -1
  72. package/lib/cjs/hierarchies/internal/operators/grouping/GroupHiding.js +1 -2
  73. package/lib/cjs/hierarchies/internal/operators/grouping/GroupHiding.js.map +1 -1
  74. package/lib/cjs/hierarchies/internal/operators/grouping/LabelGrouping.js +1 -2
  75. package/lib/cjs/hierarchies/internal/operators/grouping/LabelGrouping.js.map +1 -1
  76. package/lib/cjs/hierarchies/internal/operators/grouping/PropertiesGrouping.js +7 -8
  77. package/lib/cjs/hierarchies/internal/operators/grouping/PropertiesGrouping.js.map +1 -1
  78. package/lib/cjs/hierarchies/internal/operators/grouping/Shared.js +1 -2
  79. package/lib/cjs/hierarchies/internal/operators/grouping/Shared.js.map +1 -1
  80. package/lib/esm/hierarchies/HierarchyNode.d.ts +3 -3
  81. package/lib/esm/hierarchies/HierarchyNode.d.ts.map +1 -1
  82. package/lib/esm/hierarchies/HierarchyNode.js.map +1 -1
  83. package/lib/esm/hierarchies/HierarchyProvider.d.ts +11 -1
  84. package/lib/esm/hierarchies/HierarchyProvider.d.ts.map +1 -1
  85. package/lib/esm/hierarchies/HierarchyProvider.js +34 -19
  86. package/lib/esm/hierarchies/HierarchyProvider.js.map +1 -1
  87. package/lib/esm/hierarchies/LimitingECSqlQueryExecutor.d.ts.map +1 -1
  88. package/lib/esm/hierarchies/LimitingECSqlQueryExecutor.js +35 -14
  89. package/lib/esm/hierarchies/LimitingECSqlQueryExecutor.js.map +1 -1
  90. package/lib/esm/hierarchies/NodeSelectQueryFactory.d.ts +14 -2
  91. package/lib/esm/hierarchies/NodeSelectQueryFactory.d.ts.map +1 -1
  92. package/lib/esm/hierarchies/NodeSelectQueryFactory.js +5 -5
  93. package/lib/esm/hierarchies/NodeSelectQueryFactory.js.map +1 -1
  94. package/lib/esm/hierarchies/internal/ChildNodeObservablesCache.d.ts.map +1 -1
  95. package/lib/esm/hierarchies/internal/ChildNodeObservablesCache.js +3 -3
  96. package/lib/esm/hierarchies/internal/ChildNodeObservablesCache.js.map +1 -1
  97. package/lib/esm/hierarchies/internal/Common.d.ts +25 -5
  98. package/lib/esm/hierarchies/internal/Common.d.ts.map +1 -1
  99. package/lib/esm/hierarchies/internal/Common.js +35 -15
  100. package/lib/esm/hierarchies/internal/Common.js.map +1 -1
  101. package/lib/esm/hierarchies/internal/FilteringHierarchyDefinition.d.ts +5 -4
  102. package/lib/esm/hierarchies/internal/FilteringHierarchyDefinition.d.ts.map +1 -1
  103. package/lib/esm/hierarchies/internal/FilteringHierarchyDefinition.js +27 -22
  104. package/lib/esm/hierarchies/internal/FilteringHierarchyDefinition.js.map +1 -1
  105. package/lib/esm/hierarchies/internal/LoggingUtils.d.ts +1 -3
  106. package/lib/esm/hierarchies/internal/LoggingUtils.d.ts.map +1 -1
  107. package/lib/esm/hierarchies/internal/LoggingUtils.js +0 -17
  108. package/lib/esm/hierarchies/internal/LoggingUtils.js.map +1 -1
  109. package/lib/esm/hierarchies/internal/operators/DetermineChildren.d.ts.map +1 -1
  110. package/lib/esm/hierarchies/internal/operators/DetermineChildren.js +2 -2
  111. package/lib/esm/hierarchies/internal/operators/DetermineChildren.js.map +1 -1
  112. package/lib/esm/hierarchies/internal/operators/Grouping.d.ts.map +1 -1
  113. package/lib/esm/hierarchies/internal/operators/Grouping.js +11 -10
  114. package/lib/esm/hierarchies/internal/operators/Grouping.js.map +1 -1
  115. package/lib/esm/hierarchies/internal/operators/HideIfNoChildren.d.ts.map +1 -1
  116. package/lib/esm/hierarchies/internal/operators/HideIfNoChildren.js +2 -2
  117. package/lib/esm/hierarchies/internal/operators/HideIfNoChildren.js.map +1 -1
  118. package/lib/esm/hierarchies/internal/operators/HideNodesInHierarchy.d.ts.map +1 -1
  119. package/lib/esm/hierarchies/internal/operators/HideNodesInHierarchy.js +2 -2
  120. package/lib/esm/hierarchies/internal/operators/HideNodesInHierarchy.js.map +1 -1
  121. package/lib/esm/hierarchies/internal/operators/ReduceToMergeMap.d.ts.map +1 -1
  122. package/lib/esm/hierarchies/internal/operators/ReleaseMainThread.d.ts.map +1 -1
  123. package/lib/esm/hierarchies/internal/operators/grouping/PropertiesGrouping.js +2 -2
  124. package/lib/esm/hierarchies/internal/operators/grouping/PropertiesGrouping.js.map +1 -1
  125. package/package.json +11 -11
@@ -1 +1 @@
1
- {"version":3,"file":"Grouping.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal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------------------------\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, Observable, of, reduce, tap, toArray } from \"rxjs\";\nimport { assert, StopWatch } from \"@itwin/core-bentley\";\nimport { ECClassHierarchyInspector, ECSchemaProvider, IPrimitiveValueFormatter } from \"@itwin/presentation-shared\";\nimport {\n HierarchyNode,\n ParentHierarchyNode,\n ProcessedGroupingHierarchyNode,\n ProcessedHierarchyNode,\n ProcessedInstanceHierarchyNode,\n} from \"../../HierarchyNode\";\nimport { createNodeIdentifierForLogging, createOperatorLoggingNamespace } from \"../Common\";\nimport { doLog, log } from \"../LoggingUtils\";\nimport { assignAutoExpand } from \"./grouping/AutoExpand\";\nimport { createBaseClassGroupingHandlers } from \"./grouping/BaseClassGrouping\";\nimport { createClassGroups } from \"./grouping/ClassGrouping\";\nimport { applyGroupHidingParams } from \"./grouping/GroupHiding\";\nimport { createLabelGroups } from \"./grouping/LabelGrouping\";\nimport { createPropertiesGroupingHandlers, PropertiesGroupingLocalizedStrings } from \"./grouping/PropertiesGrouping\";\nimport { releaseMainThreadOnItemsCount } from \"./ReleaseMainThread\";\nimport { tapOnce } from \"./TapOnce\";\n\nconst OPERATOR_NAME = \"Grouping\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME);\nconst PERF_LOGGING_NAMESPACE = `${LOGGING_NAMESPACE}.Performance`;\n\n/** @internal */\nexport function createGroupingOperator(\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector,\n parentNode: ParentHierarchyNode | undefined,\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\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: /* istanbul ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }),\n tapOnce(() => {\n doLog({\n category: PERF_LOGGING_NAMESPACE,\n message: /* istanbul 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: PERF_LOGGING_NAMESPACE,\n message: /* istanbul 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 // istanbul 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, onGroupingNodeCreated),\n ),\n finalize(() => {\n doLog({\n category: PERF_LOGGING_NAMESPACE,\n message: /* istanbul 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: /* istanbul 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 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: PERF_LOGGING_NAMESPACE,\n message: /* istanbul ignore next */ () => `Grouping handler ${handlerIndex} exclusively took ${timer.elapsedSeconds.toFixed(3)} s.`,\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: PERF_LOGGING_NAMESPACE,\n message: /* istanbul 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: PERF_LOGGING_NAMESPACE,\n message: /* istanbul 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.isCustom(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\n/** @internal */\nexport function 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: PERF_LOGGING_NAMESPACE,\n message: /* istanbul ignore next */ () => `Start creating grouping handlers`,\n });\n timer.start();\n },\n }),\n finalize(() => {\n doLog({\n category: PERF_LOGGING_NAMESPACE,\n message: /* istanbul 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/internal/operators/Grouping.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAmChG,wDAiEC;AAmGD,wDAqCC;AA1OD,+BAAiJ;AACjJ,sDAAwD;AAExD,uDAM6B;AAC7B,sCAKmB;AACnB,kDAA6C;AAC7C,sDAAyD;AACzD,oEAA+E;AAC/E,4DAA6D;AAC7D,wDAAgE;AAChE,4DAA6D;AAC7D,sEAAqH;AACrH,2DAAoE;AACpE,uCAAoC;AAEpC,MAAM,aAAa,GAAG,UAAU,CAAC;AACjC,gBAAgB;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E,0BAA0B,CAAC,GAAG,EAAE,CAAC,kCAAkC;aAC7E,CAAC,CAAC;YACH,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC;KACF,CAAC,EACF,IAAA,eAAQ,EAAC,GAAG,EAAE;QACZ,IAAA,oBAAK,EAAC;YACJ,QAAQ,EAAE,sCAAsC;YAChD,OAAO,EAAE,0BAA0B,CAAC,GAAG,EAAE,CAAC,mCAAmC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;SACjH,CAAC,CAAC;IACL,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAqC;IACjE,IAAI,IAAI,IAAI,6BAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;QACpD,OAAO,aAAa,CAAC,KAAK,CAAC;IAC7B,CAAC;IACD,IAAI,IAAI,IAAI,6BAAa,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC;QACvD,OAAO,aAAa,CAAC,QAAQ,CAAC;IAChC,CAAC;IACD,IAAI,IAAI,IAAI,6BAAa,CAAC,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, Observable, of, reduce, tap, toArray } from \"rxjs\";\nimport { assert, StopWatch } from \"@itwin/core-bentley\";\nimport { ECClassHierarchyInspector, ECSchemaProvider, IPrimitiveValueFormatter } from \"@itwin/presentation-shared\";\nimport {\n HierarchyNode,\n ParentHierarchyNode,\n ProcessedGroupingHierarchyNode,\n ProcessedHierarchyNode,\n ProcessedInstanceHierarchyNode,\n} from \"../../HierarchyNode\";\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} from \"../Common\";\nimport { doLog, log } from \"../LoggingUtils\";\nimport { assignAutoExpand } from \"./grouping/AutoExpand\";\nimport { createBaseClassGroupingHandlers } from \"./grouping/BaseClassGrouping\";\nimport { createClassGroups } from \"./grouping/ClassGrouping\";\nimport { applyGroupHidingParams } from \"./grouping/GroupHiding\";\nimport { createLabelGroups } from \"./grouping/LabelGrouping\";\nimport { createPropertiesGroupingHandlers, PropertiesGroupingLocalizedStrings } from \"./grouping/PropertiesGrouping\";\nimport { releaseMainThreadOnItemsCount } from \"./ReleaseMainThread\";\nimport { tapOnce } from \"./TapOnce\";\n\nconst OPERATOR_NAME = \"Grouping\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME);\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 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: /* istanbul ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }),\n tapOnce(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* istanbul 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: /* istanbul 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 // istanbul 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, onGroupingNodeCreated),\n ),\n finalize(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* istanbul 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: /* istanbul 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 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: /* istanbul ignore next */ () => `Grouping handler ${handlerIndex} exclusively took ${timer.elapsedSeconds.toFixed(3)} s.`,\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: /* istanbul 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: /* istanbul 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.isCustom(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\n/** @internal */\nexport function 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: /* istanbul ignore next */ () => `Start creating grouping handlers`,\n });\n timer.start();\n },\n }),\n finalize(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* istanbul 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 +1 @@
1
- {"version":3,"file":"HideIfNoChildren.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/HideIfNoChildren.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuC,UAAU,EAAE,MAAM,MAAM,CAAC;AACvE,OAAO,EAA+C,sBAAsB,EAAkC,MAAM,qBAAqB,CAAC;AAM1I,gBAAgB;AAChB,eAAO,MAAM,iBAAiB,QAAgD,CAAC;AAE/E;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,UAAU,CAAC,OAAO,CAAC,WACpF,WAAW,sBAAsB,CAAC,KAAG,WAAW,sBAAsB,CAAC,CAoDhG"}
1
+ {"version":3,"file":"HideIfNoChildren.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/HideIfNoChildren.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuC,UAAU,EAAE,MAAM,MAAM,CAAC;AACvE,OAAO,EAA+C,sBAAsB,EAAkC,MAAM,qBAAqB,CAAC;AAM1I,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,CAoDhG"}
@@ -4,7 +4,8 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createHideIfNoChildrenOperator = exports.LOGGING_NAMESPACE = void 0;
7
+ exports.LOGGING_NAMESPACE = void 0;
8
+ exports.createHideIfNoChildrenOperator = createHideIfNoChildrenOperator;
8
9
  const rxjs_1 = require("rxjs");
9
10
  const HierarchyNode_1 = require("../../HierarchyNode");
10
11
  const Common_1 = require("../Common");
@@ -12,7 +13,7 @@ const LoggingUtils_1 = require("../LoggingUtils");
12
13
  const Partition_1 = require("./Partition");
13
14
  const OPERATOR_NAME = "HideIfNoChildren";
14
15
  /** @internal */
15
- exports.LOGGING_NAMESPACE = (0, Common_1.createOperatorLoggingNamespace)(OPERATOR_NAME);
16
+ exports.LOGGING_NAMESPACE = (0, Common_1.createOperatorLoggingNamespace)(OPERATOR_NAME, Common_1.LOGGING_NAMESPACE_INTERNAL);
16
17
  /**
17
18
  * Creates an operator that hides nodes with no children if they have a `hideIfNoChildren` handling param.
18
19
  *
@@ -48,5 +49,4 @@ function createHideIfNoChildrenOperator(hasNodes) {
48
49
  }))).pipe((0, rxjs_1.filter)(Common_1.hasChildren))).pipe((0, LoggingUtils_1.log)({ category: exports.LOGGING_NAMESPACE, message: /* istanbul ignore next */ (n) => `out: ${(0, Common_1.createNodeIdentifierForLogging)(n)}` }));
49
50
  };
50
51
  }
51
- exports.createHideIfNoChildrenOperator = createHideIfNoChildrenOperator;
52
52
  //# sourceMappingURL=HideIfNoChildren.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HideIfNoChildren.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/HideIfNoChildren.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,+BAAuE;AACvE,uDAA0I;AAC1I,sCAAwG;AACxG,kDAA6C;AAC7C,2CAAwC;AAExC,MAAM,aAAa,GAAG,kBAAkB,CAAC;AACzC,gBAAgB;AACH,QAAA,iBAAiB,GAAG,IAAA,uCAA8B,EAAC,aAAa,CAAC,CAAC;AAE/E;;;;GAIG;AACH,SAAgB,8BAA8B,CAAC,QAA+D;IAC5G,OAAO,UAAU,KAAyC;QACxD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,IAAA,kBAAG,EAAC,EAAE,QAAQ,EAAE,yBAAiB,EAAE,OAAO,EAAE,0BAA0B,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,IAAA,uCAA8B,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAC3J,6BAA6B;QAC7B,8FAA8F;QAC9F,kEAAkE;QAClE,sEAAsE;QACtE,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC,GAAG,IAAA,qBAAS,EAC3C,UAAU,EACV,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AA4B;aAC3G,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CACrB,IAAA,kBAAG,EAAC;gBACF,QAAQ,EAAE,yBAAiB;gBAC3B,OAAO,EAAE,0BAA0B,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,GAAG,IAAA,uCAA8B,EAAC,CAAC,CAAC,0BAA0B,YAAY,EAAE;aACnI,CAAC,EACF,IAAA,UAAG,EAAC,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,EACD,IAAA,kBAAG,EAAC;YACF,QAAQ,EAAE,yBAAiB;YAC3B,OAAO,EAAE,0BAA0B,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAA,uCAA8B,EAAC,CAAC,CAAC,sCAAsC,IAAA,oBAAW,EAAC,CAAC,CAAC,EAAE;SACtI,CAAC,CACH,CACF,CAAC,IAAI,CAAC,IAAA,aAAM,EAAC,oBAAW,CAAC,CAAC,CAC5B,CAAC,IAAI,CAAC,IAAA,kBAAG,EAAC,EAAE,QAAQ,EAAE,yBAAiB,EAAE,OAAO,EAAE,0BAA0B,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,IAAA,uCAA8B,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACvI,CAAC,CAAC;AACJ,CAAC;AArDD,wEAqDC","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, Observable } from \"rxjs\";\nimport { HierarchyNode, ProcessedCustomHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode } from \"../../HierarchyNode\";\nimport { createNodeIdentifierForLogging, createOperatorLoggingNamespace, hasChildren } from \"../Common\";\nimport { doLog, log } from \"../LoggingUtils\";\nimport { partition } from \"./Partition\";\n\nconst OPERATOR_NAME = \"HideIfNoChildren\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME);\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: /* istanbul 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 ProcessedCustomHierarchyNode | ProcessedInstanceHierarchyNode =>\n (HierarchyNode.isCustom(n) || HierarchyNode.isInstancesNode(n)) && !!n.processingParams?.hideIfNoChildren,\n );\n const [determinedChildren, undeterminedChildren] = partition(needsHide, (n) => n.children !== undefined);\n return merge(\n doesntNeedHide.pipe(\n log({ category: LOGGING_NAMESPACE, message: /* istanbul ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: doesn't need hide` }),\n ),\n merge(\n determinedChildren.pipe(\n log({ category: LOGGING_NAMESPACE, message: /* istanbul ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: needs hide, has children` }),\n ),\n undeterminedChildren.pipe(\n log({ category: LOGGING_NAMESPACE, message: /* istanbul ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: needs hide, needs children` }),\n mergeMap(\n (n) =>\n defer(() => {\n doLog({\n category: LOGGING_NAMESPACE,\n message: /* istanbul ignore next */ () => `${createNodeIdentifierForLogging(n)}: requesting children flag`,\n });\n return hasNodes(n).pipe(\n log({\n category: LOGGING_NAMESPACE,\n message: /* istanbul 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: /* istanbul ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: needs hide, determined children: ${hasChildren(n)}`,\n }),\n ),\n ).pipe(filter(hasChildren)),\n ).pipe(log({ category: LOGGING_NAMESPACE, message: /* istanbul ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }));\n };\n}\n"]}
1
+ {"version":3,"file":"HideIfNoChildren.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/HideIfNoChildren.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAiBhG,wEAqDC;AApED,+BAAuE;AACvE,uDAA0I;AAC1I,sCAAoI;AACpI,kDAA6C;AAC7C,2CAAwC;AAExC,MAAM,aAAa,GAAG,kBAAkB,CAAC;AACzC,gBAAgB;AACH,QAAA,iBAAiB,GAAG,IAAA,uCAA8B,EAAC,aAAa,EAAE,mCAA0B,CAAC,CAAC;AAE3G;;;;GAIG;AACH,SAAgB,8BAA8B,CAAC,QAA+D;IAC5G,OAAO,UAAU,KAAyC;QACxD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,IAAA,kBAAG,EAAC,EAAE,QAAQ,EAAE,yBAAiB,EAAE,OAAO,EAAE,0BAA0B,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,IAAA,uCAA8B,EAAC,CA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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, Observable } from \"rxjs\";\nimport { HierarchyNode, ProcessedCustomHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode } from \"../../HierarchyNode\";\nimport { createNodeIdentifierForLogging, createOperatorLoggingNamespace, hasChildren, LOGGING_NAMESPACE_INTERNAL } from \"../Common\";\nimport { doLog, log } from \"../LoggingUtils\";\nimport { partition } from \"./Partition\";\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: /* istanbul 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 ProcessedCustomHierarchyNode | ProcessedInstanceHierarchyNode =>\n (HierarchyNode.isCustom(n) || HierarchyNode.isInstancesNode(n)) && !!n.processingParams?.hideIfNoChildren,\n );\n const [determinedChildren, undeterminedChildren] = partition(needsHide, (n) => n.children !== undefined);\n return merge(\n doesntNeedHide.pipe(\n log({ category: LOGGING_NAMESPACE, message: /* istanbul ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: doesn't need hide` }),\n ),\n merge(\n determinedChildren.pipe(\n log({ category: LOGGING_NAMESPACE, message: /* istanbul ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: needs hide, has children` }),\n ),\n undeterminedChildren.pipe(\n log({ category: LOGGING_NAMESPACE, message: /* istanbul ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: needs hide, needs children` }),\n mergeMap(\n (n) =>\n defer(() => {\n doLog({\n category: LOGGING_NAMESPACE,\n message: /* istanbul ignore next */ () => `${createNodeIdentifierForLogging(n)}: requesting children flag`,\n });\n return hasNodes(n).pipe(\n log({\n category: LOGGING_NAMESPACE,\n message: /* istanbul 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: /* istanbul ignore next */ (n) => `${createNodeIdentifierForLogging(n)}: needs hide, determined children: ${hasChildren(n)}`,\n }),\n ),\n ).pipe(filter(hasChildren)),\n ).pipe(log({ category: LOGGING_NAMESPACE, message: /* istanbul ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }));\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"HideNodesInHierarchy.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/HideNodesInHierarchy.ts"],"names":[],"mappings":"AAKA,OAAO,EAA0E,UAAU,EAAQ,MAAM,MAAM,CAAC;AAChH,OAAO,EAA+C,sBAAsB,EAAkC,MAAM,qBAAqB,CAAC;AAQ1I,gBAAgB;AAChB,eAAO,MAAM,iBAAiB,QAAgD,CAAC;AAE/E;;;;GAIG;AACH,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,CAAC,UAAU,EAAE,sBAAsB,KAAK,UAAU,CAAC,sBAAsB,CAAC,EACpF,gBAAgB,EAAE,OAAO,WAED,WAAW,sBAAsB,CAAC,KAAG,WAAW,sBAAsB,CAAC,CA2DhG"}
1
+ {"version":3,"file":"HideNodesInHierarchy.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/HideNodesInHierarchy.ts"],"names":[],"mappings":"AAKA,OAAO,EAA0E,UAAU,EAAQ,MAAM,MAAM,CAAC;AAChH,OAAO,EAA+C,sBAAsB,EAAkC,MAAM,qBAAqB,CAAC;AAQ1I,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,CA2DhG"}
@@ -4,7 +4,8 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createHideNodesInHierarchyOperator = exports.LOGGING_NAMESPACE = void 0;
7
+ exports.LOGGING_NAMESPACE = void 0;
8
+ exports.createHideNodesInHierarchyOperator = createHideNodesInHierarchyOperator;
8
9
  const rxjs_1 = require("rxjs");
9
10
  const HierarchyNode_1 = require("../../HierarchyNode");
10
11
  const Common_1 = require("../Common");
@@ -13,7 +14,7 @@ const Partition_1 = require("./Partition");
13
14
  const ReduceToMergeMap_1 = require("./ReduceToMergeMap");
14
15
  const OPERATOR_NAME = "HideNodesInHierarchy";
15
16
  /** @internal */
16
- exports.LOGGING_NAMESPACE = (0, Common_1.createOperatorLoggingNamespace)(OPERATOR_NAME);
17
+ exports.LOGGING_NAMESPACE = (0, Common_1.createOperatorLoggingNamespace)(OPERATOR_NAME, Common_1.LOGGING_NAMESPACE_INTERNAL);
17
18
  /**
18
19
  * Creates an operator that hides nodes and instead returns their children if the nodes have a `hideInHierarchy` handling param.
19
20
  *
@@ -45,7 +46,6 @@ function createHideNodesInHierarchyOperator(getNodes, stopOnFirstChild) {
45
46
  : withLoadedChildren).pipe((0, LoggingUtils_1.log)({ category: exports.LOGGING_NAMESPACE, message: /* istanbul ignore next */ (n) => `out: ${(0, Common_1.createNodeIdentifierForLogging)(n)}` }));
46
47
  };
47
48
  }
48
- exports.createHideNodesInHierarchyOperator = createHideNodesInHierarchyOperator;
49
49
  function createMergeMapKey(node) {
50
50
  if (typeof node.key === "string") {
51
51
  return node.key;
@@ -1 +1 @@
1
- {"version":3,"file":"HideNodesInHierarchy.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/HideNodesInHierarchy.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,+BAAgH;AAChH,uDAA0I;AAE1I,sCAAoH;AACpH,kDAA6C;AAC7C,2CAAwC;AACxC,yDAA0D;AAE1D,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAC7C,gBAAgB;AACH,QAAA,iBAAiB,GAAG,IAAA,uCAA8B,EAAC,aAAa,CAAC,CAAC;AAE/E;;;;GAIG;AACH,SAAgB,kCAAkC,CAChD,QAAoF,EACpF,gBAAyB;IAEzB,OAAO,UAAU,KAAyC;QACxD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,IAAA,kBAAG,EAAC,EAAE,QAAQ,EAAE,yBAAiB,EAAE,OAAO,EAAE,0BAA0B,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,IAAA,uCAA8B,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAC3J,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,qBAAS,EACvC,UAAU,EACV,CAAC,CAAC,EAAsE,EAAE,CACxE,CAAC,6BAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,6BAAa,CAAC,eAAe,CAAC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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, Observable, take } from \"rxjs\";\nimport { HierarchyNode, ProcessedCustomHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode } from \"../../HierarchyNode\";\nimport { InstancesNodeKey } from \"../../HierarchyNodeKey\";\nimport { createNodeIdentifierForLogging, createOperatorLoggingNamespace, hasChildren, mergeNodes } from \"../Common\";\nimport { doLog, log } from \"../LoggingUtils\";\nimport { partition } from \"./Partition\";\nimport { reduceToMergeMapItem } from \"./ReduceToMergeMap\";\n\nconst OPERATOR_NAME = \"HideNodesInHierarchy\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME);\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: /* istanbul ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }));\n const [withFlag, withoutFlag] = partition(\n inputNodes,\n (n): n is ProcessedCustomHierarchyNode | ProcessedInstanceHierarchyNode =>\n (HierarchyNode.isCustom(n) || HierarchyNode.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: /* istanbul 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: ProcessedCustomHierarchyNode | ProcessedInstanceHierarchyNode | undefined) => (mergedNode ? mergeNodes(mergedNode, node) : node),\n ),\n log({ category: LOGGING_NAMESPACE, message: /* istanbul 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: /* istanbul 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: /* istanbul 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: /* istanbul 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: /* istanbul ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }));\n };\n}\n\nfunction createMergeMapKey<TNode extends { key: InstancesNodeKey | string }>(node: TNode): string {\n if (typeof node.key === \"string\") {\n return node.key;\n }\n return node.key.instanceKeys[0].className;\n}\n"]}
1
+ {"version":3,"file":"HideNodesInHierarchy.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/Hide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A,uCAA8B,EAAC,CAAC,CAAC,gFAAgF;aAC5J,CAAC,CACH,EACD,YAAK,CAAC,IAAI,CACR,IAAA,eAAQ,EAAC,GAAG,EAAE,CACZ,IAAA,oBAAK,EAAC;gBACJ,QAAQ,EAAE,yBAAiB;gBAC3B,OAAO,EAAE,0BAA0B,CAAC,GAAG,EAAE,CACvC,0GAA0G;aAC7G,CAAC,CACH,CACF,EACD,kBAAkB,CACnB,CAAC,IAAI,CAAC,IAAA,WAAI,EAAC,CAAC,CAAC,CAAC;YACjB,CAAC,CAAC,kBAAkB,CACvB,CAAC,IAAI,CAAC,IAAA,kBAAG,EAAC,EAAE,QAAQ,EAAE,yBAAiB,EAAE,OAAO,EAAE,0BAA0B,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,IAAA,uCAA8B,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACvI,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAmD,IAAW;IACtF,IAAI,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,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, Observable, take } from \"rxjs\";\nimport { HierarchyNode, ProcessedCustomHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode } from \"../../HierarchyNode\";\nimport { InstancesNodeKey } from \"../../HierarchyNodeKey\";\nimport { createNodeIdentifierForLogging, createOperatorLoggingNamespace, hasChildren, LOGGING_NAMESPACE_INTERNAL, mergeNodes } from \"../Common\";\nimport { doLog, log } from \"../LoggingUtils\";\nimport { partition } from \"./Partition\";\nimport { reduceToMergeMapItem } from \"./ReduceToMergeMap\";\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: /* istanbul ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }));\n const [withFlag, withoutFlag] = partition(\n inputNodes,\n (n): n is ProcessedCustomHierarchyNode | ProcessedInstanceHierarchyNode =>\n (HierarchyNode.isCustom(n) || HierarchyNode.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: /* istanbul 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: ProcessedCustomHierarchyNode | ProcessedInstanceHierarchyNode | undefined) => (mergedNode ? mergeNodes(mergedNode, node) : node),\n ),\n log({ category: LOGGING_NAMESPACE, message: /* istanbul 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: /* istanbul 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: /* istanbul 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: /* istanbul 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: /* istanbul ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }));\n };\n}\n\nfunction createMergeMapKey<TNode extends { key: InstancesNodeKey | string }>(node: TNode): string {\n if (typeof node.key === \"string\") {\n return node.key;\n }\n return node.key.instanceKeys[0].className;\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.partition = void 0;
7
+ exports.partition = partition;
8
8
  const rxjs_1 = require("rxjs");
9
9
  const core_bentley_1 = require("@itwin/core-bentley");
10
10
  /**
@@ -57,5 +57,4 @@ function partition(source, predicate) {
57
57
  };
58
58
  }));
59
59
  }
60
- exports.partition = partition;
61
60
  //# sourceMappingURL=Partition.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Partition.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/Partition.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,+BAAsF;AACtF,sDAA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AE,UAAU,CAAC,CAAC,GAAG,CAC9B,CAAC,OAAO,EAAE,EAAE,CACV,IAAI,iBAAU,CAAC,CAAC,UAAU,EAAE,EAAE;QAC5B,MAAM,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAC1D,iBAAiB,EAAE,CAAC;QACpB,OAAO,GAAG,EAAE;YACV,mBAAmB,CAAC,WAAW,EAAE,CAAC;YAClC,qBAAqB,EAAE,CAAC;QAC1B,CAAC,CAAC;IACJ,CAAC,CAAC,CAC6B,CAAC;AACtC,CAAC;AA/CD,8BA+CC","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 { from, Observable, ObservableInput, ReplaySubject, Subscription } from \"rxjs\";\nimport { assert } from \"@itwin/core-bentley\";\n\n/** @internal */\nexport function partition<T, U extends T>(source: ObservableInput<T>, predicate: (value: T) => value is U): [Observable<U>, Observable<Exclude<T, U>>];\n/** @internal */\nexport function partition<T>(source: ObservableInput<T>, predicate: (value: T) => boolean): [Observable<T>, Observable<T>];\n\n/**\n * This is similar to `rxjs` `partition` operator, but it subscribes to source observable only once.\n * @internal\n */\nexport function partition<T>(source: ObservableInput<T>, predicate: (value: T) => boolean): [Observable<T>, Observable<T>] {\n const matches = new ReplaySubject<T>();\n const nonMatches = new ReplaySubject<T>();\n let sourceSubscription: Subscription | undefined;\n let sourceSubscriptionsCount = 0;\n function subscribeToSource() {\n if (sourceSubscriptionsCount++ > 0) {\n return;\n }\n assert(!sourceSubscription);\n sourceSubscription = from(source).subscribe({\n next(value) {\n if (predicate(value)) {\n matches.next(value);\n } else {\n nonMatches.next(value);\n }\n },\n error(error) {\n matches.error(error);\n nonMatches.error(error);\n },\n complete() {\n matches.complete();\n nonMatches.complete();\n },\n });\n }\n function unsubscribeFromSource() {\n assert(sourceSubscriptionsCount > 0);\n if (--sourceSubscriptionsCount === 0) {\n assert(!!sourceSubscription);\n sourceSubscription.unsubscribe();\n sourceSubscription = undefined;\n }\n }\n return [matches, nonMatches].map(\n (subject) =>\n new Observable((subscriber) => {\n const subjectSubscription = subject.subscribe(subscriber);\n subscribeToSource();\n return () => {\n subjectSubscription.unsubscribe();\n unsubscribeFromSource();\n };\n }),\n ) as [Observable<T>, Observable<T>];\n}\n"]}
1
+ {"version":3,"file":"Partition.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/Partition.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAchG,8BA+CC;AA3DD,+BAAsF;AACtF,sDAA6C;AAO7C;;;GAGG;AACH,SAAgB,SAAS,CAAI,MAA0B,EAAE,SAAgC;IACvF,MAAM,OAAO,GAAG,IAAI,oBAAa,EAAK,CAAC;IACvC,MAAM,UAAU,GAAG,IAAI,oBAAa,EAAK,CAAC;IAC1C,IAAI,kBAA4C,CAAC;IACjD,IAAI,wBAAwB,GAAG,CAAC,CAAC;IACjC,SAAS,iBAAiB;QACxB,IAAI,wBAAwB,EAAE,GAAG,CAAC,EAAE,CAAC;YACnC,OAAO;QACT,CAAC;QACD,IAAA,qBAAM,EAAC,CAAC,kBAAkB,CAAC,CAAC;QAC5B,kBAAkB,GAAG,IAAA,WAAI,EAAC,MAAM,CAAC,CAAC,SAAS,CAAC;YAC1C,IAAI,CAAC,KAAK;gBACR,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;oBACrB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACtB,CAAC;qBAAM,CAAC;oBACN,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC;YACD,KAAK,CAAC,KAAK;gBACT,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACrB,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC;YACD,QAAQ;gBACN,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACnB,UAAU,CAAC,QAAQ,EAAE,CAAC;YACxB,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IACD,SAAS,qBAAqB;QAC5B,IAAA,qBAAM,EAAC,wBAAwB,GAAG,CAAC,CAAC,CAAC;QACrC,IAAI,EAAE,wBAAwB,KAAK,CAAC,EAAE,CAAC;YACrC,IAAA,qBAAM,EAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC;YAC7B,kBAAkB,CAAC,WAAW,EAAE,CAAC;YACjC,kBAAkB,GAAG,SAAS,CAAC;QACjC,CAAC;IACH,CAAC;IACD,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,GAAG,CAC9B,CAAC,OAAO,EAAE,EAAE,CACV,IAAI,iBAAU,CAAC,CAAC,UAAU,EAAE,EAAE;QAC5B,MAAM,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAC1D,iBAAiB,EAAE,CAAC;QACpB,OAAO,GAAG,EAAE;YACV,mBAAmB,CAAC,WAAW,EAAE,CAAC;YAClC,qBAAqB,EAAE,CAAC;QAC1B,CAAC,CAAC;IACJ,CAAC,CAAC,CAC6B,CAAC;AACtC,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 { from, Observable, ObservableInput, ReplaySubject, Subscription } from \"rxjs\";\nimport { assert } from \"@itwin/core-bentley\";\n\n/** @internal */\nexport function partition<T, U extends T>(source: ObservableInput<T>, predicate: (value: T) => value is U): [Observable<U>, Observable<Exclude<T, U>>];\n/** @internal */\nexport function partition<T>(source: ObservableInput<T>, predicate: (value: T) => boolean): [Observable<T>, Observable<T>];\n\n/**\n * This is similar to `rxjs` `partition` operator, but it subscribes to source observable only once.\n * @internal\n */\nexport function partition<T>(source: ObservableInput<T>, predicate: (value: T) => boolean): [Observable<T>, Observable<T>] {\n const matches = new ReplaySubject<T>();\n const nonMatches = new ReplaySubject<T>();\n let sourceSubscription: Subscription | undefined;\n let sourceSubscriptionsCount = 0;\n function subscribeToSource() {\n if (sourceSubscriptionsCount++ > 0) {\n return;\n }\n assert(!sourceSubscription);\n sourceSubscription = from(source).subscribe({\n next(value) {\n if (predicate(value)) {\n matches.next(value);\n } else {\n nonMatches.next(value);\n }\n },\n error(error) {\n matches.error(error);\n nonMatches.error(error);\n },\n complete() {\n matches.complete();\n nonMatches.complete();\n },\n });\n }\n function unsubscribeFromSource() {\n assert(sourceSubscriptionsCount > 0);\n if (--sourceSubscriptionsCount === 0) {\n assert(!!sourceSubscription);\n sourceSubscription.unsubscribe();\n sourceSubscription = undefined;\n }\n }\n return [matches, nonMatches].map(\n (subject) =>\n new Observable((subscriber) => {\n const subjectSubscription = subject.subscribe(subscriber);\n subscribeToSource();\n return () => {\n subjectSubscription.unsubscribe();\n unsubscribeFromSource();\n };\n }),\n ) as [Observable<T>, Observable<T>];\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ReduceToMergeMap.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/ReduceToMergeMap.ts"],"names":[],"mappings":"AAKA,OAAO,EAAQ,eAAe,EAAU,MAAM,MAAM,CAAC;AAErD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,MAAM,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,QAAQ,gGAQrI;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,QAAQ,EACxD,GAAG,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,MAAM,EAClC,SAAS,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,GAAG,SAAS,KAAK,QAAQ,YAE/D,gBAAgB,WAAW,CAAC,sDAa7C"}
1
+ {"version":3,"file":"ReduceToMergeMap.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/ReduceToMergeMap.ts"],"names":[],"mappings":"AAKA,OAAO,EAAQ,eAAe,EAAU,MAAM,MAAM,CAAC;AAErD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,MAAM,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,QAAQ,gGAQrI;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,QAAQ,EACxD,GAAG,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,MAAM,EAClC,SAAS,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,GAAG,SAAS,KAAK,QAAQ,YAE/D,eAAe,CAAC,WAAW,CAAC,sDAa7C"}
@@ -4,7 +4,8 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.reduceToMergeMapItem = exports.reduceToMergeMapList = void 0;
7
+ exports.reduceToMergeMapList = reduceToMergeMapList;
8
+ exports.reduceToMergeMapItem = reduceToMergeMapItem;
8
9
  const rxjs_1 = require("rxjs");
9
10
  /**
10
11
  * Reduces the source observable into a `Map<string, TMapItem[]>`, where all input items are grouped based on their key
@@ -24,7 +25,6 @@ function reduceToMergeMapList(key, value) {
24
25
  return list;
25
26
  });
26
27
  }
27
- exports.reduceToMergeMapList = reduceToMergeMapList;
28
28
  /**
29
29
  * Reduces the source observable into a `Map<string, TMapItem>`, where all input items are grouped based on their key
30
30
  * and merged into a single value using provided merge function.
@@ -46,6 +46,5 @@ function reduceToMergeMapItem(key, mergeFunc) {
46
46
  return mergedMap;
47
47
  }, EMPTY_MAP));
48
48
  }
49
- exports.reduceToMergeMapItem = reduceToMergeMapItem;
50
49
  const EMPTY_MAP = new Map();
51
50
  //# sourceMappingURL=ReduceToMergeMap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReduceToMergeMap.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/ReduceToMergeMap.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,+BAAqD;AAErD;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAAwB,GAAkC,EAAE,KAAsC;IACpI,OAAO,oBAAoB,CAA0B,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QACvE,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,GAAG,EAAE,CAAC;QACZ,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AARD,oDAQC;AAED;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAClC,GAAkC,EAClC,SAA+E;IAE/E,OAAO,CAAC,MAAoC,EAAE,EAAE,CAC9C,IAAA,WAAI,EAAC,MAAM,CAAC,CAAC,IAAI,CACf,IAAA,aAAM,EAAqC,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE;QAC7D,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,6EAA6E;YAC7E,0BAA0B;YAC1B,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;QACxB,CAAC;QACD,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;QAC3B,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAClE,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,SAAS,CAAC,CACd,CAAC;AACN,CAAC;AAjBD,oDAiBC;AACD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAE,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 { from, ObservableInput, reduce } from \"rxjs\";\n\n/**\n * Reduces the source observable into a `Map<string, TMapItem[]>`, where all input items are grouped based on their key\n * and placed into arrays.\n *\n * @param key A function to calculate map key for the item.\n * @param value A function to calculate entry value for the item.\n *\n * @internal\n */\nexport function reduceToMergeMapList<TSourceItem, TMapItem>(key: (item: TSourceItem) => string, value: (item: TSourceItem) => TMapItem) {\n return reduceToMergeMapItem<TSourceItem, TMapItem[]>(key, (item, list) => {\n if (!list) {\n list = [];\n }\n list.push(value(item));\n return list;\n });\n}\n\n/**\n * Reduces the source observable into a `Map<string, TMapItem>`, where all input items are grouped based on their key\n * and merged into a single value using provided merge function.\n *\n * @param key A function to calculate map key for the item.\n * @param value A function to create map value using the _current_ item and an item already _existing_ in the map with the same key.\n *\n * @internal\n */\nexport function reduceToMergeMapItem<TSourceItem, TMapItem>(\n key: (item: TSourceItem) => string,\n mergeFunc: (sourceItem: TSourceItem, mapItem: TMapItem | undefined) => TMapItem,\n) {\n return (source: ObservableInput<TSourceItem>) =>\n from(source).pipe(\n reduce<TSourceItem, Map<string, TMapItem>>((mergedMap, item) => {\n if (mergedMap === EMPTY_MAP) {\n // this helps us avoid creating an empty map for cases when source observable\n // doesn't emit any values\n mergedMap = new Map();\n }\n const mergeKey = key(item);\n mergedMap.set(mergeKey, mergeFunc(item, mergedMap.get(mergeKey)));\n return mergedMap;\n }, EMPTY_MAP),\n );\n}\nconst EMPTY_MAP = new Map();\n"]}
1
+ {"version":3,"file":"ReduceToMergeMap.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/ReduceToMergeMap.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAahG,oDAQC;AAWD,oDAiBC;AA/CD,+BAAqD;AAErD;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAAwB,GAAkC,EAAE,KAAsC;IACpI,OAAO,oBAAoB,CAA0B,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QACvE,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,GAAG,EAAE,CAAC;QACZ,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAClC,GAAkC,EAClC,SAA+E;IAE/E,OAAO,CAAC,MAAoC,EAAE,EAAE,CAC9C,IAAA,WAAI,EAAC,MAAM,CAAC,CAAC,IAAI,CACf,IAAA,aAAM,EAAqC,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE;QAC7D,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,6EAA6E;YAC7E,0BAA0B;YAC1B,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;QACxB,CAAC;QACD,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;QAC3B,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAClE,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,SAAS,CAAC,CACd,CAAC;AACN,CAAC;AACD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAE,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 { from, ObservableInput, reduce } from \"rxjs\";\n\n/**\n * Reduces the source observable into a `Map<string, TMapItem[]>`, where all input items are grouped based on their key\n * and placed into arrays.\n *\n * @param key A function to calculate map key for the item.\n * @param value A function to calculate entry value for the item.\n *\n * @internal\n */\nexport function reduceToMergeMapList<TSourceItem, TMapItem>(key: (item: TSourceItem) => string, value: (item: TSourceItem) => TMapItem) {\n return reduceToMergeMapItem<TSourceItem, TMapItem[]>(key, (item, list) => {\n if (!list) {\n list = [];\n }\n list.push(value(item));\n return list;\n });\n}\n\n/**\n * Reduces the source observable into a `Map<string, TMapItem>`, where all input items are grouped based on their key\n * and merged into a single value using provided merge function.\n *\n * @param key A function to calculate map key for the item.\n * @param value A function to create map value using the _current_ item and an item already _existing_ in the map with the same key.\n *\n * @internal\n */\nexport function reduceToMergeMapItem<TSourceItem, TMapItem>(\n key: (item: TSourceItem) => string,\n mergeFunc: (sourceItem: TSourceItem, mapItem: TMapItem | undefined) => TMapItem,\n) {\n return (source: ObservableInput<TSourceItem>) =>\n from(source).pipe(\n reduce<TSourceItem, Map<string, TMapItem>>((mergedMap, item) => {\n if (mergedMap === EMPTY_MAP) {\n // this helps us avoid creating an empty map for cases when source observable\n // doesn't emit any values\n mergedMap = new Map();\n }\n const mergeKey = key(item);\n mergedMap.set(mergeKey, mergeFunc(item, mergedMap.get(mergeKey)));\n return mergedMap;\n }, EMPTY_MAP),\n );\n}\nconst EMPTY_MAP = new Map();\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ReleaseMainThread.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/ReleaseMainThread.ts"],"names":[],"mappings":"AAKA,OAAO,EAA4C,UAAU,EAAM,MAAM,MAAM,CAAC;AAEhF;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,SACtD,WAAW,CAAC,CAAC,KAAG,WAAW,CAAC,CAAC,CAa3C"}
1
+ {"version":3,"file":"ReleaseMainThread.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/ReleaseMainThread.ts"],"names":[],"mappings":"AAKA,OAAO,EAA4C,UAAU,EAAM,MAAM,MAAM,CAAC;AAEhF;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,SACtD,UAAU,CAAC,CAAC,CAAC,KAAG,UAAU,CAAC,CAAC,CAAC,CAa3C"}
@@ -4,7 +4,7 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.releaseMainThreadOnItemsCount = void 0;
7
+ exports.releaseMainThreadOnItemsCount = releaseMainThreadOnItemsCount;
8
8
  const rxjs_1 = require("rxjs");
9
9
  /**
10
10
  * Emits a certain amount of values, then releases the main thread for other timers to use.
@@ -21,5 +21,4 @@ function releaseMainThreadOnItemsCount(elementCount) {
21
21
  }), (0, rxjs_1.concatAll)());
22
22
  };
23
23
  }
24
- exports.releaseMainThreadOnItemsCount = releaseMainThreadOnItemsCount;
25
24
  //# sourceMappingURL=ReleaseMainThread.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReleaseMainThread.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/ReleaseMainThread.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,+BAAgF;AAEhF;;;GAGG;AACH,SAAgB,6BAA6B,CAAI,YAAoB;IACnE,OAAO,CAAC,GAAkB,EAAiB,EAAE;QAC3C,OAAO,GAAG,CAAC,IAAI,CACb,IAAA,kBAAW,EAAC,YAAY,CAAC,EACzB,IAAA,gBAAS,EAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;YACpB,MAAM,GAAG,GAAG,IAAA,SAAE,EAAC,IAAI,CAAC,CAAC;YACrB,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,YAAY,EAAE,CAAC;gBAC1C,OAAO,GAAG,CAAC;YACb,CAAC;YACD,OAAO,GAAG,CAAC,IAAI,CAAC,IAAA,YAAK,EAAC,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC,CAAC,EACF,IAAA,gBAAS,GAAE,CACZ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAdD,sEAcC","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 { bufferCount, concatAll, concatMap, delay, Observable, of } from \"rxjs\";\n\n/**\n * Emits a certain amount of values, then releases the main thread for other timers to use.\n * @internal\n */\nexport function releaseMainThreadOnItemsCount<T>(elementCount: number) {\n return (obs: Observable<T>): Observable<T> => {\n return obs.pipe(\n bufferCount(elementCount),\n concatMap((buff, i) => {\n const out = of(buff);\n if (i === 0 && buff.length < elementCount) {\n return out;\n }\n return out.pipe(delay(0));\n }),\n concatAll(),\n );\n };\n}\n"]}
1
+ {"version":3,"file":"ReleaseMainThread.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/ReleaseMainThread.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAQhG,sEAcC;AApBD,+BAAgF;AAEhF;;;GAGG;AACH,SAAgB,6BAA6B,CAAI,YAAoB;IACnE,OAAO,CAAC,GAAkB,EAAiB,EAAE;QAC3C,OAAO,GAAG,CAAC,IAAI,CACb,IAAA,kBAAW,EAAC,YAAY,CAAC,EACzB,IAAA,gBAAS,EAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;YACpB,MAAM,GAAG,GAAG,IAAA,SAAE,EAAC,IAAI,CAAC,CAAC;YACrB,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,YAAY,EAAE,CAAC;gBAC1C,OAAO,GAAG,CAAC;YACb,CAAC;YACD,OAAO,GAAG,CAAC,IAAI,CAAC,IAAA,YAAK,EAAC,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC,CAAC,EACF,IAAA,gBAAS,GAAE,CACZ,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 { bufferCount, concatAll, concatMap, delay, Observable, of } from \"rxjs\";\n\n/**\n * Emits a certain amount of values, then releases the main thread for other timers to use.\n * @internal\n */\nexport function releaseMainThreadOnItemsCount<T>(elementCount: number) {\n return (obs: Observable<T>): Observable<T> => {\n return obs.pipe(\n bufferCount(elementCount),\n concatMap((buff, i) => {\n const out = of(buff);\n if (i === 0 && buff.length < elementCount) {\n return out;\n }\n return out.pipe(delay(0));\n }),\n concatAll(),\n );\n };\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.shareReplayWithErrors = void 0;
7
+ exports.shareReplayWithErrors = shareReplayWithErrors;
8
8
  const rxjs_1 = require("rxjs");
9
9
  /**
10
10
  * This is doing exactly the same as the standard `shareReplay` from `rxjs`, except that
@@ -20,5 +20,4 @@ function shareReplayWithErrors() {
20
20
  resetOnRefCountZero: false,
21
21
  });
22
22
  }
23
- exports.shareReplayWithErrors = shareReplayWithErrors;
24
23
  //# sourceMappingURL=ShareReplayWithErrors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ShareReplayWithErrors.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/ShareReplayWithErrors.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,+BAAsE;AAEtE;;;;;GAKG;AACH,SAAgB,qBAAqB;IACnC,OAAO,IAAA,YAAK,EAAI;QACd,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,oBAAa,EAAE;QACpC,YAAY,EAAE,KAAK;QACnB,eAAe,EAAE,KAAK;QACtB,mBAAmB,EAAE,KAAK;KAC3B,CAAC,CAAC;AACL,CAAC;AAPD,sDAOC","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 { MonoTypeOperatorFunction, ReplaySubject, share } from \"rxjs\";\n\n/**\n * This is doing exactly the same as the standard `shareReplay` from `rxjs`, except that\n * source is not retried on error.\n *\n * @internal\n */\nexport function shareReplayWithErrors<T>(): MonoTypeOperatorFunction<T> {\n return share<T>({\n connector: () => new ReplaySubject(),\n resetOnError: false,\n resetOnComplete: false,\n resetOnRefCountZero: false,\n });\n}\n"]}
1
+ {"version":3,"file":"ShareReplayWithErrors.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/ShareReplayWithErrors.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAUhG,sDAOC;AAfD,+BAAsE;AAEtE;;;;;GAKG;AACH,SAAgB,qBAAqB;IACnC,OAAO,IAAA,YAAK,EAAI;QACd,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,oBAAa,EAAE;QACpC,YAAY,EAAE,KAAK;QACnB,eAAe,EAAE,KAAK;QACtB,mBAAmB,EAAE,KAAK;KAC3B,CAAC,CAAC;AACL,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 { MonoTypeOperatorFunction, ReplaySubject, share } from \"rxjs\";\n\n/**\n * This is doing exactly the same as the standard `shareReplay` from `rxjs`, except that\n * source is not retried on error.\n *\n * @internal\n */\nexport function shareReplayWithErrors<T>(): MonoTypeOperatorFunction<T> {\n return share<T>({\n connector: () => new ReplaySubject(),\n resetOnError: false,\n resetOnComplete: false,\n resetOnRefCountZero: false,\n });\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.sortNodesByLabelOperator = void 0;
7
+ exports.sortNodesByLabelOperator = sortNodesByLabelOperator;
8
8
  const rxjs_1 = require("rxjs");
9
9
  const core_bentley_1 = require("@itwin/core-bentley");
10
10
  const Common_1 = require("../Common");
@@ -22,5 +22,4 @@ function sortNodesByLabelOperator(nodes) {
22
22
  return sorted;
23
23
  }, new core_bentley_1.SortedArray(Common_1.compareNodesByLabel, core_bentley_1.DuplicatePolicy.Allow)), (0, rxjs_1.map)((sortedArray) => sortedArray.extractArray()), (0, rxjs_1.concatAll)());
24
24
  }
25
- exports.sortNodesByLabelOperator = sortNodesByLabelOperator;
26
25
  //# sourceMappingURL=Sorting.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sorting.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/Sorting.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,+BAA0D;AAC1D,sDAAmE;AAEnE,sCAAgD;AAEhD;;;;;;;GAOG;AACH,SAAgB,wBAAwB,CAAC,KAAyC;IAChF,OAAO,KAAK,CAAC,IAAI,CACf,IAAA,aAAM,EACJ,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;QACf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpB,OAAO,MAAM,CAAC;IAChB,CAAC,EACD,IAAI,0BAAW,CAAyB,4BAAmB,EAAE,8BAAe,CAAC,KAAK,CAAC,CACpF,EACD,IAAA,UAAG,EAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC,EAChD,IAAA,gBAAS,GAAE,CACZ,CAAC;AACJ,CAAC;AAZD,4DAYC","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 { concatAll, map, Observable, reduce } from \"rxjs\";\nimport { DuplicatePolicy, SortedArray } from \"@itwin/core-bentley\";\nimport { ProcessedHierarchyNode } from \"../../HierarchyNode\";\nimport { compareNodesByLabel } from \"../Common\";\n\n/**\n * This should accept sorting params in some form:\n * - is sorting disabled?\n * - are we sorting by label or some property value, in case of the latter - how do we get the value?\n *\n * @note Nodes with same labels are returned in undefined order.\n * @internal\n */\nexport function sortNodesByLabelOperator(nodes: Observable<ProcessedHierarchyNode>): Observable<ProcessedHierarchyNode> {\n return nodes.pipe(\n reduce(\n (sorted, node) => {\n sorted.insert(node);\n return sorted;\n },\n new SortedArray<ProcessedHierarchyNode>(compareNodesByLabel, DuplicatePolicy.Allow),\n ),\n map((sortedArray) => sortedArray.extractArray()),\n concatAll(),\n );\n}\n"]}
1
+ {"version":3,"file":"Sorting.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/Sorting.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAehG,4DAYC;AAzBD,+BAA0D;AAC1D,sDAAmE;AAEnE,sCAAgD;AAEhD;;;;;;;GAOG;AACH,SAAgB,wBAAwB,CAAC,KAAyC;IAChF,OAAO,KAAK,CAAC,IAAI,CACf,IAAA,aAAM,EACJ,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;QACf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpB,OAAO,MAAM,CAAC;IAChB,CAAC,EACD,IAAI,0BAAW,CAAyB,4BAAmB,EAAE,8BAAe,CAAC,KAAK,CAAC,CACpF,EACD,IAAA,UAAG,EAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC,EAChD,IAAA,gBAAS,GAAE,CACZ,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 { concatAll, map, Observable, reduce } from \"rxjs\";\nimport { DuplicatePolicy, SortedArray } from \"@itwin/core-bentley\";\nimport { ProcessedHierarchyNode } from \"../../HierarchyNode\";\nimport { compareNodesByLabel } from \"../Common\";\n\n/**\n * This should accept sorting params in some form:\n * - is sorting disabled?\n * - are we sorting by label or some property value, in case of the latter - how do we get the value?\n *\n * @note Nodes with same labels are returned in undefined order.\n * @internal\n */\nexport function sortNodesByLabelOperator(nodes: Observable<ProcessedHierarchyNode>): Observable<ProcessedHierarchyNode> {\n return nodes.pipe(\n reduce(\n (sorted, node) => {\n sorted.insert(node);\n return sorted;\n },\n new SortedArray<ProcessedHierarchyNode>(compareNodesByLabel, DuplicatePolicy.Allow),\n ),\n map((sortedArray) => sortedArray.extractArray()),\n concatAll(),\n );\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.tapOnce = void 0;
7
+ exports.tapOnce = tapOnce;
8
8
  const rxjs_1 = require("rxjs");
9
9
  /** @internal */
10
10
  function tapOnce(observer) {
@@ -16,5 +16,4 @@ function tapOnce(observer) {
16
16
  }
17
17
  }));
18
18
  }
19
- exports.tapOnce = tapOnce;
20
19
  //# sourceMappingURL=TapOnce.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TapOnce.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/TapOnce.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,+BAAqD;AAErD,gBAAgB;AAChB,SAAgB,OAAO,CAAI,QAAoB;IAC7C,IAAI,KAAK,GAAG,IAAI,CAAC;IACjB,OAAO,CAAC,MAAM,EAAE,EAAE,CAChB,MAAM,CAAC,IAAI,CACT,IAAA,UAAG,EAAC,GAAG,EAAE;QACP,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,GAAG,KAAK,CAAC;YACd,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACN,CAAC;AAXD,0BAWC","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 { MonoTypeOperatorFunction, tap } from \"rxjs\";\n\n/** @internal */\nexport function tapOnce<T>(observer: () => void): MonoTypeOperatorFunction<T> {\n let first = true;\n return (source) =>\n source.pipe(\n tap(() => {\n if (first) {\n first = false;\n observer();\n }\n }),\n );\n}\n"]}
1
+ {"version":3,"file":"TapOnce.js","sourceRoot":"","sources":["../../../../../src/hierarchies/internal/operators/TapOnce.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAKhG,0BAWC;AAdD,+BAAqD;AAErD,gBAAgB;AAChB,SAAgB,OAAO,CAAI,QAAoB;IAC7C,IAAI,KAAK,GAAG,IAAI,CAAC;IACjB,OAAO,CAAC,MAAM,EAAE,EAAE,CAChB,MAAM,CAAC,IAAI,CACT,IAAA,UAAG,EAAC,GAAG,EAAE;QACP,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,GAAG,KAAK,CAAC;YACd,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACN,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 { MonoTypeOperatorFunction, tap } from \"rxjs\";\n\n/** @internal */\nexport function tapOnce<T>(observer: () => void): MonoTypeOperatorFunction<T> {\n let first = true;\n return (source) =>\n source.pipe(\n tap(() => {\n if (first) {\n first = false;\n observer();\n }\n }),\n );\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.assignAutoExpand = void 0;
7
+ exports.assignAutoExpand = assignAutoExpand;
8
8
  const Shared_1 = require("./Shared");
9
9
  /** @internal */
10
10
  function assignAutoExpand(props) {
@@ -23,5 +23,4 @@ function assignAutoExpand(props) {
23
23
  }
24
24
  return props;
25
25
  }
26
- exports.assignAutoExpand = assignAutoExpand;
27
26
  //# sourceMappingURL=AutoExpand.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AutoExpand.js","sourceRoot":"","sources":["../../../../../../src/hierarchies/internal/operators/grouping/AutoExpand.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAIhG,qCAA0D;AAE1D,gBAAgB;AAChB,SAAgB,gBAAgB,CAAC,KAA4B;IAC3D,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACjC,IAAI,cAAuD,CAAC;QAC5D,IAAA,uCAA8B,EAAC,IAAI,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,aAAa,EAAE,EAAE;YACzE,IAAI,cAAc,KAAK,QAAQ,EAAE,CAAC;gBAChC,OAAO,IAAI,CAAC;YACd,CAAC;YACD,cAAc,GAAG,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC;YACvF,OAAO;QACT,CAAC,CAAC,CAAC;QACH,IAAI,cAAc,KAAK,QAAQ,IAAI,CAAC,cAAc,KAAK,cAAc,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;YACrG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAfD,4CAeC","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 { HierarchyNodeAutoExpandProp } from \"../../../HierarchyNode\";\nimport { GroupingHandlerResult } from \"../Grouping\";\nimport { iterateChildNodeGroupingParams } from \"./Shared\";\n\n/** @internal */\nexport function assignAutoExpand(props: GroupingHandlerResult): GroupingHandlerResult {\n for (const node of props.grouped) {\n let autoExpandProp: HierarchyNodeAutoExpandProp | undefined;\n iterateChildNodeGroupingParams(node, props.groupingType, (groupingProps) => {\n if (autoExpandProp === \"always\") {\n return true;\n }\n autoExpandProp = groupingProps?.autoExpand ? groupingProps.autoExpand : autoExpandProp;\n return;\n });\n if (autoExpandProp === \"always\" || (autoExpandProp === \"single-child\" && node.children.length === 1)) {\n node.autoExpand = true;\n }\n }\n return props;\n}\n"]}
1
+ {"version":3,"file":"AutoExpand.js","sourceRoot":"","sources":["../../../../../../src/hierarchies/internal/operators/grouping/AutoExpand.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAOhG,4CAeC;AAlBD,qCAA0D;AAE1D,gBAAgB;AAChB,SAAgB,gBAAgB,CAAC,KAA4B;IAC3D,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACjC,IAAI,cAAuD,CAAC;QAC5D,IAAA,uCAA8B,EAAC,IAAI,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,aAAa,EAAE,EAAE;YACzE,IAAI,cAAc,KAAK,QAAQ,EAAE,CAAC;gBAChC,OAAO,IAAI,CAAC;YACd,CAAC;YACD,cAAc,GAAG,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC;YACvF,OAAO;QACT,CAAC,CAAC,CAAC;QACH,IAAI,cAAc,KAAK,QAAQ,IAAI,CAAC,cAAc,KAAK,cAAc,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;YACrG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,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 { HierarchyNodeAutoExpandProp } from \"../../../HierarchyNode\";\nimport { GroupingHandlerResult } from \"../Grouping\";\nimport { iterateChildNodeGroupingParams } from \"./Shared\";\n\n/** @internal */\nexport function assignAutoExpand(props: GroupingHandlerResult): GroupingHandlerResult {\n for (const node of props.grouped) {\n let autoExpandProp: HierarchyNodeAutoExpandProp | undefined;\n iterateChildNodeGroupingParams(node, props.groupingType, (groupingProps) => {\n if (autoExpandProp === \"always\") {\n return true;\n }\n autoExpandProp = groupingProps?.autoExpand ? groupingProps.autoExpand : autoExpandProp;\n return;\n });\n if (autoExpandProp === \"always\" || (autoExpandProp === \"single-child\" && node.children.length === 1)) {\n node.autoExpand = true;\n }\n }\n return props;\n}\n"]}
@@ -4,7 +4,9 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createBaseClassGroupingHandlers = exports.createBaseClassGroupsForSingleBaseClass = exports.getBaseClassGroupingECClasses = void 0;
7
+ exports.getBaseClassGroupingECClasses = getBaseClassGroupingECClasses;
8
+ exports.createBaseClassGroupsForSingleBaseClass = createBaseClassGroupsForSingleBaseClass;
9
+ exports.createBaseClassGroupingHandlers = createBaseClassGroupingHandlers;
8
10
  const presentation_shared_1 = require("@itwin/presentation-shared");
9
11
  const HierarchyNode_1 = require("../../../HierarchyNode");
10
12
  /** @internal */
@@ -31,7 +33,6 @@ async function getBaseClassGroupingECClasses(schemaProvider, parentNode, nodes)
31
33
  }
32
34
  return sortedClasses;
33
35
  }
34
- exports.getBaseClassGroupingECClasses = getBaseClassGroupingECClasses;
35
36
  /** @internal */
36
37
  async function createBaseClassGroupsForSingleBaseClass(nodes, baseECClass, classHierarchyInspector) {
37
38
  const releaseMainThread = (0, presentation_shared_1.createMainThreadReleaseOnTimePassedHandler)();
@@ -72,7 +73,6 @@ async function createBaseClassGroupsForSingleBaseClass(nodes, baseECClass, class
72
73
  }
73
74
  return result;
74
75
  }
75
- exports.createBaseClassGroupsForSingleBaseClass = createBaseClassGroupsForSingleBaseClass;
76
76
  async function getGroupingBaseClassNames(nodes) {
77
77
  const releaseMainThread = (0, presentation_shared_1.createMainThreadReleaseOnTimePassedHandler)();
78
78
  const baseClasses = new Set();
@@ -111,5 +111,4 @@ async function createBaseClassGroupingHandlers(imodelAccess, parentNode, nodes)
111
111
  const baseClassGroupingECClasses = await getBaseClassGroupingECClasses(imodelAccess, parentNode, nodes);
112
112
  return baseClassGroupingECClasses.map((baseECClass) => async (allNodes) => createBaseClassGroupsForSingleBaseClass(allNodes, baseECClass, imodelAccess));
113
113
  }
114
- exports.createBaseClassGroupingHandlers = createBaseClassGroupingHandlers;
115
114
  //# sourceMappingURL=BaseClassGrouping.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseClassGrouping.js","sourceRoot":"","sources":["../../../../../../src/hierarchies/internal/operators/grouping/BaseClassGrouping.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,oEAAmJ;AACnJ,0DAA4G;AAI5G,gBAAgB;AACT,KAAK,UAAU,6BAA6B,CACjD,cAAgC,EAChC,UAA2C,EAC3C,KAAuC;IAEvC,yEAAyE;IACzE,MAAM,yBAAyB,GAAG,MAAM,yBAAyB,CAAC,KAAK,CAAC,CAAC;IACzE,IAAI,yBAAyB,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACzC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,iBAAiB,GAAG,IAAA,gEAA0C,GAAE,CAAC;IACvE,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,KAAK,MAAM,QAAQ,IAAI,yBAAyB,EAAE,CAAC;QACjD,MAAM,iBAAiB,EAAE,CAAC;QAC1B,WAAW,CAAC,IAAI,CAAC,MAAM,IAAA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M,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;AACT,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,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,uCAAuC,CAAC,QAAQ,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;AAC3J,CAAC;AAPD,0EAOC","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 { createMainThreadReleaseOnTimePassedHandler, EC, ECClassHierarchyInspector, ECSchemaProvider, getClass } from \"@itwin/presentation-shared\";\nimport { HierarchyNode, ParentHierarchyNode, ProcessedInstanceHierarchyNode } from \"../../../HierarchyNode\";\nimport { ClassGroupingNodeKey } from \"../../../HierarchyNodeKey\";\nimport { GroupingHandler, GroupingHandlerResult } from \"../Grouping\";\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.size === 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) => c.fullName === parentNode.key.className);\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) => className === baseClassFullName)\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 // istanbul 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 Set<string>();\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.add(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/internal/operators/grouping/BaseClassGrouping.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAQhG,sEA6BC;AAGD,0FA8CC;AAuCD,0EAOC;AAlID,oEAAmJ;AACnJ,0DAA4G;AAI5G,gBAAgB;AACT,KAAK,UAAU,6BAA6B,CACjD,cAAgC,EAChC,UAA2C,EAC3C,KAAuC;IAEvC,yEAAyE;IACzE,MAAM,yBAAyB,GAAG,MAAM,yBAAyB,CAAC,KAAK,CAAC,CAAC;IACzE,IAAI,yBAAyB,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACzC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,iBAAiB,GAAG,IAAA,gEAA0C,GAAE,CAAC;IACvE,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,KAAK,MAAM,QAAQ,IAAI,yBAAyB,EAAE,CAAC;QACjD,MAAM,iBAAiB,EAAE,CAAC;QAC1B,WAAW,CAAC,IAAI,CAAC,MAAM,IAAA,8BAAQ,EAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC7D,CAAC;IACD,MAAM,aAAa,GAAG,MAAM,eAAe,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,mBAAmB,EAAE,IAAI,SAAS,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;IAE7I,IAAI,UAAU,IAAI,6BAAa,CAAC,mBAAmB,CAAC,UAAU,CAAC,EAAE,CAAC;QAChE,oHAAoH;QACpH,MAAM,WAAW,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC5F,IAAI,WAAW,IAAI,CAAC,EAAE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EAAE,KAAK,CAAC,CAAC;IACxG,OAAO,0BAA0B,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,uCAAuC,CAAC,QAAQ,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;AAC3J,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 { createMainThreadReleaseOnTimePassedHandler, EC, ECClassHierarchyInspector, ECSchemaProvider, getClass } from \"@itwin/presentation-shared\";\nimport { HierarchyNode, ParentHierarchyNode, ProcessedInstanceHierarchyNode } from \"../../../HierarchyNode\";\nimport { ClassGroupingNodeKey } from \"../../../HierarchyNodeKey\";\nimport { GroupingHandler, GroupingHandlerResult } from \"../Grouping\";\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.size === 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) => c.fullName === parentNode.key.className);\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) => className === baseClassFullName)\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 // istanbul 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 Set<string>();\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.add(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"]}
@@ -4,7 +4,7 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createClassGroups = void 0;
7
+ exports.createClassGroups = createClassGroups;
8
8
  const presentation_shared_1 = require("@itwin/presentation-shared");
9
9
  const HierarchyNode_1 = require("../../../HierarchyNode");
10
10
  /** @internal */
@@ -32,7 +32,6 @@ async function createClassGroups(schemaProvider, parentNode, nodes) {
32
32
  }
33
33
  return createGroupingNodes(groupings);
34
34
  }
35
- exports.createClassGroups = createClassGroups;
36
35
  async function createGroupingNodes(groupings) {
37
36
  const groupedNodes = new Array();
38
37
  const releaseMainThread = (0, presentation_shared_1.createMainThreadReleaseOnTimePassedHandler)();