@itwin/presentation-frontend 5.1.0-dev.9 → 5.2.0-dev.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 +70 -1
- package/lib/cjs/presentation-frontend/Presentation.d.ts +2 -2
- package/lib/cjs/presentation-frontend/Presentation.js +1 -1
- package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts +16 -11
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.js +24 -15
- package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +4 -4
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +4 -4
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts +3 -3
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +1 -1
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts +1 -1
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts +4 -4
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js +2 -2
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts +3 -3
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +2 -2
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +3 -3
- package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js +2 -2
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +3 -3
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +2 -2
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend.js +20 -0
- package/lib/cjs/presentation-frontend.js.map +1 -1
- package/lib/esm/presentation-frontend/Presentation.d.ts +2 -2
- package/lib/esm/presentation-frontend/Presentation.js +1 -1
- package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.d.ts +16 -11
- package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.js +24 -15
- package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +4 -4
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +4 -4
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts +3 -3
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +1 -1
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts +1 -1
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts +4 -4
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js +2 -2
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts +3 -3
- package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHandler.js +2 -2
- package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHelper.js +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +3 -3
- package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.js +2 -2
- package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +3 -3
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +2 -2
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/lib/esm/presentation-frontend.js +20 -0
- package/lib/esm/presentation-frontend.js.map +1 -1
- package/package.json +19 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAAsF;AACtF,wDAA2E;AAG3E,oEA0CoC;AACpC,kEAM6C;AAC7C,gEAAuE;AACvE,mEAA6D;AAC7D,mEAAqE;AACrE,2DAAyE;AACzE,6EAAoG;AACpG,iFAA2E;AAC3E,2FAAyG;AACzG,6DAA0H;AA8H1H;;;;;GAKG;AACH,MAAa,mBAAmB;IACtB,gBAAgB,CAAq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C,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,SAAS,KAAK,+CAA2B,CAAC;YACzE,CAAC,yBAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,aAAa,KAAK,+CAA2B,CAAC,CAAC;QAChF,OAAO,CAAC,WAAW,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,KAAK,UAAU,OAAO,CAAI,IAAsB;IAC9C,MAAM,MAAM,GAAG,IAAI,KAAK,EAAK,CAAC;IAC9B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,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/** @packageDocumentation\n * @module Core\n */\n\nimport { BeEvent, CompressedId64Set, OrderedId64Iterable } from \"@itwin/core-bentley\";\nimport { IModelApp, IModelConnection, IpcApp } from \"@itwin/core-frontend\";\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\nimport { SchemaContext } from \"@itwin/ecschema-metadata\";\nimport {\n ClientDiagnosticsAttribute,\n Content,\n ContentDescriptorRequestOptions,\n ContentFlags,\n ContentInstanceKeysRequestOptions,\n ContentRequestOptions,\n ContentSourcesRequestOptions,\n ContentUpdateInfo,\n DefaultContentDisplayTypes,\n Descriptor,\n DescriptorOverrides,\n DisplayLabelRequestOptions,\n DisplayLabelsRequestOptions,\n DisplayValueGroup,\n DistinctValuesRequestOptions,\n ElementProperties,\n FilterByInstancePathsHierarchyRequestOptions,\n FilterByTextHierarchyRequestOptions,\n FormatsMap,\n HierarchyLevelDescriptorRequestOptions,\n HierarchyRequestOptions,\n HierarchyUpdateInfo,\n InstanceKey,\n Item,\n ItemJSON,\n Key,\n KeySet,\n KoqPropertyValueFormatter,\n LabelDefinition,\n Node,\n NodeKey,\n NodePathElement,\n Paged,\n PagedResponse,\n PageOptions,\n Ruleset,\n RulesetVariable,\n SelectClassInfo,\n SingleElementPropertiesRequestOptions,\n UpdateInfo,\n VariableValueTypes,\n} from \"@itwin/presentation-common\";\nimport {\n buildElementProperties,\n ContentFormatter,\n ContentPropertyValueFormatter,\n PresentationIpcEvents,\n RpcRequestsHandler,\n} from \"@itwin/presentation-common/internal\";\nimport { TRANSIENT_ELEMENT_CLASSNAME } from \"@itwin/unified-selection\";\nimport { IpcRequestsHandler } from \"./IpcRequestsHandler.js\";\nimport { FrontendLocalizationHelper } from \"./LocalizationHelper.js\";\nimport { RulesetManager, RulesetManagerImpl } from \"./RulesetManager.js\";\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager.js\";\nimport { StreamedResponseGenerator } from \"./StreamedResponseGenerator.js\";\nimport { ensureIModelInitialized, startIModelInitialization } from \"./IModelConnectionInitialization.js\";\nimport { _presentation_manager_ipcRequestsHandler, _presentation_manager_rpcRequestsHandler } from \"./InternalSymbols.js\";\n\n/**\n * Data structure that describes IModel hierarchy change event arguments.\n * @public\n */\nexport interface IModelHierarchyChangeEventArgs {\n /** Id of ruleset that was used to create hierarchy. */\n rulesetId: string;\n /** Hierarchy changes info. */\n updateInfo: HierarchyUpdateInfo;\n /** Key of iModel that was used to create hierarchy. It matches [[IModelConnection.key]] property. */\n imodelKey: string;\n}\n\n/**\n * Data structure that describes iModel content change event arguments.\n * @public\n */\nexport interface IModelContentChangeEventArgs {\n /** Id of ruleset that was used to create content. */\n rulesetId: string;\n /** Content changes info. */\n updateInfo: ContentUpdateInfo;\n /** Key of iModel that was used to create content. It matches [[IModelConnection.key]] property. */\n imodelKey: string;\n}\n\n/**\n * Options for requests that can return multiple pages of items concurrently.\n * @public\n */\nexport type MultipleValuesRequestOptions = Paged<{\n /**\n * Max number of requests that should be made to the backend to fulfill the whole request.\n * `undefined` means no limit, so in that case all requests are sent at once.\n */\n maxParallelRequests?: number;\n\n /**\n * Size of a single batch when fetching data through multiple requests. If not set,\n * the fall back is requested page size. If the page size is not set, the backend\n * decides how many items to return.\n */\n batchSize?: number;\n}>;\n\n/**\n * Options for requests that retrieve nodes.\n * @public\n */\nexport type GetNodesRequestOptions = HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute;\n\n/**\n * Options for requests that retrieve content.\n * @public\n */\nexport type GetContentRequestOptions = ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> &\n ClientDiagnosticsAttribute;\n\n/**\n * Options for requests that retrieve distinct values.\n * @public\n */\nexport type GetDistinctValuesRequestOptions = DistinctValuesRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> &\n ClientDiagnosticsAttribute;\n\n/**\n * Properties used to configure [[PresentationManager]]\n * @public\n */\nexport interface PresentationManagerProps {\n /**\n * Sets the active locale to use when localizing presentation-related\n * strings. It can later be changed through [[PresentationManager]].\n */\n activeLocale?: string;\n\n /**\n * Sets the active unit system to use for formatting property values with\n * units. The value can later be changed through [[PresentationManager.activeUnitSystem]] setter or\n * overriden for each request through request parameters. If not set, `IModelApp.quantityFormatter.activeUnitSystem`\n * is used by default.\n *\n * @deprecated in 4.0. Use [IModelApp.quantityFormatter]($core-frontend) to set the active unit system.\n */\n activeUnitSystem?: UnitSystemKey;\n\n /**\n * ID used to identify client that requests data. Generally, clients should\n * store this ID in their local storage so the ID can be reused across\n * sessions - this allows reusing some caches.\n *\n * Defaults to a unique GUID as a client id.\n */\n clientId?: string;\n\n /**\n * Timeout (in milliseconds) for how long we're going to wait for RPC request to be fulfilled before throwing\n * a timeout error.\n *\n * Defaults to 10 minutes.\n */\n requestTimeout?: number;\n\n /**\n * Callback that provides [SchemaContext]($ecschema-metadata) for supplied [IModelConnection]($core-frontend).\n * [SchemaContext]($ecschema-metadata) is used for getting metadata required for values formatting.\n */\n schemaContextProvider?: (imodel: IModelConnection) => SchemaContext;\n\n /**\n * A map of default unit formats to use for formatting properties that don't have a presentation format\n * in requested unit system.\n *\n * @note Only has effect when frontend value formatting is enabled by supplying the `schemaContextProvider` prop.\n */\n defaultFormats?: FormatsMap;\n}\n\n/** @internal */\ninterface PresentationManagerInternalProps {\n rpcRequestsHandler?: RpcRequestsHandler;\n ipcRequestsHandler?: IpcRequestsHandler;\n}\n\n/**\n * Frontend Presentation manager which basically just forwards all calls to\n * the backend implementation.\n *\n * @public\n */\nexport class PresentationManager implements Disposable {\n private _requestsHandler: RpcRequestsHandler;\n private _rulesets: RulesetManager;\n private _localizationHelper: FrontendLocalizationHelper;\n private _explicitActiveUnitSystem: UnitSystemKey | undefined;\n private _rulesetVars: Map<string, RulesetVariablesManager>;\n private _clearEventListener?: () => void;\n private _schemaContextProvider?: (imodel: IModelConnection) => SchemaContext;\n private _defaultFormats?: FormatsMap;\n private _ipcRequestsHandler?: IpcRequestsHandler;\n\n /**\n * An event raised when hierarchies created using specific ruleset change\n */\n public onIModelHierarchyChanged = new BeEvent<(args: IModelHierarchyChangeEventArgs) => void>();\n\n /**\n * An event raised when content created using specific ruleset changes\n */\n public onIModelContentChanged = new BeEvent<(args: IModelContentChangeEventArgs) => void>();\n\n /**\n * Get / set active unit system used to format property values with units.\n *\n * @deprecated in 4.0. `IModelApp.quantityFormatter` should be used to get/set the active unit system. At the moment\n * [[PresentationManager]] allows overriding it, but returns `IModelApp.quantityFormatter.activeUnitSystem` if override\n * is not set.\n */\n public get activeUnitSystem(): UnitSystemKey {\n return this._explicitActiveUnitSystem ?? IModelApp.quantityFormatter.activeUnitSystem;\n }\n public set activeUnitSystem(value: UnitSystemKey | undefined) {\n this._explicitActiveUnitSystem = value;\n }\n\n private constructor(props?: PresentationManagerProps) {\n if (props) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n this._explicitActiveUnitSystem = props.activeUnitSystem;\n }\n\n this._requestsHandler =\n (props as PresentationManagerInternalProps)?.rpcRequestsHandler ??\n new RpcRequestsHandler(props ? { clientId: props.clientId, timeout: props.requestTimeout } : undefined);\n this._rulesetVars = new Map<string, RulesetVariablesManager>();\n this._rulesets = RulesetManagerImpl.create();\n this._localizationHelper = new FrontendLocalizationHelper(props?.activeLocale);\n this._schemaContextProvider = props?.schemaContextProvider;\n this._defaultFormats = props?.defaultFormats;\n\n if (IpcApp.isValid) {\n // Ipc only works in ipc apps, so the `onUpdate` callback will only be called there.\n this._clearEventListener = IpcApp.addListener(PresentationIpcEvents.Update, this.onUpdate);\n this._ipcRequestsHandler = (props as PresentationManagerInternalProps)?.ipcRequestsHandler ?? new IpcRequestsHandler(this._requestsHandler.clientId);\n }\n }\n\n /** Get / set active locale used for localizing presentation data */\n public get activeLocale(): string | undefined {\n return this._localizationHelper.locale;\n }\n public set activeLocale(locale: string | undefined) {\n this._localizationHelper.locale = locale;\n }\n\n public [Symbol.dispose]() {\n if (this._clearEventListener) {\n this._clearEventListener();\n this._clearEventListener = undefined;\n }\n }\n\n /** @deprecated in 5.0 Use [Symbol.dispose] instead. */\n /* c8 ignore next 3 */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n private onUpdate = (_evt: Event, report: UpdateInfo) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.handleUpdateAsync(report);\n };\n\n /** @note This is only called in native apps after changes in iModels */\n private async handleUpdateAsync(report: UpdateInfo) {\n for (const imodelKey in report) {\n /* c8 ignore next 3 */\n if (!report.hasOwnProperty(imodelKey)) {\n continue;\n }\n\n const imodelReport = report[imodelKey];\n for (const rulesetId in imodelReport) {\n /* c8 ignore next 3 */\n if (!imodelReport.hasOwnProperty(rulesetId)) {\n continue;\n }\n\n const updateInfo = imodelReport[rulesetId];\n if (updateInfo.content) {\n this.onIModelContentChanged.raiseEvent({ rulesetId, updateInfo: updateInfo.content, imodelKey });\n }\n if (updateInfo.hierarchy) {\n this.onIModelHierarchyChanged.raiseEvent({ rulesetId, updateInfo: updateInfo.hierarchy, imodelKey });\n }\n }\n }\n }\n\n /**\n * Create a new PresentationManager instance\n * @param props Optional properties used to configure the manager\n */\n public static create(props?: PresentationManagerProps) {\n return new PresentationManager(props);\n }\n\n /** @internal */\n public get [_presentation_manager_rpcRequestsHandler]() {\n return this._requestsHandler;\n }\n\n /** @internal */\n public get [_presentation_manager_ipcRequestsHandler]() {\n return this._ipcRequestsHandler;\n }\n\n /**\n * Get rulesets manager\n */\n public rulesets() {\n return this._rulesets;\n }\n\n /**\n * Get ruleset variables manager for specific ruleset\n * @param rulesetId Id of the ruleset to get the vars manager for\n */\n public vars(rulesetId: string) {\n if (!this._rulesetVars.has(rulesetId)) {\n const varsManager = new RulesetVariablesManagerImpl(rulesetId, this._ipcRequestsHandler);\n this._rulesetVars.set(rulesetId, varsManager);\n }\n return this._rulesetVars.get(rulesetId)!;\n }\n\n private toRpcTokenOptions<TOptions extends { imodel: IModelConnection; locale?: string; unitSystem?: UnitSystemKey; rulesetVariables?: RulesetVariable[] }>(\n requestOptions: TOptions,\n ) {\n // 1. put default `locale` and `unitSystem`\n // 2. put all `requestOptions` members (if `locale` or `unitSystem` are set, they'll override the defaults put at #1)\n // 3. put `imodel` of type `IModelRpcProps` which overwrites the `imodel` from `requestOptions` put at #2\n const defaultOptions: Pick<TOptions, \"locale\" | \"unitSystem\"> = {};\n if (this.activeLocale) {\n defaultOptions.locale = this.activeLocale;\n }\n defaultOptions.unitSystem = this.activeUnitSystem; // eslint-disable-line @typescript-eslint/no-deprecated\n\n const { imodel, rulesetVariables, ...rpcRequestOptions } = requestOptions;\n return {\n ...defaultOptions,\n ...rpcRequestOptions,\n ...(rulesetVariables ? { rulesetVariables: rulesetVariables.map(RulesetVariable.toJSON) } : {}),\n imodel: imodel.getRpcProps(),\n };\n }\n\n private async addRulesetAndVariablesToOptions<TOptions extends { rulesetOrId: Ruleset | string; rulesetVariables?: RulesetVariable[] }>(options: TOptions) {\n const { rulesetOrId, rulesetVariables } = options;\n let foundRulesetOrId: Ruleset | string;\n if (typeof rulesetOrId === \"object\") {\n foundRulesetOrId = rulesetOrId;\n } else {\n const foundRuleset = await this._rulesets.get(rulesetOrId);\n foundRulesetOrId = foundRuleset ? foundRuleset.toJSON() : rulesetOrId;\n }\n const rulesetId = typeof foundRulesetOrId === \"object\" ? foundRulesetOrId.id : foundRulesetOrId;\n\n // All Id64Array variable values must be sorted for serialization to JSON to work. RulesetVariablesManager\n // sorts them before storing, so that part is taken care of, but we need to ensure that variables coming from\n // request options are also sorted.\n const variables = (rulesetVariables ?? []).map((variable) => {\n if (variable.type === VariableValueTypes.Id64Array) {\n return { ...variable, value: OrderedId64Iterable.sortArray(variable.value) };\n }\n return variable;\n });\n if (!this._ipcRequestsHandler) {\n // only need to add variables from variables manager if there's no IPC\n // handler - if there is one, the variables are already known by the backend\n variables.push(...this.vars(rulesetId).getAllVariables());\n }\n\n return { ...options, rulesetOrId: foundRulesetOrId, rulesetVariables: variables };\n }\n\n /** Returns an iterator that polls nodes asynchronously. */\n public async getNodesIterator(\n requestOptions: GetNodesRequestOptions & MultipleValuesRequestOptions,\n ): Promise<{ total: number; items: AsyncIterableIterator<Node> }> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n\n const generator = new StreamedResponseGenerator({\n ...requestOptions,\n getBatch: async (paging) => {\n const result = await this._requestsHandler.getPagedNodes({ ...rpcOptions, paging });\n return {\n total: result.total,\n items: this._localizationHelper.getLocalizedNodes(result.items),\n };\n },\n });\n\n return generator.createAsyncIteratorResponse();\n }\n\n /**\n * Retrieves nodes\n * @deprecated in 4.5. Use [[getNodesIterator]] instead.\n */\n public async getNodes(requestOptions: GetNodesRequestOptions & MultipleValuesRequestOptions): Promise<Node[]> {\n const result = await this.getNodesIterator(requestOptions);\n return collect(result.items);\n }\n\n /** Retrieves nodes count. */\n public async getNodesCount(requestOptions: GetNodesRequestOptions): Promise<number> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n return this._requestsHandler.getNodesCount(rpcOptions);\n }\n\n /**\n * Retrieves total nodes count and a single page of nodes.\n * @deprecated in 4.5. Use [[getNodesIterator]] instead.\n */\n public async getNodesAndCount(requestOptions: GetNodesRequestOptions & MultipleValuesRequestOptions): Promise<{ count: number; nodes: Node[] }> {\n const result = await this.getNodesIterator(requestOptions);\n return {\n count: result.total,\n nodes: await collect(result.items),\n };\n }\n\n /**\n * Retrieves hierarchy level descriptor.\n * @public\n */\n public async getNodesDescriptor(\n requestOptions: HierarchyLevelDescriptorRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute,\n ): Promise<Descriptor | undefined> {\n startIModelInitialization(requestOptions.imodel);\n try {\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n const result = await this._requestsHandler.getNodesDescriptor(rpcOptions);\n const descriptor = Descriptor.fromJSON(result);\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\n } finally {\n await ensureIModelInitialized(requestOptions.imodel);\n }\n }\n\n /** Retrieves paths from root nodes to children nodes according to specified keys. Intersecting paths will be merged. */\n public async getNodePaths(\n requestOptions: FilterByInstancePathsHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute,\n ): Promise<NodePathElement[]> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n const result = await this._requestsHandler.getNodePaths(rpcOptions);\n return result.map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\n }\n\n /** Retrieves paths from root nodes to nodes containing filter text in their label. */\n public async getFilteredNodePaths(\n requestOptions: FilterByTextHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute,\n ): Promise<NodePathElement[]> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const result = await this._requestsHandler.getFilteredNodePaths(this.toRpcTokenOptions(options));\n return result.map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\n }\n\n /**\n * Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,\n * its related instances for loading related and navigation properties.\n * @public\n */\n public async getContentSources(requestOptions: ContentSourcesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute): Promise<SelectClassInfo[]> {\n startIModelInitialization(requestOptions.imodel);\n const rpcOptions = this.toRpcTokenOptions(requestOptions);\n const result = await this._requestsHandler.getContentSources(rpcOptions);\n return result.sources.map((sourceJson) => SelectClassInfo.fromCompressedJSON(sourceJson, result.classesMap));\n }\n\n /** Retrieves the content descriptor which describes the content and can be used to customize it. */\n public async getContentDescriptor(\n requestOptions: ContentDescriptorRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute,\n ): Promise<Descriptor | undefined> {\n startIModelInitialization(requestOptions.imodel);\n try {\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({\n ...options,\n keys: stripTransientElementKeys(options.keys).toJSON(),\n });\n const result = await this._requestsHandler.getContentDescriptor(rpcOptions);\n const descriptor = Descriptor.fromJSON(result);\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\n } finally {\n await ensureIModelInitialized(requestOptions.imodel);\n }\n }\n\n /** Retrieves overall content set size. */\n public async getContentSetSize(requestOptions: GetContentRequestOptions): Promise<number> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({\n ...options,\n descriptor: getDescriptorOverrides(requestOptions.descriptor),\n keys: stripTransientElementKeys(requestOptions.keys).toJSON(),\n });\n return this._requestsHandler.getContentSetSize(rpcOptions);\n }\n\n private async getContentIteratorInternal(\n requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions,\n ): Promise<{ descriptor: Descriptor; total: number; items: AsyncIterableIterator<Item> } | undefined> {\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const firstPageSize = options.batchSize ?? requestOptions.paging?.size;\n const rpcOptions = this.toRpcTokenOptions({\n ...options,\n descriptor: getDescriptorOverrides(requestOptions.descriptor),\n keys: stripTransientElementKeys(requestOptions.keys).toJSON(),\n ...(firstPageSize ? { paging: { ...requestOptions.paging, size: firstPageSize } } : undefined),\n ...(!requestOptions.omitFormattedValues && this._schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),\n });\n\n let contentFormatter: ContentFormatter | undefined;\n if (!requestOptions.omitFormattedValues && this._schemaContextProvider) {\n const koqPropertyFormatter = new KoqPropertyValueFormatter(this._schemaContextProvider(requestOptions.imodel), this._defaultFormats);\n contentFormatter = new ContentFormatter(\n new ContentPropertyValueFormatter(koqPropertyFormatter),\n requestOptions.unitSystem ?? this._explicitActiveUnitSystem ?? IModelApp.quantityFormatter.activeUnitSystem,\n );\n }\n\n let descriptor = requestOptions.descriptor instanceof Descriptor ? requestOptions.descriptor : undefined;\n let firstPage: PagedResponse<ItemJSON> | undefined;\n if (!descriptor) {\n const firstPageResponse = await this._requestsHandler.getPagedContent(rpcOptions);\n if (!firstPageResponse?.descriptor || !firstPageResponse.contentSet) {\n return undefined;\n }\n descriptor = Descriptor.fromJSON(firstPageResponse?.descriptor);\n firstPage = firstPageResponse?.contentSet;\n }\n\n /* c8 ignore next 3 */\n if (!descriptor) {\n return undefined;\n }\n\n descriptor = this._localizationHelper.getLocalizedContentDescriptor(descriptor);\n\n const getPage = async (paging: Required<PageOptions>, requestIndex: number) => {\n let contentSet = requestIndex === 0 ? firstPage : undefined;\n contentSet ??= await this._requestsHandler.getPagedContentSet({ ...rpcOptions, paging });\n\n let items = contentSet.items.map((x) => Item.fromJSON(x)).filter((x): x is Item => x !== undefined);\n if (contentFormatter) {\n items = await contentFormatter.formatContentItems(items, descriptor);\n }\n\n items = this._localizationHelper.getLocalizedContentItems(items);\n return {\n total: contentSet.total,\n items,\n };\n };\n\n const generator = new StreamedResponseGenerator({\n ...requestOptions,\n getBatch: getPage,\n });\n\n return {\n ...(await generator.createAsyncIteratorResponse()),\n descriptor,\n };\n }\n\n /** Retrieves a content descriptor, item count and async generator for the items themselves. */\n public async getContentIterator(\n requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions,\n ): Promise<{ descriptor: Descriptor; total: number; items: AsyncIterableIterator<Item> } | undefined> {\n startIModelInitialization(requestOptions.imodel);\n const response = await this.getContentIteratorInternal(requestOptions);\n if (!response) {\n return undefined;\n }\n\n await ensureIModelInitialized(requestOptions.imodel);\n return response;\n }\n\n /**\n * Retrieves content which consists of a content descriptor and a page of records.\n * @deprecated in 4.5. Use [[getContentIterator]] instead.\n */\n public async getContent(requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions): Promise<Content | undefined> {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return (await this.getContentAndSize(requestOptions))?.content;\n }\n\n /**\n * Retrieves content set size and content which consists of a content descriptor and a page of records.\n * @deprecated in 4.5. Use [[getContentIterator]] instead.\n */\n public async getContentAndSize(\n requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions,\n ): Promise<{ content: Content; size: number } | undefined> {\n const response = await this.getContentIterator(requestOptions);\n if (!response) {\n return undefined;\n }\n\n const { descriptor, total } = response;\n const items = await collect(response.items);\n return {\n content: new Content(descriptor, items),\n size: total,\n };\n }\n\n /** Returns an iterator that asynchronously polls distinct values of specific field from the content. */\n public async getDistinctValuesIterator(\n requestOptions: GetDistinctValuesRequestOptions & MultipleValuesRequestOptions,\n ): Promise<{ total: number; items: AsyncIterableIterator<DisplayValueGroup> }> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = {\n ...this.toRpcTokenOptions(options),\n descriptor: getDescriptorOverrides(options.descriptor),\n keys: stripTransientElementKeys(options.keys).toJSON(),\n };\n\n const generator = new StreamedResponseGenerator({\n ...requestOptions,\n getBatch: async (paging) => {\n const response = await this._requestsHandler.getPagedDistinctValues({ ...rpcOptions, paging });\n return {\n total: response.total,\n items: response.items.map((x) => this._localizationHelper.getLocalizedDisplayValueGroup(x)),\n };\n },\n });\n\n return generator.createAsyncIteratorResponse();\n }\n\n /**\n * Retrieves distinct values of specific field from the content.\n * @deprecated in 4.5. Use [[getDistinctValuesIterator]] instead.\n */\n public async getPagedDistinctValues(\n requestOptions: GetDistinctValuesRequestOptions & MultipleValuesRequestOptions,\n ): Promise<PagedResponse<DisplayValueGroup>> {\n const result = await this.getDistinctValuesIterator(requestOptions);\n return {\n total: result.total,\n items: await collect(result.items),\n };\n }\n\n /**\n * Retrieves property data in a simplified format for a single element specified by ID.\n * @public\n */\n public async getElementProperties<TParsedContent = ElementProperties>(\n requestOptions: SingleElementPropertiesRequestOptions<IModelConnection, TParsedContent> & ClientDiagnosticsAttribute,\n ): Promise<TParsedContent | undefined> {\n startIModelInitialization(requestOptions.imodel);\n type TParser = Required<typeof requestOptions>[\"contentParser\"];\n const { elementId, contentParser, ...optionsNoElementId } = requestOptions;\n const parser: TParser = contentParser ?? (buildElementProperties as TParser);\n const iter = await this.getContentIterator({\n ...optionsNoElementId,\n descriptor: {\n displayType: DefaultContentDisplayTypes.PropertyPane,\n contentFlags: ContentFlags.ShowLabels,\n },\n rulesetOrId: \"ElementProperties\",\n keys: new KeySet([{ className: \"BisCore:Element\", id: elementId }]),\n });\n if (!iter || iter.total === 0) {\n return undefined;\n }\n return parser(iter.descriptor, (await iter.items.next()).value);\n }\n\n /**\n * Retrieves content item instance keys.\n * @public\n */\n public async getContentInstanceKeys(\n requestOptions: ContentInstanceKeysRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute & MultipleValuesRequestOptions,\n ): Promise<{ total: number; items: () => AsyncGenerator<InstanceKey> }> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = {\n ...this.toRpcTokenOptions(options),\n keys: stripTransientElementKeys(options.keys).toJSON(),\n };\n\n const generator = new StreamedResponseGenerator({\n ...requestOptions,\n getBatch: async (page) => {\n const keys = await this._requestsHandler.getContentInstanceKeys({ ...rpcOptions, paging: page });\n return {\n total: keys.total,\n items: keys.items.instanceKeys.reduce((instanceKeys, entry) => {\n for (const id of CompressedId64Set.iterable(entry[1])) {\n instanceKeys.push({ className: entry[0], id });\n }\n return instanceKeys;\n }, new Array<InstanceKey>()),\n };\n },\n });\n\n const { total, items } = await generator.createAsyncIteratorResponse();\n return {\n total,\n async *items() {\n yield* items;\n },\n };\n }\n\n /** Retrieves display label definition of specific item. */\n public async getDisplayLabelDefinition(\n requestOptions: DisplayLabelRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute,\n ): Promise<LabelDefinition> {\n startIModelInitialization(requestOptions.imodel);\n const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });\n const result = await this._requestsHandler.getDisplayLabelDefinition(rpcOptions);\n return this._localizationHelper.getLocalizedLabelDefinition(result);\n }\n\n /** Retrieves display label definition of specific items. */\n public async getDisplayLabelDefinitionsIterator(\n requestOptions: DisplayLabelsRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute & MultipleValuesRequestOptions,\n ): Promise<{ total: number; items: AsyncIterableIterator<LabelDefinition> }> {\n startIModelInitialization(requestOptions.imodel);\n const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });\n const generator = new StreamedResponseGenerator({\n ...requestOptions,\n getBatch: async (page) => {\n const partialKeys = !page.start ? rpcOptions.keys : rpcOptions.keys.slice(page.start);\n const result = await this._requestsHandler.getPagedDisplayLabelDefinitions({ ...rpcOptions, keys: partialKeys });\n result.items = this._localizationHelper.getLocalizedLabelDefinitions(result.items);\n return result;\n },\n });\n\n return generator.createAsyncIteratorResponse();\n }\n\n /**\n * Retrieves display label definition of specific items.\n * @deprecated in 4.5. Use [[getDisplayLabelDefinitionsIterator]] instead.\n */\n public async getDisplayLabelDefinitions(\n requestOptions: DisplayLabelsRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute & MultipleValuesRequestOptions,\n ): Promise<LabelDefinition[]> {\n const { items } = await this.getDisplayLabelDefinitionsIterator(requestOptions);\n return collect(items);\n }\n}\n\nconst getDescriptorOverrides = (descriptorOrOverrides: Descriptor | DescriptorOverrides): DescriptorOverrides => {\n if (descriptorOrOverrides instanceof Descriptor) {\n return descriptorOrOverrides.createDescriptorOverrides();\n }\n return descriptorOrOverrides;\n};\n\nconst stripTransientElementKeys = (keys: KeySet) => {\n if (!keys.some((key) => Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME)) {\n return keys;\n }\n\n const copy = new KeySet();\n copy.add(keys, (key) => {\n // the callback is not going to be called with EntityProps as KeySet converts them\n // to InstanceKeys, but we want to keep the EntityProps case for correctness\n /* c8 ignore next 3 */\n const isTransient =\n (Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME) ||\n (Key.isEntityProps(key) && key.classFullName === TRANSIENT_ELEMENT_CLASSNAME);\n return !isTransient;\n });\n return copy;\n};\n\nasync function collect<T>(iter: AsyncIterable<T>): Promise<T[]> {\n const result = new Array<T>();\n for await (const value of iter) {\n result.push(value);\n }\n return result;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAAsF;AACtF,wDAA2E;AAG3E,oEA0CoC;AACpC,kEAM6C;AAC7C,gEAAuE;AACvE,2FAAyG;AACzG,6DAA0H;AAC1H,mEAA6D;AAC7D,mEAAqE;AACrE,2DAAyE;AACzE,6EAAoG;AACpG,iFAA2E;AAoI3E;;;;;GAKG;AACH,MAAa,mBAAmB;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CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;QACrB,kFAAkF;QAClF,4EAA4E;QAC5E,sBAAsB;QACtB,MAAM,WAAW,GACf,CAAC,yBAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,SAAS,KAAK,+CAA2B,CAAC;YACzE,CAAC,yBAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,aAAa,KAAK,+CAA2B,CAAC,CAAC;QAChF,OAAO,CAAC,WAAW,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,KAAK,UAAU,OAAO,CAAI,IAAsB;IAC9C,MAAM,MAAM,GAAG,IAAI,KAAK,EAAK,CAAC;IAC9B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,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/** @packageDocumentation\n * @module Core\n */\n\nimport { BeEvent, CompressedId64Set, OrderedId64Iterable } from \"@itwin/core-bentley\";\nimport { IModelApp, IModelConnection, IpcApp } from \"@itwin/core-frontend\";\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\nimport { SchemaContext } from \"@itwin/ecschema-metadata\";\nimport {\n ClientDiagnosticsAttribute,\n Content,\n ContentDescriptorRequestOptions,\n ContentFlags,\n ContentInstanceKeysRequestOptions,\n ContentRequestOptions,\n ContentSourcesRequestOptions,\n ContentUpdateInfo,\n DefaultContentDisplayTypes,\n Descriptor,\n DescriptorOverrides,\n DisplayLabelRequestOptions,\n DisplayLabelsRequestOptions,\n DisplayValueGroup,\n DistinctValuesRequestOptions,\n ElementProperties,\n FilterByInstancePathsHierarchyRequestOptions,\n FilterByTextHierarchyRequestOptions,\n FormatsMap,\n HierarchyLevelDescriptorRequestOptions,\n HierarchyRequestOptions,\n HierarchyUpdateInfo,\n InstanceKey,\n Item,\n ItemJSON,\n Key,\n KeySet,\n KoqPropertyValueFormatter,\n LabelDefinition,\n Node,\n NodeKey,\n NodePathElement,\n Paged,\n PagedResponse,\n PageOptions,\n Ruleset,\n RulesetVariable,\n SelectClassInfo,\n SingleElementPropertiesRequestOptions,\n UpdateInfo,\n VariableValueTypes,\n} from \"@itwin/presentation-common\";\nimport {\n buildElementProperties,\n ContentFormatter,\n ContentPropertyValueFormatter,\n PresentationIpcEvents,\n RpcRequestsHandler,\n} from \"@itwin/presentation-common/internal\";\nimport { TRANSIENT_ELEMENT_CLASSNAME } from \"@itwin/unified-selection\";\nimport { ensureIModelInitialized, startIModelInitialization } from \"./IModelConnectionInitialization.js\";\nimport { _presentation_manager_ipcRequestsHandler, _presentation_manager_rpcRequestsHandler } from \"./InternalSymbols.js\";\nimport { IpcRequestsHandler } from \"./IpcRequestsHandler.js\";\nimport { FrontendLocalizationHelper } from \"./LocalizationHelper.js\";\nimport { RulesetManager, RulesetManagerImpl } from \"./RulesetManager.js\";\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager.js\";\nimport { StreamedResponseGenerator } from \"./StreamedResponseGenerator.js\";\n\n/**\n * Data structure that describes IModel hierarchy change event arguments.\n * @public\n */\nexport interface IModelHierarchyChangeEventArgs {\n /** Id of ruleset that was used to create hierarchy. */\n rulesetId: string;\n /** Hierarchy changes info. */\n updateInfo: HierarchyUpdateInfo;\n /** Key of iModel that was used to create hierarchy. It matches [[IModelConnection.key]] property. */\n imodelKey: string;\n}\n\n/**\n * Data structure that describes iModel content change event arguments.\n * @public\n */\nexport interface IModelContentChangeEventArgs {\n /** Id of ruleset that was used to create content. */\n rulesetId: string;\n /** Content changes info. */\n updateInfo: ContentUpdateInfo;\n /** Key of iModel that was used to create content. It matches [[IModelConnection.key]] property. */\n imodelKey: string;\n}\n\n/**\n * Options for requests that can return multiple pages of items concurrently.\n * @public\n */\nexport type MultipleValuesRequestOptions = Paged<{\n /**\n * Max number of requests that should be made to the backend to fulfill the whole request.\n * `undefined` means no limit, so in that case all requests are sent at once.\n */\n maxParallelRequests?: number;\n\n /**\n * Size of a single batch when fetching data through multiple requests. If not set,\n * the fall back is requested page size. If the page size is not set, the backend\n * decides how many items to return.\n */\n batchSize?: number;\n}>;\n\n/**\n * Options for requests that retrieve nodes.\n * @public\n */\nexport type GetNodesRequestOptions = HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute;\n\n/**\n * Options for requests that retrieve content.\n * @public\n */\nexport type GetContentRequestOptions = ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> &\n ClientDiagnosticsAttribute;\n\n/**\n * Options for requests that retrieve distinct values.\n * @public\n */\nexport type GetDistinctValuesRequestOptions = DistinctValuesRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> &\n ClientDiagnosticsAttribute;\n\n/**\n * Properties used to configure [[PresentationManager]]\n * @public\n */\nexport interface PresentationManagerProps {\n /**\n * Sets the active locale to use when localizing presentation-related\n * strings. It can later be changed through [[PresentationManager]].\n */\n activeLocale?: string;\n\n /**\n * Sets the active unit system to use for formatting property values with\n * units. The value can later be changed through [[PresentationManager.activeUnitSystem]] setter or\n * overriden for each request through request parameters. If not set, `IModelApp.quantityFormatter.activeUnitSystem`\n * is used by default.\n *\n * @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [IModelApp.quantityFormatter]($core-frontend) to set the active unit system.\n */\n activeUnitSystem?: UnitSystemKey;\n\n /**\n * ID used to identify client that requests data. Generally, clients should\n * store this ID in their local storage so the ID can be reused across\n * sessions - this allows reusing some caches.\n *\n * Defaults to a unique GUID as a client id.\n */\n clientId?: string;\n\n /**\n * Timeout (in milliseconds) for how long we're going to wait for RPC request to be fulfilled before throwing\n * a timeout error.\n *\n * Defaults to 10 minutes.\n */\n requestTimeout?: number;\n\n /**\n * Callback that provides [SchemaContext]($ecschema-metadata) for supplied [IModelConnection]($core-frontend).\n * [SchemaContext]($ecschema-metadata) is used for getting metadata required for values formatting.\n *\n * @deprecated in 5.1. By default [IModelConnection.schemaContext]($core-frontend) is now used instead.\n */\n schemaContextProvider?: (imodel: IModelConnection) => SchemaContext;\n\n /**\n * A map of default unit formats to use for formatting properties that don't have a presentation format\n * in requested unit system.\n *\n * @note Only has effect when frontend value formatting is enabled by supplying the `schemaContextProvider` prop.\n *\n * @deprecated in 5.1. All formats' logic is now handled by [IModelApp.formatsProvider]($core-frontend). Until the prop is removed, when\n * supplied, this map will be used as a fallback if IModelApp's formats provider doesn't return anything for requested format.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n defaultFormats?: FormatsMap;\n}\n\n/** @internal */\ninterface PresentationManagerInternalProps {\n rpcRequestsHandler?: RpcRequestsHandler;\n ipcRequestsHandler?: IpcRequestsHandler;\n}\n\n/**\n * Frontend Presentation manager which basically just forwards all calls to\n * the backend implementation.\n *\n * @public\n */\nexport class PresentationManager implements Disposable {\n private _requestsHandler: RpcRequestsHandler;\n private _rulesets: RulesetManager;\n private _localizationHelper: FrontendLocalizationHelper;\n private _explicitActiveUnitSystem: UnitSystemKey | undefined;\n private _rulesetVars: Map<string, RulesetVariablesManager>;\n private _clearEventListener?: () => void;\n private _schemaContextProvider: (imodel: IModelConnection) => SchemaContext;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n private _defaultFormats?: FormatsMap;\n private _ipcRequestsHandler?: IpcRequestsHandler;\n\n /**\n * An event raised when hierarchies created using specific ruleset change\n */\n public onIModelHierarchyChanged = new BeEvent<(args: IModelHierarchyChangeEventArgs) => void>();\n\n /**\n * An event raised when content created using specific ruleset changes\n */\n public onIModelContentChanged = new BeEvent<(args: IModelContentChangeEventArgs) => void>();\n\n /**\n * Get / set active unit system used to format property values with units.\n *\n * @deprecated in 4.0 - will not be removed until after 2026-06-13. `IModelApp.quantityFormatter` should be used to get/set the active unit system. At the moment\n * [[PresentationManager]] allows overriding it, but returns `IModelApp.quantityFormatter.activeUnitSystem` if override\n * is not set.\n */\n public get activeUnitSystem(): UnitSystemKey {\n return this._explicitActiveUnitSystem ?? IModelApp.quantityFormatter.activeUnitSystem;\n }\n public set activeUnitSystem(value: UnitSystemKey | undefined) {\n this._explicitActiveUnitSystem = value;\n }\n\n private constructor(props?: PresentationManagerProps) {\n if (props) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n this._explicitActiveUnitSystem = props.activeUnitSystem;\n }\n\n this._requestsHandler =\n (props as PresentationManagerInternalProps)?.rpcRequestsHandler ??\n new RpcRequestsHandler(props ? { clientId: props.clientId, timeout: props.requestTimeout } : undefined);\n this._rulesetVars = new Map<string, RulesetVariablesManager>();\n this._rulesets = RulesetManagerImpl.create();\n this._localizationHelper = new FrontendLocalizationHelper(props?.activeLocale);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n this._schemaContextProvider = props?.schemaContextProvider ?? ((imodel: IModelConnection) => imodel.schemaContext);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n this._defaultFormats = props?.defaultFormats;\n\n if (IpcApp.isValid) {\n // Ipc only works in ipc apps, so the `onUpdate` callback will only be called there.\n this._clearEventListener = IpcApp.addListener(PresentationIpcEvents.Update, this.onUpdate);\n this._ipcRequestsHandler = (props as PresentationManagerInternalProps)?.ipcRequestsHandler ?? new IpcRequestsHandler(this._requestsHandler.clientId);\n }\n }\n\n /** Get / set active locale used for localizing presentation data */\n public get activeLocale(): string | undefined {\n return this._localizationHelper.locale;\n }\n public set activeLocale(locale: string | undefined) {\n this._localizationHelper.locale = locale;\n }\n\n public [Symbol.dispose]() {\n if (this._clearEventListener) {\n this._clearEventListener();\n this._clearEventListener = undefined;\n }\n }\n\n /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */\n /* c8 ignore next 3 */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n private onUpdate = (_evt: Event, report: UpdateInfo) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.handleUpdateAsync(report);\n };\n\n /** @note This is only called in native apps after changes in iModels */\n private async handleUpdateAsync(report: UpdateInfo) {\n for (const imodelKey in report) {\n /* c8 ignore next 3 */\n if (!report.hasOwnProperty(imodelKey)) {\n continue;\n }\n\n const imodelReport = report[imodelKey];\n for (const rulesetId in imodelReport) {\n /* c8 ignore next 3 */\n if (!imodelReport.hasOwnProperty(rulesetId)) {\n continue;\n }\n\n const updateInfo = imodelReport[rulesetId];\n if (updateInfo.content) {\n this.onIModelContentChanged.raiseEvent({ rulesetId, updateInfo: updateInfo.content, imodelKey });\n }\n if (updateInfo.hierarchy) {\n this.onIModelHierarchyChanged.raiseEvent({ rulesetId, updateInfo: updateInfo.hierarchy, imodelKey });\n }\n }\n }\n }\n\n /**\n * Create a new PresentationManager instance\n * @param props Optional properties used to configure the manager\n */\n public static create(props?: PresentationManagerProps) {\n return new PresentationManager(props);\n }\n\n /** @internal */\n public get [_presentation_manager_rpcRequestsHandler]() {\n return this._requestsHandler;\n }\n\n /** @internal */\n public get [_presentation_manager_ipcRequestsHandler]() {\n return this._ipcRequestsHandler;\n }\n\n /**\n * Get rulesets manager\n */\n public rulesets() {\n return this._rulesets;\n }\n\n /**\n * Get ruleset variables manager for specific ruleset\n * @param rulesetId Id of the ruleset to get the vars manager for\n */\n public vars(rulesetId: string) {\n if (!this._rulesetVars.has(rulesetId)) {\n const varsManager = new RulesetVariablesManagerImpl(rulesetId, this._ipcRequestsHandler);\n this._rulesetVars.set(rulesetId, varsManager);\n }\n return this._rulesetVars.get(rulesetId)!;\n }\n\n private toRpcTokenOptions<TOptions extends { imodel: IModelConnection; locale?: string; unitSystem?: UnitSystemKey; rulesetVariables?: RulesetVariable[] }>(\n requestOptions: TOptions,\n ) {\n // 1. put default `locale` and `unitSystem`\n // 2. put all `requestOptions` members (if `locale` or `unitSystem` are set, they'll override the defaults put at #1)\n // 3. put `imodel` of type `IModelRpcProps` which overwrites the `imodel` from `requestOptions` put at #2\n const defaultOptions: Pick<TOptions, \"locale\" | \"unitSystem\"> = {};\n if (this.activeLocale) {\n defaultOptions.locale = this.activeLocale;\n }\n defaultOptions.unitSystem = this.activeUnitSystem; // eslint-disable-line @typescript-eslint/no-deprecated\n\n const { imodel, rulesetVariables, ...rpcRequestOptions } = requestOptions;\n return {\n ...defaultOptions,\n ...rpcRequestOptions,\n ...(rulesetVariables ? { rulesetVariables: rulesetVariables.map(RulesetVariable.toJSON) } : {}),\n imodel: imodel.getRpcProps(),\n };\n }\n\n private async addRulesetAndVariablesToOptions<TOptions extends { rulesetOrId: Ruleset | string; rulesetVariables?: RulesetVariable[] }>(options: TOptions) {\n const { rulesetOrId, rulesetVariables } = options;\n let foundRulesetOrId: Ruleset | string;\n if (typeof rulesetOrId === \"object\") {\n foundRulesetOrId = rulesetOrId;\n } else {\n const foundRuleset = await this._rulesets.get(rulesetOrId);\n foundRulesetOrId = foundRuleset ? foundRuleset.toJSON() : rulesetOrId;\n }\n const rulesetId = typeof foundRulesetOrId === \"object\" ? foundRulesetOrId.id : foundRulesetOrId;\n\n // All Id64Array variable values must be sorted for serialization to JSON to work. RulesetVariablesManager\n // sorts them before storing, so that part is taken care of, but we need to ensure that variables coming from\n // request options are also sorted.\n const variables = (rulesetVariables ?? []).map((variable) => {\n if (variable.type === VariableValueTypes.Id64Array) {\n return { ...variable, value: OrderedId64Iterable.sortArray(variable.value) };\n }\n return variable;\n });\n if (!this._ipcRequestsHandler) {\n // only need to add variables from variables manager if there's no IPC\n // handler - if there is one, the variables are already known by the backend\n variables.push(...this.vars(rulesetId).getAllVariables());\n }\n\n return { ...options, rulesetOrId: foundRulesetOrId, rulesetVariables: variables };\n }\n\n /** Returns an iterator that polls nodes asynchronously. */\n public async getNodesIterator(\n requestOptions: GetNodesRequestOptions & MultipleValuesRequestOptions,\n ): Promise<{ total: number; items: AsyncIterableIterator<Node> }> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n\n const generator = new StreamedResponseGenerator({\n ...requestOptions,\n getBatch: async (paging) => {\n const result = await this._requestsHandler.getPagedNodes({ ...rpcOptions, paging });\n return {\n total: result.total,\n items: this._localizationHelper.getLocalizedNodes(result.items),\n };\n },\n });\n\n return generator.createAsyncIteratorResponse();\n }\n\n /**\n * Retrieves nodes\n * @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[getNodesIterator]] instead.\n */\n public async getNodes(requestOptions: GetNodesRequestOptions & MultipleValuesRequestOptions): Promise<Node[]> {\n const result = await this.getNodesIterator(requestOptions);\n return collect(result.items);\n }\n\n /** Retrieves nodes count. */\n public async getNodesCount(requestOptions: GetNodesRequestOptions): Promise<number> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n return this._requestsHandler.getNodesCount(rpcOptions);\n }\n\n /**\n * Retrieves total nodes count and a single page of nodes.\n * @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[getNodesIterator]] instead.\n */\n public async getNodesAndCount(requestOptions: GetNodesRequestOptions & MultipleValuesRequestOptions): Promise<{ count: number; nodes: Node[] }> {\n const result = await this.getNodesIterator(requestOptions);\n return {\n count: result.total,\n nodes: await collect(result.items),\n };\n }\n\n /**\n * Retrieves hierarchy level descriptor.\n * @public\n */\n public async getNodesDescriptor(\n requestOptions: HierarchyLevelDescriptorRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute,\n ): Promise<Descriptor | undefined> {\n startIModelInitialization(requestOptions.imodel);\n try {\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n const result = await this._requestsHandler.getNodesDescriptor(rpcOptions);\n const descriptor = Descriptor.fromJSON(result);\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\n } finally {\n await ensureIModelInitialized(requestOptions.imodel);\n }\n }\n\n /** Retrieves paths from root nodes to children nodes according to specified keys. Intersecting paths will be merged. */\n public async getNodePaths(\n requestOptions: FilterByInstancePathsHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute,\n ): Promise<NodePathElement[]> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n const result = await this._requestsHandler.getNodePaths(rpcOptions);\n return result.map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\n }\n\n /** Retrieves paths from root nodes to nodes containing filter text in their label. */\n public async getFilteredNodePaths(\n requestOptions: FilterByTextHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute,\n ): Promise<NodePathElement[]> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const result = await this._requestsHandler.getFilteredNodePaths(this.toRpcTokenOptions(options));\n return result.map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\n }\n\n /**\n * Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,\n * its related instances for loading related and navigation properties.\n * @public\n */\n public async getContentSources(requestOptions: ContentSourcesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute): Promise<SelectClassInfo[]> {\n startIModelInitialization(requestOptions.imodel);\n const rpcOptions = this.toRpcTokenOptions(requestOptions);\n const result = await this._requestsHandler.getContentSources(rpcOptions);\n return result.sources.map((sourceJson) => SelectClassInfo.fromCompressedJSON(sourceJson, result.classesMap));\n }\n\n /** Retrieves the content descriptor which describes the content and can be used to customize it. */\n public async getContentDescriptor(\n requestOptions: ContentDescriptorRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute,\n ): Promise<Descriptor | undefined> {\n startIModelInitialization(requestOptions.imodel);\n try {\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({\n ...options,\n keys: stripTransientElementKeys(options.keys).toJSON(),\n });\n const result = await this._requestsHandler.getContentDescriptor(rpcOptions);\n const descriptor = Descriptor.fromJSON(result);\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\n } finally {\n await ensureIModelInitialized(requestOptions.imodel);\n }\n }\n\n /** Retrieves overall content set size. */\n public async getContentSetSize(requestOptions: GetContentRequestOptions): Promise<number> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({\n ...options,\n descriptor: getDescriptorOverrides(requestOptions.descriptor),\n keys: stripTransientElementKeys(requestOptions.keys).toJSON(),\n });\n return this._requestsHandler.getContentSetSize(rpcOptions);\n }\n\n private async getContentIteratorInternal(\n requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions,\n ): Promise<{ descriptor: Descriptor; total: number; items: AsyncIterableIterator<Item> } | undefined> {\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const firstPageSize = options.batchSize ?? requestOptions.paging?.size;\n const rpcOptions = this.toRpcTokenOptions({\n ...options,\n descriptor: getDescriptorOverrides(requestOptions.descriptor),\n keys: stripTransientElementKeys(requestOptions.keys).toJSON(),\n omitFormattedValues: true,\n ...(firstPageSize ? { paging: { ...requestOptions.paging, size: firstPageSize } } : undefined),\n });\n\n let contentFormatter: ContentFormatter | undefined;\n if (!requestOptions.omitFormattedValues) {\n const schemaContext = this._schemaContextProvider(requestOptions.imodel);\n const unitSystem = requestOptions.unitSystem ?? this._explicitActiveUnitSystem ?? IModelApp.quantityFormatter.activeUnitSystem;\n const koqPropertyFormatter = new KoqPropertyValueFormatter({\n schemaContext,\n formatsProvider: IModelApp.formatsProvider,\n });\n koqPropertyFormatter.defaultFormats = this._defaultFormats;\n contentFormatter = new ContentFormatter(new ContentPropertyValueFormatter(koqPropertyFormatter), unitSystem);\n }\n\n let descriptor = requestOptions.descriptor instanceof Descriptor ? requestOptions.descriptor : undefined;\n let firstPage: PagedResponse<ItemJSON> | undefined;\n if (!descriptor) {\n const firstPageResponse = await this._requestsHandler.getPagedContent(rpcOptions);\n if (!firstPageResponse?.descriptor || !firstPageResponse.contentSet) {\n return undefined;\n }\n descriptor = Descriptor.fromJSON(firstPageResponse?.descriptor);\n firstPage = firstPageResponse?.contentSet;\n }\n\n /* c8 ignore next 3 */\n if (!descriptor) {\n return undefined;\n }\n\n descriptor = this._localizationHelper.getLocalizedContentDescriptor(descriptor);\n\n const getPage = async (paging: Required<PageOptions>, requestIndex: number) => {\n let contentSet = requestIndex === 0 ? firstPage : undefined;\n contentSet ??= await this._requestsHandler.getPagedContentSet({ ...rpcOptions, paging });\n\n let items = contentSet.items.map((x) => Item.fromJSON(x)).filter((x): x is Item => x !== undefined);\n if (contentFormatter) {\n items = await contentFormatter.formatContentItems(items, descriptor);\n }\n\n items = this._localizationHelper.getLocalizedContentItems(items);\n return {\n total: contentSet.total,\n items,\n };\n };\n\n const generator = new StreamedResponseGenerator({\n ...requestOptions,\n getBatch: getPage,\n });\n\n return {\n ...(await generator.createAsyncIteratorResponse()),\n descriptor,\n };\n }\n\n /** Retrieves a content descriptor, item count and async generator for the items themselves. */\n public async getContentIterator(\n requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions,\n ): Promise<{ descriptor: Descriptor; total: number; items: AsyncIterableIterator<Item> } | undefined> {\n startIModelInitialization(requestOptions.imodel);\n const response = await this.getContentIteratorInternal(requestOptions);\n if (!response) {\n return undefined;\n }\n\n await ensureIModelInitialized(requestOptions.imodel);\n return response;\n }\n\n /**\n * Retrieves content which consists of a content descriptor and a page of records.\n * @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[getContentIterator]] instead.\n */\n public async getContent(requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions): Promise<Content | undefined> {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return (await this.getContentAndSize(requestOptions))?.content;\n }\n\n /**\n * Retrieves content set size and content which consists of a content descriptor and a page of records.\n * @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[getContentIterator]] instead.\n */\n public async getContentAndSize(\n requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions,\n ): Promise<{ content: Content; size: number } | undefined> {\n const response = await this.getContentIterator(requestOptions);\n if (!response) {\n return undefined;\n }\n\n const { descriptor, total } = response;\n const items = await collect(response.items);\n return {\n content: new Content(descriptor, items),\n size: total,\n };\n }\n\n /** Returns an iterator that asynchronously polls distinct values of specific field from the content. */\n public async getDistinctValuesIterator(\n requestOptions: GetDistinctValuesRequestOptions & MultipleValuesRequestOptions,\n ): Promise<{ total: number; items: AsyncIterableIterator<DisplayValueGroup> }> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = {\n ...this.toRpcTokenOptions(options),\n descriptor: getDescriptorOverrides(options.descriptor),\n keys: stripTransientElementKeys(options.keys).toJSON(),\n };\n\n const generator = new StreamedResponseGenerator({\n ...requestOptions,\n getBatch: async (paging) => {\n const response = await this._requestsHandler.getPagedDistinctValues({ ...rpcOptions, paging });\n return {\n total: response.total,\n items: response.items.map((x) => this._localizationHelper.getLocalizedDisplayValueGroup(x)),\n };\n },\n });\n\n return generator.createAsyncIteratorResponse();\n }\n\n /**\n * Retrieves distinct values of specific field from the content.\n * @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[getDistinctValuesIterator]] instead.\n */\n public async getPagedDistinctValues(\n requestOptions: GetDistinctValuesRequestOptions & MultipleValuesRequestOptions,\n ): Promise<PagedResponse<DisplayValueGroup>> {\n const result = await this.getDistinctValuesIterator(requestOptions);\n return {\n total: result.total,\n items: await collect(result.items),\n };\n }\n\n /**\n * Retrieves property data in a simplified format for a single element specified by ID.\n * @public\n */\n public async getElementProperties<TParsedContent = ElementProperties>(\n requestOptions: SingleElementPropertiesRequestOptions<IModelConnection, TParsedContent> & ClientDiagnosticsAttribute,\n ): Promise<TParsedContent | undefined> {\n startIModelInitialization(requestOptions.imodel);\n type TParser = Required<typeof requestOptions>[\"contentParser\"];\n const { elementId, contentParser, ...optionsNoElementId } = requestOptions;\n const parser: TParser = contentParser ?? (buildElementProperties as TParser);\n const iter = await this.getContentIterator({\n ...optionsNoElementId,\n descriptor: {\n displayType: DefaultContentDisplayTypes.PropertyPane,\n contentFlags: ContentFlags.ShowLabels,\n },\n rulesetOrId: \"ElementProperties\",\n keys: new KeySet([{ className: \"BisCore:Element\", id: elementId }]),\n });\n if (!iter || iter.total === 0) {\n return undefined;\n }\n return parser(iter.descriptor, (await iter.items.next()).value);\n }\n\n /**\n * Retrieves content item instance keys.\n * @public\n */\n public async getContentInstanceKeys(\n requestOptions: ContentInstanceKeysRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute & MultipleValuesRequestOptions,\n ): Promise<{ total: number; items: () => AsyncGenerator<InstanceKey> }> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = {\n ...this.toRpcTokenOptions(options),\n keys: stripTransientElementKeys(options.keys).toJSON(),\n };\n\n const generator = new StreamedResponseGenerator({\n ...requestOptions,\n getBatch: async (page) => {\n const keys = await this._requestsHandler.getContentInstanceKeys({ ...rpcOptions, paging: page });\n return {\n total: keys.total,\n items: keys.items.instanceKeys.reduce((instanceKeys, entry) => {\n for (const id of CompressedId64Set.iterable(entry[1])) {\n instanceKeys.push({ className: entry[0], id });\n }\n return instanceKeys;\n }, new Array<InstanceKey>()),\n };\n },\n });\n\n const { total, items } = await generator.createAsyncIteratorResponse();\n return {\n total,\n async *items() {\n yield* items;\n },\n };\n }\n\n /** Retrieves display label definition of specific item. */\n public async getDisplayLabelDefinition(\n requestOptions: DisplayLabelRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute,\n ): Promise<LabelDefinition> {\n startIModelInitialization(requestOptions.imodel);\n const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });\n const result = await this._requestsHandler.getDisplayLabelDefinition(rpcOptions);\n return this._localizationHelper.getLocalizedLabelDefinition(result);\n }\n\n /** Retrieves display label definition of specific items. */\n public async getDisplayLabelDefinitionsIterator(\n requestOptions: DisplayLabelsRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute & MultipleValuesRequestOptions,\n ): Promise<{ total: number; items: AsyncIterableIterator<LabelDefinition> }> {\n startIModelInitialization(requestOptions.imodel);\n const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });\n const generator = new StreamedResponseGenerator({\n ...requestOptions,\n getBatch: async (page) => {\n const partialKeys = !page.start ? rpcOptions.keys : rpcOptions.keys.slice(page.start);\n const result = await this._requestsHandler.getPagedDisplayLabelDefinitions({ ...rpcOptions, keys: partialKeys });\n result.items = this._localizationHelper.getLocalizedLabelDefinitions(result.items);\n return result;\n },\n });\n\n return generator.createAsyncIteratorResponse();\n }\n\n /**\n * Retrieves display label definition of specific items.\n * @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[getDisplayLabelDefinitionsIterator]] instead.\n */\n public async getDisplayLabelDefinitions(\n requestOptions: DisplayLabelsRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute & MultipleValuesRequestOptions,\n ): Promise<LabelDefinition[]> {\n const { items } = await this.getDisplayLabelDefinitionsIterator(requestOptions);\n return collect(items);\n }\n}\n\nconst getDescriptorOverrides = (descriptorOrOverrides: Descriptor | DescriptorOverrides): DescriptorOverrides => {\n if (descriptorOrOverrides instanceof Descriptor) {\n return descriptorOrOverrides.createDescriptorOverrides();\n }\n return descriptorOrOverrides;\n};\n\nconst stripTransientElementKeys = (keys: KeySet) => {\n if (!keys.some((key) => Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME)) {\n return keys;\n }\n\n const copy = new KeySet();\n copy.add(keys, (key) => {\n // the callback is not going to be called with EntityProps as KeySet converts them\n // to InstanceKeys, but we want to keep the EntityProps case for correctness\n /* c8 ignore next 3 */\n const isTransient =\n (Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME) ||\n (Key.isEntityProps(key) && key.classFullName === TRANSIENT_ELEMENT_CLASSNAME);\n return !isTransient;\n });\n return copy;\n};\n\nasync function collect<T>(iter: AsyncIterable<T>): Promise<T[]> {\n const result = new Array<T>();\n for await (const value of iter) {\n result.push(value);\n }\n return result;\n}\n"]}
|
|
@@ -63,11 +63,11 @@ export declare class FavoritePropertiesManager implements Disposable {
|
|
|
63
63
|
private _propertiesOrder;
|
|
64
64
|
constructor(props: FavoritePropertiesManagerProps);
|
|
65
65
|
[Symbol.dispose](): void;
|
|
66
|
-
/** @deprecated in 5.0 Use [Symbol.dispose] instead. */
|
|
66
|
+
/** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */
|
|
67
67
|
dispose(): void;
|
|
68
68
|
/**
|
|
69
69
|
* Initialize favorite properties for the provided IModelConnection.
|
|
70
|
-
* @deprecated in 4.5. Initialization is performed automatically by all async methods and only needed for deprecated [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]].
|
|
70
|
+
* @deprecated in 4.5 - will not be removed until after 2026-06-13. Initialization is performed automatically by all async methods and only needed for deprecated [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]].
|
|
71
71
|
*/
|
|
72
72
|
initializeConnection: (imodel: IModelConnection) => Promise<void>;
|
|
73
73
|
/**
|
|
@@ -109,7 +109,7 @@ export declare class FavoritePropertiesManager implements Disposable {
|
|
|
109
109
|
* @param imodel IModelConnection.
|
|
110
110
|
* @param scope FavoritePropertiesScope to check for favorite properties. It also checks the more general scopes.
|
|
111
111
|
* @note `initializeConnection` must be called with the `imodel` before calling this function.
|
|
112
|
-
* @deprecated in 4.5. Use [[FavoritePropertiesManager.hasAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].
|
|
112
|
+
* @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[FavoritePropertiesManager.hasAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].
|
|
113
113
|
*/
|
|
114
114
|
has(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): boolean;
|
|
115
115
|
/**
|
|
@@ -125,7 +125,7 @@ export declare class FavoritePropertiesManager implements Disposable {
|
|
|
125
125
|
* @param imodel IModelConnection.
|
|
126
126
|
* @param fields Array of Field's that needs to be sorted.
|
|
127
127
|
* @note `initializeConnection` must be called with the `imodel` before calling this function.
|
|
128
|
-
* @deprecated in 4.5. Use [[FavoritePropertiesManager.sortFieldsAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].
|
|
128
|
+
* @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[FavoritePropertiesManager.sortFieldsAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].
|
|
129
129
|
*/
|
|
130
130
|
sortFields: (imodel: IModelConnection, fields: Field[]) => Field[];
|
|
131
131
|
/**
|
package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoritePropertiesManager.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/favorite-properties/FavoritePropertiesManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAA+B,MAAM,qBAAqB,CAAC;AAE3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAW,KAAK,EAAuC,MAAM,4BAA4B,CAAC;AACjG,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAG5E;;;GAGG;AACH,oBAAY,uBAAuB;IACjC,MAAM,IAAA;IACN,KAAK,IAAA;IACL,MAAM,IAAA;CACP;AAED;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEtC;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,IAAI,EAAE,gBAAgB,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,IAAI,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;;OAGG;IACH,OAAO,EAAE,0BAA0B,CAAC;CACrC;AAED;;;;;GAKG;AACH,qBAAa,yBAA0B,YAAW,UAAU;IAC1D,2DAA2D;IACpD,kBAAkB,gBAAqB,IAAI,EAAI;IAEtD,SAAgB,OAAO,EAAE,0BAA0B,CAAC;IAEpD,OAAO,CAAC,iBAAiB,CAAoC;IAC7D,OAAO,CAAC,gBAAgB,CAAqC;IAC7D,OAAO,CAAC,iBAAiB,CAAqC;IAC9D,OAAO,CAAC,yBAAyB,CAAiD;IAClF,OAAO,CAAC,6BAA6B,CAAuC;IAC5E,OAAO,CAAC,4BAA4B,CAAwC;IAE5E,mDAAmD;IACnD,OAAO,CAAC,gBAAgB,CAA6C;gBAElD,KAAK,EAAE,8BAA8B;IAejD,CAAC,MAAM,CAAC,OAAO,CAAC;IAWvB,
|
|
1
|
+
{"version":3,"file":"FavoritePropertiesManager.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/favorite-properties/FavoritePropertiesManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAA+B,MAAM,qBAAqB,CAAC;AAE3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAW,KAAK,EAAuC,MAAM,4BAA4B,CAAC;AACjG,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAG5E;;;GAGG;AACH,oBAAY,uBAAuB;IACjC,MAAM,IAAA;IACN,KAAK,IAAA;IACL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@deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */
|
|
66
66
|
/* c8 ignore next 3 */
|
|
67
67
|
dispose() {
|
|
68
68
|
this[Symbol.dispose]();
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* Initialize favorite properties for the provided IModelConnection.
|
|
72
|
-
* @deprecated in 4.5. Initialization is performed automatically by all async methods and only needed for deprecated [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]].
|
|
72
|
+
* @deprecated in 4.5 - will not be removed until after 2026-06-13. Initialization is performed automatically by all async methods and only needed for deprecated [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]].
|
|
73
73
|
*/
|
|
74
74
|
initializeConnection = async (imodel) => {
|
|
75
75
|
const imodelId = imodel.iModelId;
|
|
@@ -279,7 +279,7 @@ class FavoritePropertiesManager {
|
|
|
279
279
|
* @param imodel IModelConnection.
|
|
280
280
|
* @param scope FavoritePropertiesScope to check for favorite properties. It also checks the more general scopes.
|
|
281
281
|
* @note `initializeConnection` must be called with the `imodel` before calling this function.
|
|
282
|
-
* @deprecated in 4.5. Use [[FavoritePropertiesManager.hasAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].
|
|
282
|
+
* @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[FavoritePropertiesManager.hasAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].
|
|
283
283
|
*/
|
|
284
284
|
has(field, imodel, scope) {
|
|
285
285
|
this.validateInitialization(imodel);
|
|
@@ -307,7 +307,7 @@ class FavoritePropertiesManager {
|
|
|
307
307
|
* @param imodel IModelConnection.
|
|
308
308
|
* @param fields Array of Field's that needs to be sorted.
|
|
309
309
|
* @note `initializeConnection` must be called with the `imodel` before calling this function.
|
|
310
|
-
* @deprecated in 4.5. Use [[FavoritePropertiesManager.sortFieldsAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].
|
|
310
|
+
* @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[FavoritePropertiesManager.sortFieldsAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].
|
|
311
311
|
*/
|
|
312
312
|
sortFields = (imodel, fields) => {
|
|
313
313
|
this.validateInitialization(imodel);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoritePropertiesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/favorite-properties/FavoritePropertiesManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA2E;AAC3E,oDAAoD;AAIpD,4FAA2H;AAE3H;;;GAGG;AACH,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,yEAAM,CAAA;IACN,uEAAK,CAAA;IACL,yEAAM,CAAA;AACR,CAAC,EAJW,uBAAuB,uCAAvB,uBAAuB,QAIlC;AAkCD;;;;;GAKG;AACH,MAAa,yBAAyB;IACpC,2DAA2D;IACpD,kBAAkB,GAAG,IAAI,sBAAO,EAAc,CAAC;IAEtC,OAAO,CAA6B;IAE5C,iBAAiB,CAAoC;IACrD,gBAAgB,CAAqC;IACrD,iBAAiB,CAAqC;IACtD,yBAAyB,CAAiD;IAC1E,6BAA6B,CAAuC;IACpE,4BAA4B,CAAwC;IAE5E,mDAAmD;IAC3C,gBAAgB,CAA6C;IAErE,YAAmB,KAAqC;QACtD,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAiC,CAAC;QACjE,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAiC,CAAC;QAClE,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAyC,CAAC;QACzE,IAAI,CAAC,yBAAyB,GAAG,IAAI,GAAG,EAA6C,CAAC;QACtF,IAAI,CAAC,6BAA6B,GAAG,IAAI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,IAAY,EAAE,EAAE;QACvC,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QACjE,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;YACjC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACvC,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,KAAK,CAAC,iBAAiB,EAAE,EAAE,CAAC;QAC9B,+BAA+B,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAClE,CAAC;SAAM,IAAI,KAAK,CAAC,oBAAoB,EAAE,EAAE,CAAC;QACxC,eAAe,CAAC,iCAAiC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5D,CAAC;SAAM,CAAC;QACN,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAC,UAAyC,EAAE,EAAE,CAC3E,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,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/** @packageDocumentation\n * @module Core\n */\n\nimport { BeEvent, isDisposable, isIDisposable } from \"@itwin/core-bentley\";\nimport { QueryRowFormat } from \"@itwin/core-common\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { ClassId, Field, NestedContentField, PropertiesField } from \"@itwin/presentation-common\";\nimport { IFavoritePropertiesStorage } from \"./FavoritePropertiesStorage.js\";\nimport { IModelConnectionInitializationHandler, imodelInitializationHandlers } from \"../IModelConnectionInitialization.js\";\n\n/**\n * Scopes that favorite properties can be stored in.\n * @public\n */\nexport enum FavoritePropertiesScope {\n Global,\n ITwin,\n IModel,\n}\n\n/**\n * Format:\n * Regular property - [{path from parent class}-]{schema name}:{class name}:{property name}.\n * Nested property - [{path from parent class}-]{content class schema name}:{content class name}.\n * Primitive property - {field name}.\n * @public\n */\nexport type PropertyFullName = string;\n\n/**\n * Holds the information of favorite properties ordering.\n * @public\n */\nexport interface FavoritePropertiesOrderInfo {\n parentClassName: string | undefined;\n name: PropertyFullName;\n priority: number;\n orderedTimestamp: Date;\n}\n\n/**\n * Properties for initializing [[FavoritePropertiesManager]]\n * @public\n */\nexport interface FavoritePropertiesManagerProps {\n /**\n * Implementation of a persistence layer for storing favorite properties and their order.\n * @public\n */\n storage: IFavoritePropertiesStorage;\n}\n\n/**\n * The favorite property manager which lets to store favorite properties\n * and check if field contains favorite properties.\n *\n * @public\n */\nexport class FavoritePropertiesManager implements Disposable {\n /** Event raised after favorite properties have changed. */\n public onFavoritesChanged = new BeEvent<() => void>();\n\n public readonly storage: IFavoritePropertiesStorage;\n\n private _globalProperties: Set<PropertyFullName> | undefined;\n private _iTwinProperties: Map<string, Set<PropertyFullName>>;\n private _imodelProperties: Map<string, Set<PropertyFullName>>;\n private _imodelBaseClassesByClass: Map<string, { [className: string]: string[] }>;\n private _imodelInitializationPromises: Map<IModelConnection, Promise<void>>;\n private _imodelInitializationHandler: IModelConnectionInitializationHandler;\n\n /** Property order is saved only in iModel scope */\n private _propertiesOrder: Map<string, FavoritePropertiesOrderInfo[]>;\n\n public constructor(props: FavoritePropertiesManagerProps) {\n this.storage = props.storage;\n this._iTwinProperties = new Map<string, Set<PropertyFullName>>();\n this._imodelProperties = new Map<string, Set<PropertyFullName>>();\n this._propertiesOrder = new Map<string, FavoritePropertiesOrderInfo[]>();\n this._imodelBaseClassesByClass = new Map<string, { [className: string]: string[] }>();\n this._imodelInitializationPromises = new Map<IModelConnection, Promise<void>>();\n imodelInitializationHandlers.add(\n (this._imodelInitializationHandler = {\n startInitialization: (imodel) => this.startConnectionInitialization(imodel),\n ensureInitialized: async (imodel) => this.ensureInitialized(imodel),\n }),\n );\n }\n\n public [Symbol.dispose]() {\n imodelInitializationHandlers.delete(this._imodelInitializationHandler);\n if (isDisposable(this.storage)) {\n this.storage[Symbol.dispose]();\n /* c8 ignore next 4 */\n /* eslint-disable-next-line @typescript-eslint/no-deprecated */\n } else if (isIDisposable(this.storage)) {\n this.storage.dispose();\n }\n }\n\n /** @deprecated in 5.0 Use [Symbol.dispose] instead. */\n /* c8 ignore next 3 */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n /**\n * Initialize favorite properties for the provided IModelConnection.\n * @deprecated in 4.5. Initialization is performed automatically by all async methods and only needed for deprecated [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]].\n */\n public initializeConnection = async (imodel: IModelConnection) => {\n const imodelId = imodel.iModelId!;\n const iTwinId = imodel.iTwinId!;\n\n if (this._globalProperties === undefined) {\n this._globalProperties = (await this.storage.loadProperties()) || new Set<PropertyFullName>();\n }\n\n if (!this._iTwinProperties.has(iTwinId)) {\n const iTwinProperties = (await this.storage.loadProperties(iTwinId)) || new Set<PropertyFullName>();\n this._iTwinProperties.set(iTwinId, iTwinProperties);\n }\n\n if (!this._imodelProperties.has(getiModelInfo(iTwinId, imodelId))) {\n const imodelProperties = (await this.storage.loadProperties(iTwinId, imodelId)) || new Set<PropertyFullName>();\n this._imodelProperties.set(getiModelInfo(iTwinId, imodelId), imodelProperties);\n }\n const propertiesOrder = (await this.storage.loadPropertiesOrder(iTwinId, imodelId)) || [];\n this._propertiesOrder.set(getiModelInfo(iTwinId, imodelId), propertiesOrder);\n await this._adjustPropertyOrderInfos(iTwinId, imodelId);\n };\n\n /**\n * Function that removes order information of properties that are no longer\n * favorited and adds missing order information for favorited properties.\n */\n private _adjustPropertyOrderInfos = async (iTwinId: string, imodelId: string) => {\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n\n const globalProperties = this._globalProperties!;\n const iTwinProperties = this._iTwinProperties.get(iTwinId)!;\n const imodelProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\n // favorite property infos that need to be added to the propertiesOrder array\n const infosToAdd = new Set<string>([...globalProperties, ...iTwinProperties, ...imodelProperties]);\n\n for (let i = propertiesOrder.length - 1; i >= 0; i--) {\n if (infosToAdd.has(propertiesOrder[i].name)) {\n infosToAdd.delete(propertiesOrder[i].name);\n } else {\n propertiesOrder.splice(i, 1);\n }\n }\n\n infosToAdd.forEach((info) =>\n propertiesOrder.push({\n name: info,\n parentClassName: getPropertyClassName(info),\n orderedTimestamp: new Date(),\n priority: 0,\n }),\n );\n\n let priority = propertiesOrder.length;\n propertiesOrder.forEach((oi) => (oi.priority = priority--));\n };\n\n private isInitialized(imodel: IModelConnection): boolean {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n return this._imodelProperties.has(getiModelInfo(iTwinId, imodelId));\n }\n\n /**\n * Checks if [[FavoritePropertiesManager.initializeConnection]] has been called for a given imodel.\n * Can be removed when [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]] are removed.\n */\n private validateInitialization(imodel: IModelConnection) {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n if (!this.isInitialized(imodel)) {\n throw Error(\n `Favorite properties are not initialized for iModel: '${imodelId}', in iTwin: '${iTwinId}'. Call initializeConnection() with an IModelConnection to initialize.`,\n );\n }\n }\n\n private startConnectionInitialization(imodel: IModelConnection) {\n if (!this.isInitialized(imodel) && !this._imodelInitializationPromises.has(imodel)) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n this._imodelInitializationPromises.set(imodel, this.initializeConnection(imodel));\n }\n }\n\n private async ensureInitialized(imodel: IModelConnection) {\n if (this.isInitialized(imodel)) {\n return;\n }\n\n let promise = this._imodelInitializationPromises.get(imodel);\n if (!promise) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n promise = this.initializeConnection(imodel);\n\n // Put the promise in the map to avoid possible multiple initializations from different promises.\n this._imodelInitializationPromises.set(imodel, promise);\n }\n\n await promise;\n\n // Remove this promise from the map, because the next time this method is called, `this.isInitialized` should return true.\n this._imodelInitializationPromises.delete(imodel);\n }\n\n /**\n * Adds favorite properties into a certain scope.\n * @param field Field that contains properties. If field contains multiple properties, all of them will be favorited.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to put the favorite properties into.\n */\n public async add(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n let favoriteProperties: Set<PropertyFullName>;\n let saveProperties: (properties: Set<PropertyFullName>) => Promise<void>;\n switch (scope) {\n case FavoritePropertiesScope.Global:\n favoriteProperties = this._globalProperties!;\n saveProperties = async (properties) => this.storage.saveProperties(properties);\n break;\n case FavoritePropertiesScope.ITwin:\n favoriteProperties = this._iTwinProperties.get(iTwinId)!;\n saveProperties = async (properties) => this.storage.saveProperties(properties, iTwinId);\n break;\n default:\n favoriteProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\n saveProperties = async (properties) => this.storage.saveProperties(properties, iTwinId, imodelId);\n }\n\n const countBefore = favoriteProperties.size;\n const fieldInfos = getFieldInfos(field);\n fieldInfos.forEach((info) => favoriteProperties.add(info));\n if (favoriteProperties.size !== countBefore) {\n const saves: Array<Promise<void>> = [];\n saves.push(saveProperties(favoriteProperties));\n\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n addOrderInfos(propertiesOrder, createFieldOrderInfos(field));\n saves.push(this.storage.savePropertiesOrder(propertiesOrder, iTwinId, imodelId));\n\n await Promise.all(saves);\n this.onFavoritesChanged.raiseEvent();\n }\n }\n\n /**\n * Removes favorite properties from a scope specified and all the more general scopes.\n * @param field Field that contains properties. If field contains multiple properties, all of them will be un-favorited.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to remove the favorite properties from. It also removes from more general scopes.\n */\n public async remove(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const fieldInfos = getFieldInfos(field);\n const workingScopes: Array<{ properties: Set<PropertyFullName>; save: (properties: Set<PropertyFullName>) => Promise<void> }> = [];\n workingScopes.push({\n properties: this._globalProperties!,\n save: async (properties) => this.storage.saveProperties(properties),\n });\n if (scope === FavoritePropertiesScope.ITwin || scope === FavoritePropertiesScope.IModel) {\n workingScopes.push({\n properties: this._iTwinProperties.get(iTwinId)!,\n save: async (properties) => this.storage.saveProperties(properties, iTwinId),\n });\n }\n if (scope === FavoritePropertiesScope.IModel) {\n workingScopes.push({\n properties: this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!,\n save: async (properties) => this.storage.saveProperties(properties, iTwinId, imodelId),\n });\n }\n\n const saves: Array<Promise<void>> = [];\n let favoritesChanged = false;\n for (const { properties, save } of workingScopes) {\n const countBefore = properties.size;\n fieldInfos.forEach((info) => properties.delete(info));\n if (properties.size !== countBefore) {\n saves.push(save(properties));\n favoritesChanged = true;\n }\n }\n if (!favoritesChanged) {\n return;\n }\n\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n removeOrderInfos(propertiesOrder, createFieldOrderInfos(field));\n saves.push(this.storage.savePropertiesOrder(propertiesOrder, iTwinId, imodelId));\n\n await Promise.all(saves);\n this.onFavoritesChanged.raiseEvent();\n }\n\n /**\n * Removes all favorite properties from a certain scope.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to remove the favorite properties from.\n */\n public async clear(imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n let favoriteProperties: Set<PropertyFullName>;\n let saveProperties: () => Promise<void>;\n switch (scope) {\n case FavoritePropertiesScope.Global:\n favoriteProperties = this._globalProperties!;\n saveProperties = async () => this.storage.saveProperties(new Set<PropertyFullName>());\n break;\n case FavoritePropertiesScope.ITwin:\n favoriteProperties = this._iTwinProperties.get(iTwinId)!;\n saveProperties = async () => this.storage.saveProperties(new Set<PropertyFullName>(), iTwinId);\n break;\n default:\n favoriteProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\n saveProperties = async () => this.storage.saveProperties(new Set<PropertyFullName>(), iTwinId, imodelId);\n }\n\n if (favoriteProperties.size === 0) {\n return;\n }\n\n favoriteProperties.clear();\n const saves: Array<Promise<void>> = [];\n saves.push(saveProperties());\n saves.push(this._adjustPropertyOrderInfos(iTwinId, imodelId));\n await Promise.all(saves);\n this.onFavoritesChanged.raiseEvent();\n }\n\n /**\n * Check if field contains at least one favorite property.\n * @param field Field that contains properties.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to check for favorite properties. It also checks the more general scopes.\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\n * @deprecated in 4.5. Use [[FavoritePropertiesManager.hasAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].\n */\n public has(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): boolean {\n this.validateInitialization(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const fieldInfos = getFieldInfos(field);\n return (\n setHasAny(this._globalProperties!, fieldInfos) ||\n (scope !== FavoritePropertiesScope.Global && setHasAny(this._iTwinProperties.get(iTwinId)!, fieldInfos)) ||\n (scope === FavoritePropertiesScope.IModel && setHasAny(this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!, fieldInfos))\n );\n }\n\n /**\n * Check if field contains at least one favorite property.\n * @param field Field that contains properties.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to check for favorite properties. It also checks the more general scopes.\n */\n public async hasAsync(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<boolean> {\n await this.ensureInitialized(imodel);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return this.has(field, imodel, scope);\n }\n\n /**\n * Sorts an array of fields with respect to favorite property order.\n * Non-favorited fields get sorted by their default priority and always have lower priority than favorited fields.\n * @param imodel IModelConnection.\n * @param fields Array of Field's that needs to be sorted.\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\n * @deprecated in 4.5. Use [[FavoritePropertiesManager.sortFieldsAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].\n */\n public sortFields = (imodel: IModelConnection, fields: Field[]): Field[] => {\n this.validateInitialization(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const fieldPriority = new Map<Field, number>();\n fields.forEach((field) => fieldPriority.set(field, this.getFieldPriority(field, iTwinId, imodelId)));\n\n const sortFunction = (left: Field, right: Field): number => {\n const lp = fieldPriority.get(left)!;\n const rp = fieldPriority.get(right)!;\n return lp < rp\n ? 1\n : lp > rp\n ? -1\n : left.priority < right.priority\n ? 1 // if favorite fields have equal priorities, sort by field priority\n : left.priority > right.priority\n ? -1\n : left.name.localeCompare(right.name);\n };\n\n return fields.sort(sortFunction);\n };\n\n /**\n * Sorts an array of fields with respect to favorite property order.\n * Non-favorited fields get sorted by their default priority and always have lower priority than favorited fields.\n * @param imodel IModelConnection.\n * @param fields Array of Field's that needs to be sorted.\n */\n public async sortFieldsAsync(imodel: IModelConnection, fields: Field[]): Promise<Field[]> {\n await this.ensureInitialized(imodel);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return this.sortFields(imodel, fields);\n }\n\n private getFieldPriority(field: Field, iTwinId: string, imodelId: string): number {\n const orderInfos = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n const fieldOrderInfos = getFieldOrderInfos(field, orderInfos);\n if (fieldOrderInfos.length === 0) {\n return -1;\n }\n const mostRecent = getMostRecentOrderInfo(fieldOrderInfos);\n return mostRecent.priority;\n }\n\n private _getBaseClassesByClass = async (imodel: IModelConnection, neededClasses: Set<string>): Promise<{ [className: string]: string[] }> => {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const imodelInfo = getiModelInfo(iTwinId, imodelId);\n let baseClasses: { [className: string]: string[] };\n if (this._imodelBaseClassesByClass.has(imodelInfo)) {\n baseClasses = this._imodelBaseClassesByClass.get(imodelInfo)!;\n } else {\n this._imodelBaseClassesByClass.set(imodelInfo, (baseClasses = {}));\n }\n\n const missingClasses = new Set<string>();\n neededClasses.forEach((className) => {\n if (!baseClasses.hasOwnProperty(className)) {\n missingClasses.add(className);\n }\n });\n if (missingClasses.size === 0) {\n return baseClasses;\n }\n\n const query = `\n SELECT (derivedSchema.Name || ':' || derivedClass.Name) AS \"ClassFullName\", (baseSchema.Name || ':' || baseClass.Name) AS \"BaseClassFullName\"\n FROM ECDbMeta.ClassHasAllBaseClasses baseClassRels\n INNER JOIN ECDbMeta.ECClassDef derivedClass ON derivedClass.ECInstanceId = baseClassRels.SourceECInstanceId\n INNER JOIN ECDbMeta.ECSchemaDef derivedSchema ON derivedSchema.ECInstanceId = derivedClass.Schema.Id\n INNER JOIN ECDbMeta.ECClassDef baseClass ON baseClass.ECInstanceId = baseClassRels.TargetECInstanceId\n INNER JOIN ECDbMeta.ECSchemaDef baseSchema ON baseSchema.ECInstanceId = baseClass.Schema.Id\n WHERE (derivedSchema.Name || ':' || derivedClass.Name) IN (${[...missingClasses].map((className) => `'${className}'`).join(\",\")})`;\n const reader = imodel.createQueryReader(query, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames });\n while (await reader.step()) {\n const row = reader.current.toRow();\n if (!(row.classFullName in baseClasses)) {\n baseClasses[row.classFullName] = [];\n }\n baseClasses[row.classFullName].push(row.baseClassFullName);\n }\n return baseClasses;\n };\n\n /** Changes field properties priorities to lower than another fields priority\n * @param imodel IModelConnection.\n * @param field Field that priority is being changed.\n * @param afterField Field that goes before the moved field. If undefined the moving field is changed to the highest priority (to the top).\n * @param visibleFields Array of fields to move the field in.\n */\n public async changeFieldPriority(imodel: IModelConnection, field: Field, afterField: Field | undefined, visibleFields: Field[]) {\n /**\n * How it works:\n * 1. Gets the orderInfo's for `field` (`orderInfo`) and `afterField` (`afterOrderInfo`) by selecting the most recent order informations for each field\n * 2. Iterates all orderInfo's that are in between `afterOrderInfo` and `orderInfo` when sorted by priority\n * 3. For each iterated orderInfo it checks if it is relevant:\n * 3.1. If orderInfo belongs to a primitive property, orderInfo is relevant\n * 3.2. If orderInfo's field is visible, orderInfo is relevant\n * 3.3. If orderInfo's class has a base class or itself in previously labeled relevant orderInfo's, orderInfo is relevant\n * 3.4. If 3.1 - 3.3 don't pass, orderInfo is irrelevant\n * 4. Irrelevant orderInfos's get moved after `orderInfo` (depends on the direction)\n * 5. All `field` orderInfo's get moved after `afterOrderInfo`\n */\n await this.ensureInitialized(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n if (field === afterField) {\n throw Error(\"`field` can not be the same as `afterField`.\");\n }\n\n const allOrderInfos = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n\n const findFieldOrderInfoData = (f: Field) => {\n if (!visibleFields.includes(f)) {\n throw Error(\"Field is not contained in visible fields.\");\n }\n const infos = getFieldOrderInfos(f, allOrderInfos);\n\n if (infos.length === 0) {\n throw Error(\"Field has no property order information.\");\n }\n const info = getMostRecentOrderInfo(infos);\n const index = allOrderInfos.indexOf(info);\n return { infos, mostRecent: { info, index } };\n };\n\n const {\n infos: movingOrderInfos,\n mostRecent: { index: orderInfoIndex },\n } = findFieldOrderInfoData(field);\n\n let afterOrderInfo: FavoritePropertiesOrderInfo | undefined;\n let afterOrderInfoIndex;\n if (afterField === undefined) {\n afterOrderInfo = undefined;\n afterOrderInfoIndex = -1;\n } else {\n ({\n mostRecent: { info: afterOrderInfo, index: afterOrderInfoIndex },\n } = findFieldOrderInfoData(afterField));\n }\n\n let direction: Direction; // where to go from `afterOrderInfo` to `orderInfo`\n let startIndex: number;\n if (orderInfoIndex < afterOrderInfoIndex) {\n direction = Direction.Up;\n startIndex = afterOrderInfoIndex;\n } else {\n direction = Direction.Down;\n startIndex = afterOrderInfoIndex + 1;\n }\n\n const neededClassNames: Set<string> = allOrderInfos.reduce((classNames: Set<string>, oi) => {\n if (oi.parentClassName) {\n classNames.add(oi.parentClassName);\n }\n return classNames;\n }, new Set<string>());\n const baseClassesByClass = await this._getBaseClassesByClass(imodel, neededClassNames);\n\n const visibleOrderInfos = visibleFields.reduce(\n (union: FavoritePropertiesOrderInfo[], currField) => union.concat(getFieldOrderInfos(currField, allOrderInfos)),\n [],\n );\n const irrelevantOrderInfos: FavoritePropertiesOrderInfo[] = []; // orderInfos's that won't change their logical order in respect to other properties\n const relevantClasses: Set<ClassId> = new Set<ClassId>(); // currently relevant classes\n\n for (let i = startIndex; i !== orderInfoIndex; i += direction) {\n const currOrderInfo = allOrderInfos[i];\n\n // primitive properties are always relevant, because we can't determine their relevance based on the class hierarchy\n if (currOrderInfo.parentClassName === undefined) {\n continue;\n }\n\n const visible = visibleOrderInfos.includes(currOrderInfo);\n if (visible) {\n relevantClasses.add(currOrderInfo.parentClassName);\n continue;\n }\n\n const hasBaseClasses = baseClassesByClass[currOrderInfo.parentClassName].some((classId) => relevantClasses.has(classId));\n if (hasBaseClasses) {\n continue;\n }\n\n if (direction === Direction.Down) {\n irrelevantOrderInfos.push(currOrderInfo);\n } else {\n irrelevantOrderInfos.unshift(currOrderInfo);\n }\n }\n\n // remove irrelevantOrderInfo's to add them after the `orderInfo`\n irrelevantOrderInfos.forEach((foi) => {\n const index = allOrderInfos.findIndex((oi) => oi.parentClassName === foi.parentClassName && oi.name === foi.name);\n allOrderInfos.splice(index, 1);\n });\n\n // remove movingOrderInfos's to add them after the `afterOrderInfo`\n movingOrderInfos.forEach((foi) => {\n const index = allOrderInfos.findIndex((oi) => oi.parentClassName === foi.parentClassName && oi.name === foi.name);\n allOrderInfos.splice(index, 1);\n });\n movingOrderInfos.forEach((oi) => (oi.orderedTimestamp = new Date()));\n\n afterOrderInfoIndex = afterOrderInfo === undefined ? -1 : allOrderInfos.indexOf(afterOrderInfo);\n allOrderInfos.splice(afterOrderInfoIndex + 1, 0, ...movingOrderInfos);\n allOrderInfos.splice(afterOrderInfoIndex + 1 + (direction === Direction.Up ? movingOrderInfos.length : 0), 0, ...irrelevantOrderInfos);\n\n // reassign priority numbers\n let priority = allOrderInfos.length;\n allOrderInfos.forEach((oi) => (oi.priority = priority--));\n\n await this.storage.savePropertiesOrder(allOrderInfos, iTwinId, imodelId);\n this.onFavoritesChanged.raiseEvent();\n }\n}\n\nenum Direction {\n Up = -1,\n Down = 1,\n}\n\nconst getiModelInfo = (iTwinId: string, imodelId: string) => `${iTwinId}/${imodelId}`;\n\nconst getPropertiesFieldPropertyNames = (field: PropertiesField) => {\n const nestingPrefix = getNestingPrefix(field.parent);\n return field.properties.map((property) => `${nestingPrefix}${property.property.classInfo.name}:${property.property.name}`);\n};\n\nconst getNestedContentFieldPropertyName = (field: NestedContentField) => {\n const nestingPrefix = getNestingPrefix(field);\n return `${nestingPrefix}${field.contentClassInfo.name}`;\n};\n\nconst getNestingPrefix = (field: NestedContentField | undefined) => {\n const path: string[] = [];\n let curr = field;\n while (curr !== undefined) {\n curr.pathToPrimaryClass.forEach((rel) => {\n // Relationship directions are reversed, because we are generating a relationship list starting from the parent\n path.push(`${rel.isForwardRelationship ? \"B\" : \"F\"}:${rel.relationshipInfo.name}`);\n path.push(rel.targetClassInfo.name);\n });\n curr = curr.parent;\n }\n if (path.length === 0) {\n return \"\";\n }\n\n path.reverse();\n return `${path.join(\"-\")}-`;\n};\n\nconst getPropertyClassName = (propertyName: PropertyFullName): string | undefined => {\n const propertyNameStart = propertyName.split(\"-\")[0];\n const parts = propertyNameStart.split(\":\").length;\n if (parts === 1) {\n // primitive\n return undefined;\n }\n if (parts === 2) {\n // nested property OR nested property parent class OR regular property parent class\n return propertyNameStart;\n }\n // regular property without parent class\n return propertyNameStart.substring(0, propertyName.lastIndexOf(\":\"));\n};\n\n/** @internal */\nexport const getFieldInfos = (field: Field): Set<PropertyFullName> => {\n const fieldInfos: Set<PropertyFullName> = new Set<PropertyFullName>();\n if (field.isPropertiesField()) {\n getPropertiesFieldPropertyNames(field).forEach((info) => fieldInfos.add(info));\n } else if (field.isNestedContentField()) {\n fieldInfos.add(getNestedContentFieldPropertyName(field));\n } else {\n fieldInfos.add(field.name);\n }\n return fieldInfos;\n};\n\nconst setHasAny = (set: Set<string>, lookup: Set<string>) => {\n for (const key of lookup) {\n if (set.has(key)) {\n return true;\n }\n }\n return false;\n};\n\nconst addOrderInfos = (dest: FavoritePropertiesOrderInfo[], source: FavoritePropertiesOrderInfo[]) => {\n source.forEach((si) => {\n const index = dest.findIndex((di) => di.name === si.name);\n if (index === -1) {\n si.orderedTimestamp = new Date();\n dest.push(si);\n }\n });\n let priority = dest.length;\n dest.forEach((info) => (info.priority = priority--));\n};\n\nconst removeOrderInfos = (container: FavoritePropertiesOrderInfo[], toRemove: FavoritePropertiesOrderInfo[]) => {\n toRemove.forEach((roi) => {\n const index = container.findIndex((oi) => oi.name === roi.name);\n if (index >= 0) {\n container.splice(index, 1);\n }\n });\n};\n\n/** @internal */\nexport const createFieldOrderInfos = (field: Field): FavoritePropertiesOrderInfo[] => {\n if (field.isNestedContentField()) {\n const propertyName = getNestedContentFieldPropertyName(field);\n return [\n {\n parentClassName: getPropertyClassName(propertyName),\n name: propertyName,\n priority: 0,\n orderedTimestamp: new Date(),\n },\n ];\n }\n if (field.isPropertiesField()) {\n return getPropertiesFieldPropertyNames(field).map((propertyName) => ({\n parentClassName: getPropertyClassName(propertyName),\n name: propertyName,\n priority: 0,\n orderedTimestamp: new Date(),\n }));\n }\n return [\n {\n parentClassName: undefined,\n name: field.name,\n priority: 0,\n orderedTimestamp: new Date(),\n },\n ];\n};\n\nconst getFieldOrderInfos = (field: Field, orderInfos: FavoritePropertiesOrderInfo[]): FavoritePropertiesOrderInfo[] => {\n const fieldOrderInfos: FavoritePropertiesOrderInfo[] = [];\n const tryAddOrderInfo = (name: string) => {\n const fieldOrderInfo = orderInfos.find((oi) => oi.name === name);\n if (fieldOrderInfo !== undefined) {\n fieldOrderInfos.push(fieldOrderInfo);\n }\n };\n\n if (field.isPropertiesField()) {\n getPropertiesFieldPropertyNames(field).forEach(tryAddOrderInfo);\n } else if (field.isNestedContentField()) {\n tryAddOrderInfo(getNestedContentFieldPropertyName(field));\n } else {\n tryAddOrderInfo(field.name);\n }\n\n return fieldOrderInfos;\n};\n\nconst getMostRecentOrderInfo = (orderInfos: FavoritePropertiesOrderInfo[]) =>\n orderInfos.reduce((recent, curr) => (recent && recent.orderedTimestamp >= curr.orderedTimestamp ? recent : curr));\n"]}
|
|
1
|
+
{"version":3,"file":"FavoritePropertiesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/favorite-properties/FavoritePropertiesManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA2E;AAC3E,oDAAoD;AAIpD,4FAA2H;AAE3H;;;GAGG;AACH,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,yEAAM,CAAA;IACN,uEAAK,CAAA;IACL,yEAAM,CAAA;AACR,CAAC,EAJW,uBAAuB,uCAAvB,uBAAuB,QAIlC;AAkCD;;;;;GAKG;AACH,MAAa,yBAAyB;IACpC,2DAA2D;IACpD,kBAAkB,GAAG,IAAI,sBAAO,EAAc,CAAC;IAEtC,OAAO,CAA6B;IAE5C,iBAAiB,CAAoC;IACrD,gBAAgB,CAAqC;IACrD,iBAAiB,CAAqC;IACtD,yBAAyB,CAAiD;IAC1E,6BAA6B,CAAuC;IACpE,4BAA4B,CAAwC;IAE5E,mDAAmD;IAC3C,gBAAgB,CAA6C;IAErE,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------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { BeEvent, isDisposable, isIDisposable } from \"@itwin/core-bentley\";\nimport { QueryRowFormat } from \"@itwin/core-common\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { ClassId, Field, NestedContentField, PropertiesField } from \"@itwin/presentation-common\";\nimport { IFavoritePropertiesStorage } from \"./FavoritePropertiesStorage.js\";\nimport { IModelConnectionInitializationHandler, imodelInitializationHandlers } from \"../IModelConnectionInitialization.js\";\n\n/**\n * Scopes that favorite properties can be stored in.\n * @public\n */\nexport enum FavoritePropertiesScope {\n Global,\n ITwin,\n IModel,\n}\n\n/**\n * Format:\n * Regular property - [{path from parent class}-]{schema name}:{class name}:{property name}.\n * Nested property - [{path from parent class}-]{content class schema name}:{content class name}.\n * Primitive property - {field name}.\n * @public\n */\nexport type PropertyFullName = string;\n\n/**\n * Holds the information of favorite properties ordering.\n * @public\n */\nexport interface FavoritePropertiesOrderInfo {\n parentClassName: string | undefined;\n name: PropertyFullName;\n priority: number;\n orderedTimestamp: Date;\n}\n\n/**\n * Properties for initializing [[FavoritePropertiesManager]]\n * @public\n */\nexport interface FavoritePropertiesManagerProps {\n /**\n * Implementation of a persistence layer for storing favorite properties and their order.\n * @public\n */\n storage: IFavoritePropertiesStorage;\n}\n\n/**\n * The favorite property manager which lets to store favorite properties\n * and check if field contains favorite properties.\n *\n * @public\n */\nexport class FavoritePropertiesManager implements Disposable {\n /** Event raised after favorite properties have changed. */\n public onFavoritesChanged = new BeEvent<() => void>();\n\n public readonly storage: IFavoritePropertiesStorage;\n\n private _globalProperties: Set<PropertyFullName> | undefined;\n private _iTwinProperties: Map<string, Set<PropertyFullName>>;\n private _imodelProperties: Map<string, Set<PropertyFullName>>;\n private _imodelBaseClassesByClass: Map<string, { [className: string]: string[] }>;\n private _imodelInitializationPromises: Map<IModelConnection, Promise<void>>;\n private _imodelInitializationHandler: IModelConnectionInitializationHandler;\n\n /** Property order is saved only in iModel scope */\n private _propertiesOrder: Map<string, FavoritePropertiesOrderInfo[]>;\n\n public constructor(props: FavoritePropertiesManagerProps) {\n this.storage = props.storage;\n this._iTwinProperties = new Map<string, Set<PropertyFullName>>();\n this._imodelProperties = new Map<string, Set<PropertyFullName>>();\n this._propertiesOrder = new Map<string, FavoritePropertiesOrderInfo[]>();\n this._imodelBaseClassesByClass = new Map<string, { [className: string]: string[] }>();\n this._imodelInitializationPromises = new Map<IModelConnection, Promise<void>>();\n imodelInitializationHandlers.add(\n (this._imodelInitializationHandler = {\n startInitialization: (imodel) => this.startConnectionInitialization(imodel),\n ensureInitialized: async (imodel) => this.ensureInitialized(imodel),\n }),\n );\n }\n\n public [Symbol.dispose]() {\n imodelInitializationHandlers.delete(this._imodelInitializationHandler);\n if (isDisposable(this.storage)) {\n this.storage[Symbol.dispose]();\n /* c8 ignore next 4 */\n /* eslint-disable-next-line @typescript-eslint/no-deprecated */\n } else if (isIDisposable(this.storage)) {\n this.storage.dispose();\n }\n }\n\n /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */\n /* c8 ignore next 3 */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n /**\n * Initialize favorite properties for the provided IModelConnection.\n * @deprecated in 4.5 - will not be removed until after 2026-06-13. Initialization is performed automatically by all async methods and only needed for deprecated [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]].\n */\n public initializeConnection = async (imodel: IModelConnection) => {\n const imodelId = imodel.iModelId!;\n const iTwinId = imodel.iTwinId!;\n\n if (this._globalProperties === undefined) {\n this._globalProperties = (await this.storage.loadProperties()) || new Set<PropertyFullName>();\n }\n\n if (!this._iTwinProperties.has(iTwinId)) {\n const iTwinProperties = (await this.storage.loadProperties(iTwinId)) || new Set<PropertyFullName>();\n this._iTwinProperties.set(iTwinId, iTwinProperties);\n }\n\n if (!this._imodelProperties.has(getiModelInfo(iTwinId, imodelId))) {\n const imodelProperties = (await this.storage.loadProperties(iTwinId, imodelId)) || new Set<PropertyFullName>();\n this._imodelProperties.set(getiModelInfo(iTwinId, imodelId), imodelProperties);\n }\n const propertiesOrder = (await this.storage.loadPropertiesOrder(iTwinId, imodelId)) || [];\n this._propertiesOrder.set(getiModelInfo(iTwinId, imodelId), propertiesOrder);\n await this._adjustPropertyOrderInfos(iTwinId, imodelId);\n };\n\n /**\n * Function that removes order information of properties that are no longer\n * favorited and adds missing order information for favorited properties.\n */\n private _adjustPropertyOrderInfos = async (iTwinId: string, imodelId: string) => {\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n\n const globalProperties = this._globalProperties!;\n const iTwinProperties = this._iTwinProperties.get(iTwinId)!;\n const imodelProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\n // favorite property infos that need to be added to the propertiesOrder array\n const infosToAdd = new Set<string>([...globalProperties, ...iTwinProperties, ...imodelProperties]);\n\n for (let i = propertiesOrder.length - 1; i >= 0; i--) {\n if (infosToAdd.has(propertiesOrder[i].name)) {\n infosToAdd.delete(propertiesOrder[i].name);\n } else {\n propertiesOrder.splice(i, 1);\n }\n }\n\n infosToAdd.forEach((info) =>\n propertiesOrder.push({\n name: info,\n parentClassName: getPropertyClassName(info),\n orderedTimestamp: new Date(),\n priority: 0,\n }),\n );\n\n let priority = propertiesOrder.length;\n propertiesOrder.forEach((oi) => (oi.priority = priority--));\n };\n\n private isInitialized(imodel: IModelConnection): boolean {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n return this._imodelProperties.has(getiModelInfo(iTwinId, imodelId));\n }\n\n /**\n * Checks if [[FavoritePropertiesManager.initializeConnection]] has been called for a given imodel.\n * Can be removed when [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]] are removed.\n */\n private validateInitialization(imodel: IModelConnection) {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n if (!this.isInitialized(imodel)) {\n throw Error(\n `Favorite properties are not initialized for iModel: '${imodelId}', in iTwin: '${iTwinId}'. Call initializeConnection() with an IModelConnection to initialize.`,\n );\n }\n }\n\n private startConnectionInitialization(imodel: IModelConnection) {\n if (!this.isInitialized(imodel) && !this._imodelInitializationPromises.has(imodel)) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n this._imodelInitializationPromises.set(imodel, this.initializeConnection(imodel));\n }\n }\n\n private async ensureInitialized(imodel: IModelConnection) {\n if (this.isInitialized(imodel)) {\n return;\n }\n\n let promise = this._imodelInitializationPromises.get(imodel);\n if (!promise) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n promise = this.initializeConnection(imodel);\n\n // Put the promise in the map to avoid possible multiple initializations from different promises.\n this._imodelInitializationPromises.set(imodel, promise);\n }\n\n await promise;\n\n // Remove this promise from the map, because the next time this method is called, `this.isInitialized` should return true.\n this._imodelInitializationPromises.delete(imodel);\n }\n\n /**\n * Adds favorite properties into a certain scope.\n * @param field Field that contains properties. If field contains multiple properties, all of them will be favorited.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to put the favorite properties into.\n */\n public async add(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n let favoriteProperties: Set<PropertyFullName>;\n let saveProperties: (properties: Set<PropertyFullName>) => Promise<void>;\n switch (scope) {\n case FavoritePropertiesScope.Global:\n favoriteProperties = this._globalProperties!;\n saveProperties = async (properties) => this.storage.saveProperties(properties);\n break;\n case FavoritePropertiesScope.ITwin:\n favoriteProperties = this._iTwinProperties.get(iTwinId)!;\n saveProperties = async (properties) => this.storage.saveProperties(properties, iTwinId);\n break;\n default:\n favoriteProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\n saveProperties = async (properties) => this.storage.saveProperties(properties, iTwinId, imodelId);\n }\n\n const countBefore = favoriteProperties.size;\n const fieldInfos = getFieldInfos(field);\n fieldInfos.forEach((info) => favoriteProperties.add(info));\n if (favoriteProperties.size !== countBefore) {\n const saves: Array<Promise<void>> = [];\n saves.push(saveProperties(favoriteProperties));\n\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n addOrderInfos(propertiesOrder, createFieldOrderInfos(field));\n saves.push(this.storage.savePropertiesOrder(propertiesOrder, iTwinId, imodelId));\n\n await Promise.all(saves);\n this.onFavoritesChanged.raiseEvent();\n }\n }\n\n /**\n * Removes favorite properties from a scope specified and all the more general scopes.\n * @param field Field that contains properties. If field contains multiple properties, all of them will be un-favorited.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to remove the favorite properties from. It also removes from more general scopes.\n */\n public async remove(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const fieldInfos = getFieldInfos(field);\n const workingScopes: Array<{ properties: Set<PropertyFullName>; save: (properties: Set<PropertyFullName>) => Promise<void> }> = [];\n workingScopes.push({\n properties: this._globalProperties!,\n save: async (properties) => this.storage.saveProperties(properties),\n });\n if (scope === FavoritePropertiesScope.ITwin || scope === FavoritePropertiesScope.IModel) {\n workingScopes.push({\n properties: this._iTwinProperties.get(iTwinId)!,\n save: async (properties) => this.storage.saveProperties(properties, iTwinId),\n });\n }\n if (scope === FavoritePropertiesScope.IModel) {\n workingScopes.push({\n properties: this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!,\n save: async (properties) => this.storage.saveProperties(properties, iTwinId, imodelId),\n });\n }\n\n const saves: Array<Promise<void>> = [];\n let favoritesChanged = false;\n for (const { properties, save } of workingScopes) {\n const countBefore = properties.size;\n fieldInfos.forEach((info) => properties.delete(info));\n if (properties.size !== countBefore) {\n saves.push(save(properties));\n favoritesChanged = true;\n }\n }\n if (!favoritesChanged) {\n return;\n }\n\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n removeOrderInfos(propertiesOrder, createFieldOrderInfos(field));\n saves.push(this.storage.savePropertiesOrder(propertiesOrder, iTwinId, imodelId));\n\n await Promise.all(saves);\n this.onFavoritesChanged.raiseEvent();\n }\n\n /**\n * Removes all favorite properties from a certain scope.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to remove the favorite properties from.\n */\n public async clear(imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n let favoriteProperties: Set<PropertyFullName>;\n let saveProperties: () => Promise<void>;\n switch (scope) {\n case FavoritePropertiesScope.Global:\n favoriteProperties = this._globalProperties!;\n saveProperties = async () => this.storage.saveProperties(new Set<PropertyFullName>());\n break;\n case FavoritePropertiesScope.ITwin:\n favoriteProperties = this._iTwinProperties.get(iTwinId)!;\n saveProperties = async () => this.storage.saveProperties(new Set<PropertyFullName>(), iTwinId);\n break;\n default:\n favoriteProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\n saveProperties = async () => this.storage.saveProperties(new Set<PropertyFullName>(), iTwinId, imodelId);\n }\n\n if (favoriteProperties.size === 0) {\n return;\n }\n\n favoriteProperties.clear();\n const saves: Array<Promise<void>> = [];\n saves.push(saveProperties());\n saves.push(this._adjustPropertyOrderInfos(iTwinId, imodelId));\n await Promise.all(saves);\n this.onFavoritesChanged.raiseEvent();\n }\n\n /**\n * Check if field contains at least one favorite property.\n * @param field Field that contains properties.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to check for favorite properties. It also checks the more general scopes.\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\n * @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[FavoritePropertiesManager.hasAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].\n */\n public has(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): boolean {\n this.validateInitialization(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const fieldInfos = getFieldInfos(field);\n return (\n setHasAny(this._globalProperties!, fieldInfos) ||\n (scope !== FavoritePropertiesScope.Global && setHasAny(this._iTwinProperties.get(iTwinId)!, fieldInfos)) ||\n (scope === FavoritePropertiesScope.IModel && setHasAny(this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!, fieldInfos))\n );\n }\n\n /**\n * Check if field contains at least one favorite property.\n * @param field Field that contains properties.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to check for favorite properties. It also checks the more general scopes.\n */\n public async hasAsync(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<boolean> {\n await this.ensureInitialized(imodel);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return this.has(field, imodel, scope);\n }\n\n /**\n * Sorts an array of fields with respect to favorite property order.\n * Non-favorited fields get sorted by their default priority and always have lower priority than favorited fields.\n * @param imodel IModelConnection.\n * @param fields Array of Field's that needs to be sorted.\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\n * @deprecated in 4.5 - will not be removed until after 2026-06-13. Use [[FavoritePropertiesManager.sortFieldsAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].\n */\n public sortFields = (imodel: IModelConnection, fields: Field[]): Field[] => {\n this.validateInitialization(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const fieldPriority = new Map<Field, number>();\n fields.forEach((field) => fieldPriority.set(field, this.getFieldPriority(field, iTwinId, imodelId)));\n\n const sortFunction = (left: Field, right: Field): number => {\n const lp = fieldPriority.get(left)!;\n const rp = fieldPriority.get(right)!;\n return lp < rp\n ? 1\n : lp > rp\n ? -1\n : left.priority < right.priority\n ? 1 // if favorite fields have equal priorities, sort by field priority\n : left.priority > right.priority\n ? -1\n : left.name.localeCompare(right.name);\n };\n\n return fields.sort(sortFunction);\n };\n\n /**\n * Sorts an array of fields with respect to favorite property order.\n * Non-favorited fields get sorted by their default priority and always have lower priority than favorited fields.\n * @param imodel IModelConnection.\n * @param fields Array of Field's that needs to be sorted.\n */\n public async sortFieldsAsync(imodel: IModelConnection, fields: Field[]): Promise<Field[]> {\n await this.ensureInitialized(imodel);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return this.sortFields(imodel, fields);\n }\n\n private getFieldPriority(field: Field, iTwinId: string, imodelId: string): number {\n const orderInfos = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n const fieldOrderInfos = getFieldOrderInfos(field, orderInfos);\n if (fieldOrderInfos.length === 0) {\n return -1;\n }\n const mostRecent = getMostRecentOrderInfo(fieldOrderInfos);\n return mostRecent.priority;\n }\n\n private _getBaseClassesByClass = async (imodel: IModelConnection, neededClasses: Set<string>): Promise<{ [className: string]: string[] }> => {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const imodelInfo = getiModelInfo(iTwinId, imodelId);\n let baseClasses: { [className: string]: string[] };\n if (this._imodelBaseClassesByClass.has(imodelInfo)) {\n baseClasses = this._imodelBaseClassesByClass.get(imodelInfo)!;\n } else {\n this._imodelBaseClassesByClass.set(imodelInfo, (baseClasses = {}));\n }\n\n const missingClasses = new Set<string>();\n neededClasses.forEach((className) => {\n if (!baseClasses.hasOwnProperty(className)) {\n missingClasses.add(className);\n }\n });\n if (missingClasses.size === 0) {\n return baseClasses;\n }\n\n const query = `\n SELECT (derivedSchema.Name || ':' || derivedClass.Name) AS \"ClassFullName\", (baseSchema.Name || ':' || baseClass.Name) AS \"BaseClassFullName\"\n FROM ECDbMeta.ClassHasAllBaseClasses baseClassRels\n INNER JOIN ECDbMeta.ECClassDef derivedClass ON derivedClass.ECInstanceId = baseClassRels.SourceECInstanceId\n INNER JOIN ECDbMeta.ECSchemaDef derivedSchema ON derivedSchema.ECInstanceId = derivedClass.Schema.Id\n INNER JOIN ECDbMeta.ECClassDef baseClass ON baseClass.ECInstanceId = baseClassRels.TargetECInstanceId\n INNER JOIN ECDbMeta.ECSchemaDef baseSchema ON baseSchema.ECInstanceId = baseClass.Schema.Id\n WHERE (derivedSchema.Name || ':' || derivedClass.Name) IN (${[...missingClasses].map((className) => `'${className}'`).join(\",\")})`;\n const reader = imodel.createQueryReader(query, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames });\n while (await reader.step()) {\n const row = reader.current.toRow();\n if (!(row.classFullName in baseClasses)) {\n baseClasses[row.classFullName] = [];\n }\n baseClasses[row.classFullName].push(row.baseClassFullName);\n }\n return baseClasses;\n };\n\n /** Changes field properties priorities to lower than another fields priority\n * @param imodel IModelConnection.\n * @param field Field that priority is being changed.\n * @param afterField Field that goes before the moved field. If undefined the moving field is changed to the highest priority (to the top).\n * @param visibleFields Array of fields to move the field in.\n */\n public async changeFieldPriority(imodel: IModelConnection, field: Field, afterField: Field | undefined, visibleFields: Field[]) {\n /**\n * How it works:\n * 1. Gets the orderInfo's for `field` (`orderInfo`) and `afterField` (`afterOrderInfo`) by selecting the most recent order informations for each field\n * 2. Iterates all orderInfo's that are in between `afterOrderInfo` and `orderInfo` when sorted by priority\n * 3. For each iterated orderInfo it checks if it is relevant:\n * 3.1. If orderInfo belongs to a primitive property, orderInfo is relevant\n * 3.2. If orderInfo's field is visible, orderInfo is relevant\n * 3.3. If orderInfo's class has a base class or itself in previously labeled relevant orderInfo's, orderInfo is relevant\n * 3.4. If 3.1 - 3.3 don't pass, orderInfo is irrelevant\n * 4. Irrelevant orderInfos's get moved after `orderInfo` (depends on the direction)\n * 5. All `field` orderInfo's get moved after `afterOrderInfo`\n */\n await this.ensureInitialized(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n if (field === afterField) {\n throw Error(\"`field` can not be the same as `afterField`.\");\n }\n\n const allOrderInfos = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n\n const findFieldOrderInfoData = (f: Field) => {\n if (!visibleFields.includes(f)) {\n throw Error(\"Field is not contained in visible fields.\");\n }\n const infos = getFieldOrderInfos(f, allOrderInfos);\n\n if (infos.length === 0) {\n throw Error(\"Field has no property order information.\");\n }\n const info = getMostRecentOrderInfo(infos);\n const index = allOrderInfos.indexOf(info);\n return { infos, mostRecent: { info, index } };\n };\n\n const {\n infos: movingOrderInfos,\n mostRecent: { index: orderInfoIndex },\n } = findFieldOrderInfoData(field);\n\n let afterOrderInfo: FavoritePropertiesOrderInfo | undefined;\n let afterOrderInfoIndex;\n if (afterField === undefined) {\n afterOrderInfo = undefined;\n afterOrderInfoIndex = -1;\n } else {\n ({\n mostRecent: { info: afterOrderInfo, index: afterOrderInfoIndex },\n } = findFieldOrderInfoData(afterField));\n }\n\n let direction: Direction; // where to go from `afterOrderInfo` to `orderInfo`\n let startIndex: number;\n if (orderInfoIndex < afterOrderInfoIndex) {\n direction = Direction.Up;\n startIndex = afterOrderInfoIndex;\n } else {\n direction = Direction.Down;\n startIndex = afterOrderInfoIndex + 1;\n }\n\n const neededClassNames: Set<string> = allOrderInfos.reduce((classNames: Set<string>, oi) => {\n if (oi.parentClassName) {\n classNames.add(oi.parentClassName);\n }\n return classNames;\n }, new Set<string>());\n const baseClassesByClass = await this._getBaseClassesByClass(imodel, neededClassNames);\n\n const visibleOrderInfos = visibleFields.reduce(\n (union: FavoritePropertiesOrderInfo[], currField) => union.concat(getFieldOrderInfos(currField, allOrderInfos)),\n [],\n );\n const irrelevantOrderInfos: FavoritePropertiesOrderInfo[] = []; // orderInfos's that won't change their logical order in respect to other properties\n const relevantClasses: Set<ClassId> = new Set<ClassId>(); // currently relevant classes\n\n for (let i = startIndex; i !== orderInfoIndex; i += direction) {\n const currOrderInfo = allOrderInfos[i];\n\n // primitive properties are always relevant, because we can't determine their relevance based on the class hierarchy\n if (currOrderInfo.parentClassName === undefined) {\n continue;\n }\n\n const visible = visibleOrderInfos.includes(currOrderInfo);\n if (visible) {\n relevantClasses.add(currOrderInfo.parentClassName);\n continue;\n }\n\n const hasBaseClasses = baseClassesByClass[currOrderInfo.parentClassName].some((classId) => relevantClasses.has(classId));\n if (hasBaseClasses) {\n continue;\n }\n\n if (direction === Direction.Down) {\n irrelevantOrderInfos.push(currOrderInfo);\n } else {\n irrelevantOrderInfos.unshift(currOrderInfo);\n }\n }\n\n // remove irrelevantOrderInfo's to add them after the `orderInfo`\n irrelevantOrderInfos.forEach((foi) => {\n const index = allOrderInfos.findIndex((oi) => oi.parentClassName === foi.parentClassName && oi.name === foi.name);\n allOrderInfos.splice(index, 1);\n });\n\n // remove movingOrderInfos's to add them after the `afterOrderInfo`\n movingOrderInfos.forEach((foi) => {\n const index = allOrderInfos.findIndex((oi) => oi.parentClassName === foi.parentClassName && oi.name === foi.name);\n allOrderInfos.splice(index, 1);\n });\n movingOrderInfos.forEach((oi) => (oi.orderedTimestamp = new Date()));\n\n afterOrderInfoIndex = afterOrderInfo === undefined ? -1 : allOrderInfos.indexOf(afterOrderInfo);\n allOrderInfos.splice(afterOrderInfoIndex + 1, 0, ...movingOrderInfos);\n allOrderInfos.splice(afterOrderInfoIndex + 1 + (direction === Direction.Up ? movingOrderInfos.length : 0), 0, ...irrelevantOrderInfos);\n\n // reassign priority numbers\n let priority = allOrderInfos.length;\n allOrderInfos.forEach((oi) => (oi.priority = priority--));\n\n await this.storage.savePropertiesOrder(allOrderInfos, iTwinId, imodelId);\n this.onFavoritesChanged.raiseEvent();\n }\n}\n\nenum Direction {\n Up = -1,\n Down = 1,\n}\n\nconst getiModelInfo = (iTwinId: string, imodelId: string) => `${iTwinId}/${imodelId}`;\n\nconst getPropertiesFieldPropertyNames = (field: PropertiesField) => {\n const nestingPrefix = getNestingPrefix(field.parent);\n return field.properties.map((property) => `${nestingPrefix}${property.property.classInfo.name}:${property.property.name}`);\n};\n\nconst getNestedContentFieldPropertyName = (field: NestedContentField) => {\n const nestingPrefix = getNestingPrefix(field);\n return `${nestingPrefix}${field.contentClassInfo.name}`;\n};\n\nconst getNestingPrefix = (field: NestedContentField | undefined) => {\n const path: string[] = [];\n let curr = field;\n while (curr !== undefined) {\n curr.pathToPrimaryClass.forEach((rel) => {\n // Relationship directions are reversed, because we are generating a relationship list starting from the parent\n path.push(`${rel.isForwardRelationship ? \"B\" : \"F\"}:${rel.relationshipInfo.name}`);\n path.push(rel.targetClassInfo.name);\n });\n curr = curr.parent;\n }\n if (path.length === 0) {\n return \"\";\n }\n\n path.reverse();\n return `${path.join(\"-\")}-`;\n};\n\nconst getPropertyClassName = (propertyName: PropertyFullName): string | undefined => {\n const propertyNameStart = propertyName.split(\"-\")[0];\n const parts = propertyNameStart.split(\":\").length;\n if (parts === 1) {\n // primitive\n return undefined;\n }\n if (parts === 2) {\n // nested property OR nested property parent class OR regular property parent class\n return propertyNameStart;\n }\n // regular property without parent class\n return propertyNameStart.substring(0, propertyName.lastIndexOf(\":\"));\n};\n\n/** @internal */\nexport const getFieldInfos = (field: Field): Set<PropertyFullName> => {\n const fieldInfos: Set<PropertyFullName> = new Set<PropertyFullName>();\n if (field.isPropertiesField()) {\n getPropertiesFieldPropertyNames(field).forEach((info) => fieldInfos.add(info));\n } else if (field.isNestedContentField()) {\n fieldInfos.add(getNestedContentFieldPropertyName(field));\n } else {\n fieldInfos.add(field.name);\n }\n return fieldInfos;\n};\n\nconst setHasAny = (set: Set<string>, lookup: Set<string>) => {\n for (const key of lookup) {\n if (set.has(key)) {\n return true;\n }\n }\n return false;\n};\n\nconst addOrderInfos = (dest: FavoritePropertiesOrderInfo[], source: FavoritePropertiesOrderInfo[]) => {\n source.forEach((si) => {\n const index = dest.findIndex((di) => di.name === si.name);\n if (index === -1) {\n si.orderedTimestamp = new Date();\n dest.push(si);\n }\n });\n let priority = dest.length;\n dest.forEach((info) => (info.priority = priority--));\n};\n\nconst removeOrderInfos = (container: FavoritePropertiesOrderInfo[], toRemove: FavoritePropertiesOrderInfo[]) => {\n toRemove.forEach((roi) => {\n const index = container.findIndex((oi) => oi.name === roi.name);\n if (index >= 0) {\n container.splice(index, 1);\n }\n });\n};\n\n/** @internal */\nexport const createFieldOrderInfos = (field: Field): FavoritePropertiesOrderInfo[] => {\n if (field.isNestedContentField()) {\n const propertyName = getNestedContentFieldPropertyName(field);\n return [\n {\n parentClassName: getPropertyClassName(propertyName),\n name: propertyName,\n priority: 0,\n orderedTimestamp: new Date(),\n },\n ];\n }\n if (field.isPropertiesField()) {\n return getPropertiesFieldPropertyNames(field).map((propertyName) => ({\n parentClassName: getPropertyClassName(propertyName),\n name: propertyName,\n priority: 0,\n orderedTimestamp: new Date(),\n }));\n }\n return [\n {\n parentClassName: undefined,\n name: field.name,\n priority: 0,\n orderedTimestamp: new Date(),\n },\n ];\n};\n\nconst getFieldOrderInfos = (field: Field, orderInfos: FavoritePropertiesOrderInfo[]): FavoritePropertiesOrderInfo[] => {\n const fieldOrderInfos: FavoritePropertiesOrderInfo[] = [];\n const tryAddOrderInfo = (name: string) => {\n const fieldOrderInfo = orderInfos.find((oi) => oi.name === name);\n if (fieldOrderInfo !== undefined) {\n fieldOrderInfos.push(fieldOrderInfo);\n }\n };\n\n if (field.isPropertiesField()) {\n getPropertiesFieldPropertyNames(field).forEach(tryAddOrderInfo);\n } else if (field.isNestedContentField()) {\n tryAddOrderInfo(getNestedContentFieldPropertyName(field));\n } else {\n tryAddOrderInfo(field.name);\n }\n\n return fieldOrderInfos;\n};\n\nconst getMostRecentOrderInfo = (orderInfos: FavoritePropertiesOrderInfo[]) =>\n orderInfos.reduce((recent, curr) => (recent && recent.orderedTimestamp >= curr.orderedTimestamp ? recent : curr));\n"]}
|