@itwin/presentation-hierarchies 2.0.0-alpha.8 → 2.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/lib/cjs/hierarchies/HierarchySearch.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchySearch.js +0 -2
- package/lib/cjs/hierarchies/HierarchySearch.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts +5 -3
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.d.ts +2 -2
- package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js +98 -39
- package/lib/cjs/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.js +1 -1
- package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.js.map +1 -1
- package/lib/esm/hierarchies/HierarchySearch.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchySearch.js +0 -2
- package/lib/esm/hierarchies/HierarchySearch.js.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts +5 -3
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyDefinition.js.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
- package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.d.ts +2 -2
- package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js +98 -39
- package/lib/esm/hierarchies/imodel/NodeSelectQueryFactory.js.map +1 -1
- package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.js +1 -1
- package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @itwin/presentation-hierarchies
|
|
2
2
|
|
|
3
|
+
## 2.0.0-alpha.9
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#1150](https://github.com/iTwin/presentation/pull/1150): Support creating ECSQL query definitions based on instance filters, containing schema items that don't exist in the _current_ iModel.
|
|
8
|
+
|
|
9
|
+
To support that, the `NodesQueryClauseFactory` created by `createNodesQueryClauseFactory` returns a query-disabling result when it encounters such schema items. To ensure that's possible,
|
|
10
|
+
the `createNodesQueryClauseFactory` function should be called with `imodelAccess` that is passed to `HierarchyDefinition.defineHierarchyLevel`.
|
|
11
|
+
|
|
12
|
+
**Breaking changes:**
|
|
13
|
+
- `DefineHierarchyLevelProps.imodelKey` was replaced with `imodelAccess`. If needed, the key can be accessed using `imodelAccess.imodelKey`. This affects the following APIs:
|
|
14
|
+
- `HierarchyDefinition.defineHierarchyLevel` (function that uses these props),
|
|
15
|
+
- `DefineRootHierarchyLevelProps` (extends the props type),
|
|
16
|
+
- `DefineInstanceNodeChildHierarchyLevelProps` (extends the props type).
|
|
17
|
+
|
|
3
18
|
## 2.0.0-alpha.8
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
|
@@ -145,6 +160,14 @@
|
|
|
145
160
|
- Updated dependencies:
|
|
146
161
|
- @itwin/presentation-shared@2.0.0-alpha.0
|
|
147
162
|
|
|
163
|
+
## 1.7.7
|
|
164
|
+
|
|
165
|
+
### Patch Changes
|
|
166
|
+
|
|
167
|
+
- [#1152](https://github.com/iTwin/presentation/pull/1152): Bump dependencies.
|
|
168
|
+
- Updated dependencies:
|
|
169
|
+
- @itwin/presentation-shared@1.2.6
|
|
170
|
+
|
|
148
171
|
## 1.7.6
|
|
149
172
|
|
|
150
173
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchySearch.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchySearch.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AACrG,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE3F,cAAc;AACd,MAAM,WAAW,2BAA2B;IAC1C;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,cAAc;AACd,MAAM,WAAW,gCAAgC;IAC/C;;;;;;;;;;;;;;;;;;;OAmBG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,cAAc;AACd,MAAM,WAAW,0BAA0B;IACzC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,gCAAgC,GAAG,2BAA2B,CAAC;IAClF;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAuCD;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,4BAA4B,GAAG;IAAE,IAAI,EAAE,4BAA4B,CAAC;IAAC,OAAO,CAAC,EAAE,0BAA0B,CAAA;CAAE,CAAC;AAC9I,cAAc;AAEd,yBAAiB,mBAAmB,CAAC;IACnC;;;OAGG;IACH,SAAgB,SAAS,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,EAAE,4BAA4B,CAAC,CAKjH;IAED;;;;;;;;;;;;OAYG;IACH,SAAgB,YAAY,CAC1B,GAAG,EAAE,0BAA0B,GAAG,SAAS,EAC3C,GAAG,EAAE,0BAA0B,GAAG,SAAS,GAC1C,0BAA0B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B,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;SACvF,GAAG,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,QAAQ,GAAG,YAAY,CAAC,GAAG,SAAS,CAAC,GAAG,IAAI,CAAC,wBAAwB,EAAE,QAAQ,GAAG,YAAY,CAAC,GAAG,SAAS;;EAuEvJ;AA0DD,gBAAgB;AAChB,wBAAgB,6BAA6B,CAAC,EAC5C,MAAM,EACN,kBAAkB,EAClB,uBAAuB,GACxB,EAAE;IACD,MAAM,EAAE,0BAA0B,CAAC,QAAQ,CAAC,CAAC;IAC7C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,uBAAuB,EAAE,MAAM,CAAC;CACjC,GAAG,OAAO,CAWV"}
|
|
@@ -79,8 +79,6 @@ var HierarchySearchPath;
|
|
|
79
79
|
}
|
|
80
80
|
HierarchySearchPath.mergeOptions = mergeOptions;
|
|
81
81
|
})(HierarchySearchPath || (exports.HierarchySearchPath = HierarchySearchPath = {}));
|
|
82
|
-
// TODO: remove c8 ignore start and add tests to cover the gaps
|
|
83
|
-
/* c8 ignore start */
|
|
84
82
|
function extractSearchPropsInternal(rootLevelSearchProps, parentNode) {
|
|
85
83
|
if (!parentNode) {
|
|
86
84
|
return rootLevelSearchProps ? { childrenTargetPaths: rootLevelSearchProps, hasSearchTargetAncestor: false } : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchySearch.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchySearch.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AA6LhG,kEAyKC;AA2DD,sEAmBC;AAjbD,6EAAqG;AACrG,+DAA2F;AAsE3F,IAAU,0BAA0B,CAmCnC;AAnCD,WAAU,0BAA0B;IAClC,SAAgB,kBAAkB,CAChC,GAAyC,EACzC,GAAyC;QAEzC,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACjC,OAAO,IAAI,CAA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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 { NonGroupingHierarchyNode } from \"./HierarchyNode.js\";\nimport { HierarchyNodeIdentifier, HierarchyNodeIdentifiersPath } from \"./HierarchyNodeIdentifier.js\";\nimport { GenericNodeKey, HierarchyNodeKey, InstancesNodeKey } from \"./HierarchyNodeKey.js\";\n\n/** @public */\nexport interface SearchPathRevealDepthInPath {\n /**\n * Index of the node in search path should be revealed in hierarchy by auto-expanding its ancestors.\n *\n * Use when you want to expand up to specific instance node and don't care about grouping nodes.\n *\n * **Use case example:**\n *\n * All nodes up to `Element1` should be expanded in the following hierarchy:\n * - Node1\n * - GroupingNode1\n * - GroupingNode2\n * - Element1\n * - Element2\n *\n * Provide `{ path: [Node1, Element1], reveal: { depthInPath: 1 } }`\n *\n * **NOTE**: All nodes that are up to `depthInPath` will be expanded **except** search targets.\n */\n depthInPath: number;\n}\n\n/** @public */\nexport interface SearchPathRevealDepthInHierarchy {\n /**\n * Considering the list of nodes from root to the target node, this is an index in that list, identifying the node that should be revealed in hierarchy by auto-expanding its ancestors.\n *\n * This should take into account the number of grouping nodes in hierarchy.\n *\n * **Use case example:**\n *\n * Only `Node1` and `GroupingNode1` should have `autoExpand` flag in the following hierarchy:\n * - Node1\n * - GroupingNode1\n * - GroupingNode2\n * - Element1\n * - Element2\n *\n * Provide `{ path: [Node1, Element1], reveal: { depthInHierarchy: 2 } }`\n *\n * To get the correct depth use `HierarchyNode.parentKeys.length`.\n *\n * **NOTE**: All nodes that are up to `depthInHierarchy` will be expanded **except** search targets.\n */\n depthInHierarchy: number;\n}\n\n/** @public */\nexport interface HierarchySearchPathOptions {\n /**\n * This option specifies the way `autoExpand` flag should be assigned to nodes in the searched hierarchy.\n * - If it's `false` or `undefined`, nodes have no 'autoExpand' flag.\n * - If it's `true`, then all nodes up to the search target will have `autoExpand` flag.\n * - If it's an instance of `SearchPathRevealDepthInPath`, then all nodes up to `depthInPath` will have `autoExpand` flag.\n * - If it's an instance of `SearchPathRevealDepthInHierarchy`, then all nodes up to `depthInHierarchy` will have `autoExpand` flag.\n */\n reveal?: boolean | SearchPathRevealDepthInHierarchy | SearchPathRevealDepthInPath;\n /**\n * This option specifies whether or not search target should be expanded.\n * - If it's `false` or `undefined`, search target won't have 'autoExpand' flag.\n * - If it's `true`, search target will have `autoExpand` flag.\n *\n * **NOTE**: this attribute does not set `autoExpand` flag on nodes up to the search target. For that use `reveal`.\n */\n autoExpand?: boolean;\n}\n\nnamespace HierarchySearchPathOptions {\n export function mergeRevealOptions(\n lhs: HierarchySearchPathOptions[\"reveal\"],\n rhs: HierarchySearchPathOptions[\"reveal\"],\n ): HierarchySearchPathOptions[\"reveal\"] {\n if (rhs === true || lhs === true) {\n return true;\n }\n if (!rhs || !lhs) {\n return !!rhs ? rhs : lhs;\n }\n\n const lhsDepth = \"depthInPath\" in lhs ? lhs.depthInPath : lhs.depthInHierarchy;\n const rhsDepth = \"depthInPath\" in rhs ? rhs.depthInPath : rhs.depthInHierarchy;\n const isLhsDepthBasedOnPath = \"depthInPath\" in lhs;\n const isRhsDepthBasedOnPath = \"depthInPath\" in rhs;\n\n if (isLhsDepthBasedOnPath) {\n if (isRhsDepthBasedOnPath) {\n return lhsDepth > rhsDepth ? lhs : rhs;\n }\n return lhs;\n }\n if (isRhsDepthBasedOnPath) {\n return rhs;\n }\n return lhsDepth > rhsDepth ? lhs : rhs;\n }\n\n export function mergeAutoExpandOption(\n lhs: HierarchySearchPathOptions[\"autoExpand\"],\n rhs: HierarchySearchPathOptions[\"autoExpand\"],\n ): HierarchySearchPathOptions[\"autoExpand\"] {\n return lhs || rhs ? true : undefined;\n }\n}\n\n/**\n * A path of hierarchy node identifiers for search the hierarchy with additional options.\n * @public\n */\nexport type HierarchySearchPath = HierarchyNodeIdentifiersPath | { path: HierarchyNodeIdentifiersPath; options?: HierarchySearchPathOptions };\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchySearchPath {\n /**\n * Normalizes the hierarchy search path to the object form.\n * @public\n */\n export function normalize(source: HierarchySearchPath): Exclude<HierarchySearchPath, HierarchyNodeIdentifiersPath> {\n if (Array.isArray(source)) {\n return { path: source };\n }\n return source;\n }\n\n /**\n * Merges two given `HierarchySearchPathOptions` objects.\n *\n * For the `reveal` attribute, the merge chooses to `reveal` as deep as the deepest input:\n * - if any one of the inputs is `true`, return `true`,\n * - else if only one of the inputs is an object, return it,\n * - else if both inputs are falsy, return `false` or `undefined`,\n * - else:\n * - if only one of the inputs has `depthInHierarchy` set, return the other one,\n * - else return the one with greater `depthInPath` or `depthInHierarchy`.\n *\n * @public\n */\n export function mergeOptions(\n lhs: HierarchySearchPathOptions | undefined,\n rhs: HierarchySearchPathOptions | undefined,\n ): HierarchySearchPathOptions | undefined {\n const reveal = HierarchySearchPathOptions.mergeRevealOptions(lhs?.reveal, rhs?.reveal);\n const autoExpand = HierarchySearchPathOptions.mergeAutoExpandOption(lhs?.autoExpand, rhs?.autoExpand);\n return reveal || autoExpand\n ? {\n ...(reveal !== undefined ? { reveal } : undefined),\n ...(autoExpand !== undefined ? { autoExpand } : undefined),\n }\n : undefined;\n }\n}\n\n// TODO: remove c8 ignore start and add tests to cover the gaps\n/* c8 ignore start */\n\nfunction extractSearchPropsInternal(\n rootLevelSearchProps: HierarchySearchPath[] | undefined,\n parentNode: Pick<NonGroupingHierarchyNode, \"search\"> | undefined,\n):\n | {\n childrenTargetPaths?: HierarchySearchPath[];\n hasSearchTargetAncestor: boolean;\n }\n | undefined {\n if (!parentNode) {\n return rootLevelSearchProps ? { childrenTargetPaths: rootLevelSearchProps, hasSearchTargetAncestor: false } : undefined;\n }\n const searchProps: {\n childrenTargetPaths?: HierarchySearchPath[];\n hasSearchTargetAncestor: boolean;\n } = {\n ...(parentNode.search?.childrenTargetPaths ? { childrenTargetPaths: parentNode.search.childrenTargetPaths } : undefined),\n hasSearchTargetAncestor: !!parentNode.search?.hasSearchTargetAncestor || !!parentNode.search?.isSearchTarget,\n };\n return searchProps.childrenTargetPaths || searchProps.hasSearchTargetAncestor ? searchProps : undefined;\n}\n\n/**\n * Creates a set of utilities for making it easier to search the given hierarchy\n * level.\n *\n * @public\n */\nexport function createHierarchySearchHelper(\n rootLevelSearchProps: HierarchySearchPath[] | undefined,\n parentNode: Pick<NonGroupingHierarchyNode, \"search\"> | undefined,\n) {\n const searchProps = extractSearchPropsInternal(rootLevelSearchProps, parentNode);\n const hasSearch = !!searchProps;\n\n function saveSearchPropsFromPathsIntoReducer(\n extractionProps: {\n pathsReducer: MatchingSearchPathsReducer;\n } & (\n | {\n nodeKey: InstancesNodeKey | GenericNodeKey;\n }\n | { pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean }\n ),\n ): void;\n function saveSearchPropsFromPathsIntoReducer(extractionProps: {\n pathsReducer: MatchingSearchPathsReducer;\n asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;\n }): void | Promise<void>;\n function saveSearchPropsFromPathsIntoReducer(\n extractionProps: {\n pathsReducer: MatchingSearchPathsReducer;\n } & (\n | {\n nodeKey: InstancesNodeKey | GenericNodeKey;\n }\n | { pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean }\n | { asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean> }\n ),\n ): void | Promise<void> {\n // Passes down matching normalized paths to the reducer.\n // It uses `nodeKey`, `pathMatcher` or `asyncPathMatcher` to check if `HierarchyNodeIdentifier` at the first position in search path matches the node\n // and if it does, the path is passed down to the reducer.\n // This function returns a promise only if asyncPathMatcher returns a promise.\n if (!searchProps?.childrenTargetPaths) {\n return;\n }\n const matchedPathPromises = new Array<Promise<NormalizedSearchPath | undefined>>();\n for (const childrenTargetPaths of searchProps.childrenTargetPaths) {\n const normalizedPath = HierarchySearchPath.normalize(childrenTargetPaths);\n /* c8 ignore next 3 */\n if (normalizedPath.path.length === 0) {\n continue;\n }\n if (\"nodeKey\" in extractionProps) {\n if (\n (HierarchyNodeKey.isGeneric(extractionProps.nodeKey) && HierarchyNodeIdentifier.equal(normalizedPath.path[0], extractionProps.nodeKey)) ||\n (HierarchyNodeKey.isInstances(extractionProps.nodeKey) &&\n extractionProps.nodeKey.instanceKeys.some((ik) => HierarchyNodeIdentifier.equal(normalizedPath.path[0], ik)))\n ) {\n extractionProps.pathsReducer.accept(normalizedPath);\n }\n continue;\n }\n\n const matchesPossiblyPromise =\n \"pathMatcher\" in extractionProps ? extractionProps.pathMatcher(normalizedPath.path[0]) : extractionProps.asyncPathMatcher(normalizedPath.path[0]);\n if (matchesPossiblyPromise instanceof Promise) {\n matchedPathPromises.push(matchesPossiblyPromise.then((matches) => (matches ? normalizedPath : undefined)));\n continue;\n }\n if (matchesPossiblyPromise) {\n extractionProps.pathsReducer.accept(normalizedPath);\n }\n }\n if (matchedPathPromises.length === 0) {\n return;\n }\n return Promise.all(matchedPathPromises).then((matchedPath) =>\n matchedPath.forEach((normalizedPath) => normalizedPath && extractionProps.pathsReducer.accept(normalizedPath)),\n );\n }\n\n function createChildNodeProps(props: {\n parentKeys?: undefined;\n nodeKey: InstancesNodeKey | GenericNodeKey;\n }): Pick<NonGroupingHierarchyNode, \"search\"> | undefined;\n function createChildNodeProps(props: {\n parentKeys?: undefined;\n pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;\n }): Pick<NonGroupingHierarchyNode, \"search\"> | undefined;\n function createChildNodeProps(props: {\n parentKeys?: undefined;\n asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;\n }): Promise<Pick<NonGroupingHierarchyNode, \"search\"> | undefined> | Pick<NonGroupingHierarchyNode, \"search\"> | undefined;\n function createChildNodeProps(props: {\n parentKeys: HierarchyNodeKey[];\n nodeKey: InstancesNodeKey | GenericNodeKey;\n }): Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> | undefined;\n function createChildNodeProps(props: {\n parentKeys: HierarchyNodeKey[];\n pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;\n }): Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> | undefined;\n function createChildNodeProps(props: {\n parentKeys: HierarchyNodeKey[];\n asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;\n }): Promise<Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> | undefined> | Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> | undefined;\n function createChildNodeProps(\n props: { parentKeys?: HierarchyNodeKey[] } & (\n | {\n asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;\n }\n | {\n pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;\n }\n | {\n nodeKey: InstancesNodeKey | GenericNodeKey;\n }\n ),\n ):\n | Promise<Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> | Pick<NonGroupingHierarchyNode, \"search\"> | undefined>\n | Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\">\n | Pick<NonGroupingHierarchyNode, \"search\">\n | undefined {\n if (!hasSearch) {\n return undefined;\n }\n const reducer = new MatchingSearchPathsReducer(searchProps.hasSearchTargetAncestor);\n if (\"asyncPathMatcher\" in props) {\n const extractResult = saveSearchPropsFromPathsIntoReducer({ pathsReducer: reducer, asyncPathMatcher: props.asyncPathMatcher });\n if (extractResult instanceof Promise) {\n return extractResult.then(() => reducer.getNodeProps(props.parentKeys));\n }\n } else {\n saveSearchPropsFromPathsIntoReducer({ ...props, pathsReducer: reducer });\n }\n return reducer.getNodeProps(props.parentKeys);\n }\n return {\n /** Returns a flag indicating if the hierarchy level is filtered. */\n hasSearch,\n /**\n * Returns a flag indicating whether this hierarchy level has an ancestor node\n * that is a search target. That generally means that this and all downstream hierarchy\n * levels should be displayed without search being applied to them, even if search paths\n * say otherwise.\n */\n hasSearchTargetAncestor: searchProps?.hasSearchTargetAncestor ?? false,\n /**\n * Returns a list of hierarchy node identifiers that apply specifically for this\n * hierarchy level. Returns `undefined` if search is not applied to this level.\n */\n getChildNodeSearchIdentifiers: () => {\n if (!searchProps?.childrenTargetPaths) {\n return undefined;\n }\n return searchProps.childrenTargetPaths\n .map(HierarchySearchPath.normalize)\n .filter(({ path }) => path.length > 0)\n .map(({ path }) => path[0]);\n },\n /**\n * When a hierarchy node is created for a filtered hierarchy level, it needs some attributes (e.g. `search`\n * and `autoExpand`) to be set based on the search paths and search options. This function calculates\n * these props for a child node based on its key or path matcher.\n *\n * When using `pathMatcher` or `asyncPathMatcher` prop, callers have more flexibility to decide whether the given `HierarchyNodeIdentifier` applies\n * to their node. For example, only some parts of the identifier can be checked for improved performance. Otherwise, the\n * `nodeKey` prop can be used to check the whole identifier.\n *\n * There are multiple overloads of `createChildNodeProps`: depending on props type it returns different values:\n * - `parentKeys` is defined and `pathMatcher` or `nodeKey` is provided - returns undefined **or** `search` and `autoExpand` prop from `HierarchyNode`;\n * - `parentKeys` is undefined - does not return `HierarchyNode.autoExpand` option;\n * - props have `asyncPathMatcher` - returns either Promise or the regular return value based on whether or not `asyncPathMatcher` returns a promise.\n */\n createChildNodeProps,\n };\n}\n\ntype NormalizedSearchPath = ReturnType<(typeof HierarchySearchPath)[\"normalize\"]>;\n\n/**\n * Extracts information from search paths and later returns `search` and `autoExpand` values from `HierarchyNode`.\n *\n * Saved values can be applied to a single `HierarchyNode` - this means that a new reducer should be created every time these props are requested for a `HierarchyNode`.\n *\n * Extracts information using `accept` function:\n * - Determines if node is search target, and if it is saves the options as `searchTargetOptions`\n * - Saves `HierarchySearchPathOptions` and `childrenTargetPaths`\n */\nclass MatchingSearchPathsReducer {\n private _childrenTargetPaths = new Array<NormalizedSearchPath>();\n private _isSearchTarget = false;\n private _searchTargetOptions: HierarchySearchPathOptions | undefined = undefined;\n private _revealOption: HierarchySearchPathOptions[\"reveal\"] = false;\n\n public constructor(private _hasSearchTargetAncestor: boolean) {}\n\n public accept(normalizedPath: NormalizedSearchPath): void {\n const { path, options } = normalizedPath;\n if (path.length === 1) {\n this._isSearchTarget = true;\n this._searchTargetOptions = HierarchySearchPath.mergeOptions(this._searchTargetOptions, options);\n } else if (path.length > 1) {\n this._childrenTargetPaths.push({ path: path.slice(1), options });\n this._revealOption = HierarchySearchPathOptions.mergeRevealOptions(options?.reveal, this._revealOption);\n }\n }\n\n public getNodeProps<T extends HierarchyNodeKey[] | undefined = undefined>(\n parentKeys?: T,\n ): T extends undefined ? Pick<NonGroupingHierarchyNode, \"search\"> : Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> {\n return {\n ...(this._hasSearchTargetAncestor || this._isSearchTarget || this._childrenTargetPaths.length > 0\n ? {\n search: {\n ...(this._hasSearchTargetAncestor ? { hasSearchTargetAncestor: true } : undefined),\n ...(this._isSearchTarget ? { isSearchTarget: true, searchTargetOptions: this._searchTargetOptions } : undefined),\n ...(this._childrenTargetPaths.length > 0 ? { childrenTargetPaths: this._childrenTargetPaths } : undefined),\n },\n }\n : undefined),\n ...(parentKeys &&\n (shouldAutoExpandBasedOnReveal({\n reveal: this._revealOption,\n nodePositionInHierarchy: parentKeys.length,\n nodePositionInPath: parentKeys.filter((key) => !HierarchyNodeKey.isGrouping(key)).length,\n }) ||\n !!this._searchTargetOptions?.autoExpand)\n ? { autoExpand: true }\n : undefined),\n };\n }\n}\n\n/** @internal */\nexport function shouldAutoExpandBasedOnReveal({\n reveal,\n nodePositionInPath,\n nodePositionInHierarchy,\n}: {\n reveal: HierarchySearchPathOptions[\"reveal\"];\n nodePositionInPath: number;\n nodePositionInHierarchy: number;\n}): boolean {\n if (!reveal) {\n return false;\n }\n if (reveal === true) {\n return true;\n }\n if (\"depthInHierarchy\" in reveal) {\n return nodePositionInHierarchy < reveal.depthInHierarchy;\n }\n return nodePositionInPath < reveal.depthInPath;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"HierarchySearch.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchySearch.ts"],"names":[],"mappings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,KAAK,IAAI,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,kBAAkB,IAAI,MAAM,EAAE,CAAC;QACjC,OAAO,uBAAuB,GAAG,MAAM,CAAC,gBAAgB,CAAC;IAC3D,CAAC;IACD,OAAO,kBAAkB,GAAG,MAAM,CAAC,WAAW,CAAC;AACjD,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 { NonGroupingHierarchyNode } from \"./HierarchyNode.js\";\nimport { HierarchyNodeIdentifier, HierarchyNodeIdentifiersPath } from \"./HierarchyNodeIdentifier.js\";\nimport { GenericNodeKey, HierarchyNodeKey, InstancesNodeKey } from \"./HierarchyNodeKey.js\";\n\n/** @public */\nexport interface SearchPathRevealDepthInPath {\n /**\n * Index of the node in search path should be revealed in hierarchy by auto-expanding its ancestors.\n *\n * Use when you want to expand up to specific instance node and don't care about grouping nodes.\n *\n * **Use case example:**\n *\n * All nodes up to `Element1` should be expanded in the following hierarchy:\n * - Node1\n * - GroupingNode1\n * - GroupingNode2\n * - Element1\n * - Element2\n *\n * Provide `{ path: [Node1, Element1], reveal: { depthInPath: 1 } }`\n *\n * **NOTE**: All nodes that are up to `depthInPath` will be expanded **except** search targets.\n */\n depthInPath: number;\n}\n\n/** @public */\nexport interface SearchPathRevealDepthInHierarchy {\n /**\n * Considering the list of nodes from root to the target node, this is an index in that list, identifying the node that should be revealed in hierarchy by auto-expanding its ancestors.\n *\n * This should take into account the number of grouping nodes in hierarchy.\n *\n * **Use case example:**\n *\n * Only `Node1` and `GroupingNode1` should have `autoExpand` flag in the following hierarchy:\n * - Node1\n * - GroupingNode1\n * - GroupingNode2\n * - Element1\n * - Element2\n *\n * Provide `{ path: [Node1, Element1], reveal: { depthInHierarchy: 2 } }`\n *\n * To get the correct depth use `HierarchyNode.parentKeys.length`.\n *\n * **NOTE**: All nodes that are up to `depthInHierarchy` will be expanded **except** search targets.\n */\n depthInHierarchy: number;\n}\n\n/** @public */\nexport interface HierarchySearchPathOptions {\n /**\n * This option specifies the way `autoExpand` flag should be assigned to nodes in the searched hierarchy.\n * - If it's `false` or `undefined`, nodes have no 'autoExpand' flag.\n * - If it's `true`, then all nodes up to the search target will have `autoExpand` flag.\n * - If it's an instance of `SearchPathRevealDepthInPath`, then all nodes up to `depthInPath` will have `autoExpand` flag.\n * - If it's an instance of `SearchPathRevealDepthInHierarchy`, then all nodes up to `depthInHierarchy` will have `autoExpand` flag.\n */\n reveal?: boolean | SearchPathRevealDepthInHierarchy | SearchPathRevealDepthInPath;\n /**\n * This option specifies whether or not search target should be expanded.\n * - If it's `false` or `undefined`, search target won't have 'autoExpand' flag.\n * - If it's `true`, search target will have `autoExpand` flag.\n *\n * **NOTE**: this attribute does not set `autoExpand` flag on nodes up to the search target. For that use `reveal`.\n */\n autoExpand?: boolean;\n}\n\nnamespace HierarchySearchPathOptions {\n export function mergeRevealOptions(\n lhs: HierarchySearchPathOptions[\"reveal\"],\n rhs: HierarchySearchPathOptions[\"reveal\"],\n ): HierarchySearchPathOptions[\"reveal\"] {\n if (rhs === true || lhs === true) {\n return true;\n }\n if (!rhs || !lhs) {\n return !!rhs ? rhs : lhs;\n }\n\n const lhsDepth = \"depthInPath\" in lhs ? lhs.depthInPath : lhs.depthInHierarchy;\n const rhsDepth = \"depthInPath\" in rhs ? rhs.depthInPath : rhs.depthInHierarchy;\n const isLhsDepthBasedOnPath = \"depthInPath\" in lhs;\n const isRhsDepthBasedOnPath = \"depthInPath\" in rhs;\n\n if (isLhsDepthBasedOnPath) {\n if (isRhsDepthBasedOnPath) {\n return lhsDepth > rhsDepth ? lhs : rhs;\n }\n return lhs;\n }\n if (isRhsDepthBasedOnPath) {\n return rhs;\n }\n return lhsDepth > rhsDepth ? lhs : rhs;\n }\n\n export function mergeAutoExpandOption(\n lhs: HierarchySearchPathOptions[\"autoExpand\"],\n rhs: HierarchySearchPathOptions[\"autoExpand\"],\n ): HierarchySearchPathOptions[\"autoExpand\"] {\n return lhs || rhs ? true : undefined;\n }\n}\n\n/**\n * A path of hierarchy node identifiers for search the hierarchy with additional options.\n * @public\n */\nexport type HierarchySearchPath = HierarchyNodeIdentifiersPath | { path: HierarchyNodeIdentifiersPath; options?: HierarchySearchPathOptions };\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchySearchPath {\n /**\n * Normalizes the hierarchy search path to the object form.\n * @public\n */\n export function normalize(source: HierarchySearchPath): Exclude<HierarchySearchPath, HierarchyNodeIdentifiersPath> {\n if (Array.isArray(source)) {\n return { path: source };\n }\n return source;\n }\n\n /**\n * Merges two given `HierarchySearchPathOptions` objects.\n *\n * For the `reveal` attribute, the merge chooses to `reveal` as deep as the deepest input:\n * - if any one of the inputs is `true`, return `true`,\n * - else if only one of the inputs is an object, return it,\n * - else if both inputs are falsy, return `false` or `undefined`,\n * - else:\n * - if only one of the inputs has `depthInHierarchy` set, return the other one,\n * - else return the one with greater `depthInPath` or `depthInHierarchy`.\n *\n * @public\n */\n export function mergeOptions(\n lhs: HierarchySearchPathOptions | undefined,\n rhs: HierarchySearchPathOptions | undefined,\n ): HierarchySearchPathOptions | undefined {\n const reveal = HierarchySearchPathOptions.mergeRevealOptions(lhs?.reveal, rhs?.reveal);\n const autoExpand = HierarchySearchPathOptions.mergeAutoExpandOption(lhs?.autoExpand, rhs?.autoExpand);\n return reveal || autoExpand\n ? {\n ...(reveal !== undefined ? { reveal } : undefined),\n ...(autoExpand !== undefined ? { autoExpand } : undefined),\n }\n : undefined;\n }\n}\n\nfunction extractSearchPropsInternal(\n rootLevelSearchProps: HierarchySearchPath[] | undefined,\n parentNode: Pick<NonGroupingHierarchyNode, \"search\"> | undefined,\n):\n | {\n childrenTargetPaths?: HierarchySearchPath[];\n hasSearchTargetAncestor: boolean;\n }\n | undefined {\n if (!parentNode) {\n return rootLevelSearchProps ? { childrenTargetPaths: rootLevelSearchProps, hasSearchTargetAncestor: false } : undefined;\n }\n const searchProps: {\n childrenTargetPaths?: HierarchySearchPath[];\n hasSearchTargetAncestor: boolean;\n } = {\n ...(parentNode.search?.childrenTargetPaths ? { childrenTargetPaths: parentNode.search.childrenTargetPaths } : undefined),\n hasSearchTargetAncestor: !!parentNode.search?.hasSearchTargetAncestor || !!parentNode.search?.isSearchTarget,\n };\n return searchProps.childrenTargetPaths || searchProps.hasSearchTargetAncestor ? searchProps : undefined;\n}\n\n/**\n * Creates a set of utilities for making it easier to search the given hierarchy\n * level.\n *\n * @public\n */\nexport function createHierarchySearchHelper(\n rootLevelSearchProps: HierarchySearchPath[] | undefined,\n parentNode: Pick<NonGroupingHierarchyNode, \"search\"> | undefined,\n) {\n const searchProps = extractSearchPropsInternal(rootLevelSearchProps, parentNode);\n const hasSearch = !!searchProps;\n\n function saveSearchPropsFromPathsIntoReducer(\n extractionProps: {\n pathsReducer: MatchingSearchPathsReducer;\n } & (\n | {\n nodeKey: InstancesNodeKey | GenericNodeKey;\n }\n | { pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean }\n ),\n ): void;\n function saveSearchPropsFromPathsIntoReducer(extractionProps: {\n pathsReducer: MatchingSearchPathsReducer;\n asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;\n }): void | Promise<void>;\n function saveSearchPropsFromPathsIntoReducer(\n extractionProps: {\n pathsReducer: MatchingSearchPathsReducer;\n } & (\n | {\n nodeKey: InstancesNodeKey | GenericNodeKey;\n }\n | { pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean }\n | { asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean> }\n ),\n ): void | Promise<void> {\n // Passes down matching normalized paths to the reducer.\n // It uses `nodeKey`, `pathMatcher` or `asyncPathMatcher` to check if `HierarchyNodeIdentifier` at the first position in search path matches the node\n // and if it does, the path is passed down to the reducer.\n // This function returns a promise only if asyncPathMatcher returns a promise.\n if (!searchProps?.childrenTargetPaths) {\n return;\n }\n const matchedPathPromises = new Array<Promise<NormalizedSearchPath | undefined>>();\n for (const childrenTargetPaths of searchProps.childrenTargetPaths) {\n const normalizedPath = HierarchySearchPath.normalize(childrenTargetPaths);\n /* c8 ignore next 3 */\n if (normalizedPath.path.length === 0) {\n continue;\n }\n if (\"nodeKey\" in extractionProps) {\n if (\n (HierarchyNodeKey.isGeneric(extractionProps.nodeKey) && HierarchyNodeIdentifier.equal(normalizedPath.path[0], extractionProps.nodeKey)) ||\n (HierarchyNodeKey.isInstances(extractionProps.nodeKey) &&\n extractionProps.nodeKey.instanceKeys.some((ik) => HierarchyNodeIdentifier.equal(normalizedPath.path[0], ik)))\n ) {\n extractionProps.pathsReducer.accept(normalizedPath);\n }\n continue;\n }\n\n const matchesPossiblyPromise =\n \"pathMatcher\" in extractionProps ? extractionProps.pathMatcher(normalizedPath.path[0]) : extractionProps.asyncPathMatcher(normalizedPath.path[0]);\n if (matchesPossiblyPromise instanceof Promise) {\n matchedPathPromises.push(matchesPossiblyPromise.then((matches) => (matches ? normalizedPath : undefined)));\n continue;\n }\n if (matchesPossiblyPromise) {\n extractionProps.pathsReducer.accept(normalizedPath);\n }\n }\n if (matchedPathPromises.length === 0) {\n return;\n }\n return Promise.all(matchedPathPromises).then((matchedPath) =>\n matchedPath.forEach((normalizedPath) => normalizedPath && extractionProps.pathsReducer.accept(normalizedPath)),\n );\n }\n\n function createChildNodeProps(props: {\n parentKeys?: undefined;\n nodeKey: InstancesNodeKey | GenericNodeKey;\n }): Pick<NonGroupingHierarchyNode, \"search\"> | undefined;\n function createChildNodeProps(props: {\n parentKeys?: undefined;\n pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;\n }): Pick<NonGroupingHierarchyNode, \"search\"> | undefined;\n function createChildNodeProps(props: {\n parentKeys?: undefined;\n asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;\n }): Promise<Pick<NonGroupingHierarchyNode, \"search\"> | undefined> | Pick<NonGroupingHierarchyNode, \"search\"> | undefined;\n function createChildNodeProps(props: {\n parentKeys: HierarchyNodeKey[];\n nodeKey: InstancesNodeKey | GenericNodeKey;\n }): Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> | undefined;\n function createChildNodeProps(props: {\n parentKeys: HierarchyNodeKey[];\n pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;\n }): Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> | undefined;\n function createChildNodeProps(props: {\n parentKeys: HierarchyNodeKey[];\n asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;\n }): Promise<Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> | undefined> | Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> | undefined;\n function createChildNodeProps(\n props: { parentKeys?: HierarchyNodeKey[] } & (\n | {\n asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;\n }\n | {\n pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;\n }\n | {\n nodeKey: InstancesNodeKey | GenericNodeKey;\n }\n ),\n ):\n | Promise<Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> | Pick<NonGroupingHierarchyNode, \"search\"> | undefined>\n | Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\">\n | Pick<NonGroupingHierarchyNode, \"search\">\n | undefined {\n if (!hasSearch) {\n return undefined;\n }\n const reducer = new MatchingSearchPathsReducer(searchProps.hasSearchTargetAncestor);\n if (\"asyncPathMatcher\" in props) {\n const extractResult = saveSearchPropsFromPathsIntoReducer({ pathsReducer: reducer, asyncPathMatcher: props.asyncPathMatcher });\n if (extractResult instanceof Promise) {\n return extractResult.then(() => reducer.getNodeProps(props.parentKeys));\n }\n } else {\n saveSearchPropsFromPathsIntoReducer({ ...props, pathsReducer: reducer });\n }\n return reducer.getNodeProps(props.parentKeys);\n }\n return {\n /** Returns a flag indicating if the hierarchy level is filtered. */\n hasSearch,\n /**\n * Returns a flag indicating whether this hierarchy level has an ancestor node\n * that is a search target. That generally means that this and all downstream hierarchy\n * levels should be displayed without search being applied to them, even if search paths\n * say otherwise.\n */\n hasSearchTargetAncestor: searchProps?.hasSearchTargetAncestor ?? false,\n /**\n * Returns a list of hierarchy node identifiers that apply specifically for this\n * hierarchy level. Returns `undefined` if search is not applied to this level.\n */\n getChildNodeSearchIdentifiers: () => {\n if (!searchProps?.childrenTargetPaths) {\n return undefined;\n }\n return searchProps.childrenTargetPaths\n .map(HierarchySearchPath.normalize)\n .filter(({ path }) => path.length > 0)\n .map(({ path }) => path[0]);\n },\n /**\n * When a hierarchy node is created for a filtered hierarchy level, it needs some attributes (e.g. `search`\n * and `autoExpand`) to be set based on the search paths and search options. This function calculates\n * these props for a child node based on its key or path matcher.\n *\n * When using `pathMatcher` or `asyncPathMatcher` prop, callers have more flexibility to decide whether the given `HierarchyNodeIdentifier` applies\n * to their node. For example, only some parts of the identifier can be checked for improved performance. Otherwise, the\n * `nodeKey` prop can be used to check the whole identifier.\n *\n * There are multiple overloads of `createChildNodeProps`: depending on props type it returns different values:\n * - `parentKeys` is defined and `pathMatcher` or `nodeKey` is provided - returns undefined **or** `search` and `autoExpand` prop from `HierarchyNode`;\n * - `parentKeys` is undefined - does not return `HierarchyNode.autoExpand` option;\n * - props have `asyncPathMatcher` - returns either Promise or the regular return value based on whether or not `asyncPathMatcher` returns a promise.\n */\n createChildNodeProps,\n };\n}\n\ntype NormalizedSearchPath = ReturnType<(typeof HierarchySearchPath)[\"normalize\"]>;\n\n/**\n * Extracts information from search paths and later returns `search` and `autoExpand` values from `HierarchyNode`.\n *\n * Saved values can be applied to a single `HierarchyNode` - this means that a new reducer should be created every time these props are requested for a `HierarchyNode`.\n *\n * Extracts information using `accept` function:\n * - Determines if node is search target, and if it is saves the options as `searchTargetOptions`\n * - Saves `HierarchySearchPathOptions` and `childrenTargetPaths`\n */\nclass MatchingSearchPathsReducer {\n private _childrenTargetPaths = new Array<NormalizedSearchPath>();\n private _isSearchTarget = false;\n private _searchTargetOptions: HierarchySearchPathOptions | undefined = undefined;\n private _revealOption: HierarchySearchPathOptions[\"reveal\"] = false;\n\n public constructor(private _hasSearchTargetAncestor: boolean) {}\n\n public accept(normalizedPath: NormalizedSearchPath): void {\n const { path, options } = normalizedPath;\n if (path.length === 1) {\n this._isSearchTarget = true;\n this._searchTargetOptions = HierarchySearchPath.mergeOptions(this._searchTargetOptions, options);\n } else if (path.length > 1) {\n this._childrenTargetPaths.push({ path: path.slice(1), options });\n this._revealOption = HierarchySearchPathOptions.mergeRevealOptions(options?.reveal, this._revealOption);\n }\n }\n\n public getNodeProps<T extends HierarchyNodeKey[] | undefined = undefined>(\n parentKeys?: T,\n ): T extends undefined ? Pick<NonGroupingHierarchyNode, \"search\"> : Pick<NonGroupingHierarchyNode, \"search\" | \"autoExpand\"> {\n return {\n ...(this._hasSearchTargetAncestor || this._isSearchTarget || this._childrenTargetPaths.length > 0\n ? {\n search: {\n ...(this._hasSearchTargetAncestor ? { hasSearchTargetAncestor: true } : undefined),\n ...(this._isSearchTarget ? { isSearchTarget: true, searchTargetOptions: this._searchTargetOptions } : undefined),\n ...(this._childrenTargetPaths.length > 0 ? { childrenTargetPaths: this._childrenTargetPaths } : undefined),\n },\n }\n : undefined),\n ...(parentKeys &&\n (shouldAutoExpandBasedOnReveal({\n reveal: this._revealOption,\n nodePositionInHierarchy: parentKeys.length,\n nodePositionInPath: parentKeys.filter((key) => !HierarchyNodeKey.isGrouping(key)).length,\n }) ||\n !!this._searchTargetOptions?.autoExpand)\n ? { autoExpand: true }\n : undefined),\n };\n }\n}\n\n/** @internal */\nexport function shouldAutoExpandBasedOnReveal({\n reveal,\n nodePositionInPath,\n nodePositionInHierarchy,\n}: {\n reveal: HierarchySearchPathOptions[\"reveal\"];\n nodePositionInPath: number;\n nodePositionInHierarchy: number;\n}): boolean {\n if (!reveal) {\n return false;\n }\n if (reveal === true) {\n return true;\n }\n if (\"depthInHierarchy\" in reveal) {\n return nodePositionInHierarchy < reveal.depthInHierarchy;\n }\n return nodePositionInPath < reveal.depthInPath;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GenericInstanceFilter } from "@itwin/core-common";
|
|
2
|
-
import { ECSqlQueryDef } from "@itwin/presentation-shared";
|
|
2
|
+
import { ECClassHierarchyInspector, ECSchemaProvider, ECSqlQueryDef } from "@itwin/presentation-shared";
|
|
3
3
|
import { NonGroupingHierarchyNode } from "../HierarchyNode.js";
|
|
4
4
|
import { ProcessedGenericHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode, SourceGenericHierarchyNode, SourceInstanceHierarchyNode } from "./IModelHierarchyNode.js";
|
|
5
5
|
/**
|
|
@@ -84,8 +84,10 @@ export type HierarchyDefinitionParentNode = Omit<NonGroupingHierarchyNode, "chil
|
|
|
84
84
|
* @public
|
|
85
85
|
*/
|
|
86
86
|
export interface DefineHierarchyLevelProps {
|
|
87
|
-
/** The
|
|
88
|
-
|
|
87
|
+
/** The iModel for which the hierarchy definition is being requested for. */
|
|
88
|
+
imodelAccess: ECSchemaProvider & ECClassHierarchyInspector & {
|
|
89
|
+
imodelKey: string;
|
|
90
|
+
};
|
|
89
91
|
/** Parent node to get children for. Pass `undefined` to get root nodes. */
|
|
90
92
|
parentNode: HierarchyDefinitionParentNode | undefined;
|
|
91
93
|
/** Optional hierarchy level filter. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelHierarchyDefinition.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyDefinition.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"IModelHierarchyDefinition.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyDef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MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,SAAS,6BAA6B,GAAG,8BAA8B,EAAE,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;AAEzJ;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,sBAAsB,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAElG;;;;;;GAMG;AACH,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAC;AAEvF;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,4EAA4E;IAC5E,YAAY,EAAE,gBAAgB,GAAG,yBAAyB,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAEnF,2EAA2E;IAC3E,UAAU,EAAE,6BAA6B,GAAG,SAAS,CAAC;IAEtD,uCAAuC;IACvC,cAAc,CAAC,EAAE,qBAAqB,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IAEvB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAElC;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,iBAAiB,CAAC;IAEpC,+EAA+E;IAC/E,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAC3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelHierarchyDefinition.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyDefinition.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AA6ChG,cAAc;AACd,2DAA2D;AAC3D,IAAiB,wBAAwB,CAOxC;AAPD,WAAiB,wBAAwB;IACvC,SAAgB,aAAa,CAAC,GAA6B;QACzD,OAAO,CAAC,CAAE,GAAsC,CAAC,IAAI,CAAC;IACxD,CAAC;IAFe,sCAAa,gBAE5B,CAAA;IACD,SAAgB,oBAAoB,CAAC,GAA6B;QAChE,OAAO,CAAC,CAAE,GAAoC,CAAC,KAAK,CAAC;IACvD,CAAC;IAFe,6CAAoB,uBAEnC,CAAA;AACH,CAAC,EAPgB,wBAAwB,wCAAxB,wBAAwB,QAOxC","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 { GenericInstanceFilter } from \"@itwin/core-common\";\nimport { ECSqlQueryDef } from \"@itwin/presentation-shared\";\nimport { NonGroupingHierarchyNode } from \"../HierarchyNode.js\";\nimport {\n ProcessedGenericHierarchyNode,\n ProcessedHierarchyNode,\n ProcessedInstanceHierarchyNode,\n SourceGenericHierarchyNode,\n SourceInstanceHierarchyNode,\n} from \"./IModelHierarchyNode.js\";\n\n/**\n * A nodes definition that returns a single generic node.\n * @public\n */\nexport interface GenericHierarchyNodeDefinition {\n /** The node to be created in the hierarchy level */\n node: SourceGenericHierarchyNode;\n}\n\n/**\n * A nodes definition that returns an ECSQL query for selecting nodes from an iModel.\n * @public\n */\nexport interface InstanceNodesQueryDefinition {\n /**\n * Full name of the class whose instances are going to be returned. It's okay if the attribute\n * points to a base class of multiple different classes of instances returned by the query, however\n * the more specific this class is, the more efficient hierarchy building process is.\n */\n fullClassName: string;\n /**\n * An ECSQL query that selects nodes from an iModel. `SELECT` clause of the query is expected\n * to be built using `NodeSelectQueryFactory.createSelectClause`.\n */\n query: ECSqlQueryDef;\n}\n\n/**\n * A definition of nodes included in a hierarchy level.\n * @public\n */\nexport type HierarchyNodesDefinition = GenericHierarchyNodeDefinition | InstanceNodesQueryDefinition;\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNodesDefinition {\n export function isGenericNode(def: HierarchyNodesDefinition): def is GenericHierarchyNodeDefinition {\n return !!(def as GenericHierarchyNodeDefinition).node;\n }\n export function isInstanceNodesQuery(def: HierarchyNodesDefinition): def is InstanceNodesQueryDefinition {\n return !!(def as InstanceNodesQueryDefinition).query;\n }\n}\n\n/**\n * A definition of a hierarchy level, which may consist of multiple node definitions.\n * @public\n */\nexport type HierarchyLevelDefinition = HierarchyNodesDefinition[];\n\n/**\n * A type for a function that parses a `SourceInstanceHierarchyNode` from provided ECSQL `row` object.\n * @public\n */\nexport type NodeParser = (props: {\n /** The ECSQL row object to parse. Keys & value types depend on the executed query. */\n row: { [columnName: string]: any };\n\n /** The parent node whose child node is being parsed. */\n parentNode?: HierarchyDefinitionParentNode;\n\n /** The key of iModel which is used to run the query. */\n imodelKey: string;\n}) => SourceInstanceHierarchyNode | Promise<SourceInstanceHierarchyNode>;\n\n/**\n * A type for a function that pre-processes given node. Unless the function decides not to make any modifications,\n * it should return a new - modified - node, rather than modifying the given one. Returning `undefined` omits the node\n * from the hierarchy.\n *\n * @public\n */\nexport type NodePreProcessor = <TNode extends ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode>(node: TNode) => Promise<TNode | undefined>;\n\n/**\n * A type for a function that post-processes given node. Unless the function decides not to make any modifications,\n * it should return a new - modified - node, rather than modifying the given one.\n *\n * @public\n */\nexport type NodePostProcessor = (node: ProcessedHierarchyNode) => Promise<ProcessedHierarchyNode>;\n\n/**\n * A type of node that can be passed to `HierarchyDefinition.defineHierarchyLevel`. This basically means\n * a `HierarchyNode` that:\n * - knows nothing about its children,\n * - is either an instances node (key is of `InstancesNodeKey` type) or a generic node (key is of `GenericNodeKey` type).\n * @public\n */\nexport type HierarchyDefinitionParentNode = Omit<NonGroupingHierarchyNode, \"children\">;\n\n/**\n * Props for `HierarchyDefinition.defineHierarchyLevel`.\n * @public\n */\nexport interface DefineHierarchyLevelProps {\n /** The
|
|
1
|
+
{"version":3,"file":"IModelHierarchyDefinition.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyDefinition.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AA6ChG,cAAc;AACd,2DAA2D;AAC3D,IAAiB,wBAAwB,CAOxC;AAPD,WAAiB,wBAAwB;IACvC,SAAgB,aAAa,CAAC,GAA6B;QACzD,OAAO,CAAC,CAAE,GAAsC,CAAC,IAAI,CAAC;IACxD,CAAC;IAFe,sCAAa,gBAE5B,CAAA;IACD,SAAgB,oBAAoB,CAAC,GAA6B;QAChE,OAAO,CAAC,CAAE,GAAoC,CAAC,KAAK,CAAC;IACvD,CAAC;IAFe,6CAAoB,uBAEnC,CAAA;AACH,CAAC,EAPgB,wBAAwB,wCAAxB,wBAAwB,QAOxC","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 { GenericInstanceFilter } from \"@itwin/core-common\";\nimport { ECClassHierarchyInspector, ECSchemaProvider, ECSqlQueryDef } from \"@itwin/presentation-shared\";\nimport { NonGroupingHierarchyNode } from \"../HierarchyNode.js\";\nimport {\n ProcessedGenericHierarchyNode,\n ProcessedHierarchyNode,\n ProcessedInstanceHierarchyNode,\n SourceGenericHierarchyNode,\n SourceInstanceHierarchyNode,\n} from \"./IModelHierarchyNode.js\";\n\n/**\n * A nodes definition that returns a single generic node.\n * @public\n */\nexport interface GenericHierarchyNodeDefinition {\n /** The node to be created in the hierarchy level */\n node: SourceGenericHierarchyNode;\n}\n\n/**\n * A nodes definition that returns an ECSQL query for selecting nodes from an iModel.\n * @public\n */\nexport interface InstanceNodesQueryDefinition {\n /**\n * Full name of the class whose instances are going to be returned. It's okay if the attribute\n * points to a base class of multiple different classes of instances returned by the query, however\n * the more specific this class is, the more efficient hierarchy building process is.\n */\n fullClassName: string;\n /**\n * An ECSQL query that selects nodes from an iModel. `SELECT` clause of the query is expected\n * to be built using `NodeSelectQueryFactory.createSelectClause`.\n */\n query: ECSqlQueryDef;\n}\n\n/**\n * A definition of nodes included in a hierarchy level.\n * @public\n */\nexport type HierarchyNodesDefinition = GenericHierarchyNodeDefinition | InstanceNodesQueryDefinition;\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNodesDefinition {\n export function isGenericNode(def: HierarchyNodesDefinition): def is GenericHierarchyNodeDefinition {\n return !!(def as GenericHierarchyNodeDefinition).node;\n }\n export function isInstanceNodesQuery(def: HierarchyNodesDefinition): def is InstanceNodesQueryDefinition {\n return !!(def as InstanceNodesQueryDefinition).query;\n }\n}\n\n/**\n * A definition of a hierarchy level, which may consist of multiple node definitions.\n * @public\n */\nexport type HierarchyLevelDefinition = HierarchyNodesDefinition[];\n\n/**\n * A type for a function that parses a `SourceInstanceHierarchyNode` from provided ECSQL `row` object.\n * @public\n */\nexport type NodeParser = (props: {\n /** The ECSQL row object to parse. Keys & value types depend on the executed query. */\n row: { [columnName: string]: any };\n\n /** The parent node whose child node is being parsed. */\n parentNode?: HierarchyDefinitionParentNode;\n\n /** The key of iModel which is used to run the query. */\n imodelKey: string;\n}) => SourceInstanceHierarchyNode | Promise<SourceInstanceHierarchyNode>;\n\n/**\n * A type for a function that pre-processes given node. Unless the function decides not to make any modifications,\n * it should return a new - modified - node, rather than modifying the given one. Returning `undefined` omits the node\n * from the hierarchy.\n *\n * @public\n */\nexport type NodePreProcessor = <TNode extends ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode>(node: TNode) => Promise<TNode | undefined>;\n\n/**\n * A type for a function that post-processes given node. Unless the function decides not to make any modifications,\n * it should return a new - modified - node, rather than modifying the given one.\n *\n * @public\n */\nexport type NodePostProcessor = (node: ProcessedHierarchyNode) => Promise<ProcessedHierarchyNode>;\n\n/**\n * A type of node that can be passed to `HierarchyDefinition.defineHierarchyLevel`. This basically means\n * a `HierarchyNode` that:\n * - knows nothing about its children,\n * - is either an instances node (key is of `InstancesNodeKey` type) or a generic node (key is of `GenericNodeKey` type).\n * @public\n */\nexport type HierarchyDefinitionParentNode = Omit<NonGroupingHierarchyNode, \"children\">;\n\n/**\n * Props for `HierarchyDefinition.defineHierarchyLevel`.\n * @public\n */\nexport interface DefineHierarchyLevelProps {\n /** The iModel for which the hierarchy definition is being requested for. */\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector & { imodelKey: string };\n\n /** Parent node to get children for. Pass `undefined` to get root nodes. */\n parentNode: HierarchyDefinitionParentNode | undefined;\n\n /** Optional hierarchy level filter. */\n instanceFilter?: GenericInstanceFilter;\n}\n\n/**\n * An interface for a factory that knows how define a hierarchy based on a given parent node.\n * @public\n */\nexport interface HierarchyDefinition {\n /**\n * An optional function for parsing ECInstance node from ECSQL row.\n *\n * Should be used in situations when the `HierarchyDefinition` implementation\n * introduces additional ECSQL columns into the select clause and wants to assign additional\n * data to the nodes it produces.\n *\n * Defaults to a function that parses all `HierarchyNode` attributes from a query, whose SELECT\n * clause is created using `NodeSelectQueryFactory.createSelectClause`.\n */\n parseNode?: NodeParser;\n\n /**\n * An optional function for pre-processing nodes.\n *\n * Pre-processing happens immediately after the nodes are loaded based on `HierarchyLevelDefinition`\n * returned by this `HierarchyDefinition` and before their processing (hiding, grouping, sorting, etc.) starts.\n * The step allows assigning nodes additional data or excluding them from the hierarchy based on some attributes.\n */\n preProcessNode?: NodePreProcessor;\n\n /**\n * An optional function for post-processing nodes.\n *\n * Post-processing happens after the loaded nodes go through all the merging, hiding and grouping\n * steps, but before sorting them. This step allows `HierarchyDefinition` implementations to assign additional data\n * to nodes after they're processed. This is especially true for grouping nodes as they're only created during\n * processing.\n */\n postProcessNode?: NodePostProcessor;\n\n /** A function to create a hierarchy level definition for given parent node. */\n defineHierarchyLevel(props: DefineHierarchyLevelProps): Promise<HierarchyLevelDefinition>;\n}\n"]}
|
|
@@ -193,7 +193,7 @@ class IModelHierarchyProviderImpl {
|
|
|
193
193
|
return rxjs_1.EMPTY;
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
return this._activeHierarchyDefinition.defineHierarchyLevel({ ...defineHierarchyLevelProps, parentNode,
|
|
196
|
+
return this._activeHierarchyDefinition.defineHierarchyLevel({ ...defineHierarchyLevelProps, parentNode, imodelAccess }).pipe((0, rxjs_1.mergeAll)(), (0, rxjs_1.map)(
|
|
197
197
|
/* Using `as` to work around TS not understanding that `{ x: A, y: B | C }` is the same as `{ x: A } & ({ y: B } | { y: C })` */
|
|
198
198
|
(hierarchyNodesDefinition) => ({ imodelAccess, imodelAccessIndex, hierarchyNodesDefinition })));
|
|
199
199
|
}), (0, rxjs_1.finalize)(() => (0, LoggingUtils_js_1.doLog)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelHierarchyProvider.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAwKhG,sEAGC;AAuCD,kFAEC;AAlND,0CAAwC;AAExC,+BAwBc;AACd,sDAAmF;AACnF,oEAaoC;AACpC,8DAA+D;AAC/D,0DAAmG;AACnG,gEAA+G;AAE/G,8DAA4D;AAC5D,qDAM+B;AAC/B,mEAA6D;AAC7D,iEAAyD;AACzD,qEAA+D;AAC/D,mFAAiF;AACjF,6FAAuF;AACvF,iEAA4E;AAC5E,uFAA6G;AAC7G,mFAA6E;AAC7E,2DAAqD;AACrD,iFAMwC;AAGxC,2EAA0E;AAC1E,2EAAmF;AACnF,yDAAiE;AACjE,yEAAiF;AACjF,iFAAyF;AACzF,iFAA2E;AAC3E,6DAAiD;AAEjD,MAAM,iBAAiB,GAAG,GAAG,6BAAsB,0BAA0B,CAAC;AAC9E,MAAM,0BAA0B,GAAG,GAAG,sCAA+B,0BAA0B,CAAC;AAChG,MAAM,6BAA6B,GAAG,GAAG,yCAAkC,0BAA0B,CAAC;AAEtG,MAAM,yBAAyB,GAAG,EAAE,CAAC;AACrC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AA2EnC;;;;;GAKG;AACH,SAAgB,6BAA6B,C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CAAC;QACvE,OAAO;YACL,GAAG,OAAO;YACV,GAAG,EAAE;gBACH,IAAI,EAAE,WAAW;gBACjB,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC;aAC1E;YACD,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SACvD,CAAC;IACJ,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AACD,SAAS,oBAAoB,CAAC,OAA4B,EAAE,SAA8B;IACxF,IAAI,gCAAa,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,gCAAa,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QACtH,MAAM,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QACvE,OAAO;YACL,GAAG,OAAO;YACV,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SACvD,CAAC;IACJ,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AACD,SAAS,aAAa,CAAC,OAA4B,EAAE,SAA8B;IACjF,OAAO,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,oBAAoB,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,SAAS,CAAC;AAC5G,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 \"../internal/DisposePolyfill.js\";\n\nimport {\n catchError,\n concat,\n defaultIfEmpty,\n defer,\n EMPTY,\n filter,\n finalize,\n from,\n fromEventPattern,\n identity,\n map,\n merge,\n mergeAll,\n mergeMap,\n Observable,\n ObservableInput,\n ObservedValueOf,\n of,\n reduce,\n Subject,\n take,\n takeUntil,\n tap,\n} from \"rxjs\";\nimport { assert, BeEvent, Guid, GuidString, StopWatch } from \"@itwin/core-bentley\";\nimport {\n ConcatenatedValue,\n createDefaultValueFormatter,\n ECClassHierarchyInspector,\n ECSchemaProvider,\n ECSqlBinding,\n ECSqlQueryDef,\n Event,\n EventArgs,\n formatConcatenatedValue,\n InstanceKey,\n IPrimitiveValueFormatter,\n normalizeFullClassName,\n} from \"@itwin/presentation-shared\";\nimport { RowsLimitExceededError } from \"../HierarchyErrors.js\";\nimport { HierarchyNode, NonGroupingHierarchyNode, ParentHierarchyNode } from \"../HierarchyNode.js\";\nimport { GenericNodeKey, HierarchyNodeKey, IModelInstanceKey, InstancesNodeKey } from \"../HierarchyNodeKey.js\";\nimport { GetHierarchyNodesProps, HierarchyProvider } from \"../HierarchyProvider.js\";\nimport { HierarchySearchPath } from \"../HierarchySearch.js\";\nimport {\n LOGGING_NAMESPACE as BASE_LOGGING_NAMESPACE,\n LOGGING_NAMESPACE_INTERNAL as BASE_LOGGING_NAMESPACE_INTERNAL,\n LOGGING_NAMESPACE_PERFORMANCE as BASE_LOGGING_NAMESPACE_PERFORMANCE,\n createNodeIdentifierForLogging,\n hasChildren,\n} from \"../internal/Common.js\";\nimport { eachValueFrom } from \"../internal/EachValueFrom.js\";\nimport { doLog, log } from \"../internal/LoggingUtils.js\";\nimport { partition } from \"../internal/operators/Partition.js\";\nimport { reduceToMergeMapList } from \"../internal/operators/ReduceToMergeMap.js\";\nimport { shareReplayWithErrors } from \"../internal/operators/ShareReplayWithErrors.js\";\nimport { sortNodesByLabelOperator } from \"../internal/operators/Sorting.js\";\nimport { getRxjsHierarchyDefinition, RxjsHierarchyDefinition } from \"../internal/RxjsHierarchyDefinition.js\";\nimport { SubscriptionScheduler } from \"../internal/SubscriptionScheduler.js\";\nimport { HierarchyCache } from \"./HierarchyCache.js\";\nimport {\n DefineHierarchyLevelProps,\n GenericHierarchyNodeDefinition,\n HierarchyDefinition,\n HierarchyNodesDefinition,\n InstanceNodesQueryDefinition,\n} from \"./IModelHierarchyDefinition.js\";\nimport { ProcessedGroupingHierarchyNode, ProcessedHierarchyNode, SourceGenericHierarchyNode, SourceInstanceHierarchyNode } from \"./IModelHierarchyNode.js\";\nimport { LimitingECSqlQueryExecutor } from \"./LimitingECSqlQueryExecutor.js\";\nimport { NodeSelectClauseColumnNames } from \"./NodeSelectQueryFactory.js\";\nimport { createDetermineChildrenOperator } from \"./operators/DetermineChildren.js\";\nimport { createGroupingOperator } from \"./operators/Grouping.js\";\nimport { createHideIfNoChildrenOperator } from \"./operators/HideIfNoChildren.js\";\nimport { createHideNodesInHierarchyOperator } from \"./operators/HideNodesInHierarchy.js\";\nimport { SearchHierarchyDefinition } from \"./SearchHierarchyDefinition.js\";\nimport { readNodes } from \"./TreeNodesReader.js\";\n\nconst LOGGING_NAMESPACE = `${BASE_LOGGING_NAMESPACE}.IModelHierarchyProvider`;\nconst LOGGING_NAMESPACE_INTERNAL = `${BASE_LOGGING_NAMESPACE_INTERNAL}.IModelHierarchyProvider`;\nconst LOGGING_NAMESPACE_PERFORMANCE = `${BASE_LOGGING_NAMESPACE_PERFORMANCE}.IModelHierarchyProvider`;\n\nconst DEFAULT_QUERY_CONCURRENCY = 10;\nconst DEFAULT_QUERY_CACHE_SIZE = 1;\n\n/**\n * Defines the strings used by hierarchy provider.\n * @public\n */\ninterface IModelHierarchyProviderLocalizedStrings {\n /**\n * A string for \"Unspecified\". Used for labels of property grouping nodes\n * that group by an empty value.\n */\n unspecified: string;\n\n /**\n * A string for \"Other\". Used for label of a range property grouping node that\n * groups values which don't fit into any other range.\n */\n other: string;\n}\n\n/** @public */\ntype IModelAccess = ECSchemaProvider & LimitingECSqlQueryExecutor & ECClassHierarchyInspector & { imodelKey: string };\n\n/**\n * Props for `createIModelHierarchyProvider`.\n * @public\n */\ninterface IModelHierarchyProviderProps {\n /**\n * An object that provides access to iModel's data and metadata.\n *\n * @see `ECSchemaProvider`\n * @see `LimitingECSqlQueryExecutor`\n * @see `ECClassHierarchyInspector`\n */\n imodelAccess: IModelAccess;\n\n /**\n * An event that is raised when iModel data, that may affect the hierarchy, changes. The created provider\n * subscribes to the event to know that it needs to reload the data, and unsubscribes on disposal.\n */\n imodelChanged?: Event<() => void>;\n\n /**\n * A function that returns a hierarchy definition, describing how the hierarchy that the provider should be create. The\n * function is called once during the provider's construction.\n */\n hierarchyDefinition: HierarchyDefinition;\n\n /** Maximum number of queries that the provider attempts to execute in parallel. Defaults to `10`. */\n queryConcurrency?: number;\n\n /**\n * The amount of queries whose results are stored in-memory for quick retrieval. Defaults to `1`,\n * which means only results of the last run query are cached.\n */\n queryCacheSize?: number;\n\n /** A set of localized strings to use. Defaults to English strings. */\n localizedStrings?: Partial<IModelHierarchyProviderLocalizedStrings>;\n\n /**\n * A values formatter for formatting node labels. Defaults to the\n * result of `createDefaultValueFormatter` called with default parameters. May be overridden\n * by calling `setFormatter` on the provider instance.\n */\n formatter?: IPrimitiveValueFormatter;\n\n /** Props for search the hierarchy. */\n search?: {\n /** A list of node identifiers from root to target node. */\n paths: HierarchySearchPath[];\n };\n}\n\n/**\n * Creates an instance of `HierarchyProvider` that creates a hierarchy based on given the iModel and\n * a hierarchy definition, which defines each hierarchy level through ECSQL queries.\n *\n * @public\n */\nexport function createIModelHierarchyProvider(props: IModelHierarchyProviderProps): HierarchyProvider & Disposable {\n const { imodelAccess, imodelChanged, ...restProps } = props;\n return createMergedIModelHierarchyProvider({ ...restProps, imodels: [{ imodelAccess, imodelChanged }] });\n}\n\n/**\n * Props for `createMergedIModelHierarchyProvider`.\n * @alpha\n */\ninterface MergedIModelHierarchyProviderProps extends Omit<IModelHierarchyProviderProps, \"imodelAccess\" | \"imodelChanged\"> {\n /**\n * A list of iModels to create merged hierarchy for.\n *\n * **Warning:** These **must** all be different versions of the same iModel, ordered from the earliest to the\n * latest version. Not obeying this rule may result in undefined behavior.\n */\n imodels: Array<{\n /**\n * An object that provides access to iModel's data and metadata.\n *\n * @see `ECSchemaProvider`\n * @see `LimitingECSqlQueryExecutor`\n * @see `ECClassHierarchyInspector`\n */\n imodelAccess: IModelAccess;\n\n /**\n * An event that is raised when iModel data, that may affect the hierarchy, changes. The created provider\n * subscribes to the event to know that it needs to reload the data, and unsubscribes on disposal.\n */\n imodelChanged?: Event<() => void>;\n }>;\n}\n\n/**\n * Creates an instance of `HierarchyProvider` that creates a hierarchy based on multiple version of **the same** iModel\n * and a hierarchy definition, which defines each hierarchy level through ECSQL queries.\n *\n * **Warning:** This is an experimental API that **should not be used in production**.\n *\n * @alpha\n */\nexport function createMergedIModelHierarchyProvider(props: MergedIModelHierarchyProviderProps): HierarchyProvider & Disposable {\n return new IModelHierarchyProviderImpl(props);\n}\n\ninterface RequestContextProp {\n requestContext: {\n requestId: string;\n };\n}\n\ntype WithSourceNameOverride<T> = T & { sourceName?: string };\n\nclass IModelHierarchyProviderImpl implements HierarchyProvider {\n private _imodels: Array<{ imodelAccess: IModelAccess; imodelChanged?: Event<() => void> }>;\n private _hierarchyChanged: BeEvent<(args?: EventArgs<HierarchyProvider[\"hierarchyChanged\"]>) => void>;\n private _valuesFormatter: IPrimitiveValueFormatter;\n private _sourceHierarchyDefinition: RxjsHierarchyDefinition;\n private _activeHierarchyDefinition: RxjsHierarchyDefinition;\n private _localizedStrings: IModelHierarchyProviderLocalizedStrings;\n private _queryConcurrency: number;\n private _querySchedulers: Map<string, SubscriptionScheduler>;\n private _nodesCache?: HierarchyCache<HierarchyCacheEntry>;\n private _unsubscribe?: () => void;\n private _dispose = new Subject<void>();\n #componentId: GuidString;\n #componentName: string;\n #sourceName: string;\n\n public constructor(props: WithSourceNameOverride<MergedIModelHierarchyProviderProps>) {\n if (props.imodels.length === 0) {\n throw new Error(`Creating an iModel hierarchy provider requires at least one iModel.`);\n }\n\n this.#componentId = Guid.createValue();\n this.#componentName = \"IModelHierarchyProviderImpl\";\n /* c8 ignore next */\n this.#sourceName = props.sourceName ?? `${this.#componentName}:${this.#componentId}`;\n this._imodels = props.imodels;\n this._hierarchyChanged = new BeEvent();\n this._activeHierarchyDefinition = this._sourceHierarchyDefinition = getRxjsHierarchyDefinition(props.hierarchyDefinition);\n this._valuesFormatter = props?.formatter ?? createDefaultValueFormatter();\n this._localizedStrings = { other: \"Other\", unspecified: \"Not specified\", ...props?.localizedStrings };\n this._queryConcurrency = props.queryConcurrency ?? DEFAULT_QUERY_CONCURRENCY;\n this._querySchedulers = new Map();\n this.setHierarchySearch(props.search);\n\n const queryCacheSize = props.queryCacheSize ?? DEFAULT_QUERY_CACHE_SIZE;\n if (queryCacheSize !== 0) {\n this._nodesCache = new HierarchyCache({\n // we divide the size by 2, because each variation also counts as a query that we cache\n size: Math.ceil(queryCacheSize / 2),\n variationsCount: 1,\n });\n }\n\n const imodelChangeSubscription = from(this._imodels)\n .pipe(\n mergeMap(({ imodelAccess, imodelChanged }) =>\n imodelChanged\n ? fromEventPattern(\n (handler) => imodelChanged.addListener(handler),\n (handler) => imodelChanged.removeListener(handler),\n () => imodelAccess,\n )\n : EMPTY,\n ),\n )\n .subscribe(({ imodelKey }) => {\n this.invalidateHierarchyCache(`Data source changed: \"${imodelKey}\"`);\n this._dispose.next();\n this._hierarchyChanged.raiseEvent();\n });\n this._unsubscribe = () => {\n imodelChangeSubscription.unsubscribe();\n };\n }\n\n public [Symbol.dispose]() {\n this._dispose.next();\n this._unsubscribe?.();\n }\n\n /* c8 ignore next 3 */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n public get hierarchyChanged() {\n return this._hierarchyChanged;\n }\n\n private getQueryScheduler(imodelKey: string) {\n let scheduler = this._querySchedulers.get(imodelKey);\n if (!scheduler) {\n scheduler = new SubscriptionScheduler(this._queryConcurrency);\n this._querySchedulers.set(imodelKey, scheduler);\n }\n return scheduler;\n }\n\n private getPrimaryIModelAccess() {\n return this._imodels[this._imodels.length - 1].imodelAccess;\n }\n\n private invalidateHierarchyCache(reason?: string) {\n doLog({\n category: `${LOGGING_NAMESPACE}.Events`,\n message: /* c8 ignore next */ () => (reason ? `${reason}: clear hierarchy cache` : `Clear hierarchy cache`),\n });\n this._nodesCache?.clear();\n }\n\n /**\n * Sets `HierarchyProvider` values formatter that formats nodes' labels. If provided `undefined`, then defaults to the\n * result of `createDefaultValueFormatter` called with default parameters.\n */\n public setFormatter(formatter: IPrimitiveValueFormatter | undefined) {\n this._valuesFormatter = formatter ?? createDefaultValueFormatter();\n this._hierarchyChanged.raiseEvent({ formatterChange: { newFormatter: this._valuesFormatter } });\n }\n\n public setHierarchySearch(props: IModelHierarchyProviderProps[\"search\"]) {\n if (!props) {\n if (this._sourceHierarchyDefinition !== this._activeHierarchyDefinition) {\n this._activeHierarchyDefinition = this._sourceHierarchyDefinition;\n this.invalidateHierarchyCache(\"Hierarchy search reset\");\n }\n this._hierarchyChanged.raiseEvent({ searchChange: { newSearch: undefined } });\n return;\n }\n this._activeHierarchyDefinition = new SearchHierarchyDefinition({\n imodelAccess: this.getPrimaryIModelAccess(),\n source: this._sourceHierarchyDefinition,\n sourceName: this.#sourceName,\n targetPaths: props.paths,\n });\n this.invalidateHierarchyCache(\"Hierarchy search set\");\n this._dispose.next();\n this._hierarchyChanged.raiseEvent({ searchChange: { newSearch: props } });\n }\n\n private onGroupingNodeCreated(groupingNode: ProcessedGroupingHierarchyNode, props: GetHierarchyNodesProps) {\n this._nodesCache?.set({ ...props, parentNode: groupingNode }, { observable: from(groupingNode.children), processingStatus: \"pre-processed\" });\n }\n\n private createHierarchyLevelDefinitionsObservable(\n props: Omit<DefineHierarchyLevelProps, \"imodelKey\"> & RequestContextProp,\n ): Observable<\n { imodelAccess: IModelAccess; imodelAccessIndex: number } & (\n | { hierarchyNodesDefinition: GenericHierarchyNodeDefinition }\n | { hierarchyNodesDefinition: InstanceNodesQueryDefinition }\n )\n > {\n const { requestContext, ...defineHierarchyLevelProps } = props;\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () =>\n `[${requestContext.requestId}] Requesting hierarchy level definitions for ${createNodeIdentifierForLogging(props.parentNode)}`,\n });\n\n return from(this._imodels).pipe(\n mergeMap(({ imodelAccess }, imodelAccessIndex) => {\n let parentNode = props.parentNode;\n if (parentNode && HierarchyNode.isGeneric(parentNode) && parentNode.key.source && parentNode.key.source !== this.#sourceName) {\n return EMPTY;\n }\n if (parentNode && HierarchyNode.isInstancesNode(parentNode)) {\n parentNode = {\n ...parentNode,\n key: {\n ...parentNode.key,\n instanceKeys: parentNode.key.instanceKeys.filter((ik) => !ik.imodelKey || ik.imodelKey === imodelAccess.imodelKey),\n },\n };\n assert(HierarchyNodeKey.isInstances(parentNode.key));\n if (parentNode.key.instanceKeys.length === 0) {\n return EMPTY;\n }\n }\n return this._activeHierarchyDefinition.defineHierarchyLevel({ ...defineHierarchyLevelProps, parentNode, imodelKey: imodelAccess.imodelKey }).pipe(\n mergeAll(),\n map(\n /* Using `as` to work around TS not understanding that `{ x: A, y: B | C }` is the same as `{ x: A } & ({ y: B } | { y: C })` */\n (hierarchyNodesDefinition) =>\n ({ imodelAccess, imodelAccessIndex, hierarchyNodesDefinition }) as ObservedValueOf<\n ReturnType<typeof this.createHierarchyLevelDefinitionsObservable>\n >,\n ),\n );\n }),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () =>\n `[${requestContext.requestId}] Received all hierarchy level definitions for ${createNodeIdentifierForLogging(props.parentNode)}`,\n }),\n ),\n );\n }\n\n private createSourceNodesObservable(\n props: Omit<DefineHierarchyLevelProps, \"imodelKey\"> & {\n hierarchyLevelSizeLimit?: number | \"unbounded\";\n targetInstanceKeys?: InstanceKey[];\n } & RequestContextProp,\n ): SourceNodesObservable {\n // pipe definitions to nodes and put \"share replay\" on it\n return this.createHierarchyLevelDefinitionsObservable(props).pipe(\n mergeMap(({ imodelAccess, imodelAccessIndex, hierarchyNodesDefinition: def }) =>\n defer((): Observable<SourceHierarchyNode> => {\n if (HierarchyNodesDefinition.isGenericNode(def)) {\n return of({\n ...def.node,\n key: { type: \"generic\" as const, id: def.node.key, source: this.#sourceName },\n });\n }\n return this.getQueryScheduler(imodelAccess.imodelKey).scheduleSubscription(\n of(def.query).pipe(\n map((query) => createInstanceKeysFilteredQuery(query, props.targetInstanceKeys)),\n mergeMap((query) =>\n readNodes({\n queryExecutor: imodelAccess,\n query,\n limit: props.hierarchyLevelSizeLimit,\n parser: this._activeHierarchyDefinition.parseNode\n ? ({ row }) => this._activeHierarchyDefinition.parseNode!({ row, parentNode: props.parentNode, imodelKey: imodelAccess.imodelKey })\n : undefined,\n }),\n ),\n map((node) => ({\n ...node,\n key: { ...node.key, instanceKeys: node.key.instanceKeys.map((key) => ({ ...key, imodelKey: imodelAccess.imodelKey })) },\n })),\n ),\n );\n }).pipe(map((node: SourceHierarchyNode) => ({ imodelAccess, imodelAccessIndex, node }))),\n ),\n mergeNodes,\n map(({ node }) => node),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () => `[${props.requestContext.requestId}] Read all child nodes ${createNodeIdentifierForLogging(props.parentNode)}`,\n }),\n ),\n shareReplayWithErrors(),\n );\n }\n\n private createPreProcessedNodesObservable(\n queryNodesObservable: SourceNodesObservable,\n props: GetHierarchyNodesProps & RequestContextProp,\n ): Observable<ProcessedHierarchyNode> {\n return queryNodesObservable.pipe(\n // we're going to be mutating the nodes, but don't want to mutate the original one, so just clone it here once\n map((node) => ({ ...node })),\n // set parent node keys on the source node\n map((node) => Object.assign(node, { parentKeys: createParentNodeKeysList(props.parentNode) })),\n // format `ConcatenatedValue` labels into string labels\n mergeMap((node) => applyLabelsFormatting(node, this._valuesFormatter)),\n // we have `ProcessedHierarchyNode` from here\n // let consumers step-in\n preProcessNodes(this._activeHierarchyDefinition),\n // process hiding\n createHideIfNoChildrenOperator((n) => this.getChildNodesObservables({ parentNode: n, requestContext: props.requestContext }).hasNodes),\n createHideNodesInHierarchyOperator(\n // note: for child nodes created because of hidden parent, we want to use parent's request props (instance filter, limit)\n (n) => this.getChildNodesObservables({ ...props, parentNode: n }).processedNodes,\n false,\n ),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () =>\n `[${props.requestContext.requestId}] Finished pre-processing child nodes for ${createNodeIdentifierForLogging(props.parentNode)}`,\n }),\n ),\n );\n }\n\n private createProcessedNodesObservable(\n preprocessedNodesObservable: Observable<ProcessedHierarchyNode>,\n props: GetHierarchyNodesProps & RequestContextProp,\n ): Observable<ProcessedHierarchyNode> {\n return preprocessedNodesObservable.pipe(\n createGroupingOperator(this.getPrimaryIModelAccess(), props.parentNode, this._valuesFormatter, this._localizedStrings, undefined, (gn) =>\n this.onGroupingNodeCreated(gn, props),\n ),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () =>\n `[${props.requestContext.requestId}] Finished grouping child nodes for ${createNodeIdentifierForLogging(props.parentNode)}`,\n }),\n ),\n );\n }\n\n private createFinalizedNodesObservable(\n processedNodesObservable: Observable<ProcessedHierarchyNode>,\n props: GetHierarchyNodesProps & RequestContextProp,\n ): Observable<HierarchyNode> {\n return processedNodesObservable.pipe(\n createDetermineChildrenOperator((n) => this.getChildNodesObservables({ parentNode: n, requestContext: props.requestContext }).hasNodes),\n postProcessNodes(this._activeHierarchyDefinition),\n sortNodesByLabelOperator,\n map((n): HierarchyNode => {\n if (\"processingParams\" in n) {\n delete n.processingParams;\n }\n return { ...n, children: hasChildren(n) };\n }),\n takeUntil(this._dispose),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () =>\n `[${props.requestContext.requestId}] Finished finalizing child nodes for ${createNodeIdentifierForLogging(props.parentNode)}`,\n }),\n ),\n );\n }\n\n private createHasNodesObservable(\n preprocessedNodesObservable: Observable<ProcessedHierarchyNode>,\n possiblyKnownChildrenObservable: SourceNodesObservable | undefined,\n props: RequestContextProp,\n ): Observable<boolean> {\n const loggingCategory = `${LOGGING_NAMESPACE_INTERNAL}.HasNodes`;\n return concat((possiblyKnownChildrenObservable ?? EMPTY).pipe(filter((n) => hasChildren(n))), preprocessedNodesObservable).pipe(\n log({\n category: loggingCategory,\n message: /* c8 ignore next */ (n) => `[${props.requestContext.requestId}] Node before mapping to 'true': ${createNodeIdentifierForLogging(n)}`,\n }),\n take(1),\n map(() => true),\n defaultIfEmpty(false),\n catchError((e: Error) => {\n doLog({\n category: loggingCategory,\n message: /* c8 ignore next */ () => `[${props.requestContext.requestId}] Error while determining children: ${e.message}`,\n });\n if (e instanceof RowsLimitExceededError) {\n return of(true);\n }\n throw e;\n }),\n log({ category: loggingCategory, message: /* c8 ignore next */ (r) => `[${props.requestContext.requestId}] Result: ${r}` }),\n );\n }\n\n private getCachedObservableEntry(props: GetHierarchyNodesProps & RequestContextProp): HierarchyCacheEntry {\n const loggingCategory = `${LOGGING_NAMESPACE}.QueryResultsCache`;\n const { parentNode, ...restProps } = props;\n const cached = props.ignoreCache || !this._nodesCache ? undefined : this._nodesCache.get(props);\n if (cached) {\n doLog({\n category: loggingCategory,\n message: /* c8 ignore next */ () =>\n `[${props.requestContext.requestId}] Found query nodes observable for ${createNodeIdentifierForLogging(parentNode)}`,\n });\n return cached;\n }\n\n // if we don't find an entry for a grouping node, we load its instances by getting a query and applying\n // a search based on grouped instance keys\n let targetInstanceKeys: InstanceKey[] | undefined;\n let parentNonGroupingNode: ParentHierarchyNode<NonGroupingHierarchyNode> | undefined;\n if (parentNode) {\n if (HierarchyNode.isGroupingNode(parentNode)) {\n parentNonGroupingNode = parentNode.nonGroupingAncestor;\n targetInstanceKeys = parentNode.groupedInstanceKeys;\n } else {\n // not sure why type checker doesn't pick this up\n assert(HierarchyNode.isGeneric(parentNode) || HierarchyNode.isInstancesNode(parentNode));\n parentNonGroupingNode = parentNode;\n }\n }\n\n const nonGroupingNodeChildrenRequestProps = {\n ...restProps,\n parentNode: parentNonGroupingNode,\n ...(targetInstanceKeys ? { targetInstanceKeys } : undefined),\n };\n const value = { observable: this.createSourceNodesObservable(nonGroupingNodeChildrenRequestProps), processingStatus: \"none\" as const };\n this._nodesCache?.set(nonGroupingNodeChildrenRequestProps, value);\n doLog({\n category: loggingCategory,\n message: /* c8 ignore next */ () => `[${props.requestContext.requestId}] Saved query nodes observable for ${createNodeIdentifierForLogging(parentNode)}`,\n });\n return value;\n }\n\n private getChildNodesObservables(props: GetHierarchyNodesProps & { hierarchyLevelSizeLimit?: number | \"unbounded\" } & RequestContextProp) {\n const entry = this.getCachedObservableEntry(props);\n switch (entry.processingStatus) {\n case \"none\": {\n const pre = this.createPreProcessedNodesObservable(entry.observable, props);\n const post = this.createProcessedNodesObservable(pre, props);\n return {\n processedNodes: post,\n hasNodes: this.createHasNodesObservable(pre, entry.observable, props),\n finalizedNodes: this.createFinalizedNodesObservable(post, props),\n };\n }\n case \"pre-processed\": {\n const post = this.createProcessedNodesObservable(entry.observable, props);\n return {\n processedNodes: post,\n hasNodes: this.createHasNodesObservable(entry.observable, undefined, props),\n finalizedNodes: this.createFinalizedNodesObservable(post, props),\n };\n }\n }\n }\n\n /**\n * Creates and runs a query based on provided props, then processes retrieved nodes and returns them.\n */\n public getNodes(props: GetHierarchyNodesProps): AsyncIterableIterator<HierarchyNode> {\n const requestContext = { requestId: Guid.createValue() };\n const loggingCategory = `${LOGGING_NAMESPACE}.GetNodes`;\n const timer = new StopWatch(undefined, true);\n let error: any;\n let nodesCount = 0;\n doLog({\n category: loggingCategory,\n message: /* c8 ignore next */ () => `[${requestContext.requestId}] Requesting child nodes for ${createNodeIdentifierForLogging(props.parentNode)}`,\n });\n return eachValueFrom(\n this.getChildNodesObservables({ ...props, requestContext }).finalizedNodes.pipe(\n tap(() => ++nodesCount),\n catchError((e) => {\n error = e;\n throw e;\n }),\n finalize(() => {\n doLog({\n category: loggingCategory,\n message: /* c8 ignore next */ () =>\n /* c8 ignore next 3 */ error\n ? `[${requestContext.requestId}] Error creating child nodes for ${createNodeIdentifierForLogging(props.parentNode)}: ${error instanceof Error ? error.message : error.toString()}`\n : `[${requestContext.requestId}] Returned ${nodesCount} child nodes for ${createNodeIdentifierForLogging(props.parentNode)} in ${timer.currentSeconds.toFixed(2)} s.`,\n });\n }),\n ),\n );\n }\n\n private getNodeInstanceKeysObs(props: Omit<GetHierarchyNodesProps, \"ignoreCache\"> & RequestContextProp): Observable<InstanceKey> {\n const { parentNode, instanceFilter, hierarchyLevelSizeLimit = \"unbounded\", requestContext } = props;\n if (parentNode && HierarchyNode.isGroupingNode(parentNode)) {\n return from(parentNode.groupedInstanceKeys);\n }\n assert(!parentNode || HierarchyNode.isGeneric(parentNode) || HierarchyNode.isInstancesNode(parentNode));\n\n // split the definitions based on whether they're for generic nodes or for instance nodes\n const hierarchyLevelDefinitions = this.createHierarchyLevelDefinitionsObservable({ parentNode, instanceFilter, requestContext });\n const [instanceDefs, genericDefs] = partition(\n hierarchyLevelDefinitions,\n (\n x,\n ): x is Omit<ObservedValueOf<typeof hierarchyLevelDefinitions>, \"hierarchyNodesDefinition\"> & {\n hierarchyNodesDefinition: InstanceNodesQueryDefinition;\n } => HierarchyNodesDefinition.isInstanceNodesQuery(x.hierarchyNodesDefinition),\n );\n\n // query instance keys and a flag whether they should be hidden\n const instanceKeys = instanceDefs.pipe(\n mergeMap(({ imodelAccess, hierarchyNodesDefinition: def }) =>\n this.getQueryScheduler(imodelAccess.imodelKey).scheduleSubscription(\n of(def.query).pipe(\n mergeMap(async (query) => {\n const ecsql = `\n SELECT\n ${NodeSelectClauseColumnNames.FullClassName},\n ${NodeSelectClauseColumnNames.ECInstanceId},\n ${NodeSelectClauseColumnNames.HideNodeInHierarchy}\n FROM (\n ${query.ecsql}\n )\n `;\n const reader = imodelAccess.createQueryReader(\n { ...query, ecsql },\n {\n rowFormat: \"Indexes\",\n limit: hierarchyLevelSizeLimit,\n restartToken: `${this.#componentName}/${this.#componentId}/node-instance-keys/${Guid.createValue()}`,\n },\n );\n return from(reader).pipe(\n map((row) => ({\n key: {\n className: normalizeFullClassName(row[0]),\n id: row[1],\n imodelKey: imodelAccess.imodelKey,\n } satisfies IModelInstanceKey,\n hide: !!row[2],\n })),\n );\n }),\n mergeAll(),\n ),\n ),\n ),\n );\n // split the instance keys observable based on whether they should be hidden or not\n const [visibleNodeInstanceKeys, hiddenNodeInstanceKeys] = partition(instanceKeys, ({ hide }) => !hide);\n\n // hidden items' handling:\n // - if a generic node is hidden, we'll want to retrieve instance keys of its children, otherwise we don't care about it,\n // - if an instance key is hidden, we want to create a merged node similar to what we do in `createHideNodesInHierarchyOperator`\n const hiddenParentNodes = merge(\n genericDefs.pipe(\n filter(({ hierarchyNodesDefinition }) => !!hierarchyNodesDefinition.node.processingParams?.hideInHierarchy),\n map(\n ({ hierarchyNodesDefinition }): GenericNodeKey => ({\n type: \"generic\",\n id: hierarchyNodesDefinition.node.key,\n source: this.#sourceName,\n }),\n ),\n ),\n hiddenNodeInstanceKeys.pipe(\n // first merge all keys by class\n reduceToMergeMapList(\n ({ key }) => key.className,\n ({ key }) => key,\n ),\n // then, for each class, create an instance key\n mergeMap((mergedMap): InstancesNodeKey[] =>\n [...mergedMap.entries()].map(([className, keys]) => ({\n type: \"instances\",\n instanceKeys: keys.map(({ id, imodelKey }) => ({ className, id, imodelKey })),\n })),\n ),\n ),\n ).pipe(\n map((key) => ({\n key,\n parentKeys: [],\n label: \"\",\n })),\n );\n\n // merge visible instance keys from this level & the ones we get recursively requesting from deeper levels\n return merge(\n visibleNodeInstanceKeys.pipe(map(({ key }) => key)),\n hiddenParentNodes.pipe(mergeMap((hiddenNode) => this.getNodeInstanceKeysObs({ parentNode: hiddenNode, requestContext }))),\n ).pipe(takeUntil(this._dispose));\n }\n\n /**\n * Creates an iterator for all child hierarchy level instance keys, taking into account any hidden hierarchy levels\n * that there may be under the given parent node.\n */\n public getNodeInstanceKeys(props: Omit<GetHierarchyNodesProps, \"ignoreCache\">): AsyncIterableIterator<InstanceKey> {\n const requestContext = { requestId: Guid.createValue() };\n const loggingCategory = `${LOGGING_NAMESPACE}.GetNodeInstanceKeys`;\n const timer = new StopWatch(undefined, true);\n doLog({\n category: loggingCategory,\n message: /* c8 ignore next */ () => `[${requestContext.requestId}] Requesting keys for ${createNodeIdentifierForLogging(props.parentNode)}`,\n });\n let error: any;\n let keysCount = 0;\n return eachValueFrom(\n this.getNodeInstanceKeysObs({ ...props, requestContext }).pipe(\n tap(() => ++keysCount),\n catchError((e) => {\n error = e;\n throw e;\n }),\n finalize(() => {\n doLog({\n category: loggingCategory,\n message: /* c8 ignore next */ () =>\n /* c8 ignore next 3 */ error\n ? `[${requestContext.requestId}] Error creating node instance keys for ${createNodeIdentifierForLogging(props.parentNode)}: ${error instanceof Error ? error.message : error.toString()}`\n : `[${requestContext.requestId}] Returned ${keysCount} instance keys for ${createNodeIdentifierForLogging(props.parentNode)} in ${timer.currentSeconds.toFixed(2)} s.`,\n });\n }),\n ),\n );\n }\n}\n\ntype SourceHierarchyNode = SourceInstanceHierarchyNode | (Omit<SourceGenericHierarchyNode, \"key\"> & { key: GenericNodeKey });\ntype SourceNodesObservable = Observable<SourceHierarchyNode>;\ntype ProcessedNodesObservable = Observable<ProcessedHierarchyNode>;\ntype HierarchyCacheEntry =\n | { observable: SourceNodesObservable; processingStatus: \"none\" }\n | { observable: ProcessedNodesObservable; processingStatus: \"pre-processed\" };\n\nfunction preProcessNodes(hierarchyFactory: RxjsHierarchyDefinition) {\n return hierarchyFactory.preProcessNode ? processNodes(hierarchyFactory.preProcessNode) : identity;\n}\n\nfunction postProcessNodes(hierarchyFactory: RxjsHierarchyDefinition) {\n return hierarchyFactory.postProcessNode ? processNodes(hierarchyFactory.postProcessNode) : identity;\n}\n\nfunction processNodes<TNode>(processor: (node: TNode) => Observable<TNode>) {\n return (nodes: Observable<TNode>) => nodes.pipe(mergeMap(processor));\n}\n\nfunction applyLabelsFormatting<TNode extends { label: string | ConcatenatedValue }>(\n node: TNode,\n valueFormatter: IPrimitiveValueFormatter,\n): Observable<TNode & { label: string }> {\n return from(\n formatConcatenatedValue({\n value: node.label,\n valueFormatter,\n }),\n ).pipe(\n map((label) => ({\n ...node,\n label,\n })),\n );\n}\n\nfunction createParentNodeKeysList(parentNode: ParentHierarchyNode | undefined) {\n if (!parentNode) {\n return [];\n }\n return [...parentNode.parentKeys, parentNode.key];\n}\n\nfunction createInstanceKeysFilteredQuery(query: ECSqlQueryDef, targetInstanceKeys: InstanceKey[] | undefined): ECSqlQueryDef {\n if (!targetInstanceKeys || !targetInstanceKeys.length) {\n return query;\n }\n const MAX_ALLOWED_BINDINGS = 1000;\n if (targetInstanceKeys.length < MAX_ALLOWED_BINDINGS) {\n return {\n ...query,\n ecsql: `\n SELECT *\n FROM (${query.ecsql}) q\n WHERE q.ECInstanceId IN (${targetInstanceKeys.map(() => \"?\").join(\",\")})\n `,\n bindings: [...(query.bindings ?? []), ...targetInstanceKeys.map((k): ECSqlBinding => ({ type: \"id\", value: k.id }))],\n };\n }\n /* c8 ignore start */\n return {\n ...query,\n ecsql: `\n SELECT *\n FROM (${query.ecsql}) q\n WHERE InVirtualSet(?, q.ECInstanceId)\n `,\n bindings: [...(query.bindings ?? []), { type: \"idset\", value: targetInstanceKeys.map((k) => k.id) }],\n };\n /* c8 ignore end */\n}\n\ninterface MergeNodesInput {\n imodelAccess: IModelAccess;\n imodelAccessIndex: number;\n node: SourceHierarchyNode;\n}\nfunction mergeNodes(source: ObservableInput<MergeNodesInput>) {\n return from(source).pipe(\n reduce((acc, input) => {\n for (let i = 0; i < acc.length; ++i) {\n if (input.imodelAccess === acc[i].imodelAccess) {\n // don't attempt to merge nodes if they come from the same provider\n continue;\n }\n\n // the first argument for `tryMergeNodes` acts as the primary data source, so we have to make sure we pass\n // the node with higher `imodelAccessIndex` first\n const candidates =\n input.imodelAccessIndex > acc[i].imodelAccessIndex\n ? { imodelAccess: input.imodelAccess, imodelAccessIndex: input.imodelAccessIndex, primary: input.node, secondary: acc[i].node }\n : { imodelAccess: acc[i].imodelAccess, imodelAccessIndex: acc[i].imodelAccessIndex, primary: acc[i].node, secondary: input.node };\n const merged = tryMergeNodes(candidates.primary, candidates.secondary);\n if (merged) {\n acc[i] = { node: merged, imodelAccess: candidates.imodelAccess, imodelAccessIndex: candidates.imodelAccessIndex };\n return acc;\n }\n }\n acc.push(input);\n return acc;\n }, new Array<MergeNodesInput>()),\n mergeAll(),\n );\n}\nfunction mergeSearchProps(primary: SourceHierarchyNode[\"search\"], secondary: SourceHierarchyNode[\"search\"]): SourceHierarchyNode[\"search\"] {\n if (!primary || !secondary) {\n return primary ?? secondary;\n }\n\n const hasSearchTargetAncestor = primary.hasSearchTargetAncestor || secondary.hasSearchTargetAncestor;\n const childrenTargetPaths = [...(primary.childrenTargetPaths ?? []), ...(secondary.childrenTargetPaths ?? [])];\n return {\n ...(hasSearchTargetAncestor ? { hasSearchTargetAncestor } : undefined),\n ...(childrenTargetPaths.length ? { childrenTargetPaths } : undefined),\n ...(primary.isSearchTarget || secondary.isSearchTarget\n ? {\n isSearchTarget: true,\n searchTargetOptions: HierarchySearchPath.mergeOptions(\n primary.isSearchTarget ? primary.searchTargetOptions : undefined,\n secondary.isSearchTarget ? secondary.searchTargetOptions : undefined,\n ),\n }\n : {\n isSearchTarget: false,\n }),\n };\n}\nfunction tryMergeInstanceNodes(primary: SourceHierarchyNode, secondary: SourceHierarchyNode): SourceHierarchyNode | undefined {\n if (\n HierarchyNode.isInstancesNode(primary) &&\n HierarchyNode.isInstancesNode(secondary) &&\n primary.key.instanceKeys.some((lhsKey) => secondary.key.instanceKeys.some((rhsKey) => InstanceKey.equals(lhsKey, rhsKey)))\n ) {\n const searchProps = mergeSearchProps(primary.search, secondary.search);\n return {\n ...primary,\n key: {\n type: \"instances\",\n instanceKeys: primary.key.instanceKeys.concat(secondary.key.instanceKeys),\n },\n ...(searchProps ? { search: searchProps } : undefined),\n };\n }\n return undefined;\n}\nfunction tryMergeGenericNodes(primary: SourceHierarchyNode, secondary: SourceHierarchyNode): SourceHierarchyNode | undefined {\n if (HierarchyNode.isGeneric(primary) && HierarchyNode.isGeneric(secondary) && primary.key.type === secondary.key.type) {\n const searchProps = mergeSearchProps(primary.search, secondary.search);\n return {\n ...primary,\n ...(searchProps ? { search: searchProps } : undefined),\n };\n }\n return undefined;\n}\nfunction tryMergeNodes(primary: SourceHierarchyNode, secondary: SourceHierarchyNode): SourceHierarchyNode | undefined {\n return tryMergeInstanceNodes(primary, secondary) ?? tryMergeGenericNodes(primary, secondary) ?? undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IModelHierarchyProvider.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAwKhG,sEAGC;AAuCD,kFAEC;AAlND,0CAAwC;AAExC,+BAwBc;AACd,sDAAmF;AACnF,oEAaoC;AACpC,8DAA+D;AAC/D,0DAAmG;AACnG,gEAA+G;AAE/G,8DAA4D;AAC5D,qDAM+B;AAC/B,mEAA6D;AAC7D,iEAAyD;AACzD,qEAA+D;AAC/D,mFAAiF;AACjF,6FAAuF;AACvF,iEAA4E;AAC5E,uFAA6G;AAC7G,mFAA6E;AAC7E,2DAAqD;AACrD,iFAMwC;AAGxC,2EAA0E;AAC1E,2EAAmF;AACnF,yDAAiE;AACjE,yEAAiF;AACjF,iFAAyF;AACzF,iFAA2E;AAC3E,6DAAiD;AAEjD,MAAM,iBAAiB,GAAG,GAAG,6BAAsB,0BAA0B,CAAC;AAC9E,MAAM,0BAA0B,GAAG,GAAG,sCAA+B,0BAA0B,CAAC;AAChG,MAAM,6BAA6B,GAAG,GAAG,yCAAkC,0BAA0B,CAAC;AAEtG,MAAM,yBAAyB,GAAG,EAAE,CAAC;AACrC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AA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C,MAAM,CAAC,CAAC;QACvE,OAAO;YACL,GAAG,OAAO;YACV,GAAG,EAAE;gBACH,IAAI,EAAE,WAAW;gBACjB,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC;aAC1E;YACD,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SACvD,CAAC;IACJ,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AACD,SAAS,oBAAoB,CAAC,OAA4B,EAAE,SAA8B;IACxF,IAAI,gCAAa,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,gCAAa,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QACtH,MAAM,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QACvE,OAAO;YACL,GAAG,OAAO;YACV,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SACvD,CAAC;IACJ,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AACD,SAAS,aAAa,CAAC,OAA4B,EAAE,SAA8B;IACjF,OAAO,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,oBAAoB,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,SAAS,CAAC;AAC5G,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 \"../internal/DisposePolyfill.js\";\n\nimport {\n catchError,\n concat,\n defaultIfEmpty,\n defer,\n EMPTY,\n filter,\n finalize,\n from,\n fromEventPattern,\n identity,\n map,\n merge,\n mergeAll,\n mergeMap,\n Observable,\n ObservableInput,\n ObservedValueOf,\n of,\n reduce,\n Subject,\n take,\n takeUntil,\n tap,\n} from \"rxjs\";\nimport { assert, BeEvent, Guid, GuidString, StopWatch } from \"@itwin/core-bentley\";\nimport {\n ConcatenatedValue,\n createDefaultValueFormatter,\n ECClassHierarchyInspector,\n ECSchemaProvider,\n ECSqlBinding,\n ECSqlQueryDef,\n Event,\n EventArgs,\n formatConcatenatedValue,\n InstanceKey,\n IPrimitiveValueFormatter,\n normalizeFullClassName,\n} from \"@itwin/presentation-shared\";\nimport { RowsLimitExceededError } from \"../HierarchyErrors.js\";\nimport { HierarchyNode, NonGroupingHierarchyNode, ParentHierarchyNode } from \"../HierarchyNode.js\";\nimport { GenericNodeKey, HierarchyNodeKey, IModelInstanceKey, InstancesNodeKey } from \"../HierarchyNodeKey.js\";\nimport { GetHierarchyNodesProps, HierarchyProvider } from \"../HierarchyProvider.js\";\nimport { HierarchySearchPath } from \"../HierarchySearch.js\";\nimport {\n LOGGING_NAMESPACE as BASE_LOGGING_NAMESPACE,\n LOGGING_NAMESPACE_INTERNAL as BASE_LOGGING_NAMESPACE_INTERNAL,\n LOGGING_NAMESPACE_PERFORMANCE as BASE_LOGGING_NAMESPACE_PERFORMANCE,\n createNodeIdentifierForLogging,\n hasChildren,\n} from \"../internal/Common.js\";\nimport { eachValueFrom } from \"../internal/EachValueFrom.js\";\nimport { doLog, log } from \"../internal/LoggingUtils.js\";\nimport { partition } from \"../internal/operators/Partition.js\";\nimport { reduceToMergeMapList } from \"../internal/operators/ReduceToMergeMap.js\";\nimport { shareReplayWithErrors } from \"../internal/operators/ShareReplayWithErrors.js\";\nimport { sortNodesByLabelOperator } from \"../internal/operators/Sorting.js\";\nimport { getRxjsHierarchyDefinition, RxjsHierarchyDefinition } from \"../internal/RxjsHierarchyDefinition.js\";\nimport { SubscriptionScheduler } from \"../internal/SubscriptionScheduler.js\";\nimport { HierarchyCache } from \"./HierarchyCache.js\";\nimport {\n DefineHierarchyLevelProps,\n GenericHierarchyNodeDefinition,\n HierarchyDefinition,\n HierarchyNodesDefinition,\n InstanceNodesQueryDefinition,\n} from \"./IModelHierarchyDefinition.js\";\nimport { ProcessedGroupingHierarchyNode, ProcessedHierarchyNode, SourceGenericHierarchyNode, SourceInstanceHierarchyNode } from \"./IModelHierarchyNode.js\";\nimport { LimitingECSqlQueryExecutor } from \"./LimitingECSqlQueryExecutor.js\";\nimport { NodeSelectClauseColumnNames } from \"./NodeSelectQueryFactory.js\";\nimport { createDetermineChildrenOperator } from \"./operators/DetermineChildren.js\";\nimport { createGroupingOperator } from \"./operators/Grouping.js\";\nimport { createHideIfNoChildrenOperator } from \"./operators/HideIfNoChildren.js\";\nimport { createHideNodesInHierarchyOperator } from \"./operators/HideNodesInHierarchy.js\";\nimport { SearchHierarchyDefinition } from \"./SearchHierarchyDefinition.js\";\nimport { readNodes } from \"./TreeNodesReader.js\";\n\nconst LOGGING_NAMESPACE = `${BASE_LOGGING_NAMESPACE}.IModelHierarchyProvider`;\nconst LOGGING_NAMESPACE_INTERNAL = `${BASE_LOGGING_NAMESPACE_INTERNAL}.IModelHierarchyProvider`;\nconst LOGGING_NAMESPACE_PERFORMANCE = `${BASE_LOGGING_NAMESPACE_PERFORMANCE}.IModelHierarchyProvider`;\n\nconst DEFAULT_QUERY_CONCURRENCY = 10;\nconst DEFAULT_QUERY_CACHE_SIZE = 1;\n\n/**\n * Defines the strings used by hierarchy provider.\n * @public\n */\ninterface IModelHierarchyProviderLocalizedStrings {\n /**\n * A string for \"Unspecified\". Used for labels of property grouping nodes\n * that group by an empty value.\n */\n unspecified: string;\n\n /**\n * A string for \"Other\". Used for label of a range property grouping node that\n * groups values which don't fit into any other range.\n */\n other: string;\n}\n\n/** @public */\ntype IModelAccess = ECSchemaProvider & LimitingECSqlQueryExecutor & ECClassHierarchyInspector & { imodelKey: string };\n\n/**\n * Props for `createIModelHierarchyProvider`.\n * @public\n */\ninterface IModelHierarchyProviderProps {\n /**\n * An object that provides access to iModel's data and metadata.\n *\n * @see `ECSchemaProvider`\n * @see `LimitingECSqlQueryExecutor`\n * @see `ECClassHierarchyInspector`\n */\n imodelAccess: IModelAccess;\n\n /**\n * An event that is raised when iModel data, that may affect the hierarchy, changes. The created provider\n * subscribes to the event to know that it needs to reload the data, and unsubscribes on disposal.\n */\n imodelChanged?: Event<() => void>;\n\n /**\n * A function that returns a hierarchy definition, describing how the hierarchy that the provider should be create. The\n * function is called once during the provider's construction.\n */\n hierarchyDefinition: HierarchyDefinition;\n\n /** Maximum number of queries that the provider attempts to execute in parallel. Defaults to `10`. */\n queryConcurrency?: number;\n\n /**\n * The amount of queries whose results are stored in-memory for quick retrieval. Defaults to `1`,\n * which means only results of the last run query are cached.\n */\n queryCacheSize?: number;\n\n /** A set of localized strings to use. Defaults to English strings. */\n localizedStrings?: Partial<IModelHierarchyProviderLocalizedStrings>;\n\n /**\n * A values formatter for formatting node labels. Defaults to the\n * result of `createDefaultValueFormatter` called with default parameters. May be overridden\n * by calling `setFormatter` on the provider instance.\n */\n formatter?: IPrimitiveValueFormatter;\n\n /** Props for search the hierarchy. */\n search?: {\n /** A list of node identifiers from root to target node. */\n paths: HierarchySearchPath[];\n };\n}\n\n/**\n * Creates an instance of `HierarchyProvider` that creates a hierarchy based on given the iModel and\n * a hierarchy definition, which defines each hierarchy level through ECSQL queries.\n *\n * @public\n */\nexport function createIModelHierarchyProvider(props: IModelHierarchyProviderProps): HierarchyProvider & Disposable {\n const { imodelAccess, imodelChanged, ...restProps } = props;\n return createMergedIModelHierarchyProvider({ ...restProps, imodels: [{ imodelAccess, imodelChanged }] });\n}\n\n/**\n * Props for `createMergedIModelHierarchyProvider`.\n * @alpha\n */\ninterface MergedIModelHierarchyProviderProps extends Omit<IModelHierarchyProviderProps, \"imodelAccess\" | \"imodelChanged\"> {\n /**\n * A list of iModels to create merged hierarchy for.\n *\n * **Warning:** These **must** all be different versions of the same iModel, ordered from the earliest to the\n * latest version. Not obeying this rule may result in undefined behavior.\n */\n imodels: Array<{\n /**\n * An object that provides access to iModel's data and metadata.\n *\n * @see `ECSchemaProvider`\n * @see `LimitingECSqlQueryExecutor`\n * @see `ECClassHierarchyInspector`\n */\n imodelAccess: IModelAccess;\n\n /**\n * An event that is raised when iModel data, that may affect the hierarchy, changes. The created provider\n * subscribes to the event to know that it needs to reload the data, and unsubscribes on disposal.\n */\n imodelChanged?: Event<() => void>;\n }>;\n}\n\n/**\n * Creates an instance of `HierarchyProvider` that creates a hierarchy based on multiple version of **the same** iModel\n * and a hierarchy definition, which defines each hierarchy level through ECSQL queries.\n *\n * **Warning:** This is an experimental API that **should not be used in production**.\n *\n * @alpha\n */\nexport function createMergedIModelHierarchyProvider(props: MergedIModelHierarchyProviderProps): HierarchyProvider & Disposable {\n return new IModelHierarchyProviderImpl(props);\n}\n\ninterface RequestContextProp {\n requestContext: {\n requestId: string;\n };\n}\n\ntype WithSourceNameOverride<T> = T & { sourceName?: string };\n\nclass IModelHierarchyProviderImpl implements HierarchyProvider {\n private _imodels: Array<{ imodelAccess: IModelAccess; imodelChanged?: Event<() => void> }>;\n private _hierarchyChanged: BeEvent<(args?: EventArgs<HierarchyProvider[\"hierarchyChanged\"]>) => void>;\n private _valuesFormatter: IPrimitiveValueFormatter;\n private _sourceHierarchyDefinition: RxjsHierarchyDefinition;\n private _activeHierarchyDefinition: RxjsHierarchyDefinition;\n private _localizedStrings: IModelHierarchyProviderLocalizedStrings;\n private _queryConcurrency: number;\n private _querySchedulers: Map<string, SubscriptionScheduler>;\n private _nodesCache?: HierarchyCache<HierarchyCacheEntry>;\n private _unsubscribe?: () => void;\n private _dispose = new Subject<void>();\n #componentId: GuidString;\n #componentName: string;\n #sourceName: string;\n\n public constructor(props: WithSourceNameOverride<MergedIModelHierarchyProviderProps>) {\n if (props.imodels.length === 0) {\n throw new Error(`Creating an iModel hierarchy provider requires at least one iModel.`);\n }\n\n this.#componentId = Guid.createValue();\n this.#componentName = \"IModelHierarchyProviderImpl\";\n /* c8 ignore next */\n this.#sourceName = props.sourceName ?? `${this.#componentName}:${this.#componentId}`;\n this._imodels = props.imodels;\n this._hierarchyChanged = new BeEvent();\n this._activeHierarchyDefinition = this._sourceHierarchyDefinition = getRxjsHierarchyDefinition(props.hierarchyDefinition);\n this._valuesFormatter = props?.formatter ?? createDefaultValueFormatter();\n this._localizedStrings = { other: \"Other\", unspecified: \"Not specified\", ...props?.localizedStrings };\n this._queryConcurrency = props.queryConcurrency ?? DEFAULT_QUERY_CONCURRENCY;\n this._querySchedulers = new Map();\n this.setHierarchySearch(props.search);\n\n const queryCacheSize = props.queryCacheSize ?? DEFAULT_QUERY_CACHE_SIZE;\n if (queryCacheSize !== 0) {\n this._nodesCache = new HierarchyCache({\n // we divide the size by 2, because each variation also counts as a query that we cache\n size: Math.ceil(queryCacheSize / 2),\n variationsCount: 1,\n });\n }\n\n const imodelChangeSubscription = from(this._imodels)\n .pipe(\n mergeMap(({ imodelAccess, imodelChanged }) =>\n imodelChanged\n ? fromEventPattern(\n (handler) => imodelChanged.addListener(handler),\n (handler) => imodelChanged.removeListener(handler),\n () => imodelAccess,\n )\n : EMPTY,\n ),\n )\n .subscribe(({ imodelKey }) => {\n this.invalidateHierarchyCache(`Data source changed: \"${imodelKey}\"`);\n this._dispose.next();\n this._hierarchyChanged.raiseEvent();\n });\n this._unsubscribe = () => {\n imodelChangeSubscription.unsubscribe();\n };\n }\n\n public [Symbol.dispose]() {\n this._dispose.next();\n this._unsubscribe?.();\n }\n\n /* c8 ignore next 3 */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n public get hierarchyChanged() {\n return this._hierarchyChanged;\n }\n\n private getQueryScheduler(imodelKey: string) {\n let scheduler = this._querySchedulers.get(imodelKey);\n if (!scheduler) {\n scheduler = new SubscriptionScheduler(this._queryConcurrency);\n this._querySchedulers.set(imodelKey, scheduler);\n }\n return scheduler;\n }\n\n private getPrimaryIModelAccess() {\n return this._imodels[this._imodels.length - 1].imodelAccess;\n }\n\n private invalidateHierarchyCache(reason?: string) {\n doLog({\n category: `${LOGGING_NAMESPACE}.Events`,\n message: /* c8 ignore next */ () => (reason ? `${reason}: clear hierarchy cache` : `Clear hierarchy cache`),\n });\n this._nodesCache?.clear();\n }\n\n /**\n * Sets `HierarchyProvider` values formatter that formats nodes' labels. If provided `undefined`, then defaults to the\n * result of `createDefaultValueFormatter` called with default parameters.\n */\n public setFormatter(formatter: IPrimitiveValueFormatter | undefined) {\n this._valuesFormatter = formatter ?? createDefaultValueFormatter();\n this._hierarchyChanged.raiseEvent({ formatterChange: { newFormatter: this._valuesFormatter } });\n }\n\n public setHierarchySearch(props: IModelHierarchyProviderProps[\"search\"]) {\n if (!props) {\n if (this._sourceHierarchyDefinition !== this._activeHierarchyDefinition) {\n this._activeHierarchyDefinition = this._sourceHierarchyDefinition;\n this.invalidateHierarchyCache(\"Hierarchy search reset\");\n }\n this._hierarchyChanged.raiseEvent({ searchChange: { newSearch: undefined } });\n return;\n }\n this._activeHierarchyDefinition = new SearchHierarchyDefinition({\n imodelAccess: this.getPrimaryIModelAccess(),\n source: this._sourceHierarchyDefinition,\n sourceName: this.#sourceName,\n targetPaths: props.paths,\n });\n this.invalidateHierarchyCache(\"Hierarchy search set\");\n this._dispose.next();\n this._hierarchyChanged.raiseEvent({ searchChange: { newSearch: props } });\n }\n\n private onGroupingNodeCreated(groupingNode: ProcessedGroupingHierarchyNode, props: GetHierarchyNodesProps) {\n this._nodesCache?.set({ ...props, parentNode: groupingNode }, { observable: from(groupingNode.children), processingStatus: \"pre-processed\" });\n }\n\n private createHierarchyLevelDefinitionsObservable(\n props: Omit<DefineHierarchyLevelProps, \"imodelAccess\"> & RequestContextProp,\n ): Observable<\n { imodelAccess: IModelAccess; imodelAccessIndex: number } & (\n | { hierarchyNodesDefinition: GenericHierarchyNodeDefinition }\n | { hierarchyNodesDefinition: InstanceNodesQueryDefinition }\n )\n > {\n const { requestContext, ...defineHierarchyLevelProps } = props;\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () =>\n `[${requestContext.requestId}] Requesting hierarchy level definitions for ${createNodeIdentifierForLogging(props.parentNode)}`,\n });\n\n return from(this._imodels).pipe(\n mergeMap(({ imodelAccess }, imodelAccessIndex) => {\n let parentNode = props.parentNode;\n if (parentNode && HierarchyNode.isGeneric(parentNode) && parentNode.key.source && parentNode.key.source !== this.#sourceName) {\n return EMPTY;\n }\n if (parentNode && HierarchyNode.isInstancesNode(parentNode)) {\n parentNode = {\n ...parentNode,\n key: {\n ...parentNode.key,\n instanceKeys: parentNode.key.instanceKeys.filter((ik) => !ik.imodelKey || ik.imodelKey === imodelAccess.imodelKey),\n },\n };\n assert(HierarchyNodeKey.isInstances(parentNode.key));\n if (parentNode.key.instanceKeys.length === 0) {\n return EMPTY;\n }\n }\n return this._activeHierarchyDefinition.defineHierarchyLevel({ ...defineHierarchyLevelProps, parentNode, imodelAccess }).pipe(\n mergeAll(),\n map(\n /* Using `as` to work around TS not understanding that `{ x: A, y: B | C }` is the same as `{ x: A } & ({ y: B } | { y: C })` */\n (hierarchyNodesDefinition) =>\n ({ imodelAccess, imodelAccessIndex, hierarchyNodesDefinition }) as ObservedValueOf<\n ReturnType<typeof this.createHierarchyLevelDefinitionsObservable>\n >,\n ),\n );\n }),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () =>\n `[${requestContext.requestId}] Received all hierarchy level definitions for ${createNodeIdentifierForLogging(props.parentNode)}`,\n }),\n ),\n );\n }\n\n private createSourceNodesObservable(\n props: Omit<DefineHierarchyLevelProps, \"imodelAccess\"> & {\n hierarchyLevelSizeLimit?: number | \"unbounded\";\n targetInstanceKeys?: InstanceKey[];\n } & RequestContextProp,\n ): SourceNodesObservable {\n // pipe definitions to nodes and put \"share replay\" on it\n return this.createHierarchyLevelDefinitionsObservable(props).pipe(\n mergeMap(({ imodelAccess, imodelAccessIndex, hierarchyNodesDefinition: def }) =>\n defer((): Observable<SourceHierarchyNode> => {\n if (HierarchyNodesDefinition.isGenericNode(def)) {\n return of({\n ...def.node,\n key: { type: \"generic\" as const, id: def.node.key, source: this.#sourceName },\n });\n }\n return this.getQueryScheduler(imodelAccess.imodelKey).scheduleSubscription(\n of(def.query).pipe(\n map((query) => createInstanceKeysFilteredQuery(query, props.targetInstanceKeys)),\n mergeMap((query) =>\n readNodes({\n queryExecutor: imodelAccess,\n query,\n limit: props.hierarchyLevelSizeLimit,\n parser: this._activeHierarchyDefinition.parseNode\n ? ({ row }) => this._activeHierarchyDefinition.parseNode!({ row, parentNode: props.parentNode, imodelKey: imodelAccess.imodelKey })\n : undefined,\n }),\n ),\n map((node) => ({\n ...node,\n key: { ...node.key, instanceKeys: node.key.instanceKeys.map((key) => ({ ...key, imodelKey: imodelAccess.imodelKey })) },\n })),\n ),\n );\n }).pipe(map((node: SourceHierarchyNode) => ({ imodelAccess, imodelAccessIndex, node }))),\n ),\n mergeNodes,\n map(({ node }) => node),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () => `[${props.requestContext.requestId}] Read all child nodes ${createNodeIdentifierForLogging(props.parentNode)}`,\n }),\n ),\n shareReplayWithErrors(),\n );\n }\n\n private createPreProcessedNodesObservable(\n queryNodesObservable: SourceNodesObservable,\n props: GetHierarchyNodesProps & RequestContextProp,\n ): Observable<ProcessedHierarchyNode> {\n return queryNodesObservable.pipe(\n // we're going to be mutating the nodes, but don't want to mutate the original one, so just clone it here once\n map((node) => ({ ...node })),\n // set parent node keys on the source node\n map((node) => Object.assign(node, { parentKeys: createParentNodeKeysList(props.parentNode) })),\n // format `ConcatenatedValue` labels into string labels\n mergeMap((node) => applyLabelsFormatting(node, this._valuesFormatter)),\n // we have `ProcessedHierarchyNode` from here\n // let consumers step-in\n preProcessNodes(this._activeHierarchyDefinition),\n // process hiding\n createHideIfNoChildrenOperator((n) => this.getChildNodesObservables({ parentNode: n, requestContext: props.requestContext }).hasNodes),\n createHideNodesInHierarchyOperator(\n // note: for child nodes created because of hidden parent, we want to use parent's request props (instance filter, limit)\n (n) => this.getChildNodesObservables({ ...props, parentNode: n }).processedNodes,\n false,\n ),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () =>\n `[${props.requestContext.requestId}] Finished pre-processing child nodes for ${createNodeIdentifierForLogging(props.parentNode)}`,\n }),\n ),\n );\n }\n\n private createProcessedNodesObservable(\n preprocessedNodesObservable: Observable<ProcessedHierarchyNode>,\n props: GetHierarchyNodesProps & RequestContextProp,\n ): Observable<ProcessedHierarchyNode> {\n return preprocessedNodesObservable.pipe(\n createGroupingOperator(this.getPrimaryIModelAccess(), props.parentNode, this._valuesFormatter, this._localizedStrings, undefined, (gn) =>\n this.onGroupingNodeCreated(gn, props),\n ),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () =>\n `[${props.requestContext.requestId}] Finished grouping child nodes for ${createNodeIdentifierForLogging(props.parentNode)}`,\n }),\n ),\n );\n }\n\n private createFinalizedNodesObservable(\n processedNodesObservable: Observable<ProcessedHierarchyNode>,\n props: GetHierarchyNodesProps & RequestContextProp,\n ): Observable<HierarchyNode> {\n return processedNodesObservable.pipe(\n createDetermineChildrenOperator((n) => this.getChildNodesObservables({ parentNode: n, requestContext: props.requestContext }).hasNodes),\n postProcessNodes(this._activeHierarchyDefinition),\n sortNodesByLabelOperator,\n map((n): HierarchyNode => {\n if (\"processingParams\" in n) {\n delete n.processingParams;\n }\n return { ...n, children: hasChildren(n) };\n }),\n takeUntil(this._dispose),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () =>\n `[${props.requestContext.requestId}] Finished finalizing child nodes for ${createNodeIdentifierForLogging(props.parentNode)}`,\n }),\n ),\n );\n }\n\n private createHasNodesObservable(\n preprocessedNodesObservable: Observable<ProcessedHierarchyNode>,\n possiblyKnownChildrenObservable: SourceNodesObservable | undefined,\n props: RequestContextProp,\n ): Observable<boolean> {\n const loggingCategory = `${LOGGING_NAMESPACE_INTERNAL}.HasNodes`;\n return concat((possiblyKnownChildrenObservable ?? EMPTY).pipe(filter((n) => hasChildren(n))), preprocessedNodesObservable).pipe(\n log({\n category: loggingCategory,\n message: /* c8 ignore next */ (n) => `[${props.requestContext.requestId}] Node before mapping to 'true': ${createNodeIdentifierForLogging(n)}`,\n }),\n take(1),\n map(() => true),\n defaultIfEmpty(false),\n catchError((e: Error) => {\n doLog({\n category: loggingCategory,\n message: /* c8 ignore next */ () => `[${props.requestContext.requestId}] Error while determining children: ${e.message}`,\n });\n if (e instanceof RowsLimitExceededError) {\n return of(true);\n }\n throw e;\n }),\n log({ category: loggingCategory, message: /* c8 ignore next */ (r) => `[${props.requestContext.requestId}] Result: ${r}` }),\n );\n }\n\n private getCachedObservableEntry(props: GetHierarchyNodesProps & RequestContextProp): HierarchyCacheEntry {\n const loggingCategory = `${LOGGING_NAMESPACE}.QueryResultsCache`;\n const { parentNode, ...restProps } = props;\n const cached = props.ignoreCache || !this._nodesCache ? undefined : this._nodesCache.get(props);\n if (cached) {\n doLog({\n category: loggingCategory,\n message: /* c8 ignore next */ () =>\n `[${props.requestContext.requestId}] Found query nodes observable for ${createNodeIdentifierForLogging(parentNode)}`,\n });\n return cached;\n }\n\n // if we don't find an entry for a grouping node, we load its instances by getting a query and applying\n // a search based on grouped instance keys\n let targetInstanceKeys: InstanceKey[] | undefined;\n let parentNonGroupingNode: ParentHierarchyNode<NonGroupingHierarchyNode> | undefined;\n if (parentNode) {\n if (HierarchyNode.isGroupingNode(parentNode)) {\n parentNonGroupingNode = parentNode.nonGroupingAncestor;\n targetInstanceKeys = parentNode.groupedInstanceKeys;\n } else {\n // not sure why type checker doesn't pick this up\n assert(HierarchyNode.isGeneric(parentNode) || HierarchyNode.isInstancesNode(parentNode));\n parentNonGroupingNode = parentNode;\n }\n }\n\n const nonGroupingNodeChildrenRequestProps = {\n ...restProps,\n parentNode: parentNonGroupingNode,\n ...(targetInstanceKeys ? { targetInstanceKeys } : undefined),\n };\n const value = { observable: this.createSourceNodesObservable(nonGroupingNodeChildrenRequestProps), processingStatus: \"none\" as const };\n this._nodesCache?.set(nonGroupingNodeChildrenRequestProps, value);\n doLog({\n category: loggingCategory,\n message: /* c8 ignore next */ () => `[${props.requestContext.requestId}] Saved query nodes observable for ${createNodeIdentifierForLogging(parentNode)}`,\n });\n return value;\n }\n\n private getChildNodesObservables(props: GetHierarchyNodesProps & { hierarchyLevelSizeLimit?: number | \"unbounded\" } & RequestContextProp) {\n const entry = this.getCachedObservableEntry(props);\n switch (entry.processingStatus) {\n case \"none\": {\n const pre = this.createPreProcessedNodesObservable(entry.observable, props);\n const post = this.createProcessedNodesObservable(pre, props);\n return {\n processedNodes: post,\n hasNodes: this.createHasNodesObservable(pre, entry.observable, props),\n finalizedNodes: this.createFinalizedNodesObservable(post, props),\n };\n }\n case \"pre-processed\": {\n const post = this.createProcessedNodesObservable(entry.observable, props);\n return {\n processedNodes: post,\n hasNodes: this.createHasNodesObservable(entry.observable, undefined, props),\n finalizedNodes: this.createFinalizedNodesObservable(post, props),\n };\n }\n }\n }\n\n /**\n * Creates and runs a query based on provided props, then processes retrieved nodes and returns them.\n */\n public getNodes(props: GetHierarchyNodesProps): AsyncIterableIterator<HierarchyNode> {\n const requestContext = { requestId: Guid.createValue() };\n const loggingCategory = `${LOGGING_NAMESPACE}.GetNodes`;\n const timer = new StopWatch(undefined, true);\n let error: any;\n let nodesCount = 0;\n doLog({\n category: loggingCategory,\n message: /* c8 ignore next */ () => `[${requestContext.requestId}] Requesting child nodes for ${createNodeIdentifierForLogging(props.parentNode)}`,\n });\n return eachValueFrom(\n this.getChildNodesObservables({ ...props, requestContext }).finalizedNodes.pipe(\n tap(() => ++nodesCount),\n catchError((e) => {\n error = e;\n throw e;\n }),\n finalize(() => {\n doLog({\n category: loggingCategory,\n message: /* c8 ignore next */ () =>\n /* c8 ignore next 3 */ error\n ? `[${requestContext.requestId}] Error creating child nodes for ${createNodeIdentifierForLogging(props.parentNode)}: ${error instanceof Error ? error.message : error.toString()}`\n : `[${requestContext.requestId}] Returned ${nodesCount} child nodes for ${createNodeIdentifierForLogging(props.parentNode)} in ${timer.currentSeconds.toFixed(2)} s.`,\n });\n }),\n ),\n );\n }\n\n private getNodeInstanceKeysObs(props: Omit<GetHierarchyNodesProps, \"ignoreCache\"> & RequestContextProp): Observable<InstanceKey> {\n const { parentNode, instanceFilter, hierarchyLevelSizeLimit = \"unbounded\", requestContext } = props;\n if (parentNode && HierarchyNode.isGroupingNode(parentNode)) {\n return from(parentNode.groupedInstanceKeys);\n }\n assert(!parentNode || HierarchyNode.isGeneric(parentNode) || HierarchyNode.isInstancesNode(parentNode));\n\n // split the definitions based on whether they're for generic nodes or for instance nodes\n const hierarchyLevelDefinitions = this.createHierarchyLevelDefinitionsObservable({ parentNode, instanceFilter, requestContext });\n const [instanceDefs, genericDefs] = partition(\n hierarchyLevelDefinitions,\n (\n x,\n ): x is Omit<ObservedValueOf<typeof hierarchyLevelDefinitions>, \"hierarchyNodesDefinition\"> & {\n hierarchyNodesDefinition: InstanceNodesQueryDefinition;\n } => HierarchyNodesDefinition.isInstanceNodesQuery(x.hierarchyNodesDefinition),\n );\n\n // query instance keys and a flag whether they should be hidden\n const instanceKeys = instanceDefs.pipe(\n mergeMap(({ imodelAccess, hierarchyNodesDefinition: def }) =>\n this.getQueryScheduler(imodelAccess.imodelKey).scheduleSubscription(\n of(def.query).pipe(\n mergeMap(async (query) => {\n const ecsql = `\n SELECT\n ${NodeSelectClauseColumnNames.FullClassName},\n ${NodeSelectClauseColumnNames.ECInstanceId},\n ${NodeSelectClauseColumnNames.HideNodeInHierarchy}\n FROM (\n ${query.ecsql}\n )\n `;\n const reader = imodelAccess.createQueryReader(\n { ...query, ecsql },\n {\n rowFormat: \"Indexes\",\n limit: hierarchyLevelSizeLimit,\n restartToken: `${this.#componentName}/${this.#componentId}/node-instance-keys/${Guid.createValue()}`,\n },\n );\n return from(reader).pipe(\n map((row) => ({\n key: {\n className: normalizeFullClassName(row[0]),\n id: row[1],\n imodelKey: imodelAccess.imodelKey,\n } satisfies IModelInstanceKey,\n hide: !!row[2],\n })),\n );\n }),\n mergeAll(),\n ),\n ),\n ),\n );\n // split the instance keys observable based on whether they should be hidden or not\n const [visibleNodeInstanceKeys, hiddenNodeInstanceKeys] = partition(instanceKeys, ({ hide }) => !hide);\n\n // hidden items' handling:\n // - if a generic node is hidden, we'll want to retrieve instance keys of its children, otherwise we don't care about it,\n // - if an instance key is hidden, we want to create a merged node similar to what we do in `createHideNodesInHierarchyOperator`\n const hiddenParentNodes = merge(\n genericDefs.pipe(\n filter(({ hierarchyNodesDefinition }) => !!hierarchyNodesDefinition.node.processingParams?.hideInHierarchy),\n map(\n ({ hierarchyNodesDefinition }): GenericNodeKey => ({\n type: \"generic\",\n id: hierarchyNodesDefinition.node.key,\n source: this.#sourceName,\n }),\n ),\n ),\n hiddenNodeInstanceKeys.pipe(\n // first merge all keys by class\n reduceToMergeMapList(\n ({ key }) => key.className,\n ({ key }) => key,\n ),\n // then, for each class, create an instance key\n mergeMap((mergedMap): InstancesNodeKey[] =>\n [...mergedMap.entries()].map(([className, keys]) => ({\n type: \"instances\",\n instanceKeys: keys.map(({ id, imodelKey }) => ({ className, id, imodelKey })),\n })),\n ),\n ),\n ).pipe(\n map((key) => ({\n key,\n parentKeys: [],\n label: \"\",\n })),\n );\n\n // merge visible instance keys from this level & the ones we get recursively requesting from deeper levels\n return merge(\n visibleNodeInstanceKeys.pipe(map(({ key }) => key)),\n hiddenParentNodes.pipe(mergeMap((hiddenNode) => this.getNodeInstanceKeysObs({ parentNode: hiddenNode, requestContext }))),\n ).pipe(takeUntil(this._dispose));\n }\n\n /**\n * Creates an iterator for all child hierarchy level instance keys, taking into account any hidden hierarchy levels\n * that there may be under the given parent node.\n */\n public getNodeInstanceKeys(props: Omit<GetHierarchyNodesProps, \"ignoreCache\">): AsyncIterableIterator<InstanceKey> {\n const requestContext = { requestId: Guid.createValue() };\n const loggingCategory = `${LOGGING_NAMESPACE}.GetNodeInstanceKeys`;\n const timer = new StopWatch(undefined, true);\n doLog({\n category: loggingCategory,\n message: /* c8 ignore next */ () => `[${requestContext.requestId}] Requesting keys for ${createNodeIdentifierForLogging(props.parentNode)}`,\n });\n let error: any;\n let keysCount = 0;\n return eachValueFrom(\n this.getNodeInstanceKeysObs({ ...props, requestContext }).pipe(\n tap(() => ++keysCount),\n catchError((e) => {\n error = e;\n throw e;\n }),\n finalize(() => {\n doLog({\n category: loggingCategory,\n message: /* c8 ignore next */ () =>\n /* c8 ignore next 3 */ error\n ? `[${requestContext.requestId}] Error creating node instance keys for ${createNodeIdentifierForLogging(props.parentNode)}: ${error instanceof Error ? error.message : error.toString()}`\n : `[${requestContext.requestId}] Returned ${keysCount} instance keys for ${createNodeIdentifierForLogging(props.parentNode)} in ${timer.currentSeconds.toFixed(2)} s.`,\n });\n }),\n ),\n );\n }\n}\n\ntype SourceHierarchyNode = SourceInstanceHierarchyNode | (Omit<SourceGenericHierarchyNode, \"key\"> & { key: GenericNodeKey });\ntype SourceNodesObservable = Observable<SourceHierarchyNode>;\ntype ProcessedNodesObservable = Observable<ProcessedHierarchyNode>;\ntype HierarchyCacheEntry =\n | { observable: SourceNodesObservable; processingStatus: \"none\" }\n | { observable: ProcessedNodesObservable; processingStatus: \"pre-processed\" };\n\nfunction preProcessNodes(hierarchyFactory: RxjsHierarchyDefinition) {\n return hierarchyFactory.preProcessNode ? processNodes(hierarchyFactory.preProcessNode) : identity;\n}\n\nfunction postProcessNodes(hierarchyFactory: RxjsHierarchyDefinition) {\n return hierarchyFactory.postProcessNode ? processNodes(hierarchyFactory.postProcessNode) : identity;\n}\n\nfunction processNodes<TNode>(processor: (node: TNode) => Observable<TNode>) {\n return (nodes: Observable<TNode>) => nodes.pipe(mergeMap(processor));\n}\n\nfunction applyLabelsFormatting<TNode extends { label: string | ConcatenatedValue }>(\n node: TNode,\n valueFormatter: IPrimitiveValueFormatter,\n): Observable<TNode & { label: string }> {\n return from(\n formatConcatenatedValue({\n value: node.label,\n valueFormatter,\n }),\n ).pipe(\n map((label) => ({\n ...node,\n label,\n })),\n );\n}\n\nfunction createParentNodeKeysList(parentNode: ParentHierarchyNode | undefined) {\n if (!parentNode) {\n return [];\n }\n return [...parentNode.parentKeys, parentNode.key];\n}\n\nfunction createInstanceKeysFilteredQuery(query: ECSqlQueryDef, targetInstanceKeys: InstanceKey[] | undefined): ECSqlQueryDef {\n if (!targetInstanceKeys || !targetInstanceKeys.length) {\n return query;\n }\n const MAX_ALLOWED_BINDINGS = 1000;\n if (targetInstanceKeys.length < MAX_ALLOWED_BINDINGS) {\n return {\n ...query,\n ecsql: `\n SELECT *\n FROM (${query.ecsql}) q\n WHERE q.ECInstanceId IN (${targetInstanceKeys.map(() => \"?\").join(\",\")})\n `,\n bindings: [...(query.bindings ?? []), ...targetInstanceKeys.map((k): ECSqlBinding => ({ type: \"id\", value: k.id }))],\n };\n }\n /* c8 ignore start */\n return {\n ...query,\n ecsql: `\n SELECT *\n FROM (${query.ecsql}) q\n WHERE InVirtualSet(?, q.ECInstanceId)\n `,\n bindings: [...(query.bindings ?? []), { type: \"idset\", value: targetInstanceKeys.map((k) => k.id) }],\n };\n /* c8 ignore end */\n}\n\ninterface MergeNodesInput {\n imodelAccess: IModelAccess;\n imodelAccessIndex: number;\n node: SourceHierarchyNode;\n}\nfunction mergeNodes(source: ObservableInput<MergeNodesInput>) {\n return from(source).pipe(\n reduce((acc, input) => {\n for (let i = 0; i < acc.length; ++i) {\n if (input.imodelAccess === acc[i].imodelAccess) {\n // don't attempt to merge nodes if they come from the same provider\n continue;\n }\n\n // the first argument for `tryMergeNodes` acts as the primary data source, so we have to make sure we pass\n // the node with higher `imodelAccessIndex` first\n const candidates =\n input.imodelAccessIndex > acc[i].imodelAccessIndex\n ? { imodelAccess: input.imodelAccess, imodelAccessIndex: input.imodelAccessIndex, primary: input.node, secondary: acc[i].node }\n : { imodelAccess: acc[i].imodelAccess, imodelAccessIndex: acc[i].imodelAccessIndex, primary: acc[i].node, secondary: input.node };\n const merged = tryMergeNodes(candidates.primary, candidates.secondary);\n if (merged) {\n acc[i] = { node: merged, imodelAccess: candidates.imodelAccess, imodelAccessIndex: candidates.imodelAccessIndex };\n return acc;\n }\n }\n acc.push(input);\n return acc;\n }, new Array<MergeNodesInput>()),\n mergeAll(),\n );\n}\nfunction mergeSearchProps(primary: SourceHierarchyNode[\"search\"], secondary: SourceHierarchyNode[\"search\"]): SourceHierarchyNode[\"search\"] {\n if (!primary || !secondary) {\n return primary ?? secondary;\n }\n\n const hasSearchTargetAncestor = primary.hasSearchTargetAncestor || secondary.hasSearchTargetAncestor;\n const childrenTargetPaths = [...(primary.childrenTargetPaths ?? []), ...(secondary.childrenTargetPaths ?? [])];\n return {\n ...(hasSearchTargetAncestor ? { hasSearchTargetAncestor } : undefined),\n ...(childrenTargetPaths.length ? { childrenTargetPaths } : undefined),\n ...(primary.isSearchTarget || secondary.isSearchTarget\n ? {\n isSearchTarget: true,\n searchTargetOptions: HierarchySearchPath.mergeOptions(\n primary.isSearchTarget ? primary.searchTargetOptions : undefined,\n secondary.isSearchTarget ? secondary.searchTargetOptions : undefined,\n ),\n }\n : {\n isSearchTarget: false,\n }),\n };\n}\nfunction tryMergeInstanceNodes(primary: SourceHierarchyNode, secondary: SourceHierarchyNode): SourceHierarchyNode | undefined {\n if (\n HierarchyNode.isInstancesNode(primary) &&\n HierarchyNode.isInstancesNode(secondary) &&\n primary.key.instanceKeys.some((lhsKey) => secondary.key.instanceKeys.some((rhsKey) => InstanceKey.equals(lhsKey, rhsKey)))\n ) {\n const searchProps = mergeSearchProps(primary.search, secondary.search);\n return {\n ...primary,\n key: {\n type: \"instances\",\n instanceKeys: primary.key.instanceKeys.concat(secondary.key.instanceKeys),\n },\n ...(searchProps ? { search: searchProps } : undefined),\n };\n }\n return undefined;\n}\nfunction tryMergeGenericNodes(primary: SourceHierarchyNode, secondary: SourceHierarchyNode): SourceHierarchyNode | undefined {\n if (HierarchyNode.isGeneric(primary) && HierarchyNode.isGeneric(secondary) && primary.key.type === secondary.key.type) {\n const searchProps = mergeSearchProps(primary.search, secondary.search);\n return {\n ...primary,\n ...(searchProps ? { search: searchProps } : undefined),\n };\n }\n return undefined;\n}\nfunction tryMergeNodes(primary: SourceHierarchyNode, secondary: SourceHierarchyNode): SourceHierarchyNode | undefined {\n return tryMergeInstanceNodes(primary, secondary) ?? tryMergeGenericNodes(primary, secondary) ?? undefined;\n}\n"]}
|