@itwin/presentation-backend 5.1.0-dev.5 → 5.1.0-dev.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +71 -1
  2. package/lib/cjs/presentation-backend/BackendLoggerCategory.d.ts +9 -9
  3. package/lib/cjs/presentation-backend/BackendLoggerCategory.d.ts.map +1 -1
  4. package/lib/cjs/presentation-backend/BackendLoggerCategory.js +9 -9
  5. package/lib/cjs/presentation-backend/BackendLoggerCategory.js.map +1 -1
  6. package/lib/cjs/presentation-backend/Presentation.d.ts +3 -3
  7. package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
  8. package/lib/cjs/presentation-backend/PresentationManager.d.ts +19 -8
  9. package/lib/cjs/presentation-backend/PresentationManager.d.ts.map +1 -1
  10. package/lib/cjs/presentation-backend/PresentationManager.js +27 -18
  11. package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
  12. package/lib/cjs/presentation-backend/PresentationManagerDetail.d.ts.map +1 -1
  13. package/lib/cjs/presentation-backend/PresentationManagerDetail.js +16 -8
  14. package/lib/cjs/presentation-backend/PresentationManagerDetail.js.map +1 -1
  15. package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
  16. package/lib/cjs/presentation-backend/PresentationRpcImpl.js +3 -16
  17. package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
  18. package/lib/cjs/presentation-backend/SelectionScopesHelper.js.map +1 -1
  19. package/lib/cjs/presentation-backend/Utils.d.ts.map +1 -1
  20. package/lib/cjs/presentation-backend/Utils.js.map +1 -1
  21. package/lib/cjs/presentation-backend.js +20 -0
  22. package/lib/cjs/presentation-backend.js.map +1 -1
  23. package/lib/esm/presentation-backend/BackendLoggerCategory.d.ts +9 -9
  24. package/lib/esm/presentation-backend/BackendLoggerCategory.d.ts.map +1 -1
  25. package/lib/esm/presentation-backend/BackendLoggerCategory.js +9 -9
  26. package/lib/esm/presentation-backend/BackendLoggerCategory.js.map +1 -1
  27. package/lib/esm/presentation-backend/Presentation.d.ts +3 -3
  28. package/lib/esm/presentation-backend/Presentation.js.map +1 -1
  29. package/lib/esm/presentation-backend/PresentationManager.d.ts +19 -8
  30. package/lib/esm/presentation-backend/PresentationManager.d.ts.map +1 -1
  31. package/lib/esm/presentation-backend/PresentationManager.js +27 -18
  32. package/lib/esm/presentation-backend/PresentationManager.js.map +1 -1
  33. package/lib/esm/presentation-backend/PresentationManagerDetail.d.ts.map +1 -1
  34. package/lib/esm/presentation-backend/PresentationManagerDetail.js +11 -3
  35. package/lib/esm/presentation-backend/PresentationManagerDetail.js.map +1 -1
  36. package/lib/esm/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
  37. package/lib/esm/presentation-backend/PresentationRpcImpl.js +5 -18
  38. package/lib/esm/presentation-backend/PresentationRpcImpl.js.map +1 -1
  39. package/lib/esm/presentation-backend/SelectionScopesHelper.js.map +1 -1
  40. package/lib/esm/presentation-backend/Utils.d.ts.map +1 -1
  41. package/lib/esm/presentation-backend/Utils.js +2 -2
  42. package/lib/esm/presentation-backend/Utils.js.map +1 -1
  43. package/lib/esm/presentation-backend.js +20 -0
  44. package/lib/esm/presentation-backend.js.map +1 -1
  45. package/package.json +15 -14
@@ -1 +1 @@
1
- {"version":3,"file":"PresentationRpcImpl.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationRpcImpl.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;AAEH,sDAAyD;AACzD,sDAA4G;AAC5G,oDAAwE;AACxE,oEA4CoC;AACpC,kEAA2I;AAC3I,iHAAiH;AACjH,wDAAwD;AACxD,yEAAsE;AACtE,yEAA+E;AAC/E,uDAAiD;AAEjD,iFAAkG;AAClG,+DAAyD;AACzD,6DAAoE;AAEpE,MAAM,kBAAkB,GAAG,sBAAW,CAAC,OAAO,CAAC;AAI/C,gBAAgB;AACH,QAAA,qBAAqB,GAAG,IAAI,C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AAiB,EAAE,CAAC;YACnC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;gBACtB,KAAK,wCAAkB,CAAC,cAAc;oBACpC,OAAO,IAAI,CAAC,KAAM,SAAQ,4BAAa;wBAC9B,IAAI,GAAG,uBAAuB,CAAC;wBAC/B,IAAI,GAAG,GAAG,CAAC;qBACnB,CAAC,EAAE,CAAC;gBACP,KAAK,wCAAkB,CAAC,QAAQ;oBAC9B,OAAO,IAAI,CAAC,KAAM,SAAQ,8BAAe;wBAChC,IAAI,GAAG,WAAW,CAAC;wBACnB,IAAI,GAAG,GAAG,CAAC;qBACnB,CAAC,EAAE,CAAC;gBACP,KAAK,wCAAkB,CAAC,iBAAiB;oBACvC,OAAO,IAAI,CAAC,KAAM,SAAQ,4BAAa;wBAC9B,IAAI,GAAG,yBAAyB,CAAC;wBACjC,IAAI,GAAG,GAAG,CAAC;qBACnB,CAAC,EAAE,CAAC;gBACP,KAAK,wCAAkB,CAAC,KAAK,CAAC;gBAC9B,KAAK,wCAAkB,CAAC,eAAe;oBACrC,OAAO,IAAI,CAAC,KAAM,SAAQ,4BAAa;wBAC9B,IAAI,GAAG,uBAAuB,CAAC;wBAC/B,IAAI,GAAG,GAAG,CAAC;qBACnB,CAAC,EAAE,CAAC;YACT,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC;AACD,mBAAmB","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 RPC\n */\n\nimport { IModelDb, RpcTrace } from \"@itwin/core-backend\";\nimport { BeEvent, ErrorCategory, Logger, omit, StatusCategory, SuccessCategory } from \"@itwin/core-bentley\";\nimport { IModelRpcProps, RpcPendingResponse } from \"@itwin/core-common\";\nimport {\n ClientDiagnostics,\n ComputeSelectionRpcRequestOptions,\n ContentDescriptorRpcRequestOptions,\n ContentFlags,\n ContentInstanceKeysRpcRequestOptions,\n ContentRpcRequestOptions,\n ContentSourcesRpcRequestOptions,\n ContentSourcesRpcResult,\n DefaultContentDisplayTypes,\n DescriptorJSON,\n Diagnostics,\n DisplayLabelRpcRequestOptions,\n DisplayLabelsRpcRequestOptions,\n DisplayValueGroup,\n DistinctValuesRpcRequestOptions,\n ElementProperties,\n FilterByInstancePathsHierarchyRpcRequestOptions,\n FilterByTextHierarchyRpcRequestOptions,\n HierarchyLevel,\n HierarchyLevelDescriptorRpcRequestOptions,\n HierarchyRpcRequestOptions,\n ItemJSON,\n KeySet,\n KeySetJSON,\n LabelDefinition,\n Node,\n NodePathElement,\n Paged,\n PagedResponse,\n PageOptions,\n PresentationError,\n PresentationRpcInterface,\n PresentationRpcResponse,\n PresentationRpcResponseData,\n PresentationStatus,\n RpcDiagnosticsOptions,\n Ruleset,\n RulesetVariable,\n RulesetVariableJSON,\n SelectClassInfo,\n SelectionScope,\n SelectionScopeRpcRequestOptions,\n SingleElementPropertiesRpcRequestOptions,\n} from \"@itwin/presentation-common\";\nimport { buildElementProperties, createCancellableTimeoutPromise, deepReplaceNullsToUndefined } from \"@itwin/presentation-common/internal\";\n// @ts-expect-error TS complains about `with` in CJS builds; The path is fine at runtime, but not at compile time\n// eslint-disable-next-line @itwin/import-within-package\nimport packageJson from \"../../../package.json\" with { type: \"json\" };\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory.js\";\nimport { Presentation } from \"./Presentation.js\";\nimport { PresentationManager } from \"./PresentationManager.js\";\nimport { DESCRIPTOR_ONLY_CONTENT_FLAG, getRulesetIdObject } from \"./PresentationManagerDetail.js\";\nimport { TemporaryStorage } from \"./TemporaryStorage.js\";\nimport { _presentation_manager_detail } from \"./InternalSymbols.js\";\n\nconst packageJsonVersion = packageJson.version;\n\ntype ContentGetter<TResult = any, TOptions = any> = (requestOptions: TOptions) => TResult;\n\n/** @internal */\nexport const MAX_ALLOWED_PAGE_SIZE = 1000;\n/** @internal */\nexport const MAX_ALLOWED_KEYS_PAGE_SIZE = 10000;\n\nconst DEFAULT_REQUEST_TIMEOUT = 5000;\n\n/**\n * The backend implementation of PresentationRpcInterface. All it's basically\n * responsible for is forwarding calls to [[Presentation.manager]].\n *\n * @internal\n */\nexport class PresentationRpcImpl extends PresentationRpcInterface implements Disposable {\n private _requestTimeout: number;\n private _pendingRequests: TemporaryStorage<PresentationRpcResponse<any>>;\n private _cancelEvents: Map<string, BeEvent<() => void>>;\n private _statusHandler: (e: Error) => StatusCategory | undefined;\n\n public constructor(props?: { requestTimeout?: number }) {\n super();\n this._requestTimeout = props?.requestTimeout ?? DEFAULT_REQUEST_TIMEOUT;\n this._pendingRequests = new TemporaryStorage({\n // remove the pending request after request timeout + 10 seconds - this gives\n // frontend 10 seconds to re-send the request until it's removed from requests' cache\n unusedValueLifetime: this._requestTimeout > 0 ? this._requestTimeout + 10 * 1000 : undefined,\n\n // attempt to clean up every second\n cleanupInterval: 1000,\n\n cleanupHandler: (id, _, reason) => {\n if (reason !== \"request\") {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Cleaning up request without frontend retrieving it: ${id}.`);\n /* c8 ignore next */\n this._cancelEvents.get(id)?.raiseEvent();\n }\n this._cancelEvents.delete(id);\n },\n });\n this._cancelEvents = new Map<string, BeEvent<() => void>>();\n\n this._statusHandler = createStatusCategoryHandler();\n StatusCategory.handlers.add(this._statusHandler);\n }\n\n public [Symbol.dispose]() {\n this._pendingRequests[Symbol.dispose]();\n StatusCategory.handlers.delete(this._statusHandler);\n }\n\n public get requestTimeout() {\n return this._requestTimeout;\n }\n\n public get pendingRequests() {\n return this._pendingRequests;\n }\n\n /** Returns an ok response with result inside */\n private successResponse<TResult>(result: TResult, diagnostics?: ClientDiagnostics) {\n return {\n statusCode: PresentationStatus.Success,\n result,\n diagnostics,\n };\n }\n\n /** Returns a bad request response with empty result and an error code */\n private errorResponse(errorCode: PresentationStatus, errorMessage?: string, diagnostics?: ClientDiagnostics) {\n return {\n statusCode: errorCode,\n result: undefined,\n errorMessage,\n diagnostics,\n };\n }\n\n /**\n * Get the [[PresentationManager]] used by this RPC impl.\n */\n public getManager(clientId?: string): PresentationManager {\n return Presentation.getManager(clientId);\n }\n\n private async getIModel(token: IModelRpcProps): Promise<IModelDb> {\n const imodel = IModelDb.findByKey(token.key);\n // call refreshContainer, just in case this is a V2 checkpoint whose sasToken is about to expire, or its default transaction is about to be restarted.\n await imodel.refreshContainerForRpc(RpcTrace.expectCurrentActivity.accessToken);\n return imodel;\n }\n\n private async makeRequest<\n TRpcOptions extends { rulesetOrId?: Ruleset | string; clientId?: string; diagnostics?: RpcDiagnosticsOptions; rulesetVariables?: RulesetVariableJSON[] },\n TResult,\n >(token: IModelRpcProps, requestId: string, requestOptions: TRpcOptions, request: ContentGetter<Promise<TResult>>): PresentationRpcResponse<TResult> {\n const serializedRequestOptionsForLogging = JSON.stringify({\n ...omit(requestOptions, [\"rulesetOrId\"]),\n ...(requestOptions.rulesetOrId ? { rulesetId: getRulesetIdObject(requestOptions.rulesetOrId).uniqueId } : undefined),\n });\n Logger.logInfo(PresentationBackendLoggerCategory.Rpc, `Received '${requestId}' request. Params: ${serializedRequestOptionsForLogging}`);\n\n const imodel = await this.getIModel(token);\n const requestKey = JSON.stringify({ iModelKey: token.key, requestId, requestOptions });\n let resultPromise = this._pendingRequests.getValue(requestKey);\n if (resultPromise) {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request already pending`);\n } else {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request not found, creating a new one`);\n const { clientId: _, diagnostics: diagnosticsOptions, rulesetVariables, ...options } = requestOptions;\n const managerRequestOptions: any = {\n ...options,\n imodel,\n cancelEvent: new BeEvent<() => void>(),\n };\n\n // set up ruleset variables\n if (rulesetVariables) {\n managerRequestOptions.rulesetVariables = rulesetVariables.map(RulesetVariable.fromJSON);\n }\n\n // set up diagnostics listener\n let diagnostics: ClientDiagnostics | undefined;\n const getDiagnostics = (): ClientDiagnostics => {\n if (!diagnostics) {\n diagnostics = {};\n }\n return diagnostics;\n };\n if (diagnosticsOptions) {\n if (diagnosticsOptions.backendVersion) {\n getDiagnostics().backendVersion = packageJsonVersion;\n }\n managerRequestOptions.diagnostics = {\n ...diagnosticsOptions,\n handler: (d: Diagnostics) => {\n if (d.logs) {\n const target = getDiagnostics();\n if (target.logs) {\n target.logs.push(...d.logs);\n } else {\n target.logs = [...d.logs];\n }\n }\n },\n };\n }\n\n // initiate request\n resultPromise = request(managerRequestOptions).then((result) => this.successResponse(result, diagnostics));\n\n // store the request promise\n this._pendingRequests.addValue(requestKey, resultPromise);\n this._cancelEvents.set(requestKey, managerRequestOptions.cancelEvent);\n }\n\n if (this._requestTimeout === 0) {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request timeout not configured, returning promise without a timeout.`);\n void resultPromise.finally(() => {\n this._pendingRequests.deleteValue(requestKey);\n });\n return resultPromise;\n }\n\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Returning a promise with a timeout of ${this._requestTimeout}.`);\n const timeout = createCancellableTimeoutPromise(this._requestTimeout);\n return Promise.race([\n resultPromise,\n timeout.promise.then(() => {\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw new RpcPendingResponse(\"Timeout\");\n }),\n ])\n .then((response: PresentationRpcResponseData<TResult>) => {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request completed, returning result.`);\n this._pendingRequests.deleteValue(requestKey);\n return response;\n })\n .finally(() => {\n timeout.cancel();\n });\n }\n\n public override async getNodesCount(token: IModelRpcProps, requestOptions: HierarchyRpcRequestOptions): PresentationRpcResponse<number> {\n return this.makeRequest(token, \"getNodesCount\", requestOptions, async (options) => {\n return this.getManager(requestOptions.clientId).getNodesCount(options);\n });\n }\n\n public override async getPagedNodes(token: IModelRpcProps, requestOptions: Paged<HierarchyRpcRequestOptions>): PresentationRpcResponse<PagedResponse<Node>> {\n return this.makeRequest(token, \"getPagedNodes\", requestOptions, async (options) => {\n options = enforceValidPageSize(options);\n const [serializedHierarchyLevel, count] = await Promise.all([\n this.getManager(requestOptions.clientId)[_presentation_manager_detail].getNodes(options),\n this.getManager(requestOptions.clientId).getNodesCount(options),\n ]);\n const hierarchyLevel: HierarchyLevel = deepReplaceNullsToUndefined(JSON.parse(serializedHierarchyLevel));\n return {\n total: count,\n items: hierarchyLevel.nodes,\n };\n });\n }\n\n public override async getNodesDescriptor(\n token: IModelRpcProps,\n requestOptions: HierarchyLevelDescriptorRpcRequestOptions,\n ): PresentationRpcResponse<string | DescriptorJSON | undefined> {\n return this.makeRequest(token, \"getNodesDescriptor\", requestOptions, async (options) => {\n return this.getManager(requestOptions.clientId)[_presentation_manager_detail].getNodesDescriptor(options);\n });\n }\n\n public override async getNodePaths(\n token: IModelRpcProps,\n requestOptions: FilterByInstancePathsHierarchyRpcRequestOptions,\n ): PresentationRpcResponse<NodePathElement[]> {\n return this.makeRequest(token, \"getNodePaths\", requestOptions, async (options) => {\n return this.getManager(requestOptions.clientId)[_presentation_manager_detail].getNodePaths(options);\n });\n }\n\n public override async getFilteredNodePaths(\n token: IModelRpcProps,\n requestOptions: FilterByTextHierarchyRpcRequestOptions,\n ): PresentationRpcResponse<NodePathElement[]> {\n return this.makeRequest(token, \"getFilteredNodePaths\", requestOptions, async (options) => {\n return this.getManager(requestOptions.clientId)[_presentation_manager_detail].getFilteredNodePaths(options);\n });\n }\n\n public override async getContentSources(\n token: IModelRpcProps,\n requestOptions: ContentSourcesRpcRequestOptions,\n ): PresentationRpcResponse<ContentSourcesRpcResult> {\n return this.makeRequest(token, \"getContentSources\", requestOptions, async (options) => {\n const result = await this.getManager(requestOptions.clientId).getContentSources(options);\n const classesMap = {};\n const selectClasses = result.map((sci) => SelectClassInfo.toCompressedJSON(sci, classesMap));\n return { sources: selectClasses, classesMap };\n });\n }\n\n public override async getContentDescriptor(\n token: IModelRpcProps,\n requestOptions: ContentDescriptorRpcRequestOptions,\n ): PresentationRpcResponse<DescriptorJSON | undefined> {\n return this.makeRequest(token, \"getContentDescriptor\", requestOptions, async (options) => {\n options = {\n ...options,\n contentFlags: (options.contentFlags ?? 0) | DESCRIPTOR_ONLY_CONTENT_FLAG, // always append the \"descriptor only\" flag when handling request from the frontend\n keys: KeySet.fromJSON(options.keys),\n };\n // Here we send a plain JSON string but we will parse it to DescriptorJSON on the frontend. This way we are\n // bypassing unnecessary deserialization and serialization.\n return Presentation.getManager(requestOptions.clientId)[_presentation_manager_detail].getContentDescriptor(options) as unknown as\n | DescriptorJSON\n | undefined;\n });\n }\n\n public override async getContentSetSize(token: IModelRpcProps, requestOptions: ContentRpcRequestOptions): PresentationRpcResponse<number> {\n return this.makeRequest(token, \"getContentSetSize\", requestOptions, async (options) => {\n options = {\n ...options,\n keys: KeySet.fromJSON(options.keys),\n };\n return this.getManager(requestOptions.clientId).getContentSetSize(options);\n });\n }\n\n public override async getPagedContent(\n token: IModelRpcProps,\n requestOptions: Paged<ContentRpcRequestOptions>,\n ): PresentationRpcResponse<{ descriptor: DescriptorJSON; contentSet: PagedResponse<ItemJSON> } | undefined> {\n return this.makeRequest(token, \"getPagedContent\", requestOptions, async (options) => {\n options = enforceValidPageSize({\n ...options,\n keys: KeySet.fromJSON(options.keys),\n });\n\n const [size, content] = await Promise.all([\n this.getManager(requestOptions.clientId).getContentSetSize(options),\n this.getManager(requestOptions.clientId)[_presentation_manager_detail].getContent(options),\n ]);\n\n if (!content) {\n return undefined;\n }\n\n return {\n descriptor: content.descriptor.toJSON(),\n contentSet: {\n total: size,\n items: content.contentSet.map((i) => i.toJSON()),\n },\n };\n });\n }\n\n public override async getPagedContentSet(\n token: IModelRpcProps,\n requestOptions: Paged<ContentRpcRequestOptions>,\n ): PresentationRpcResponse<PagedResponse<ItemJSON>> {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const response = await this.getPagedContent(token, requestOptions);\n if (response.statusCode !== PresentationStatus.Success) {\n return this.errorResponse(response.statusCode, response.errorMessage, response.diagnostics);\n }\n if (!response.result) {\n return this.errorResponse(PresentationStatus.Error, `Failed to get content set (received a success response with empty result)`, response.diagnostics);\n }\n return {\n ...response,\n result: response.result.contentSet,\n };\n }\n\n public override async getElementProperties(\n token: IModelRpcProps,\n requestOptions: SingleElementPropertiesRpcRequestOptions,\n ): PresentationRpcResponse<ElementProperties | undefined> {\n return this.makeRequest(token, \"getElementProperties\", { ...requestOptions }, async (options) => {\n const manager = this.getManager(requestOptions.clientId);\n const { elementId, ...optionsNoElementId } = options;\n const content = await manager[_presentation_manager_detail].getContent({\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 (!content || content.contentSet.length === 0) {\n return undefined;\n }\n return buildElementProperties(content.descriptor, content.contentSet[0]);\n });\n }\n\n public override async getPagedDistinctValues(\n token: IModelRpcProps,\n requestOptions: DistinctValuesRpcRequestOptions,\n ): PresentationRpcResponse<PagedResponse<DisplayValueGroup>> {\n return this.makeRequest(token, \"getPagedDistinctValues\", requestOptions, async (options) => {\n options = enforceValidPageSize({\n ...options,\n keys: KeySet.fromJSON(options.keys),\n });\n return this.getManager(requestOptions.clientId)[_presentation_manager_detail].getPagedDistinctValues(options);\n });\n }\n\n public override async getContentInstanceKeys(\n token: IModelRpcProps,\n requestOptions: ContentInstanceKeysRpcRequestOptions,\n ): PresentationRpcResponse<{ total: number; items: KeySetJSON }> {\n return this.makeRequest(token, \"getContentInstanceKeys\", requestOptions, async (options) => {\n const { displayType, ...optionsNoDisplayType } = options;\n options = enforceValidPageSize(\n {\n ...optionsNoDisplayType,\n keys: KeySet.fromJSON(optionsNoDisplayType.keys),\n descriptor: {\n displayType,\n contentFlags: ContentFlags.KeysOnly,\n },\n },\n MAX_ALLOWED_KEYS_PAGE_SIZE,\n );\n\n const [size, content] = await Promise.all([\n this.getManager(requestOptions.clientId).getContentSetSize(options),\n this.getManager(requestOptions.clientId)[_presentation_manager_detail].getContent(options),\n ]);\n\n if (size === 0 || !content) {\n return { total: 0, items: new KeySet().toJSON() };\n }\n\n return {\n total: size,\n items: content.contentSet.reduce((keys, item) => keys.add(item.primaryKeys), new KeySet()).toJSON(),\n };\n });\n }\n\n public override async getDisplayLabelDefinition(\n token: IModelRpcProps,\n requestOptions: DisplayLabelRpcRequestOptions,\n ): PresentationRpcResponse<LabelDefinition> {\n return this.makeRequest(token, \"getDisplayLabelDefinition\", requestOptions, async (options) => {\n const label = await this.getManager(requestOptions.clientId)[_presentation_manager_detail].getDisplayLabelDefinition(options);\n return label;\n });\n }\n\n public override async getPagedDisplayLabelDefinitions(\n token: IModelRpcProps,\n requestOptions: DisplayLabelsRpcRequestOptions,\n ): PresentationRpcResponse<PagedResponse<LabelDefinition>> {\n const pageOpts = enforceValidPageSize({ paging: { start: 0, size: requestOptions.keys.length } });\n if (pageOpts.paging.size < requestOptions.keys.length) {\n requestOptions.keys.splice(pageOpts.paging.size);\n }\n return this.makeRequest(token, \"getPagedDisplayLabelDefinitions\", requestOptions, async (options) => {\n const labels = await this.getManager(requestOptions.clientId)[_presentation_manager_detail].getDisplayLabelDefinitions({\n ...options,\n keys: options.keys,\n });\n return {\n total: options.keys.length,\n items: labels,\n };\n });\n }\n\n /* eslint-disable @typescript-eslint/no-deprecated */\n public override async getSelectionScopes(token: IModelRpcProps, requestOptions: SelectionScopeRpcRequestOptions): PresentationRpcResponse<SelectionScope[]> {\n return this.makeRequest(token, \"getSelectionScopes\", requestOptions, async (options) =>\n this.getManager(requestOptions.clientId).getSelectionScopes(options),\n );\n }\n\n public override async computeSelection(token: IModelRpcProps, requestOptions: ComputeSelectionRpcRequestOptions): PresentationRpcResponse<KeySetJSON> {\n return this.makeRequest(token, \"computeSelection\", requestOptions, async (options) => {\n const keys = await this.getManager(requestOptions.clientId).computeSelection(options);\n return keys.toJSON();\n });\n }\n /* eslint-enable @typescript-eslint/no-deprecated */\n}\n\nconst enforceValidPageSize = <TOptions extends Paged<object>>(\n requestOptions: TOptions,\n maxPageSize = MAX_ALLOWED_PAGE_SIZE,\n): TOptions & { paging: PageOptions } => {\n const validPageSize = getValidPageSize(requestOptions.paging?.size, maxPageSize);\n if (!requestOptions.paging || requestOptions.paging.size !== validPageSize) {\n return { ...requestOptions, paging: { ...requestOptions.paging, size: validPageSize } };\n }\n return requestOptions as TOptions & { paging: PageOptions };\n};\n\nconst getValidPageSize = (size: number | undefined, maxPageSize: number) => {\n const requestedSize = size ?? 0;\n return requestedSize === 0 || requestedSize > maxPageSize ? maxPageSize : requestedSize;\n};\n\n// not testing temporary solution\n/* c8 ignore start */\nfunction createStatusCategoryHandler() {\n return (e: Error) => {\n if (e instanceof PresentationError) {\n switch (e.errorNumber) {\n case PresentationStatus.NotInitialized:\n return new (class extends ErrorCategory {\n public name = \"Internal server error\";\n public code = 500;\n })();\n case PresentationStatus.Canceled:\n return new (class extends SuccessCategory {\n public name = \"Cancelled\";\n public code = 204;\n })();\n case PresentationStatus.ResultSetTooLarge:\n return new (class extends ErrorCategory {\n public name = \"Result set is too large\";\n public code = 413;\n })();\n case PresentationStatus.Error:\n case PresentationStatus.InvalidArgument:\n return new (class extends ErrorCategory {\n public name = \"Invalid request props\";\n public code = 422;\n })();\n }\n }\n return undefined;\n };\n}\n/* c8 ignore end */\n"]}
1
+ {"version":3,"file":"PresentationRpcImpl.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationRpcImpl.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;AAEH,sDAAyD;AACzD,sDAA4G;AAC5G,oDAAwE;AACxE,oEA2CoC;AACpC,kEAAmH;AACnH,iHAAiH;AACjH,wDAAwD;AACxD,yEAAsE;AACtE,yEAA+E;AAC/E,6DAAoE;AACpE,uDAAiD;AAEjD,iFAAkG;AAClG,+DAAyD;AAEzD,MAAM,kBAAkB,GAAG,sBAAW,C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,CAAC;wBACjC,IAAI,GAAG,GAAG,CAAC;qBACnB,CAAC,EAAE,CAAC;gBACP,KAAK,wCAAkB,CAAC,KAAK,CAAC;gBAC9B,KAAK,wCAAkB,CAAC,eAAe;oBACrC,OAAO,IAAI,CAAC,KAAM,SAAQ,4BAAa;wBAC9B,IAAI,GAAG,uBAAuB,CAAC;wBAC/B,IAAI,GAAG,GAAG,CAAC;qBACnB,CAAC,EAAE,CAAC;YACT,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC;AACD,mBAAmB","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 RPC\n */\n\nimport { IModelDb, RpcTrace } from \"@itwin/core-backend\";\nimport { BeEvent, ErrorCategory, Logger, omit, StatusCategory, SuccessCategory } from \"@itwin/core-bentley\";\nimport { IModelRpcProps, RpcPendingResponse } from \"@itwin/core-common\";\nimport {\n ClientDiagnostics,\n ComputeSelectionRpcRequestOptions,\n ContentDescriptorRpcRequestOptions,\n ContentFlags,\n ContentInstanceKeysRpcRequestOptions,\n ContentRpcRequestOptions,\n ContentSourcesRpcRequestOptions,\n ContentSourcesRpcResult,\n DescriptorJSON,\n Diagnostics,\n DisplayLabelRpcRequestOptions,\n DisplayLabelsRpcRequestOptions,\n DisplayValueGroup,\n DistinctValuesRpcRequestOptions,\n ElementProperties,\n FilterByInstancePathsHierarchyRpcRequestOptions,\n FilterByTextHierarchyRpcRequestOptions,\n HierarchyLevel,\n HierarchyLevelDescriptorRpcRequestOptions,\n HierarchyRpcRequestOptions,\n ItemJSON,\n KeySet,\n KeySetJSON,\n LabelDefinition,\n Node,\n NodePathElement,\n Paged,\n PagedResponse,\n PageOptions,\n PresentationError,\n PresentationRpcInterface,\n PresentationRpcResponse,\n PresentationRpcResponseData,\n PresentationStatus,\n RpcDiagnosticsOptions,\n Ruleset,\n RulesetVariable,\n RulesetVariableJSON,\n SelectClassInfo,\n SelectionScope,\n SelectionScopeRpcRequestOptions,\n SingleElementPropertiesRpcRequestOptions,\n} from \"@itwin/presentation-common\";\nimport { createCancellableTimeoutPromise, deepReplaceNullsToUndefined } from \"@itwin/presentation-common/internal\";\n// @ts-expect-error TS complains about `with` in CJS builds; The path is fine at runtime, but not at compile time\n// eslint-disable-next-line @itwin/import-within-package\nimport packageJson from \"../../../package.json\" with { type: \"json\" };\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory.js\";\nimport { _presentation_manager_detail } from \"./InternalSymbols.js\";\nimport { Presentation } from \"./Presentation.js\";\nimport { PresentationManager } from \"./PresentationManager.js\";\nimport { DESCRIPTOR_ONLY_CONTENT_FLAG, getRulesetIdObject } from \"./PresentationManagerDetail.js\";\nimport { TemporaryStorage } from \"./TemporaryStorage.js\";\n\nconst packageJsonVersion = packageJson.version;\n\ntype ContentGetter<TResult = any, TOptions = any> = (requestOptions: TOptions) => TResult;\n\n/** @internal */\nexport const MAX_ALLOWED_PAGE_SIZE = 1000;\n/** @internal */\nexport const MAX_ALLOWED_KEYS_PAGE_SIZE = 10000;\n\nconst DEFAULT_REQUEST_TIMEOUT = 5000;\n\n/**\n * The backend implementation of PresentationRpcInterface. All it's basically\n * responsible for is forwarding calls to [[Presentation.manager]].\n *\n * @internal\n */\nexport class PresentationRpcImpl extends PresentationRpcInterface implements Disposable {\n private _requestTimeout: number;\n private _pendingRequests: TemporaryStorage<PresentationRpcResponse<any>>;\n private _cancelEvents: Map<string, BeEvent<() => void>>;\n private _statusHandler: (e: Error) => StatusCategory | undefined;\n\n public constructor(props?: { requestTimeout?: number }) {\n super();\n this._requestTimeout = props?.requestTimeout ?? DEFAULT_REQUEST_TIMEOUT;\n this._pendingRequests = new TemporaryStorage({\n // remove the pending request after request timeout + 10 seconds - this gives\n // frontend 10 seconds to re-send the request until it's removed from requests' cache\n unusedValueLifetime: this._requestTimeout > 0 ? this._requestTimeout + 10 * 1000 : undefined,\n\n // attempt to clean up every second\n cleanupInterval: 1000,\n\n cleanupHandler: (id, _, reason) => {\n if (reason !== \"request\") {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Cleaning up request without frontend retrieving it: ${id}.`);\n /* c8 ignore next */\n this._cancelEvents.get(id)?.raiseEvent();\n }\n this._cancelEvents.delete(id);\n },\n });\n this._cancelEvents = new Map<string, BeEvent<() => void>>();\n\n this._statusHandler = createStatusCategoryHandler();\n StatusCategory.handlers.add(this._statusHandler);\n }\n\n public [Symbol.dispose]() {\n this._pendingRequests[Symbol.dispose]();\n StatusCategory.handlers.delete(this._statusHandler);\n }\n\n public get requestTimeout() {\n return this._requestTimeout;\n }\n\n public get pendingRequests() {\n return this._pendingRequests;\n }\n\n /** Returns an ok response with result inside */\n private successResponse<TResult>(result: TResult, diagnostics?: ClientDiagnostics) {\n return {\n statusCode: PresentationStatus.Success,\n result,\n diagnostics,\n };\n }\n\n /** Returns a bad request response with empty result and an error code */\n private errorResponse(errorCode: PresentationStatus, errorMessage?: string, diagnostics?: ClientDiagnostics) {\n return {\n statusCode: errorCode,\n result: undefined,\n errorMessage,\n diagnostics,\n };\n }\n\n /**\n * Get the [[PresentationManager]] used by this RPC impl.\n */\n public getManager(clientId?: string): PresentationManager {\n return Presentation.getManager(clientId);\n }\n\n private async getIModel(token: IModelRpcProps): Promise<IModelDb> {\n const imodel = IModelDb.findByKey(token.key);\n // call refreshContainer, just in case this is a V2 checkpoint whose sasToken is about to expire, or its default transaction is about to be restarted.\n await imodel.refreshContainerForRpc(RpcTrace.expectCurrentActivity.accessToken);\n return imodel;\n }\n\n private async makeRequest<\n TRpcOptions extends { rulesetOrId?: Ruleset | string; clientId?: string; diagnostics?: RpcDiagnosticsOptions; rulesetVariables?: RulesetVariableJSON[] },\n TResult,\n >(token: IModelRpcProps, requestId: string, requestOptions: TRpcOptions, request: ContentGetter<Promise<TResult>>): PresentationRpcResponse<TResult> {\n const serializedRequestOptionsForLogging = JSON.stringify({\n ...omit(requestOptions, [\"rulesetOrId\"]),\n ...(requestOptions.rulesetOrId ? { rulesetId: getRulesetIdObject(requestOptions.rulesetOrId).uniqueId } : undefined),\n });\n Logger.logInfo(PresentationBackendLoggerCategory.Rpc, `Received '${requestId}' request. Params: ${serializedRequestOptionsForLogging}`);\n\n const imodel = await this.getIModel(token);\n const requestKey = JSON.stringify({ iModelKey: token.key, requestId, requestOptions });\n let resultPromise = this._pendingRequests.getValue(requestKey);\n if (resultPromise) {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request already pending`);\n } else {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request not found, creating a new one`);\n const { clientId: _, diagnostics: diagnosticsOptions, rulesetVariables, ...options } = requestOptions;\n const managerRequestOptions: any = {\n ...options,\n imodel,\n cancelEvent: new BeEvent<() => void>(),\n };\n\n // set up ruleset variables\n if (rulesetVariables) {\n managerRequestOptions.rulesetVariables = rulesetVariables.map(RulesetVariable.fromJSON);\n }\n\n // set up diagnostics listener\n let diagnostics: ClientDiagnostics | undefined;\n const getDiagnostics = (): ClientDiagnostics => {\n if (!diagnostics) {\n diagnostics = {};\n }\n return diagnostics;\n };\n if (diagnosticsOptions) {\n if (diagnosticsOptions.backendVersion) {\n getDiagnostics().backendVersion = packageJsonVersion;\n }\n managerRequestOptions.diagnostics = {\n ...diagnosticsOptions,\n handler: (d: Diagnostics) => {\n if (d.logs) {\n const target = getDiagnostics();\n if (target.logs) {\n target.logs.push(...d.logs);\n } else {\n target.logs = [...d.logs];\n }\n }\n },\n };\n }\n\n // initiate request\n resultPromise = request(managerRequestOptions).then((result) => this.successResponse(result, diagnostics));\n\n // store the request promise\n this._pendingRequests.addValue(requestKey, resultPromise);\n this._cancelEvents.set(requestKey, managerRequestOptions.cancelEvent);\n }\n\n if (this._requestTimeout === 0) {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request timeout not configured, returning promise without a timeout.`);\n void resultPromise.finally(() => {\n this._pendingRequests.deleteValue(requestKey);\n });\n return resultPromise;\n }\n\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Returning a promise with a timeout of ${this._requestTimeout}.`);\n const timeout = createCancellableTimeoutPromise(this._requestTimeout);\n return Promise.race([\n resultPromise,\n timeout.promise.then(() => {\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw new RpcPendingResponse(\"Timeout\");\n }),\n ])\n .then((response: PresentationRpcResponseData<TResult>) => {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request completed, returning result.`);\n this._pendingRequests.deleteValue(requestKey);\n return response;\n })\n .finally(() => {\n timeout.cancel();\n });\n }\n\n public override async getNodesCount(token: IModelRpcProps, requestOptions: HierarchyRpcRequestOptions): PresentationRpcResponse<number> {\n return this.makeRequest(token, \"getNodesCount\", requestOptions, async (options) => {\n return this.getManager(requestOptions.clientId).getNodesCount(options);\n });\n }\n\n public override async getPagedNodes(token: IModelRpcProps, requestOptions: Paged<HierarchyRpcRequestOptions>): PresentationRpcResponse<PagedResponse<Node>> {\n return this.makeRequest(token, \"getPagedNodes\", requestOptions, async (options) => {\n options = enforceValidPageSize(options);\n const [serializedHierarchyLevel, count] = await Promise.all([\n this.getManager(requestOptions.clientId)[_presentation_manager_detail].getNodes(options),\n this.getManager(requestOptions.clientId).getNodesCount(options),\n ]);\n const hierarchyLevel: HierarchyLevel = deepReplaceNullsToUndefined(JSON.parse(serializedHierarchyLevel));\n return {\n total: count,\n items: hierarchyLevel.nodes,\n };\n });\n }\n\n public override async getNodesDescriptor(\n token: IModelRpcProps,\n requestOptions: HierarchyLevelDescriptorRpcRequestOptions,\n ): PresentationRpcResponse<string | DescriptorJSON | undefined> {\n return this.makeRequest(token, \"getNodesDescriptor\", requestOptions, async (options) => {\n return this.getManager(requestOptions.clientId)[_presentation_manager_detail].getNodesDescriptor(options);\n });\n }\n\n public override async getNodePaths(\n token: IModelRpcProps,\n requestOptions: FilterByInstancePathsHierarchyRpcRequestOptions,\n ): PresentationRpcResponse<NodePathElement[]> {\n return this.makeRequest(token, \"getNodePaths\", requestOptions, async (options) => {\n return this.getManager(requestOptions.clientId)[_presentation_manager_detail].getNodePaths(options);\n });\n }\n\n public override async getFilteredNodePaths(\n token: IModelRpcProps,\n requestOptions: FilterByTextHierarchyRpcRequestOptions,\n ): PresentationRpcResponse<NodePathElement[]> {\n return this.makeRequest(token, \"getFilteredNodePaths\", requestOptions, async (options) => {\n return this.getManager(requestOptions.clientId)[_presentation_manager_detail].getFilteredNodePaths(options);\n });\n }\n\n public override async getContentSources(\n token: IModelRpcProps,\n requestOptions: ContentSourcesRpcRequestOptions,\n ): PresentationRpcResponse<ContentSourcesRpcResult> {\n return this.makeRequest(token, \"getContentSources\", requestOptions, async (options) => {\n const result = await this.getManager(requestOptions.clientId).getContentSources(options);\n const classesMap = {};\n const selectClasses = result.map((sci) => SelectClassInfo.toCompressedJSON(sci, classesMap));\n return { sources: selectClasses, classesMap };\n });\n }\n\n public override async getContentDescriptor(\n token: IModelRpcProps,\n requestOptions: ContentDescriptorRpcRequestOptions,\n ): PresentationRpcResponse<DescriptorJSON | undefined> {\n return this.makeRequest(token, \"getContentDescriptor\", requestOptions, async (options) => {\n options = {\n ...options,\n contentFlags: (options.contentFlags ?? 0) | DESCRIPTOR_ONLY_CONTENT_FLAG, // always append the \"descriptor only\" flag when handling request from the frontend\n keys: KeySet.fromJSON(options.keys),\n };\n // Here we send a plain JSON string but we will parse it to DescriptorJSON on the frontend. This way we are\n // bypassing unnecessary deserialization and serialization.\n return Presentation.getManager(requestOptions.clientId)[_presentation_manager_detail].getContentDescriptor(options) as unknown as\n | DescriptorJSON\n | undefined;\n });\n }\n\n public override async getContentSetSize(token: IModelRpcProps, requestOptions: ContentRpcRequestOptions): PresentationRpcResponse<number> {\n return this.makeRequest(token, \"getContentSetSize\", requestOptions, async (options) => {\n options = {\n ...options,\n keys: KeySet.fromJSON(options.keys),\n };\n return this.getManager(requestOptions.clientId).getContentSetSize(options);\n });\n }\n\n public override async getPagedContent(\n token: IModelRpcProps,\n requestOptions: Paged<ContentRpcRequestOptions>,\n ): PresentationRpcResponse<{ descriptor: DescriptorJSON; contentSet: PagedResponse<ItemJSON> } | undefined> {\n return this.makeRequest(token, \"getPagedContent\", requestOptions, async (options) => {\n options = enforceValidPageSize({\n ...options,\n keys: KeySet.fromJSON(options.keys),\n });\n\n const [size, content] = await Promise.all([\n this.getManager(requestOptions.clientId).getContentSetSize(options),\n this.getManager(requestOptions.clientId)[_presentation_manager_detail].getContent(options),\n ]);\n\n if (!content) {\n return undefined;\n }\n\n return {\n descriptor: content.descriptor.toJSON(),\n contentSet: {\n total: size,\n items: content.contentSet.map((i) => i.toJSON()),\n },\n };\n });\n }\n\n public override async getPagedContentSet(\n token: IModelRpcProps,\n requestOptions: Paged<ContentRpcRequestOptions>,\n ): PresentationRpcResponse<PagedResponse<ItemJSON>> {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const response = await this.getPagedContent(token, requestOptions);\n if (response.statusCode !== PresentationStatus.Success) {\n return this.errorResponse(response.statusCode, response.errorMessage, response.diagnostics);\n }\n if (!response.result) {\n return this.errorResponse(PresentationStatus.Error, `Failed to get content set (received a success response with empty result)`, response.diagnostics);\n }\n return {\n ...response,\n result: response.result.contentSet,\n };\n }\n\n public override async getElementProperties(\n token: IModelRpcProps,\n requestOptions: SingleElementPropertiesRpcRequestOptions,\n ): PresentationRpcResponse<ElementProperties | undefined> {\n return this.makeRequest(token, \"getElementProperties\", { ...requestOptions }, async (options) => {\n const { clientId, ...restOptions } = options;\n return this.getManager(clientId).getElementProperties(restOptions);\n });\n }\n\n public override async getPagedDistinctValues(\n token: IModelRpcProps,\n requestOptions: DistinctValuesRpcRequestOptions,\n ): PresentationRpcResponse<PagedResponse<DisplayValueGroup>> {\n return this.makeRequest(token, \"getPagedDistinctValues\", requestOptions, async (options) => {\n options = enforceValidPageSize({\n ...options,\n keys: KeySet.fromJSON(options.keys),\n });\n return this.getManager(requestOptions.clientId)[_presentation_manager_detail].getPagedDistinctValues(options);\n });\n }\n\n public override async getContentInstanceKeys(\n token: IModelRpcProps,\n requestOptions: ContentInstanceKeysRpcRequestOptions,\n ): PresentationRpcResponse<{ total: number; items: KeySetJSON }> {\n return this.makeRequest(token, \"getContentInstanceKeys\", requestOptions, async (options) => {\n const { displayType, ...optionsNoDisplayType } = options;\n options = enforceValidPageSize(\n {\n ...optionsNoDisplayType,\n keys: KeySet.fromJSON(optionsNoDisplayType.keys),\n descriptor: {\n displayType,\n contentFlags: ContentFlags.KeysOnly,\n },\n },\n MAX_ALLOWED_KEYS_PAGE_SIZE,\n );\n\n const [size, content] = await Promise.all([\n this.getManager(requestOptions.clientId).getContentSetSize(options),\n this.getManager(requestOptions.clientId)[_presentation_manager_detail].getContent(options),\n ]);\n\n if (size === 0 || !content) {\n return { total: 0, items: new KeySet().toJSON() };\n }\n\n return {\n total: size,\n items: content.contentSet.reduce((keys, item) => keys.add(item.primaryKeys), new KeySet()).toJSON(),\n };\n });\n }\n\n public override async getDisplayLabelDefinition(\n token: IModelRpcProps,\n requestOptions: DisplayLabelRpcRequestOptions,\n ): PresentationRpcResponse<LabelDefinition> {\n return this.makeRequest(token, \"getDisplayLabelDefinition\", requestOptions, async (options) => {\n const label = await this.getManager(requestOptions.clientId)[_presentation_manager_detail].getDisplayLabelDefinition(options);\n return label;\n });\n }\n\n public override async getPagedDisplayLabelDefinitions(\n token: IModelRpcProps,\n requestOptions: DisplayLabelsRpcRequestOptions,\n ): PresentationRpcResponse<PagedResponse<LabelDefinition>> {\n const pageOpts = enforceValidPageSize({ paging: { start: 0, size: requestOptions.keys.length } });\n if (pageOpts.paging.size < requestOptions.keys.length) {\n requestOptions.keys.splice(pageOpts.paging.size);\n }\n return this.makeRequest(token, \"getPagedDisplayLabelDefinitions\", requestOptions, async (options) => {\n const labels = await this.getManager(requestOptions.clientId)[_presentation_manager_detail].getDisplayLabelDefinitions({\n ...options,\n keys: options.keys,\n });\n return {\n total: options.keys.length,\n items: labels,\n };\n });\n }\n\n /* eslint-disable @typescript-eslint/no-deprecated */\n public override async getSelectionScopes(token: IModelRpcProps, requestOptions: SelectionScopeRpcRequestOptions): PresentationRpcResponse<SelectionScope[]> {\n return this.makeRequest(token, \"getSelectionScopes\", requestOptions, async (options) =>\n this.getManager(requestOptions.clientId).getSelectionScopes(options),\n );\n }\n\n public override async computeSelection(token: IModelRpcProps, requestOptions: ComputeSelectionRpcRequestOptions): PresentationRpcResponse<KeySetJSON> {\n return this.makeRequest(token, \"computeSelection\", requestOptions, async (options) => {\n const keys = await this.getManager(requestOptions.clientId).computeSelection(options);\n return keys.toJSON();\n });\n }\n /* eslint-enable @typescript-eslint/no-deprecated */\n}\n\nconst enforceValidPageSize = <TOptions extends Paged<object>>(\n requestOptions: TOptions,\n maxPageSize = MAX_ALLOWED_PAGE_SIZE,\n): TOptions & { paging: PageOptions } => {\n const validPageSize = getValidPageSize(requestOptions.paging?.size, maxPageSize);\n if (!requestOptions.paging || requestOptions.paging.size !== validPageSize) {\n return { ...requestOptions, paging: { ...requestOptions.paging, size: validPageSize } };\n }\n return requestOptions as TOptions & { paging: PageOptions };\n};\n\nconst getValidPageSize = (size: number | undefined, maxPageSize: number) => {\n const requestedSize = size ?? 0;\n return requestedSize === 0 || requestedSize > maxPageSize ? maxPageSize : requestedSize;\n};\n\n// not testing temporary solution\n/* c8 ignore start */\nfunction createStatusCategoryHandler() {\n return (e: Error) => {\n if (e instanceof PresentationError) {\n switch (e.errorNumber) {\n case PresentationStatus.NotInitialized:\n return new (class extends ErrorCategory {\n public name = \"Internal server error\";\n public code = 500;\n })();\n case PresentationStatus.Canceled:\n return new (class extends SuccessCategory {\n public name = \"Cancelled\";\n public code = 204;\n })();\n case PresentationStatus.ResultSetTooLarge:\n return new (class extends ErrorCategory {\n public name = \"Result set is too large\";\n public code = 413;\n })();\n case PresentationStatus.Error:\n case PresentationStatus.InvalidArgument:\n return new (class extends ErrorCategory {\n public name = \"Invalid request props\";\n public code = 422;\n })();\n }\n }\n return undefined;\n };\n}\n/* c8 ignore end */\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionScopesHelper.js","sourceRoot":"","sources":["../../../src/presentation-backend/SelectionScopesHelper.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAAqD;AACrD;;GAEG;;;AAGH,sDAAkE;AAClE,oDAAiD;AACjD,oEAQoC;AACpC,yCAA2C;AAE3C;;;;;GAKG;AACH,MAAa,qBAAqB;IAChC,oBAAoB;IACpB,gBAAwB,CAAC;IAElB,MAAM,CAAC,kBAAkB;QAC9B,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,KAAa,EAAE,WAAmB,EAAkB,EAAE,CAAC,CAAC;YACrG,EAAE,EAAE,OAAO;YACX,KAAK;YACL,WAAW;SACZ,CAAC,CAAC;QACH,OAAO;YACL,oBAAoB,CAAC,SAAS,EAAE,SAAS,EAAE,2BAA2B,CAAC;YACvE,oBAAoB,CAAC,UAAU,EAAE,UAAU,EAAE,qCAAqC,CAAC;YACnF,oBAAoB,CAAC,cAAc,EAAE,cAAc,EAAE,iDAAiD,CAAC;YACvG,gHAAgH;YAChH,wGAAwG;YACxG,+FAA+F;SAChG,CAAC;IACJ,CAAC;IAEO,MAAM,CAAC,aAAa,CAAC,MAAgB,EAAE,SAAqB,EAAE,aAAqB;QACzF,IAAI,MAAM,GAAG,SAAS,CAAC;QACvB,IAAI,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;QACtE,OAAO,QAAQ,IAAI,aAAa,KAAK,CAAC,EAAE,CAAC;YACvC,MAAM,GAAG,QAAQ,CAAC;YAClB,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;YAClE,EAAE,aAAa,CAAC;QAClB,CAAC;QACD,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QACD,MAAM,IAAI,uCAAiB,CAAC,wCAAkB,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IAC7E,CAAC;CACF;AA5ND,sDA4NC;AAED,KAAK,UAAU,qBAAqB,CAAC,GAAc,EAAE,QAA2C;IAC9F,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,mBAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC7E,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/* eslint-disable @typescript-eslint/no-deprecated */\n/** @packageDocumentation\n * @module Core\n */\n\nimport { GeometricElement, IModelDb } from \"@itwin/core-backend\";\nimport { Id64, Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport { QueryBinder } from \"@itwin/core-common\";\nimport {\n ComputeSelectionRequestOptions,\n ElementSelectionScopeProps,\n InstanceKey,\n KeySet,\n PresentationError,\n PresentationStatus,\n SelectionScope,\n} from \"@itwin/presentation-common\";\nimport { getElementKey } from \"./Utils.js\";\n\n/**\n * Contains helper methods for computing selection scopes. Will get removed\n * once rules-driven scopes are implemented.\n *\n * @internal\n */\nexport class SelectionScopesHelper {\n /* c8 ignore next */\n private constructor() { }\n\n public static getSelectionScopes(): SelectionScope[] {\n const createSelectionScope = (scopeId: string, label: string, description: string): SelectionScope => ({\n id: scopeId,\n label,\n description,\n });\n return [\n createSelectionScope(\"element\", \"Element\", \"Select the picked element\"),\n createSelectionScope(\"assembly\", \"Assembly\", \"Select parent of the picked element\"),\n createSelectionScope(\"top-assembly\", \"Top Assembly\", \"Select the topmost parent of the picked element\"),\n // WIP: temporarily comment-out \"category\" and \"model\" scopes since we can't hilite contents of them fast enough\n // createSelectionScope(\"category\", \"Category\", \"Select all elements in the picked element's category\"),\n // createSelectionScope(\"model\", \"Model\", \"Select all elements in the picked element's model\"),\n ];\n }\n\n private static getElementKey(iModel: IModelDb, elementId: Id64String, ancestorLevel: number) {\n let currId = elementId;\n let parentId = iModel.elements.tryGetElementProps(currId)?.parent?.id;\n while (parentId && ancestorLevel !== 0) {\n currId = parentId;\n parentId = iModel.elements.tryGetElementProps(currId)?.parent?.id;\n --ancestorLevel;\n }\n return getElementKey(iModel, currId);\n }\n\n private static async computeElementSelection(iModel: IModelDb, elementIds: Id64String[], ancestorLevel: number) {\n const parentKeys = new KeySet();\n await forEachNonTransientId(elementIds, async (id) => {\n const key = this.getElementKey(iModel, id, ancestorLevel);\n key && parentKeys.add(key);\n });\n return parentKeys;\n }\n\n private static async computeCategorySelection(iModel: IModelDb, ids: Id64String[]) {\n const categoryKeys = new KeySet();\n await forEachNonTransientId(ids, async (id) => {\n const el = iModel.elements.tryGetElement<GeometricElement>(id);\n const category = el?.category ? iModel.elements.tryGetElementProps(el.category) : undefined;\n if (category) {\n categoryKeys.add({ className: category.classFullName, id: category.id! });\n }\n });\n return categoryKeys;\n }\n\n private static async computeModelSelection(iModel: IModelDb, ids: Id64String[]) {\n const modelKeys = new KeySet();\n await forEachNonTransientId(ids, async (id) => {\n const el = iModel.elements.tryGetElementProps(id);\n const model = el ? iModel.models.tryGetModelProps(el.model) : undefined;\n if (model) {\n modelKeys.add({ className: model.classFullName, id: model.id! });\n }\n });\n return modelKeys;\n }\n\n private static async getRelatedFunctionalElementKey(imodel: IModelDb, graphicalElementId: Id64String): Promise<InstanceKey | undefined> {\n const query = `\n SELECT funcSchemaDef.Name || '.' || funcClassDef.Name funcElClassName, fe.ECInstanceId funcElId\n FROM bis.Element e\n LEFT JOIN func.PhysicalElementFulfillsFunction rel1 ON rel1.SourceECInstanceId = e.ECInstanceId\n LEFT JOIN func.DrawingGraphicRepresentsFunctionalElement rel2 ON rel2.SourceECInstanceId = e.ECInstanceId\n LEFT JOIN func.FunctionalElement fe ON fe.ECInstanceId IN (rel1.TargetECInstanceId, rel2.TargetECInstanceId)\n INNER JOIN meta.ECClassDef funcClassDef ON funcClassDef.ECInstanceId = fe.ECClassId\n INNER JOIN meta.ECSchemaDef funcSchemaDef ON funcSchemaDef.ECInstanceId = funcClassDef.Schema.Id\n WHERE e.ECInstanceId = ?\n `;\n\n const bindings = new QueryBinder();\n bindings.bindId(1, graphicalElementId);\n\n for await (const row of imodel.createQueryReader(query, bindings)) {\n if (row.funcElClassName && row.funcElId) {\n return { className: row.funcElClassName.replace(\".\", \":\"), id: row.funcElId };\n }\n }\n return undefined;\n }\n\n private static async findFirstRelatedFunctionalElementKey(imodel: IModelDb, graphicalElementId: Id64String): Promise<InstanceKey | undefined> {\n let currId: Id64String | undefined = graphicalElementId;\n while (currId) {\n const relatedFunctionalKey = await this.getRelatedFunctionalElementKey(imodel, currId);\n if (relatedFunctionalKey) {\n return relatedFunctionalKey;\n }\n currId = imodel.elements.tryGetElementProps(currId)?.parent?.id;\n }\n return undefined;\n }\n\n private static async elementClassDerivesFrom(imodel: IModelDb, elementId: Id64String, baseClassFullName: string): Promise<boolean> {\n const query = `\n SELECT 1\n FROM bis.Element e\n INNER JOIN meta.ClassHasAllBaseClasses baseClassRels ON baseClassRels.SourceECInstanceId = e.ECClassId\n INNER JOIN meta.ECClassDef baseClass ON baseClass.ECInstanceId = baseClassRels.TargetECInstanceId\n INNER JOIN meta.ECSchemaDef baseSchema ON baseSchema.ECInstanceId = baseClass.Schema.Id\n WHERE e.ECInstanceId = ? AND (baseSchema.Name || ':' || baseClass.Name) = ?\n `;\n\n const bindings = new QueryBinder();\n bindings.bindId(1, elementId);\n bindings.bindString(2, baseClassFullName);\n\n for await (const _ of imodel.createQueryReader(query, bindings)) {\n return true;\n }\n return false;\n }\n\n private static async computeFunctionalElementSelection(iModel: IModelDb, ids: Id64String[]) {\n const keys = new KeySet();\n await forEachNonTransientId(ids, async (id) => {\n const is3d = await this.elementClassDerivesFrom(iModel, id, \"BisCore.GeometricElement3d\");\n if (!is3d) {\n // if the input is not a 3d element, we try to find the first related functional element\n const firstFunctionalKey = await this.findFirstRelatedFunctionalElementKey(iModel, id);\n if (firstFunctionalKey) {\n keys.add(firstFunctionalKey);\n return;\n }\n }\n let keyToAdd: InstanceKey | undefined;\n if (is3d) {\n // if we're computing scope for a 3d element, try to switch to its related functional element\n keyToAdd = await this.getRelatedFunctionalElementKey(iModel, id);\n }\n if (!keyToAdd) {\n keyToAdd = getElementKey(iModel, id);\n }\n keyToAdd && keys.add(keyToAdd);\n });\n return keys;\n }\n\n private static async computeFunctionalAssemblySelection(iModel: IModelDb, ids: Id64String[]) {\n const keys = new KeySet();\n await forEachNonTransientId(ids, async (id) => {\n let idToGetAssemblyFor = id;\n const is3d = await this.elementClassDerivesFrom(iModel, id, \"BisCore.GeometricElement3d\");\n if (!is3d) {\n // if the input is not a 3d element, we try to find the first related functional element\n const firstFunctionalKey = await this.findFirstRelatedFunctionalElementKey(iModel, id);\n if (firstFunctionalKey) {\n idToGetAssemblyFor = firstFunctionalKey.id;\n }\n }\n // find the assembly of either the given element or the functional element\n const assemblyKey = this.getElementKey(iModel, idToGetAssemblyFor, 1);\n let keyToAdd = assemblyKey;\n if (is3d && keyToAdd) {\n // if we're computing scope for a 3d element, try to switch to its related functional element\n const relatedFunctionalKey = await this.getRelatedFunctionalElementKey(iModel, keyToAdd.id);\n if (relatedFunctionalKey) {\n keyToAdd = relatedFunctionalKey;\n }\n }\n keyToAdd && keys.add(keyToAdd);\n });\n return keys;\n }\n\n private static async computeFunctionalTopAssemblySelection(iModel: IModelDb, ids: Id64String[]) {\n const keys = new KeySet();\n await forEachNonTransientId(ids, async (id) => {\n let idToGetAssemblyFor = id;\n const is3d = await this.elementClassDerivesFrom(iModel, id, \"BisCore.GeometricElement3d\");\n if (!is3d) {\n // if the input is not a 3d element, we try to find the first related functional element\n const firstFunctionalKey = await this.findFirstRelatedFunctionalElementKey(iModel, id);\n if (firstFunctionalKey) {\n idToGetAssemblyFor = firstFunctionalKey.id;\n }\n }\n // find the top assembly of either the given element or the functional element\n const topAssemblyKey = this.getElementKey(iModel, idToGetAssemblyFor, Number.MAX_SAFE_INTEGER);\n let keyToAdd = topAssemblyKey;\n if (is3d && keyToAdd) {\n // if we're computing scope for a 3d element, try to switch to its related functional element\n const relatedFunctionalKey = await this.getRelatedFunctionalElementKey(iModel, keyToAdd.id);\n if (relatedFunctionalKey) {\n keyToAdd = relatedFunctionalKey;\n }\n }\n keyToAdd && keys.add(keyToAdd);\n });\n return keys;\n }\n\n public static async computeSelection({ imodel, scope, elementIds }: ComputeSelectionRequestOptions<IModelDb>): Promise<KeySet> {\n switch (scope.id) {\n case \"element\":\n return this.computeElementSelection(imodel, elementIds, (scope as ElementSelectionScopeProps).ancestorLevel ?? 0);\n case \"assembly\":\n return this.computeElementSelection(imodel, elementIds, 1);\n case \"top-assembly\":\n return this.computeElementSelection(imodel, elementIds, Number.MAX_SAFE_INTEGER);\n case \"category\":\n return this.computeCategorySelection(imodel, elementIds);\n case \"model\":\n return this.computeModelSelection(imodel, elementIds);\n case \"functional\":\n case \"functional-element\":\n return this.computeFunctionalElementSelection(imodel, elementIds);\n case \"functional-assembly\":\n return this.computeFunctionalAssemblySelection(imodel, elementIds);\n case \"functional-top-assembly\":\n return this.computeFunctionalTopAssemblySelection(imodel, elementIds);\n }\n throw new PresentationError(PresentationStatus.InvalidArgument, \"scopeId\");\n }\n}\n\nasync function forEachNonTransientId(ids: Id64Array, callback: (id: Id64String) => Promise<void>): Promise<void> {\n await Promise.all(ids.filter((id) => !Id64.isTransient(id)).map(callback));\n}\n"]}
1
+ {"version":3,"file":"SelectionScopesHelper.js","sourceRoot":"","sources":["../../../src/presentation-backend/SelectionScopesHelper.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAAqD;AACrD;;GAEG;;;AAGH,sDAAkE;AAClE,oDAAiD;AACjD,oEAQoC;AACpC,yCAA2C;AAE3C;;;;;GAKG;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GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC7E,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/* eslint-disable @typescript-eslint/no-deprecated */\n/** @packageDocumentation\n * @module Core\n */\n\nimport { GeometricElement, IModelDb } from \"@itwin/core-backend\";\nimport { Id64, Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport { QueryBinder } from \"@itwin/core-common\";\nimport {\n ComputeSelectionRequestOptions,\n ElementSelectionScopeProps,\n InstanceKey,\n KeySet,\n PresentationError,\n PresentationStatus,\n SelectionScope,\n} from \"@itwin/presentation-common\";\nimport { getElementKey } from \"./Utils.js\";\n\n/**\n * Contains helper methods for computing selection scopes. Will get removed\n * once rules-driven scopes are implemented.\n *\n * @internal\n */\nexport class SelectionScopesHelper {\n /* c8 ignore next */\n private constructor() {}\n\n public static getSelectionScopes(): SelectionScope[] {\n const createSelectionScope = (scopeId: string, label: string, description: string): SelectionScope => ({\n id: scopeId,\n label,\n description,\n });\n return [\n createSelectionScope(\"element\", \"Element\", \"Select the picked element\"),\n createSelectionScope(\"assembly\", \"Assembly\", \"Select parent of the picked element\"),\n createSelectionScope(\"top-assembly\", \"Top Assembly\", \"Select the topmost parent of the picked element\"),\n // WIP: temporarily comment-out \"category\" and \"model\" scopes since we can't hilite contents of them fast enough\n // createSelectionScope(\"category\", \"Category\", \"Select all elements in the picked element's category\"),\n // createSelectionScope(\"model\", \"Model\", \"Select all elements in the picked element's model\"),\n ];\n }\n\n private static getElementKey(iModel: IModelDb, elementId: Id64String, ancestorLevel: number) {\n let currId = elementId;\n let parentId = iModel.elements.tryGetElementProps(currId)?.parent?.id;\n while (parentId && ancestorLevel !== 0) {\n currId = parentId;\n parentId = iModel.elements.tryGetElementProps(currId)?.parent?.id;\n --ancestorLevel;\n }\n return getElementKey(iModel, currId);\n }\n\n private static async computeElementSelection(iModel: IModelDb, elementIds: Id64String[], ancestorLevel: number) {\n const parentKeys = new KeySet();\n await forEachNonTransientId(elementIds, async (id) => {\n const key = this.getElementKey(iModel, id, ancestorLevel);\n key && parentKeys.add(key);\n });\n return parentKeys;\n }\n\n private static async computeCategorySelection(iModel: IModelDb, ids: Id64String[]) {\n const categoryKeys = new KeySet();\n await forEachNonTransientId(ids, async (id) => {\n const el = iModel.elements.tryGetElement<GeometricElement>(id);\n const category = el?.category ? iModel.elements.tryGetElementProps(el.category) : undefined;\n if (category) {\n categoryKeys.add({ className: category.classFullName, id: category.id! });\n }\n });\n return categoryKeys;\n }\n\n private static async computeModelSelection(iModel: IModelDb, ids: Id64String[]) {\n const modelKeys = new KeySet();\n await forEachNonTransientId(ids, async (id) => {\n const el = iModel.elements.tryGetElementProps(id);\n const model = el ? iModel.models.tryGetModelProps(el.model) : undefined;\n if (model) {\n modelKeys.add({ className: model.classFullName, id: model.id! });\n }\n });\n return modelKeys;\n }\n\n private static async getRelatedFunctionalElementKey(imodel: IModelDb, graphicalElementId: Id64String): Promise<InstanceKey | undefined> {\n const query = `\n SELECT funcSchemaDef.Name || '.' || funcClassDef.Name funcElClassName, fe.ECInstanceId funcElId\n FROM bis.Element e\n LEFT JOIN func.PhysicalElementFulfillsFunction rel1 ON rel1.SourceECInstanceId = e.ECInstanceId\n LEFT JOIN func.DrawingGraphicRepresentsFunctionalElement rel2 ON rel2.SourceECInstanceId = e.ECInstanceId\n LEFT JOIN func.FunctionalElement fe ON fe.ECInstanceId IN (rel1.TargetECInstanceId, rel2.TargetECInstanceId)\n INNER JOIN meta.ECClassDef funcClassDef ON funcClassDef.ECInstanceId = fe.ECClassId\n INNER JOIN meta.ECSchemaDef funcSchemaDef ON funcSchemaDef.ECInstanceId = funcClassDef.Schema.Id\n WHERE e.ECInstanceId = ?\n `;\n\n const bindings = new QueryBinder();\n bindings.bindId(1, graphicalElementId);\n\n for await (const row of imodel.createQueryReader(query, bindings)) {\n if (row.funcElClassName && row.funcElId) {\n return { className: row.funcElClassName.replace(\".\", \":\"), id: row.funcElId };\n }\n }\n return undefined;\n }\n\n private static async findFirstRelatedFunctionalElementKey(imodel: IModelDb, graphicalElementId: Id64String): Promise<InstanceKey | undefined> {\n let currId: Id64String | undefined = graphicalElementId;\n while (currId) {\n const relatedFunctionalKey = await this.getRelatedFunctionalElementKey(imodel, currId);\n if (relatedFunctionalKey) {\n return relatedFunctionalKey;\n }\n currId = imodel.elements.tryGetElementProps(currId)?.parent?.id;\n }\n return undefined;\n }\n\n private static async elementClassDerivesFrom(imodel: IModelDb, elementId: Id64String, baseClassFullName: string): Promise<boolean> {\n const query = `\n SELECT 1\n FROM bis.Element e\n INNER JOIN meta.ClassHasAllBaseClasses baseClassRels ON baseClassRels.SourceECInstanceId = e.ECClassId\n INNER JOIN meta.ECClassDef baseClass ON baseClass.ECInstanceId = baseClassRels.TargetECInstanceId\n INNER JOIN meta.ECSchemaDef baseSchema ON baseSchema.ECInstanceId = baseClass.Schema.Id\n WHERE e.ECInstanceId = ? AND (baseSchema.Name || ':' || baseClass.Name) = ?\n `;\n\n const bindings = new QueryBinder();\n bindings.bindId(1, elementId);\n bindings.bindString(2, baseClassFullName);\n\n for await (const _ of imodel.createQueryReader(query, bindings)) {\n return true;\n }\n return false;\n }\n\n private static async computeFunctionalElementSelection(iModel: IModelDb, ids: Id64String[]) {\n const keys = new KeySet();\n await forEachNonTransientId(ids, async (id) => {\n const is3d = await this.elementClassDerivesFrom(iModel, id, \"BisCore.GeometricElement3d\");\n if (!is3d) {\n // if the input is not a 3d element, we try to find the first related functional element\n const firstFunctionalKey = await this.findFirstRelatedFunctionalElementKey(iModel, id);\n if (firstFunctionalKey) {\n keys.add(firstFunctionalKey);\n return;\n }\n }\n let keyToAdd: InstanceKey | undefined;\n if (is3d) {\n // if we're computing scope for a 3d element, try to switch to its related functional element\n keyToAdd = await this.getRelatedFunctionalElementKey(iModel, id);\n }\n if (!keyToAdd) {\n keyToAdd = getElementKey(iModel, id);\n }\n keyToAdd && keys.add(keyToAdd);\n });\n return keys;\n }\n\n private static async computeFunctionalAssemblySelection(iModel: IModelDb, ids: Id64String[]) {\n const keys = new KeySet();\n await forEachNonTransientId(ids, async (id) => {\n let idToGetAssemblyFor = id;\n const is3d = await this.elementClassDerivesFrom(iModel, id, \"BisCore.GeometricElement3d\");\n if (!is3d) {\n // if the input is not a 3d element, we try to find the first related functional element\n const firstFunctionalKey = await this.findFirstRelatedFunctionalElementKey(iModel, id);\n if (firstFunctionalKey) {\n idToGetAssemblyFor = firstFunctionalKey.id;\n }\n }\n // find the assembly of either the given element or the functional element\n const assemblyKey = this.getElementKey(iModel, idToGetAssemblyFor, 1);\n let keyToAdd = assemblyKey;\n if (is3d && keyToAdd) {\n // if we're computing scope for a 3d element, try to switch to its related functional element\n const relatedFunctionalKey = await this.getRelatedFunctionalElementKey(iModel, keyToAdd.id);\n if (relatedFunctionalKey) {\n keyToAdd = relatedFunctionalKey;\n }\n }\n keyToAdd && keys.add(keyToAdd);\n });\n return keys;\n }\n\n private static async computeFunctionalTopAssemblySelection(iModel: IModelDb, ids: Id64String[]) {\n const keys = new KeySet();\n await forEachNonTransientId(ids, async (id) => {\n let idToGetAssemblyFor = id;\n const is3d = await this.elementClassDerivesFrom(iModel, id, \"BisCore.GeometricElement3d\");\n if (!is3d) {\n // if the input is not a 3d element, we try to find the first related functional element\n const firstFunctionalKey = await this.findFirstRelatedFunctionalElementKey(iModel, id);\n if (firstFunctionalKey) {\n idToGetAssemblyFor = firstFunctionalKey.id;\n }\n }\n // find the top assembly of either the given element or the functional element\n const topAssemblyKey = this.getElementKey(iModel, idToGetAssemblyFor, Number.MAX_SAFE_INTEGER);\n let keyToAdd = topAssemblyKey;\n if (is3d && keyToAdd) {\n // if we're computing scope for a 3d element, try to switch to its related functional element\n const relatedFunctionalKey = await this.getRelatedFunctionalElementKey(iModel, keyToAdd.id);\n if (relatedFunctionalKey) {\n keyToAdd = relatedFunctionalKey;\n }\n }\n keyToAdd && keys.add(keyToAdd);\n });\n return keys;\n }\n\n public static async computeSelection({ imodel, scope, elementIds }: ComputeSelectionRequestOptions<IModelDb>): Promise<KeySet> {\n switch (scope.id) {\n case \"element\":\n return this.computeElementSelection(imodel, elementIds, (scope as ElementSelectionScopeProps).ancestorLevel ?? 0);\n case \"assembly\":\n return this.computeElementSelection(imodel, elementIds, 1);\n case \"top-assembly\":\n return this.computeElementSelection(imodel, elementIds, Number.MAX_SAFE_INTEGER);\n case \"category\":\n return this.computeCategorySelection(imodel, elementIds);\n case \"model\":\n return this.computeModelSelection(imodel, elementIds);\n case \"functional\":\n case \"functional-element\":\n return this.computeFunctionalElementSelection(imodel, elementIds);\n case \"functional-assembly\":\n return this.computeFunctionalAssemblySelection(imodel, elementIds);\n case \"functional-top-assembly\":\n return this.computeFunctionalTopAssemblySelection(imodel, elementIds);\n }\n throw new PresentationError(PresentationStatus.InvalidArgument, \"scopeId\");\n }\n}\n\nasync function forEachNonTransientId(ids: Id64Array, callback: (id: Id64String) => Promise<void>): Promise<void> {\n await Promise.all(ids.filter((id) => !Id64.isTransient(id)).map(callback));\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/Utils.ts"],"names":[],"mappings":"AAKA;;GAEG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACL,WAAW,EAEX,kBAAkB,EAClB,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAQpC,gBAAgB;AAChB,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,UAc/C;AAED,gBAAgB;AAChB,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,GAAG,WAAW,GAAG,SAAS,CAGvF;AAED,gBAAgB;AAChB,wBAAgB,gBAAgB,CAAC,OAAO,CAAC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AqB,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAA,uCAA4B,EAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAChI,IAAI,kBAAkB,IAAI,qBAAqB,EAAE,CAAC;gBAChD,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACpD,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/* eslint-disable @typescript-eslint/ban-ts-comment */\n/** @packageDocumentation\n * @module Core\n */\n\nimport { parse as parseVersion } from \"semver\";\nimport { IModelDb } from \"@itwin/core-backend\";\nimport { Id64String } from \"@itwin/core-bentley\";\nimport {\n Diagnostics,\n DiagnosticsLogEntry,\n DiagnosticsOptions,\n InstanceKey,\n} from \"@itwin/presentation-common\";\nimport {\n combineDiagnosticsSeverities,\n compareDiagnosticsSeverities,\n} from \"@itwin/presentation-common/internal\";\n// @ts-ignore TS complains about `with` in CJS builds, but not ESM\nimport presentationStrings from \"@itwin/presentation-common/locales/en/Presentation.json\" with { type: \"json\" };\n\n/** @internal */\nexport function getLocalizedStringEN(key: string) {\n let result: object | string = presentationStrings;\n const [namespace, identifier] = key.split(\":\", 2);\n if (namespace !== \"Presentation\") {\n return key;\n }\n const keySteps = identifier.split(\".\");\n for (const keyStep of keySteps) {\n if (typeof result !== \"object\" || keyStep in result === false) {\n return key;\n }\n result = result[keyStep as keyof typeof result];\n }\n return typeof result === \"string\" ? result : key;\n}\n\n/** @internal */\nexport function getElementKey(imodel: IModelDb, id: Id64String): InstanceKey | undefined {\n const className = imodel.elements.tryGetElementProps(id)?.classFullName;\n return className ? { className, id } : undefined;\n}\n\n/** @internal */\nexport function normalizeVersion(version?: string) {\n if (version) {\n const parsedVersion = parseVersion(version, true);\n if (parsedVersion) {\n return `${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch}`;\n }\n }\n return \"0.0.0\";\n}\n\n/**\n * A function that received request diagnostics and, optionally, request context.\n * @public\n */\nexport type BackendDiagnosticsHandler<TContext = any> = (logs: Diagnostics, requestContext?: TContext) => void;\n\n/**\n * Data structure for backend diagnostics options.\n * @public\n */\nexport interface BackendDiagnosticsOptions<TContext = any> extends DiagnosticsOptions {\n /**\n * An optional function to supply request context that'll be passed to [[handler]] when\n * it's called after the request is fulfilled.\n */\n requestContextSupplier?: () => TContext;\n\n /**\n * Request diagnostics handler function that is called after the request is fulfilled. The handler\n * receives request diagnostics as the first argument and, optionally, request context as the\n * second (see [[requestContextSupplier]]).\n */\n handler: BackendDiagnosticsHandler<TContext>;\n}\n\n/**\n * Data structure which contains backend diagnostics options.\n * @public\n */\nexport interface BackendDiagnosticsAttribute {\n /**\n * Backend diagnostics options.\n * @public\n */\n diagnostics?: BackendDiagnosticsOptions;\n}\n\n/** @internal */\nexport function combineDiagnosticsOptions(...options: Array<BackendDiagnosticsOptions | undefined>): DiagnosticsOptions | undefined {\n const combinedOptions: DiagnosticsOptions = {};\n options.forEach((d) => {\n if (!d) {\n return;\n }\n if (\n d.perf === true ||\n (typeof d.perf === \"object\" &&\n (!combinedOptions.perf || (typeof combinedOptions.perf === \"object\" && d.perf.minimumDuration < combinedOptions.perf.minimumDuration)))\n ) {\n combinedOptions.perf = d.perf;\n }\n const combinedDev = combineDiagnosticsSeverities(d.dev, combinedOptions.dev);\n if (combinedDev) {\n combinedOptions.dev = combinedDev;\n }\n const combinedEditor = combineDiagnosticsSeverities(d.editor, combinedOptions.editor);\n if (combinedEditor) {\n combinedOptions.editor = combinedEditor;\n }\n });\n return combinedOptions.dev || combinedOptions.editor || combinedOptions.perf ? combinedOptions : undefined;\n}\n\n/** @internal */\nexport function reportDiagnostics<TContext>(diagnostics: Diagnostics, options: BackendDiagnosticsOptions<TContext>, context?: TContext) {\n const stripped = diagnostics.logs ? stripDiagnostics(options, diagnostics.logs) : undefined;\n stripped && options.handler({ logs: stripped }, context);\n}\nfunction stripDiagnostics<TEntry extends DiagnosticsLogEntry>(options: DiagnosticsOptions, diagnostics: TEntry[]) {\n const stripped: TEntry[] = [];\n diagnostics.forEach((entry) => {\n if (DiagnosticsLogEntry.isScope(entry)) {\n const scopeLogs = stripDiagnostics(options, entry.logs ?? []);\n const strippedScope = { ...entry, logs: scopeLogs };\n if (!strippedScope.logs) {\n delete strippedScope.logs;\n }\n if (entry.duration !== undefined && (options.perf === true || (typeof options.perf === \"object\" && entry.duration >= options.perf.minimumDuration))) {\n stripped.push(strippedScope);\n } else if (scopeLogs) {\n delete strippedScope.duration;\n delete strippedScope.scopeCreateTimestamp;\n stripped.push(strippedScope);\n }\n } else {\n const matchesDevSeverity = entry.severity.dev && compareDiagnosticsSeverities(entry.severity.dev, options.dev) >= 0;\n const matchesEditorSeverity = entry.severity.editor && compareDiagnosticsSeverities(entry.severity.editor, options.editor) >= 0;\n if (matchesDevSeverity || matchesEditorSeverity) {\n stripped.push({ ...entry });\n }\n }\n });\n return stripped.length > 0 ? stripped : undefined;\n}\n"]}
1
+ {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/presentation-backend/Utils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,sDAAsD;AACtD;;GAEG;;;;;AAWH,oDAcC;AAGD,sCAGC;AAGD,4CAQC;AAwCD,8DAuBC;AAGD,8CAGC;AA7GD,mCAA+C;AAG/C,oEAA+G;AAC/G,kEAAiH;AACjH,kEAAkE;AAClE,gHAAgH;AAEhH,gBAAgB;AAChB,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,IAAI,MAAM,GAAoB,2BAAmB,CAAC;IAClD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,CAAC;YACpH,MAAM,qBAAqB,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAA,uCAA4B,EAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAChI,IAAI,kBAAkB,IAAI,qBAAqB,EAAE,CAAC;gBAChD,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACpD,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/* eslint-disable @typescript-eslint/ban-ts-comment */\n/** @packageDocumentation\n * @module Core\n */\n\nimport { parse as parseVersion } from \"semver\";\nimport { IModelDb } from \"@itwin/core-backend\";\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { Diagnostics, DiagnosticsLogEntry, DiagnosticsOptions, InstanceKey } from \"@itwin/presentation-common\";\nimport { combineDiagnosticsSeverities, compareDiagnosticsSeverities } from \"@itwin/presentation-common/internal\";\n// @ts-ignore TS complains about `with` in CJS builds, but not ESM\nimport presentationStrings from \"@itwin/presentation-common/locales/en/Presentation.json\" with { type: \"json\" };\n\n/** @internal */\nexport function getLocalizedStringEN(key: string) {\n let result: object | string = presentationStrings;\n const [namespace, identifier] = key.split(\":\", 2);\n if (namespace !== \"Presentation\") {\n return key;\n }\n const keySteps = identifier.split(\".\");\n for (const keyStep of keySteps) {\n if (typeof result !== \"object\" || keyStep in result === false) {\n return key;\n }\n result = result[keyStep as keyof typeof result];\n }\n return typeof result === \"string\" ? result : key;\n}\n\n/** @internal */\nexport function getElementKey(imodel: IModelDb, id: Id64String): InstanceKey | undefined {\n const className = imodel.elements.tryGetElementProps(id)?.classFullName;\n return className ? { className, id } : undefined;\n}\n\n/** @internal */\nexport function normalizeVersion(version?: string) {\n if (version) {\n const parsedVersion = parseVersion(version, true);\n if (parsedVersion) {\n return `${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch}`;\n }\n }\n return \"0.0.0\";\n}\n\n/**\n * A function that received request diagnostics and, optionally, request context.\n * @public\n */\nexport type BackendDiagnosticsHandler<TContext = any> = (logs: Diagnostics, requestContext?: TContext) => void;\n\n/**\n * Data structure for backend diagnostics options.\n * @public\n */\nexport interface BackendDiagnosticsOptions<TContext = any> extends DiagnosticsOptions {\n /**\n * An optional function to supply request context that'll be passed to [[handler]] when\n * it's called after the request is fulfilled.\n */\n requestContextSupplier?: () => TContext;\n\n /**\n * Request diagnostics handler function that is called after the request is fulfilled. The handler\n * receives request diagnostics as the first argument and, optionally, request context as the\n * second (see [[requestContextSupplier]]).\n */\n handler: BackendDiagnosticsHandler<TContext>;\n}\n\n/**\n * Data structure which contains backend diagnostics options.\n * @public\n */\nexport interface BackendDiagnosticsAttribute {\n /**\n * Backend diagnostics options.\n * @public\n */\n diagnostics?: BackendDiagnosticsOptions;\n}\n\n/** @internal */\nexport function combineDiagnosticsOptions(...options: Array<BackendDiagnosticsOptions | undefined>): DiagnosticsOptions | undefined {\n const combinedOptions: DiagnosticsOptions = {};\n options.forEach((d) => {\n if (!d) {\n return;\n }\n if (\n d.perf === true ||\n (typeof d.perf === \"object\" &&\n (!combinedOptions.perf || (typeof combinedOptions.perf === \"object\" && d.perf.minimumDuration < combinedOptions.perf.minimumDuration)))\n ) {\n combinedOptions.perf = d.perf;\n }\n const combinedDev = combineDiagnosticsSeverities(d.dev, combinedOptions.dev);\n if (combinedDev) {\n combinedOptions.dev = combinedDev;\n }\n const combinedEditor = combineDiagnosticsSeverities(d.editor, combinedOptions.editor);\n if (combinedEditor) {\n combinedOptions.editor = combinedEditor;\n }\n });\n return combinedOptions.dev || combinedOptions.editor || combinedOptions.perf ? combinedOptions : undefined;\n}\n\n/** @internal */\nexport function reportDiagnostics<TContext>(diagnostics: Diagnostics, options: BackendDiagnosticsOptions<TContext>, context?: TContext) {\n const stripped = diagnostics.logs ? stripDiagnostics(options, diagnostics.logs) : undefined;\n stripped && options.handler({ logs: stripped }, context);\n}\nfunction stripDiagnostics<TEntry extends DiagnosticsLogEntry>(options: DiagnosticsOptions, diagnostics: TEntry[]) {\n const stripped: TEntry[] = [];\n diagnostics.forEach((entry) => {\n if (DiagnosticsLogEntry.isScope(entry)) {\n const scopeLogs = stripDiagnostics(options, entry.logs ?? []);\n const strippedScope = { ...entry, logs: scopeLogs };\n if (!strippedScope.logs) {\n delete strippedScope.logs;\n }\n if (entry.duration !== undefined && (options.perf === true || (typeof options.perf === \"object\" && entry.duration >= options.perf.minimumDuration))) {\n stripped.push(strippedScope);\n } else if (scopeLogs) {\n delete strippedScope.duration;\n delete strippedScope.scopeCreateTimestamp;\n stripped.push(strippedScope);\n }\n } else {\n const matchesDevSeverity = entry.severity.dev && compareDiagnosticsSeverities(entry.severity.dev, options.dev) >= 0;\n const matchesEditorSeverity = entry.severity.editor && compareDiagnosticsSeverities(entry.severity.editor, options.editor) >= 0;\n if (matchesDevSeverity || matchesEditorSeverity) {\n stripped.push({ ...entry });\n }\n }\n });\n return stripped.length > 0 ? stripped : undefined;\n}\n"]}
@@ -27,4 +27,24 @@ Object.defineProperty(exports, "RulesetEmbedder", { enumerable: true, get: funct
27
27
  var BackendLoggerCategory_js_1 = require("./presentation-backend/BackendLoggerCategory.js");
28
28
  Object.defineProperty(exports, "PresentationBackendLoggerCategory", { enumerable: true, get: function () { return BackendLoggerCategory_js_1.PresentationBackendLoggerCategory; } });
29
29
  Object.defineProperty(exports, "PresentationBackendNativeLoggerCategory", { enumerable: true, get: function () { return BackendLoggerCategory_js_1.PresentationBackendNativeLoggerCategory; } });
30
+ const globalSymbolPresentationBackend = Symbol.for("itwin.presentation.backend.globals");
31
+ if (globalThis[globalSymbolPresentationBackend]) {
32
+ // Get the stack trace from when the module was first loaded
33
+ const firstLoadStack = globalThis[globalSymbolPresentationBackend].stack;
34
+ const error = new Error("Multiple @itwin/presentation-backend imports detected! This may happen if:\n" +
35
+ "- You have multiple versions of the package installed\n" +
36
+ "- Your bundling configuration is incorrect\n" +
37
+ "- You're importing from both ESM and CommonJS versions");
38
+ /* eslint-disable no-console */
39
+ console.error("Duplicate @itwin/presentation-backend import:", error);
40
+ console.error("First import occurred at:", firstLoadStack);
41
+ console.error("Current import occurred at:", error.stack);
42
+ /* eslint-enable no-console */
43
+ throw error;
44
+ }
45
+ else {
46
+ globalThis[globalSymbolPresentationBackend] = {
47
+ stack: new Error().stack,
48
+ };
49
+ }
30
50
  //# sourceMappingURL=presentation-backend.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"presentation-backend.js","sourceRoot":"","sources":["../../src/presentation-backend.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG;;;;;GAKG;AACH,0EAAwJ;AAA7D,+GAAA,YAAY,OAAA;AACvG,wFAauD;AAZrD,4HAAA,kBAAkB,OAAA;AAWlB,6HAAA,mBAAmB,OAAA;AAIrB,gFAAwH;AAAnE,qHAAA,eAAe,OAAA;AAGpE;;;;;GAKG;AACH,4FAA6I;AAApI,6IAAA,iCAAiC,OAAA;AAAE,mJAAA,uCAAuC,OAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/**\n * @module Core\n *\n * @docs-group-description Core\n * Common types used for retrieving presentation data from iModels.\n */\nexport { PresentationProps, MultiManagerPresentationProps, SingleManagerPresentationProps, Presentation } from \"./presentation-backend/Presentation.js\";\nexport {\n HierarchyCacheMode,\n HierarchyCacheConfig,\n MemoryHierarchyCacheConfig,\n DiskHierarchyCacheConfig,\n HybridCacheConfig,\n ContentCacheConfig,\n PresentationManagerCachingConfig,\n UnitSystemFormat,\n MultiElementPropertiesResponse,\n PresentationAssetsRootConfig,\n PresentationManagerProps,\n PresentationManager,\n} from \"./presentation-backend/PresentationManager.js\";\nexport { RulesetManager } from \"./presentation-backend/RulesetManager.js\";\nexport { RulesetVariablesManager } from \"./presentation-backend/RulesetVariablesManager.js\";\nexport { RulesetInsertOptions, RulesetEmbedderProps, RulesetEmbedder } from \"./presentation-backend/RulesetEmbedder.js\";\nexport { BackendDiagnosticsHandler, BackendDiagnosticsOptions, BackendDiagnosticsAttribute } from \"./presentation-backend/Utils.js\";\n\n/**\n * @module Logging\n *\n * @docs-group-description Logging\n * Types related to logging in this package.\n */\nexport { PresentationBackendLoggerCategory, PresentationBackendNativeLoggerCategory } from \"./presentation-backend/BackendLoggerCategory.js\";\n"]}
1
+ {"version":3,"file":"presentation-backend.js","sourceRoot":"","sources":["../../src/presentation-backend.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG;;;;;GAKG;AACH,0EAAwJ;AAA7D,+GAAA,YAAY,OAAA;AACvG,wFAauD;AAZrD,4HAAA,kBAAkB,OAAA;AAWlB,6HAAA,mBAAmB,OAAA;AAIrB,gFAAwH;AAAnE,qHAAA,eAAe,OAAA;AAGpE;;;;;GAKG;AACH,4FAA6I;AAApI,6IAAA,iCAAiC,OAAA;AAAE,mJAAA,uCAAuC,OAAA;AAEnF,MAAM,+BAA+B,GAAG,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;AACzF,IAAK,UAAkB,CAAC,+BAA+B,CAAC,EAAE,CAAC;IACzD,4DAA4D;IAC5D,MAAM,cAAc,GAAI,UAAkB,CAAC,+BAA+B,CAAC,CAAC,KAAK,CAAC;IAElF,MAAM,KAAK,GAAG,IAAI,KAAK,CACrB,8EAA8E;QAC5E,yDAAyD;QACzD,8CAA8C;QAC9C,wDAAwD,CAC3D,CAAC;IAEF,+BAA+B;IAC/B,OAAO,CAAC,KAAK,CAAC,+CAA+C,EAAE,KAAK,CAAC,CAAC;IACtE,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,cAAc,CAAC,CAAC;IAC3D,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1D,8BAA8B;IAE9B,MAAM,KAAK,CAAC;AACd,CAAC;KAAM,CAAC;IACL,UAAkB,CAAC,+BAA+B,CAAC,GAAG;QACrD,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC,KAAK;KACzB,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/**\n * @module Core\n *\n * @docs-group-description Core\n * Common types used for retrieving presentation data from iModels.\n */\nexport { PresentationProps, MultiManagerPresentationProps, SingleManagerPresentationProps, Presentation } from \"./presentation-backend/Presentation.js\";\nexport {\n HierarchyCacheMode,\n HierarchyCacheConfig,\n MemoryHierarchyCacheConfig,\n DiskHierarchyCacheConfig,\n HybridCacheConfig,\n ContentCacheConfig,\n PresentationManagerCachingConfig,\n UnitSystemFormat,\n MultiElementPropertiesResponse,\n PresentationAssetsRootConfig,\n PresentationManagerProps,\n PresentationManager,\n} from \"./presentation-backend/PresentationManager.js\";\nexport { RulesetManager } from \"./presentation-backend/RulesetManager.js\";\nexport { RulesetVariablesManager } from \"./presentation-backend/RulesetVariablesManager.js\";\nexport { RulesetInsertOptions, RulesetEmbedderProps, RulesetEmbedder } from \"./presentation-backend/RulesetEmbedder.js\";\nexport { BackendDiagnosticsHandler, BackendDiagnosticsOptions, BackendDiagnosticsAttribute } from \"./presentation-backend/Utils.js\";\n\n/**\n * @module Logging\n *\n * @docs-group-description Logging\n * Types related to logging in this package.\n */\nexport { PresentationBackendLoggerCategory, PresentationBackendNativeLoggerCategory } from \"./presentation-backend/BackendLoggerCategory.js\";\n\nconst globalSymbolPresentationBackend = Symbol.for(\"itwin.presentation.backend.globals\");\nif ((globalThis as any)[globalSymbolPresentationBackend]) {\n // Get the stack trace from when the module was first loaded\n const firstLoadStack = (globalThis as any)[globalSymbolPresentationBackend].stack;\n\n const error = new Error(\n \"Multiple @itwin/presentation-backend imports detected! This may happen if:\\n\" +\n \"- You have multiple versions of the package installed\\n\" +\n \"- Your bundling configuration is incorrect\\n\" +\n \"- You're importing from both ESM and CommonJS versions\",\n );\n\n /* eslint-disable no-console */\n console.error(\"Duplicate @itwin/presentation-backend import:\", error);\n console.error(\"First import occurred at:\", firstLoadStack);\n console.error(\"Current import occurred at:\", error.stack);\n /* eslint-enable no-console */\n\n throw error;\n} else {\n (globalThis as any)[globalSymbolPresentationBackend] = {\n stack: new Error().stack,\n };\n}"]}
@@ -40,23 +40,23 @@ export declare enum PresentationBackendNativeLoggerCategory {
40
40
  ECPresentation_RulesetVariables = "ECPresentation.RulesetVariables",
41
41
  ECPresentation_ECExpressions = "ECPresentation.ECExpressions",
42
42
  ECPresentation_Serialization = "ECPresentation.Serialization",
43
- /** @deprecated in 4.0. The logging namespace is not used anymore. */
43
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. The logging namespace is not used anymore. */
44
44
  ECPresentation_Localization = "ECPresentation.Localization",
45
- /** @deprecated in 4.0. Use [[ECPresentation]] */
45
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation]] */
46
46
  ECPresentation_RulesEngine = "ECPresentation.RulesEngine",
47
- /** @deprecated in 4.0. Use [[ECPresentation_Content]] */
47
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_Content]] */
48
48
  ECPresentation_RulesEngine_Content = "ECPresentation.Content",
49
- /** @deprecated in 4.0. The logging namespace is not used anymore. */
49
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. The logging namespace is not used anymore. */
50
50
  ECPresentation_RulesEngine_Localization = "ECPresentation.Localization",
51
- /** @deprecated in 4.0. Use [[ECPresentation_Hierarchies]] */
51
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_Hierarchies]] */
52
52
  ECPresentation_RulesEngine_Navigation = "ECPresentation.Navigation",
53
- /** @deprecated in 4.0. Use [[ECPresentation_Hierarchies_Cache]] */
53
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_Hierarchies_Cache]] */
54
54
  ECPresentation_RulesEngine_Navigation_Cache = "ECPresentation.Navigation.Cache",
55
- /** @deprecated in 4.0. Use [[ECPresentation_Tasks]] */
55
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_Tasks]] */
56
56
  ECPresentation_RulesEngine_Threads = "ECPresentation.Tasks",
57
- /** @deprecated in 4.0. Use [[ECPresentation_Update]] */
57
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_Update]] */
58
58
  ECPresentation_RulesEngine_Update = "ECPresentation.Update",
59
- /** @deprecated in 4.0. Use [[ECPresentation_RulesetVariables]] */
59
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_RulesetVariables]] */
60
60
  ECPresentation_RulesEngine_RulesetVariables = "ECPresentation.RulesetVariables"
61
61
  }
62
62
  //# sourceMappingURL=BackendLoggerCategory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BackendLoggerCategory.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/BackendLoggerCategory.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;GAKG;AACH,oBAAY,iCAAiC;IAC3C,OAAO,yBAAyB;IAEhC,+FAA+F;IAC/F,mBAAmB,6CAA6C;IAEhE,mEAAmE;IACnE,GAAG,6BAA6B;IAEhC,mEAAmE;IACnE,GAAG,6BAA6B;CACjC;AAED;;;;;GAKG;AACH,oBAAY,uCAAuC;IACjD,SAAS,cAAc;IACvB,uBAAuB,4BAA4B;IACnD,6BAA6B,kCAAkC;IAC/D,gCAAgC,qCAAqC;IAErE,cAAc,mBAAmB;IACjC,0BAA0B,+BAA+B;IACzD,oBAAoB,yBAAyB;IAC7C,0BAA0B,8BAA8B;IACxD,gCAAgC,oCAAoC;IACpE,sBAAsB,2BAA2B;IACjD,qBAAqB,0BAA0B;IAC/C,iCAAiC,sCAAsC;IACvE,6BAA6B,kCAAkC;IAC/D,oBAAoB,yBAAyB;IAC7C,+BAA+B,oCAAoC;IACnE,4BAA4B,iCAAiC;IAC7D,4BAA4B,iCAAiC;IAG7D,qEAAqE;IACrE,2BAA2B,gCAAgC;IAC3D,iDAAiD;IACjD,0BAA0B,+BAA+B;IACzD,yDAAyD;IACzD,kCAAkC,2BAA2B;IAC7D,qEAAqE;IACrE,uCAAuC,gCAAgC;IACvE,6DAA6D;IAC7D,qCAAqC,8BAA8B;IACnE,mEAAmE;IACnE,2CAA2C,oCAAoC;IAC/E,uDAAuD;IACvD,kCAAkC,yBAAyB;IAC3D,wDAAwD;IACxD,iCAAiC,0BAA0B;IAC3D,kEAAkE;IAClE,2CAA2C,oCAAoC;CAChF"}
1
+ {"version":3,"file":"BackendLoggerCategory.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/BackendLoggerCategory.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;GAKG;AACH,oBAAY,iCAAiC;IAC3C,OAAO,yBAAyB;IAEhC,+FAA+F;IAC/F,mBAAmB,6CAA6C;IAEhE,mEAAmE;IACnE,GAAG,6BAA6B;IAEhC,mEAAmE;IACnE,GAAG,6BAA6B;CACjC;AAED;;;;;GAKG;AACH,oBAAY,uCAAuC;IACjD,SAAS,cAAc;IACvB,uBAAuB,4BAA4B;IACnD,6BAA6B,kCAAkC;IAC/D,gCAAgC,qCAAqC;IAErE,cAAc,mBAAmB;IACjC,0BAA0B,+BAA+B;IACzD,oBAAoB,yBAAyB;IAC7C,0BAA0B,8BAA8B;IACxD,gCAAgC,oCAAoC;IACpE,sBAAsB,2BAA2B;IACjD,qBAAqB,0BAA0B;IAC/C,iCAAiC,sCAAsC;IACvE,6BAA6B,kCAAkC;IAC/D,oBAAoB,yBAAyB;IAC7C,+BAA+B,oCAAoC;IACnE,4BAA4B,iCAAiC;IAC7D,4BAA4B,iCAAiC;IAG7D,kHAAkH;IAClH,2BAA2B,gCAAgC;IAC3D,8FAA8F;IAC9F,0BAA0B,+BAA+B;IACzD,sGAAsG;IACtG,kCAAkC,2BAA2B;IAC7D,kHAAkH;IAClH,uCAAuC,gCAAgC;IACvE,0GAA0G;IAC1G,qCAAqC,8BAA8B;IACnE,gHAAgH;IAChH,2CAA2C,oCAAoC;IAC/E,oGAAoG;IACpG,kCAAkC,yBAAyB;IAC3D,qGAAqG;IACrG,iCAAiC,0BAA0B;IAC3D,+GAA+G;IAC/G,2CAA2C,oCAAoC;CAChF"}
@@ -47,23 +47,23 @@ export var PresentationBackendNativeLoggerCategory;
47
47
  PresentationBackendNativeLoggerCategory["ECPresentation_ECExpressions"] = "ECPresentation.ECExpressions";
48
48
  PresentationBackendNativeLoggerCategory["ECPresentation_Serialization"] = "ECPresentation.Serialization";
49
49
  /* eslint-disable @typescript-eslint/no-duplicate-enum-values */
50
- /** @deprecated in 4.0. The logging namespace is not used anymore. */
50
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. The logging namespace is not used anymore. */
51
51
  PresentationBackendNativeLoggerCategory["ECPresentation_Localization"] = "ECPresentation.Localization";
52
- /** @deprecated in 4.0. Use [[ECPresentation]] */
52
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation]] */
53
53
  PresentationBackendNativeLoggerCategory["ECPresentation_RulesEngine"] = "ECPresentation.RulesEngine";
54
- /** @deprecated in 4.0. Use [[ECPresentation_Content]] */
54
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_Content]] */
55
55
  PresentationBackendNativeLoggerCategory["ECPresentation_RulesEngine_Content"] = "ECPresentation.Content";
56
- /** @deprecated in 4.0. The logging namespace is not used anymore. */
56
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. The logging namespace is not used anymore. */
57
57
  PresentationBackendNativeLoggerCategory["ECPresentation_RulesEngine_Localization"] = "ECPresentation.Localization";
58
- /** @deprecated in 4.0. Use [[ECPresentation_Hierarchies]] */
58
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_Hierarchies]] */
59
59
  PresentationBackendNativeLoggerCategory["ECPresentation_RulesEngine_Navigation"] = "ECPresentation.Navigation";
60
- /** @deprecated in 4.0. Use [[ECPresentation_Hierarchies_Cache]] */
60
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_Hierarchies_Cache]] */
61
61
  PresentationBackendNativeLoggerCategory["ECPresentation_RulesEngine_Navigation_Cache"] = "ECPresentation.Navigation.Cache";
62
- /** @deprecated in 4.0. Use [[ECPresentation_Tasks]] */
62
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_Tasks]] */
63
63
  PresentationBackendNativeLoggerCategory["ECPresentation_RulesEngine_Threads"] = "ECPresentation.Tasks";
64
- /** @deprecated in 4.0. Use [[ECPresentation_Update]] */
64
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_Update]] */
65
65
  PresentationBackendNativeLoggerCategory["ECPresentation_RulesEngine_Update"] = "ECPresentation.Update";
66
- /** @deprecated in 4.0. Use [[ECPresentation_RulesetVariables]] */
66
+ /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_RulesetVariables]] */
67
67
  PresentationBackendNativeLoggerCategory["ECPresentation_RulesEngine_RulesetVariables"] = "ECPresentation.RulesetVariables";
68
68
  })(PresentationBackendNativeLoggerCategory || (PresentationBackendNativeLoggerCategory = {}));
69
69
  //# sourceMappingURL=BackendLoggerCategory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BackendLoggerCategory.js","sourceRoot":"","sources":["../../../src/presentation-backend/BackendLoggerCategory.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH;;;;;GAKG;AACH,MAAM,CAAN,IAAY,iCAWX;AAXD,WAAY,iCAAiC;IAC3C,qEAAgC,CAAA;IAEhC,+FAA+F;IAC/F,qGAAgE,CAAA;IAEhE,mEAAmE;IACnE,qEAAgC,CAAA;IAEhC,mEAAmE;IACnE,qEAAgC,CAAA;AAClC,CAAC,EAXW,iCAAiC,KAAjC,iCAAiC,QAW5C;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,uCAuCX;AAvCD,WAAY,uCAAuC;IACjD,kEAAuB,CAAA;IACvB,8FAAmD,CAAA;IACnD,0GAA+D,CAAA;IAC/D,gHAAqE,CAAA;IAErE,4EAAiC,CAAA;IACjC,oGAAyD,CAAA;IACzD,wFAA6C,CAAA;IAC7C,mGAAwD,CAAA;IACxD,+GAAoE,CAAA;IACpE,4FAAiD,CAAA;IACjD,0FAA+C,CAAA;IAC/C,kHAAuE,CAAA;IACvE,0GAA+D,CAAA;IAC/D,wFAA6C,CAAA;IAC7C,8GAAmE,CAAA;IACnE,wGAA6D,CAAA;IAC7D,wGAA6D,CAAA;IAE7D,gEAAgE;IAChE,qEAAqE;IACrE,sGAA2D,CAAA;IAC3D,iDAAiD;IACjD,oGAAyD,CAAA;IACzD,yDAAyD;IACzD,wGAA6D,CAAA;IAC7D,qEAAqE;IACrE,kHAAuE,CAAA;IACvE,6DAA6D;IAC7D,8GAAmE,CAAA;IACnE,mEAAmE;IACnE,0HAA+E,CAAA;IAC/E,uDAAuD;IACvD,sGAA2D,CAAA;IAC3D,wDAAwD;IACxD,sGAA2D,CAAA;IAC3D,kEAAkE;IAClE,0HAA+E,CAAA;AACjF,CAAC,EAvCW,uCAAuC,KAAvC,uCAAuC,QAuClD","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 Logging\n */\n\n/**\n * Logger categories used by this package\n * @note All logger categories in this package start with the `presentation-backend` prefix.\n * @see [Logger]($bentley)\n * @public\n */\nexport enum PresentationBackendLoggerCategory {\n Package = \"presentation-backend\",\n\n /** The logger category used by the [[PresentationManager]] class and other related classes. */\n PresentationManager = \"presentation-backend.PresentationManager\",\n\n /** The logger category used by Presentation RPC implementation. */\n Rpc = \"presentation-backend.Rpc\",\n\n /** The logger category used by Presentation IPC implementation. */\n Ipc = \"presentation-backend.Ipc\",\n}\n\n/**\n * Logger categories used by this package\n * @note Logger categories used by the [[PresentationManager]] native addon.\n * @see [Logger]($bentley)\n * @public\n */\nexport enum PresentationBackendNativeLoggerCategory {\n ECObjects = \"ECObjects\",\n ECObjects_ECExpressions = \"ECObjects.ECExpressions\",\n ECObjects_ECExpressions_Parse = \"ECObjects.ECExpressions.Parse\",\n ECObjects_ECExpressions_Evaluate = \"ECObjects.ECExpressions.Evaluate\",\n\n ECPresentation = \"ECPresentation\",\n ECPresentation_Connections = \"ECPresentation.Connections\",\n ECPresentation_Tasks = \"ECPresentation.Tasks\",\n ECPresentation_Hierarchies = \"ECPresentation.Navigation\",\n ECPresentation_Hierarchies_Cache = \"ECPresentation.Navigation.Cache\",\n ECPresentation_Content = \"ECPresentation.Content\",\n ECPresentation_Update = \"ECPresentation.Update\",\n ECPresentation_Update_Hierarchies = \"ECPresentation.Update.Hierarchies\",\n ECPresentation_Update_Content = \"ECPresentation.Update.Content\",\n ECPresentation_Rules = \"ECPresentation.Rules\",\n ECPresentation_RulesetVariables = \"ECPresentation.RulesetVariables\",\n ECPresentation_ECExpressions = \"ECPresentation.ECExpressions\",\n ECPresentation_Serialization = \"ECPresentation.Serialization\",\n\n /* eslint-disable @typescript-eslint/no-duplicate-enum-values */\n /** @deprecated in 4.0. The logging namespace is not used anymore. */\n ECPresentation_Localization = \"ECPresentation.Localization\",\n /** @deprecated in 4.0. Use [[ECPresentation]] */\n ECPresentation_RulesEngine = \"ECPresentation.RulesEngine\",\n /** @deprecated in 4.0. Use [[ECPresentation_Content]] */\n ECPresentation_RulesEngine_Content = \"ECPresentation.Content\",\n /** @deprecated in 4.0. The logging namespace is not used anymore. */\n ECPresentation_RulesEngine_Localization = \"ECPresentation.Localization\",\n /** @deprecated in 4.0. Use [[ECPresentation_Hierarchies]] */\n ECPresentation_RulesEngine_Navigation = \"ECPresentation.Navigation\",\n /** @deprecated in 4.0. Use [[ECPresentation_Hierarchies_Cache]] */\n ECPresentation_RulesEngine_Navigation_Cache = \"ECPresentation.Navigation.Cache\",\n /** @deprecated in 4.0. Use [[ECPresentation_Tasks]] */\n ECPresentation_RulesEngine_Threads = \"ECPresentation.Tasks\",\n /** @deprecated in 4.0. Use [[ECPresentation_Update]] */\n ECPresentation_RulesEngine_Update = \"ECPresentation.Update\",\n /** @deprecated in 4.0. Use [[ECPresentation_RulesetVariables]] */\n ECPresentation_RulesEngine_RulesetVariables = \"ECPresentation.RulesetVariables\",\n}\n"]}
1
+ {"version":3,"file":"BackendLoggerCategory.js","sourceRoot":"","sources":["../../../src/presentation-backend/BackendLoggerCategory.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH;;;;;GAKG;AACH,MAAM,CAAN,IAAY,iCAWX;AAXD,WAAY,iCAAiC;IAC3C,qEAAgC,CAAA;IAEhC,+FAA+F;IAC/F,qGAAgE,CAAA;IAEhE,mEAAmE;IACnE,qEAAgC,CAAA;IAEhC,mEAAmE;IACnE,qEAAgC,CAAA;AAClC,CAAC,EAXW,iCAAiC,KAAjC,iCAAiC,QAW5C;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,uCAuCX;AAvCD,WAAY,uCAAuC;IACjD,kEAAuB,CAAA;IACvB,8FAAmD,CAAA;IACnD,0GAA+D,CAAA;IAC/D,gHAAqE,CAAA;IAErE,4EAAiC,CAAA;IACjC,oGAAyD,CAAA;IACzD,wFAA6C,CAAA;IAC7C,mGAAwD,CAAA;IACxD,+GAAoE,CAAA;IACpE,4FAAiD,CAAA;IACjD,0FAA+C,CAAA;IAC/C,kHAAuE,CAAA;IACvE,0GAA+D,CAAA;IAC/D,wFAA6C,CAAA;IAC7C,8GAAmE,CAAA;IACnE,wGAA6D,CAAA;IAC7D,wGAA6D,CAAA;IAE7D,gEAAgE;IAChE,kHAAkH;IAClH,sGAA2D,CAAA;IAC3D,8FAA8F;IAC9F,oGAAyD,CAAA;IACzD,sGAAsG;IACtG,wGAA6D,CAAA;IAC7D,kHAAkH;IAClH,kHAAuE,CAAA;IACvE,0GAA0G;IAC1G,8GAAmE,CAAA;IACnE,gHAAgH;IAChH,0HAA+E,CAAA;IAC/E,oGAAoG;IACpG,sGAA2D,CAAA;IAC3D,qGAAqG;IACrG,sGAA2D,CAAA;IAC3D,+GAA+G;IAC/G,0HAA+E,CAAA;AACjF,CAAC,EAvCW,uCAAuC,KAAvC,uCAAuC,QAuClD","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 Logging\n */\n\n/**\n * Logger categories used by this package\n * @note All logger categories in this package start with the `presentation-backend` prefix.\n * @see [Logger]($bentley)\n * @public\n */\nexport enum PresentationBackendLoggerCategory {\n Package = \"presentation-backend\",\n\n /** The logger category used by the [[PresentationManager]] class and other related classes. */\n PresentationManager = \"presentation-backend.PresentationManager\",\n\n /** The logger category used by Presentation RPC implementation. */\n Rpc = \"presentation-backend.Rpc\",\n\n /** The logger category used by Presentation IPC implementation. */\n Ipc = \"presentation-backend.Ipc\",\n}\n\n/**\n * Logger categories used by this package\n * @note Logger categories used by the [[PresentationManager]] native addon.\n * @see [Logger]($bentley)\n * @public\n */\nexport enum PresentationBackendNativeLoggerCategory {\n ECObjects = \"ECObjects\",\n ECObjects_ECExpressions = \"ECObjects.ECExpressions\",\n ECObjects_ECExpressions_Parse = \"ECObjects.ECExpressions.Parse\",\n ECObjects_ECExpressions_Evaluate = \"ECObjects.ECExpressions.Evaluate\",\n\n ECPresentation = \"ECPresentation\",\n ECPresentation_Connections = \"ECPresentation.Connections\",\n ECPresentation_Tasks = \"ECPresentation.Tasks\",\n ECPresentation_Hierarchies = \"ECPresentation.Navigation\",\n ECPresentation_Hierarchies_Cache = \"ECPresentation.Navigation.Cache\",\n ECPresentation_Content = \"ECPresentation.Content\",\n ECPresentation_Update = \"ECPresentation.Update\",\n ECPresentation_Update_Hierarchies = \"ECPresentation.Update.Hierarchies\",\n ECPresentation_Update_Content = \"ECPresentation.Update.Content\",\n ECPresentation_Rules = \"ECPresentation.Rules\",\n ECPresentation_RulesetVariables = \"ECPresentation.RulesetVariables\",\n ECPresentation_ECExpressions = \"ECPresentation.ECExpressions\",\n ECPresentation_Serialization = \"ECPresentation.Serialization\",\n\n /* eslint-disable @typescript-eslint/no-duplicate-enum-values */\n /** @deprecated in 4.0 - will not be removed until after 2026-06-13. The logging namespace is not used anymore. */\n ECPresentation_Localization = \"ECPresentation.Localization\",\n /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation]] */\n ECPresentation_RulesEngine = \"ECPresentation.RulesEngine\",\n /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_Content]] */\n ECPresentation_RulesEngine_Content = \"ECPresentation.Content\",\n /** @deprecated in 4.0 - will not be removed until after 2026-06-13. The logging namespace is not used anymore. */\n ECPresentation_RulesEngine_Localization = \"ECPresentation.Localization\",\n /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_Hierarchies]] */\n ECPresentation_RulesEngine_Navigation = \"ECPresentation.Navigation\",\n /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_Hierarchies_Cache]] */\n ECPresentation_RulesEngine_Navigation_Cache = \"ECPresentation.Navigation.Cache\",\n /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_Tasks]] */\n ECPresentation_RulesEngine_Threads = \"ECPresentation.Tasks\",\n /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_Update]] */\n ECPresentation_RulesEngine_Update = \"ECPresentation.Update\",\n /** @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ECPresentation_RulesetVariables]] */\n ECPresentation_RulesEngine_RulesetVariables = \"ECPresentation.RulesetVariables\",\n}\n"]}
@@ -27,14 +27,14 @@ export interface PresentationProps extends Omit<PresentationManagerProps, "enabl
27
27
  * instances, one for each frontend.
28
28
  *
29
29
  * @public
30
- * @deprecated in 4.8 - use [[PresentationProps]] instead.
30
+ * @deprecated in 4.8 - will not be removed until after 2026-06-13. Use [[PresentationProps]] instead.
31
31
  */
32
32
  export type MultiManagerPresentationProps = PresentationProps;
33
33
  /**
34
34
  * Base props for initializing the [[Presentation]] library.
35
35
  *
36
36
  * @public
37
- * @deprecated in 4.8 - use [[PresentationProps]] instead.
37
+ * @deprecated in 4.8 - will not be removed until after 2026-06-13. Use [[PresentationProps]] instead.
38
38
  */
39
39
  export type PresentationPropsBase = PresentationProps;
40
40
  /**
@@ -42,7 +42,7 @@ export type PresentationPropsBase = PresentationProps;
42
42
  * [[PresentationManager]] instance for handling all requests.
43
43
  *
44
44
  * @public
45
- * @deprecated in 4.8 - use [[PresentationProps]] instead.
45
+ * @deprecated in 4.8 - will not be removed until after 2026-06-13. Use [[PresentationProps]] instead.
46
46
  */
47
47
  export type SingleManagerPresentationProps = Omit<PresentationProps, "unusedClientLifetime">;
48
48
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../../src/presentation-backend/Presentation.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAe,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAA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H,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,CAAC;IACrB,CAAC;IAEO,MAAM,CAAC,oBAAoB,CAAC,GAAW,EAAE,SAA0B;QACzE,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,UAAU,CAAC,QAAiB;QACxC,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC;QAC/D,CAAC;QACD,MAAM,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,cAAc,EAAE,2EAA2E,CAAC,CAAC;IAC9I,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,iBAAiB;QAC7B,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAChC,MAAM,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,cAAc,EAAE,2EAA2E,CAAC,CAAC;QAC9I,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;IACtC,CAAC;IAEO,MAAM,CAAC,cAAc,GAAG,CAAC,MAAmB,EAAE,EAAE;QACtD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,MAAM,WAAW,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC,iBAAiB,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACrG,mEAAmE;QACnE,OAAO,CAAC,4BAA4B,CAAC,CAAC,iBAAiB,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC1F,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 { BriefcaseDb, IModelHost, IpcHost } from \"@itwin/core-backend\";\nimport { DisposeFunc, Logger } from \"@itwin/core-bentley\";\nimport { RpcManager } from \"@itwin/core-common\";\nimport { PresentationError, PresentationRpcInterface, PresentationStatus } from \"@itwin/presentation-common\";\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory.js\";\nimport { PresentationIpcHandler } from \"./PresentationIpcHandler.js\";\nimport { PresentationManager, PresentationManagerProps } from \"./PresentationManager.js\";\nimport { PresentationRpcImpl } from \"./PresentationRpcImpl.js\";\nimport { FactoryBasedTemporaryStorage } from \"./TemporaryStorage.js\";\nimport { _presentation_manager_detail } from \"./InternalSymbols.js\";\n\n/**\n * Properties that can be used to configure [[Presentation]] API.\n * @public\n */\nexport interface PresentationProps extends Omit<PresentationManagerProps, \"enableSchemasPreload\"> {\n /**\n * Time in milliseconds after which the request will timeout.\n */\n requestTimeout?: number;\n\n /**\n * Should schemas preloading be enabled. If true, [[Presentation]] library listens\n * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.\n */\n enableSchemasPreload?: boolean;\n\n /**\n * How much time should an unused client manager be stored in memory\n * before it's disposed.\n */\n unusedClientLifetime?: number;\n}\n\ninterface PresentationInternalProps {\n /**\n * Factory method for creating separate managers for each client\n */\n clientManagerFactory?: (clientId: string, props: PresentationManagerProps) => PresentationManager;\n}\n\n/**\n * Props for initializing the [[Presentation]] library for using multiple [[PresentationManager]]\n * instances, one for each frontend.\n *\n * @public\n * @deprecated in 4.8 - use [[PresentationProps]] instead.\n */\nexport type MultiManagerPresentationProps = PresentationProps;\n\n/**\n * Base props for initializing the [[Presentation]] library.\n *\n * @public\n * @deprecated in 4.8 - use [[PresentationProps]] instead.\n */\nexport type PresentationPropsBase = PresentationProps;\n\n/**\n * Props for initializing the [[Presentation]] library with ability to use a single\n * [[PresentationManager]] instance for handling all requests.\n *\n * @public\n * @deprecated in 4.8 - use [[PresentationProps]] instead.\n */\nexport type SingleManagerPresentationProps = Omit<PresentationProps, \"unusedClientLifetime\">;\n\ninterface ClientStoreItem {\n manager: PresentationManager;\n}\n\n/**\n * Static class used to statically set up Presentation library for the backend.\n * Basically what it does is:\n * - Register a RPC implementation\n * - Create a singleton [[PresentationManager]] instance\n * - Subscribe for [IModelHost.onBeforeShutdown]($core-backend) event and terminate\n * the presentation manager when that happens.\n *\n * @public\n */\nexport class Presentation {\n private static _initProps: (PresentationProps & PresentationInternalProps) | undefined;\n private static _clientsStorage: FactoryBasedTemporaryStorage<ClientStoreItem> | undefined;\n private static _disposeIpcHandler: DisposeFunc | undefined;\n private static _shutdownListener: DisposeFunc | undefined;\n private static _disposeIModelOpenedListener: DisposeFunc | undefined;\n private static _rpcImpl: PresentationRpcImpl | undefined;\n\n /* c8 ignore next */\n private constructor() {}\n\n /** Properties used to initialize the presentation framework */\n public static get initProps(): PresentationProps | undefined {\n return this._initProps;\n }\n\n /**\n * Initializes Presentation library for the backend.\n *\n * See [Setting up iTwin.js Presentation library documentation page]($docs/presentation/setup/index.md#backend) for an example.\n *\n * **Important:** The method should be called after a call to [IModelHost.startup]($core-backend)\n *\n * @param props Optional properties for [[PresentationManager]]\n */\n public static initialize(props?: PresentationProps): void {\n this._initProps = props || {};\n this._shutdownListener = IModelHost.onBeforeShutdown.addListener(() => Presentation.terminate());\n\n this._rpcImpl = new PresentationRpcImpl({\n requestTimeout: this._initProps.requestTimeout,\n });\n RpcManager.registerImpl(PresentationRpcInterface, PresentationRpcImpl);\n RpcManager.supplyImplInstance(PresentationRpcInterface, this._rpcImpl);\n\n if (IpcHost.isValid) {\n this._disposeIpcHandler = PresentationIpcHandler.register();\n }\n\n this._clientsStorage = new FactoryBasedTemporaryStorage<ClientStoreItem>({\n factory: this.createClientManager.bind(this),\n cleanupHandler: (_id, storeItem) => this.disposeClientManager(_id, storeItem),\n // cleanup unused managers every minute\n cleanupInterval: 60 * 1000,\n // by default, manager is disposed after 1 hour of being unused\n unusedValueLifetime: this._initProps.unusedClientLifetime ?? 60 * 60 * 1000,\n // add some logging\n /* c8 ignore next 5 */\n onDisposedSingle: (id: string) =>\n Logger.logInfo(\n PresentationBackendLoggerCategory.PresentationManager,\n `Disposed PresentationManager instance with ID: ${id}. Total instances: ${this._clientsStorage!.values.length}.`,\n ),\n /* c8 ignore next */\n onDisposedAll: () => Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Disposed all PresentationManager instances.`),\n });\n\n if (this._initProps.enableSchemasPreload) {\n this._disposeIModelOpenedListener = BriefcaseDb.onOpened.addListener(this.onIModelOpened);\n }\n }\n\n /**\n * Terminates Presentation. Consumers don't need to call this as it's automatically\n * called on [IModelHost.onBeforeShutdown]($core-backend) event.\n */\n public static terminate(): void {\n if (this._clientsStorage) {\n this._clientsStorage[Symbol.dispose]();\n this._clientsStorage = undefined;\n }\n if (this._disposeIModelOpenedListener) {\n this._disposeIModelOpenedListener();\n this._disposeIModelOpenedListener = undefined;\n }\n if (this._shutdownListener) {\n this._shutdownListener();\n this._shutdownListener = undefined;\n }\n RpcManager.unregisterImpl(PresentationRpcInterface);\n if (this._rpcImpl) {\n this._rpcImpl[Symbol.dispose]();\n this._rpcImpl = undefined;\n }\n if (this._disposeIpcHandler) {\n this._disposeIpcHandler();\n }\n this._initProps = undefined;\n }\n\n private static createClientManager(clientId: string, onManagerUsed: () => void): ClientStoreItem {\n const manager =\n Presentation._initProps && Presentation._initProps.clientManagerFactory\n ? Presentation._initProps.clientManagerFactory(clientId, Presentation._initProps)\n : new PresentationManager({\n ...Presentation._initProps,\n // @ts-expect-error internal prop\n id: clientId,\n });\n manager.onUsed.addListener(onManagerUsed);\n Logger.logInfo(\n PresentationBackendLoggerCategory.PresentationManager,\n `Created a PresentationManager instance with ID: ${clientId}. Total instances: ${this._clientsStorage!.values.length}.`,\n );\n return { manager };\n }\n\n private static disposeClientManager(_id: string, storeItem: ClientStoreItem) {\n storeItem.manager[Symbol.dispose]();\n }\n\n /**\n * Get an instance of [[PresentationManager]] for specific client\n * @param clientId ID of the client requesting presentation data. If no\n * ID is provided, the default [[PresentationManager]] is returned.\n */\n public static getManager(clientId?: string): PresentationManager {\n if (this._clientsStorage) {\n return this._clientsStorage.getValue(clientId || \"\").manager;\n }\n throw new PresentationError(PresentationStatus.NotInitialized, \"Presentation must be first initialized by calling Presentation.initialize\");\n }\n\n /**\n * Get the time in milliseconds that backend should respond in .\n */\n public static getRequestTimeout(): number {\n if (this._rpcImpl === undefined) {\n throw new PresentationError(PresentationStatus.NotInitialized, \"Presentation must be first initialized by calling Presentation.initialize\");\n }\n return this._rpcImpl.requestTimeout;\n }\n\n private static onIModelOpened = (imodel: BriefcaseDb) => {\n const manager = this.getManager();\n const imodelAddon = manager[_presentation_manager_detail].getNativePlatform().getImodelAddon(imodel);\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n manager[_presentation_manager_detail].getNativePlatform().forceLoadSchemas(imodelAddon);\n };\n}\n"]}
1
+ {"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../../src/presentation-backend/Presentation.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAe,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC7G,OAAO,EAAE,iCAAiC,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAA4B,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CA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AM,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,cAAc,EAAE,2EAA2E,CAAC,CAAC;IAC9I,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,iBAAiB;QAC7B,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAChC,MAAM,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,cAAc,EAAE,2EAA2E,CAAC,CAAC;QAC9I,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;IACtC,CAAC;IAEO,MAAM,CAAC,cAAc,GAAG,CAAC,MAAmB,EAAE,EAAE;QACtD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,MAAM,WAAW,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC,iBAAiB,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACrG,mEAAmE;QACnE,OAAO,CAAC,4BAA4B,CAAC,CAAC,iBAAiB,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC1F,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 { BriefcaseDb, IModelHost, IpcHost } from \"@itwin/core-backend\";\nimport { DisposeFunc, Logger } from \"@itwin/core-bentley\";\nimport { RpcManager } from \"@itwin/core-common\";\nimport { PresentationError, PresentationRpcInterface, PresentationStatus } from \"@itwin/presentation-common\";\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory.js\";\nimport { PresentationIpcHandler } from \"./PresentationIpcHandler.js\";\nimport { PresentationManager, PresentationManagerProps } from \"./PresentationManager.js\";\nimport { PresentationRpcImpl } from \"./PresentationRpcImpl.js\";\nimport { FactoryBasedTemporaryStorage } from \"./TemporaryStorage.js\";\nimport { _presentation_manager_detail } from \"./InternalSymbols.js\";\n\n/**\n * Properties that can be used to configure [[Presentation]] API.\n * @public\n */\nexport interface PresentationProps extends Omit<PresentationManagerProps, \"enableSchemasPreload\"> {\n /**\n * Time in milliseconds after which the request will timeout.\n */\n requestTimeout?: number;\n\n /**\n * Should schemas preloading be enabled. If true, [[Presentation]] library listens\n * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.\n */\n enableSchemasPreload?: boolean;\n\n /**\n * How much time should an unused client manager be stored in memory\n * before it's disposed.\n */\n unusedClientLifetime?: number;\n}\n\ninterface PresentationInternalProps {\n /**\n * Factory method for creating separate managers for each client\n */\n clientManagerFactory?: (clientId: string, props: PresentationManagerProps) => PresentationManager;\n}\n\n/**\n * Props for initializing the [[Presentation]] library for using multiple [[PresentationManager]]\n * instances, one for each frontend.\n *\n * @public\n * @deprecated in 4.8 - will not be removed until after 2026-06-13. Use [[PresentationProps]] instead.\n */\nexport type MultiManagerPresentationProps = PresentationProps;\n\n/**\n * Base props for initializing the [[Presentation]] library.\n *\n * @public\n * @deprecated in 4.8 - will not be removed until after 2026-06-13. Use [[PresentationProps]] instead.\n */\nexport type PresentationPropsBase = PresentationProps;\n\n/**\n * Props for initializing the [[Presentation]] library with ability to use a single\n * [[PresentationManager]] instance for handling all requests.\n *\n * @public\n * @deprecated in 4.8 - will not be removed until after 2026-06-13. Use [[PresentationProps]] instead.\n */\nexport type SingleManagerPresentationProps = Omit<PresentationProps, \"unusedClientLifetime\">;\n\ninterface ClientStoreItem {\n manager: PresentationManager;\n}\n\n/**\n * Static class used to statically set up Presentation library for the backend.\n * Basically what it does is:\n * - Register a RPC implementation\n * - Create a singleton [[PresentationManager]] instance\n * - Subscribe for [IModelHost.onBeforeShutdown]($core-backend) event and terminate\n * the presentation manager when that happens.\n *\n * @public\n */\nexport class Presentation {\n private static _initProps: (PresentationProps & PresentationInternalProps) | undefined;\n private static _clientsStorage: FactoryBasedTemporaryStorage<ClientStoreItem> | undefined;\n private static _disposeIpcHandler: DisposeFunc | undefined;\n private static _shutdownListener: DisposeFunc | undefined;\n private static _disposeIModelOpenedListener: DisposeFunc | undefined;\n private static _rpcImpl: PresentationRpcImpl | undefined;\n\n /* c8 ignore next */\n private constructor() {}\n\n /** Properties used to initialize the presentation framework */\n public static get initProps(): PresentationProps | undefined {\n return this._initProps;\n }\n\n /**\n * Initializes Presentation library for the backend.\n *\n * See [Setting up iTwin.js Presentation library documentation page]($docs/presentation/setup/index.md#backend) for an example.\n *\n * **Important:** The method should be called after a call to [IModelHost.startup]($core-backend)\n *\n * @param props Optional properties for [[PresentationManager]]\n */\n public static initialize(props?: PresentationProps): void {\n this._initProps = props || {};\n this._shutdownListener = IModelHost.onBeforeShutdown.addListener(() => Presentation.terminate());\n\n this._rpcImpl = new PresentationRpcImpl({\n requestTimeout: this._initProps.requestTimeout,\n });\n RpcManager.registerImpl(PresentationRpcInterface, PresentationRpcImpl);\n RpcManager.supplyImplInstance(PresentationRpcInterface, this._rpcImpl);\n\n if (IpcHost.isValid) {\n this._disposeIpcHandler = PresentationIpcHandler.register();\n }\n\n this._clientsStorage = new FactoryBasedTemporaryStorage<ClientStoreItem>({\n factory: this.createClientManager.bind(this),\n cleanupHandler: (_id, storeItem) => this.disposeClientManager(_id, storeItem),\n // cleanup unused managers every minute\n cleanupInterval: 60 * 1000,\n // by default, manager is disposed after 1 hour of being unused\n unusedValueLifetime: this._initProps.unusedClientLifetime ?? 60 * 60 * 1000,\n // add some logging\n /* c8 ignore next 5 */\n onDisposedSingle: (id: string) =>\n Logger.logInfo(\n PresentationBackendLoggerCategory.PresentationManager,\n `Disposed PresentationManager instance with ID: ${id}. Total instances: ${this._clientsStorage!.values.length}.`,\n ),\n /* c8 ignore next */\n onDisposedAll: () => Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Disposed all PresentationManager instances.`),\n });\n\n if (this._initProps.enableSchemasPreload) {\n this._disposeIModelOpenedListener = BriefcaseDb.onOpened.addListener(this.onIModelOpened);\n }\n }\n\n /**\n * Terminates Presentation. Consumers don't need to call this as it's automatically\n * called on [IModelHost.onBeforeShutdown]($core-backend) event.\n */\n public static terminate(): void {\n if (this._clientsStorage) {\n this._clientsStorage[Symbol.dispose]();\n this._clientsStorage = undefined;\n }\n if (this._disposeIModelOpenedListener) {\n this._disposeIModelOpenedListener();\n this._disposeIModelOpenedListener = undefined;\n }\n if (this._shutdownListener) {\n this._shutdownListener();\n this._shutdownListener = undefined;\n }\n RpcManager.unregisterImpl(PresentationRpcInterface);\n if (this._rpcImpl) {\n this._rpcImpl[Symbol.dispose]();\n this._rpcImpl = undefined;\n }\n if (this._disposeIpcHandler) {\n this._disposeIpcHandler();\n }\n this._initProps = undefined;\n }\n\n private static createClientManager(clientId: string, onManagerUsed: () => void): ClientStoreItem {\n const manager =\n Presentation._initProps && Presentation._initProps.clientManagerFactory\n ? Presentation._initProps.clientManagerFactory(clientId, Presentation._initProps)\n : new PresentationManager({\n ...Presentation._initProps,\n // @ts-expect-error internal prop\n id: clientId,\n });\n manager.onUsed.addListener(onManagerUsed);\n Logger.logInfo(\n PresentationBackendLoggerCategory.PresentationManager,\n `Created a PresentationManager instance with ID: ${clientId}. Total instances: ${this._clientsStorage!.values.length}.`,\n );\n return { manager };\n }\n\n private static disposeClientManager(_id: string, storeItem: ClientStoreItem) {\n storeItem.manager[Symbol.dispose]();\n }\n\n /**\n * Get an instance of [[PresentationManager]] for specific client\n * @param clientId ID of the client requesting presentation data. If no\n * ID is provided, the default [[PresentationManager]] is returned.\n */\n public static getManager(clientId?: string): PresentationManager {\n if (this._clientsStorage) {\n return this._clientsStorage.getValue(clientId || \"\").manager;\n }\n throw new PresentationError(PresentationStatus.NotInitialized, \"Presentation must be first initialized by calling Presentation.initialize\");\n }\n\n /**\n * Get the time in milliseconds that backend should respond in .\n */\n public static getRequestTimeout(): number {\n if (this._rpcImpl === undefined) {\n throw new PresentationError(PresentationStatus.NotInitialized, \"Presentation must be first initialized by calling Presentation.initialize\");\n }\n return this._rpcImpl.requestTimeout;\n }\n\n private static onIModelOpened = (imodel: BriefcaseDb) => {\n const manager = this.getManager();\n const imodelAddon = manager[_presentation_manager_detail].getNativePlatform().getImodelAddon(imodel);\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n manager[_presentation_manager_detail].getNativePlatform().forceLoadSchemas(imodelAddon);\n };\n}\n"]}