@itwin/presentation-backend 4.10.0-dev.32 → 4.10.0-dev.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/presentation-backend/Presentation.d.ts +1 -1
- package/lib/cjs/presentation-backend/Presentation.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManager.d.ts +1 -1
- package/lib/cjs/presentation-backend/PresentationManager.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManager.js +3 -4
- package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManagerDetail.js +4 -4
- package/lib/cjs/presentation-backend/PresentationManagerDetail.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js +8 -8
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
- package/lib/cjs/presentation-backend/Utils.js +1 -1
- package/lib/cjs/presentation-backend/Utils.js.map +1 -1
- package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js +0 -1
- package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js.map +1 -1
- package/package.json +17 -17
|
@@ -6,7 +6,7 @@ import { PresentationManager, PresentationManagerProps } from "./PresentationMan
|
|
|
6
6
|
* Properties that can be used to configure [[Presentation]] API.
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
|
-
export interface PresentationProps extends PresentationManagerProps {
|
|
9
|
+
export interface PresentationProps extends Omit<PresentationManagerProps, "enableSchemasPreload"> {
|
|
10
10
|
/**
|
|
11
11
|
* Time in milliseconds after which the request will timeout.
|
|
12
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Presentation.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/Presentation.ts"],"names":[],"mappings":"AAIA;;GAEG;AAQH,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M,GAAG,CACxH,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,CAAC;IACrB,CAAC;IAEO,MAAM,CAAC,oBAAoB,CAAC,GAAW,EAAE,SAA0B;QACzE,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IAC9B,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,uCAAiB,CAAC,wCAAkB,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,uCAAiB,CAAC,wCAAkB,CAAC,cAAc,EAAE,2EAA2E,CAAC,CAAC;QAC9I,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;IACtC,CAAC;;AA9HH,oCAsIC;;AANgB,2BAAc,GAAG,CAAC,MAAmB,EAAE,EAAE;IACtD,MAAM,OAAO,GAAG,EAAI,CAAC,UAAU,EAAE,CAAC;IAClC,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACvE,mEAAmE;IACnE,OAAO,CAAC,iBAAiB,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;AAC5D,CAAC,AAL4B,CAK3B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { BriefcaseDb, IModelHost, IpcHost } from \"@itwin/core-backend\";\r\nimport { DisposeFunc, Logger } from \"@itwin/core-bentley\";\r\nimport { RpcManager } from \"@itwin/core-common\";\r\nimport { PresentationError, PresentationRpcInterface, PresentationStatus } from \"@itwin/presentation-common\";\r\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { PresentationIpcHandler } from \"./PresentationIpcHandler\";\r\nimport { PresentationManager, PresentationManagerProps } from \"./PresentationManager\";\r\nimport { PresentationRpcImpl } from \"./PresentationRpcImpl\";\r\nimport { FactoryBasedTemporaryStorage } from \"./TemporaryStorage\";\r\n\r\n/**\r\n * Properties that can be used to configure [[Presentation]] API.\r\n * @public\r\n */\r\nexport interface PresentationProps extends PresentationManagerProps {\r\n /**\r\n * Time in milliseconds after which the request will timeout.\r\n */\r\n requestTimeout?: number;\r\n\r\n /**\r\n * Should schemas preloading be enabled. If true, [[Presentation]] library listens\r\n * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.\r\n */\r\n enableSchemasPreload?: boolean;\r\n\r\n /**\r\n * Factory method for creating separate managers for each client\r\n * @internal\r\n */\r\n clientManagerFactory?: (clientId: string, props: PresentationManagerProps) => PresentationManager;\r\n\r\n /**\r\n * How much time should an unused client manager be stored in memory\r\n * before it's disposed.\r\n */\r\n unusedClientLifetime?: number;\r\n}\r\n\r\n/**\r\n * Props for initializing the [[Presentation]] library for using multiple [[PresentationManager]]\r\n * instances, one for each frontend.\r\n *\r\n * @public\r\n * @deprecated in 4.8 - use [[PresentationProps]] instead.\r\n */\r\nexport type MultiManagerPresentationProps = PresentationProps;\r\n\r\n/**\r\n * Base props for initializing the [[Presentation]] library.\r\n *\r\n * @public\r\n * @deprecated in 4.8 - use [[PresentationProps]] instead.\r\n */\r\nexport type PresentationPropsBase = PresentationProps;\r\n\r\n/**\r\n * Props for initializing the [[Presentation]] library with ability to use a single\r\n * [[PresentationManager]] instance for handling all requests.\r\n *\r\n * @public\r\n * @deprecated in 4.8 - use [[PresentationProps]] instead.\r\n */\r\nexport type SingleManagerPresentationProps = Omit<PresentationProps, \"clientManagerFactory\" | \"unusedClientLifetime\">;\r\n\r\ninterface ClientStoreItem {\r\n manager: PresentationManager;\r\n}\r\n\r\n/**\r\n * Static class used to statically set up Presentation library for the backend.\r\n * Basically what it does is:\r\n * - Register a RPC implementation\r\n * - Create a singleton [[PresentationManager]] instance\r\n * - Subscribe for [IModelHost.onBeforeShutdown]($core-backend) event and terminate\r\n * the presentation manager when that happens.\r\n *\r\n * @public\r\n */\r\nexport class Presentation {\r\n private static _initProps: PresentationProps | undefined;\r\n private static _clientsStorage: FactoryBasedTemporaryStorage<ClientStoreItem> | undefined;\r\n private static _disposeIpcHandler: DisposeFunc | undefined;\r\n private static _shutdownListener: DisposeFunc | undefined;\r\n private static _disposeIModelOpenedListener: DisposeFunc | undefined;\r\n private static _rpcImpl: PresentationRpcImpl | undefined;\r\n\r\n /* istanbul ignore next */\r\n private constructor() {}\r\n\r\n /** Properties used to initialize the presentation framework */\r\n public static get initProps() {\r\n return this._initProps;\r\n }\r\n\r\n /**\r\n * Initializes Presentation library for the backend.\r\n *\r\n * See [Setting up iTwin.js Presentation library documentation page]($docs/presentation/setup/index.md#backend) for an example.\r\n *\r\n * **Important:** The method should be called after a call to [IModelHost.startup]($core-backend)\r\n *\r\n * @param props Optional properties for [[PresentationManager]]\r\n */\r\n public static initialize(props?: PresentationProps): void {\r\n this._initProps = props || {};\r\n this._shutdownListener = IModelHost.onBeforeShutdown.addListener(() => Presentation.terminate());\r\n\r\n this._rpcImpl = new PresentationRpcImpl({\r\n requestTimeout: this._initProps.requestTimeout,\r\n });\r\n RpcManager.registerImpl(PresentationRpcInterface, PresentationRpcImpl);\r\n RpcManager.supplyImplInstance(PresentationRpcInterface, this._rpcImpl);\r\n\r\n if (IpcHost.isValid) {\r\n this._disposeIpcHandler = PresentationIpcHandler.register();\r\n }\r\n\r\n this._clientsStorage = new FactoryBasedTemporaryStorage<ClientStoreItem>({\r\n factory: this.createClientManager.bind(this),\r\n cleanupHandler: (_id, storeItem) => this.disposeClientManager(_id, storeItem),\r\n // cleanup unused managers every minute\r\n cleanupInterval: 60 * 1000,\r\n // by default, manager is disposed after 1 hour of being unused\r\n unusedValueLifetime: this._initProps.unusedClientLifetime ?? 60 * 60 * 1000,\r\n // add some logging\r\n onDisposedSingle: /* istanbul ignore next */ (id: string) =>\r\n Logger.logInfo(\r\n PresentationBackendLoggerCategory.PresentationManager,\r\n `Disposed PresentationManager instance with ID: ${id}. Total instances: ${this._clientsStorage!.values.length}.`,\r\n ),\r\n onDisposedAll: /* istanbul ignore next */ () =>\r\n Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Disposed all PresentationManager instances.`),\r\n });\r\n\r\n if (this._initProps.enableSchemasPreload) {\r\n this._disposeIModelOpenedListener = BriefcaseDb.onOpened.addListener(this.onIModelOpened);\r\n }\r\n }\r\n\r\n /**\r\n * Terminates Presentation. Consumers don't need to call this as it's automatically\r\n * called on [IModelHost.onBeforeShutdown]($core-backend) event.\r\n */\r\n public static terminate(): void {\r\n if (this._clientsStorage) {\r\n this._clientsStorage.dispose();\r\n this._clientsStorage = undefined;\r\n }\r\n if (this._disposeIModelOpenedListener) {\r\n this._disposeIModelOpenedListener();\r\n this._disposeIModelOpenedListener = undefined;\r\n }\r\n if (this._shutdownListener) {\r\n this._shutdownListener();\r\n this._shutdownListener = undefined;\r\n }\r\n RpcManager.unregisterImpl(PresentationRpcInterface);\r\n if (this._rpcImpl) {\r\n this._rpcImpl.dispose();\r\n this._rpcImpl = undefined;\r\n }\r\n if (this._disposeIpcHandler) {\r\n this._disposeIpcHandler();\r\n }\r\n this._initProps = undefined;\r\n }\r\n\r\n private static createClientManager(clientId: string, onManagerUsed: () => void): ClientStoreItem {\r\n const manager =\r\n Presentation._initProps && Presentation._initProps.clientManagerFactory\r\n ? Presentation._initProps.clientManagerFactory(clientId, Presentation._initProps)\r\n : new PresentationManager({ ...Presentation._initProps, id: clientId });\r\n manager.setOnManagerUsedHandler(onManagerUsed);\r\n Logger.logInfo(\r\n PresentationBackendLoggerCategory.PresentationManager,\r\n `Created a PresentationManager instance with ID: ${clientId}. Total instances: ${this._clientsStorage!.values.length}.`,\r\n );\r\n return { manager };\r\n }\r\n\r\n private static disposeClientManager(_id: string, storeItem: ClientStoreItem) {\r\n storeItem.manager.dispose();\r\n }\r\n\r\n /**\r\n * Get an instance of [[PresentationManager]] for specific client\r\n * @param clientId ID of the client requesting presentation data. If no\r\n * ID is provided, the default [[PresentationManager]] is returned.\r\n */\r\n public static getManager(clientId?: string): PresentationManager {\r\n if (this._clientsStorage) {\r\n return this._clientsStorage.getValue(clientId || \"\").manager;\r\n }\r\n throw new PresentationError(PresentationStatus.NotInitialized, \"Presentation must be first initialized by calling Presentation.initialize\");\r\n }\r\n\r\n /**\r\n * Get the time in milliseconds that backend should respond in .\r\n */\r\n public static getRequestTimeout(): number {\r\n if (this._rpcImpl === undefined) {\r\n throw new PresentationError(PresentationStatus.NotInitialized, \"Presentation must be first initialized by calling Presentation.initialize\");\r\n }\r\n return this._rpcImpl.requestTimeout;\r\n }\r\n\r\n private static onIModelOpened = (imodel: BriefcaseDb) => {\r\n const manager = this.getManager();\r\n const imodelAddon = manager.getNativePlatform().getImodelAddon(imodel);\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n manager.getNativePlatform().forceLoadSchemas(imodelAddon);\r\n };\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../../src/presentation-backend/Presentation.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;AAEH,sDAAuE;AACvE,sDAA0D;AAC1D,oDAAgD;AAChD,oEAA6G;AAC7G,mEAA4E;AAC5E,qEAAkE;AAClE,+DAAsF;AACtF,+DAA4D;AAC5D,yDAAkE;AA6DlE;;;;;;;;;GASG;AACH,MAAa,YAAY;IAQvB,0BAA0B;IAC1B,gBAAuB,CAAC;IAExB,+DAA+D;IAC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G,CAAC,MAAmB,EAAE,EAAE;IACtD,MAAM,OAAO,GAAG,EAAI,CAAC,UAAU,EAAE,CAAC;IAClC,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACvE,mEAAmE;IACnE,OAAO,CAAC,iBAAiB,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;AAC5D,CAAC,AAL4B,CAK3B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { BriefcaseDb, IModelHost, IpcHost } from \"@itwin/core-backend\";\r\nimport { DisposeFunc, Logger } from \"@itwin/core-bentley\";\r\nimport { RpcManager } from \"@itwin/core-common\";\r\nimport { PresentationError, PresentationRpcInterface, PresentationStatus } from \"@itwin/presentation-common\";\r\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { PresentationIpcHandler } from \"./PresentationIpcHandler\";\r\nimport { PresentationManager, PresentationManagerProps } from \"./PresentationManager\";\r\nimport { PresentationRpcImpl } from \"./PresentationRpcImpl\";\r\nimport { FactoryBasedTemporaryStorage } from \"./TemporaryStorage\";\r\n\r\n/**\r\n * Properties that can be used to configure [[Presentation]] API.\r\n * @public\r\n */\r\nexport interface PresentationProps extends Omit<PresentationManagerProps, \"enableSchemasPreload\"> {\r\n /**\r\n * Time in milliseconds after which the request will timeout.\r\n */\r\n requestTimeout?: number;\r\n\r\n /**\r\n * Should schemas preloading be enabled. If true, [[Presentation]] library listens\r\n * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.\r\n */\r\n enableSchemasPreload?: boolean;\r\n\r\n /**\r\n * Factory method for creating separate managers for each client\r\n * @internal\r\n */\r\n clientManagerFactory?: (clientId: string, props: PresentationManagerProps) => PresentationManager;\r\n\r\n /**\r\n * How much time should an unused client manager be stored in memory\r\n * before it's disposed.\r\n */\r\n unusedClientLifetime?: number;\r\n}\r\n\r\n/**\r\n * Props for initializing the [[Presentation]] library for using multiple [[PresentationManager]]\r\n * instances, one for each frontend.\r\n *\r\n * @public\r\n * @deprecated in 4.8 - use [[PresentationProps]] instead.\r\n */\r\nexport type MultiManagerPresentationProps = PresentationProps;\r\n\r\n/**\r\n * Base props for initializing the [[Presentation]] library.\r\n *\r\n * @public\r\n * @deprecated in 4.8 - use [[PresentationProps]] instead.\r\n */\r\nexport type PresentationPropsBase = PresentationProps;\r\n\r\n/**\r\n * Props for initializing the [[Presentation]] library with ability to use a single\r\n * [[PresentationManager]] instance for handling all requests.\r\n *\r\n * @public\r\n * @deprecated in 4.8 - use [[PresentationProps]] instead.\r\n */\r\nexport type SingleManagerPresentationProps = Omit<PresentationProps, \"clientManagerFactory\" | \"unusedClientLifetime\">;\r\n\r\ninterface ClientStoreItem {\r\n manager: PresentationManager;\r\n}\r\n\r\n/**\r\n * Static class used to statically set up Presentation library for the backend.\r\n * Basically what it does is:\r\n * - Register a RPC implementation\r\n * - Create a singleton [[PresentationManager]] instance\r\n * - Subscribe for [IModelHost.onBeforeShutdown]($core-backend) event and terminate\r\n * the presentation manager when that happens.\r\n *\r\n * @public\r\n */\r\nexport class Presentation {\r\n private static _initProps: PresentationProps | undefined;\r\n private static _clientsStorage: FactoryBasedTemporaryStorage<ClientStoreItem> | undefined;\r\n private static _disposeIpcHandler: DisposeFunc | undefined;\r\n private static _shutdownListener: DisposeFunc | undefined;\r\n private static _disposeIModelOpenedListener: DisposeFunc | undefined;\r\n private static _rpcImpl: PresentationRpcImpl | undefined;\r\n\r\n /* istanbul ignore next */\r\n private constructor() {}\r\n\r\n /** Properties used to initialize the presentation framework */\r\n public static get initProps() {\r\n return this._initProps;\r\n }\r\n\r\n /**\r\n * Initializes Presentation library for the backend.\r\n *\r\n * See [Setting up iTwin.js Presentation library documentation page]($docs/presentation/setup/index.md#backend) for an example.\r\n *\r\n * **Important:** The method should be called after a call to [IModelHost.startup]($core-backend)\r\n *\r\n * @param props Optional properties for [[PresentationManager]]\r\n */\r\n public static initialize(props?: PresentationProps): void {\r\n this._initProps = props || {};\r\n this._shutdownListener = IModelHost.onBeforeShutdown.addListener(() => Presentation.terminate());\r\n\r\n this._rpcImpl = new PresentationRpcImpl({\r\n requestTimeout: this._initProps.requestTimeout,\r\n });\r\n RpcManager.registerImpl(PresentationRpcInterface, PresentationRpcImpl);\r\n RpcManager.supplyImplInstance(PresentationRpcInterface, this._rpcImpl);\r\n\r\n if (IpcHost.isValid) {\r\n this._disposeIpcHandler = PresentationIpcHandler.register();\r\n }\r\n\r\n this._clientsStorage = new FactoryBasedTemporaryStorage<ClientStoreItem>({\r\n factory: this.createClientManager.bind(this),\r\n cleanupHandler: (_id, storeItem) => this.disposeClientManager(_id, storeItem),\r\n // cleanup unused managers every minute\r\n cleanupInterval: 60 * 1000,\r\n // by default, manager is disposed after 1 hour of being unused\r\n unusedValueLifetime: this._initProps.unusedClientLifetime ?? 60 * 60 * 1000,\r\n // add some logging\r\n onDisposedSingle: /* istanbul ignore next */ (id: string) =>\r\n Logger.logInfo(\r\n PresentationBackendLoggerCategory.PresentationManager,\r\n `Disposed PresentationManager instance with ID: ${id}. Total instances: ${this._clientsStorage!.values.length}.`,\r\n ),\r\n onDisposedAll: /* istanbul ignore next */ () =>\r\n Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Disposed all PresentationManager instances.`),\r\n });\r\n\r\n if (this._initProps.enableSchemasPreload) {\r\n this._disposeIModelOpenedListener = BriefcaseDb.onOpened.addListener(this.onIModelOpened);\r\n }\r\n }\r\n\r\n /**\r\n * Terminates Presentation. Consumers don't need to call this as it's automatically\r\n * called on [IModelHost.onBeforeShutdown]($core-backend) event.\r\n */\r\n public static terminate(): void {\r\n if (this._clientsStorage) {\r\n this._clientsStorage.dispose();\r\n this._clientsStorage = undefined;\r\n }\r\n if (this._disposeIModelOpenedListener) {\r\n this._disposeIModelOpenedListener();\r\n this._disposeIModelOpenedListener = undefined;\r\n }\r\n if (this._shutdownListener) {\r\n this._shutdownListener();\r\n this._shutdownListener = undefined;\r\n }\r\n RpcManager.unregisterImpl(PresentationRpcInterface);\r\n if (this._rpcImpl) {\r\n this._rpcImpl.dispose();\r\n this._rpcImpl = undefined;\r\n }\r\n if (this._disposeIpcHandler) {\r\n this._disposeIpcHandler();\r\n }\r\n this._initProps = undefined;\r\n }\r\n\r\n private static createClientManager(clientId: string, onManagerUsed: () => void): ClientStoreItem {\r\n const manager =\r\n Presentation._initProps && Presentation._initProps.clientManagerFactory\r\n ? Presentation._initProps.clientManagerFactory(clientId, Presentation._initProps)\r\n : new PresentationManager({ ...Presentation._initProps, id: clientId });\r\n manager.setOnManagerUsedHandler(onManagerUsed);\r\n Logger.logInfo(\r\n PresentationBackendLoggerCategory.PresentationManager,\r\n `Created a PresentationManager instance with ID: ${clientId}. Total instances: ${this._clientsStorage!.values.length}.`,\r\n );\r\n return { manager };\r\n }\r\n\r\n private static disposeClientManager(_id: string, storeItem: ClientStoreItem) {\r\n storeItem.manager.dispose();\r\n }\r\n\r\n /**\r\n * Get an instance of [[PresentationManager]] for specific client\r\n * @param clientId ID of the client requesting presentation data. If no\r\n * ID is provided, the default [[PresentationManager]] is returned.\r\n */\r\n public static getManager(clientId?: string): PresentationManager {\r\n if (this._clientsStorage) {\r\n return this._clientsStorage.getValue(clientId || \"\").manager;\r\n }\r\n throw new PresentationError(PresentationStatus.NotInitialized, \"Presentation must be first initialized by calling Presentation.initialize\");\r\n }\r\n\r\n /**\r\n * Get the time in milliseconds that backend should respond in .\r\n */\r\n public static getRequestTimeout(): number {\r\n if (this._rpcImpl === undefined) {\r\n throw new PresentationError(PresentationStatus.NotInitialized, \"Presentation must be first initialized by calling Presentation.initialize\");\r\n }\r\n return this._rpcImpl.requestTimeout;\r\n }\r\n\r\n private static onIModelOpened = (imodel: BriefcaseDb) => {\r\n const manager = this.getManager();\r\n const imodelAddon = manager.getNativePlatform().getImodelAddon(imodel);\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n manager.getNativePlatform().forceLoadSchemas(imodelAddon);\r\n };\r\n}\r\n"]}
|
|
@@ -247,7 +247,7 @@ export interface PresentationManagerProps {
|
|
|
247
247
|
* Should schemas preloading be enabled. If true, presentation manager listens
|
|
248
248
|
* for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.
|
|
249
249
|
*
|
|
250
|
-
* @deprecated in 3.x. Use [[
|
|
250
|
+
* @deprecated in 3.x. Use [[PresentationProps.enableSchemasPreload]] instead.
|
|
251
251
|
*/
|
|
252
252
|
enableSchemasPreload?: boolean;
|
|
253
253
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAEL,gBAAgB,IAAI,sBAAsB,EAC1C,8BAA8B,EAC9B,OAAO,EACP,+BAA+B,EAI/B,qBAAqB,EACrB,4BAA4B,EAE5B,UAAU,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,2BAA2B,EAC3B,iBAAiB,EACjB,4BAA4B,EAC5B,iBAAiB,EACjB,4CAA4C,EAC5C,mCAAmC,EACnC,UAAU,EACV,oBAAoB,EACpB,uBAAuB,EACvB,sCAAsC,EAEtC,uBAAuB,EACvB,WAAW,EAGX,IAAI,EACJ,MAAM,EAEN,eAAe,EAEf,oCAAoC,EACpC,IAAI,EACJ,OAAO,EACP,eAAe,EACf,KAAK,EACL,aAAa,EAG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AAC,CAAC,CAAC,CAAC,GAAG,2BAA2B,GACpI,OAAO,CAAC,eAAe,EAAE,CAAC;IAK7B;;;OAGG;IACU,kBAAkB,CAAC,eAAe,EAAE,4BAA4B,CAAC,QAAQ,CAAC,GAAG,2BAA2B,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAIjJ;;;;OAIG;IACU,gBAAgB,CAC3B,cAAc,EAAE,4BAA4B,CAAC,QAAQ,CAAC,GAAG;QAAE,GAAG,EAAE,UAAU,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,2BAA2B,GAC5H,OAAO,CAAC,MAAM,CAAC;IAClB;;;OAGG;IAEU,gBAAgB,CAAC,cAAc,EAAE,8BAA8B,CAAC,QAAQ,CAAC,GAAG,2BAA2B,GAAG,OAAO,CAAC,MAAM,CAAC;IAetI;;;OAGG;IACU,kBAAkB,CAAC,cAAc,EAAE,uBAAuB,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC;CA+B3H"}
|
|
@@ -76,7 +76,7 @@ class PresentationManager {
|
|
|
76
76
|
};
|
|
77
77
|
this._props = props ?? {};
|
|
78
78
|
this._detail = new PresentationManagerDetail_1.PresentationManagerDetail(this._props);
|
|
79
|
-
this.activeLocale = this._props.defaultLocale; // eslint-disable-line
|
|
79
|
+
this.activeLocale = this._props.defaultLocale; // eslint-disable-line @typescript-eslint/no-deprecated
|
|
80
80
|
this._localizationHelper = new presentation_common_1.LocalizationHelper({ getLocalizedString: props?.getLocalizedString ?? Utils_1.getLocalizedStringEN });
|
|
81
81
|
}
|
|
82
82
|
/** Get / set active unit system used to format property values with units */
|
|
@@ -125,7 +125,7 @@ class PresentationManager {
|
|
|
125
125
|
*/
|
|
126
126
|
async getNodes(requestOptions) {
|
|
127
127
|
const serializedNodesJson = await this._detail.getNodes(requestOptions);
|
|
128
|
-
// eslint-disable-next-line
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
129
129
|
const nodesJson = JSON.parse(serializedNodesJson);
|
|
130
130
|
const nodes = presentation_common_1.Node.listFromJSON(nodesJson.nodes);
|
|
131
131
|
return this._localizationHelper.getLocalizedNodes(nodes);
|
|
@@ -233,7 +233,6 @@ class PresentationManager {
|
|
|
233
233
|
const result = await this._detail.getPagedDistinctValues(requestOptions);
|
|
234
234
|
return {
|
|
235
235
|
...result,
|
|
236
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
237
236
|
items: result.items.map((g) => this._localizationHelper.getLocalizedDisplayValueGroup(g)),
|
|
238
237
|
};
|
|
239
238
|
}
|
|
@@ -399,7 +398,7 @@ class PresentationManager {
|
|
|
399
398
|
currRulesetVariables: JSON.stringify(currRulesetVariables),
|
|
400
399
|
expandedNodeKeys: JSON.stringify(options.expandedNodeKeys ?? []),
|
|
401
400
|
};
|
|
402
|
-
// eslint-disable-next-line
|
|
401
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
403
402
|
const reviver = (key, value) => (key === "" ? presentation_common_1.HierarchyCompareInfo.fromJSON(value) : value);
|
|
404
403
|
return JSON.parse(await this._detail.request(params), reviver);
|
|
405
404
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAAyD;AACzD,mDAA+C;AAK/C,oEAmDoC;AACpC,uEAAqI;AACrI,qDAAwF;AACxF,2EAA4F;AAE5F,uEAAiG;AACjG,mEAAgE;AAChE,mCAAuG;AAEvG;;;;GAIG;AACH,IAAY,uBAYX;AAZD,WAAY,uBAAuB;IACjC;;;OAGG;IACH,6EAAQ,CAAA;IAER;;;OAGG;IACH,+EAAS,CAAA;AACX,CAAC,EAZW,uBAAuB,uCAAvB,uBAAuB,QAYlC;AAED;;;GAGG;AACH,IAAY,kBAiBX;AAjBD,WAAY,kBAAkB;IAC5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AE,CAAC;QACpD,MAAM,oBAAoB,GAAG,IAAI,CAAC,gBAAgB,IAAI,oBAAoB,CAAC;QAE3E,MAAM,MAAM,GAAG;YACb,SAAS,EAAE,2CAA0B,CAAC,kBAAkB;YACxD,GAAG,OAAO;YACV,aAAa,EAAE,aAAa,CAAC,QAAQ;YACrC,aAAa,EAAE,aAAa,CAAC,QAAQ;YACrC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC;YAC1D,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC;YAC1D,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC;SACjE,CAAC;QAEF,mDAAmD;QACnD,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,KAAU,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,0CAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACzG,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;CACF;AAneD,kDAmeC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { forkJoin, from, map, mergeMap, of } from \"rxjs\";\r\nimport { eachValueFrom } from \"rxjs-for-await\";\r\nimport { IModelDb } from \"@itwin/core-backend\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport { SchemaContext } from \"@itwin/ecschema-metadata\";\r\nimport {\r\n buildElementProperties,\r\n UnitSystemFormat as CommonUnitSystemFormat,\r\n ComputeSelectionRequestOptions,\r\n Content,\r\n ContentDescriptorRequestOptions,\r\n ContentFlags,\r\n ContentFormatter,\r\n ContentPropertyValueFormatter,\r\n ContentRequestOptions,\r\n ContentSourcesRequestOptions,\r\n DefaultContentDisplayTypes,\r\n Descriptor,\r\n DescriptorOverrides,\r\n DisplayLabelRequestOptions,\r\n DisplayLabelsRequestOptions,\r\n DisplayValueGroup,\r\n DistinctValuesRequestOptions,\r\n ElementProperties,\r\n FilterByInstancePathsHierarchyRequestOptions,\r\n FilterByTextHierarchyRequestOptions,\r\n FormatsMap,\r\n HierarchyCompareInfo,\r\n HierarchyCompareOptions,\r\n HierarchyLevelDescriptorRequestOptions,\r\n HierarchyLevelJSON,\r\n HierarchyRequestOptions,\r\n InstanceKey,\r\n isComputeSelectionRequestOptions,\r\n isSingleElementPropertiesRequestOptions,\r\n Item,\r\n KeySet,\r\n KoqPropertyValueFormatter,\r\n LabelDefinition,\r\n LocalizationHelper,\r\n MultiElementPropertiesRequestOptions,\r\n Node,\r\n NodeKey,\r\n NodePathElement,\r\n Paged,\r\n PagedResponse,\r\n PresentationError,\r\n PresentationStatus,\r\n Prioritized,\r\n Ruleset,\r\n RulesetVariable,\r\n SelectClassInfo,\r\n SelectionScope,\r\n SelectionScopeRequestOptions,\r\n SingleElementPropertiesRequestOptions,\r\n WithCancelEvent,\r\n} from \"@itwin/presentation-common\";\r\nimport { getBatchedClassElementIds, getClassesWithInstances, getElementsCount, parseFullClassName } from \"./ElementPropertiesHelper\";\r\nimport { NativePlatformDefinition, NativePlatformRequestTypes } from \"./NativePlatform\";\r\nimport { getRulesetIdObject, PresentationManagerDetail } from \"./PresentationManagerDetail\";\r\nimport { RulesetManager } from \"./RulesetManager\";\r\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager\";\r\nimport { SelectionScopesHelper } from \"./SelectionScopesHelper\";\r\nimport { BackendDiagnosticsAttribute, BackendDiagnosticsOptions, getLocalizedStringEN } from \"./Utils\";\r\n\r\n/**\r\n * Presentation manager working mode.\r\n * @public\r\n * @deprecated in 3.x. The attribute is not used by [[PresentationManager]] anymore\r\n */\r\nexport enum PresentationManagerMode {\r\n /**\r\n * Presentation manager assumes iModels are opened in read-only mode and avoids doing some work\r\n * related to reacting to changes in iModels.\r\n */\r\n ReadOnly,\r\n\r\n /**\r\n * Presentation manager assumes iModels are opened in read-write mode and it may need to\r\n * react to changes. This involves some additional work and gives slightly worse performance.\r\n */\r\n ReadWrite,\r\n}\r\n\r\n/**\r\n * Presentation hierarchy cache mode.\r\n * @public\r\n */\r\nexport enum HierarchyCacheMode {\r\n /**\r\n * Hierarchy cache is created in memory.\r\n */\r\n Memory = \"memory\",\r\n /**\r\n * Hierarchy cache is created on disk. In this mode hierarchy cache is persisted between iModel\r\n * openings.\r\n */\r\n Disk = \"disk\",\r\n /**\r\n * Hierarchy cache is created on disk. In this mode everything is cached in memory while creating hierarchy level\r\n * and persisted in disk cache when whole hierarchy level is created.\r\n *\r\n * **Note:** This mode is still experimental.\r\n */\r\n Hybrid = \"hybrid\",\r\n}\r\n\r\n/**\r\n * Configuration for hierarchy cache.\r\n * @public\r\n */\r\nexport type HierarchyCacheConfig = MemoryHierarchyCacheConfig | DiskHierarchyCacheConfig | HybridCacheConfig;\r\n\r\n/**\r\n * Base interface for all [[HierarchyCacheConfig]] implementations.\r\n * @public\r\n */\r\nexport interface HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode;\r\n}\r\n\r\n/**\r\n * Configuration for in-memory hierarchy cache.\r\n *\r\n * @see [Memory cache documentation page]($docs/presentation/advanced/Caching.md#memory-cache)\r\n * @public\r\n */\r\nexport interface MemoryHierarchyCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Memory;\r\n}\r\n\r\n/**\r\n * Configuration for persistent disk hierarchy cache.\r\n *\r\n * @see [Disk cache documentation page]($docs/presentation/advanced/Caching.md#disk-cache)\r\n * @public\r\n */\r\nexport interface DiskHierarchyCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Disk;\r\n\r\n /**\r\n * A directory for hierarchy caches. If set, the directory must exist. Relative paths start from `process.cwd()`.\r\n *\r\n * The default directory depends on the iModel and the way it's opened.\r\n */\r\n directory?: string;\r\n\r\n /**\r\n * While the cache itself is stored on a disk, there's still a required small in-memory cache.\r\n * The parameter allows controlling size of that cache. Defaults to `32768000` bytes (32 MB).\r\n */\r\n memoryCacheSize?: number;\r\n}\r\n\r\n/**\r\n * Configuration for the experimental hybrid hierarchy cache.\r\n *\r\n * Hybrid cache uses a combination of in-memory and disk caches, which should make it a better\r\n * alternative for cases when there are lots of simultaneous requests.\r\n *\r\n * @see [Hybrid cache documentation page]($docs/presentation/advanced/Caching.md#hybrid-cache)\r\n * @public\r\n */\r\nexport interface HybridCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Hybrid;\r\n\r\n /** Configuration for disk cache used to persist hierarchies. */\r\n disk?: DiskHierarchyCacheConfig;\r\n}\r\n\r\n/**\r\n * Configuration for content cache.\r\n *\r\n * @see [Content cache documentation page]($docs/presentation/advanced/Caching.md#content-cache)\r\n * @public\r\n */\r\nexport interface ContentCacheConfig {\r\n /**\r\n * Maximum number of content descriptors cached in memory for quicker paged content requests.\r\n *\r\n * Defaults to `100`.\r\n */\r\n size?: number;\r\n}\r\n\r\n/**\r\n * Caching configuration options for [[PresentationManager]].\r\n * @public\r\n */\r\nexport interface PresentationManagerCachingConfig {\r\n /**\r\n * Hierarchies-related caching options.\r\n *\r\n * @see [Hierarchies cache documentation page]($docs/presentation/advanced/Caching.md#hierarchies-cache)\r\n */\r\n hierarchies?: HierarchyCacheConfig;\r\n\r\n /**\r\n * Content-related caching options.\r\n *\r\n * @see [Content cache documentation page]($docs/presentation/advanced/Caching.md#content-cache)\r\n */\r\n content?: ContentCacheConfig;\r\n\r\n /**\r\n * Each worker thread (see [[workerThreadsCount]]) opens a connection to an iModel used for a request. This\r\n * means there could be `{workerThreadsCount} * {iModels count}` number of connections. Each connection\r\n * uses a memory cache to increase iModel read performance. This parameter allows controlling the size of that\r\n * cache. Defaults to `32768000` bytes (32 MB).\r\n *\r\n * @see [Worker connections cache documentation page]($docs/presentation/advanced/Caching.md#worker-connections-cache)\r\n */\r\n workerConnectionCacheSize?: number;\r\n}\r\n\r\n/**\r\n * A data structure that associates unit systems with a format. The associations are used for\r\n * assigning default unit formats for specific phenomenons (see [[PresentationManagerProps.defaultFormats]]).\r\n *\r\n * @public\r\n * @deprecated in 4.3. The type has been moved to `@itwin/presentation-common` package.\r\n */\r\nexport type UnitSystemFormat = CommonUnitSystemFormat;\r\n\r\n/**\r\n * Data structure for multiple element properties request response.\r\n * @public\r\n */\r\nexport interface MultiElementPropertiesResponse<TParsedContent = ElementProperties> {\r\n total: number;\r\n iterator: () => AsyncGenerator<TParsedContent[]>;\r\n}\r\n\r\n/**\r\n * Configuration options for supplying asset paths to [[PresentationManager]].\r\n * @public\r\n */\r\nexport interface PresentationAssetsRootConfig {\r\n /**\r\n * Path to `presentation-backend` assets. Relative paths start from `process.cwd()`.\r\n */\r\n backend: string;\r\n\r\n /**\r\n * Path to `presentation-common` assets.\r\n *\r\n * @deprecated in 3.x. This path is not used anymore\r\n */\r\n common: string;\r\n}\r\n\r\n/**\r\n * Properties that can be used to configure [[PresentationManager]]\r\n * @public\r\n */\r\nexport interface PresentationManagerProps {\r\n /**\r\n * Path overrides for presentation backend assets. Need to be overriden by application if it puts these assets someplace else than the default.\r\n *\r\n * By default the path to assets directory is determined during the call of [[Presentation.initialize]] using this algorithm:\r\n *\r\n * - if path of `.js` file that contains [[PresentationManager]] definition contains \"presentation-backend\", assume the package is in `node_modules` and the directory structure is:\r\n * - `assets/*\\*\\/*`\r\n * - `presentation-backend/{presentation-backend source files}`\r\n *\r\n * which means the assets can be found through a relative path `../assets/` from the JS file being executed.\r\n *\r\n * - else, assume the backend is webpacked into a single file with assets next to it:\r\n * - `assets/*\\*\\/*`\r\n * - `{source file being executed}.js`\r\n *\r\n * which means the assets can be found through a relative path `./assets/` from the `{source file being executed}`.\r\n *\r\n * @deprecated in 4.2. This attribute is not used anymore - the package is not using private assets anymore.\r\n */\r\n presentationAssetsRoot?: string | PresentationAssetsRootConfig;\r\n\r\n /**\r\n * A list of directories containing application's presentation rulesets. Relative\r\n * paths start from `process.cwd()`. The directories are traversed recursively.\r\n *\r\n * @note Only files with `.PresentationRuleSet.json` are read.\r\n */\r\n rulesetDirectories?: string[];\r\n\r\n /**\r\n * A list of directories containing application's supplemental presentation rulesets. Relative\r\n * paths start from `process.cwd()`. The directories are traversed recursively.\r\n *\r\n * @note Only files with `.PresentationRuleSet.json` are read.\r\n */\r\n supplementalRulesetDirectories?: string[];\r\n\r\n /**\r\n * A list of directories containing application's locale-specific localized\r\n * string files (in simplified i18next v3 format)\r\n *\r\n * @deprecated in 3.x. Use [[getLocalizedString]] to localize data returned by [[PresentationManager]].\r\n */\r\n localeDirectories?: string[];\r\n\r\n /**\r\n * Sets the active locale to use when localizing presentation-related\r\n * strings. It can later be changed through [[PresentationManager.activeLocale]].\r\n *\r\n * @deprecated in 3.x. Use [[getLocalizedString]] to localize data returned by [[PresentationManager]].\r\n */\r\n defaultLocale?: string;\r\n\r\n /**\r\n * Sets the active unit system to use for formatting property values with\r\n * units. Default presentation units are used if this is not specified. The active unit\r\n * system can later be changed through [[PresentationManager.activeUnitSystem]] or overriden for each request\r\n * through request options.\r\n */\r\n defaultUnitSystem?: UnitSystemKey;\r\n\r\n /**\r\n * A map of default unit formats to use for formatting properties that don't have a presentation format\r\n * in requested unit system.\r\n */\r\n defaultFormats?: FormatsMap;\r\n\r\n /**\r\n * Should schemas preloading be enabled. If true, presentation manager listens\r\n * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.\r\n *\r\n * @deprecated in 3.x. Use [[PresentationPropsBase.enableSchemasPreload]] instead.\r\n */\r\n enableSchemasPreload?: boolean;\r\n\r\n /**\r\n * A number of worker threads to use for handling presentation requests. Defaults to `2`.\r\n */\r\n workerThreadsCount?: number;\r\n\r\n /**\r\n * Presentation manager working mode. Backends that use iModels in read-write mode should\r\n * use `ReadWrite`, others might want to set to `ReadOnly` for better performance.\r\n *\r\n * Defaults to [[PresentationManagerMode.ReadWrite]].\r\n *\r\n * @deprecated in 3.x. The attribute is not used by [[PresentationManager]] anymore\r\n */\r\n mode?: PresentationManagerMode; // eslint-disable-line deprecation/deprecation\r\n\r\n /**\r\n * The interval (in milliseconds) used to poll for presentation data changes. If not set, presentation\r\n * data changes are not tracked at all.\r\n *\r\n * @beta\r\n * @deprecated in 4.4. The manager now always tracks for iModel data changes without polling.\r\n */\r\n updatesPollInterval?: number;\r\n\r\n /** Options for caching. */\r\n caching?: PresentationManagerCachingConfig;\r\n\r\n /**\r\n * Use [SQLite's Memory-Mapped I/O](https://sqlite.org/mmap.html) for worker connections. This mode improves performance of handling\r\n * requests with high I/O intensity, e.g. filtering large tables on non-indexed columns. No downsides have been noticed.\r\n *\r\n * Set to a falsy value to turn off. `true` for memory-mapping the whole iModel. Number value for memory-mapping the specified amount of bytes.\r\n */\r\n useMmap?: boolean | number;\r\n\r\n /**\r\n * An identifier which helps separate multiple presentation managers. It's\r\n * mostly useful in tests where multiple presentation managers can co-exist\r\n * and try to share the same resources, which we don't want. With this identifier\r\n * set, managers put their resources into id-named subdirectories.\r\n *\r\n * @internal\r\n */\r\n id?: string;\r\n\r\n /** @internal */\r\n addon?: NativePlatformDefinition;\r\n\r\n /**\r\n * Localization function to localize data returned by presentation manager when it's used directly on the backend (as opposed to when used through RPC, where\r\n * data is localized on the frontend). Defaults to English localization.\r\n *\r\n * @see [Localization]($docs/presentation/advanced/Localization)\r\n */\r\n getLocalizedString?: (key: string) => string;\r\n\r\n /**\r\n * Callback that provides [SchemaContext]($ecschema-metadata) for supplied [IModelDb]($core-backend).\r\n * [SchemaContext]($ecschema-metadata) is used for getting metadata required for values formatting.\r\n */\r\n schemaContextProvider?: (imodel: IModelDb) => SchemaContext;\r\n\r\n /**\r\n * Parameters for gathering diagnostics at the manager level. When supplied, they're used with every request\r\n * made through the manager.\r\n *\r\n * @see [Diagnostics documentation page]($docs/presentation/advanced/Diagnostics.md)\r\n */\r\n diagnostics?: BackendDiagnosticsOptions;\r\n}\r\n\r\n/**\r\n * Backend Presentation manager which pulls the presentation data from\r\n * an iModel using native platform.\r\n *\r\n * @public\r\n */\r\nexport class PresentationManager {\r\n private _props: PresentationManagerProps;\r\n private _detail: PresentationManagerDetail;\r\n private _localizationHelper: LocalizationHelper;\r\n\r\n /**\r\n * Get / set active locale used for localizing presentation data\r\n * @deprecated in 3.x. Use [[PresentationManagerProps.getLocalizedString]] to localize data returned by [[PresentationManager]].\r\n */\r\n public activeLocale: string | undefined;\r\n\r\n /**\r\n * Creates an instance of PresentationManager.\r\n * @param props Optional configuration properties.\r\n */\r\n constructor(props?: PresentationManagerProps) {\r\n this._props = props ?? {};\r\n this._detail = new PresentationManagerDetail(this._props);\r\n this.activeLocale = this._props.defaultLocale; // eslint-disable-line deprecation/deprecation\r\n\r\n this._localizationHelper = new LocalizationHelper({ getLocalizedString: props?.getLocalizedString ?? getLocalizedStringEN });\r\n }\r\n\r\n /** Get / set active unit system used to format property values with units */\r\n public get activeUnitSystem(): UnitSystemKey | undefined {\r\n return this._detail.activeUnitSystem;\r\n }\r\n // istanbul ignore next\r\n public set activeUnitSystem(value: UnitSystemKey | undefined) {\r\n this._detail.activeUnitSystem = value;\r\n }\r\n\r\n /** Dispose the presentation manager. Must be called to clean up native resources. */\r\n public dispose() {\r\n this._detail.dispose();\r\n }\r\n\r\n /** @internal */\r\n public setOnManagerUsedHandler(handler: () => void) {\r\n this._detail.setOnManagerUsedHandler(handler);\r\n }\r\n\r\n /** Properties used to initialize the manager */\r\n public get props() {\r\n return this._props;\r\n }\r\n\r\n /** Get rulesets manager */\r\n public rulesets(): RulesetManager {\r\n return this._detail.rulesets;\r\n }\r\n\r\n /**\r\n * Get ruleset variables manager for specific ruleset\r\n * @param rulesetId Id of the ruleset to get variables manager for\r\n */\r\n public vars(rulesetId: string): RulesetVariablesManager {\r\n return new RulesetVariablesManagerImpl(this.getNativePlatform, rulesetId);\r\n }\r\n\r\n /** @internal */\r\n public getNativePlatform = (): NativePlatformDefinition => {\r\n return this._detail.getNativePlatform();\r\n };\r\n\r\n /** @internal */\r\n // istanbul ignore next\r\n public getDetail(): PresentationManagerDetail {\r\n return this._detail;\r\n }\r\n\r\n /** @internal */\r\n public getRulesetId(rulesetOrId: Ruleset | string) {\r\n return this._detail.getRulesetId(rulesetOrId);\r\n }\r\n\r\n /**\r\n * Retrieves nodes\r\n * @public\r\n */\r\n public async getNodes(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>>> & BackendDiagnosticsAttribute,\r\n ): Promise<Node[]> {\r\n const serializedNodesJson = await this._detail.getNodes(requestOptions);\r\n // eslint-disable-next-line deprecation/deprecation\r\n const nodesJson = JSON.parse(serializedNodesJson) as HierarchyLevelJSON;\r\n const nodes = Node.listFromJSON(nodesJson.nodes);\r\n return this._localizationHelper.getLocalizedNodes(nodes);\r\n }\r\n\r\n /**\r\n * Retrieves nodes count\r\n * @public\r\n */\r\n public async getNodesCount(\r\n requestOptions: WithCancelEvent<Prioritized<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<number> {\r\n return this._detail.getNodesCount(requestOptions);\r\n }\r\n\r\n /**\r\n * Retrieves hierarchy level descriptor\r\n * @public\r\n */\r\n public async getNodesDescriptor(\r\n requestOptions: WithCancelEvent<Prioritized<HierarchyLevelDescriptorRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<Descriptor | undefined> {\r\n const response = await this._detail.getNodesDescriptor(requestOptions);\r\n const descriptor = Descriptor.fromJSON(JSON.parse(response));\r\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\r\n }\r\n\r\n /**\r\n * Retrieves paths from root nodes to children nodes according to specified instance key paths. Intersecting paths will be merged.\r\n * TODO: Return results in pages\r\n * @public\r\n */\r\n public async getNodePaths(\r\n requestOptions: WithCancelEvent<Prioritized<FilterByInstancePathsHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n const result = await this._detail.getNodePaths(requestOptions);\r\n return result.map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\r\n }\r\n\r\n /**\r\n * Retrieves paths from root nodes to nodes containing filter text in their label.\r\n * TODO: Return results in pages\r\n * @public\r\n */\r\n public async getFilteredNodePaths(\r\n requestOptions: WithCancelEvent<Prioritized<FilterByTextHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n const result = await this._detail.getFilteredNodePaths(requestOptions);\r\n return result.map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\r\n }\r\n\r\n /**\r\n * Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,\r\n * its related instances for loading related and navigation properties.\r\n * @public\r\n */\r\n public async getContentSources(\r\n requestOptions: WithCancelEvent<Prioritized<ContentSourcesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute,\r\n ): Promise<SelectClassInfo[]> {\r\n return this._detail.getContentSources(requestOptions);\r\n }\r\n\r\n /**\r\n * Retrieves the content descriptor which can be used to get content\r\n * @public\r\n */\r\n public async getContentDescriptor(\r\n requestOptions: WithCancelEvent<Prioritized<ContentDescriptorRequestOptions<IModelDb, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<Descriptor | undefined> {\r\n const response = await this._detail.getContentDescriptor(requestOptions);\r\n const descriptor = Descriptor.fromJSON(JSON.parse(response));\r\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\r\n }\r\n\r\n /**\r\n * Retrieves the content set size based on the supplied content descriptor override\r\n * @public\r\n */\r\n public async getContentSetSize(\r\n requestOptions: WithCancelEvent<Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<number> {\r\n return this._detail.getContentSetSize(requestOptions);\r\n }\r\n\r\n /**\r\n * Retrieves the content set based on the supplied content descriptor.\r\n * @public\r\n */\r\n public async getContentSet(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor, KeySet, RulesetVariable>>>> & BackendDiagnosticsAttribute,\r\n ): Promise<Item[]> {\r\n let items = await this._detail.getContentSet({\r\n ...requestOptions,\r\n ...(!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),\r\n });\r\n\r\n if (!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined) {\r\n const koqPropertyFormatter = new KoqPropertyValueFormatter(this.props.schemaContextProvider(requestOptions.imodel), this.props.defaultFormats);\r\n const formatter = new ContentFormatter(\r\n new ContentPropertyValueFormatter(koqPropertyFormatter),\r\n requestOptions.unitSystem ?? this.props.defaultUnitSystem,\r\n );\r\n items = await formatter.formatContentItems(items, requestOptions.descriptor);\r\n }\r\n\r\n return this._localizationHelper.getLocalizedContentItems(items);\r\n }\r\n\r\n /**\r\n * Retrieves the content based on the supplied content descriptor override.\r\n * @public\r\n */\r\n public async getContent(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<Content | undefined> {\r\n const content = await this._detail.getContent({\r\n ...requestOptions,\r\n ...(!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),\r\n });\r\n\r\n if (!content) {\r\n return undefined;\r\n }\r\n\r\n if (!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined) {\r\n const koqPropertyFormatter = new KoqPropertyValueFormatter(this.props.schemaContextProvider(requestOptions.imodel), this.props.defaultFormats);\r\n const formatter = new ContentFormatter(\r\n new ContentPropertyValueFormatter(koqPropertyFormatter),\r\n requestOptions.unitSystem ?? this.props.defaultUnitSystem,\r\n );\r\n await formatter.formatContent(content);\r\n }\r\n\r\n return this._localizationHelper.getLocalizedContent(content);\r\n }\r\n\r\n /**\r\n * Retrieves distinct values of specific field from the content based on the supplied content descriptor override.\r\n * @param requestOptions Options for the request\r\n * @return A promise object that returns either distinct values on success or an error string on error.\r\n * @public\r\n */\r\n public async getPagedDistinctValues(\r\n requestOptions: WithCancelEvent<Prioritized<DistinctValuesRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<PagedResponse<DisplayValueGroup>> {\r\n const result = await this._detail.getPagedDistinctValues(requestOptions);\r\n return {\r\n ...result,\r\n // eslint-disable-next-line deprecation/deprecation\r\n items: result.items.map((g) => this._localizationHelper.getLocalizedDisplayValueGroup(g)),\r\n };\r\n }\r\n\r\n /**\r\n * Retrieves property data in a simplified format for a single element specified by ID.\r\n * @public\r\n */\r\n public async getElementProperties<TParsedContent = ElementProperties>(\r\n requestOptions: WithCancelEvent<Prioritized<SingleElementPropertiesRequestOptions<IModelDb, TParsedContent>>> & BackendDiagnosticsAttribute,\r\n ): Promise<TParsedContent | undefined>;\r\n /**\r\n * Retrieves property data in simplified format for multiple elements specified by class or all element.\r\n * @return An object that contains element count and AsyncGenerator to iterate over properties of those elements in batches of undefined size.\r\n * @public\r\n */\r\n public async getElementProperties<TParsedContent = ElementProperties>(\r\n requestOptions: WithCancelEvent<Prioritized<MultiElementPropertiesRequestOptions<IModelDb, TParsedContent>>> & BackendDiagnosticsAttribute,\r\n ): Promise<MultiElementPropertiesResponse<TParsedContent>>;\r\n public async getElementProperties<TParsedContent = ElementProperties>(\r\n requestOptions: WithCancelEvent<\r\n Prioritized<SingleElementPropertiesRequestOptions<IModelDb, TParsedContent> | MultiElementPropertiesRequestOptions<IModelDb, TParsedContent>>\r\n > &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<TParsedContent | undefined | MultiElementPropertiesResponse<TParsedContent>> {\r\n if (isSingleElementPropertiesRequestOptions(requestOptions)) {\r\n return this.getSingleElementProperties<TParsedContent>(requestOptions);\r\n }\r\n return this.getMultipleElementProperties<TParsedContent>(requestOptions);\r\n }\r\n\r\n private async getSingleElementProperties<TParsedContent>(\r\n requestOptions: WithCancelEvent<Prioritized<SingleElementPropertiesRequestOptions<IModelDb, TParsedContent>>> & BackendDiagnosticsAttribute,\r\n ): Promise<TParsedContent | undefined> {\r\n type TParser = Required<typeof requestOptions>[\"contentParser\"];\r\n const { elementId, contentParser, ...optionsNoElementId } = requestOptions;\r\n const parser: TParser = contentParser ?? (buildElementProperties as TParser);\r\n const content = await this.getContent({\r\n ...optionsNoElementId,\r\n descriptor: {\r\n displayType: DefaultContentDisplayTypes.PropertyPane,\r\n contentFlags: ContentFlags.ShowLabels,\r\n },\r\n rulesetOrId: \"ElementProperties\",\r\n keys: new KeySet([{ className: \"BisCore:Element\", id: elementId }]),\r\n });\r\n if (!content || content.contentSet.length === 0) {\r\n return undefined;\r\n }\r\n return parser(content.descriptor, content.contentSet[0]);\r\n }\r\n\r\n private async getMultipleElementProperties<TParsedContent>(\r\n requestOptions: WithCancelEvent<Prioritized<MultiElementPropertiesRequestOptions<IModelDb, TParsedContent>>> & BackendDiagnosticsAttribute,\r\n ): Promise<MultiElementPropertiesResponse<TParsedContent>> {\r\n type TParser = Required<typeof requestOptions>[\"contentParser\"];\r\n const { elementClasses, contentParser, batchSize, ...contentOptions } = requestOptions;\r\n const parser: TParser = contentParser ?? (buildElementProperties as TParser);\r\n const workerThreadsCount = this._props.workerThreadsCount ?? 2;\r\n\r\n // We don't want to request content for all classes at once - each class results in a huge content descriptor object that's cached in memory\r\n // and can be shared across all batch requests for that class. Handling multiple classes at the same time not only increases memory footprint,\r\n // but also may push descriptors out of cache, requiring us to recreate them, thus making performance worse. For those reasons we handle at\r\n // most `workerThreadsCount / 2` classes in parallel.\r\n // istanbul ignore next\r\n const classParallelism = workerThreadsCount > 1 ? workerThreadsCount / 2 : 1;\r\n\r\n // We want all worker threads to be constantly busy. However, there's some fairly expensive work being done after the worker thread is done,\r\n // but before we receive the response. That means the worker thread would be starving if we sent only `workerThreadsCount` requests in parallel.\r\n // To avoid that, we keep twice as much requests active.\r\n // istanbul ignore next\r\n const batchesParallelism = workerThreadsCount > 0 ? workerThreadsCount * 2 : 2;\r\n\r\n const createClassContentRuleset = (fullClassName: string): Ruleset => {\r\n const [schemaName, className] = parseFullClassName(fullClassName);\r\n return {\r\n id: `content/${fullClassName}`,\r\n rules: [\r\n {\r\n ruleType: \"Content\",\r\n specifications: [\r\n {\r\n specType: \"ContentInstancesOfSpecificClasses\",\r\n classes: {\r\n schemaName,\r\n classNames: [className],\r\n arePolymorphic: false,\r\n },\r\n handlePropertiesPolymorphically: true,\r\n },\r\n ],\r\n },\r\n ],\r\n };\r\n };\r\n const getContentDescriptor = async (ruleset: Ruleset): Promise<Descriptor> => {\r\n return (await this.getContentDescriptor({\r\n ...contentOptions,\r\n rulesetOrId: ruleset,\r\n displayType: DefaultContentDisplayTypes.Grid,\r\n contentFlags: ContentFlags.ShowLabels,\r\n keys: new KeySet(),\r\n }))!;\r\n };\r\n\r\n const obs = getClassesWithInstances(requestOptions.imodel, elementClasses ?? /* istanbul ignore next */ [\"BisCore.Element\"]).pipe(\r\n map((classFullName) => ({\r\n classFullName,\r\n ruleset: createClassContentRuleset(classFullName),\r\n })),\r\n mergeMap(\r\n ({ classFullName, ruleset }) =>\r\n // use forkJoin to query descriptor and element ids in parallel\r\n forkJoin({\r\n classFullName: of(classFullName),\r\n ruleset: of(ruleset),\r\n descriptor: from(getContentDescriptor(ruleset)),\r\n batches: from(getBatchedClassElementIds(requestOptions.imodel, classFullName, batchSize ?? /* istanbul ignore next */ 1000)),\r\n }).pipe(\r\n // split incoming stream into individual batch requests\r\n mergeMap(({ descriptor, batches }) => from(batches.map((batch) => ({ classFullName, descriptor, batch })))),\r\n // request content for each batch, filter by IDs for performance\r\n mergeMap(({ descriptor, batch }) => {\r\n const filteringDescriptor = new Descriptor(descriptor);\r\n filteringDescriptor.instanceFilter = {\r\n selectClassName: classFullName,\r\n expression: `this.ECInstanceId >= ${Number.parseInt(batch.from, 16)} AND this.ECInstanceId <= ${Number.parseInt(batch.to, 16)}`,\r\n };\r\n return from(\r\n this.getContentSet({\r\n ...contentOptions,\r\n keys: new KeySet(),\r\n descriptor: filteringDescriptor,\r\n rulesetOrId: ruleset,\r\n }),\r\n ).pipe(map((items) => ({ classFullName, descriptor, items })));\r\n }, batchesParallelism),\r\n ),\r\n classParallelism,\r\n ),\r\n map(({ descriptor, items }) => items.map((item) => parser(descriptor, item))),\r\n );\r\n\r\n return {\r\n total: getElementsCount(requestOptions.imodel, elementClasses),\r\n async *iterator() {\r\n for await (const batch of eachValueFrom(obs)) {\r\n yield batch;\r\n }\r\n },\r\n };\r\n }\r\n\r\n /**\r\n * Retrieves display label definition of specific item\r\n * @public\r\n */\r\n public async getDisplayLabelDefinition(\r\n requestOptions: WithCancelEvent<Prioritized<DisplayLabelRequestOptions<IModelDb, InstanceKey>>> & BackendDiagnosticsAttribute,\r\n ): Promise<LabelDefinition> {\r\n const labelDefinition = await this._detail.getDisplayLabelDefinition(requestOptions);\r\n return this._localizationHelper.getLocalizedLabelDefinition(labelDefinition);\r\n }\r\n\r\n /**\r\n * Retrieves display label definitions of specific items\r\n * @public\r\n */\r\n public async getDisplayLabelDefinitions(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<DisplayLabelsRequestOptions<IModelDb, InstanceKey>>>> & BackendDiagnosticsAttribute,\r\n ): Promise<LabelDefinition[]> {\r\n const labelDefinitions = await this._detail.getDisplayLabelDefinitions(requestOptions);\r\n return this._localizationHelper.getLocalizedLabelDefinitions(labelDefinitions);\r\n }\r\n\r\n /**\r\n * Retrieves available selection scopes.\r\n * @public\r\n */\r\n public async getSelectionScopes(_requestOptions: SelectionScopeRequestOptions<IModelDb> & BackendDiagnosticsAttribute): Promise<SelectionScope[]> {\r\n return SelectionScopesHelper.getSelectionScopes();\r\n }\r\n\r\n /**\r\n * Computes selection set based on provided selection scope.\r\n * @public\r\n * @deprecated in 3.x. Use overload with `ComputeSelectionRequestOptions` parameter.\r\n */\r\n public async computeSelection(\r\n requestOptions: SelectionScopeRequestOptions<IModelDb> & { ids: Id64String[]; scopeId: string } & BackendDiagnosticsAttribute,\r\n ): Promise<KeySet>;\r\n /**\r\n * Computes selection based on provided element IDs and selection scope.\r\n * @public\r\n */\r\n // eslint-disable-next-line @typescript-eslint/unified-signatures\r\n public async computeSelection(requestOptions: ComputeSelectionRequestOptions<IModelDb> & BackendDiagnosticsAttribute): Promise<KeySet>;\r\n public async computeSelection(\r\n requestOptions: ((SelectionScopeRequestOptions<IModelDb> & { ids: Id64String[]; scopeId: string }) | ComputeSelectionRequestOptions<IModelDb>) &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<KeySet> {\r\n return SelectionScopesHelper.computeSelection(\r\n isComputeSelectionRequestOptions(requestOptions)\r\n ? requestOptions\r\n : (function () {\r\n const { ids, scopeId, ...rest } = requestOptions;\r\n return { ...rest, elementIds: ids, scope: { id: scopeId } };\r\n })(),\r\n );\r\n }\r\n\r\n /**\r\n * Compares two hierarchies specified in the request options\r\n * @public\r\n */\r\n public async compareHierarchies(requestOptions: HierarchyCompareOptions<IModelDb, NodeKey>): Promise<HierarchyCompareInfo> {\r\n if (!requestOptions.prev.rulesetOrId && !requestOptions.prev.rulesetVariables) {\r\n return { changes: [] };\r\n }\r\n\r\n const { rulesetOrId, prev, rulesetVariables, ...options } = requestOptions;\r\n this._detail.registerRuleset(rulesetOrId);\r\n\r\n const currRulesetId = getRulesetIdObject(requestOptions.rulesetOrId);\r\n const prevRulesetId = prev.rulesetOrId ? getRulesetIdObject(prev.rulesetOrId) : currRulesetId;\r\n if (prevRulesetId.parts.id !== currRulesetId.parts.id) {\r\n throw new PresentationError(PresentationStatus.InvalidArgument, \"Can't compare rulesets with different IDs\");\r\n }\r\n\r\n const currRulesetVariables = rulesetVariables ?? [];\r\n const prevRulesetVariables = prev.rulesetVariables ?? currRulesetVariables;\r\n\r\n const params = {\r\n requestId: NativePlatformRequestTypes.CompareHierarchies,\r\n ...options,\r\n prevRulesetId: prevRulesetId.uniqueId,\r\n currRulesetId: currRulesetId.uniqueId,\r\n prevRulesetVariables: JSON.stringify(prevRulesetVariables),\r\n currRulesetVariables: JSON.stringify(currRulesetVariables),\r\n expandedNodeKeys: JSON.stringify(options.expandedNodeKeys ?? []),\r\n };\r\n\r\n // eslint-disable-next-line deprecation/deprecation\r\n const reviver = (key: string, value: any) => (key === \"\" ? HierarchyCompareInfo.fromJSON(value) : value);\r\n return JSON.parse(await this._detail.request(params), reviver);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAAyD;AACzD,mDAA+C;AAK/C,oEAmDoC;AACpC,uEAAqI;AACrI,qDAAwF;AACxF,2EAA4F;AAE5F,uEAAiG;AACjG,mEAAgE;AAChE,mCAAuG;AAEvG;;;;GAIG;AACH,IAAY,uBAYX;AAZD,WAAY,uBAAuB;IACjC;;;OAGG;IACH,6EAAQ,CAAA;IAER;;;OAGG;IACH,+EAAS,CAAA;AACX,CAAC,EAZW,uBAAuB,uCAAvB,uBAAuB,QAYlC;AAED;;;GAGG;AACH,IAAY,kBAiBX;AAjBD,WAAY,kBAAkB;IAC5B;;OAEG;IACH,uCAAiB,CAAA;IACjB;;;OAGG;IACH,mCAAa,CAAA;IACb;;;;;OAKG;IACH,uCAAiB,CAAA;AACnB,CAAC,EAjBW,kBAAkB,kCAAlB,kBAAkB,QAiB7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YACV,aAAa,EAAE,aAAa,CAAC,QAAQ;YACrC,aAAa,EAAE,aAAa,CAAC,QAAQ;YACrC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC;YAC1D,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC;YAC1D,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC;SACjE,CAAC;QAEF,4DAA4D;QAC5D,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,KAAU,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,0CAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACzG,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;CACF;AAleD,kDAkeC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { forkJoin, from, map, mergeMap, of } from \"rxjs\";\r\nimport { eachValueFrom } from \"rxjs-for-await\";\r\nimport { IModelDb } from \"@itwin/core-backend\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport { SchemaContext } from \"@itwin/ecschema-metadata\";\r\nimport {\r\n buildElementProperties,\r\n UnitSystemFormat as CommonUnitSystemFormat,\r\n ComputeSelectionRequestOptions,\r\n Content,\r\n ContentDescriptorRequestOptions,\r\n ContentFlags,\r\n ContentFormatter,\r\n ContentPropertyValueFormatter,\r\n ContentRequestOptions,\r\n ContentSourcesRequestOptions,\r\n DefaultContentDisplayTypes,\r\n Descriptor,\r\n DescriptorOverrides,\r\n DisplayLabelRequestOptions,\r\n DisplayLabelsRequestOptions,\r\n DisplayValueGroup,\r\n DistinctValuesRequestOptions,\r\n ElementProperties,\r\n FilterByInstancePathsHierarchyRequestOptions,\r\n FilterByTextHierarchyRequestOptions,\r\n FormatsMap,\r\n HierarchyCompareInfo,\r\n HierarchyCompareOptions,\r\n HierarchyLevelDescriptorRequestOptions,\r\n HierarchyLevelJSON,\r\n HierarchyRequestOptions,\r\n InstanceKey,\r\n isComputeSelectionRequestOptions,\r\n isSingleElementPropertiesRequestOptions,\r\n Item,\r\n KeySet,\r\n KoqPropertyValueFormatter,\r\n LabelDefinition,\r\n LocalizationHelper,\r\n MultiElementPropertiesRequestOptions,\r\n Node,\r\n NodeKey,\r\n NodePathElement,\r\n Paged,\r\n PagedResponse,\r\n PresentationError,\r\n PresentationStatus,\r\n Prioritized,\r\n Ruleset,\r\n RulesetVariable,\r\n SelectClassInfo,\r\n SelectionScope,\r\n SelectionScopeRequestOptions,\r\n SingleElementPropertiesRequestOptions,\r\n WithCancelEvent,\r\n} from \"@itwin/presentation-common\";\r\nimport { getBatchedClassElementIds, getClassesWithInstances, getElementsCount, parseFullClassName } from \"./ElementPropertiesHelper\";\r\nimport { NativePlatformDefinition, NativePlatformRequestTypes } from \"./NativePlatform\";\r\nimport { getRulesetIdObject, PresentationManagerDetail } from \"./PresentationManagerDetail\";\r\nimport { RulesetManager } from \"./RulesetManager\";\r\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager\";\r\nimport { SelectionScopesHelper } from \"./SelectionScopesHelper\";\r\nimport { BackendDiagnosticsAttribute, BackendDiagnosticsOptions, getLocalizedStringEN } from \"./Utils\";\r\n\r\n/**\r\n * Presentation manager working mode.\r\n * @public\r\n * @deprecated in 3.x. The attribute is not used by [[PresentationManager]] anymore\r\n */\r\nexport enum PresentationManagerMode {\r\n /**\r\n * Presentation manager assumes iModels are opened in read-only mode and avoids doing some work\r\n * related to reacting to changes in iModels.\r\n */\r\n ReadOnly,\r\n\r\n /**\r\n * Presentation manager assumes iModels are opened in read-write mode and it may need to\r\n * react to changes. This involves some additional work and gives slightly worse performance.\r\n */\r\n ReadWrite,\r\n}\r\n\r\n/**\r\n * Presentation hierarchy cache mode.\r\n * @public\r\n */\r\nexport enum HierarchyCacheMode {\r\n /**\r\n * Hierarchy cache is created in memory.\r\n */\r\n Memory = \"memory\",\r\n /**\r\n * Hierarchy cache is created on disk. In this mode hierarchy cache is persisted between iModel\r\n * openings.\r\n */\r\n Disk = \"disk\",\r\n /**\r\n * Hierarchy cache is created on disk. In this mode everything is cached in memory while creating hierarchy level\r\n * and persisted in disk cache when whole hierarchy level is created.\r\n *\r\n * **Note:** This mode is still experimental.\r\n */\r\n Hybrid = \"hybrid\",\r\n}\r\n\r\n/**\r\n * Configuration for hierarchy cache.\r\n * @public\r\n */\r\nexport type HierarchyCacheConfig = MemoryHierarchyCacheConfig | DiskHierarchyCacheConfig | HybridCacheConfig;\r\n\r\n/**\r\n * Base interface for all [[HierarchyCacheConfig]] implementations.\r\n * @public\r\n */\r\nexport interface HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode;\r\n}\r\n\r\n/**\r\n * Configuration for in-memory hierarchy cache.\r\n *\r\n * @see [Memory cache documentation page]($docs/presentation/advanced/Caching.md#memory-cache)\r\n * @public\r\n */\r\nexport interface MemoryHierarchyCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Memory;\r\n}\r\n\r\n/**\r\n * Configuration for persistent disk hierarchy cache.\r\n *\r\n * @see [Disk cache documentation page]($docs/presentation/advanced/Caching.md#disk-cache)\r\n * @public\r\n */\r\nexport interface DiskHierarchyCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Disk;\r\n\r\n /**\r\n * A directory for hierarchy caches. If set, the directory must exist. Relative paths start from `process.cwd()`.\r\n *\r\n * The default directory depends on the iModel and the way it's opened.\r\n */\r\n directory?: string;\r\n\r\n /**\r\n * While the cache itself is stored on a disk, there's still a required small in-memory cache.\r\n * The parameter allows controlling size of that cache. Defaults to `32768000` bytes (32 MB).\r\n */\r\n memoryCacheSize?: number;\r\n}\r\n\r\n/**\r\n * Configuration for the experimental hybrid hierarchy cache.\r\n *\r\n * Hybrid cache uses a combination of in-memory and disk caches, which should make it a better\r\n * alternative for cases when there are lots of simultaneous requests.\r\n *\r\n * @see [Hybrid cache documentation page]($docs/presentation/advanced/Caching.md#hybrid-cache)\r\n * @public\r\n */\r\nexport interface HybridCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Hybrid;\r\n\r\n /** Configuration for disk cache used to persist hierarchies. */\r\n disk?: DiskHierarchyCacheConfig;\r\n}\r\n\r\n/**\r\n * Configuration for content cache.\r\n *\r\n * @see [Content cache documentation page]($docs/presentation/advanced/Caching.md#content-cache)\r\n * @public\r\n */\r\nexport interface ContentCacheConfig {\r\n /**\r\n * Maximum number of content descriptors cached in memory for quicker paged content requests.\r\n *\r\n * Defaults to `100`.\r\n */\r\n size?: number;\r\n}\r\n\r\n/**\r\n * Caching configuration options for [[PresentationManager]].\r\n * @public\r\n */\r\nexport interface PresentationManagerCachingConfig {\r\n /**\r\n * Hierarchies-related caching options.\r\n *\r\n * @see [Hierarchies cache documentation page]($docs/presentation/advanced/Caching.md#hierarchies-cache)\r\n */\r\n hierarchies?: HierarchyCacheConfig;\r\n\r\n /**\r\n * Content-related caching options.\r\n *\r\n * @see [Content cache documentation page]($docs/presentation/advanced/Caching.md#content-cache)\r\n */\r\n content?: ContentCacheConfig;\r\n\r\n /**\r\n * Each worker thread (see [[workerThreadsCount]]) opens a connection to an iModel used for a request. This\r\n * means there could be `{workerThreadsCount} * {iModels count}` number of connections. Each connection\r\n * uses a memory cache to increase iModel read performance. This parameter allows controlling the size of that\r\n * cache. Defaults to `32768000` bytes (32 MB).\r\n *\r\n * @see [Worker connections cache documentation page]($docs/presentation/advanced/Caching.md#worker-connections-cache)\r\n */\r\n workerConnectionCacheSize?: number;\r\n}\r\n\r\n/**\r\n * A data structure that associates unit systems with a format. The associations are used for\r\n * assigning default unit formats for specific phenomenons (see [[PresentationManagerProps.defaultFormats]]).\r\n *\r\n * @public\r\n * @deprecated in 4.3. The type has been moved to `@itwin/presentation-common` package.\r\n */\r\nexport type UnitSystemFormat = CommonUnitSystemFormat;\r\n\r\n/**\r\n * Data structure for multiple element properties request response.\r\n * @public\r\n */\r\nexport interface MultiElementPropertiesResponse<TParsedContent = ElementProperties> {\r\n total: number;\r\n iterator: () => AsyncGenerator<TParsedContent[]>;\r\n}\r\n\r\n/**\r\n * Configuration options for supplying asset paths to [[PresentationManager]].\r\n * @public\r\n */\r\nexport interface PresentationAssetsRootConfig {\r\n /**\r\n * Path to `presentation-backend` assets. Relative paths start from `process.cwd()`.\r\n */\r\n backend: string;\r\n\r\n /**\r\n * Path to `presentation-common` assets.\r\n *\r\n * @deprecated in 3.x. This path is not used anymore\r\n */\r\n common: string;\r\n}\r\n\r\n/**\r\n * Properties that can be used to configure [[PresentationManager]]\r\n * @public\r\n */\r\nexport interface PresentationManagerProps {\r\n /**\r\n * Path overrides for presentation backend assets. Need to be overriden by application if it puts these assets someplace else than the default.\r\n *\r\n * By default the path to assets directory is determined during the call of [[Presentation.initialize]] using this algorithm:\r\n *\r\n * - if path of `.js` file that contains [[PresentationManager]] definition contains \"presentation-backend\", assume the package is in `node_modules` and the directory structure is:\r\n * - `assets/*\\*\\/*`\r\n * - `presentation-backend/{presentation-backend source files}`\r\n *\r\n * which means the assets can be found through a relative path `../assets/` from the JS file being executed.\r\n *\r\n * - else, assume the backend is webpacked into a single file with assets next to it:\r\n * - `assets/*\\*\\/*`\r\n * - `{source file being executed}.js`\r\n *\r\n * which means the assets can be found through a relative path `./assets/` from the `{source file being executed}`.\r\n *\r\n * @deprecated in 4.2. This attribute is not used anymore - the package is not using private assets anymore.\r\n */\r\n presentationAssetsRoot?: string | PresentationAssetsRootConfig;\r\n\r\n /**\r\n * A list of directories containing application's presentation rulesets. Relative\r\n * paths start from `process.cwd()`. The directories are traversed recursively.\r\n *\r\n * @note Only files with `.PresentationRuleSet.json` are read.\r\n */\r\n rulesetDirectories?: string[];\r\n\r\n /**\r\n * A list of directories containing application's supplemental presentation rulesets. Relative\r\n * paths start from `process.cwd()`. The directories are traversed recursively.\r\n *\r\n * @note Only files with `.PresentationRuleSet.json` are read.\r\n */\r\n supplementalRulesetDirectories?: string[];\r\n\r\n /**\r\n * A list of directories containing application's locale-specific localized\r\n * string files (in simplified i18next v3 format)\r\n *\r\n * @deprecated in 3.x. Use [[getLocalizedString]] to localize data returned by [[PresentationManager]].\r\n */\r\n localeDirectories?: string[];\r\n\r\n /**\r\n * Sets the active locale to use when localizing presentation-related\r\n * strings. It can later be changed through [[PresentationManager.activeLocale]].\r\n *\r\n * @deprecated in 3.x. Use [[getLocalizedString]] to localize data returned by [[PresentationManager]].\r\n */\r\n defaultLocale?: string;\r\n\r\n /**\r\n * Sets the active unit system to use for formatting property values with\r\n * units. Default presentation units are used if this is not specified. The active unit\r\n * system can later be changed through [[PresentationManager.activeUnitSystem]] or overriden for each request\r\n * through request options.\r\n */\r\n defaultUnitSystem?: UnitSystemKey;\r\n\r\n /**\r\n * A map of default unit formats to use for formatting properties that don't have a presentation format\r\n * in requested unit system.\r\n */\r\n defaultFormats?: FormatsMap;\r\n\r\n /**\r\n * Should schemas preloading be enabled. If true, presentation manager listens\r\n * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.\r\n *\r\n * @deprecated in 3.x. Use [[PresentationProps.enableSchemasPreload]] instead.\r\n */\r\n enableSchemasPreload?: boolean;\r\n\r\n /**\r\n * A number of worker threads to use for handling presentation requests. Defaults to `2`.\r\n */\r\n workerThreadsCount?: number;\r\n\r\n /**\r\n * Presentation manager working mode. Backends that use iModels in read-write mode should\r\n * use `ReadWrite`, others might want to set to `ReadOnly` for better performance.\r\n *\r\n * Defaults to [[PresentationManagerMode.ReadWrite]].\r\n *\r\n * @deprecated in 3.x. The attribute is not used by [[PresentationManager]] anymore\r\n */\r\n mode?: PresentationManagerMode; // eslint-disable-line @typescript-eslint/no-deprecated\r\n\r\n /**\r\n * The interval (in milliseconds) used to poll for presentation data changes. If not set, presentation\r\n * data changes are not tracked at all.\r\n *\r\n * @beta\r\n * @deprecated in 4.4. The manager now always tracks for iModel data changes without polling.\r\n */\r\n updatesPollInterval?: number;\r\n\r\n /** Options for caching. */\r\n caching?: PresentationManagerCachingConfig;\r\n\r\n /**\r\n * Use [SQLite's Memory-Mapped I/O](https://sqlite.org/mmap.html) for worker connections. This mode improves performance of handling\r\n * requests with high I/O intensity, e.g. filtering large tables on non-indexed columns. No downsides have been noticed.\r\n *\r\n * Set to a falsy value to turn off. `true` for memory-mapping the whole iModel. Number value for memory-mapping the specified amount of bytes.\r\n */\r\n useMmap?: boolean | number;\r\n\r\n /**\r\n * An identifier which helps separate multiple presentation managers. It's\r\n * mostly useful in tests where multiple presentation managers can co-exist\r\n * and try to share the same resources, which we don't want. With this identifier\r\n * set, managers put their resources into id-named subdirectories.\r\n *\r\n * @internal\r\n */\r\n id?: string;\r\n\r\n /** @internal */\r\n addon?: NativePlatformDefinition;\r\n\r\n /**\r\n * Localization function to localize data returned by presentation manager when it's used directly on the backend (as opposed to when used through RPC, where\r\n * data is localized on the frontend). Defaults to English localization.\r\n *\r\n * @see [Localization]($docs/presentation/advanced/Localization)\r\n */\r\n getLocalizedString?: (key: string) => string;\r\n\r\n /**\r\n * Callback that provides [SchemaContext]($ecschema-metadata) for supplied [IModelDb]($core-backend).\r\n * [SchemaContext]($ecschema-metadata) is used for getting metadata required for values formatting.\r\n */\r\n schemaContextProvider?: (imodel: IModelDb) => SchemaContext;\r\n\r\n /**\r\n * Parameters for gathering diagnostics at the manager level. When supplied, they're used with every request\r\n * made through the manager.\r\n *\r\n * @see [Diagnostics documentation page]($docs/presentation/advanced/Diagnostics.md)\r\n */\r\n diagnostics?: BackendDiagnosticsOptions;\r\n}\r\n\r\n/**\r\n * Backend Presentation manager which pulls the presentation data from\r\n * an iModel using native platform.\r\n *\r\n * @public\r\n */\r\nexport class PresentationManager {\r\n private _props: PresentationManagerProps;\r\n private _detail: PresentationManagerDetail;\r\n private _localizationHelper: LocalizationHelper;\r\n\r\n /**\r\n * Get / set active locale used for localizing presentation data\r\n * @deprecated in 3.x. Use [[PresentationManagerProps.getLocalizedString]] to localize data returned by [[PresentationManager]].\r\n */\r\n public activeLocale: string | undefined;\r\n\r\n /**\r\n * Creates an instance of PresentationManager.\r\n * @param props Optional configuration properties.\r\n */\r\n constructor(props?: PresentationManagerProps) {\r\n this._props = props ?? {};\r\n this._detail = new PresentationManagerDetail(this._props);\r\n this.activeLocale = this._props.defaultLocale; // eslint-disable-line @typescript-eslint/no-deprecated\r\n\r\n this._localizationHelper = new LocalizationHelper({ getLocalizedString: props?.getLocalizedString ?? getLocalizedStringEN });\r\n }\r\n\r\n /** Get / set active unit system used to format property values with units */\r\n public get activeUnitSystem(): UnitSystemKey | undefined {\r\n return this._detail.activeUnitSystem;\r\n }\r\n // istanbul ignore next\r\n public set activeUnitSystem(value: UnitSystemKey | undefined) {\r\n this._detail.activeUnitSystem = value;\r\n }\r\n\r\n /** Dispose the presentation manager. Must be called to clean up native resources. */\r\n public dispose() {\r\n this._detail.dispose();\r\n }\r\n\r\n /** @internal */\r\n public setOnManagerUsedHandler(handler: () => void) {\r\n this._detail.setOnManagerUsedHandler(handler);\r\n }\r\n\r\n /** Properties used to initialize the manager */\r\n public get props() {\r\n return this._props;\r\n }\r\n\r\n /** Get rulesets manager */\r\n public rulesets(): RulesetManager {\r\n return this._detail.rulesets;\r\n }\r\n\r\n /**\r\n * Get ruleset variables manager for specific ruleset\r\n * @param rulesetId Id of the ruleset to get variables manager for\r\n */\r\n public vars(rulesetId: string): RulesetVariablesManager {\r\n return new RulesetVariablesManagerImpl(this.getNativePlatform, rulesetId);\r\n }\r\n\r\n /** @internal */\r\n public getNativePlatform = (): NativePlatformDefinition => {\r\n return this._detail.getNativePlatform();\r\n };\r\n\r\n /** @internal */\r\n // istanbul ignore next\r\n public getDetail(): PresentationManagerDetail {\r\n return this._detail;\r\n }\r\n\r\n /** @internal */\r\n public getRulesetId(rulesetOrId: Ruleset | string) {\r\n return this._detail.getRulesetId(rulesetOrId);\r\n }\r\n\r\n /**\r\n * Retrieves nodes\r\n * @public\r\n */\r\n public async getNodes(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>>> & BackendDiagnosticsAttribute,\r\n ): Promise<Node[]> {\r\n const serializedNodesJson = await this._detail.getNodes(requestOptions);\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const nodesJson = JSON.parse(serializedNodesJson) as HierarchyLevelJSON;\r\n const nodes = Node.listFromJSON(nodesJson.nodes);\r\n return this._localizationHelper.getLocalizedNodes(nodes);\r\n }\r\n\r\n /**\r\n * Retrieves nodes count\r\n * @public\r\n */\r\n public async getNodesCount(\r\n requestOptions: WithCancelEvent<Prioritized<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<number> {\r\n return this._detail.getNodesCount(requestOptions);\r\n }\r\n\r\n /**\r\n * Retrieves hierarchy level descriptor\r\n * @public\r\n */\r\n public async getNodesDescriptor(\r\n requestOptions: WithCancelEvent<Prioritized<HierarchyLevelDescriptorRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<Descriptor | undefined> {\r\n const response = await this._detail.getNodesDescriptor(requestOptions);\r\n const descriptor = Descriptor.fromJSON(JSON.parse(response));\r\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\r\n }\r\n\r\n /**\r\n * Retrieves paths from root nodes to children nodes according to specified instance key paths. Intersecting paths will be merged.\r\n * TODO: Return results in pages\r\n * @public\r\n */\r\n public async getNodePaths(\r\n requestOptions: WithCancelEvent<Prioritized<FilterByInstancePathsHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n const result = await this._detail.getNodePaths(requestOptions);\r\n return result.map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\r\n }\r\n\r\n /**\r\n * Retrieves paths from root nodes to nodes containing filter text in their label.\r\n * TODO: Return results in pages\r\n * @public\r\n */\r\n public async getFilteredNodePaths(\r\n requestOptions: WithCancelEvent<Prioritized<FilterByTextHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n const result = await this._detail.getFilteredNodePaths(requestOptions);\r\n return result.map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\r\n }\r\n\r\n /**\r\n * Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,\r\n * its related instances for loading related and navigation properties.\r\n * @public\r\n */\r\n public async getContentSources(\r\n requestOptions: WithCancelEvent<Prioritized<ContentSourcesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute,\r\n ): Promise<SelectClassInfo[]> {\r\n return this._detail.getContentSources(requestOptions);\r\n }\r\n\r\n /**\r\n * Retrieves the content descriptor which can be used to get content\r\n * @public\r\n */\r\n public async getContentDescriptor(\r\n requestOptions: WithCancelEvent<Prioritized<ContentDescriptorRequestOptions<IModelDb, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<Descriptor | undefined> {\r\n const response = await this._detail.getContentDescriptor(requestOptions);\r\n const descriptor = Descriptor.fromJSON(JSON.parse(response));\r\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\r\n }\r\n\r\n /**\r\n * Retrieves the content set size based on the supplied content descriptor override\r\n * @public\r\n */\r\n public async getContentSetSize(\r\n requestOptions: WithCancelEvent<Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<number> {\r\n return this._detail.getContentSetSize(requestOptions);\r\n }\r\n\r\n /**\r\n * Retrieves the content set based on the supplied content descriptor.\r\n * @public\r\n */\r\n public async getContentSet(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor, KeySet, RulesetVariable>>>> & BackendDiagnosticsAttribute,\r\n ): Promise<Item[]> {\r\n let items = await this._detail.getContentSet({\r\n ...requestOptions,\r\n ...(!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),\r\n });\r\n\r\n if (!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined) {\r\n const koqPropertyFormatter = new KoqPropertyValueFormatter(this.props.schemaContextProvider(requestOptions.imodel), this.props.defaultFormats);\r\n const formatter = new ContentFormatter(\r\n new ContentPropertyValueFormatter(koqPropertyFormatter),\r\n requestOptions.unitSystem ?? this.props.defaultUnitSystem,\r\n );\r\n items = await formatter.formatContentItems(items, requestOptions.descriptor);\r\n }\r\n\r\n return this._localizationHelper.getLocalizedContentItems(items);\r\n }\r\n\r\n /**\r\n * Retrieves the content based on the supplied content descriptor override.\r\n * @public\r\n */\r\n public async getContent(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<Content | undefined> {\r\n const content = await this._detail.getContent({\r\n ...requestOptions,\r\n ...(!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),\r\n });\r\n\r\n if (!content) {\r\n return undefined;\r\n }\r\n\r\n if (!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined) {\r\n const koqPropertyFormatter = new KoqPropertyValueFormatter(this.props.schemaContextProvider(requestOptions.imodel), this.props.defaultFormats);\r\n const formatter = new ContentFormatter(\r\n new ContentPropertyValueFormatter(koqPropertyFormatter),\r\n requestOptions.unitSystem ?? this.props.defaultUnitSystem,\r\n );\r\n await formatter.formatContent(content);\r\n }\r\n\r\n return this._localizationHelper.getLocalizedContent(content);\r\n }\r\n\r\n /**\r\n * Retrieves distinct values of specific field from the content based on the supplied content descriptor override.\r\n * @param requestOptions Options for the request\r\n * @return A promise object that returns either distinct values on success or an error string on error.\r\n * @public\r\n */\r\n public async getPagedDistinctValues(\r\n requestOptions: WithCancelEvent<Prioritized<DistinctValuesRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<PagedResponse<DisplayValueGroup>> {\r\n const result = await this._detail.getPagedDistinctValues(requestOptions);\r\n return {\r\n ...result,\r\n items: result.items.map((g) => this._localizationHelper.getLocalizedDisplayValueGroup(g)),\r\n };\r\n }\r\n\r\n /**\r\n * Retrieves property data in a simplified format for a single element specified by ID.\r\n * @public\r\n */\r\n public async getElementProperties<TParsedContent = ElementProperties>(\r\n requestOptions: WithCancelEvent<Prioritized<SingleElementPropertiesRequestOptions<IModelDb, TParsedContent>>> & BackendDiagnosticsAttribute,\r\n ): Promise<TParsedContent | undefined>;\r\n /**\r\n * Retrieves property data in simplified format for multiple elements specified by class or all element.\r\n * @return An object that contains element count and AsyncGenerator to iterate over properties of those elements in batches of undefined size.\r\n * @public\r\n */\r\n public async getElementProperties<TParsedContent = ElementProperties>(\r\n requestOptions: WithCancelEvent<Prioritized<MultiElementPropertiesRequestOptions<IModelDb, TParsedContent>>> & BackendDiagnosticsAttribute,\r\n ): Promise<MultiElementPropertiesResponse<TParsedContent>>;\r\n public async getElementProperties<TParsedContent = ElementProperties>(\r\n requestOptions: WithCancelEvent<\r\n Prioritized<SingleElementPropertiesRequestOptions<IModelDb, TParsedContent> | MultiElementPropertiesRequestOptions<IModelDb, TParsedContent>>\r\n > &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<TParsedContent | undefined | MultiElementPropertiesResponse<TParsedContent>> {\r\n if (isSingleElementPropertiesRequestOptions(requestOptions)) {\r\n return this.getSingleElementProperties<TParsedContent>(requestOptions);\r\n }\r\n return this.getMultipleElementProperties<TParsedContent>(requestOptions);\r\n }\r\n\r\n private async getSingleElementProperties<TParsedContent>(\r\n requestOptions: WithCancelEvent<Prioritized<SingleElementPropertiesRequestOptions<IModelDb, TParsedContent>>> & BackendDiagnosticsAttribute,\r\n ): Promise<TParsedContent | undefined> {\r\n type TParser = Required<typeof requestOptions>[\"contentParser\"];\r\n const { elementId, contentParser, ...optionsNoElementId } = requestOptions;\r\n const parser: TParser = contentParser ?? (buildElementProperties as TParser);\r\n const content = await this.getContent({\r\n ...optionsNoElementId,\r\n descriptor: {\r\n displayType: DefaultContentDisplayTypes.PropertyPane,\r\n contentFlags: ContentFlags.ShowLabels,\r\n },\r\n rulesetOrId: \"ElementProperties\",\r\n keys: new KeySet([{ className: \"BisCore:Element\", id: elementId }]),\r\n });\r\n if (!content || content.contentSet.length === 0) {\r\n return undefined;\r\n }\r\n return parser(content.descriptor, content.contentSet[0]);\r\n }\r\n\r\n private async getMultipleElementProperties<TParsedContent>(\r\n requestOptions: WithCancelEvent<Prioritized<MultiElementPropertiesRequestOptions<IModelDb, TParsedContent>>> & BackendDiagnosticsAttribute,\r\n ): Promise<MultiElementPropertiesResponse<TParsedContent>> {\r\n type TParser = Required<typeof requestOptions>[\"contentParser\"];\r\n const { elementClasses, contentParser, batchSize, ...contentOptions } = requestOptions;\r\n const parser: TParser = contentParser ?? (buildElementProperties as TParser);\r\n const workerThreadsCount = this._props.workerThreadsCount ?? 2;\r\n\r\n // We don't want to request content for all classes at once - each class results in a huge content descriptor object that's cached in memory\r\n // and can be shared across all batch requests for that class. Handling multiple classes at the same time not only increases memory footprint,\r\n // but also may push descriptors out of cache, requiring us to recreate them, thus making performance worse. For those reasons we handle at\r\n // most `workerThreadsCount / 2` classes in parallel.\r\n // istanbul ignore next\r\n const classParallelism = workerThreadsCount > 1 ? workerThreadsCount / 2 : 1;\r\n\r\n // We want all worker threads to be constantly busy. However, there's some fairly expensive work being done after the worker thread is done,\r\n // but before we receive the response. That means the worker thread would be starving if we sent only `workerThreadsCount` requests in parallel.\r\n // To avoid that, we keep twice as much requests active.\r\n // istanbul ignore next\r\n const batchesParallelism = workerThreadsCount > 0 ? workerThreadsCount * 2 : 2;\r\n\r\n const createClassContentRuleset = (fullClassName: string): Ruleset => {\r\n const [schemaName, className] = parseFullClassName(fullClassName);\r\n return {\r\n id: `content/${fullClassName}`,\r\n rules: [\r\n {\r\n ruleType: \"Content\",\r\n specifications: [\r\n {\r\n specType: \"ContentInstancesOfSpecificClasses\",\r\n classes: {\r\n schemaName,\r\n classNames: [className],\r\n arePolymorphic: false,\r\n },\r\n handlePropertiesPolymorphically: true,\r\n },\r\n ],\r\n },\r\n ],\r\n };\r\n };\r\n const getContentDescriptor = async (ruleset: Ruleset): Promise<Descriptor> => {\r\n return (await this.getContentDescriptor({\r\n ...contentOptions,\r\n rulesetOrId: ruleset,\r\n displayType: DefaultContentDisplayTypes.Grid,\r\n contentFlags: ContentFlags.ShowLabels,\r\n keys: new KeySet(),\r\n }))!;\r\n };\r\n\r\n const obs = getClassesWithInstances(requestOptions.imodel, elementClasses ?? /* istanbul ignore next */ [\"BisCore.Element\"]).pipe(\r\n map((classFullName) => ({\r\n classFullName,\r\n ruleset: createClassContentRuleset(classFullName),\r\n })),\r\n mergeMap(\r\n ({ classFullName, ruleset }) =>\r\n // use forkJoin to query descriptor and element ids in parallel\r\n forkJoin({\r\n classFullName: of(classFullName),\r\n ruleset: of(ruleset),\r\n descriptor: from(getContentDescriptor(ruleset)),\r\n batches: from(getBatchedClassElementIds(requestOptions.imodel, classFullName, batchSize ?? /* istanbul ignore next */ 1000)),\r\n }).pipe(\r\n // split incoming stream into individual batch requests\r\n mergeMap(({ descriptor, batches }) => from(batches.map((batch) => ({ classFullName, descriptor, batch })))),\r\n // request content for each batch, filter by IDs for performance\r\n mergeMap(({ descriptor, batch }) => {\r\n const filteringDescriptor = new Descriptor(descriptor);\r\n filteringDescriptor.instanceFilter = {\r\n selectClassName: classFullName,\r\n expression: `this.ECInstanceId >= ${Number.parseInt(batch.from, 16)} AND this.ECInstanceId <= ${Number.parseInt(batch.to, 16)}`,\r\n };\r\n return from(\r\n this.getContentSet({\r\n ...contentOptions,\r\n keys: new KeySet(),\r\n descriptor: filteringDescriptor,\r\n rulesetOrId: ruleset,\r\n }),\r\n ).pipe(map((items) => ({ classFullName, descriptor, items })));\r\n }, batchesParallelism),\r\n ),\r\n classParallelism,\r\n ),\r\n map(({ descriptor, items }) => items.map((item) => parser(descriptor, item))),\r\n );\r\n\r\n return {\r\n total: getElementsCount(requestOptions.imodel, elementClasses),\r\n async *iterator() {\r\n for await (const batch of eachValueFrom(obs)) {\r\n yield batch;\r\n }\r\n },\r\n };\r\n }\r\n\r\n /**\r\n * Retrieves display label definition of specific item\r\n * @public\r\n */\r\n public async getDisplayLabelDefinition(\r\n requestOptions: WithCancelEvent<Prioritized<DisplayLabelRequestOptions<IModelDb, InstanceKey>>> & BackendDiagnosticsAttribute,\r\n ): Promise<LabelDefinition> {\r\n const labelDefinition = await this._detail.getDisplayLabelDefinition(requestOptions);\r\n return this._localizationHelper.getLocalizedLabelDefinition(labelDefinition);\r\n }\r\n\r\n /**\r\n * Retrieves display label definitions of specific items\r\n * @public\r\n */\r\n public async getDisplayLabelDefinitions(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<DisplayLabelsRequestOptions<IModelDb, InstanceKey>>>> & BackendDiagnosticsAttribute,\r\n ): Promise<LabelDefinition[]> {\r\n const labelDefinitions = await this._detail.getDisplayLabelDefinitions(requestOptions);\r\n return this._localizationHelper.getLocalizedLabelDefinitions(labelDefinitions);\r\n }\r\n\r\n /**\r\n * Retrieves available selection scopes.\r\n * @public\r\n */\r\n public async getSelectionScopes(_requestOptions: SelectionScopeRequestOptions<IModelDb> & BackendDiagnosticsAttribute): Promise<SelectionScope[]> {\r\n return SelectionScopesHelper.getSelectionScopes();\r\n }\r\n\r\n /**\r\n * Computes selection set based on provided selection scope.\r\n * @public\r\n * @deprecated in 3.x. Use overload with `ComputeSelectionRequestOptions` parameter.\r\n */\r\n public async computeSelection(\r\n requestOptions: SelectionScopeRequestOptions<IModelDb> & { ids: Id64String[]; scopeId: string } & BackendDiagnosticsAttribute,\r\n ): Promise<KeySet>;\r\n /**\r\n * Computes selection based on provided element IDs and selection scope.\r\n * @public\r\n */\r\n // eslint-disable-next-line @typescript-eslint/unified-signatures\r\n public async computeSelection(requestOptions: ComputeSelectionRequestOptions<IModelDb> & BackendDiagnosticsAttribute): Promise<KeySet>;\r\n public async computeSelection(\r\n requestOptions: ((SelectionScopeRequestOptions<IModelDb> & { ids: Id64String[]; scopeId: string }) | ComputeSelectionRequestOptions<IModelDb>) &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<KeySet> {\r\n return SelectionScopesHelper.computeSelection(\r\n isComputeSelectionRequestOptions(requestOptions)\r\n ? requestOptions\r\n : (function () {\r\n const { ids, scopeId, ...rest } = requestOptions;\r\n return { ...rest, elementIds: ids, scope: { id: scopeId } };\r\n })(),\r\n );\r\n }\r\n\r\n /**\r\n * Compares two hierarchies specified in the request options\r\n * @public\r\n */\r\n public async compareHierarchies(requestOptions: HierarchyCompareOptions<IModelDb, NodeKey>): Promise<HierarchyCompareInfo> {\r\n if (!requestOptions.prev.rulesetOrId && !requestOptions.prev.rulesetVariables) {\r\n return { changes: [] };\r\n }\r\n\r\n const { rulesetOrId, prev, rulesetVariables, ...options } = requestOptions;\r\n this._detail.registerRuleset(rulesetOrId);\r\n\r\n const currRulesetId = getRulesetIdObject(requestOptions.rulesetOrId);\r\n const prevRulesetId = prev.rulesetOrId ? getRulesetIdObject(prev.rulesetOrId) : currRulesetId;\r\n if (prevRulesetId.parts.id !== currRulesetId.parts.id) {\r\n throw new PresentationError(PresentationStatus.InvalidArgument, \"Can't compare rulesets with different IDs\");\r\n }\r\n\r\n const currRulesetVariables = rulesetVariables ?? [];\r\n const prevRulesetVariables = prev.rulesetVariables ?? currRulesetVariables;\r\n\r\n const params = {\r\n requestId: NativePlatformRequestTypes.CompareHierarchies,\r\n ...options,\r\n prevRulesetId: prevRulesetId.uniqueId,\r\n currRulesetId: currRulesetId.uniqueId,\r\n prevRulesetVariables: JSON.stringify(prevRulesetVariables),\r\n currRulesetVariables: JSON.stringify(currRulesetVariables),\r\n expandedNodeKeys: JSON.stringify(options.expandedNodeKeys ?? []),\r\n };\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const reviver = (key: string, value: any) => (key === \"\" ? HierarchyCompareInfo.fromJSON(value) : value);\r\n return JSON.parse(await this._detail.request(params), reviver);\r\n }\r\n}\r\n"]}
|
|
@@ -192,7 +192,7 @@ class PresentationManagerDetail {
|
|
|
192
192
|
return key === ""
|
|
193
193
|
? {
|
|
194
194
|
total: value.total,
|
|
195
|
-
// eslint-disable-next-line
|
|
195
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
196
196
|
items: value.items.map(presentation_common_1.DisplayValueGroup.fromJSON),
|
|
197
197
|
}
|
|
198
198
|
: value;
|
|
@@ -289,13 +289,13 @@ async function withOptionalDiagnostics(diagnosticsOptions, nativePlatformRequest
|
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
function setupRulesets(nativePlatform, supplementalRulesetDirectories, primaryRulesetDirectories) {
|
|
292
|
-
// eslint-disable-next-line @typescript-eslint/no-
|
|
292
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
293
293
|
const elementPropertiesRuleset = require("./primary-presentation-rules/ElementProperties.PresentationRuleSet.json");
|
|
294
294
|
nativePlatform.addRuleset(JSON.stringify(elementPropertiesRuleset));
|
|
295
|
-
// eslint-disable-next-line @typescript-eslint/no-
|
|
295
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
296
296
|
const bisSupplementalRuleset = require("./supplemental-presentation-rules/BisCore.PresentationRuleSet.json");
|
|
297
297
|
nativePlatform.registerSupplementalRuleset(JSON.stringify(bisSupplementalRuleset));
|
|
298
|
-
// eslint-disable-next-line @typescript-eslint/no-
|
|
298
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
299
299
|
const funcSupplementalRuleset = require("./supplemental-presentation-rules/Functional.PresentationRuleSet.json");
|
|
300
300
|
nativePlatform.registerSupplementalRuleset(JSON.stringify(funcSupplementalRuleset));
|
|
301
301
|
nativePlatform.setupSupplementalRulesetDirectories(collateAssetDirectories(supplementalRulesetDirectories));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManagerDetail.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManagerDetail.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6ZA,gDAsBC;AAGD,4DA8BC;AAGD,0EAgBC;AAyHD,8CAKC;AAID,gDAAoE;AAzmBpE;;;gGAGgG;AAChG,kDAAoC;AACpC,2CAA6B;AAC7B,sDAAwE;AACxE,sDAAmE;AAEnE,oEAsCoC;AACpC,mEAA4E;AAC5E,qDAS0B;AAC1B,+DAA2G;AAC3G,qDAAsE;AACtE,mCAA8I;AAE9I,gBAAgB;AAChB,MAAa,yBAAyB;IASpC,YAAY,MAAgC;QAC1C,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QAEvB,IAAI,CAAC,eAAe;YAClB,MAAM,CAAC,KAAK;gBACZ,oBAAoB,CAClB,MAAM,CAAC,EAAE,IAAI,EAAE,EACf,MAAM,CAAC,kBAAkB,IAAI,CAAC,EAC9B,sBAAO,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,kBAAkB,EACxD,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,cAAc,EACrB,MAAM,CAAC,OAAO,CACf,CAAC;QAEJ,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,8BAA8B,IAAI,EAAE,EAAE,MAAM,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC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,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;AACrE,CAAC;AAED,gBAAgB;AAChB,SAAgB,iBAAiB,CAAC,IAA4B;IAC5D,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,MAAM,EAAE,CAAC;QACX,sBAAO,CAAC,IAAI,CAAC,2CAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;AACH,CAAC;AAED,gBAAgB;AAChB,uBAAuB;AACvB,SAAgB,kBAAkB,CAAC,KAA6B,IAAG,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as hash from \"object-hash\";\r\nimport * as path from \"path\";\r\nimport { IModelDb, IModelJsNative, IpcHost } from \"@itwin/core-backend\";\r\nimport { BeEvent, IDisposable, Logger } from \"@itwin/core-bentley\";\r\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport {\r\n Content,\r\n ContentDescriptorRequestOptions,\r\n ContentFlags,\r\n ContentRequestOptions,\r\n ContentSourcesRequestOptions,\r\n DefaultContentDisplayTypes,\r\n Descriptor,\r\n DescriptorOverrides,\r\n DiagnosticsOptions,\r\n DiagnosticsScopeLogs,\r\n DisplayLabelRequestOptions,\r\n DisplayLabelsRequestOptions,\r\n DisplayValueGroup,\r\n DistinctValuesRequestOptions,\r\n FilterByInstancePathsHierarchyRequestOptions,\r\n FilterByTextHierarchyRequestOptions,\r\n FormatsMap,\r\n HierarchyLevelDescriptorRequestOptions,\r\n HierarchyRequestOptions,\r\n InstanceKey,\r\n Item,\r\n Key,\r\n KeySet,\r\n LabelDefinition,\r\n NodeKey,\r\n NodePathElement,\r\n Paged,\r\n PagedResponse,\r\n PresentationError,\r\n PresentationIpcEvents,\r\n PresentationStatus,\r\n Prioritized,\r\n Ruleset,\r\n RulesetVariable,\r\n SelectClassInfo,\r\n UpdateInfo,\r\n WithCancelEvent,\r\n} from \"@itwin/presentation-common\";\r\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport {\r\n createDefaultNativePlatform,\r\n NativePlatformDefinition,\r\n NativePlatformRequestTypes,\r\n NativePlatformResponse,\r\n NativePresentationDefaultUnitFormats,\r\n NativePresentationKeySetJSON,\r\n NativePresentationUnitSystem,\r\n PresentationNativePlatformResponseError,\r\n} from \"./NativePlatform\";\r\nimport { HierarchyCacheConfig, HierarchyCacheMode, PresentationManagerProps } from \"./PresentationManager\";\r\nimport { RulesetManager, RulesetManagerImpl } from \"./RulesetManager\";\r\nimport { BackendDiagnosticsAttribute, BackendDiagnosticsOptions, combineDiagnosticsOptions, getElementKey, reportDiagnostics } from \"./Utils\";\r\n\r\n/** @internal */\r\nexport class PresentationManagerDetail implements IDisposable {\r\n private _disposed: boolean;\r\n private _nativePlatform: NativePlatformDefinition | undefined;\r\n private _onManagerUsed: (() => void) | undefined;\r\n private _diagnosticsOptions: BackendDiagnosticsOptions | undefined;\r\n\r\n public rulesets: RulesetManager;\r\n public activeUnitSystem: UnitSystemKey | undefined;\r\n\r\n constructor(params: PresentationManagerProps) {\r\n this._disposed = false;\r\n\r\n this._nativePlatform =\r\n params.addon ??\r\n createNativePlatform(\r\n params.id ?? \"\",\r\n params.workerThreadsCount ?? 2,\r\n IpcHost.isValid ? ipcUpdatesHandler : noopUpdatesHandler,\r\n params.caching,\r\n params.defaultFormats,\r\n params.useMmap,\r\n );\r\n\r\n setupRulesets(this._nativePlatform, params.supplementalRulesetDirectories ?? [], params.rulesetDirectories ?? []);\r\n this.activeUnitSystem = params.defaultUnitSystem;\r\n\r\n this._onManagerUsed = undefined;\r\n this.rulesets = new RulesetManagerImpl(() => this.getNativePlatform());\r\n this._diagnosticsOptions = params.diagnostics;\r\n }\r\n\r\n public dispose(): void {\r\n if (this._disposed) {\r\n return;\r\n }\r\n\r\n this.getNativePlatform().dispose();\r\n this._nativePlatform = undefined;\r\n\r\n this._disposed = true;\r\n }\r\n\r\n public getNativePlatform(): NativePlatformDefinition {\r\n if (this._disposed) {\r\n throw new PresentationError(PresentationStatus.NotInitialized, \"Attempting to use Presentation manager after disposal\");\r\n }\r\n\r\n return this._nativePlatform!;\r\n }\r\n\r\n public setOnManagerUsedHandler(handler: () => void) {\r\n this._onManagerUsed = handler;\r\n }\r\n\r\n public async getNodes(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>>> & BackendDiagnosticsAttribute,\r\n ): Promise<string> {\r\n const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: parentKey ? NativePlatformRequestTypes.GetChildren : NativePlatformRequestTypes.GetRootNodes,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return this.request(params);\r\n }\r\n\r\n public async getNodesCount(\r\n requestOptions: WithCancelEvent<Prioritized<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<number> {\r\n const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: parentKey ? NativePlatformRequestTypes.GetChildrenCount : NativePlatformRequestTypes.GetRootNodesCount,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return JSON.parse(await this.request(params));\r\n }\r\n\r\n public async getNodesDescriptor(\r\n requestOptions: WithCancelEvent<Prioritized<HierarchyLevelDescriptorRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<string> {\r\n const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetNodesDescriptor,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return this.request(params);\r\n }\r\n\r\n public async getNodePaths(\r\n requestOptions: WithCancelEvent<Prioritized<FilterByInstancePathsHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n const { rulesetOrId, instancePaths, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetNodePaths,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n paths: instancePaths,\r\n };\r\n return JSON.parse(await this.request(params), NodePathElement.listReviver);\r\n }\r\n\r\n public async getFilteredNodePaths(\r\n requestOptions: WithCancelEvent<Prioritized<FilterByTextHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n const { rulesetOrId, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetFilteredNodePaths,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n };\r\n return JSON.parse(await this.request(params), NodePathElement.listReviver);\r\n }\r\n\r\n public async getContentDescriptor(requestOptions: WithCancelEvent<Prioritized<ContentDescriptorRequestOptions<IModelDb, KeySet>>>): Promise<string> {\r\n const { rulesetOrId, contentFlags, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentDescriptor,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n contentFlags: contentFlags ?? ContentFlags.DescriptorOnly, // only set \"descriptor only\" flag if there are no flags provided\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n };\r\n return this.request(params);\r\n }\r\n\r\n public async getContentSources(\r\n requestOptions: WithCancelEvent<Prioritized<ContentSourcesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute,\r\n ): Promise<SelectClassInfo[]> {\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentSources,\r\n rulesetId: \"ElementProperties\",\r\n ...requestOptions,\r\n };\r\n const reviver = (key: string, value: any) => {\r\n return key === \"\" ? SelectClassInfo.listFromCompressedJSON(value.sources, value.classesMap) : value;\r\n };\r\n return JSON.parse(await this.request(params), reviver);\r\n }\r\n\r\n public async getContentSetSize(\r\n requestOptions: WithCancelEvent<Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<number> {\r\n const { rulesetOrId, descriptor, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentSetSize,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n return JSON.parse(await this.request(params));\r\n }\r\n\r\n public async getContentSet(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<Item[]> {\r\n const { rulesetOrId, descriptor, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentSet,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n return JSON.parse(await this.request(params), Item.listReviver);\r\n }\r\n\r\n public async getContent(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<Content | undefined> {\r\n const { rulesetOrId, descriptor, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContent,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n return JSON.parse(await this.request(params), (key, value) => Content.reviver(key, value));\r\n }\r\n\r\n public async getPagedDistinctValues(\r\n requestOptions: WithCancelEvent<Prioritized<DistinctValuesRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<PagedResponse<DisplayValueGroup>> {\r\n const { rulesetOrId, ...strippedOptions } = requestOptions;\r\n const { descriptor, keys, ...strippedOptionsNoDescriptorAndKeys } = strippedOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetPagedDistinctValues,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptionsNoDescriptorAndKeys,\r\n keys: getKeysForContentRequest(keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n const reviver = (key: string, value: any) => {\r\n return key === \"\"\r\n ? {\r\n total: value.total,\r\n // eslint-disable-next-line deprecation/deprecation\r\n items: value.items.map(DisplayValueGroup.fromJSON),\r\n }\r\n : value;\r\n };\r\n return JSON.parse(await this.request(params), reviver);\r\n }\r\n\r\n public async getDisplayLabelDefinition(\r\n requestOptions: WithCancelEvent<Prioritized<DisplayLabelRequestOptions<IModelDb, InstanceKey>>> & BackendDiagnosticsAttribute,\r\n ): Promise<LabelDefinition> {\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetDisplayLabel,\r\n ...requestOptions,\r\n };\r\n return JSON.parse(await this.request(params));\r\n }\r\n\r\n public async getDisplayLabelDefinitions(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<DisplayLabelsRequestOptions<IModelDb, InstanceKey>>>> & BackendDiagnosticsAttribute,\r\n ): Promise<LabelDefinition[]> {\r\n const concreteKeys = requestOptions.keys\r\n .map((k) => {\r\n if (k.className === \"BisCore:Element\") {\r\n return getElementKey(requestOptions.imodel, k.id);\r\n }\r\n return k;\r\n })\r\n .filter<InstanceKey>((k): k is InstanceKey => !!k);\r\n const contentRequestOptions: ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet> = {\r\n ...requestOptions,\r\n rulesetOrId: \"RulesDrivenECPresentationManager_RulesetId_DisplayLabel\",\r\n descriptor: {\r\n displayType: DefaultContentDisplayTypes.List,\r\n contentFlags: ContentFlags.ShowLabels | ContentFlags.NoFields,\r\n },\r\n keys: new KeySet(concreteKeys),\r\n };\r\n const content = await this.getContent(contentRequestOptions);\r\n return concreteKeys.map((key) => {\r\n const item = content ? content.contentSet.find((it) => it.primaryKeys.length > 0 && InstanceKey.compare(it.primaryKeys[0], key) === 0) : undefined;\r\n if (!item) {\r\n return { displayValue: \"\", rawValue: \"\", typeName: \"\" };\r\n }\r\n return item.label;\r\n });\r\n }\r\n\r\n /** Registers given ruleset and replaces the ruleset with its ID in the resulting object */\r\n public registerRuleset(rulesetOrId: Ruleset | string): string {\r\n if (typeof rulesetOrId === \"object\") {\r\n const rulesetWithNativeId = { ...rulesetOrId, id: this.getRulesetId(rulesetOrId) };\r\n return this.rulesets.add(rulesetWithNativeId).id;\r\n }\r\n\r\n return rulesetOrId;\r\n }\r\n\r\n /** @internal */\r\n public getRulesetId(rulesetOrId: Ruleset | string): string {\r\n return getRulesetIdObject(rulesetOrId).uniqueId;\r\n }\r\n\r\n public async request(params: RequestParams): Promise<string> {\r\n this._onManagerUsed?.();\r\n const { requestId, imodel, unitSystem, diagnostics: requestDiagnostics, cancelEvent, ...strippedParams } = params;\r\n const imodelAddon = this.getNativePlatform().getImodelAddon(imodel);\r\n const response = await withOptionalDiagnostics([this._diagnosticsOptions, requestDiagnostics], async (diagnosticsOptions) => {\r\n const nativeRequestParams: any = {\r\n requestId,\r\n params: {\r\n unitSystem: toOptionalNativeUnitSystem(unitSystem ?? this.activeUnitSystem),\r\n ...strippedParams,\r\n ...(diagnosticsOptions ? { diagnostics: diagnosticsOptions } : undefined),\r\n },\r\n };\r\n return this.getNativePlatform().handleRequest(imodelAddon, JSON.stringify(nativeRequestParams), cancelEvent);\r\n });\r\n return response.result;\r\n }\r\n}\r\n\r\nasync function withOptionalDiagnostics(\r\n diagnosticsOptions: Array<BackendDiagnosticsOptions | undefined>,\r\n nativePlatformRequestHandler: (combinedDiagnosticsOptions: DiagnosticsOptions | undefined) => Promise<NativePlatformResponse<string>>,\r\n): Promise<NativePlatformResponse<string>> {\r\n const contexts = diagnosticsOptions.map((d) => d?.requestContextSupplier?.());\r\n const combinedOptions = combineDiagnosticsOptions(...diagnosticsOptions);\r\n let responseDiagnostics: DiagnosticsScopeLogs | undefined;\r\n try {\r\n const response = await nativePlatformRequestHandler(combinedOptions);\r\n responseDiagnostics = response.diagnostics;\r\n return response;\r\n } catch (e) {\r\n if (e instanceof PresentationNativePlatformResponseError) {\r\n responseDiagnostics = e.diagnostics;\r\n }\r\n throw e;\r\n } finally {\r\n if (responseDiagnostics) {\r\n const diagnostics = { logs: [responseDiagnostics] };\r\n diagnosticsOptions.forEach((options, i) => {\r\n options && reportDiagnostics(diagnostics, options, contexts[i]);\r\n });\r\n }\r\n }\r\n}\r\n\r\ninterface RequestParams {\r\n diagnostics?: BackendDiagnosticsOptions;\r\n requestId: string;\r\n imodel: IModelDb;\r\n unitSystem?: UnitSystemKey;\r\n cancelEvent?: BeEvent<() => void>;\r\n}\r\n\r\nfunction setupRulesets(nativePlatform: NativePlatformDefinition, supplementalRulesetDirectories: string[], primaryRulesetDirectories: string[]): void {\r\n // eslint-disable-next-line @typescript-eslint/no-var-requires\r\n const elementPropertiesRuleset: Ruleset = require(\"./primary-presentation-rules/ElementProperties.PresentationRuleSet.json\");\r\n nativePlatform.addRuleset(JSON.stringify(elementPropertiesRuleset));\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-var-requires\r\n const bisSupplementalRuleset: Ruleset = require(\"./supplemental-presentation-rules/BisCore.PresentationRuleSet.json\");\r\n nativePlatform.registerSupplementalRuleset(JSON.stringify(bisSupplementalRuleset));\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-var-requires\r\n const funcSupplementalRuleset: Ruleset = require(\"./supplemental-presentation-rules/Functional.PresentationRuleSet.json\");\r\n nativePlatform.registerSupplementalRuleset(JSON.stringify(funcSupplementalRuleset));\r\n\r\n nativePlatform.setupSupplementalRulesetDirectories(collateAssetDirectories(supplementalRulesetDirectories));\r\n nativePlatform.setupRulesetDirectories(collateAssetDirectories(primaryRulesetDirectories));\r\n}\r\n\r\ninterface RulesetIdObject {\r\n uniqueId: string;\r\n parts: {\r\n id: string;\r\n hash?: string;\r\n };\r\n}\r\n\r\n/** @internal */\r\nexport function getRulesetIdObject(rulesetOrId: Ruleset | string): RulesetIdObject {\r\n if (typeof rulesetOrId === \"object\") {\r\n if (IpcHost.isValid) {\r\n // in case of native apps we don't want to enforce ruleset id uniqueness as ruleset variables\r\n // are stored on a backend and creating new id will lose those variables\r\n return {\r\n uniqueId: rulesetOrId.id,\r\n parts: { id: rulesetOrId.id },\r\n };\r\n }\r\n\r\n const hashedId = hash.MD5(rulesetOrId);\r\n return {\r\n uniqueId: `${rulesetOrId.id}-${hashedId}`,\r\n parts: {\r\n id: rulesetOrId.id,\r\n hash: hashedId,\r\n },\r\n };\r\n }\r\n\r\n return { uniqueId: rulesetOrId, parts: { id: rulesetOrId } };\r\n}\r\n\r\n/** @internal */\r\nexport function getKeysForContentRequest(\r\n keys: Readonly<KeySet>,\r\n classInstanceKeysProcessor?: (keys: Map<string, Set<string>>) => void,\r\n): NativePresentationKeySetJSON {\r\n const result: NativePresentationKeySetJSON = {\r\n instanceKeys: [],\r\n nodeKeys: [],\r\n };\r\n const classInstancesMap = new Map<string, Set<string>>();\r\n keys.forEach((key) => {\r\n if (Key.isNodeKey(key)) {\r\n result.nodeKeys.push(key);\r\n }\r\n\r\n if (Key.isInstanceKey(key)) {\r\n addInstanceKey(classInstancesMap, key);\r\n }\r\n });\r\n\r\n if (classInstanceKeysProcessor) {\r\n classInstanceKeysProcessor(classInstancesMap);\r\n }\r\n\r\n for (const entry of classInstancesMap) {\r\n if (entry[1].size > 0) {\r\n result.instanceKeys.push([entry[\"0\"], [...entry[1]]]);\r\n }\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/** @internal */\r\nexport function bisElementInstanceKeysProcessor(imodel: IModelDb, classInstancesMap: Map<string, Set<string>>) {\r\n const elementClassName = \"BisCore:Element\";\r\n const elementIds = classInstancesMap.get(elementClassName);\r\n if (elementIds) {\r\n const deleteElementIds = new Array<string>();\r\n elementIds.forEach((elementId) => {\r\n const concreteKey = getElementKey(imodel, elementId);\r\n if (concreteKey && concreteKey.className !== elementClassName) {\r\n deleteElementIds.push(elementId);\r\n addInstanceKey(classInstancesMap, { className: concreteKey.className, id: elementId });\r\n }\r\n });\r\n for (const id of deleteElementIds) {\r\n elementIds.delete(id);\r\n }\r\n }\r\n}\r\n\r\nfunction addInstanceKey(classInstancesMap: Map<string, Set<string>>, key: InstanceKey): void {\r\n let set = classInstancesMap.get(key.className);\r\n // istanbul ignore else\r\n if (!set) {\r\n set = new Set();\r\n classInstancesMap.set(key.className, set);\r\n }\r\n set.add(key.id);\r\n}\r\n\r\nfunction createNativePlatform(\r\n id: string,\r\n workerThreadsCount: number,\r\n updateCallback: (updateInfo: UpdateInfo | undefined) => void,\r\n caching: PresentationManagerProps[\"caching\"],\r\n defaultFormats: FormatsMap | undefined,\r\n useMmap: boolean | number | undefined,\r\n): NativePlatformDefinition {\r\n return new (createDefaultNativePlatform({\r\n id,\r\n taskAllocationsMap: { [Number.MAX_SAFE_INTEGER]: workerThreadsCount },\r\n updateCallback,\r\n cacheConfig: createCacheConfig(caching?.hierarchies),\r\n contentCacheSize: caching?.content?.size,\r\n workerConnectionCacheSize: caching?.workerConnectionCacheSize,\r\n defaultFormats: toNativeUnitFormatsMap(defaultFormats),\r\n useMmap,\r\n }))();\r\n\r\n function createCacheConfig(config?: HierarchyCacheConfig): IModelJsNative.ECPresentationHierarchyCacheConfig {\r\n switch (config?.mode) {\r\n case HierarchyCacheMode.Disk:\r\n return { ...config, directory: normalizeDirectory(config.directory) };\r\n\r\n case HierarchyCacheMode.Hybrid:\r\n return {\r\n ...config,\r\n disk: config.disk ? { ...config.disk, directory: normalizeDirectory(config.disk.directory) } : undefined,\r\n };\r\n\r\n case HierarchyCacheMode.Memory:\r\n return config;\r\n\r\n default:\r\n return { mode: HierarchyCacheMode.Disk, directory: \"\" };\r\n }\r\n }\r\n\r\n function normalizeDirectory(directory?: string): string {\r\n return directory ? path.resolve(directory) : \"\";\r\n }\r\n\r\n function toNativeUnitFormatsMap(map: FormatsMap | undefined): NativePresentationDefaultUnitFormats | undefined {\r\n if (!map) {\r\n return undefined;\r\n }\r\n\r\n const nativeFormatsMap: NativePresentationDefaultUnitFormats = {};\r\n Object.entries(map).forEach(([phenomenon, formats]) => {\r\n nativeFormatsMap[phenomenon] = (Array.isArray(formats) ? formats : [formats]).map((unitSystemsFormat) => ({\r\n unitSystems: unitSystemsFormat.unitSystems.map(toNativeUnitSystem),\r\n format: unitSystemsFormat.format,\r\n }));\r\n });\r\n return nativeFormatsMap;\r\n }\r\n}\r\n\r\nfunction toOptionalNativeUnitSystem(unitSystem: UnitSystemKey | undefined): NativePresentationUnitSystem | undefined {\r\n return unitSystem ? toNativeUnitSystem(unitSystem) : undefined;\r\n}\r\n\r\nfunction toNativeUnitSystem(unitSystem: UnitSystemKey): NativePresentationUnitSystem {\r\n switch (unitSystem) {\r\n case \"imperial\":\r\n return NativePresentationUnitSystem.BritishImperial;\r\n case \"metric\":\r\n return NativePresentationUnitSystem.Metric;\r\n case \"usCustomary\":\r\n return NativePresentationUnitSystem.UsCustomary;\r\n case \"usSurvey\":\r\n return NativePresentationUnitSystem.UsSurvey;\r\n }\r\n}\r\n\r\nfunction collateAssetDirectories(dirs: string[]): string[] {\r\n return [...new Set(dirs)];\r\n}\r\nconst createContentDescriptorOverrides = (descriptorOrOverrides: Descriptor | DescriptorOverrides): DescriptorOverrides => {\r\n if (descriptorOrOverrides instanceof Descriptor) {\r\n return descriptorOrOverrides.createDescriptorOverrides();\r\n }\r\n return descriptorOrOverrides;\r\n};\r\n\r\nfunction parseUpdateInfo(info: UpdateInfo | undefined) {\r\n if (info === undefined) {\r\n return undefined;\r\n }\r\n\r\n const parsedInfo: UpdateInfo = {};\r\n for (const fileName in info) {\r\n // istanbul ignore if\r\n if (!info.hasOwnProperty(fileName)) {\r\n continue;\r\n }\r\n\r\n const imodelDb = IModelDb.findByFilename(fileName);\r\n if (!imodelDb) {\r\n Logger.logError(PresentationBackendLoggerCategory.PresentationManager, `Update records IModelDb not found with path ${fileName}`);\r\n continue;\r\n }\r\n\r\n parsedInfo[imodelDb.getRpcProps().key] = info[fileName];\r\n }\r\n return Object.keys(parsedInfo).length > 0 ? parsedInfo : undefined;\r\n}\r\n\r\n/** @internal */\r\nexport function ipcUpdatesHandler(info: UpdateInfo | undefined) {\r\n const parsed = parseUpdateInfo(info);\r\n if (parsed) {\r\n IpcHost.send(PresentationIpcEvents.Update, parsed);\r\n }\r\n}\r\n\r\n/** @internal */\r\n// istanbul ignore next\r\nexport function noopUpdatesHandler(_info: UpdateInfo | undefined) {}\r\n"]}
|
|
1
|
+
{"version":3,"file":"PresentationManagerDetail.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManagerDetail.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6ZA,gDAsBC;AAGD,4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ourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport * as hash from \"object-hash\";\r\nimport * as path from \"path\";\r\nimport { IModelDb, IModelJsNative, IpcHost } from \"@itwin/core-backend\";\r\nimport { BeEvent, IDisposable, Logger } from \"@itwin/core-bentley\";\r\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport {\r\n Content,\r\n ContentDescriptorRequestOptions,\r\n ContentFlags,\r\n ContentRequestOptions,\r\n ContentSourcesRequestOptions,\r\n DefaultContentDisplayTypes,\r\n Descriptor,\r\n DescriptorOverrides,\r\n DiagnosticsOptions,\r\n DiagnosticsScopeLogs,\r\n DisplayLabelRequestOptions,\r\n DisplayLabelsRequestOptions,\r\n DisplayValueGroup,\r\n DistinctValuesRequestOptions,\r\n FilterByInstancePathsHierarchyRequestOptions,\r\n FilterByTextHierarchyRequestOptions,\r\n FormatsMap,\r\n HierarchyLevelDescriptorRequestOptions,\r\n HierarchyRequestOptions,\r\n InstanceKey,\r\n Item,\r\n Key,\r\n KeySet,\r\n LabelDefinition,\r\n NodeKey,\r\n NodePathElement,\r\n Paged,\r\n PagedResponse,\r\n PresentationError,\r\n PresentationIpcEvents,\r\n PresentationStatus,\r\n Prioritized,\r\n Ruleset,\r\n RulesetVariable,\r\n SelectClassInfo,\r\n UpdateInfo,\r\n WithCancelEvent,\r\n} from \"@itwin/presentation-common\";\r\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport {\r\n createDefaultNativePlatform,\r\n NativePlatformDefinition,\r\n NativePlatformRequestTypes,\r\n NativePlatformResponse,\r\n NativePresentationDefaultUnitFormats,\r\n NativePresentationKeySetJSON,\r\n NativePresentationUnitSystem,\r\n PresentationNativePlatformResponseError,\r\n} from \"./NativePlatform\";\r\nimport { HierarchyCacheConfig, HierarchyCacheMode, PresentationManagerProps } from \"./PresentationManager\";\r\nimport { RulesetManager, RulesetManagerImpl } from \"./RulesetManager\";\r\nimport { BackendDiagnosticsAttribute, BackendDiagnosticsOptions, combineDiagnosticsOptions, getElementKey, reportDiagnostics } from \"./Utils\";\r\n\r\n/** @internal */\r\nexport class PresentationManagerDetail implements IDisposable {\r\n private _disposed: boolean;\r\n private _nativePlatform: NativePlatformDefinition | undefined;\r\n private _onManagerUsed: (() => void) | undefined;\r\n private _diagnosticsOptions: BackendDiagnosticsOptions | undefined;\r\n\r\n public rulesets: RulesetManager;\r\n public activeUnitSystem: UnitSystemKey | undefined;\r\n\r\n constructor(params: PresentationManagerProps) {\r\n this._disposed = false;\r\n\r\n this._nativePlatform =\r\n params.addon ??\r\n createNativePlatform(\r\n params.id ?? \"\",\r\n params.workerThreadsCount ?? 2,\r\n IpcHost.isValid ? ipcUpdatesHandler : noopUpdatesHandler,\r\n params.caching,\r\n params.defaultFormats,\r\n params.useMmap,\r\n );\r\n\r\n setupRulesets(this._nativePlatform, params.supplementalRulesetDirectories ?? [], params.rulesetDirectories ?? []);\r\n this.activeUnitSystem = params.defaultUnitSystem;\r\n\r\n this._onManagerUsed = undefined;\r\n this.rulesets = new RulesetManagerImpl(() => this.getNativePlatform());\r\n this._diagnosticsOptions = params.diagnostics;\r\n }\r\n\r\n public dispose(): void {\r\n if (this._disposed) {\r\n return;\r\n }\r\n\r\n this.getNativePlatform().dispose();\r\n this._nativePlatform = undefined;\r\n\r\n this._disposed = true;\r\n }\r\n\r\n public getNativePlatform(): NativePlatformDefinition {\r\n if (this._disposed) {\r\n throw new PresentationError(PresentationStatus.NotInitialized, \"Attempting to use Presentation manager after disposal\");\r\n }\r\n\r\n return this._nativePlatform!;\r\n }\r\n\r\n public setOnManagerUsedHandler(handler: () => void) {\r\n this._onManagerUsed = handler;\r\n }\r\n\r\n public async getNodes(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>>> & BackendDiagnosticsAttribute,\r\n ): Promise<string> {\r\n const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: parentKey ? NativePlatformRequestTypes.GetChildren : NativePlatformRequestTypes.GetRootNodes,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return this.request(params);\r\n }\r\n\r\n public async getNodesCount(\r\n requestOptions: WithCancelEvent<Prioritized<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<number> {\r\n const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: parentKey ? NativePlatformRequestTypes.GetChildrenCount : NativePlatformRequestTypes.GetRootNodesCount,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return JSON.parse(await this.request(params));\r\n }\r\n\r\n public async getNodesDescriptor(\r\n requestOptions: WithCancelEvent<Prioritized<HierarchyLevelDescriptorRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<string> {\r\n const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetNodesDescriptor,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return this.request(params);\r\n }\r\n\r\n public async getNodePaths(\r\n requestOptions: WithCancelEvent<Prioritized<FilterByInstancePathsHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n const { rulesetOrId, instancePaths, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetNodePaths,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n paths: instancePaths,\r\n };\r\n return JSON.parse(await this.request(params), NodePathElement.listReviver);\r\n }\r\n\r\n public async getFilteredNodePaths(\r\n requestOptions: WithCancelEvent<Prioritized<FilterByTextHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n const { rulesetOrId, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetFilteredNodePaths,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n };\r\n return JSON.parse(await this.request(params), NodePathElement.listReviver);\r\n }\r\n\r\n public async getContentDescriptor(requestOptions: WithCancelEvent<Prioritized<ContentDescriptorRequestOptions<IModelDb, KeySet>>>): Promise<string> {\r\n const { rulesetOrId, contentFlags, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentDescriptor,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n contentFlags: contentFlags ?? ContentFlags.DescriptorOnly, // only set \"descriptor only\" flag if there are no flags provided\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n };\r\n return this.request(params);\r\n }\r\n\r\n public async getContentSources(\r\n requestOptions: WithCancelEvent<Prioritized<ContentSourcesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute,\r\n ): Promise<SelectClassInfo[]> {\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentSources,\r\n rulesetId: \"ElementProperties\",\r\n ...requestOptions,\r\n };\r\n const reviver = (key: string, value: any) => {\r\n return key === \"\" ? SelectClassInfo.listFromCompressedJSON(value.sources, value.classesMap) : value;\r\n };\r\n return JSON.parse(await this.request(params), reviver);\r\n }\r\n\r\n public async getContentSetSize(\r\n requestOptions: WithCancelEvent<Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<number> {\r\n const { rulesetOrId, descriptor, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentSetSize,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n return JSON.parse(await this.request(params));\r\n }\r\n\r\n public async getContentSet(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<Item[]> {\r\n const { rulesetOrId, descriptor, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentSet,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n return JSON.parse(await this.request(params), Item.listReviver);\r\n }\r\n\r\n public async getContent(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<Content | undefined> {\r\n const { rulesetOrId, descriptor, ...strippedOptions } = requestOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContent,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n return JSON.parse(await this.request(params), (key, value) => Content.reviver(key, value));\r\n }\r\n\r\n public async getPagedDistinctValues(\r\n requestOptions: WithCancelEvent<Prioritized<DistinctValuesRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<PagedResponse<DisplayValueGroup>> {\r\n const { rulesetOrId, ...strippedOptions } = requestOptions;\r\n const { descriptor, keys, ...strippedOptionsNoDescriptorAndKeys } = strippedOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetPagedDistinctValues,\r\n rulesetId: this.registerRuleset(rulesetOrId),\r\n ...strippedOptionsNoDescriptorAndKeys,\r\n keys: getKeysForContentRequest(keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n const reviver = (key: string, value: any) => {\r\n return key === \"\"\r\n ? {\r\n total: value.total,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n items: value.items.map(DisplayValueGroup.fromJSON),\r\n }\r\n : value;\r\n };\r\n return JSON.parse(await this.request(params), reviver);\r\n }\r\n\r\n public async getDisplayLabelDefinition(\r\n requestOptions: WithCancelEvent<Prioritized<DisplayLabelRequestOptions<IModelDb, InstanceKey>>> & BackendDiagnosticsAttribute,\r\n ): Promise<LabelDefinition> {\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetDisplayLabel,\r\n ...requestOptions,\r\n };\r\n return JSON.parse(await this.request(params));\r\n }\r\n\r\n public async getDisplayLabelDefinitions(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<DisplayLabelsRequestOptions<IModelDb, InstanceKey>>>> & BackendDiagnosticsAttribute,\r\n ): Promise<LabelDefinition[]> {\r\n const concreteKeys = requestOptions.keys\r\n .map((k) => {\r\n if (k.className === \"BisCore:Element\") {\r\n return getElementKey(requestOptions.imodel, k.id);\r\n }\r\n return k;\r\n })\r\n .filter<InstanceKey>((k): k is InstanceKey => !!k);\r\n const contentRequestOptions: ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet> = {\r\n ...requestOptions,\r\n rulesetOrId: \"RulesDrivenECPresentationManager_RulesetId_DisplayLabel\",\r\n descriptor: {\r\n displayType: DefaultContentDisplayTypes.List,\r\n contentFlags: ContentFlags.ShowLabels | ContentFlags.NoFields,\r\n },\r\n keys: new KeySet(concreteKeys),\r\n };\r\n const content = await this.getContent(contentRequestOptions);\r\n return concreteKeys.map((key) => {\r\n const item = content ? content.contentSet.find((it) => it.primaryKeys.length > 0 && InstanceKey.compare(it.primaryKeys[0], key) === 0) : undefined;\r\n if (!item) {\r\n return { displayValue: \"\", rawValue: \"\", typeName: \"\" };\r\n }\r\n return item.label;\r\n });\r\n }\r\n\r\n /** Registers given ruleset and replaces the ruleset with its ID in the resulting object */\r\n public registerRuleset(rulesetOrId: Ruleset | string): string {\r\n if (typeof rulesetOrId === \"object\") {\r\n const rulesetWithNativeId = { ...rulesetOrId, id: this.getRulesetId(rulesetOrId) };\r\n return this.rulesets.add(rulesetWithNativeId).id;\r\n }\r\n\r\n return rulesetOrId;\r\n }\r\n\r\n /** @internal */\r\n public getRulesetId(rulesetOrId: Ruleset | string): string {\r\n return getRulesetIdObject(rulesetOrId).uniqueId;\r\n }\r\n\r\n public async request(params: RequestParams): Promise<string> {\r\n this._onManagerUsed?.();\r\n const { requestId, imodel, unitSystem, diagnostics: requestDiagnostics, cancelEvent, ...strippedParams } = params;\r\n const imodelAddon = this.getNativePlatform().getImodelAddon(imodel);\r\n const response = await withOptionalDiagnostics([this._diagnosticsOptions, requestDiagnostics], async (diagnosticsOptions) => {\r\n const nativeRequestParams: any = {\r\n requestId,\r\n params: {\r\n unitSystem: toOptionalNativeUnitSystem(unitSystem ?? this.activeUnitSystem),\r\n ...strippedParams,\r\n ...(diagnosticsOptions ? { diagnostics: diagnosticsOptions } : undefined),\r\n },\r\n };\r\n return this.getNativePlatform().handleRequest(imodelAddon, JSON.stringify(nativeRequestParams), cancelEvent);\r\n });\r\n return response.result;\r\n }\r\n}\r\n\r\nasync function withOptionalDiagnostics(\r\n diagnosticsOptions: Array<BackendDiagnosticsOptions | undefined>,\r\n nativePlatformRequestHandler: (combinedDiagnosticsOptions: DiagnosticsOptions | undefined) => Promise<NativePlatformResponse<string>>,\r\n): Promise<NativePlatformResponse<string>> {\r\n const contexts = diagnosticsOptions.map((d) => d?.requestContextSupplier?.());\r\n const combinedOptions = combineDiagnosticsOptions(...diagnosticsOptions);\r\n let responseDiagnostics: DiagnosticsScopeLogs | undefined;\r\n try {\r\n const response = await nativePlatformRequestHandler(combinedOptions);\r\n responseDiagnostics = response.diagnostics;\r\n return response;\r\n } catch (e) {\r\n if (e instanceof PresentationNativePlatformResponseError) {\r\n responseDiagnostics = e.diagnostics;\r\n }\r\n throw e;\r\n } finally {\r\n if (responseDiagnostics) {\r\n const diagnostics = { logs: [responseDiagnostics] };\r\n diagnosticsOptions.forEach((options, i) => {\r\n options && reportDiagnostics(diagnostics, options, contexts[i]);\r\n });\r\n }\r\n }\r\n}\r\n\r\ninterface RequestParams {\r\n diagnostics?: BackendDiagnosticsOptions;\r\n requestId: string;\r\n imodel: IModelDb;\r\n unitSystem?: UnitSystemKey;\r\n cancelEvent?: BeEvent<() => void>;\r\n}\r\n\r\nfunction setupRulesets(nativePlatform: NativePlatformDefinition, supplementalRulesetDirectories: string[], primaryRulesetDirectories: string[]): void {\r\n // eslint-disable-next-line @typescript-eslint/no-require-imports\r\n const elementPropertiesRuleset: Ruleset = require(\"./primary-presentation-rules/ElementProperties.PresentationRuleSet.json\");\r\n nativePlatform.addRuleset(JSON.stringify(elementPropertiesRuleset));\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-require-imports\r\n const bisSupplementalRuleset: Ruleset = require(\"./supplemental-presentation-rules/BisCore.PresentationRuleSet.json\");\r\n nativePlatform.registerSupplementalRuleset(JSON.stringify(bisSupplementalRuleset));\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-require-imports\r\n const funcSupplementalRuleset: Ruleset = require(\"./supplemental-presentation-rules/Functional.PresentationRuleSet.json\");\r\n nativePlatform.registerSupplementalRuleset(JSON.stringify(funcSupplementalRuleset));\r\n\r\n nativePlatform.setupSupplementalRulesetDirectories(collateAssetDirectories(supplementalRulesetDirectories));\r\n nativePlatform.setupRulesetDirectories(collateAssetDirectories(primaryRulesetDirectories));\r\n}\r\n\r\ninterface RulesetIdObject {\r\n uniqueId: string;\r\n parts: {\r\n id: string;\r\n hash?: string;\r\n };\r\n}\r\n\r\n/** @internal */\r\nexport function getRulesetIdObject(rulesetOrId: Ruleset | string): RulesetIdObject {\r\n if (typeof rulesetOrId === \"object\") {\r\n if (IpcHost.isValid) {\r\n // in case of native apps we don't want to enforce ruleset id uniqueness as ruleset variables\r\n // are stored on a backend and creating new id will lose those variables\r\n return {\r\n uniqueId: rulesetOrId.id,\r\n parts: { id: rulesetOrId.id },\r\n };\r\n }\r\n\r\n const hashedId = hash.MD5(rulesetOrId);\r\n return {\r\n uniqueId: `${rulesetOrId.id}-${hashedId}`,\r\n parts: {\r\n id: rulesetOrId.id,\r\n hash: hashedId,\r\n },\r\n };\r\n }\r\n\r\n return { uniqueId: rulesetOrId, parts: { id: rulesetOrId } };\r\n}\r\n\r\n/** @internal */\r\nexport function getKeysForContentRequest(\r\n keys: Readonly<KeySet>,\r\n classInstanceKeysProcessor?: (keys: Map<string, Set<string>>) => void,\r\n): NativePresentationKeySetJSON {\r\n const result: NativePresentationKeySetJSON = {\r\n instanceKeys: [],\r\n nodeKeys: [],\r\n };\r\n const classInstancesMap = new Map<string, Set<string>>();\r\n keys.forEach((key) => {\r\n if (Key.isNodeKey(key)) {\r\n result.nodeKeys.push(key);\r\n }\r\n\r\n if (Key.isInstanceKey(key)) {\r\n addInstanceKey(classInstancesMap, key);\r\n }\r\n });\r\n\r\n if (classInstanceKeysProcessor) {\r\n classInstanceKeysProcessor(classInstancesMap);\r\n }\r\n\r\n for (const entry of classInstancesMap) {\r\n if (entry[1].size > 0) {\r\n result.instanceKeys.push([entry[\"0\"], [...entry[1]]]);\r\n }\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/** @internal */\r\nexport function bisElementInstanceKeysProcessor(imodel: IModelDb, classInstancesMap: Map<string, Set<string>>) {\r\n const elementClassName = \"BisCore:Element\";\r\n const elementIds = classInstancesMap.get(elementClassName);\r\n if (elementIds) {\r\n const deleteElementIds = new Array<string>();\r\n elementIds.forEach((elementId) => {\r\n const concreteKey = getElementKey(imodel, elementId);\r\n if (concreteKey && concreteKey.className !== elementClassName) {\r\n deleteElementIds.push(elementId);\r\n addInstanceKey(classInstancesMap, { className: concreteKey.className, id: elementId });\r\n }\r\n });\r\n for (const id of deleteElementIds) {\r\n elementIds.delete(id);\r\n }\r\n }\r\n}\r\n\r\nfunction addInstanceKey(classInstancesMap: Map<string, Set<string>>, key: InstanceKey): void {\r\n let set = classInstancesMap.get(key.className);\r\n // istanbul ignore else\r\n if (!set) {\r\n set = new Set();\r\n classInstancesMap.set(key.className, set);\r\n }\r\n set.add(key.id);\r\n}\r\n\r\nfunction createNativePlatform(\r\n id: string,\r\n workerThreadsCount: number,\r\n updateCallback: (updateInfo: UpdateInfo | undefined) => void,\r\n caching: PresentationManagerProps[\"caching\"],\r\n defaultFormats: FormatsMap | undefined,\r\n useMmap: boolean | number | undefined,\r\n): NativePlatformDefinition {\r\n return new (createDefaultNativePlatform({\r\n id,\r\n taskAllocationsMap: { [Number.MAX_SAFE_INTEGER]: workerThreadsCount },\r\n updateCallback,\r\n cacheConfig: createCacheConfig(caching?.hierarchies),\r\n contentCacheSize: caching?.content?.size,\r\n workerConnectionCacheSize: caching?.workerConnectionCacheSize,\r\n defaultFormats: toNativeUnitFormatsMap(defaultFormats),\r\n useMmap,\r\n }))();\r\n\r\n function createCacheConfig(config?: HierarchyCacheConfig): IModelJsNative.ECPresentationHierarchyCacheConfig {\r\n switch (config?.mode) {\r\n case HierarchyCacheMode.Disk:\r\n return { ...config, directory: normalizeDirectory(config.directory) };\r\n\r\n case HierarchyCacheMode.Hybrid:\r\n return {\r\n ...config,\r\n disk: config.disk ? { ...config.disk, directory: normalizeDirectory(config.disk.directory) } : undefined,\r\n };\r\n\r\n case HierarchyCacheMode.Memory:\r\n return config;\r\n\r\n default:\r\n return { mode: HierarchyCacheMode.Disk, directory: \"\" };\r\n }\r\n }\r\n\r\n function normalizeDirectory(directory?: string): string {\r\n return directory ? path.resolve(directory) : \"\";\r\n }\r\n\r\n function toNativeUnitFormatsMap(map: FormatsMap | undefined): NativePresentationDefaultUnitFormats | undefined {\r\n if (!map) {\r\n return undefined;\r\n }\r\n\r\n const nativeFormatsMap: NativePresentationDefaultUnitFormats = {};\r\n Object.entries(map).forEach(([phenomenon, formats]) => {\r\n nativeFormatsMap[phenomenon] = (Array.isArray(formats) ? formats : [formats]).map((unitSystemsFormat) => ({\r\n unitSystems: unitSystemsFormat.unitSystems.map(toNativeUnitSystem),\r\n format: unitSystemsFormat.format,\r\n }));\r\n });\r\n return nativeFormatsMap;\r\n }\r\n}\r\n\r\nfunction toOptionalNativeUnitSystem(unitSystem: UnitSystemKey | undefined): NativePresentationUnitSystem | undefined {\r\n return unitSystem ? toNativeUnitSystem(unitSystem) : undefined;\r\n}\r\n\r\nfunction toNativeUnitSystem(unitSystem: UnitSystemKey): NativePresentationUnitSystem {\r\n switch (unitSystem) {\r\n case \"imperial\":\r\n return NativePresentationUnitSystem.BritishImperial;\r\n case \"metric\":\r\n return NativePresentationUnitSystem.Metric;\r\n case \"usCustomary\":\r\n return NativePresentationUnitSystem.UsCustomary;\r\n case \"usSurvey\":\r\n return NativePresentationUnitSystem.UsSurvey;\r\n }\r\n}\r\n\r\nfunction collateAssetDirectories(dirs: string[]): string[] {\r\n return [...new Set(dirs)];\r\n}\r\nconst createContentDescriptorOverrides = (descriptorOrOverrides: Descriptor | DescriptorOverrides): DescriptorOverrides => {\r\n if (descriptorOrOverrides instanceof Descriptor) {\r\n return descriptorOrOverrides.createDescriptorOverrides();\r\n }\r\n return descriptorOrOverrides;\r\n};\r\n\r\nfunction parseUpdateInfo(info: UpdateInfo | undefined) {\r\n if (info === undefined) {\r\n return undefined;\r\n }\r\n\r\n const parsedInfo: UpdateInfo = {};\r\n for (const fileName in info) {\r\n // istanbul ignore if\r\n if (!info.hasOwnProperty(fileName)) {\r\n continue;\r\n }\r\n\r\n const imodelDb = IModelDb.findByFilename(fileName);\r\n if (!imodelDb) {\r\n Logger.logError(PresentationBackendLoggerCategory.PresentationManager, `Update records IModelDb not found with path ${fileName}`);\r\n continue;\r\n }\r\n\r\n parsedInfo[imodelDb.getRpcProps().key] = info[fileName];\r\n }\r\n return Object.keys(parsedInfo).length > 0 ? parsedInfo : undefined;\r\n}\r\n\r\n/** @internal */\r\nexport function ipcUpdatesHandler(info: UpdateInfo | undefined) {\r\n const parsed = parseUpdateInfo(info);\r\n if (parsed) {\r\n IpcHost.send(PresentationIpcEvents.Update, parsed);\r\n }\r\n}\r\n\r\n/** @internal */\r\n// istanbul ignore next\r\nexport function noopUpdatesHandler(_info: UpdateInfo | undefined) {}\r\n"]}
|
|
@@ -14,7 +14,7 @@ const presentation_common_1 = require("@itwin/presentation-common");
|
|
|
14
14
|
const BackendLoggerCategory_1 = require("./BackendLoggerCategory");
|
|
15
15
|
const Presentation_1 = require("./Presentation");
|
|
16
16
|
const TemporaryStorage_1 = require("./TemporaryStorage");
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
18
18
|
const packageJsonVersion = require("../../../package.json").version;
|
|
19
19
|
/** @internal */
|
|
20
20
|
exports.MAX_ALLOWED_PAGE_SIZE = 1000;
|
|
@@ -164,7 +164,7 @@ class PresentationRpcImpl extends presentation_common_1.PresentationRpcInterface
|
|
|
164
164
|
let timeout;
|
|
165
165
|
const timeoutPromise = new Promise((_resolve, reject) => {
|
|
166
166
|
timeout = setTimeout(() => {
|
|
167
|
-
reject();
|
|
167
|
+
reject(new Error());
|
|
168
168
|
}, this._requestTimeout);
|
|
169
169
|
});
|
|
170
170
|
core_bentley_1.Logger.logTrace(BackendLoggerCategory_1.PresentationBackendLoggerCategory.Rpc, `Returning a promise with a timeout of ${this._requestTimeout}.`);
|
|
@@ -203,7 +203,7 @@ class PresentationRpcImpl extends presentation_common_1.PresentationRpcInterface
|
|
|
203
203
|
this.getManager(requestOptions.clientId).getDetail().getNodes(options),
|
|
204
204
|
this.getManager(requestOptions.clientId).getNodesCount(options),
|
|
205
205
|
]);
|
|
206
|
-
// eslint-disable-next-line
|
|
206
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
207
207
|
const nodesJson = JSON.parse(serializedNodesJson);
|
|
208
208
|
return {
|
|
209
209
|
total: count,
|
|
@@ -223,14 +223,14 @@ class PresentationRpcImpl extends presentation_common_1.PresentationRpcInterface
|
|
|
223
223
|
async getNodePaths(token, requestOptions) {
|
|
224
224
|
return this.makeRequest(token, "getNodePaths", requestOptions, async (options) => {
|
|
225
225
|
const result = await this.getManager(requestOptions.clientId).getDetail().getNodePaths(options);
|
|
226
|
-
// eslint-disable-next-line
|
|
226
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
227
227
|
return result.map(presentation_common_1.NodePathElement.toJSON);
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
230
|
async getFilteredNodePaths(token, requestOptions) {
|
|
231
231
|
return this.makeRequest(token, "getFilteredNodePaths", requestOptions, async (options) => {
|
|
232
232
|
const result = await this.getManager(requestOptions.clientId).getDetail().getFilteredNodePaths(options);
|
|
233
|
-
// eslint-disable-next-line
|
|
233
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
234
234
|
return result.map(presentation_common_1.NodePathElement.toJSON);
|
|
235
235
|
});
|
|
236
236
|
}
|
|
@@ -333,7 +333,7 @@ class PresentationRpcImpl extends presentation_common_1.PresentationRpcInterface
|
|
|
333
333
|
const response = await this.getManager(requestOptions.clientId).getDetail().getPagedDistinctValues(options);
|
|
334
334
|
return {
|
|
335
335
|
...response,
|
|
336
|
-
// eslint-disable-next-line
|
|
336
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
337
337
|
items: response.items.map(presentation_common_1.DisplayValueGroup.toJSON),
|
|
338
338
|
};
|
|
339
339
|
});
|
|
@@ -412,12 +412,12 @@ const getValidPageSize = (size, maxPageSize) => {
|
|
|
412
412
|
const requestedSize = size ?? 0;
|
|
413
413
|
return requestedSize === 0 || requestedSize > maxPageSize ? maxPageSize : requestedSize;
|
|
414
414
|
};
|
|
415
|
-
// eslint-disable-next-line
|
|
415
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
416
416
|
const nodeKeyFromJson = (json) => {
|
|
417
417
|
if (!json) {
|
|
418
418
|
return undefined;
|
|
419
419
|
}
|
|
420
|
-
// eslint-disable-next-line
|
|
420
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
421
421
|
return presentation_common_1.NodeKey.fromJSON(json);
|
|
422
422
|
};
|
|
423
423
|
//# sourceMappingURL=PresentationRpcImpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationRpcImpl.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationRpcImpl.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAAyD;AACzD,sDAAuF;AAEvF,oEAmDoC;AACpC,mEAA4E;AAC5E,iDAA8C;AAE9C,yDAAsD;AAEtD,8DAA8D;AAC9D,MAAM,kBAAkB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC;AAIpE,gBAAgB;AACH,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAC1C,gBAAgB;AACH,QAAA,0BAA0B,GAAG,KAAK,CAAC;AAEhD,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAErC;;;;;GAKG;AACH,MAAa,mBAAoB,SAAQ,8CAAwB;IAK/D,YAAmB,KAAmC;QACpD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,eAAe,GAAG,KAAK,EAAE,cAAc,IAAI,uBAAuB,C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OAAQ,EAAE;iBACxB,CAAC;YACJ,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,gBAAgB,CAAC,OAAmD,CAAC,CAAC;YAClI,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtdD,kDAsdC;AAED,MAAM,oBAAoB,GAAG,CAC3B,cAAwB,EACxB,WAAW,GAAG,6BAAqB,EACC,EAAE;IACtC,MAAM,aAAa,GAAG,gBAAgB,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IACjF,IAAI,CAAC,cAAc,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;QAC3E,OAAO,EAAE,GAAG,cAAc,EAAE,MAAM,EAAE,EAAE,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC;IAC1F,CAAC;IACD,OAAO,cAAoD,CAAC;AAC9D,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,IAAwB,EAAE,WAAmB,EAAE,EAAE;IACzE,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC,CAAC;IAChC,OAAO,aAAa,KAAK,CAAC,IAAI,aAAa,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC;AAC1F,CAAC,CAAC;AAEF,mDAAmD;AACnD,MAAM,eAAe,GAAG,CAAC,IAA6B,EAAuB,EAAE;IAC7E,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,mDAAmD;IACnD,OAAO,6BAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RPC\r\n */\r\n\r\nimport { IModelDb, RpcTrace } from \"@itwin/core-backend\";\r\nimport { assert, BeEvent, Id64String, IDisposable, Logger } from \"@itwin/core-bentley\";\r\nimport { IModelRpcProps } from \"@itwin/core-common\";\r\nimport {\r\n buildElementProperties,\r\n ClientDiagnostics,\r\n ComputeSelectionRequestOptions,\r\n ComputeSelectionRpcRequestOptions,\r\n ContentDescriptorRpcRequestOptions,\r\n ContentFlags,\r\n ContentInstanceKeysRpcRequestOptions,\r\n ContentRpcRequestOptions,\r\n ContentSourcesRpcRequestOptions,\r\n ContentSourcesRpcResult,\r\n DefaultContentDisplayTypes,\r\n DescriptorJSON,\r\n Diagnostics,\r\n DisplayLabelRpcRequestOptions,\r\n DisplayLabelsRpcRequestOptions,\r\n DisplayValueGroup,\r\n DisplayValueGroupJSON,\r\n DistinctValuesRpcRequestOptions,\r\n ElementProperties,\r\n FilterByInstancePathsHierarchyRpcRequestOptions,\r\n FilterByTextHierarchyRpcRequestOptions,\r\n HierarchyLevelDescriptorRpcRequestOptions,\r\n HierarchyLevelJSON,\r\n HierarchyRpcRequestOptions,\r\n isComputeSelectionRequestOptions,\r\n ItemJSON,\r\n KeySet,\r\n KeySetJSON,\r\n LabelDefinition,\r\n NodeJSON,\r\n NodeKey,\r\n NodeKeyJSON,\r\n NodePathElement,\r\n NodePathElementJSON,\r\n Paged,\r\n PagedResponse,\r\n PageOptions,\r\n PresentationError,\r\n PresentationRpcInterface,\r\n PresentationRpcResponse,\r\n PresentationRpcResponseData,\r\n PresentationStatus,\r\n RpcDiagnosticsOptions,\r\n Ruleset,\r\n RulesetVariable,\r\n RulesetVariableJSON,\r\n SelectClassInfo,\r\n SelectionScope,\r\n SelectionScopeRpcRequestOptions,\r\n SingleElementPropertiesRpcRequestOptions,\r\n} from \"@itwin/presentation-common\";\r\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { Presentation } from \"./Presentation\";\r\nimport { PresentationManager } from \"./PresentationManager\";\r\nimport { TemporaryStorage } from \"./TemporaryStorage\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-var-requires\r\nconst packageJsonVersion = require(\"../../../package.json\").version;\r\n\r\ntype ContentGetter<TResult = any, TOptions = any> = (requestOptions: TOptions) => TResult;\r\n\r\n/** @internal */\r\nexport const MAX_ALLOWED_PAGE_SIZE = 1000;\r\n/** @internal */\r\nexport const MAX_ALLOWED_KEYS_PAGE_SIZE = 10000;\r\n\r\nconst DEFAULT_REQUEST_TIMEOUT = 5000;\r\n\r\n/**\r\n * The backend implementation of PresentationRpcInterface. All it's basically\r\n * responsible for is forwarding calls to [[Presentation.manager]].\r\n *\r\n * @internal\r\n */\r\nexport class PresentationRpcImpl extends PresentationRpcInterface implements IDisposable {\r\n private _requestTimeout: number;\r\n private _pendingRequests: TemporaryStorage<PresentationRpcResponse<any>>;\r\n private _cancelEvents: Map<string, BeEvent<() => void>>;\r\n\r\n public constructor(props?: { requestTimeout?: number }) {\r\n super();\r\n this._requestTimeout = props?.requestTimeout ?? DEFAULT_REQUEST_TIMEOUT;\r\n this._pendingRequests = new TemporaryStorage({\r\n // remove the pending request after request timeout + 10 seconds - this gives\r\n // frontend 10 seconds to re-send the request until it's removed from requests' cache\r\n unusedValueLifetime: this._requestTimeout > 0 ? this._requestTimeout + 10 * 1000 : undefined,\r\n\r\n // attempt to clean up every second\r\n cleanupInterval: 1000,\r\n\r\n cleanupHandler: (id, _, reason) => {\r\n if (reason !== \"request\") {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Cleaning up request without frontend retrieving it: ${id}.`);\r\n // istanbul ignore next\r\n this._cancelEvents.get(id)?.raiseEvent();\r\n }\r\n this._cancelEvents.delete(id);\r\n },\r\n });\r\n this._cancelEvents = new Map<string, BeEvent<() => void>>();\r\n }\r\n\r\n public dispose() {\r\n this._pendingRequests.dispose();\r\n }\r\n\r\n public get requestTimeout() {\r\n return this._requestTimeout;\r\n }\r\n\r\n public get pendingRequests() {\r\n return this._pendingRequests;\r\n }\r\n\r\n /** Returns an ok response with result inside */\r\n private successResponse<TResult>(result: TResult, diagnostics?: ClientDiagnostics) {\r\n return {\r\n statusCode: PresentationStatus.Success,\r\n result,\r\n diagnostics,\r\n };\r\n }\r\n\r\n /** Returns a bad request response with empty result and an error code */\r\n private errorResponse(errorCode: PresentationStatus, errorMessage?: string, diagnostics?: ClientDiagnostics) {\r\n return {\r\n statusCode: errorCode,\r\n result: undefined,\r\n errorMessage,\r\n diagnostics,\r\n };\r\n }\r\n\r\n /**\r\n * Get the [[PresentationManager]] used by this RPC impl.\r\n */\r\n public getManager(clientId?: string): PresentationManager {\r\n return Presentation.getManager(clientId);\r\n }\r\n\r\n private async getIModel(token: IModelRpcProps): Promise<IModelDb> {\r\n let imodel: IModelDb;\r\n try {\r\n imodel = IModelDb.findByKey(token.key);\r\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.\r\n await imodel.refreshContainerForRpc(RpcTrace.expectCurrentActivity.accessToken);\r\n } catch {\r\n throw new PresentationError(PresentationStatus.InvalidArgument, \"IModelRpcProps doesn't point to a valid iModel\");\r\n }\r\n return imodel;\r\n }\r\n\r\n private async makeRequest<\r\n TRpcOptions extends { rulesetOrId?: Ruleset | string; clientId?: string; diagnostics?: RpcDiagnosticsOptions; rulesetVariables?: RulesetVariableJSON[] },\r\n TResult,\r\n >(token: IModelRpcProps, requestId: string, requestOptions: TRpcOptions, request: ContentGetter<Promise<TResult>>): PresentationRpcResponse<TResult> {\r\n const requestKey = JSON.stringify({ iModelKey: token.key, requestId, requestOptions });\r\n\r\n Logger.logInfo(PresentationBackendLoggerCategory.Rpc, `Received '${requestId}' request. Params: ${requestKey}`);\r\n\r\n let imodel: IModelDb;\r\n try {\r\n imodel = await this.getIModel(token);\r\n } catch (e) {\r\n assert(e instanceof Error);\r\n return this.errorResponse(PresentationStatus.InvalidArgument, e.message);\r\n }\r\n\r\n let resultPromise = this._pendingRequests.getValue(requestKey);\r\n if (resultPromise) {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request already pending`);\r\n } else {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request not found, creating a new one`);\r\n const { clientId: _, diagnostics: diagnosticsOptions, rulesetVariables, ...options } = requestOptions;\r\n const managerRequestOptions: any = {\r\n ...options,\r\n imodel,\r\n cancelEvent: new BeEvent<() => void>(),\r\n };\r\n\r\n // set up ruleset variables\r\n if (rulesetVariables) {\r\n managerRequestOptions.rulesetVariables = rulesetVariables.map(RulesetVariable.fromJSON);\r\n }\r\n\r\n // set up diagnostics listener\r\n let diagnostics: ClientDiagnostics | undefined;\r\n const getDiagnostics = (): ClientDiagnostics => {\r\n if (!diagnostics) {\r\n diagnostics = {};\r\n }\r\n return diagnostics;\r\n };\r\n if (diagnosticsOptions) {\r\n if (diagnosticsOptions.backendVersion) {\r\n getDiagnostics().backendVersion = packageJsonVersion;\r\n }\r\n managerRequestOptions.diagnostics = {\r\n ...diagnosticsOptions,\r\n handler: (d: Diagnostics) => {\r\n if (d.logs) {\r\n const target = getDiagnostics();\r\n if (target.logs) {\r\n target.logs.push(...d.logs);\r\n } else {\r\n target.logs = [...d.logs];\r\n }\r\n }\r\n },\r\n };\r\n }\r\n\r\n // initiate request\r\n resultPromise = request(managerRequestOptions)\r\n .then((result) => this.successResponse(result, diagnostics))\r\n .catch((e: PresentationError) => this.errorResponse(e.errorNumber, e.message, diagnostics));\r\n\r\n // store the request promise\r\n this._pendingRequests.addValue(requestKey, resultPromise);\r\n this._cancelEvents.set(requestKey, managerRequestOptions.cancelEvent);\r\n }\r\n\r\n if (this._requestTimeout === 0) {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request timeout not configured, returning promise without a timeout.`);\r\n void resultPromise.finally(() => {\r\n this._pendingRequests.deleteValue(requestKey);\r\n });\r\n return resultPromise;\r\n }\r\n\r\n let timeout: NodeJS.Timeout;\r\n const timeoutPromise = new Promise<any>((_resolve, reject) => {\r\n timeout = setTimeout(() => {\r\n reject();\r\n }, this._requestTimeout);\r\n });\r\n\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Returning a promise with a timeout of ${this._requestTimeout}.`);\r\n return Promise.race([resultPromise, timeoutPromise])\r\n .catch<PresentationRpcResponseData>(() => {\r\n // note: error responses from the manager get handled when creating `resultPromise`, so we can only get here due\r\n // to a timeout exception\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request timeout, returning \"BackendTimeout\" status.`);\r\n return this.errorResponse(PresentationStatus.BackendTimeout);\r\n })\r\n .then((response: PresentationRpcResponseData<TResult>) => {\r\n if (response.statusCode !== PresentationStatus.BackendTimeout) {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request completed, returning result.`);\r\n this._pendingRequests.deleteValue(requestKey);\r\n }\r\n clearTimeout(timeout);\r\n return response;\r\n });\r\n }\r\n\r\n public override async getNodesCount(token: IModelRpcProps, requestOptions: HierarchyRpcRequestOptions): PresentationRpcResponse<number> {\r\n return this.makeRequest(token, \"getNodesCount\", requestOptions, async (options) => {\r\n options = {\r\n ...options,\r\n parentKey: nodeKeyFromJson(options.parentKey),\r\n };\r\n return this.getManager(requestOptions.clientId).getNodesCount(options);\r\n });\r\n }\r\n\r\n public override async getPagedNodes(\r\n token: IModelRpcProps,\r\n requestOptions: Paged<HierarchyRpcRequestOptions>,\r\n // eslint-disable-next-line deprecation/deprecation\r\n ): PresentationRpcResponse<PagedResponse<NodeJSON>> {\r\n return this.makeRequest(token, \"getPagedNodes\", requestOptions, async (options) => {\r\n options = enforceValidPageSize({\r\n ...options,\r\n parentKey: nodeKeyFromJson(options.parentKey),\r\n });\r\n const [serializedNodesJson, count] = await Promise.all([\r\n this.getManager(requestOptions.clientId).getDetail().getNodes(options),\r\n this.getManager(requestOptions.clientId).getNodesCount(options),\r\n ]);\r\n // eslint-disable-next-line deprecation/deprecation\r\n const nodesJson = JSON.parse(serializedNodesJson) as HierarchyLevelJSON;\r\n return {\r\n total: count,\r\n items: nodesJson.nodes,\r\n };\r\n });\r\n }\r\n\r\n public override async getNodesDescriptor(\r\n token: IModelRpcProps,\r\n requestOptions: HierarchyLevelDescriptorRpcRequestOptions,\r\n ): PresentationRpcResponse<string | DescriptorJSON | undefined> {\r\n return this.makeRequest(token, \"getNodesDescriptor\", requestOptions, async (options) => {\r\n options = {\r\n ...options,\r\n parentKey: nodeKeyFromJson(options.parentKey),\r\n };\r\n return this.getManager(requestOptions.clientId).getDetail().getNodesDescriptor(options);\r\n });\r\n }\r\n\r\n public override async getNodePaths(\r\n token: IModelRpcProps,\r\n requestOptions: FilterByInstancePathsHierarchyRpcRequestOptions,\r\n // eslint-disable-next-line deprecation/deprecation\r\n ): PresentationRpcResponse<NodePathElementJSON[]> {\r\n return this.makeRequest(token, \"getNodePaths\", requestOptions, async (options) => {\r\n const result = await this.getManager(requestOptions.clientId).getDetail().getNodePaths(options);\r\n // eslint-disable-next-line deprecation/deprecation\r\n return result.map(NodePathElement.toJSON);\r\n });\r\n }\r\n\r\n public override async getFilteredNodePaths(\r\n token: IModelRpcProps,\r\n requestOptions: FilterByTextHierarchyRpcRequestOptions,\r\n // eslint-disable-next-line deprecation/deprecation\r\n ): PresentationRpcResponse<NodePathElementJSON[]> {\r\n return this.makeRequest(token, \"getFilteredNodePaths\", requestOptions, async (options) => {\r\n const result = await this.getManager(requestOptions.clientId).getDetail().getFilteredNodePaths(options);\r\n // eslint-disable-next-line deprecation/deprecation\r\n return result.map(NodePathElement.toJSON);\r\n });\r\n }\r\n\r\n public override async getContentSources(\r\n token: IModelRpcProps,\r\n requestOptions: ContentSourcesRpcRequestOptions,\r\n ): PresentationRpcResponse<ContentSourcesRpcResult> {\r\n return this.makeRequest(token, \"getContentSources\", requestOptions, async (options) => {\r\n const result = await this.getManager(requestOptions.clientId).getContentSources(options);\r\n const classesMap = {};\r\n const selectClasses = result.map((sci) => SelectClassInfo.toCompressedJSON(sci, classesMap));\r\n return { sources: selectClasses, classesMap };\r\n });\r\n }\r\n\r\n public override async getContentDescriptor(\r\n token: IModelRpcProps,\r\n requestOptions: ContentDescriptorRpcRequestOptions,\r\n ): PresentationRpcResponse<DescriptorJSON | undefined> {\r\n return this.makeRequest(token, \"getContentDescriptor\", requestOptions, async (options) => {\r\n options = {\r\n ...options,\r\n contentFlags: (options.contentFlags ?? 0) | ContentFlags.DescriptorOnly, // always append the \"descriptor only\" flag when handling request from the frontend\r\n keys: KeySet.fromJSON(options.keys),\r\n };\r\n if (options.transport === \"unparsed-json\") {\r\n // Here we send a plain JSON string but we will parse it to DescriptorJSON on the frontend. This way we are\r\n // bypassing unnecessary deserialization and serialization.\r\n return Presentation.getManager(requestOptions.clientId).getDetail().getContentDescriptor(options) as unknown as DescriptorJSON | undefined;\r\n } else {\r\n // Support for older frontends that still expect a parsed descriptor\r\n const descriptor = await Presentation.getManager(requestOptions.clientId).getContentDescriptor(options);\r\n return descriptor?.toJSON();\r\n }\r\n });\r\n }\r\n\r\n public override async getContentSetSize(token: IModelRpcProps, requestOptions: ContentRpcRequestOptions): PresentationRpcResponse<number> {\r\n return this.makeRequest(token, \"getContentSetSize\", requestOptions, async (options) => {\r\n options = {\r\n ...options,\r\n keys: KeySet.fromJSON(options.keys),\r\n };\r\n return this.getManager(requestOptions.clientId).getContentSetSize(options);\r\n });\r\n }\r\n\r\n public override async getPagedContent(\r\n token: IModelRpcProps,\r\n requestOptions: Paged<ContentRpcRequestOptions>,\r\n ): PresentationRpcResponse<{ descriptor: DescriptorJSON; contentSet: PagedResponse<ItemJSON> } | undefined> {\r\n return this.makeRequest(token, \"getPagedContent\", requestOptions, async (options) => {\r\n options = enforceValidPageSize({\r\n ...options,\r\n keys: KeySet.fromJSON(options.keys),\r\n });\r\n\r\n const [size, content] = await Promise.all([\r\n this.getManager(requestOptions.clientId).getContentSetSize(options),\r\n this.getManager(requestOptions.clientId).getDetail().getContent(options),\r\n ]);\r\n\r\n if (!content) {\r\n return undefined;\r\n }\r\n\r\n return {\r\n descriptor: content.descriptor.toJSON(),\r\n contentSet: {\r\n total: size,\r\n items: content.contentSet.map((i) => i.toJSON()),\r\n },\r\n };\r\n });\r\n }\r\n\r\n public override async getPagedContentSet(\r\n token: IModelRpcProps,\r\n requestOptions: Paged<ContentRpcRequestOptions>,\r\n ): PresentationRpcResponse<PagedResponse<ItemJSON>> {\r\n const response = await this.getPagedContent(token, requestOptions);\r\n if (response.statusCode !== PresentationStatus.Success) {\r\n return this.errorResponse(response.statusCode, response.errorMessage, response.diagnostics);\r\n }\r\n if (!response.result) {\r\n return this.errorResponse(PresentationStatus.Error, `Failed to get content set (received a success response with empty result)`, response.diagnostics);\r\n }\r\n return {\r\n ...response,\r\n result: response.result.contentSet,\r\n };\r\n }\r\n\r\n public override async getElementProperties(\r\n token: IModelRpcProps,\r\n requestOptions: SingleElementPropertiesRpcRequestOptions,\r\n ): PresentationRpcResponse<ElementProperties | undefined> {\r\n return this.makeRequest(token, \"getElementProperties\", { ...requestOptions }, async (options) => {\r\n const manager = this.getManager(requestOptions.clientId);\r\n const { elementId, ...optionsNoElementId } = options;\r\n const content = await manager.getDetail().getContent({\r\n ...optionsNoElementId,\r\n descriptor: {\r\n displayType: DefaultContentDisplayTypes.PropertyPane,\r\n contentFlags: ContentFlags.ShowLabels,\r\n },\r\n rulesetOrId: \"ElementProperties\",\r\n keys: new KeySet([{ className: \"BisCore:Element\", id: elementId }]),\r\n });\r\n if (!content || content.contentSet.length === 0) {\r\n return undefined;\r\n }\r\n return buildElementProperties(content.descriptor, content.contentSet[0]);\r\n });\r\n }\r\n\r\n public override async getPagedDistinctValues(\r\n token: IModelRpcProps,\r\n requestOptions: DistinctValuesRpcRequestOptions,\r\n // eslint-disable-next-line deprecation/deprecation\r\n ): PresentationRpcResponse<PagedResponse<DisplayValueGroupJSON>> {\r\n return this.makeRequest(token, \"getPagedDistinctValues\", requestOptions, async (options) => {\r\n options = enforceValidPageSize({\r\n ...options,\r\n keys: KeySet.fromJSON(options.keys),\r\n });\r\n const response = await this.getManager(requestOptions.clientId).getDetail().getPagedDistinctValues(options);\r\n return {\r\n ...response,\r\n // eslint-disable-next-line deprecation/deprecation\r\n items: response.items.map(DisplayValueGroup.toJSON),\r\n };\r\n });\r\n }\r\n\r\n public override async getContentInstanceKeys(\r\n token: IModelRpcProps,\r\n requestOptions: ContentInstanceKeysRpcRequestOptions,\r\n ): PresentationRpcResponse<{ total: number; items: KeySetJSON }> {\r\n return this.makeRequest(token, \"getContentInstanceKeys\", requestOptions, async (options) => {\r\n const { displayType, ...optionsNoDisplayType } = options;\r\n options = enforceValidPageSize(\r\n {\r\n ...optionsNoDisplayType,\r\n keys: KeySet.fromJSON(optionsNoDisplayType.keys),\r\n descriptor: {\r\n displayType,\r\n contentFlags: ContentFlags.KeysOnly,\r\n },\r\n },\r\n MAX_ALLOWED_KEYS_PAGE_SIZE,\r\n );\r\n\r\n const [size, content] = await Promise.all([\r\n this.getManager(requestOptions.clientId).getContentSetSize(options),\r\n this.getManager(requestOptions.clientId).getDetail().getContent(options),\r\n ]);\r\n\r\n if (size === 0 || !content) {\r\n return { total: 0, items: new KeySet().toJSON() };\r\n }\r\n\r\n return {\r\n total: size,\r\n items: content.contentSet.reduce((keys, item) => keys.add(item.primaryKeys), new KeySet()).toJSON(),\r\n };\r\n });\r\n }\r\n\r\n public override async getDisplayLabelDefinition(\r\n token: IModelRpcProps,\r\n requestOptions: DisplayLabelRpcRequestOptions,\r\n ): PresentationRpcResponse<LabelDefinition> {\r\n return this.makeRequest(token, \"getDisplayLabelDefinition\", requestOptions, async (options) => {\r\n const label = await this.getManager(requestOptions.clientId).getDetail().getDisplayLabelDefinition(options);\r\n return label;\r\n });\r\n }\r\n\r\n public override async getPagedDisplayLabelDefinitions(\r\n token: IModelRpcProps,\r\n requestOptions: DisplayLabelsRpcRequestOptions,\r\n ): PresentationRpcResponse<PagedResponse<LabelDefinition>> {\r\n const pageOpts = enforceValidPageSize({ paging: { start: 0, size: requestOptions.keys.length } });\r\n if (pageOpts.paging.size < requestOptions.keys.length) {\r\n requestOptions.keys.splice(pageOpts.paging.size);\r\n }\r\n return this.makeRequest(token, \"getPagedDisplayLabelDefinitions\", requestOptions, async (options) => {\r\n const labels = await this.getManager(requestOptions.clientId)\r\n .getDetail()\r\n .getDisplayLabelDefinitions({ ...options, keys: options.keys });\r\n return {\r\n total: options.keys.length,\r\n items: labels,\r\n };\r\n });\r\n }\r\n\r\n public override async getSelectionScopes(token: IModelRpcProps, requestOptions: SelectionScopeRpcRequestOptions): PresentationRpcResponse<SelectionScope[]> {\r\n return this.makeRequest(token, \"getSelectionScopes\", requestOptions, async (options) =>\r\n this.getManager(requestOptions.clientId).getSelectionScopes(options),\r\n );\r\n }\r\n\r\n public override async computeSelection(\r\n token: IModelRpcProps,\r\n requestOptions: ComputeSelectionRpcRequestOptions | SelectionScopeRpcRequestOptions,\r\n ids?: Id64String[],\r\n scopeId?: string,\r\n ): PresentationRpcResponse<KeySetJSON> {\r\n return this.makeRequest(token, \"computeSelection\", requestOptions, async (options) => {\r\n if (!isComputeSelectionRequestOptions(options)) {\r\n options = {\r\n ...options,\r\n elementIds: ids!,\r\n scope: { id: scopeId! },\r\n };\r\n }\r\n const keys = await this.getManager(requestOptions.clientId).computeSelection(options as ComputeSelectionRequestOptions<IModelDb>);\r\n return keys.toJSON();\r\n });\r\n }\r\n}\r\n\r\nconst enforceValidPageSize = <TOptions extends Paged<object>>(\r\n requestOptions: TOptions,\r\n maxPageSize = MAX_ALLOWED_PAGE_SIZE,\r\n): TOptions & { paging: PageOptions } => {\r\n const validPageSize = getValidPageSize(requestOptions.paging?.size, maxPageSize);\r\n if (!requestOptions.paging || requestOptions.paging.size !== validPageSize) {\r\n return { ...requestOptions, paging: { ...requestOptions.paging, size: validPageSize } };\r\n }\r\n return requestOptions as TOptions & { paging: PageOptions };\r\n};\r\n\r\nconst getValidPageSize = (size: number | undefined, maxPageSize: number) => {\r\n const requestedSize = size ?? 0;\r\n return requestedSize === 0 || requestedSize > maxPageSize ? maxPageSize : requestedSize;\r\n};\r\n\r\n// eslint-disable-next-line deprecation/deprecation\r\nconst nodeKeyFromJson = (json: NodeKeyJSON | undefined): NodeKey | undefined => {\r\n if (!json) {\r\n return undefined;\r\n }\r\n // eslint-disable-next-line deprecation/deprecation\r\n return NodeKey.fromJSON(json);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"PresentationRpcImpl.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationRpcImpl.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAAyD;AACzD,sDAAuF;AAEvF,oEAmDoC;AACpC,mEAA4E;AAC5E,iDAA8C;AAE9C,yDAAsD;AAEtD,iEAAiE;AACjE,MAAM,kBAAkB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC;AAIpE,gBAAgB;AACH,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAC1C,gBAAgB;AACH,QAAA,0BAA0B,GAAG,KAAK,CAAC;AAEhD,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAErC;;;;;GAKG;AACH,MAAa,mBAAoB,SAAQ,8CAAwB;IAK/D,YAAmB,KAAmC;QACpD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,eAAe,GAAG,KAAK,EAAE,cAAc,IAAI,uBAAuB,CAAC;QACxE,IAAI,CAAC,gBAAgB,GAAG,IAAI,mCAAgB,CAAC;YAC3C,6EAA6E;YAC7E,qFAAqF;YACrF,mBAAmB,EAAE,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS;YAE5F,mCAAmC;YACnC,eAAe,EAAE,IAAI;YAErB,cAAc,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM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cAAwB,EACxB,WAAW,GAAG,6BAAqB,EACC,EAAE;IACtC,MAAM,aAAa,GAAG,gBAAgB,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IACjF,IAAI,CAAC,cAAc,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;QAC3E,OAAO,EAAE,GAAG,cAAc,EAAE,MAAM,EAAE,EAAE,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC;IAC1F,CAAC;IACD,OAAO,cAAoD,CAAC;AAC9D,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,IAAwB,EAAE,WAAmB,EAAE,EAAE;IACzE,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC,CAAC;IAChC,OAAO,aAAa,KAAK,CAAC,IAAI,aAAa,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC;AAC1F,CAAC,CAAC;AAEF,4DAA4D;AAC5D,MAAM,eAAe,GAAG,CAAC,IAA6B,EAAuB,EAAE;IAC7E,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,4DAA4D;IAC5D,OAAO,6BAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RPC\r\n */\r\n\r\nimport { IModelDb, RpcTrace } from \"@itwin/core-backend\";\r\nimport { assert, BeEvent, Id64String, IDisposable, Logger } from \"@itwin/core-bentley\";\r\nimport { IModelRpcProps } from \"@itwin/core-common\";\r\nimport {\r\n buildElementProperties,\r\n ClientDiagnostics,\r\n ComputeSelectionRequestOptions,\r\n ComputeSelectionRpcRequestOptions,\r\n ContentDescriptorRpcRequestOptions,\r\n ContentFlags,\r\n ContentInstanceKeysRpcRequestOptions,\r\n ContentRpcRequestOptions,\r\n ContentSourcesRpcRequestOptions,\r\n ContentSourcesRpcResult,\r\n DefaultContentDisplayTypes,\r\n DescriptorJSON,\r\n Diagnostics,\r\n DisplayLabelRpcRequestOptions,\r\n DisplayLabelsRpcRequestOptions,\r\n DisplayValueGroup,\r\n DisplayValueGroupJSON,\r\n DistinctValuesRpcRequestOptions,\r\n ElementProperties,\r\n FilterByInstancePathsHierarchyRpcRequestOptions,\r\n FilterByTextHierarchyRpcRequestOptions,\r\n HierarchyLevelDescriptorRpcRequestOptions,\r\n HierarchyLevelJSON,\r\n HierarchyRpcRequestOptions,\r\n isComputeSelectionRequestOptions,\r\n ItemJSON,\r\n KeySet,\r\n KeySetJSON,\r\n LabelDefinition,\r\n NodeJSON,\r\n NodeKey,\r\n NodeKeyJSON,\r\n NodePathElement,\r\n NodePathElementJSON,\r\n Paged,\r\n PagedResponse,\r\n PageOptions,\r\n PresentationError,\r\n PresentationRpcInterface,\r\n PresentationRpcResponse,\r\n PresentationRpcResponseData,\r\n PresentationStatus,\r\n RpcDiagnosticsOptions,\r\n Ruleset,\r\n RulesetVariable,\r\n RulesetVariableJSON,\r\n SelectClassInfo,\r\n SelectionScope,\r\n SelectionScopeRpcRequestOptions,\r\n SingleElementPropertiesRpcRequestOptions,\r\n} from \"@itwin/presentation-common\";\r\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { Presentation } from \"./Presentation\";\r\nimport { PresentationManager } from \"./PresentationManager\";\r\nimport { TemporaryStorage } from \"./TemporaryStorage\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-require-imports\r\nconst packageJsonVersion = require(\"../../../package.json\").version;\r\n\r\ntype ContentGetter<TResult = any, TOptions = any> = (requestOptions: TOptions) => TResult;\r\n\r\n/** @internal */\r\nexport const MAX_ALLOWED_PAGE_SIZE = 1000;\r\n/** @internal */\r\nexport const MAX_ALLOWED_KEYS_PAGE_SIZE = 10000;\r\n\r\nconst DEFAULT_REQUEST_TIMEOUT = 5000;\r\n\r\n/**\r\n * The backend implementation of PresentationRpcInterface. All it's basically\r\n * responsible for is forwarding calls to [[Presentation.manager]].\r\n *\r\n * @internal\r\n */\r\nexport class PresentationRpcImpl extends PresentationRpcInterface implements IDisposable {\r\n private _requestTimeout: number;\r\n private _pendingRequests: TemporaryStorage<PresentationRpcResponse<any>>;\r\n private _cancelEvents: Map<string, BeEvent<() => void>>;\r\n\r\n public constructor(props?: { requestTimeout?: number }) {\r\n super();\r\n this._requestTimeout = props?.requestTimeout ?? DEFAULT_REQUEST_TIMEOUT;\r\n this._pendingRequests = new TemporaryStorage({\r\n // remove the pending request after request timeout + 10 seconds - this gives\r\n // frontend 10 seconds to re-send the request until it's removed from requests' cache\r\n unusedValueLifetime: this._requestTimeout > 0 ? this._requestTimeout + 10 * 1000 : undefined,\r\n\r\n // attempt to clean up every second\r\n cleanupInterval: 1000,\r\n\r\n cleanupHandler: (id, _, reason) => {\r\n if (reason !== \"request\") {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Cleaning up request without frontend retrieving it: ${id}.`);\r\n // istanbul ignore next\r\n this._cancelEvents.get(id)?.raiseEvent();\r\n }\r\n this._cancelEvents.delete(id);\r\n },\r\n });\r\n this._cancelEvents = new Map<string, BeEvent<() => void>>();\r\n }\r\n\r\n public dispose() {\r\n this._pendingRequests.dispose();\r\n }\r\n\r\n public get requestTimeout() {\r\n return this._requestTimeout;\r\n }\r\n\r\n public get pendingRequests() {\r\n return this._pendingRequests;\r\n }\r\n\r\n /** Returns an ok response with result inside */\r\n private successResponse<TResult>(result: TResult, diagnostics?: ClientDiagnostics) {\r\n return {\r\n statusCode: PresentationStatus.Success,\r\n result,\r\n diagnostics,\r\n };\r\n }\r\n\r\n /** Returns a bad request response with empty result and an error code */\r\n private errorResponse(errorCode: PresentationStatus, errorMessage?: string, diagnostics?: ClientDiagnostics) {\r\n return {\r\n statusCode: errorCode,\r\n result: undefined,\r\n errorMessage,\r\n diagnostics,\r\n };\r\n }\r\n\r\n /**\r\n * Get the [[PresentationManager]] used by this RPC impl.\r\n */\r\n public getManager(clientId?: string): PresentationManager {\r\n return Presentation.getManager(clientId);\r\n }\r\n\r\n private async getIModel(token: IModelRpcProps): Promise<IModelDb> {\r\n let imodel: IModelDb;\r\n try {\r\n imodel = IModelDb.findByKey(token.key);\r\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.\r\n await imodel.refreshContainerForRpc(RpcTrace.expectCurrentActivity.accessToken);\r\n } catch {\r\n throw new PresentationError(PresentationStatus.InvalidArgument, \"IModelRpcProps doesn't point to a valid iModel\");\r\n }\r\n return imodel;\r\n }\r\n\r\n private async makeRequest<\r\n TRpcOptions extends { rulesetOrId?: Ruleset | string; clientId?: string; diagnostics?: RpcDiagnosticsOptions; rulesetVariables?: RulesetVariableJSON[] },\r\n TResult,\r\n >(token: IModelRpcProps, requestId: string, requestOptions: TRpcOptions, request: ContentGetter<Promise<TResult>>): PresentationRpcResponse<TResult> {\r\n const requestKey = JSON.stringify({ iModelKey: token.key, requestId, requestOptions });\r\n\r\n Logger.logInfo(PresentationBackendLoggerCategory.Rpc, `Received '${requestId}' request. Params: ${requestKey}`);\r\n\r\n let imodel: IModelDb;\r\n try {\r\n imodel = await this.getIModel(token);\r\n } catch (e) {\r\n assert(e instanceof Error);\r\n return this.errorResponse(PresentationStatus.InvalidArgument, e.message);\r\n }\r\n\r\n let resultPromise = this._pendingRequests.getValue(requestKey);\r\n if (resultPromise) {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request already pending`);\r\n } else {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request not found, creating a new one`);\r\n const { clientId: _, diagnostics: diagnosticsOptions, rulesetVariables, ...options } = requestOptions;\r\n const managerRequestOptions: any = {\r\n ...options,\r\n imodel,\r\n cancelEvent: new BeEvent<() => void>(),\r\n };\r\n\r\n // set up ruleset variables\r\n if (rulesetVariables) {\r\n managerRequestOptions.rulesetVariables = rulesetVariables.map(RulesetVariable.fromJSON);\r\n }\r\n\r\n // set up diagnostics listener\r\n let diagnostics: ClientDiagnostics | undefined;\r\n const getDiagnostics = (): ClientDiagnostics => {\r\n if (!diagnostics) {\r\n diagnostics = {};\r\n }\r\n return diagnostics;\r\n };\r\n if (diagnosticsOptions) {\r\n if (diagnosticsOptions.backendVersion) {\r\n getDiagnostics().backendVersion = packageJsonVersion;\r\n }\r\n managerRequestOptions.diagnostics = {\r\n ...diagnosticsOptions,\r\n handler: (d: Diagnostics) => {\r\n if (d.logs) {\r\n const target = getDiagnostics();\r\n if (target.logs) {\r\n target.logs.push(...d.logs);\r\n } else {\r\n target.logs = [...d.logs];\r\n }\r\n }\r\n },\r\n };\r\n }\r\n\r\n // initiate request\r\n resultPromise = request(managerRequestOptions)\r\n .then((result) => this.successResponse(result, diagnostics))\r\n .catch((e: PresentationError) => this.errorResponse(e.errorNumber, e.message, diagnostics));\r\n\r\n // store the request promise\r\n this._pendingRequests.addValue(requestKey, resultPromise);\r\n this._cancelEvents.set(requestKey, managerRequestOptions.cancelEvent);\r\n }\r\n\r\n if (this._requestTimeout === 0) {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request timeout not configured, returning promise without a timeout.`);\r\n void resultPromise.finally(() => {\r\n this._pendingRequests.deleteValue(requestKey);\r\n });\r\n return resultPromise;\r\n }\r\n\r\n let timeout: NodeJS.Timeout;\r\n const timeoutPromise = new Promise<any>((_resolve, reject) => {\r\n timeout = setTimeout(() => {\r\n reject(new Error());\r\n }, this._requestTimeout);\r\n });\r\n\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Returning a promise with a timeout of ${this._requestTimeout}.`);\r\n return Promise.race([resultPromise, timeoutPromise])\r\n .catch<PresentationRpcResponseData>(() => {\r\n // note: error responses from the manager get handled when creating `resultPromise`, so we can only get here due\r\n // to a timeout exception\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request timeout, returning \"BackendTimeout\" status.`);\r\n return this.errorResponse(PresentationStatus.BackendTimeout);\r\n })\r\n .then((response: PresentationRpcResponseData<TResult>) => {\r\n if (response.statusCode !== PresentationStatus.BackendTimeout) {\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request completed, returning result.`);\r\n this._pendingRequests.deleteValue(requestKey);\r\n }\r\n clearTimeout(timeout);\r\n return response;\r\n });\r\n }\r\n\r\n public override async getNodesCount(token: IModelRpcProps, requestOptions: HierarchyRpcRequestOptions): PresentationRpcResponse<number> {\r\n return this.makeRequest(token, \"getNodesCount\", requestOptions, async (options) => {\r\n options = {\r\n ...options,\r\n parentKey: nodeKeyFromJson(options.parentKey),\r\n };\r\n return this.getManager(requestOptions.clientId).getNodesCount(options);\r\n });\r\n }\r\n\r\n public override async getPagedNodes(\r\n token: IModelRpcProps,\r\n requestOptions: Paged<HierarchyRpcRequestOptions>,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n ): PresentationRpcResponse<PagedResponse<NodeJSON>> {\r\n return this.makeRequest(token, \"getPagedNodes\", requestOptions, async (options) => {\r\n options = enforceValidPageSize({\r\n ...options,\r\n parentKey: nodeKeyFromJson(options.parentKey),\r\n });\r\n const [serializedNodesJson, count] = await Promise.all([\r\n this.getManager(requestOptions.clientId).getDetail().getNodes(options),\r\n this.getManager(requestOptions.clientId).getNodesCount(options),\r\n ]);\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const nodesJson = JSON.parse(serializedNodesJson) as HierarchyLevelJSON;\r\n return {\r\n total: count,\r\n items: nodesJson.nodes,\r\n };\r\n });\r\n }\r\n\r\n public override async getNodesDescriptor(\r\n token: IModelRpcProps,\r\n requestOptions: HierarchyLevelDescriptorRpcRequestOptions,\r\n ): PresentationRpcResponse<string | DescriptorJSON | undefined> {\r\n return this.makeRequest(token, \"getNodesDescriptor\", requestOptions, async (options) => {\r\n options = {\r\n ...options,\r\n parentKey: nodeKeyFromJson(options.parentKey),\r\n };\r\n return this.getManager(requestOptions.clientId).getDetail().getNodesDescriptor(options);\r\n });\r\n }\r\n\r\n public override async getNodePaths(\r\n token: IModelRpcProps,\r\n requestOptions: FilterByInstancePathsHierarchyRpcRequestOptions,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n ): PresentationRpcResponse<NodePathElementJSON[]> {\r\n return this.makeRequest(token, \"getNodePaths\", requestOptions, async (options) => {\r\n const result = await this.getManager(requestOptions.clientId).getDetail().getNodePaths(options);\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return result.map(NodePathElement.toJSON);\r\n });\r\n }\r\n\r\n public override async getFilteredNodePaths(\r\n token: IModelRpcProps,\r\n requestOptions: FilterByTextHierarchyRpcRequestOptions,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n ): PresentationRpcResponse<NodePathElementJSON[]> {\r\n return this.makeRequest(token, \"getFilteredNodePaths\", requestOptions, async (options) => {\r\n const result = await this.getManager(requestOptions.clientId).getDetail().getFilteredNodePaths(options);\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return result.map(NodePathElement.toJSON);\r\n });\r\n }\r\n\r\n public override async getContentSources(\r\n token: IModelRpcProps,\r\n requestOptions: ContentSourcesRpcRequestOptions,\r\n ): PresentationRpcResponse<ContentSourcesRpcResult> {\r\n return this.makeRequest(token, \"getContentSources\", requestOptions, async (options) => {\r\n const result = await this.getManager(requestOptions.clientId).getContentSources(options);\r\n const classesMap = {};\r\n const selectClasses = result.map((sci) => SelectClassInfo.toCompressedJSON(sci, classesMap));\r\n return { sources: selectClasses, classesMap };\r\n });\r\n }\r\n\r\n public override async getContentDescriptor(\r\n token: IModelRpcProps,\r\n requestOptions: ContentDescriptorRpcRequestOptions,\r\n ): PresentationRpcResponse<DescriptorJSON | undefined> {\r\n return this.makeRequest(token, \"getContentDescriptor\", requestOptions, async (options) => {\r\n options = {\r\n ...options,\r\n contentFlags: (options.contentFlags ?? 0) | ContentFlags.DescriptorOnly, // always append the \"descriptor only\" flag when handling request from the frontend\r\n keys: KeySet.fromJSON(options.keys),\r\n };\r\n if (options.transport === \"unparsed-json\") {\r\n // Here we send a plain JSON string but we will parse it to DescriptorJSON on the frontend. This way we are\r\n // bypassing unnecessary deserialization and serialization.\r\n return Presentation.getManager(requestOptions.clientId).getDetail().getContentDescriptor(options) as unknown as DescriptorJSON | undefined;\r\n } else {\r\n // Support for older frontends that still expect a parsed descriptor\r\n const descriptor = await Presentation.getManager(requestOptions.clientId).getContentDescriptor(options);\r\n return descriptor?.toJSON();\r\n }\r\n });\r\n }\r\n\r\n public override async getContentSetSize(token: IModelRpcProps, requestOptions: ContentRpcRequestOptions): PresentationRpcResponse<number> {\r\n return this.makeRequest(token, \"getContentSetSize\", requestOptions, async (options) => {\r\n options = {\r\n ...options,\r\n keys: KeySet.fromJSON(options.keys),\r\n };\r\n return this.getManager(requestOptions.clientId).getContentSetSize(options);\r\n });\r\n }\r\n\r\n public override async getPagedContent(\r\n token: IModelRpcProps,\r\n requestOptions: Paged<ContentRpcRequestOptions>,\r\n ): PresentationRpcResponse<{ descriptor: DescriptorJSON; contentSet: PagedResponse<ItemJSON> } | undefined> {\r\n return this.makeRequest(token, \"getPagedContent\", requestOptions, async (options) => {\r\n options = enforceValidPageSize({\r\n ...options,\r\n keys: KeySet.fromJSON(options.keys),\r\n });\r\n\r\n const [size, content] = await Promise.all([\r\n this.getManager(requestOptions.clientId).getContentSetSize(options),\r\n this.getManager(requestOptions.clientId).getDetail().getContent(options),\r\n ]);\r\n\r\n if (!content) {\r\n return undefined;\r\n }\r\n\r\n return {\r\n descriptor: content.descriptor.toJSON(),\r\n contentSet: {\r\n total: size,\r\n items: content.contentSet.map((i) => i.toJSON()),\r\n },\r\n };\r\n });\r\n }\r\n\r\n public override async getPagedContentSet(\r\n token: IModelRpcProps,\r\n requestOptions: Paged<ContentRpcRequestOptions>,\r\n ): PresentationRpcResponse<PagedResponse<ItemJSON>> {\r\n const response = await this.getPagedContent(token, requestOptions);\r\n if (response.statusCode !== PresentationStatus.Success) {\r\n return this.errorResponse(response.statusCode, response.errorMessage, response.diagnostics);\r\n }\r\n if (!response.result) {\r\n return this.errorResponse(PresentationStatus.Error, `Failed to get content set (received a success response with empty result)`, response.diagnostics);\r\n }\r\n return {\r\n ...response,\r\n result: response.result.contentSet,\r\n };\r\n }\r\n\r\n public override async getElementProperties(\r\n token: IModelRpcProps,\r\n requestOptions: SingleElementPropertiesRpcRequestOptions,\r\n ): PresentationRpcResponse<ElementProperties | undefined> {\r\n return this.makeRequest(token, \"getElementProperties\", { ...requestOptions }, async (options) => {\r\n const manager = this.getManager(requestOptions.clientId);\r\n const { elementId, ...optionsNoElementId } = options;\r\n const content = await manager.getDetail().getContent({\r\n ...optionsNoElementId,\r\n descriptor: {\r\n displayType: DefaultContentDisplayTypes.PropertyPane,\r\n contentFlags: ContentFlags.ShowLabels,\r\n },\r\n rulesetOrId: \"ElementProperties\",\r\n keys: new KeySet([{ className: \"BisCore:Element\", id: elementId }]),\r\n });\r\n if (!content || content.contentSet.length === 0) {\r\n return undefined;\r\n }\r\n return buildElementProperties(content.descriptor, content.contentSet[0]);\r\n });\r\n }\r\n\r\n public override async getPagedDistinctValues(\r\n token: IModelRpcProps,\r\n requestOptions: DistinctValuesRpcRequestOptions,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n ): PresentationRpcResponse<PagedResponse<DisplayValueGroupJSON>> {\r\n return this.makeRequest(token, \"getPagedDistinctValues\", requestOptions, async (options) => {\r\n options = enforceValidPageSize({\r\n ...options,\r\n keys: KeySet.fromJSON(options.keys),\r\n });\r\n const response = await this.getManager(requestOptions.clientId).getDetail().getPagedDistinctValues(options);\r\n return {\r\n ...response,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n items: response.items.map(DisplayValueGroup.toJSON),\r\n };\r\n });\r\n }\r\n\r\n public override async getContentInstanceKeys(\r\n token: IModelRpcProps,\r\n requestOptions: ContentInstanceKeysRpcRequestOptions,\r\n ): PresentationRpcResponse<{ total: number; items: KeySetJSON }> {\r\n return this.makeRequest(token, \"getContentInstanceKeys\", requestOptions, async (options) => {\r\n const { displayType, ...optionsNoDisplayType } = options;\r\n options = enforceValidPageSize(\r\n {\r\n ...optionsNoDisplayType,\r\n keys: KeySet.fromJSON(optionsNoDisplayType.keys),\r\n descriptor: {\r\n displayType,\r\n contentFlags: ContentFlags.KeysOnly,\r\n },\r\n },\r\n MAX_ALLOWED_KEYS_PAGE_SIZE,\r\n );\r\n\r\n const [size, content] = await Promise.all([\r\n this.getManager(requestOptions.clientId).getContentSetSize(options),\r\n this.getManager(requestOptions.clientId).getDetail().getContent(options),\r\n ]);\r\n\r\n if (size === 0 || !content) {\r\n return { total: 0, items: new KeySet().toJSON() };\r\n }\r\n\r\n return {\r\n total: size,\r\n items: content.contentSet.reduce((keys, item) => keys.add(item.primaryKeys), new KeySet()).toJSON(),\r\n };\r\n });\r\n }\r\n\r\n public override async getDisplayLabelDefinition(\r\n token: IModelRpcProps,\r\n requestOptions: DisplayLabelRpcRequestOptions,\r\n ): PresentationRpcResponse<LabelDefinition> {\r\n return this.makeRequest(token, \"getDisplayLabelDefinition\", requestOptions, async (options) => {\r\n const label = await this.getManager(requestOptions.clientId).getDetail().getDisplayLabelDefinition(options);\r\n return label;\r\n });\r\n }\r\n\r\n public override async getPagedDisplayLabelDefinitions(\r\n token: IModelRpcProps,\r\n requestOptions: DisplayLabelsRpcRequestOptions,\r\n ): PresentationRpcResponse<PagedResponse<LabelDefinition>> {\r\n const pageOpts = enforceValidPageSize({ paging: { start: 0, size: requestOptions.keys.length } });\r\n if (pageOpts.paging.size < requestOptions.keys.length) {\r\n requestOptions.keys.splice(pageOpts.paging.size);\r\n }\r\n return this.makeRequest(token, \"getPagedDisplayLabelDefinitions\", requestOptions, async (options) => {\r\n const labels = await this.getManager(requestOptions.clientId)\r\n .getDetail()\r\n .getDisplayLabelDefinitions({ ...options, keys: options.keys });\r\n return {\r\n total: options.keys.length,\r\n items: labels,\r\n };\r\n });\r\n }\r\n\r\n public override async getSelectionScopes(token: IModelRpcProps, requestOptions: SelectionScopeRpcRequestOptions): PresentationRpcResponse<SelectionScope[]> {\r\n return this.makeRequest(token, \"getSelectionScopes\", requestOptions, async (options) =>\r\n this.getManager(requestOptions.clientId).getSelectionScopes(options),\r\n );\r\n }\r\n\r\n public override async computeSelection(\r\n token: IModelRpcProps,\r\n requestOptions: ComputeSelectionRpcRequestOptions | SelectionScopeRpcRequestOptions,\r\n ids?: Id64String[],\r\n scopeId?: string,\r\n ): PresentationRpcResponse<KeySetJSON> {\r\n return this.makeRequest(token, \"computeSelection\", requestOptions, async (options) => {\r\n if (!isComputeSelectionRequestOptions(options)) {\r\n options = {\r\n ...options,\r\n elementIds: ids!,\r\n scope: { id: scopeId! },\r\n };\r\n }\r\n const keys = await this.getManager(requestOptions.clientId).computeSelection(options as ComputeSelectionRequestOptions<IModelDb>);\r\n return keys.toJSON();\r\n });\r\n }\r\n}\r\n\r\nconst enforceValidPageSize = <TOptions extends Paged<object>>(\r\n requestOptions: TOptions,\r\n maxPageSize = MAX_ALLOWED_PAGE_SIZE,\r\n): TOptions & { paging: PageOptions } => {\r\n const validPageSize = getValidPageSize(requestOptions.paging?.size, maxPageSize);\r\n if (!requestOptions.paging || requestOptions.paging.size !== validPageSize) {\r\n return { ...requestOptions, paging: { ...requestOptions.paging, size: validPageSize } };\r\n }\r\n return requestOptions as TOptions & { paging: PageOptions };\r\n};\r\n\r\nconst getValidPageSize = (size: number | undefined, maxPageSize: number) => {\r\n const requestedSize = size ?? 0;\r\n return requestedSize === 0 || requestedSize > maxPageSize ? maxPageSize : requestedSize;\r\n};\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-deprecated\r\nconst nodeKeyFromJson = (json: NodeKeyJSON | undefined): NodeKey | undefined => {\r\n if (!json) {\r\n return undefined;\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return NodeKey.fromJSON(json);\r\n};\r\n"]}
|
|
@@ -16,7 +16,7 @@ const semver_1 = require("semver");
|
|
|
16
16
|
const core_backend_1 = require("@itwin/core-backend");
|
|
17
17
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
18
18
|
const presentation_common_1 = require("@itwin/presentation-common");
|
|
19
|
-
const presentation = require("@itwin/presentation-common/lib/cjs/assets/locales/en/Presentation.json"); // eslint-disable-line @typescript-eslint/no-
|
|
19
|
+
const presentation = require("@itwin/presentation-common/lib/cjs/assets/locales/en/Presentation.json"); // eslint-disable-line @typescript-eslint/no-require-imports
|
|
20
20
|
/** @internal */
|
|
21
21
|
function getLocalizedStringEN(key) {
|
|
22
22
|
let result = presentation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/presentation-backend/Utils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;AAiBH,oDAcC;AAGD,sCAYC;AAGD,4CAQC;AAwCD,8DAuBC;AAGD,8CAGC;AA5HD,mCAA+C;AAC/C,sDAAwD;AACxD,sDAA2D;AAC3D,oEAOoC;AAEpC,MAAM,YAAY,GAAG,OAAO,CAAC,wEAAwE,CAAC,CAAC,CAAC,yDAAyD;AAEjK,gBAAgB;AAChB,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,IAAI,MAAM,GAAG,YAAY,CAAC;IAC1B,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAClD,IAAI,SAAS,KAAK,cAAc,EAAE,CAAC;QACjC,OAAO,GAAG,CAAC;IACb,CAAC;IACD,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC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AQ,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACpH,MAAM,qBAAqB,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAA,kDAA4B,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":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { parse as parseVersion } from \"semver\";\r\nimport { Element, IModelDb } from \"@itwin/core-backend\";\r\nimport { DbResult, Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n combineDiagnosticsSeverities,\r\n compareDiagnosticsSeverities,\r\n Diagnostics,\r\n DiagnosticsLogEntry,\r\n DiagnosticsOptions,\r\n InstanceKey,\r\n} from \"@itwin/presentation-common\";\r\n\r\nconst presentation = require(\"@itwin/presentation-common/lib/cjs/assets/locales/en/Presentation.json\"); // eslint-disable-line @typescript-eslint/no-var-requires\r\n\r\n/** @internal */\r\nexport function getLocalizedStringEN(key: string) {\r\n let result = presentation;\r\n const [namespace, identifier] = key.split(\":\", 2);\r\n if (namespace !== \"Presentation\") {\r\n return key;\r\n }\r\n const keySteps = identifier.split(\".\");\r\n for (const keyStep of keySteps) {\r\n if (keyStep in result === false) {\r\n return key;\r\n }\r\n result = result[keyStep];\r\n }\r\n return typeof result === \"string\" ? result : key;\r\n}\r\n\r\n/** @internal */\r\nexport function getElementKey(imodel: IModelDb, id: Id64String): InstanceKey | undefined {\r\n let key: InstanceKey | undefined;\r\n const query = `SELECT ECClassId FROM ${Element.classFullName} e WHERE ECInstanceId = ?`;\r\n imodel.withPreparedStatement(query, (stmt) => {\r\n try {\r\n stmt.bindId(1, id);\r\n if (stmt.step() === DbResult.BE_SQLITE_ROW) {\r\n key = { className: stmt.getValue(0).getClassNameForClassId().replace(\".\", \":\"), id };\r\n }\r\n } catch {}\r\n });\r\n return key;\r\n}\r\n\r\n/** @internal */\r\nexport function normalizeVersion(version?: string) {\r\n if (version) {\r\n const parsedVersion = parseVersion(version, true);\r\n if (parsedVersion) {\r\n return `${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch}`;\r\n }\r\n }\r\n return \"0.0.0\";\r\n}\r\n\r\n/**\r\n * A function that received request diagnostics and, optionally, request context.\r\n * @public\r\n */\r\nexport type BackendDiagnosticsHandler<TContext = any> = (logs: Diagnostics, requestContext?: TContext) => void;\r\n\r\n/**\r\n * Data structure for backend diagnostics options.\r\n * @public\r\n */\r\nexport interface BackendDiagnosticsOptions<TContext = any> extends DiagnosticsOptions {\r\n /**\r\n * An optional function to supply request context that'll be passed to [[handler]] when\r\n * it's called after the request is fulfilled.\r\n */\r\n requestContextSupplier?: () => TContext;\r\n\r\n /**\r\n * Request diagnostics handler function that is called after the request is fulfilled. The handler\r\n * receives request diagnostics as the first argument and, optionally, request context as the\r\n * second (see [[requestContextSupplier]]).\r\n */\r\n handler: BackendDiagnosticsHandler<TContext>;\r\n}\r\n\r\n/**\r\n * Data structure which contains backend diagnostics options.\r\n * @public\r\n */\r\nexport interface BackendDiagnosticsAttribute {\r\n /**\r\n * Backend diagnostics options.\r\n * @public\r\n */\r\n diagnostics?: BackendDiagnosticsOptions;\r\n}\r\n\r\n/** @internal */\r\nexport function combineDiagnosticsOptions(...options: Array<BackendDiagnosticsOptions | undefined>): DiagnosticsOptions | undefined {\r\n const combinedOptions: DiagnosticsOptions = {};\r\n options.forEach((d) => {\r\n if (!d) {\r\n return;\r\n }\r\n if (\r\n d.perf === true ||\r\n (typeof d.perf === \"object\" &&\r\n (!combinedOptions.perf || (typeof combinedOptions.perf === \"object\" && d.perf.minimumDuration < combinedOptions.perf.minimumDuration)))\r\n ) {\r\n combinedOptions.perf = d.perf;\r\n }\r\n const combinedDev = combineDiagnosticsSeverities(d.dev, combinedOptions.dev);\r\n if (combinedDev) {\r\n combinedOptions.dev = combinedDev;\r\n }\r\n const combinedEditor = combineDiagnosticsSeverities(d.editor, combinedOptions.editor);\r\n if (combinedEditor) {\r\n combinedOptions.editor = combinedEditor;\r\n }\r\n });\r\n return combinedOptions.dev || combinedOptions.editor || combinedOptions.perf ? combinedOptions : undefined;\r\n}\r\n\r\n/** @internal */\r\nexport function reportDiagnostics<TContext>(diagnostics: Diagnostics, options: BackendDiagnosticsOptions<TContext>, context?: TContext) {\r\n const stripped = diagnostics.logs ? stripDiagnostics(options, diagnostics.logs) : undefined;\r\n stripped && options.handler({ logs: stripped }, context);\r\n}\r\nfunction stripDiagnostics<TEntry extends DiagnosticsLogEntry>(options: DiagnosticsOptions, diagnostics: TEntry[]) {\r\n const stripped: TEntry[] = [];\r\n diagnostics.forEach((entry) => {\r\n if (DiagnosticsLogEntry.isScope(entry)) {\r\n const scopeLogs = stripDiagnostics(options, entry.logs ?? []);\r\n const strippedScope = { ...entry, logs: scopeLogs };\r\n if (!strippedScope.logs) {\r\n delete strippedScope.logs;\r\n }\r\n if (entry.duration !== undefined && (options.perf === true || (typeof options.perf === \"object\" && entry.duration >= options.perf.minimumDuration))) {\r\n stripped.push(strippedScope);\r\n } else if (scopeLogs) {\r\n delete strippedScope.duration;\r\n delete strippedScope.scopeCreateTimestamp;\r\n stripped.push(strippedScope);\r\n }\r\n } else {\r\n const matchesDevSeverity = entry.severity.dev && compareDiagnosticsSeverities(entry.severity.dev, options.dev) >= 0;\r\n const matchesEditorSeverity = entry.severity.editor && compareDiagnosticsSeverities(entry.severity.editor, options.editor) >= 0;\r\n if (matchesDevSeverity || matchesEditorSeverity) {\r\n stripped.push({ ...entry });\r\n }\r\n }\r\n });\r\n return stripped.length > 0 ? stripped : undefined;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/presentation-backend/Utils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;AAiBH,oDAcC;AAGD,sCAYC;AAGD,4CAQC;AAwCD,8DAuBC;AAGD,8CAGC;AA5HD,mCAA+C;AAC/C,sDAAwD;AACxD,sDAA2D;AAC3D,oEAOoC;AAEpC,MAAM,YAAY,GAAG,OAAO,CAAC,wEAAwE,CAAC,CAAC,CAAC,4DAA4D;AAEpK,gBAAgB;AAChB,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,IAAI,MAAM,GAAG,YAAY,CAAC;IAC1B,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAClD,IAAI,SAAS,KAAK,cAAc,EAAE,CAAC;QACjC,OAAO,GAAG,CAAC;IACb,CAAC;IACD,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;YAChC,OAAO,GAAG,CAAC;QACb,CAAC;QACD,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;AACnD,CAAC;AAED,gBAAgB;AAChB,SAAgB,aAAa,CAAC,MAAgB,EAAE,EAAc;IAC5D,IAAI,GAA4B,CAAC;IACjC,MAAM,K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C9B,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":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { parse as parseVersion } from \"semver\";\r\nimport { Element, IModelDb } from \"@itwin/core-backend\";\r\nimport { DbResult, Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n combineDiagnosticsSeverities,\r\n compareDiagnosticsSeverities,\r\n Diagnostics,\r\n DiagnosticsLogEntry,\r\n DiagnosticsOptions,\r\n InstanceKey,\r\n} from \"@itwin/presentation-common\";\r\n\r\nconst presentation = require(\"@itwin/presentation-common/lib/cjs/assets/locales/en/Presentation.json\"); // eslint-disable-line @typescript-eslint/no-require-imports\r\n\r\n/** @internal */\r\nexport function getLocalizedStringEN(key: string) {\r\n let result = presentation;\r\n const [namespace, identifier] = key.split(\":\", 2);\r\n if (namespace !== \"Presentation\") {\r\n return key;\r\n }\r\n const keySteps = identifier.split(\".\");\r\n for (const keyStep of keySteps) {\r\n if (keyStep in result === false) {\r\n return key;\r\n }\r\n result = result[keyStep];\r\n }\r\n return typeof result === \"string\" ? result : key;\r\n}\r\n\r\n/** @internal */\r\nexport function getElementKey(imodel: IModelDb, id: Id64String): InstanceKey | undefined {\r\n let key: InstanceKey | undefined;\r\n const query = `SELECT ECClassId FROM ${Element.classFullName} e WHERE ECInstanceId = ?`;\r\n imodel.withPreparedStatement(query, (stmt) => {\r\n try {\r\n stmt.bindId(1, id);\r\n if (stmt.step() === DbResult.BE_SQLITE_ROW) {\r\n key = { className: stmt.getValue(0).getClassNameForClassId().replace(\".\", \":\"), id };\r\n }\r\n } catch {}\r\n });\r\n return key;\r\n}\r\n\r\n/** @internal */\r\nexport function normalizeVersion(version?: string) {\r\n if (version) {\r\n const parsedVersion = parseVersion(version, true);\r\n if (parsedVersion) {\r\n return `${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch}`;\r\n }\r\n }\r\n return \"0.0.0\";\r\n}\r\n\r\n/**\r\n * A function that received request diagnostics and, optionally, request context.\r\n * @public\r\n */\r\nexport type BackendDiagnosticsHandler<TContext = any> = (logs: Diagnostics, requestContext?: TContext) => void;\r\n\r\n/**\r\n * Data structure for backend diagnostics options.\r\n * @public\r\n */\r\nexport interface BackendDiagnosticsOptions<TContext = any> extends DiagnosticsOptions {\r\n /**\r\n * An optional function to supply request context that'll be passed to [[handler]] when\r\n * it's called after the request is fulfilled.\r\n */\r\n requestContextSupplier?: () => TContext;\r\n\r\n /**\r\n * Request diagnostics handler function that is called after the request is fulfilled. The handler\r\n * receives request diagnostics as the first argument and, optionally, request context as the\r\n * second (see [[requestContextSupplier]]).\r\n */\r\n handler: BackendDiagnosticsHandler<TContext>;\r\n}\r\n\r\n/**\r\n * Data structure which contains backend diagnostics options.\r\n * @public\r\n */\r\nexport interface BackendDiagnosticsAttribute {\r\n /**\r\n * Backend diagnostics options.\r\n * @public\r\n */\r\n diagnostics?: BackendDiagnosticsOptions;\r\n}\r\n\r\n/** @internal */\r\nexport function combineDiagnosticsOptions(...options: Array<BackendDiagnosticsOptions | undefined>): DiagnosticsOptions | undefined {\r\n const combinedOptions: DiagnosticsOptions = {};\r\n options.forEach((d) => {\r\n if (!d) {\r\n return;\r\n }\r\n if (\r\n d.perf === true ||\r\n (typeof d.perf === \"object\" &&\r\n (!combinedOptions.perf || (typeof combinedOptions.perf === \"object\" && d.perf.minimumDuration < combinedOptions.perf.minimumDuration)))\r\n ) {\r\n combinedOptions.perf = d.perf;\r\n }\r\n const combinedDev = combineDiagnosticsSeverities(d.dev, combinedOptions.dev);\r\n if (combinedDev) {\r\n combinedOptions.dev = combinedDev;\r\n }\r\n const combinedEditor = combineDiagnosticsSeverities(d.editor, combinedOptions.editor);\r\n if (combinedEditor) {\r\n combinedOptions.editor = combinedEditor;\r\n }\r\n });\r\n return combinedOptions.dev || combinedOptions.editor || combinedOptions.perf ? combinedOptions : undefined;\r\n}\r\n\r\n/** @internal */\r\nexport function reportDiagnostics<TContext>(diagnostics: Diagnostics, options: BackendDiagnosticsOptions<TContext>, context?: TContext) {\r\n const stripped = diagnostics.logs ? stripDiagnostics(options, diagnostics.logs) : undefined;\r\n stripped && options.handler({ logs: stripped }, context);\r\n}\r\nfunction stripDiagnostics<TEntry extends DiagnosticsLogEntry>(options: DiagnosticsOptions, diagnostics: TEntry[]) {\r\n const stripped: TEntry[] = [];\r\n diagnostics.forEach((entry) => {\r\n if (DiagnosticsLogEntry.isScope(entry)) {\r\n const scopeLogs = stripDiagnostics(options, entry.logs ?? []);\r\n const strippedScope = { ...entry, logs: scopeLogs };\r\n if (!strippedScope.logs) {\r\n delete strippedScope.logs;\r\n }\r\n if (entry.duration !== undefined && (options.perf === true || (typeof options.perf === \"object\" && entry.duration >= options.perf.minimumDuration))) {\r\n stripped.push(strippedScope);\r\n } else if (scopeLogs) {\r\n delete strippedScope.duration;\r\n delete strippedScope.scopeCreateTimestamp;\r\n stripped.push(strippedScope);\r\n }\r\n } else {\r\n const matchesDevSeverity = entry.severity.dev && compareDiagnosticsSeverities(entry.severity.dev, options.dev) >= 0;\r\n const matchesEditorSeverity = entry.severity.editor && compareDiagnosticsSeverities(entry.severity.editor, options.editor) >= 0;\r\n if (matchesDevSeverity || matchesEditorSeverity) {\r\n stripped.push({ ...entry });\r\n }\r\n }\r\n });\r\n return stripped.length > 0 ? stripped : undefined;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationRulesDomain.d.ts","sourceRoot":"","sources":["../../../../src/presentation-backend/domain/PresentationRulesDomain.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAiB,MAAM,EAAW,MAAM,qBAAqB,CAAC;AAGrE,gBAAgB;AAChB,qBAAa,iBAAkB,SAAQ,MAAM;IAC3C,WAA2B,UAAU,IAAI,MAAM,CAE9C;IAED,uDAAuD;WACzC,cAAc;CAM7B;AAED,gBAAgB;AAEhB,yBAAiB,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"PresentationRulesDomain.d.ts","sourceRoot":"","sources":["../../../../src/presentation-backend/domain/PresentationRulesDomain.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAiB,MAAM,EAAW,MAAM,qBAAqB,CAAC;AAGrE,gBAAgB;AAChB,qBAAa,iBAAkB,SAAQ,MAAM;IAC3C,WAA2B,UAAU,IAAI,MAAM,CAE9C;IAED,uDAAuD;WACzC,cAAc;CAM7B;AAED,gBAAgB;AAEhB,yBAAiB,iBAAiB,CAAC;IACjC,KAAY,QAAQ;QAClB,OAAO,8BAA8B;KACtC;CACF"}
|
|
@@ -50,7 +50,6 @@ exports.PresentationRules = PresentationRules;
|
|
|
50
50
|
/** @internal */
|
|
51
51
|
/* istanbul ignore next */
|
|
52
52
|
(function (PresentationRules) {
|
|
53
|
-
// eslint-disable-line no-redeclare
|
|
54
53
|
let CodeSpec;
|
|
55
54
|
(function (CodeSpec) {
|
|
56
55
|
CodeSpec["Ruleset"] = "PresentationRules:Ruleset";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationRulesDomain.js","sourceRoot":"","sources":["../../../../src/presentation-backend/domain/PresentationRulesDomain.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sDAAqE;AACrE,mEAAqD;AAErD,gBAAgB;AAChB,MAAa,iBAAkB,SAAQ,qBAAM;IACpC,MAAM,KAAc,UAAU;QACnC,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED,uDAAuD;IAChD,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,sBAAO,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;YACvE,sBAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;YAC1C,4BAAa,CAAC,cAAc,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;CACF;AAZD,8CAYC;AAED,gBAAgB;AAChB,0BAA0B;AAC1B,WAAiB,iBAAiB;IAChC,
|
|
1
|
+
{"version":3,"file":"PresentationRulesDomain.js","sourceRoot":"","sources":["../../../../src/presentation-backend/domain/PresentationRulesDomain.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sDAAqE;AACrE,mEAAqD;AAErD,gBAAgB;AAChB,MAAa,iBAAkB,SAAQ,qBAAM;IACpC,MAAM,KAAc,UAAU;QACnC,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED,uDAAuD;IAChD,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,sBAAO,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;YACvE,sBAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;YAC1C,4BAAa,CAAC,cAAc,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;CACF;AAZD,8CAYC;AAED,gBAAgB;AAChB,0BAA0B;AAC1B,WAAiB,iBAAiB;IAChC,IAAY,QAEX;IAFD,WAAY,QAAQ;QAClB,iDAAqC,CAAA;IACvC,CAAC,EAFW,QAAQ,GAAR,0BAAQ,KAAR,0BAAQ,QAEnB;AACH,CAAC,EAJgB,iBAAiB,iCAAjB,iBAAiB,QAIjC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { ClassRegistry, Schema, Schemas } from \"@itwin/core-backend\";\r\nimport * as RulesetElements from \"./RulesetElements\";\r\n\r\n/** @internal */\r\nexport class PresentationRules extends Schema {\r\n public static override get schemaName(): string {\r\n return \"PresentationRules\";\r\n }\r\n\r\n /** Registers this schema and it's elements' classes */\r\n public static registerSchema() {\r\n if (this !== Schemas.getRegisteredSchema(PresentationRules.schemaName)) {\r\n Schemas.registerSchema(PresentationRules);\r\n ClassRegistry.registerModule(RulesetElements, this);\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\n/* istanbul ignore next */\r\nexport namespace PresentationRules {\r\n export enum CodeSpec {\r\n Ruleset = \"PresentationRules:Ruleset\",\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/presentation-backend",
|
|
3
|
-
"version": "4.10.0-dev.
|
|
3
|
+
"version": "4.10.0-dev.34",
|
|
4
4
|
"description": "Backend of iTwin.js Presentation library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"main": "lib/cjs/presentation-backend.js",
|
|
24
24
|
"typings": "lib/cjs/presentation-backend",
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@itwin/core-backend": "^4.10.0-dev.
|
|
27
|
-
"@itwin/core-bentley": "^4.10.0-dev.
|
|
28
|
-
"@itwin/core-common": "^4.10.0-dev.
|
|
29
|
-
"@itwin/core-quantity": "^4.10.0-dev.
|
|
30
|
-
"@itwin/ecschema-metadata": "^4.10.0-dev.
|
|
31
|
-
"@itwin/presentation-common": "^4.10.0-dev.
|
|
26
|
+
"@itwin/core-backend": "^4.10.0-dev.34",
|
|
27
|
+
"@itwin/core-bentley": "^4.10.0-dev.34",
|
|
28
|
+
"@itwin/core-common": "^4.10.0-dev.34",
|
|
29
|
+
"@itwin/core-quantity": "^4.10.0-dev.34",
|
|
30
|
+
"@itwin/ecschema-metadata": "^4.10.0-dev.34",
|
|
31
|
+
"@itwin/presentation-common": "^4.10.0-dev.34"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@itwin/eslint-plugin": "
|
|
34
|
+
"@itwin/eslint-plugin": "5.0.0-dev.1",
|
|
35
35
|
"@sinonjs/fake-timers": "^11.2.2",
|
|
36
36
|
"@types/chai": "4.3.1",
|
|
37
37
|
"@types/chai-as-promised": "^7",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"cpx2": "^3.0.0",
|
|
55
55
|
"cross-env": "^5.1.4",
|
|
56
56
|
"deep-equal": "^1",
|
|
57
|
-
"eslint": "^
|
|
57
|
+
"eslint": "^9.13.0",
|
|
58
58
|
"eslint-config-prettier": "^9.1.0",
|
|
59
59
|
"faker": "^4.1.0",
|
|
60
60
|
"mocha": "^10.2.0",
|
|
@@ -66,13 +66,13 @@
|
|
|
66
66
|
"source-map-support": "^0.5.6",
|
|
67
67
|
"typemoq": "^2.1.0",
|
|
68
68
|
"typescript": "~5.6.2",
|
|
69
|
-
"@itwin/core-bentley": "4.10.0-dev.
|
|
70
|
-
"@itwin/
|
|
71
|
-
"@itwin/
|
|
72
|
-
"@itwin/core-
|
|
73
|
-
"@itwin/
|
|
74
|
-
"@itwin/
|
|
75
|
-
"@itwin/
|
|
69
|
+
"@itwin/core-bentley": "4.10.0-dev.34",
|
|
70
|
+
"@itwin/build-tools": "4.10.0-dev.34",
|
|
71
|
+
"@itwin/ecschema-metadata": "4.10.0-dev.34",
|
|
72
|
+
"@itwin/core-backend": "4.10.0-dev.34",
|
|
73
|
+
"@itwin/core-common": "4.10.0-dev.34",
|
|
74
|
+
"@itwin/core-quantity": "4.10.0-dev.34",
|
|
75
|
+
"@itwin/presentation-common": "4.10.0-dev.34"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"object-hash": "^1.3.1",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"docs:reference": "betools docs --includes=../../generated-docs/extract --json=../../generated-docs/presentation/presentation-backend/file.json --tsIndexFile=presentation-backend.ts --onlyJson",
|
|
95
95
|
"extract": "betools extract --fileExt=ts --extractFrom=./src/test --recursive --out=../../generated-docs/extract",
|
|
96
96
|
"extract-api": "betools extract-api --entry=presentation-backend",
|
|
97
|
-
"lint": "eslint
|
|
97
|
+
"lint": "eslint \"./src/**/*.ts\" 1>&2",
|
|
98
98
|
"test": "mocha --config ../.mocharc.json --file ./lib/cjs/test/index.test.js \"./lib/cjs/test/**/*.test.js\"",
|
|
99
99
|
"test:watch": "npm -s test -- --reporter min --watch-extensions ts --watch",
|
|
100
100
|
"prettier:fix": "prettier --write ."
|