@itwin/presentation-hierarchies 1.4.0 → 1.4.2
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 +14 -0
- package/README.md +7 -5
- package/lib/cjs/hierarchies/HierarchyProvider.d.ts +1 -0
- package/lib/cjs/hierarchies/HierarchyProvider.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyProvider.js +1 -0
- package/lib/cjs/hierarchies/HierarchyProvider.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts +2 -0
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js +3 -1
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts +1 -0
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js +2 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/Grouping.d.ts +1 -3
- package/lib/cjs/hierarchies/imodel/operators/Grouping.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/operators/Grouping.js +5 -5
- package/lib/cjs/hierarchies/imodel/operators/Grouping.js.map +1 -1
- package/lib/cjs/hierarchies/internal/Common.d.ts +1 -0
- package/lib/cjs/hierarchies/internal/Common.d.ts.map +1 -1
- package/lib/cjs/hierarchies/internal/Common.js +1 -0
- package/lib/cjs/hierarchies/internal/Common.js.map +1 -1
- package/lib/cjs/hierarchies/internal/DisposePolyfill.d.ts +1 -0
- package/lib/cjs/hierarchies/internal/DisposePolyfill.d.ts.map +1 -0
- package/lib/cjs/hierarchies/internal/DisposePolyfill.js +11 -0
- package/lib/cjs/hierarchies/internal/DisposePolyfill.js.map +1 -0
- package/lib/esm/hierarchies/HierarchyProvider.d.ts +1 -0
- package/lib/esm/hierarchies/HierarchyProvider.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyProvider.js +1 -0
- package/lib/esm/hierarchies/HierarchyProvider.js.map +1 -1
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts +2 -0
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js +3 -1
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts +1 -0
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js +2 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/Grouping.d.ts +1 -3
- package/lib/esm/hierarchies/imodel/operators/Grouping.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/operators/Grouping.js +6 -5
- package/lib/esm/hierarchies/imodel/operators/Grouping.js.map +1 -1
- package/lib/esm/hierarchies/internal/Common.d.ts +1 -0
- package/lib/esm/hierarchies/internal/Common.d.ts.map +1 -1
- package/lib/esm/hierarchies/internal/Common.js +1 -0
- package/lib/esm/hierarchies/internal/Common.js.map +1 -1
- package/lib/esm/hierarchies/internal/DisposePolyfill.d.ts +2 -0
- package/lib/esm/hierarchies/internal/DisposePolyfill.d.ts.map +1 -0
- package/lib/esm/hierarchies/internal/DisposePolyfill.js +11 -0
- package/lib/esm/hierarchies/internal/DisposePolyfill.js.map +1 -0
- package/package.json +9 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelHierarchyProvider.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEh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;YACR,KAAK,EAAE;;gBAEG,KAAK,CAAC,KAAK;mCACQ,oBAAoB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;OACzE;YACD,QAAQ,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAgB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;SACvH,CAAC;IACJ,CAAC;IACD,qBAAqB;IACrB,OAAO;QACL,GAAG,KAAK;QACR,KAAK,EAAE;;cAEG,KAAK,CAAC,KAAK;;KAEpB;QACD,QAAQ,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;KACvG,CAAC;IACF,mBAAmB;AACrB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport {\n catchError,\n concat,\n defaultIfEmpty,\n defer,\n EMPTY,\n filter,\n finalize,\n from,\n map,\n merge,\n mergeAll,\n mergeMap,\n Observable,\n ObservableInput,\n of,\n Subject,\n take,\n takeUntil,\n tap,\n} from \"rxjs\";\nimport { assert, BeEvent, Guid, 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 { HierarchyFilteringPath } from \"../HierarchyFiltering.js\";\nimport { HierarchyNode, NonGroupingHierarchyNode, ParentHierarchyNode } from \"../HierarchyNode.js\";\nimport { GenericNodeKey, HierarchyNodeKey, IModelInstanceKey, InstancesNodeKey } from \"../HierarchyNodeKey.js\";\nimport { GetHierarchyNodesProps, HierarchyProvider } from \"../HierarchyProvider.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 { SubscriptionScheduler } from \"../internal/SubscriptionScheduler.js\";\nimport { FilteringHierarchyDefinition } from \"./FilteringHierarchyDefinition.js\";\nimport { HierarchyCache } from \"./HierarchyCache.js\";\nimport { DefineHierarchyLevelProps, HierarchyDefinition, HierarchyNodesDefinition } from \"./IModelHierarchyDefinition.js\";\nimport {\n ProcessedGenericHierarchyNode,\n ProcessedGroupingHierarchyNode,\n ProcessedHierarchyNode,\n ProcessedInstanceHierarchyNode,\n SourceGenericHierarchyNode,\n SourceInstanceHierarchyNode,\n} 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 { 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 /** An event that is raised when iModel data, that may affect the hierarchy, changes. */\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 * 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 /** Props for filtering the hierarchy. */\n filtering?: {\n /** A list of node identifiers from root to target node. */\n paths: HierarchyFilteringPath[];\n };\n}\n\n/**\n * Creates an instance of `HierarchyProvider` that creates a hierarchy based on given iModel and\n * a hierarchy definition, which defines each hierarchy level through ECSQL queries.\n *\n * @public\n */\nexport function createIModelHierarchyProvider(props: IModelHierarchyProviderProps): HierarchyProvider & {\n /** @deprecated in 1.4. Use `[Symbol.dispose]` instead. */\n dispose: () => void;\n [Symbol.dispose]: () => void;\n} {\n return new IModelHierarchyProviderImpl(props);\n}\n\ninterface RequestContextProp {\n requestContext: {\n requestId: string;\n };\n}\n\nclass IModelHierarchyProviderImpl implements HierarchyProvider {\n private _imodelAccess: IModelAccess;\n private _hierarchyChanged: BeEvent<(args?: EventArgs<HierarchyProvider[\"hierarchyChanged\"]>) => void>;\n private _valuesFormatter: IPrimitiveValueFormatter;\n private _sourceHierarchyDefinition: HierarchyDefinition;\n private _activeHierarchyDefinition: HierarchyDefinition;\n private _localizedStrings: IModelHierarchyProviderLocalizedStrings;\n private _queryScheduler: SubscriptionScheduler;\n private _nodesCache?: HierarchyCache<HierarchyCacheEntry>;\n private _unsubscribe?: () => void;\n private _dispose = new Subject<void>();\n\n public constructor(props: IModelHierarchyProviderProps) {\n this._imodelAccess = props.imodelAccess;\n this._hierarchyChanged = new BeEvent();\n this._activeHierarchyDefinition = this._sourceHierarchyDefinition = props.hierarchyDefinition;\n this._valuesFormatter = props?.formatter ?? createDefaultValueFormatter();\n this._localizedStrings = { other: \"Other\", unspecified: \"Not specified\", ...props?.localizedStrings };\n this._queryScheduler = new SubscriptionScheduler(props.queryConcurrency ?? DEFAULT_QUERY_CONCURRENCY);\n this.setHierarchyFilter(props.filtering);\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 this._unsubscribe = props.imodelChanged?.addListener(() => {\n this.invalidateHierarchyCache(\"Data source changed\");\n this._dispose.next();\n this._hierarchyChanged.raiseEvent();\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 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 setHierarchyFilter(props: IModelHierarchyProviderProps[\"filtering\"]) {\n if (!props) {\n if (this._sourceHierarchyDefinition !== this._activeHierarchyDefinition) {\n this._activeHierarchyDefinition = this._sourceHierarchyDefinition;\n this.invalidateHierarchyCache(\"Hierarchy filter reset\");\n }\n this._hierarchyChanged.raiseEvent({ filterChange: { newFilter: undefined } });\n return;\n }\n this._activeHierarchyDefinition = new FilteringHierarchyDefinition({\n imodelAccess: this._imodelAccess,\n source: this._sourceHierarchyDefinition,\n nodeIdentifierPaths: props.paths,\n });\n this.invalidateHierarchyCache(\"Hierarchy filter set\");\n this._dispose.next();\n this._hierarchyChanged.raiseEvent({ filterChange: { newFilter: 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(props: DefineHierarchyLevelProps & RequestContextProp): Observable<HierarchyNodesDefinition> {\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 return from(\n defer(async () => {\n let parentNode = props.parentNode;\n if (parentNode && HierarchyNode.isGeneric(parentNode) && parentNode.key.source && parentNode.key.source !== this._imodelAccess.imodelKey) {\n return [];\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 === this._imodelAccess.imodelKey),\n },\n };\n assert(HierarchyNodeKey.isInstances(parentNode.key));\n if (parentNode.key.instanceKeys.length === 0) {\n return [];\n }\n }\n return this._activeHierarchyDefinition.defineHierarchyLevel({ ...defineHierarchyLevelProps, parentNode });\n }),\n ).pipe(\n mergeAll(),\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: DefineHierarchyLevelProps & { hierarchyLevelSizeLimit?: number | \"unbounded\"; filteredInstanceKeys?: InstanceKey[] } & RequestContextProp,\n ): SourceNodesObservable {\n // pipe definitions to nodes and put \"share replay\" on it\n return this.createHierarchyLevelDefinitionsObservable(props).pipe(\n mergeMap((def): ObservableInput<SourceHierarchyNode> => {\n if (HierarchyNodesDefinition.isGenericNode(def)) {\n return of({ ...def.node, key: { type: \"generic\", id: def.node.key, source: this._imodelAccess.imodelKey } });\n }\n return this._queryScheduler.scheduleSubscription(\n of(def.query).pipe(\n map((query) => filterQueryByInstanceKeys(query, props.filteredInstanceKeys)),\n mergeMap((query) =>\n readNodes({\n queryExecutor: this._imodelAccess,\n query,\n limit: props.hierarchyLevelSizeLimit,\n parser: this._activeHierarchyDefinition.parseNode\n ? async (row) => this._activeHierarchyDefinition.parseNode!(row, props.parentNode)\n : undefined,\n }),\n ),\n map((node) => ({\n ...node,\n key: { ...node.key, instanceKeys: node.key.instanceKeys.map((key) => ({ ...key, imodelKey: this._imodelAccess.imodelKey })) },\n })),\n ),\n );\n }),\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(async (node) => applyLabelsFormatting(node, this._valuesFormatter)),\n // we have `ProcessedHierarchyNode` from here\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._imodelAccess, props.parentNode, this._valuesFormatter, this._localizedStrings, (gn) =>\n this.onGroupingNodeCreated(gn, props),\n ),\n finalize(() =>\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* 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 Object.assign(n, {\n children: hasChildren(n),\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 filter based on grouped instance keys\n let filteredInstanceKeys: InstanceKey[] | undefined;\n let parentNonGroupingNode: ParentHierarchyNode<NonGroupingHierarchyNode> | undefined;\n if (parentNode) {\n if (HierarchyNode.isGroupingNode(parentNode)) {\n parentNonGroupingNode = parentNode.nonGroupingAncestor;\n filteredInstanceKeys = parentNode.groupedInstanceKeys;\n } else {\n // not sure why type checker doesn't pick this up\n assert(HierarchyNode.isGeneric(parentNode) || HierarchyNode.isInstancesNode(parentNode));\n parentNonGroupingNode = parentNode;\n }\n }\n\n const nonGroupingNodeChildrenRequestProps = {\n ...restProps,\n parentNode: parentNonGroupingNode,\n ...(filteredInstanceKeys ? { filteredInstanceKeys } : undefined),\n };\n const value = { observable: this.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 const hierarchyLevelDefinitions = this.createHierarchyLevelDefinitionsObservable({ parentNode, instanceFilter, requestContext });\n\n // split the definitions based on whether they're for generic nodes or for instance nodes\n const [genericDefs, instanceDefs] = partition(hierarchyLevelDefinitions, HierarchyNodesDefinition.isGenericNode);\n\n // query instance keys and a flag whether they should be hidden\n const instanceKeys = instanceDefs.pipe(\n mergeMap((def) =>\n this._queryScheduler.scheduleSubscription(\n of(def.query).pipe(\n mergeMap(async (query) => {\n const ecsql = `\n SELECT\n ${NodeSelectClauseColumnNames.FullClassName},\n ${NodeSelectClauseColumnNames.ECInstanceId},\n ${NodeSelectClauseColumnNames.HideNodeInHierarchy}\n FROM (\n ${query.ecsql}\n )\n `;\n const reader = this._imodelAccess.createQueryReader({ ...query, ecsql }, { rowFormat: \"Indexes\", limit: hierarchyLevelSizeLimit });\n return from(reader).pipe(\n map((row) => ({\n key: {\n className: normalizeFullClassName(row[0]),\n id: row[1],\n imodelKey: this._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((def) => !!def.node.processingParams?.hideInHierarchy),\n map(\n (def): GenericNodeKey => ({\n type: \"generic\",\n id: def.node.key,\n source: this._imodelAccess.imodelKey,\n }),\n ),\n ),\n hiddenNodeInstanceKeys.pipe(\n // first merge all keys by class\n reduceToMergeMapList(\n ({ key }) => key.className,\n ({ key }) => key.id,\n ),\n // then, for each class, create an instance key\n mergeMap((mergedMap): InstancesNodeKey[] =>\n [...mergedMap.entries()].map(([className, ids]) => ({\n type: \"instances\",\n instanceKeys: ids.map((id) => ({ className, id, imodelKey: this._imodelAccess.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: HierarchyDefinition) {\n return hierarchyFactory.preProcessNode\n ? processNodes(hierarchyFactory.preProcessNode.bind(hierarchyFactory))\n : (o: Observable<ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode>) => o;\n}\n\nfunction postProcessNodes<ProcessedHierarchyNode>(hierarchyFactory: HierarchyDefinition) {\n return hierarchyFactory.postProcessNode\n ? processNodes(hierarchyFactory.postProcessNode.bind(hierarchyFactory))\n : (o: Observable<ProcessedHierarchyNode>) => o;\n}\n\nfunction processNodes<TNode>(processor: (node: TNode) => Promise<TNode | undefined>) {\n return (nodes: Observable<TNode>) =>\n nodes.pipe(\n mergeMap(processor),\n filter((n): n is TNode => !!n),\n );\n}\n\nasync function applyLabelsFormatting<TNode extends { label: string | ConcatenatedValue }>(\n node: TNode,\n valueFormatter: IPrimitiveValueFormatter,\n): Promise<TNode & { label: string }> {\n return {\n ...node,\n label: await formatConcatenatedValue({\n value: node.label,\n valueFormatter,\n }),\n };\n}\n\nfunction createParentNodeKeysList(parentNode: ParentHierarchyNode | undefined) {\n if (!parentNode) {\n return [];\n }\n return [...parentNode.parentKeys, parentNode.key];\n}\n\nfunction filterQueryByInstanceKeys(query: ECSqlQueryDef, filteredInstanceKeys: InstanceKey[] | undefined): ECSqlQueryDef {\n if (!filteredInstanceKeys || !filteredInstanceKeys.length) {\n return query;\n }\n const MAX_ALLOWED_BINDINGS = 1000;\n if (filteredInstanceKeys.length < MAX_ALLOWED_BINDINGS) {\n return {\n ...query,\n ecsql: `\n SELECT *\n FROM (${query.ecsql}) q\n WHERE q.ECInstanceId IN (${filteredInstanceKeys.map(() => \"?\").join(\",\")})\n `,\n bindings: [...(query.bindings ?? []), ...filteredInstanceKeys.map((k): ECSqlBinding => ({ type: \"id\", value: k.id }))],\n };\n }\n /* 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: filteredInstanceKeys.map((k) => k.id) }],\n };\n /* c8 ignore end */\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IModelHierarchyProvider.js","sourceRoot":"","sources":["../../../../src/hierarchies/imodel/IModelHierarchyProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,gCAAgC,CAAC;AACxC,OAAO,EACL,UAAU,EACV,MAAM,EACN,cAAc,EACd,KAAK,EACL,KAAK,EACL,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,GAAG,EACH,KAAK,EACL,QAAQ,EACR,QAAQ,EAGR,EAAE,EACF,OAAO,EACP,IAAI,EACJ,SAAS,EACT,GAAG,GACJ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAEL,2BAA2B,EAO3B,uBAAuB,EAGvB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,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AK;QACR,KAAK,EAAE;;cAEG,KAAK,CAAC,KAAK;;KAEpB;QACD,QAAQ,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;KACvG,CAAC;IACF,mBAAmB;AACrB,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\";\nimport {\n catchError,\n concat,\n defaultIfEmpty,\n defer,\n EMPTY,\n filter,\n finalize,\n from,\n map,\n merge,\n mergeAll,\n mergeMap,\n Observable,\n ObservableInput,\n of,\n Subject,\n take,\n takeUntil,\n tap,\n} from \"rxjs\";\nimport { assert, BeEvent, Guid, 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 { HierarchyFilteringPath } from \"../HierarchyFiltering.js\";\nimport { HierarchyNode, NonGroupingHierarchyNode, ParentHierarchyNode } from \"../HierarchyNode.js\";\nimport { GenericNodeKey, HierarchyNodeKey, IModelInstanceKey, InstancesNodeKey } from \"../HierarchyNodeKey.js\";\nimport { GetHierarchyNodesProps, HierarchyProvider } from \"../HierarchyProvider.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 { SubscriptionScheduler } from \"../internal/SubscriptionScheduler.js\";\nimport { FilteringHierarchyDefinition } from \"./FilteringHierarchyDefinition.js\";\nimport { HierarchyCache } from \"./HierarchyCache.js\";\nimport { DefineHierarchyLevelProps, HierarchyDefinition, HierarchyNodesDefinition } from \"./IModelHierarchyDefinition.js\";\nimport {\n ProcessedGenericHierarchyNode,\n ProcessedGroupingHierarchyNode,\n ProcessedHierarchyNode,\n ProcessedInstanceHierarchyNode,\n SourceGenericHierarchyNode,\n SourceInstanceHierarchyNode,\n} 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 { 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 /** An event that is raised when iModel data, that may affect the hierarchy, changes. */\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 * 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 /** Props for filtering the hierarchy. */\n filtering?: {\n /** A list of node identifiers from root to target node. */\n paths: HierarchyFilteringPath[];\n };\n}\n\n/**\n * Creates an instance of `HierarchyProvider` that creates a hierarchy based on given iModel and\n * a hierarchy definition, which defines each hierarchy level through ECSQL queries.\n *\n * @public\n */\nexport function createIModelHierarchyProvider(props: IModelHierarchyProviderProps): HierarchyProvider & {\n /** @deprecated in 1.4. Use `[Symbol.dispose]` instead. */\n dispose: () => void;\n [Symbol.dispose]: () => void;\n} {\n return new IModelHierarchyProviderImpl(props);\n}\n\ninterface RequestContextProp {\n requestContext: {\n requestId: string;\n };\n}\n\nclass IModelHierarchyProviderImpl implements HierarchyProvider {\n private _imodelAccess: IModelAccess;\n private _hierarchyChanged: BeEvent<(args?: EventArgs<HierarchyProvider[\"hierarchyChanged\"]>) => void>;\n private _valuesFormatter: IPrimitiveValueFormatter;\n private _sourceHierarchyDefinition: HierarchyDefinition;\n private _activeHierarchyDefinition: HierarchyDefinition;\n private _localizedStrings: IModelHierarchyProviderLocalizedStrings;\n private _queryScheduler: SubscriptionScheduler;\n private _nodesCache?: HierarchyCache<HierarchyCacheEntry>;\n private _unsubscribe?: () => void;\n private _dispose = new Subject<void>();\n\n public constructor(props: IModelHierarchyProviderProps) {\n this._imodelAccess = props.imodelAccess;\n this._hierarchyChanged = new BeEvent();\n this._activeHierarchyDefinition = this._sourceHierarchyDefinition = props.hierarchyDefinition;\n this._valuesFormatter = props?.formatter ?? createDefaultValueFormatter();\n this._localizedStrings = { other: \"Other\", unspecified: \"Not specified\", ...props?.localizedStrings };\n this._queryScheduler = new SubscriptionScheduler(props.queryConcurrency ?? DEFAULT_QUERY_CONCURRENCY);\n this.setHierarchyFilter(props.filtering);\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 this._unsubscribe = props.imodelChanged?.addListener(() => {\n this.invalidateHierarchyCache(\"Data source changed\");\n this._dispose.next();\n this._hierarchyChanged.raiseEvent();\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 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 setHierarchyFilter(props: IModelHierarchyProviderProps[\"filtering\"]) {\n if (!props) {\n if (this._sourceHierarchyDefinition !== this._activeHierarchyDefinition) {\n this._activeHierarchyDefinition = this._sourceHierarchyDefinition;\n this.invalidateHierarchyCache(\"Hierarchy filter reset\");\n }\n this._hierarchyChanged.raiseEvent({ filterChange: { newFilter: undefined } });\n return;\n }\n this._activeHierarchyDefinition = new FilteringHierarchyDefinition({\n imodelAccess: this._imodelAccess,\n source: this._sourceHierarchyDefinition,\n nodeIdentifierPaths: props.paths,\n });\n this.invalidateHierarchyCache(\"Hierarchy filter set\");\n this._dispose.next();\n this._hierarchyChanged.raiseEvent({ filterChange: { newFilter: 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(props: DefineHierarchyLevelProps & RequestContextProp): Observable<HierarchyNodesDefinition> {\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 return from(\n defer(async () => {\n let parentNode = props.parentNode;\n if (parentNode && HierarchyNode.isGeneric(parentNode) && parentNode.key.source && parentNode.key.source !== this._imodelAccess.imodelKey) {\n return [];\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 === this._imodelAccess.imodelKey),\n },\n };\n assert(HierarchyNodeKey.isInstances(parentNode.key));\n if (parentNode.key.instanceKeys.length === 0) {\n return [];\n }\n }\n return this._activeHierarchyDefinition.defineHierarchyLevel({ ...defineHierarchyLevelProps, parentNode });\n }),\n ).pipe(\n mergeAll(),\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: DefineHierarchyLevelProps & { hierarchyLevelSizeLimit?: number | \"unbounded\"; filteredInstanceKeys?: InstanceKey[] } & RequestContextProp,\n ): SourceNodesObservable {\n // pipe definitions to nodes and put \"share replay\" on it\n return this.createHierarchyLevelDefinitionsObservable(props).pipe(\n mergeMap((def): ObservableInput<SourceHierarchyNode> => {\n if (HierarchyNodesDefinition.isGenericNode(def)) {\n return of({ ...def.node, key: { type: \"generic\", id: def.node.key, source: this._imodelAccess.imodelKey } });\n }\n return this._queryScheduler.scheduleSubscription(\n of(def.query).pipe(\n map((query) => filterQueryByInstanceKeys(query, props.filteredInstanceKeys)),\n mergeMap((query) =>\n readNodes({\n queryExecutor: this._imodelAccess,\n query,\n limit: props.hierarchyLevelSizeLimit,\n parser: this._activeHierarchyDefinition.parseNode\n ? async (row) => this._activeHierarchyDefinition.parseNode!(row, props.parentNode)\n : undefined,\n }),\n ),\n map((node) => ({\n ...node,\n key: { ...node.key, instanceKeys: node.key.instanceKeys.map((key) => ({ ...key, imodelKey: this._imodelAccess.imodelKey })) },\n })),\n ),\n );\n }),\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(async (node) => applyLabelsFormatting(node, this._valuesFormatter)),\n // we have `ProcessedHierarchyNode` from here\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._imodelAccess, 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 Object.assign(n, {\n children: hasChildren(n),\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 filter based on grouped instance keys\n let filteredInstanceKeys: InstanceKey[] | undefined;\n let parentNonGroupingNode: ParentHierarchyNode<NonGroupingHierarchyNode> | undefined;\n if (parentNode) {\n if (HierarchyNode.isGroupingNode(parentNode)) {\n parentNonGroupingNode = parentNode.nonGroupingAncestor;\n filteredInstanceKeys = parentNode.groupedInstanceKeys;\n } else {\n // not sure why type checker doesn't pick this up\n assert(HierarchyNode.isGeneric(parentNode) || HierarchyNode.isInstancesNode(parentNode));\n parentNonGroupingNode = parentNode;\n }\n }\n\n const nonGroupingNodeChildrenRequestProps = {\n ...restProps,\n parentNode: parentNonGroupingNode,\n ...(filteredInstanceKeys ? { filteredInstanceKeys } : undefined),\n };\n const value = { observable: this.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 const hierarchyLevelDefinitions = this.createHierarchyLevelDefinitionsObservable({ parentNode, instanceFilter, requestContext });\n\n // split the definitions based on whether they're for generic nodes or for instance nodes\n const [genericDefs, instanceDefs] = partition(hierarchyLevelDefinitions, HierarchyNodesDefinition.isGenericNode);\n\n // query instance keys and a flag whether they should be hidden\n const instanceKeys = instanceDefs.pipe(\n mergeMap((def) =>\n this._queryScheduler.scheduleSubscription(\n of(def.query).pipe(\n mergeMap(async (query) => {\n const ecsql = `\n SELECT\n ${NodeSelectClauseColumnNames.FullClassName},\n ${NodeSelectClauseColumnNames.ECInstanceId},\n ${NodeSelectClauseColumnNames.HideNodeInHierarchy}\n FROM (\n ${query.ecsql}\n )\n `;\n const reader = this._imodelAccess.createQueryReader({ ...query, ecsql }, { rowFormat: \"Indexes\", limit: hierarchyLevelSizeLimit });\n return from(reader).pipe(\n map((row) => ({\n key: {\n className: normalizeFullClassName(row[0]),\n id: row[1],\n imodelKey: this._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((def) => !!def.node.processingParams?.hideInHierarchy),\n map(\n (def): GenericNodeKey => ({\n type: \"generic\",\n id: def.node.key,\n source: this._imodelAccess.imodelKey,\n }),\n ),\n ),\n hiddenNodeInstanceKeys.pipe(\n // first merge all keys by class\n reduceToMergeMapList(\n ({ key }) => key.className,\n ({ key }) => key.id,\n ),\n // then, for each class, create an instance key\n mergeMap((mergedMap): InstancesNodeKey[] =>\n [...mergedMap.entries()].map(([className, ids]) => ({\n type: \"instances\",\n instanceKeys: ids.map((id) => ({ className, id, imodelKey: this._imodelAccess.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: HierarchyDefinition) {\n return hierarchyFactory.preProcessNode\n ? processNodes(hierarchyFactory.preProcessNode.bind(hierarchyFactory))\n : (o: Observable<ProcessedGenericHierarchyNode | ProcessedInstanceHierarchyNode>) => o;\n}\n\nfunction postProcessNodes<ProcessedHierarchyNode>(hierarchyFactory: HierarchyDefinition) {\n return hierarchyFactory.postProcessNode\n ? processNodes(hierarchyFactory.postProcessNode.bind(hierarchyFactory))\n : (o: Observable<ProcessedHierarchyNode>) => o;\n}\n\nfunction processNodes<TNode>(processor: (node: TNode) => Promise<TNode | undefined>) {\n return (nodes: Observable<TNode>) =>\n nodes.pipe(\n mergeMap(processor),\n filter((n): n is TNode => !!n),\n );\n}\n\nasync function applyLabelsFormatting<TNode extends { label: string | ConcatenatedValue }>(\n node: TNode,\n valueFormatter: IPrimitiveValueFormatter,\n): Promise<TNode & { label: string }> {\n return {\n ...node,\n label: await formatConcatenatedValue({\n value: node.label,\n valueFormatter,\n }),\n };\n}\n\nfunction createParentNodeKeysList(parentNode: ParentHierarchyNode | undefined) {\n if (!parentNode) {\n return [];\n }\n return [...parentNode.parentKeys, parentNode.key];\n}\n\nfunction filterQueryByInstanceKeys(query: ECSqlQueryDef, filteredInstanceKeys: InstanceKey[] | undefined): ECSqlQueryDef {\n if (!filteredInstanceKeys || !filteredInstanceKeys.length) {\n return query;\n }\n const MAX_ALLOWED_BINDINGS = 1000;\n if (filteredInstanceKeys.length < MAX_ALLOWED_BINDINGS) {\n return {\n ...query,\n ecsql: `\n SELECT *\n FROM (${query.ecsql}) q\n WHERE q.ECInstanceId IN (${filteredInstanceKeys.map(() => \"?\").join(\",\")})\n `,\n bindings: [...(query.bindings ?? []), ...filteredInstanceKeys.map((k): ECSqlBinding => ({ type: \"id\", value: k.id }))],\n };\n }\n /* 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: filteredInstanceKeys.map((k) => k.id) }],\n };\n /* c8 ignore end */\n}\n"]}
|
|
@@ -6,7 +6,7 @@ import { PropertiesGroupingLocalizedStrings } from "./grouping/PropertiesGroupin
|
|
|
6
6
|
/** @internal */
|
|
7
7
|
export declare const LOGGING_NAMESPACE: string;
|
|
8
8
|
/** @internal */
|
|
9
|
-
export declare function createGroupingOperator(imodelAccess: ECSchemaProvider & ECClassHierarchyInspector, parentNode: ParentHierarchyNode | undefined, valueFormatter: IPrimitiveValueFormatter, localizedStrings: PropertiesGroupingLocalizedStrings, onGroupingNodeCreated?: (groupingNode: ProcessedGroupingHierarchyNode) => void, groupingHandlers?: GroupingHandler[]): (nodes: Observable<ProcessedHierarchyNode>) => Observable<ProcessedHierarchyNode>;
|
|
9
|
+
export declare function createGroupingOperator(imodelAccess: ECSchemaProvider & ECClassHierarchyInspector, parentNode: ParentHierarchyNode | undefined, valueFormatter: IPrimitiveValueFormatter, localizedStrings: PropertiesGroupingLocalizedStrings, onNodesGrouped?: (groupingResult: GroupingHandlerResult | undefined, handler: GroupingHandler) => void, onGroupingNodeCreated?: (groupingNode: ProcessedGroupingHierarchyNode) => void, groupingHandlers?: GroupingHandler[]): (nodes: Observable<ProcessedHierarchyNode>) => Observable<ProcessedHierarchyNode>;
|
|
10
10
|
/** @internal */
|
|
11
11
|
export type ProcessedInstancesGroupingHierarchyNode = Omit<ProcessedGroupingHierarchyNode, "children"> & {
|
|
12
12
|
children: ProcessedInstanceHierarchyNode[];
|
|
@@ -23,6 +23,4 @@ export interface GroupingHandlerResult {
|
|
|
23
23
|
export type GroupingType = "label" | "class" | "base-class" | "property";
|
|
24
24
|
/** @internal */
|
|
25
25
|
export type GroupingHandler = (nodesToGroup: ProcessedInstanceHierarchyNode[], nodesAlreadyGrouped: ProcessedInstancesGroupingHierarchyNode[]) => Promise<GroupingHandlerResult>;
|
|
26
|
-
/** @internal */
|
|
27
|
-
export declare function createGroupingHandlers(imodelAccess: ECSchemaProvider & ECClassHierarchyInspector, parentNode: ParentHierarchyNode | undefined, processedInstanceNodes: ProcessedInstanceHierarchyNode[], valueFormatter: IPrimitiveValueFormatter, localizedStrings: PropertiesGroupingLocalizedStrings): Observable<GroupingHandler>;
|
|
28
26
|
//# sourceMappingURL=Grouping.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grouping.d.ts","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/Grouping.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuF,UAAU,EAA4B,MAAM,MAAM,CAAC;AAEjJ,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACnH,OAAO,EAAiB,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAW5E,OAAO,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAMnI,OAAO,EAAoC,kCAAkC,EAAE,MAAM,kCAAkC,CAAC;AAGxH,gBAAgB;AAChB,eAAO,MAAM,iBAAiB,QAA4E,CAAC;AAI3G,gBAAgB;AAChB,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,gBAAgB,GAAG,yBAAyB,EAC1D,UAAU,EAAE,mBAAmB,GAAG,SAAS,EAC3C,cAAc,EAAE,wBAAwB,EACxC,gBAAgB,EAAE,kCAAkC,EACpD,qBAAqB,CAAC,EAAE,CAAC,YAAY,EAAE,8BAA8B,KAAK,IAAI,EAC9E,gBAAgB,CAAC,EAAE,eAAe,EAAE,WAEZ,UAAU,CAAC,sBAAsB,CAAC,KAAG,UAAU,CAAC,sBAAsB,CAAC,CAyDhG;AAED,gBAAgB;AAChB,MAAM,MAAM,uCAAuC,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AC,cAAc,EAAE,qBAAqB,GAAG,SAAS,EAAE,OAAO,EAAE,eAAe,KAAK,IAAI,EACtG,qBAAqB,CAAC,EAAE,CAAC,YAAY,EAAE,8BAA8B,KAAK,IAAI,EAC9E,gBAAgB,CAAC,EAAE,eAAe,EAAE,WAEZ,UAAU,CAAC,sBAAsB,CAAC,KAAG,UAAU,CAAC,sBAAsB,CAAC,CAyDhG;AAED,gBAAgB;AAChB,MAAM,MAAM,uCAAuC,GAAG,IAAI,CAAC,8BAA8B,EAAE,UAAU,CAAC,GAAG;IAAE,QAAQ,EAAE,8BAA8B,EAAE,CAAA;CAAE,CAAC;AAExJ,gBAAgB;AAChB,MAAM,WAAW,qBAAqB;IACpC,sCAAsC;IACtC,OAAO,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;IACxD,sCAAsC;IACtC,SAAS,EAAE,8BAA8B,EAAE,CAAC;IAC5C,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,gBAAgB;AAChB,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,OAAO,GAAG,YAAY,GAAG,UAAU,CAAC;AAEzE,gBAAgB;AAChB,MAAM,MAAM,eAAe,GAAG,CAC5B,YAAY,EAAE,8BAA8B,EAAE,EAC9C,mBAAmB,EAAE,uCAAuC,EAAE,KAC3D,OAAO,CAAC,qBAAqB,CAAC,CAAC"}
|
|
@@ -21,7 +21,7 @@ export const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, L
|
|
|
21
21
|
const LOGGING_NAMESPACE_PERFORMANCE = createOperatorLoggingNamespace(OPERATOR_NAME, BASE_LOGGING_NAMESPACE_PERFORMANCE);
|
|
22
22
|
const LOGGING_NAMESPACE_PERFORMANCE_INTERNAL = createOperatorLoggingNamespace(OPERATOR_NAME, BASE_LOGGING_NAMESPACE_PERFORMANCE_INTERNAL);
|
|
23
23
|
/** @internal */
|
|
24
|
-
export function createGroupingOperator(imodelAccess, parentNode, valueFormatter, localizedStrings, onGroupingNodeCreated, groupingHandlers) {
|
|
24
|
+
export function createGroupingOperator(imodelAccess, parentNode, valueFormatter, localizedStrings, onNodesGrouped, onGroupingNodeCreated, groupingHandlers) {
|
|
25
25
|
return function (nodes) {
|
|
26
26
|
return nodes.pipe(log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }), tapOnce(() => {
|
|
27
27
|
doLog({
|
|
@@ -51,7 +51,7 @@ export function createGroupingOperator(imodelAccess, parentNode, valueFormatter,
|
|
|
51
51
|
const groupingHandlersObs = groupingHandlers
|
|
52
52
|
? from(groupingHandlers)
|
|
53
53
|
: createGroupingHandlers(imodelAccess, parentNode, instanceNodes, valueFormatter, localizedStrings);
|
|
54
|
-
return merge(groupingHandlersObs.pipe(toArray(), mergeMap((createdGroupingHandlers) => groupInstanceNodes(instanceNodes, restNodes.length, createdGroupingHandlers, parentNode, onGroupingNodeCreated)), finalize(() => {
|
|
54
|
+
return merge(groupingHandlersObs.pipe(toArray(), mergeMap((createdGroupingHandlers) => groupInstanceNodes(instanceNodes, restNodes.length, createdGroupingHandlers, parentNode, onNodesGrouped, onGroupingNodeCreated)), finalize(() => {
|
|
55
55
|
doLog({
|
|
56
56
|
category: LOGGING_NAMESPACE_PERFORMANCE,
|
|
57
57
|
message: /* c8 ignore next */ () => `Grouping ${instanceNodes.length} nodes took ${timer.elapsedSeconds.toFixed(3)} s`,
|
|
@@ -60,7 +60,7 @@ export function createGroupingOperator(imodelAccess, parentNode, valueFormatter,
|
|
|
60
60
|
}), releaseMainThreadOnItemsCount(500), log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }));
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
function groupInstanceNodes(nodes, extraSiblings, groupingHandlers, parentNode, onGroupingNodeCreated) {
|
|
63
|
+
function groupInstanceNodes(nodes, extraSiblings, groupingHandlers, parentNode, onNodesGrouped, onGroupingNodeCreated) {
|
|
64
64
|
if (groupingHandlers.length === 0) {
|
|
65
65
|
return from(nodes);
|
|
66
66
|
}
|
|
@@ -73,6 +73,8 @@ function groupInstanceNodes(nodes, extraSiblings, groupingHandlers, parentNode,
|
|
|
73
73
|
return from(currentHandler(curr?.ungrouped ?? nodes, curr?.grouped ?? [])).pipe(log({
|
|
74
74
|
category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,
|
|
75
75
|
message: /* c8 ignore next */ () => `Grouping handler ${handlerIndex} exclusively took ${timer.elapsedSeconds.toFixed(3)} s.`,
|
|
76
|
+
}), tap((result) => {
|
|
77
|
+
onNodesGrouped?.(result, currentHandler);
|
|
76
78
|
}), mergeMap((result) => {
|
|
77
79
|
if (result.grouped.length === 0) {
|
|
78
80
|
return of({ handlerIndex: handlerIndex + 1, result: { ...result, grouped: curr?.grouped ?? [] } });
|
|
@@ -112,8 +114,7 @@ function mergeInPlace(target, source) {
|
|
|
112
114
|
}
|
|
113
115
|
return target;
|
|
114
116
|
}
|
|
115
|
-
|
|
116
|
-
export function createGroupingHandlers(imodelAccess, parentNode, processedInstanceNodes, valueFormatter, localizedStrings) {
|
|
117
|
+
function createGroupingHandlers(imodelAccess, parentNode, processedInstanceNodes, valueFormatter, localizedStrings) {
|
|
117
118
|
const timer = new StopWatch();
|
|
118
119
|
const groupingLevel = getNodeGroupingLevel(parentNode);
|
|
119
120
|
return concat(groupingLevel <= GroupingLevel.Class
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grouping.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/Grouping.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAc,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,M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CAAC;IACD,OAAO,aAAa,CAAC,IAAI,CAAC;AAC5B,CAAC;AAED,IAAK,aAKJ;AALD,WAAK,aAAa;IAChB,iDAAQ,CAAA;IACR,mDAAS,CAAA;IACT,yDAAY,CAAA;IACZ,mDAAS,CAAA;AACX,CAAC,EALI,aAAa,KAAb,aAAa,QAKjB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { concat, concatAll, delay, EMPTY, expand, finalize, from, last, map, merge, mergeMap, Observable, of, reduce, tap, toArray } from \"rxjs\";\nimport { assert, StopWatch } from \"@itwin/core-bentley\";\nimport { ECClassHierarchyInspector, ECSchemaProvider, IPrimitiveValueFormatter } from \"@itwin/presentation-shared\";\nimport { HierarchyNode, ParentHierarchyNode } from \"../../HierarchyNode.js\";\nimport {\n LOGGING_NAMESPACE_PERFORMANCE as BASE_LOGGING_NAMESPACE_PERFORMANCE,\n LOGGING_NAMESPACE_PERFORMANCE_INTERNAL as BASE_LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n createNodeIdentifierForLogging,\n createOperatorLoggingNamespace,\n LOGGING_NAMESPACE_INTERNAL,\n} from \"../../internal/Common.js\";\nimport { doLog, log } from \"../../internal/LoggingUtils.js\";\nimport { releaseMainThreadOnItemsCount } from \"../../internal/operators/ReleaseMainThread.js\";\nimport { tapOnce } from \"../../internal/operators/TapOnce.js\";\nimport { ProcessedGroupingHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode } from \"../IModelHierarchyNode.js\";\nimport { assignAutoExpand } from \"./grouping/AutoExpand.js\";\nimport { createBaseClassGroupingHandlers } from \"./grouping/BaseClassGrouping.js\";\nimport { createClassGroups } from \"./grouping/ClassGrouping.js\";\nimport { applyGroupHidingParams } from \"./grouping/GroupHiding.js\";\nimport { createLabelGroups } from \"./grouping/LabelGrouping.js\";\nimport { createPropertiesGroupingHandlers, PropertiesGroupingLocalizedStrings } from \"./grouping/PropertiesGrouping.js\";\n\nconst OPERATOR_NAME = \"Grouping\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, LOGGING_NAMESPACE_INTERNAL);\nconst LOGGING_NAMESPACE_PERFORMANCE = createOperatorLoggingNamespace(OPERATOR_NAME, BASE_LOGGING_NAMESPACE_PERFORMANCE);\nconst LOGGING_NAMESPACE_PERFORMANCE_INTERNAL = createOperatorLoggingNamespace(OPERATOR_NAME, BASE_LOGGING_NAMESPACE_PERFORMANCE_INTERNAL);\n\n/** @internal */\nexport function createGroupingOperator(\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector,\n parentNode: ParentHierarchyNode | undefined,\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\n onGroupingNodeCreated?: (groupingNode: ProcessedGroupingHierarchyNode) => void,\n groupingHandlers?: GroupingHandler[],\n) {\n return function (nodes: Observable<ProcessedHierarchyNode>): Observable<ProcessedHierarchyNode> {\n return nodes.pipe(\n log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }),\n tapOnce(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () => `Starting grouping (parent: ${createNodeIdentifierForLogging(parentNode)})`,\n });\n }),\n reduce<ProcessedHierarchyNode, { instanceNodes: ProcessedInstanceHierarchyNode[]; restNodes: ProcessedHierarchyNode[] }>(\n (resolvedNodes, node) => {\n if (HierarchyNode.isInstancesNode(node)) {\n resolvedNodes.instanceNodes.push(node);\n } else {\n resolvedNodes.restNodes.push(node);\n }\n return resolvedNodes;\n },\n { instanceNodes: [], restNodes: [] },\n ),\n tap(({ instanceNodes, restNodes }) => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Nodes partitioned. Got ${instanceNodes.length} instance nodes and ${restNodes.length} rest nodes.`,\n });\n }),\n mergeMap((res) => {\n const out = of(res);\n const totalNodes = res.instanceNodes.length + res.restNodes.length;\n /* c8 ignore next */\n return totalNodes <= 1000 ? out : out.pipe(delay(0));\n }),\n mergeMap(({ instanceNodes, restNodes }): Observable<ProcessedHierarchyNode> => {\n const timer = new StopWatch(undefined, true);\n const groupingHandlersObs: Observable<GroupingHandler> = groupingHandlers\n ? from(groupingHandlers)\n : createGroupingHandlers(imodelAccess, parentNode, instanceNodes, valueFormatter, localizedStrings);\n return merge(\n groupingHandlersObs.pipe(\n toArray(),\n mergeMap((createdGroupingHandlers) =>\n groupInstanceNodes(instanceNodes, restNodes.length, createdGroupingHandlers, parentNode, onGroupingNodeCreated),\n ),\n finalize(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () => `Grouping ${instanceNodes.length} nodes took ${timer.elapsedSeconds.toFixed(3)} s`,\n });\n }),\n ),\n from(restNodes),\n );\n }),\n releaseMainThreadOnItemsCount(500),\n log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }),\n );\n };\n}\n\n/** @internal */\nexport type ProcessedInstancesGroupingHierarchyNode = Omit<ProcessedGroupingHierarchyNode, \"children\"> & { children: ProcessedInstanceHierarchyNode[] };\n\n/** @internal */\nexport interface GroupingHandlerResult {\n /** Expected to be sorted by label. */\n grouped: Array<ProcessedInstancesGroupingHierarchyNode>;\n /** Expected to be sorted by label. */\n ungrouped: ProcessedInstanceHierarchyNode[];\n groupingType: GroupingType;\n}\n\n/** @internal */\nexport type GroupingType = \"label\" | \"class\" | \"base-class\" | \"property\";\n\n/** @internal */\nexport type GroupingHandler = (\n nodesToGroup: ProcessedInstanceHierarchyNode[],\n nodesAlreadyGrouped: ProcessedInstancesGroupingHierarchyNode[],\n) => Promise<GroupingHandlerResult>;\n\nfunction groupInstanceNodes(\n nodes: ProcessedInstanceHierarchyNode[],\n extraSiblings: number,\n groupingHandlers: GroupingHandler[],\n parentNode: ParentHierarchyNode | undefined,\n onGroupingNodeCreated?: (groupingNode: ProcessedGroupingHierarchyNode) => void,\n): Observable<ProcessedGroupingHierarchyNode | ProcessedInstanceHierarchyNode> {\n if (groupingHandlers.length === 0) {\n return from(nodes);\n }\n return of<{ handlerIndex: number; result?: GroupingHandlerResult | undefined }>({ handlerIndex: 0 }).pipe(\n expand(({ handlerIndex, result: curr }) => {\n if (handlerIndex >= groupingHandlers.length) {\n return EMPTY;\n }\n const timer = new StopWatch(undefined, true);\n const currentHandler = groupingHandlers[handlerIndex];\n return from(currentHandler(curr?.ungrouped ?? nodes, curr?.grouped ?? [])).pipe(\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Grouping handler ${handlerIndex} exclusively took ${timer.elapsedSeconds.toFixed(3)} s.`,\n }),\n mergeMap((result) => {\n if (result.grouped.length === 0) {\n return of({ handlerIndex: handlerIndex + 1, result: { ...result, grouped: curr?.grouped ?? [] } });\n }\n const groupingPostProcessingTimer = new StopWatch(undefined, true);\n return of(result).pipe(\n map((r) => applyGroupHidingParams(r, extraSiblings)),\n map((r) => assignAutoExpand(r)),\n map((r) => ({ handlerIndex: handlerIndex + 1, result: { ...r, grouped: mergeInPlace(curr?.grouped, r.grouped) } })),\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () =>\n `Post-processing grouping handler ${handlerIndex} exclusively took ${groupingPostProcessingTimer.elapsedSeconds.toFixed(3)} s.`,\n }),\n delay(0),\n );\n }),\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Total time for grouping handler ${handlerIndex}: ${timer.elapsedSeconds.toFixed(3)} s.`,\n }),\n );\n }),\n last(),\n mergeMap(({ result }) => {\n result.grouped.forEach((groupingNode) => {\n onGroupingNodeCreated?.(groupingNode);\n if (!parentNode) {\n return;\n }\n if (HierarchyNode.isGroupingNode(parentNode)) {\n groupingNode.nonGroupingAncestor = parentNode.nonGroupingAncestor;\n return;\n }\n // not sure why type checker doesn't pick this up\n assert(HierarchyNode.isGeneric(parentNode) || HierarchyNode.isInstancesNode(parentNode));\n groupingNode.nonGroupingAncestor = parentNode;\n });\n return mergeInPlace<ProcessedGroupingHierarchyNode | ProcessedInstanceHierarchyNode>(result.grouped, result.ungrouped);\n }),\n );\n}\n\nfunction mergeInPlace<T>(target: T[] | undefined, source: T[]) {\n if (!target || target.length === 0) {\n return source;\n }\n for (const item of source) {\n target.push(item);\n }\n return target;\n}\n\n/** @internal */\nexport function createGroupingHandlers(\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector,\n parentNode: ParentHierarchyNode | undefined,\n processedInstanceNodes: ProcessedInstanceHierarchyNode[],\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\n): Observable<GroupingHandler> {\n const timer = new StopWatch();\n const groupingLevel = getNodeGroupingLevel(parentNode);\n return concat(\n groupingLevel <= GroupingLevel.Class\n ? concat(\n from(createBaseClassGroupingHandlers(imodelAccess, parentNode, processedInstanceNodes)).pipe(concatAll()),\n of<GroupingHandler>(async (allNodes) => createClassGroups(imodelAccess, parentNode, allNodes)),\n )\n : EMPTY,\n groupingLevel <= GroupingLevel.Property\n ? from(createPropertiesGroupingHandlers(imodelAccess, parentNode, processedInstanceNodes, valueFormatter, localizedStrings)).pipe(concatAll())\n : EMPTY,\n groupingLevel < GroupingLevel.Label ? of<GroupingHandler>(async (allNodes) => createLabelGroups(allNodes)) : EMPTY,\n ).pipe(\n tap({\n subscribe: () => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Start creating grouping handlers`,\n });\n timer.start();\n },\n }),\n finalize(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Creating grouping handlers took ${timer.elapsedSeconds.toFixed(3)} s`,\n });\n }),\n );\n}\n\nfunction getNodeGroupingLevel(node: ParentHierarchyNode | undefined): GroupingLevel {\n if (node && HierarchyNode.isClassGroupingNode(node)) {\n return GroupingLevel.Class;\n }\n if (node && HierarchyNode.isPropertyGroupingNode(node)) {\n return GroupingLevel.Property;\n }\n if (node && HierarchyNode.isLabelGroupingNode(node)) {\n return GroupingLevel.Label;\n }\n return GroupingLevel.None;\n}\n\nenum GroupingLevel {\n None = 0,\n Class = 2,\n Property = 3,\n Label = 4,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Grouping.js","sourceRoot":"","sources":["../../../../../src/hierarchies/imodel/operators/Grouping.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAc,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACjJ,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAuB,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EACL,6BAA6B,IAAI,kCAAkC,EACnE,sCAAsC,IAAI,2CAA2C,EACrF,8BAA8B,EAC9B,8BAA8B,EAC9B,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AAClF,O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C;gBACJ,QAAQ,EAAE,sCAAsC;gBAChD,OAAO,EAAE,oBAAoB,CAAC,GAAG,EAAE,CAAC,kCAAkC;aACvE,CAAC,CAAC;YACH,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC;KACF,CAAC,EACF,QAAQ,CAAC,GAAG,EAAE;QACZ,KAAK,CAAC;YACJ,QAAQ,EAAE,sCAAsC;YAChD,OAAO,EAAE,oBAAoB,CAAC,GAAG,EAAE,CAAC,mCAAmC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;SAC3G,CAAC,CAAC;IACL,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAqC;IACjE,IAAI,IAAI,IAAI,aAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;QACpD,OAAO,aAAa,CAAC,KAAK,CAAC;IAC7B,CAAC;IACD,IAAI,IAAI,IAAI,aAAa,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC;QACvD,OAAO,aAAa,CAAC,QAAQ,CAAC;IAChC,CAAC;IACD,IAAI,IAAI,IAAI,aAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;QACpD,OAAO,aAAa,CAAC,KAAK,CAAC;IAC7B,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,CAAC;AAC5B,CAAC;AAED,IAAK,aAKJ;AALD,WAAK,aAAa;IAChB,iDAAQ,CAAA;IACR,mDAAS,CAAA;IACT,yDAAY,CAAA;IACZ,mDAAS,CAAA;AACX,CAAC,EALI,aAAa,KAAb,aAAa,QAKjB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { concat, concatAll, delay, EMPTY, expand, finalize, from, last, map, merge, mergeMap, Observable, of, reduce, tap, toArray } from \"rxjs\";\nimport { assert, StopWatch } from \"@itwin/core-bentley\";\nimport { ECClassHierarchyInspector, ECSchemaProvider, IPrimitiveValueFormatter } from \"@itwin/presentation-shared\";\nimport { HierarchyNode, ParentHierarchyNode } from \"../../HierarchyNode.js\";\nimport {\n LOGGING_NAMESPACE_PERFORMANCE as BASE_LOGGING_NAMESPACE_PERFORMANCE,\n LOGGING_NAMESPACE_PERFORMANCE_INTERNAL as BASE_LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n createNodeIdentifierForLogging,\n createOperatorLoggingNamespace,\n LOGGING_NAMESPACE_INTERNAL,\n} from \"../../internal/Common.js\";\nimport { doLog, log } from \"../../internal/LoggingUtils.js\";\nimport { releaseMainThreadOnItemsCount } from \"../../internal/operators/ReleaseMainThread.js\";\nimport { tapOnce } from \"../../internal/operators/TapOnce.js\";\nimport { ProcessedGroupingHierarchyNode, ProcessedHierarchyNode, ProcessedInstanceHierarchyNode } from \"../IModelHierarchyNode.js\";\nimport { assignAutoExpand } from \"./grouping/AutoExpand.js\";\nimport { createBaseClassGroupingHandlers } from \"./grouping/BaseClassGrouping.js\";\nimport { createClassGroups } from \"./grouping/ClassGrouping.js\";\nimport { applyGroupHidingParams } from \"./grouping/GroupHiding.js\";\nimport { createLabelGroups } from \"./grouping/LabelGrouping.js\";\nimport { createPropertiesGroupingHandlers, PropertiesGroupingLocalizedStrings } from \"./grouping/PropertiesGrouping.js\";\n\nconst OPERATOR_NAME = \"Grouping\";\n/** @internal */\nexport const LOGGING_NAMESPACE = createOperatorLoggingNamespace(OPERATOR_NAME, LOGGING_NAMESPACE_INTERNAL);\nconst LOGGING_NAMESPACE_PERFORMANCE = createOperatorLoggingNamespace(OPERATOR_NAME, BASE_LOGGING_NAMESPACE_PERFORMANCE);\nconst LOGGING_NAMESPACE_PERFORMANCE_INTERNAL = createOperatorLoggingNamespace(OPERATOR_NAME, BASE_LOGGING_NAMESPACE_PERFORMANCE_INTERNAL);\n\n/** @internal */\nexport function createGroupingOperator(\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector,\n parentNode: ParentHierarchyNode | undefined,\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\n onNodesGrouped?: (groupingResult: GroupingHandlerResult | undefined, handler: GroupingHandler) => void,\n onGroupingNodeCreated?: (groupingNode: ProcessedGroupingHierarchyNode) => void,\n groupingHandlers?: GroupingHandler[],\n) {\n return function (nodes: Observable<ProcessedHierarchyNode>): Observable<ProcessedHierarchyNode> {\n return nodes.pipe(\n log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `in: ${createNodeIdentifierForLogging(n)}` }),\n tapOnce(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () => `Starting grouping (parent: ${createNodeIdentifierForLogging(parentNode)})`,\n });\n }),\n reduce<ProcessedHierarchyNode, { instanceNodes: ProcessedInstanceHierarchyNode[]; restNodes: ProcessedHierarchyNode[] }>(\n (resolvedNodes, node) => {\n if (HierarchyNode.isInstancesNode(node)) {\n resolvedNodes.instanceNodes.push(node);\n } else {\n resolvedNodes.restNodes.push(node);\n }\n return resolvedNodes;\n },\n { instanceNodes: [], restNodes: [] },\n ),\n tap(({ instanceNodes, restNodes }) => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Nodes partitioned. Got ${instanceNodes.length} instance nodes and ${restNodes.length} rest nodes.`,\n });\n }),\n mergeMap((res) => {\n const out = of(res);\n const totalNodes = res.instanceNodes.length + res.restNodes.length;\n /* c8 ignore next */\n return totalNodes <= 1000 ? out : out.pipe(delay(0));\n }),\n mergeMap(({ instanceNodes, restNodes }): Observable<ProcessedHierarchyNode> => {\n const timer = new StopWatch(undefined, true);\n const groupingHandlersObs: Observable<GroupingHandler> = groupingHandlers\n ? from(groupingHandlers)\n : createGroupingHandlers(imodelAccess, parentNode, instanceNodes, valueFormatter, localizedStrings);\n return merge(\n groupingHandlersObs.pipe(\n toArray(),\n mergeMap((createdGroupingHandlers) =>\n groupInstanceNodes(instanceNodes, restNodes.length, createdGroupingHandlers, parentNode, onNodesGrouped, onGroupingNodeCreated),\n ),\n finalize(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE,\n message: /* c8 ignore next */ () => `Grouping ${instanceNodes.length} nodes took ${timer.elapsedSeconds.toFixed(3)} s`,\n });\n }),\n ),\n from(restNodes),\n );\n }),\n releaseMainThreadOnItemsCount(500),\n log({ category: LOGGING_NAMESPACE, message: /* c8 ignore next */ (n) => `out: ${createNodeIdentifierForLogging(n)}` }),\n );\n };\n}\n\n/** @internal */\nexport type ProcessedInstancesGroupingHierarchyNode = Omit<ProcessedGroupingHierarchyNode, \"children\"> & { children: ProcessedInstanceHierarchyNode[] };\n\n/** @internal */\nexport interface GroupingHandlerResult {\n /** Expected to be sorted by label. */\n grouped: Array<ProcessedInstancesGroupingHierarchyNode>;\n /** Expected to be sorted by label. */\n ungrouped: ProcessedInstanceHierarchyNode[];\n groupingType: GroupingType;\n}\n\n/** @internal */\nexport type GroupingType = \"label\" | \"class\" | \"base-class\" | \"property\";\n\n/** @internal */\nexport type GroupingHandler = (\n nodesToGroup: ProcessedInstanceHierarchyNode[],\n nodesAlreadyGrouped: ProcessedInstancesGroupingHierarchyNode[],\n) => Promise<GroupingHandlerResult>;\n\nfunction groupInstanceNodes(\n nodes: ProcessedInstanceHierarchyNode[],\n extraSiblings: number,\n groupingHandlers: GroupingHandler[],\n parentNode: ParentHierarchyNode | undefined,\n onNodesGrouped?: (groupingResult: GroupingHandlerResult | undefined, handler: GroupingHandler) => void,\n onGroupingNodeCreated?: (groupingNode: ProcessedGroupingHierarchyNode) => void,\n): Observable<ProcessedGroupingHierarchyNode | ProcessedInstanceHierarchyNode> {\n if (groupingHandlers.length === 0) {\n return from(nodes);\n }\n return of<{ handlerIndex: number; result?: GroupingHandlerResult | undefined }>({ handlerIndex: 0 }).pipe(\n expand(({ handlerIndex, result: curr }) => {\n if (handlerIndex >= groupingHandlers.length) {\n return EMPTY;\n }\n const timer = new StopWatch(undefined, true);\n const currentHandler = groupingHandlers[handlerIndex];\n return from(currentHandler(curr?.ungrouped ?? nodes, curr?.grouped ?? [])).pipe(\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Grouping handler ${handlerIndex} exclusively took ${timer.elapsedSeconds.toFixed(3)} s.`,\n }),\n tap((result) => {\n onNodesGrouped?.(result, currentHandler);\n }),\n mergeMap((result) => {\n if (result.grouped.length === 0) {\n return of({ handlerIndex: handlerIndex + 1, result: { ...result, grouped: curr?.grouped ?? [] } });\n }\n const groupingPostProcessingTimer = new StopWatch(undefined, true);\n return of(result).pipe(\n map((r) => applyGroupHidingParams(r, extraSiblings)),\n map((r) => assignAutoExpand(r)),\n map((r) => ({ handlerIndex: handlerIndex + 1, result: { ...r, grouped: mergeInPlace(curr?.grouped, r.grouped) } })),\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () =>\n `Post-processing grouping handler ${handlerIndex} exclusively took ${groupingPostProcessingTimer.elapsedSeconds.toFixed(3)} s.`,\n }),\n delay(0),\n );\n }),\n log({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Total time for grouping handler ${handlerIndex}: ${timer.elapsedSeconds.toFixed(3)} s.`,\n }),\n );\n }),\n last(),\n mergeMap(({ result }) => {\n result.grouped.forEach((groupingNode) => {\n onGroupingNodeCreated?.(groupingNode);\n if (!parentNode) {\n return;\n }\n if (HierarchyNode.isGroupingNode(parentNode)) {\n groupingNode.nonGroupingAncestor = parentNode.nonGroupingAncestor;\n return;\n }\n // not sure why type checker doesn't pick this up\n assert(HierarchyNode.isGeneric(parentNode) || HierarchyNode.isInstancesNode(parentNode));\n groupingNode.nonGroupingAncestor = parentNode;\n });\n return mergeInPlace<ProcessedGroupingHierarchyNode | ProcessedInstanceHierarchyNode>(result.grouped, result.ungrouped);\n }),\n );\n}\n\nfunction mergeInPlace<T>(target: T[] | undefined, source: T[]) {\n if (!target || target.length === 0) {\n return source;\n }\n for (const item of source) {\n target.push(item);\n }\n return target;\n}\n\nfunction createGroupingHandlers(\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector,\n parentNode: ParentHierarchyNode | undefined,\n processedInstanceNodes: ProcessedInstanceHierarchyNode[],\n valueFormatter: IPrimitiveValueFormatter,\n localizedStrings: PropertiesGroupingLocalizedStrings,\n): Observable<GroupingHandler> {\n const timer = new StopWatch();\n const groupingLevel = getNodeGroupingLevel(parentNode);\n return concat(\n groupingLevel <= GroupingLevel.Class\n ? concat(\n from(createBaseClassGroupingHandlers(imodelAccess, parentNode, processedInstanceNodes)).pipe(concatAll()),\n of<GroupingHandler>(async (allNodes) => createClassGroups(imodelAccess, parentNode, allNodes)),\n )\n : EMPTY,\n groupingLevel <= GroupingLevel.Property\n ? from(createPropertiesGroupingHandlers(imodelAccess, parentNode, processedInstanceNodes, valueFormatter, localizedStrings)).pipe(concatAll())\n : EMPTY,\n groupingLevel < GroupingLevel.Label ? of<GroupingHandler>(async (allNodes) => createLabelGroups(allNodes)) : EMPTY,\n ).pipe(\n tap({\n subscribe: () => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Start creating grouping handlers`,\n });\n timer.start();\n },\n }),\n finalize(() => {\n doLog({\n category: LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n message: /* c8 ignore next */ () => `Creating grouping handlers took ${timer.elapsedSeconds.toFixed(3)} s`,\n });\n }),\n );\n}\n\nfunction getNodeGroupingLevel(node: ParentHierarchyNode | undefined): GroupingLevel {\n if (node && HierarchyNode.isClassGroupingNode(node)) {\n return GroupingLevel.Class;\n }\n if (node && HierarchyNode.isPropertyGroupingNode(node)) {\n return GroupingLevel.Property;\n }\n if (node && HierarchyNode.isLabelGroupingNode(node)) {\n return GroupingLevel.Label;\n }\n return GroupingLevel.None;\n}\n\nenum GroupingLevel {\n None = 0,\n Class = 2,\n Property = 3,\n Label = 4,\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Common.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/internal/Common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Common.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/internal/Common.ts"],"names":[],"mappings":"AAKA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,6BAA6B,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,6BAA6B,yCAAqC,CAAC;AAEhF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,qCAAqC,CAAC;AAE7E;;;;GAIG;AACH,eAAO,MAAM,sCAAsC,iDAA8C,CAAC;AAElG,gBAAgB;AAChB,wBAAgB,8BAA8B,CAC5C,YAAY,EAAE,MAAM,EACpB,YAAY,EACR,OAAO,iBAAiB,GACxB,OAAO,6BAA6B,GACpC,OAAO,0BAA0B,GACjC,OAAO,sCAAsC,UAGlD;AAED,gBAAgB;AAEhB,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAAC;IAAC,GAAG,EAAE,gBAAgB,CAAC;IAAC,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAA;CAAE,GAAG,SAAS,UAQhH;AAGD,gBAAgB;AAChB,wBAAgB,WAAW,CAAC,KAAK,SAAS;IAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAA;CAAE,EAAE,IAAI,EAAE,KAAK,WAE7F;AAED,gBAAgB;AAChB,wBAAgB,mBAAmB,CAAC,QAAQ,SAAS;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,QAAQ,SAAS;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,GAAG,MAAM,CAEhJ;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,EAAE,GAAG;IAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,QAMtG"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import "./DisposePolyfill.js";
|
|
5
6
|
import naturalCompare from "natural-compare-lite";
|
|
6
7
|
/**
|
|
7
8
|
* This is a logging namespace for public log messages that may be interesting to consumers.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Common.js","sourceRoot":"","sources":["../../../../src/hierarchies/internal/Common.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAIlD;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,iBAAiB,cAAc,CAAC;AAEhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,kCAAkC,CAAC;AAE7E;;;;GAIG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,GAAG,0BAA0B,cAAc,CAAC;AAElG,gBAAgB;AAChB,MAAM,UAAU,8BAA8B,CAC5C,YAAoB,EACpB,YAIiD;IAEjD,OAAO,GAAG,YAAY,cAAc,YAAY,EAAE,CAAC;AACrD,CAAC;AAED,gBAAgB;AAChB,qBAAqB;AACrB,MAAM,UAAU,8BAA8B,CAC5C,IAA+G;IAE/G,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5B,MAAM,UAAU,GAAG,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC;IACxE,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;AACpD,CAAC;AACD,mBAAmB;AAEnB,gBAAgB;AAChB,MAAM,UAAU,WAAW,CAAwD,IAAW;IAC5F,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC9F,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,mBAAmB,CAAyE,GAAa,EAAE,GAAa;IACtI,OAAO,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,iBAAiB,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC,CAAC;AACtF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,UAA2E;IACrG,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;QAC5B,UAAU,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;SAAM,IAAI,MAAM,CAAC,OAAO,IAAI,UAAU,EAAE,CAAC;QACxC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/B,CAAC;AACH,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 naturalCompare from \"natural-compare-lite\";\nimport { ConcatenatedValue } from \"@itwin/presentation-shared\";\nimport { HierarchyNodeKey } from \"../HierarchyNodeKey.js\";\n\n/**\n * This is a logging namespace for public log messages that may be interesting to consumers.\n * @internal\n */\nexport const LOGGING_NAMESPACE = \"Presentation.Hierarchies\";\n\n/**\n * This is a logging namespace for public performance-related log messages that may be interesting to consumers.\n * @internal\n */\nexport const LOGGING_NAMESPACE_PERFORMANCE = `${LOGGING_NAMESPACE}.Performance`;\n\n/**\n * This is a logging namespace for internal log messages that are only interesting to package contributors,\n * but not the consumers.\n * @internal\n */\nexport const LOGGING_NAMESPACE_INTERNAL = \"Presentation.HierarchiesInternal\";\n\n/**\n * This is a logging namespace for internal performance-related log messages that are only interesting\n * to package contributors, but not the consumers.\n * @internal\n */\nexport const LOGGING_NAMESPACE_PERFORMANCE_INTERNAL = `${LOGGING_NAMESPACE_INTERNAL}.Performance`;\n\n/** @internal */\nexport function createOperatorLoggingNamespace(\n operatorName: string,\n baseCategory:\n | typeof LOGGING_NAMESPACE\n | typeof LOGGING_NAMESPACE_PERFORMANCE\n | typeof LOGGING_NAMESPACE_INTERNAL\n | typeof LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n) {\n return `${baseCategory}.Operators.${operatorName}`;\n}\n\n/** @internal */\n/* c8 ignore start */\nexport function createNodeIdentifierForLogging(\n node: { label: string | ConcatenatedValue; key: HierarchyNodeKey; parentKeys?: HierarchyNodeKey[] } | undefined,\n) {\n if (!node) {\n return \"<root>\";\n }\n const { label, key } = node;\n const parentKeys = \"parentKeys\" in node ? node.parentKeys : \"<unknown>\";\n return JSON.stringify({ label, key, parentKeys });\n}\n/* c8 ignore end */\n\n/** @internal */\nexport function hasChildren<TNode extends { children?: boolean | Array<unknown> }>(node: TNode) {\n return node.children === true || (Array.isArray(node.children) && node.children.length > 0);\n}\n\n/** @internal */\nexport function compareNodesByLabel<TLhsNode extends { label: string }, TRhsNode extends { label: string }>(lhs: TLhsNode, rhs: TRhsNode): number {\n return naturalCompare(lhs.label.toLocaleLowerCase(), rhs.label.toLocaleLowerCase());\n}\n\n/**\n * A helper that disposes the given object, if it's disposable.\n *\n * The first option is to dispose using the deprecated `dispose` method if it exists on the object.\n * If not, we use the new `Symbol.dispose` method. If that doesn't exist either, the object is\n * considered as non-disposable and nothing is done with it.\n *\n * @internal\n */\nexport function safeDispose(disposable: {} | { [Symbol.dispose]: () => void } | { dispose: () => void }) {\n if (\"dispose\" in disposable) {\n disposable.dispose();\n } else if (Symbol.dispose in disposable) {\n disposable[Symbol.dispose]();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Common.js","sourceRoot":"","sources":["../../../../src/hierarchies/internal/Common.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,sBAAsB,CAAC;AAC9B,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAIlD;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,iBAAiB,cAAc,CAAC;AAEhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,kCAAkC,CAAC;AAE7E;;;;GAIG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,GAAG,0BAA0B,cAAc,CAAC;AAElG,gBAAgB;AAChB,MAAM,UAAU,8BAA8B,CAC5C,YAAoB,EACpB,YAIiD;IAEjD,OAAO,GAAG,YAAY,cAAc,YAAY,EAAE,CAAC;AACrD,CAAC;AAED,gBAAgB;AAChB,qBAAqB;AACrB,MAAM,UAAU,8BAA8B,CAC5C,IAA+G;IAE/G,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5B,MAAM,UAAU,GAAG,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC;IACxE,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;AACpD,CAAC;AACD,mBAAmB;AAEnB,gBAAgB;AAChB,MAAM,UAAU,WAAW,CAAwD,IAAW;IAC5F,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC9F,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,mBAAmB,CAAyE,GAAa,EAAE,GAAa;IACtI,OAAO,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,iBAAiB,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC,CAAC;AACtF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,UAA2E;IACrG,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;QAC5B,UAAU,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;SAAM,IAAI,MAAM,CAAC,OAAO,IAAI,UAAU,EAAE,CAAC;QACxC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/B,CAAC;AACH,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 \"./DisposePolyfill.js\";\nimport naturalCompare from \"natural-compare-lite\";\nimport { ConcatenatedValue } from \"@itwin/presentation-shared\";\nimport { HierarchyNodeKey } from \"../HierarchyNodeKey.js\";\n\n/**\n * This is a logging namespace for public log messages that may be interesting to consumers.\n * @internal\n */\nexport const LOGGING_NAMESPACE = \"Presentation.Hierarchies\";\n\n/**\n * This is a logging namespace for public performance-related log messages that may be interesting to consumers.\n * @internal\n */\nexport const LOGGING_NAMESPACE_PERFORMANCE = `${LOGGING_NAMESPACE}.Performance`;\n\n/**\n * This is a logging namespace for internal log messages that are only interesting to package contributors,\n * but not the consumers.\n * @internal\n */\nexport const LOGGING_NAMESPACE_INTERNAL = \"Presentation.HierarchiesInternal\";\n\n/**\n * This is a logging namespace for internal performance-related log messages that are only interesting\n * to package contributors, but not the consumers.\n * @internal\n */\nexport const LOGGING_NAMESPACE_PERFORMANCE_INTERNAL = `${LOGGING_NAMESPACE_INTERNAL}.Performance`;\n\n/** @internal */\nexport function createOperatorLoggingNamespace(\n operatorName: string,\n baseCategory:\n | typeof LOGGING_NAMESPACE\n | typeof LOGGING_NAMESPACE_PERFORMANCE\n | typeof LOGGING_NAMESPACE_INTERNAL\n | typeof LOGGING_NAMESPACE_PERFORMANCE_INTERNAL,\n) {\n return `${baseCategory}.Operators.${operatorName}`;\n}\n\n/** @internal */\n/* c8 ignore start */\nexport function createNodeIdentifierForLogging(\n node: { label: string | ConcatenatedValue; key: HierarchyNodeKey; parentKeys?: HierarchyNodeKey[] } | undefined,\n) {\n if (!node) {\n return \"<root>\";\n }\n const { label, key } = node;\n const parentKeys = \"parentKeys\" in node ? node.parentKeys : \"<unknown>\";\n return JSON.stringify({ label, key, parentKeys });\n}\n/* c8 ignore end */\n\n/** @internal */\nexport function hasChildren<TNode extends { children?: boolean | Array<unknown> }>(node: TNode) {\n return node.children === true || (Array.isArray(node.children) && node.children.length > 0);\n}\n\n/** @internal */\nexport function compareNodesByLabel<TLhsNode extends { label: string }, TRhsNode extends { label: string }>(lhs: TLhsNode, rhs: TRhsNode): number {\n return naturalCompare(lhs.label.toLocaleLowerCase(), rhs.label.toLocaleLowerCase());\n}\n\n/**\n * A helper that disposes the given object, if it's disposable.\n *\n * The first option is to dispose using the deprecated `dispose` method if it exists on the object.\n * If not, we use the new `Symbol.dispose` method. If that doesn't exist either, the object is\n * considered as non-disposable and nothing is done with it.\n *\n * @internal\n */\nexport function safeDispose(disposable: {} | { [Symbol.dispose]: () => void } | { dispose: () => void }) {\n if (\"dispose\" in disposable) {\n disposable.dispose();\n } else if (Symbol.dispose in disposable) {\n disposable[Symbol.dispose]();\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DisposePolyfill.d.ts","sourceRoot":"","sources":["../../../../src/hierarchies/internal/DisposePolyfill.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* Polyfill for upcoming resource management feature: https://github.com/tc39/proposal-explicit-resource-management
|
|
7
|
+
*/
|
|
8
|
+
Symbol.dispose ??= Symbol("Symbol.dispose");
|
|
9
|
+
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=DisposePolyfill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DisposePolyfill.js","sourceRoot":"","sources":["../../../../src/hierarchies/internal/DisposePolyfill.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AACF,MAAc,CAAC,OAAO,KAAK,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACpD,MAAc,CAAC,YAAY,KAAK,MAAM,CAAC,qBAAqB,CAAC,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\n/**\n * Polyfill for upcoming resource management feature: https://github.com/tc39/proposal-explicit-resource-management\n */\n(Symbol as any).dispose ??= Symbol(\"Symbol.dispose\");\n(Symbol as any).asyncDispose ??= Symbol(\"Symbol.asyncDispose\");\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/presentation-hierarchies",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "A package for creating hierarchies based on data in iTwin.js iModels.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -33,22 +33,22 @@
|
|
|
33
33
|
"./package.json": "./package.json"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@itwin/core-bentley": "^4.10.
|
|
37
|
-
"@itwin/core-common": "^4.10.
|
|
38
|
-
"@itwin/core-geometry": "^4.10.
|
|
36
|
+
"@itwin/core-bentley": "^4.10.10",
|
|
37
|
+
"@itwin/core-common": "^4.10.10",
|
|
38
|
+
"@itwin/core-geometry": "^4.10.10",
|
|
39
39
|
"natural-compare-lite": "^1.4.0",
|
|
40
40
|
"rxjs": "^7.8.1",
|
|
41
|
-
"@itwin/presentation-shared": "^1.2.
|
|
41
|
+
"@itwin/presentation-shared": "^1.2.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@itwin/build-tools": "
|
|
44
|
+
"@itwin/build-tools": "5.0.0-dev.67",
|
|
45
45
|
"@itwin/eslint-plugin": "5.0.0-dev.1",
|
|
46
46
|
"@types/chai": "^4.3.16",
|
|
47
47
|
"@types/chai-as-promised": "^7.1.8",
|
|
48
48
|
"@types/chai-subset": "^1.3.5",
|
|
49
49
|
"@types/mocha": "^10.0.7",
|
|
50
50
|
"@types/natural-compare-lite": "^1.4.2",
|
|
51
|
-
"@types/node": "^
|
|
51
|
+
"@types/node": "^22.13.9",
|
|
52
52
|
"@types/sinon": "^17.0.3",
|
|
53
53
|
"@types/sinon-chai": "^3.2.12",
|
|
54
54
|
"c8": "^10.1.2",
|
|
@@ -61,9 +61,7 @@
|
|
|
61
61
|
"rimraf": "^6.0.1",
|
|
62
62
|
"sinon": "^18.0.0",
|
|
63
63
|
"sinon-chai": "^3.7.0",
|
|
64
|
-
"
|
|
65
|
-
"typescript": "~5.6.3",
|
|
66
|
-
"presentation-build-tools": "^0.0.0",
|
|
64
|
+
"typescript": "~5.7.3",
|
|
67
65
|
"presentation-test-utilities": "^0.0.0"
|
|
68
66
|
},
|
|
69
67
|
"scripts": {
|
|
@@ -75,7 +73,7 @@
|
|
|
75
73
|
"lint": "eslint ./src/**/*.ts",
|
|
76
74
|
"test:dev": "mocha --enable-source-maps --config ./.mocharc.json",
|
|
77
75
|
"test": "npm run test:dev",
|
|
78
|
-
"extract-api": "extract-api --entry=presentation-hierarchies --apiReportFolder=./api --apiReportTempFolder=./api/temp --apiSummaryFolder=./api",
|
|
76
|
+
"extract-api": "betools extract-api --entry=presentation-hierarchies --apiReportFolder=./api --apiReportTempFolder=./api/temp --apiSummaryFolder=./api --includeUnexportedApis",
|
|
79
77
|
"check-internal": "node ../../scripts/checkInternal.js --apiSummary ./api/presentation-hierarchies.api.md",
|
|
80
78
|
"update-extractions": "node ../../scripts/updateExtractions.js --targets=./README.md,./learning",
|
|
81
79
|
"check-extractions": "node ../../scripts/updateExtractions.js --targets=./README.md,./learning --check",
|