@itwin/presentation-backend 3.5.0-dev.12 → 3.5.0-dev.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts +2 -0
- package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js +2 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
# Change Log - @itwin/presentation-backend
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 27 Sep 2022 11:50:59 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 3.3.5
|
|
6
|
+
Tue, 27 Sep 2022 11:50:59 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 3.3.4
|
|
11
|
+
Thu, 08 Sep 2022 19:00:05 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
14
|
+
|
|
15
|
+
## 3.3.3
|
|
16
|
+
Tue, 06 Sep 2022 20:54:19 GMT
|
|
17
|
+
|
|
18
|
+
_Version update only_
|
|
4
19
|
|
|
5
20
|
## 3.3.2
|
|
6
21
|
Thu, 01 Sep 2022 14:37:22 GMT
|
|
@@ -5,6 +5,7 @@ import { Id64String, IDisposable } from "@itwin/core-bentley";
|
|
|
5
5
|
import { IModelRpcProps } from "@itwin/core-common";
|
|
6
6
|
import { ComputeSelectionRpcRequestOptions, ContentDescriptorRpcRequestOptions, ContentInstanceKeysRpcRequestOptions, ContentRpcRequestOptions, ContentSourcesRpcRequestOptions, ContentSourcesRpcResult, DescriptorJSON, DisplayLabelRpcRequestOptions, DisplayLabelsRpcRequestOptions, DisplayValueGroupJSON, DistinctValuesRpcRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRpcRequestOptions, FilterByTextHierarchyRpcRequestOptions, HierarchyRpcRequestOptions, ItemJSON, KeySetJSON, LabelDefinitionJSON, NodeJSON, NodePathElementJSON, Paged, PagedResponse, PresentationRpcInterface, PresentationRpcResponse, SelectionScope, SelectionScopeRpcRequestOptions, SingleElementPropertiesRpcRequestOptions } from "@itwin/presentation-common";
|
|
7
7
|
import { PresentationManager } from "./PresentationManager";
|
|
8
|
+
import { TemporaryStorage } from "./TemporaryStorage";
|
|
8
9
|
/** @internal */
|
|
9
10
|
export declare const MAX_ALLOWED_PAGE_SIZE = 1000;
|
|
10
11
|
/** @internal */
|
|
@@ -24,6 +25,7 @@ export declare class PresentationRpcImpl extends PresentationRpcInterface implem
|
|
|
24
25
|
});
|
|
25
26
|
dispose(): void;
|
|
26
27
|
get requestTimeout(): number;
|
|
28
|
+
get pendingRequests(): TemporaryStorage<PresentationRpcResponse<any>>;
|
|
27
29
|
/** Returns an ok response with result inside */
|
|
28
30
|
private successResponse;
|
|
29
31
|
/** Returns a bad request response with empty result and an error code */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationRpcImpl.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationRpcImpl.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAmB,UAAU,EAAE,WAAW,EAAU,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACc,iCAAiC,EAAE,kCAAkC,EAAgB,oCAAoC,EAC5I,wBAAwB,EAAE,+BAA+B,EAAE,uBAAuB,EAAE,cAAc,EAAe,6BAA6B,EAC9I,8BAA8B,EAAqB,qBAAqB,EAAE,+BAA+B,EAAE,iBAAiB,EAC5H,+CAA+C,EAAE,sCAAsC,EAAE,0BAA0B,EACjF,QAAQ,EAAU,UAAU,EAAmB,mBAAmB,EAAQ,QAAQ,EACnG,mBAAmB,EA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;KAAE,GAAG,SAAS,CAAC;IAyBjM,kBAAkB,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,KAAK,CAAC,wBAAwB,CAAC,GAAG,uBAAuB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAK5I,oBAAoB,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,wCAAwC,GAAG,uBAAuB,CAAC,iBAAiB,GAAG,SAAS,CAAC;IAM7J,sBAAsB,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,+BAA+B,GAAG,uBAAuB,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAc7J,sBAAsB,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,oCAAoC,GAAG,uBAAuB,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,CAAC;IA2BlK,yBAAyB,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,6BAA6B,GAAG,uBAAuB,CAAC,mBAAmB,CAAC;IAO7I,+BAA+B,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,8BAA8B,GAAG,uBAAuB,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAanK,kBAAkB,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,+BAA+B,GAAG,uBAAuB,CAAC,cAAc,EAAE,CAAC;IAMrI,gBAAgB,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,iCAAiC,GAAG,+BAA+B,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,uBAAuB,CAAC,UAAU,CAAC;CAa9N"}
|
|
@@ -34,7 +34,7 @@ class PresentationRpcImpl extends presentation_common_1.PresentationRpcInterface
|
|
|
34
34
|
this._pendingRequests = new TemporaryStorage_1.TemporaryStorage({
|
|
35
35
|
// remove the pending request after request timeout + 10 seconds - this gives
|
|
36
36
|
// frontend 10 seconds to re-send the request until it's removed from requests' cache
|
|
37
|
-
unusedValueLifetime: this._requestTimeout + 10 * 1000,
|
|
37
|
+
unusedValueLifetime: (this._requestTimeout > 0) ? (this._requestTimeout + 10 * 1000) : undefined,
|
|
38
38
|
// attempt to clean up every second
|
|
39
39
|
cleanupInterval: 1000,
|
|
40
40
|
cleanupHandler: (id, _, reason) => {
|
|
@@ -53,6 +53,7 @@ class PresentationRpcImpl extends presentation_common_1.PresentationRpcInterface
|
|
|
53
53
|
this._pendingRequests.dispose();
|
|
54
54
|
}
|
|
55
55
|
get requestTimeout() { return this._requestTimeout; }
|
|
56
|
+
get pendingRequests() { return this._pendingRequests; }
|
|
56
57
|
/** Returns an ok response with result inside */
|
|
57
58
|
successResponse(result, diagnostics) {
|
|
58
59
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationRpcImpl.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA+C;AAC/C,sDAAuF;AAEvF,oEASoC;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;;;;;GAKG;AACH,MAAa,mBAAoB,SAAQ,8CAAwB;IAM/D,YAAmB,KAAkC;;QACnD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,eAAe,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,cAAc,mCAAI,EAAE,GAAG,IAAI,CAAC;QAC1D,IAAI,CAAC,gBAAgB,GAAG,IAAI,mCAAgB,CAAC;YAC3C,6EAA6E;YAC7E,qFAAq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,CAAC,CAAC,aAAa,CAAC;AAC5F,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,IAA6B,EAAuB,EAAE;IAC7E,IAAI,CAAC,IAAI;QACP,OAAO,SAAS,CAAC;IACnB,OAAO,6BAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RPC\n */\n\nimport { IModelDb } from \"@itwin/core-backend\";\nimport { assert, BeEvent, Id64String, IDisposable, Logger } from \"@itwin/core-bentley\";\nimport { IModelRpcProps } from \"@itwin/core-common\";\nimport {\n ClientDiagnostics, ComputeSelectionRpcRequestOptions, ContentDescriptorRpcRequestOptions, ContentFlags, ContentInstanceKeysRpcRequestOptions,\n ContentRpcRequestOptions, ContentSourcesRpcRequestOptions, ContentSourcesRpcResult, DescriptorJSON, Diagnostics, DisplayLabelRpcRequestOptions,\n DisplayLabelsRpcRequestOptions, DisplayValueGroup, DisplayValueGroupJSON, DistinctValuesRpcRequestOptions, ElementProperties,\n FilterByInstancePathsHierarchyRpcRequestOptions, FilterByTextHierarchyRpcRequestOptions, HierarchyRpcRequestOptions, InstanceKey,\n isComputeSelectionRequestOptions, ItemJSON, KeySet, KeySetJSON, LabelDefinition, LabelDefinitionJSON, Node, NodeJSON, NodeKey, NodeKeyJSON,\n NodePathElement, NodePathElementJSON, Paged, PagedResponse, PageOptions, PresentationError, PresentationRpcInterface, PresentationRpcResponse,\n PresentationRpcResponseData, PresentationStatus, RpcDiagnosticsOptions, Ruleset, RulesetVariable, RulesetVariableJSON, SelectClassInfo,\n SelectionScope, SelectionScopeRpcRequestOptions, SingleElementPropertiesRpcRequestOptions,\n} from \"@itwin/presentation-common\";\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { Presentation } from \"./Presentation\";\nimport { PresentationManager } from \"./PresentationManager\";\nimport { TemporaryStorage } from \"./TemporaryStorage\";\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst packageJsonVersion = require(\"../../../package.json\").version;\n\ntype ContentGetter<TResult = any, TOptions = any> = (requestOptions: TOptions) => TResult;\n\n/** @internal */\nexport const MAX_ALLOWED_PAGE_SIZE = 1000;\n/** @internal */\nexport const MAX_ALLOWED_KEYS_PAGE_SIZE = 10000;\n\n/**\n * The backend implementation of PresentationRpcInterface. All it's basically\n * responsible for is forwarding calls to [[Presentation.manager]].\n *\n * @internal\n */\nexport class PresentationRpcImpl extends PresentationRpcInterface implements IDisposable {\n\n private _requestTimeout: number;\n private _pendingRequests: TemporaryStorage<PresentationRpcResponse<any>>;\n private _cancelEvents: Map<string, BeEvent<() => void>>;\n\n public constructor(props?: { requestTimeout: number }) {\n super();\n this._requestTimeout = props?.requestTimeout ?? 90 * 1000;\n this._pendingRequests = new TemporaryStorage({\n // remove the pending request after request timeout + 10 seconds - this gives\n // frontend 10 seconds to re-send the request until it's removed from requests' cache\n unusedValueLifetime: this._requestTimeout + 10 * 1000,\n\n // attempt to clean up every second\n cleanupInterval: 1000,\n\n cleanupHandler: (id, _, reason) => {\n if (reason !== \"request\") {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Cleaning up request without frontend retrieving it: ${id}.`);\n // istanbul ignore next\n this._cancelEvents.get(id)?.raiseEvent();\n }\n this._cancelEvents.delete(id);\n },\n });\n this._cancelEvents = new Map<string, BeEvent<() => void>>();\n }\n\n public dispose() {\n this._pendingRequests.dispose();\n }\n\n public get requestTimeout() { return this._requestTimeout; }\n\n /** Returns an ok response with result inside */\n private successResponse<TResult>(result: TResult, diagnostics?: ClientDiagnostics) {\n return {\n statusCode: PresentationStatus.Success,\n result,\n diagnostics,\n };\n }\n\n /** Returns a bad request response with empty result and an error code */\n private errorResponse(errorCode: PresentationStatus, errorMessage?: string, diagnostics?: ClientDiagnostics) {\n return {\n statusCode: errorCode,\n result: undefined,\n errorMessage,\n diagnostics,\n };\n }\n\n /**\n * Get the [[PresentationManager]] used by this RPC impl.\n */\n public getManager(clientId?: string): PresentationManager {\n return Presentation.getManager(clientId);\n }\n\n private getIModel(token: IModelRpcProps): IModelDb {\n let imodel: IModelDb;\n try {\n imodel = IModelDb.findByKey(token.key);\n } catch {\n throw new PresentationError(PresentationStatus.InvalidArgument, \"IModelRpcProps doesn't point to a valid iModel\");\n }\n return imodel;\n }\n\n private async makeRequest<TRpcOptions extends { rulesetOrId?: Ruleset | string, clientId?: string, diagnostics?: RpcDiagnosticsOptions, rulesetVariables?: RulesetVariableJSON[] }, TResult>(token: IModelRpcProps, requestId: string, requestOptions: TRpcOptions, request: ContentGetter<Promise<TResult>>): PresentationRpcResponse<TResult> {\n const requestKey = JSON.stringify({ iModelKey: token.key, requestId, requestOptions });\n\n Logger.logInfo(PresentationBackendLoggerCategory.Rpc, `Received '${requestId}' request. Params: ${requestKey}`);\n\n let resultPromise = this._pendingRequests.getValue(requestKey);\n if (resultPromise) {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request already pending`);\n } else {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request not found, creating a new one`);\n let imodel: IModelDb;\n try {\n imodel = this.getIModel(token);\n } catch (e) {\n assert(e instanceof Error);\n return this.errorResponse(PresentationStatus.InvalidArgument, e.message);\n }\n\n const { clientId: _, diagnostics: diagnosticsOptions, rulesetVariables, ...options } = requestOptions;\n const managerRequestOptions: any = {\n ...options,\n imodel,\n cancelEvent: new BeEvent<() => void>(),\n };\n\n // set up ruleset variables\n if (rulesetVariables)\n managerRequestOptions.rulesetVariables = rulesetVariables.map(RulesetVariable.fromJSON);\n\n // set up diagnostics listener\n let diagnostics: ClientDiagnostics | undefined;\n const getDiagnostics = (): ClientDiagnostics => {\n if (!diagnostics)\n diagnostics = {};\n return diagnostics;\n };\n if (diagnosticsOptions) {\n if (diagnosticsOptions.backendVersion) {\n getDiagnostics().backendVersion = packageJsonVersion;\n }\n managerRequestOptions.diagnostics = {\n ...diagnosticsOptions,\n handler: (d: Diagnostics) => {\n if (d.logs) {\n const target = getDiagnostics();\n if (target.logs)\n target.logs.push(...d.logs);\n else\n target.logs = [...d.logs];\n }\n },\n };\n }\n\n // initiate request\n resultPromise = request(managerRequestOptions)\n .then((result) => this.successResponse(result, diagnostics))\n .catch((e: PresentationError) => this.errorResponse(e.errorNumber, e.message, diagnostics));\n\n // store the request promise\n this._pendingRequests.addValue(requestKey, resultPromise);\n this._cancelEvents.set(requestKey, managerRequestOptions.cancelEvent);\n }\n\n if (this._requestTimeout === 0) {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request timeout not configured, returning promise without a timeout.`);\n resultPromise.finally(() => {\n this._pendingRequests.deleteValue(requestKey);\n });\n return resultPromise;\n }\n\n let timeout: NodeJS.Timeout;\n const timeoutPromise = new Promise<any>((_resolve, reject) => {\n timeout = setTimeout(() => {\n reject(\"Timed out\");\n }, this._requestTimeout);\n });\n\n /* eslint-disable @typescript-eslint/indent */\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Returning a promise with a timeout of ${this._requestTimeout}.`);\n return Promise\n .race([resultPromise, timeoutPromise])\n .catch<PresentationRpcResponseData>(() => {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request timeout, returning \"BackendTimeout\" status.`);\n return this.errorResponse(PresentationStatus.BackendTimeout);\n })\n .then((response: PresentationRpcResponseData<any>) => {\n if (response.statusCode !== PresentationStatus.BackendTimeout) {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request completed, returning result.`);\n this._pendingRequests.deleteValue(requestKey);\n }\n clearTimeout(timeout);\n return response;\n });\n /* eslint-enable @typescript-eslint/indent */\n }\n\n public override async getNodesCount(token: IModelRpcProps, requestOptions: HierarchyRpcRequestOptions): PresentationRpcResponse<number> {\n return this.makeRequest(token, \"getNodesCount\", requestOptions, async (options) => {\n options = {\n ...options,\n parentKey: nodeKeyFromJson(options.parentKey),\n };\n return this.getManager(requestOptions.clientId).getNodesCount(options);\n });\n }\n\n public override async getPagedNodes(token: IModelRpcProps, requestOptions: Paged<HierarchyRpcRequestOptions>): PresentationRpcResponse<PagedResponse<NodeJSON>> {\n return this.makeRequest(token, \"getPagedNodes\", requestOptions, async (options) => {\n options = enforceValidPageSize({\n ...options,\n parentKey: nodeKeyFromJson(options.parentKey),\n });\n const [nodes, count] = await Promise.all([\n this.getManager(requestOptions.clientId).getDetail().getNodes(options),\n this.getManager(requestOptions.clientId).getNodesCount(options),\n ]);\n return { total: count, items: nodes.map(Node.toJSON) };\n });\n }\n\n public override async getNodePaths(token: IModelRpcProps, requestOptions: FilterByInstancePathsHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElementJSON[]> {\n return this.makeRequest(token, \"getNodePaths\", requestOptions, async (options) => {\n const result = await this.getManager(requestOptions.clientId).getNodePaths(options);\n return result.map(NodePathElement.toJSON);\n });\n }\n\n public override async getFilteredNodePaths(token: IModelRpcProps, requestOptions: FilterByTextHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElementJSON[]> {\n return this.makeRequest(token, \"getFilteredNodePaths\", requestOptions, async (options) => {\n const result = await this.getManager(requestOptions.clientId).getFilteredNodePaths(options);\n return result.map(NodePathElement.toJSON);\n });\n }\n\n public override async getContentSources(token: IModelRpcProps, requestOptions: ContentSourcesRpcRequestOptions): PresentationRpcResponse<ContentSourcesRpcResult> {\n return this.makeRequest(token, \"getContentSources\", requestOptions, async (options) => {\n const result = await this.getManager(requestOptions.clientId).getContentSources(options);\n const classesMap = {};\n const selectClasses = result.map((sci) => SelectClassInfo.toCompressedJSON(sci, classesMap));\n return { sources: selectClasses, classesMap };\n });\n }\n\n public override async getContentDescriptor(token: IModelRpcProps, requestOptions: ContentDescriptorRpcRequestOptions): PresentationRpcResponse<DescriptorJSON | undefined> {\n return this.makeRequest(token, \"getContentDescriptor\", requestOptions, async (options) => {\n options = {\n ...options,\n keys: KeySet.fromJSON(options.keys),\n };\n if (options.transport === \"unparsed-json\") {\n // Here we send a plain JSON string but we will parse it to DescriptorJSON on the frontend. This way we are\n // bypassing unnecessary deserialization and serialization.\n return Presentation.getManager().getDetail().getContentDescriptor(options) as unknown as DescriptorJSON | undefined;\n } else {\n // Support for older frontends that still expect a parsed descriptor\n const descriptor = await Presentation.getManager().getContentDescriptor(options);\n return descriptor?.toJSON();\n }\n });\n }\n\n public override async getContentSetSize(token: IModelRpcProps, requestOptions: ContentRpcRequestOptions): PresentationRpcResponse<number> {\n return this.makeRequest(token, \"getContentSetSize\", requestOptions, async (options) => {\n options = {\n ...options,\n keys: KeySet.fromJSON(options.keys),\n };\n return this.getManager(requestOptions.clientId).getContentSetSize(options);\n });\n }\n\n public override async getPagedContent(token: IModelRpcProps, requestOptions: Paged<ContentRpcRequestOptions>): PresentationRpcResponse<{ descriptor: DescriptorJSON, contentSet: PagedResponse<ItemJSON> } | undefined> {\n return this.makeRequest(token, \"getPagedContent\", requestOptions, async (options) => {\n options = enforceValidPageSize({\n ...options,\n keys: KeySet.fromJSON(options.keys),\n });\n\n const [size, content] = await Promise.all([\n this.getManager(requestOptions.clientId).getContentSetSize(options),\n this.getManager(requestOptions.clientId).getDetail().getContent(options),\n ]);\n\n if (!content)\n return undefined;\n\n return {\n descriptor: content.descriptor.toJSON(),\n contentSet: {\n total: size,\n items: content.contentSet.map((i) => i.toJSON()),\n },\n };\n });\n }\n\n public override async getPagedContentSet(token: IModelRpcProps, requestOptions: Paged<ContentRpcRequestOptions>): PresentationRpcResponse<PagedResponse<ItemJSON>> {\n const content = await this.getPagedContent(token, requestOptions);\n return this.successResponse(content.result ? content.result.contentSet : { total: 0, items: [] });\n }\n\n public override async getElementProperties(token: IModelRpcProps, requestOptions: SingleElementPropertiesRpcRequestOptions): PresentationRpcResponse<ElementProperties | undefined> {\n return this.makeRequest(token, \"getElementProperties\", { ...requestOptions }, async (options) => {\n return this.getManager(requestOptions.clientId).getDetail().getElementProperties(options);\n });\n }\n\n public override async getPagedDistinctValues(token: IModelRpcProps, requestOptions: DistinctValuesRpcRequestOptions): PresentationRpcResponse<PagedResponse<DisplayValueGroupJSON>> {\n return this.makeRequest(token, \"getPagedDistinctValues\", requestOptions, async (options) => {\n options = enforceValidPageSize({\n ...options,\n keys: KeySet.fromJSON(options.keys),\n });\n const response = await this.getManager(requestOptions.clientId).getPagedDistinctValues(options);\n return {\n ...response,\n items: response.items.map(DisplayValueGroup.toJSON),\n };\n });\n }\n\n public override async getContentInstanceKeys(token: IModelRpcProps, requestOptions: ContentInstanceKeysRpcRequestOptions): PresentationRpcResponse<{ total: number, items: KeySetJSON }> {\n return this.makeRequest(token, \"getContentInstanceKeys\", requestOptions, async (options) => {\n const { displayType, ...optionsNoDisplayType } = options;\n options = enforceValidPageSize({\n ...optionsNoDisplayType,\n keys: KeySet.fromJSON(optionsNoDisplayType.keys),\n descriptor: {\n displayType,\n contentFlags: ContentFlags.KeysOnly,\n },\n }, MAX_ALLOWED_KEYS_PAGE_SIZE);\n\n const [size, content] = await Promise.all([\n this.getManager(requestOptions.clientId).getContentSetSize(options),\n this.getManager(requestOptions.clientId).getDetail().getContent(options),\n ]);\n\n if (size === 0 || !content)\n return { total: 0, items: new KeySet().toJSON() };\n\n return {\n total: size,\n items: content.contentSet.reduce((keys, item) => keys.add(item.primaryKeys), new KeySet()).toJSON(),\n };\n });\n }\n\n public override async getDisplayLabelDefinition(token: IModelRpcProps, requestOptions: DisplayLabelRpcRequestOptions): PresentationRpcResponse<LabelDefinitionJSON> {\n return this.makeRequest(token, \"getDisplayLabelDefinition\", requestOptions, async (options) => {\n const label = await this.getManager(requestOptions.clientId).getDetail().getDisplayLabelDefinition(options);\n return LabelDefinition.toJSON(label);\n });\n }\n\n public override async getPagedDisplayLabelDefinitions(token: IModelRpcProps, requestOptions: DisplayLabelsRpcRequestOptions): PresentationRpcResponse<PagedResponse<LabelDefinitionJSON>> {\n const pageOpts = enforceValidPageSize({ paging: { start: 0, size: requestOptions.keys.length } });\n if (pageOpts.paging.size < requestOptions.keys.length)\n requestOptions.keys.splice(pageOpts.paging.size);\n return this.makeRequest(token, \"getPagedDisplayLabelDefinitions\", requestOptions, async (options) => {\n const labels = await this.getManager(requestOptions.clientId).getDetail().getDisplayLabelDefinitions({ ...options, keys: options.keys.map(InstanceKey.fromJSON) });\n return {\n total: options.keys.length,\n items: labels.map(LabelDefinition.toJSON),\n };\n });\n }\n\n public override async getSelectionScopes(token: IModelRpcProps, requestOptions: SelectionScopeRpcRequestOptions): PresentationRpcResponse<SelectionScope[]> {\n return this.makeRequest(token, \"getSelectionScopes\", requestOptions, async (options) =>\n this.getManager(requestOptions.clientId).getSelectionScopes(options),\n );\n }\n\n public override async computeSelection(token: IModelRpcProps, requestOptions: ComputeSelectionRpcRequestOptions | SelectionScopeRpcRequestOptions, ids?: Id64String[], scopeId?: string): PresentationRpcResponse<KeySetJSON> {\n return this.makeRequest(token, \"computeSelection\", requestOptions, async (options) => {\n if (!isComputeSelectionRequestOptions(options)) {\n options = {\n ...options,\n elementIds: ids!,\n scope: { id: scopeId! },\n };\n }\n const keys = await this.getManager(requestOptions.clientId).computeSelection(options);\n return keys.toJSON();\n });\n }\n}\n\nconst enforceValidPageSize = <TOptions extends Paged<object>>(requestOptions: TOptions, maxPageSize = MAX_ALLOWED_PAGE_SIZE): TOptions & { paging: PageOptions } => {\n const validPageSize = getValidPageSize(requestOptions.paging?.size, maxPageSize);\n if (!requestOptions.paging || requestOptions.paging.size !== validPageSize)\n return { ...requestOptions, paging: { ...requestOptions.paging, size: validPageSize } };\n return requestOptions as (TOptions & { paging: PageOptions });\n};\n\nconst getValidPageSize = (size: number | undefined, maxPageSize: number) => {\n const requestedSize = size ?? 0;\n return (requestedSize === 0 || requestedSize > maxPageSize) ? maxPageSize : requestedSize;\n};\n\nconst nodeKeyFromJson = (json: NodeKeyJSON | undefined): NodeKey | undefined => {\n if (!json)\n return undefined;\n return NodeKey.fromJSON(json);\n};\n"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ACH;YACD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;YACtF,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA1WD,kDA0WC;AAED,MAAM,oBAAoB,GAAG,CAAiC,cAAwB,EAAE,WAAW,GAAG,6BAAqB,EAAsC,EAAE;;IACjK,MAAM,aAAa,GAAG,gBAAgB,CAAC,MAAA,cAAc,CAAC,MAAM,0CAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IACjF,IAAI,CAAC,cAAc,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,KAAK,aAAa;QACxE,OAAO,EAAE,GAAG,cAAc,EAAE,MAAM,EAAE,EAAE,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC;IAC1F,OAAO,cAAsD,CAAC;AAChE,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,IAAwB,EAAE,WAAmB,EAAE,EAAE;IACzE,MAAM,aAAa,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,CAAC,CAAC;IAChC,OAAO,CAAC,aAAa,KAAK,CAAC,IAAI,aAAa,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC;AAC5F,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,IAA6B,EAAuB,EAAE;IAC7E,IAAI,CAAC,IAAI;QACP,OAAO,SAAS,CAAC;IACnB,OAAO,6BAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RPC\n */\n\nimport { IModelDb } from \"@itwin/core-backend\";\nimport { assert, BeEvent, Id64String, IDisposable, Logger } from \"@itwin/core-bentley\";\nimport { IModelRpcProps } from \"@itwin/core-common\";\nimport {\n ClientDiagnostics, ComputeSelectionRpcRequestOptions, ContentDescriptorRpcRequestOptions, ContentFlags, ContentInstanceKeysRpcRequestOptions,\n ContentRpcRequestOptions, ContentSourcesRpcRequestOptions, ContentSourcesRpcResult, DescriptorJSON, Diagnostics, DisplayLabelRpcRequestOptions,\n DisplayLabelsRpcRequestOptions, DisplayValueGroup, DisplayValueGroupJSON, DistinctValuesRpcRequestOptions, ElementProperties,\n FilterByInstancePathsHierarchyRpcRequestOptions, FilterByTextHierarchyRpcRequestOptions, HierarchyRpcRequestOptions, InstanceKey,\n isComputeSelectionRequestOptions, ItemJSON, KeySet, KeySetJSON, LabelDefinition, LabelDefinitionJSON, Node, NodeJSON, NodeKey, NodeKeyJSON,\n NodePathElement, NodePathElementJSON, Paged, PagedResponse, PageOptions, PresentationError, PresentationRpcInterface, PresentationRpcResponse,\n PresentationRpcResponseData, PresentationStatus, RpcDiagnosticsOptions, Ruleset, RulesetVariable, RulesetVariableJSON, SelectClassInfo,\n SelectionScope, SelectionScopeRpcRequestOptions, SingleElementPropertiesRpcRequestOptions,\n} from \"@itwin/presentation-common\";\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { Presentation } from \"./Presentation\";\nimport { PresentationManager } from \"./PresentationManager\";\nimport { TemporaryStorage } from \"./TemporaryStorage\";\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst packageJsonVersion = require(\"../../../package.json\").version;\n\ntype ContentGetter<TResult = any, TOptions = any> = (requestOptions: TOptions) => TResult;\n\n/** @internal */\nexport const MAX_ALLOWED_PAGE_SIZE = 1000;\n/** @internal */\nexport const MAX_ALLOWED_KEYS_PAGE_SIZE = 10000;\n\n/**\n * The backend implementation of PresentationRpcInterface. All it's basically\n * responsible for is forwarding calls to [[Presentation.manager]].\n *\n * @internal\n */\nexport class PresentationRpcImpl extends PresentationRpcInterface implements IDisposable {\n\n private _requestTimeout: number;\n private _pendingRequests: TemporaryStorage<PresentationRpcResponse<any>>;\n private _cancelEvents: Map<string, BeEvent<() => void>>;\n\n public constructor(props?: { requestTimeout: number }) {\n super();\n this._requestTimeout = props?.requestTimeout ?? 90 * 1000;\n this._pendingRequests = new TemporaryStorage({\n // remove the pending request after request timeout + 10 seconds - this gives\n // frontend 10 seconds to re-send the request until it's removed from requests' cache\n unusedValueLifetime: (this._requestTimeout > 0) ? (this._requestTimeout + 10 * 1000) : undefined,\n\n // attempt to clean up every second\n cleanupInterval: 1000,\n\n cleanupHandler: (id, _, reason) => {\n if (reason !== \"request\") {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Cleaning up request without frontend retrieving it: ${id}.`);\n // istanbul ignore next\n this._cancelEvents.get(id)?.raiseEvent();\n }\n this._cancelEvents.delete(id);\n },\n });\n this._cancelEvents = new Map<string, BeEvent<() => void>>();\n }\n\n public dispose() {\n this._pendingRequests.dispose();\n }\n\n public get requestTimeout() { return this._requestTimeout; }\n\n public get pendingRequests() { return this._pendingRequests; }\n\n /** Returns an ok response with result inside */\n private successResponse<TResult>(result: TResult, diagnostics?: ClientDiagnostics) {\n return {\n statusCode: PresentationStatus.Success,\n result,\n diagnostics,\n };\n }\n\n /** Returns a bad request response with empty result and an error code */\n private errorResponse(errorCode: PresentationStatus, errorMessage?: string, diagnostics?: ClientDiagnostics) {\n return {\n statusCode: errorCode,\n result: undefined,\n errorMessage,\n diagnostics,\n };\n }\n\n /**\n * Get the [[PresentationManager]] used by this RPC impl.\n */\n public getManager(clientId?: string): PresentationManager {\n return Presentation.getManager(clientId);\n }\n\n private getIModel(token: IModelRpcProps): IModelDb {\n let imodel: IModelDb;\n try {\n imodel = IModelDb.findByKey(token.key);\n } catch {\n throw new PresentationError(PresentationStatus.InvalidArgument, \"IModelRpcProps doesn't point to a valid iModel\");\n }\n return imodel;\n }\n\n private async makeRequest<TRpcOptions extends { rulesetOrId?: Ruleset | string, clientId?: string, diagnostics?: RpcDiagnosticsOptions, rulesetVariables?: RulesetVariableJSON[] }, TResult>(token: IModelRpcProps, requestId: string, requestOptions: TRpcOptions, request: ContentGetter<Promise<TResult>>): PresentationRpcResponse<TResult> {\n const requestKey = JSON.stringify({ iModelKey: token.key, requestId, requestOptions });\n\n Logger.logInfo(PresentationBackendLoggerCategory.Rpc, `Received '${requestId}' request. Params: ${requestKey}`);\n\n let resultPromise = this._pendingRequests.getValue(requestKey);\n if (resultPromise) {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request already pending`);\n } else {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request not found, creating a new one`);\n let imodel: IModelDb;\n try {\n imodel = this.getIModel(token);\n } catch (e) {\n assert(e instanceof Error);\n return this.errorResponse(PresentationStatus.InvalidArgument, e.message);\n }\n\n const { clientId: _, diagnostics: diagnosticsOptions, rulesetVariables, ...options } = requestOptions;\n const managerRequestOptions: any = {\n ...options,\n imodel,\n cancelEvent: new BeEvent<() => void>(),\n };\n\n // set up ruleset variables\n if (rulesetVariables)\n managerRequestOptions.rulesetVariables = rulesetVariables.map(RulesetVariable.fromJSON);\n\n // set up diagnostics listener\n let diagnostics: ClientDiagnostics | undefined;\n const getDiagnostics = (): ClientDiagnostics => {\n if (!diagnostics)\n diagnostics = {};\n return diagnostics;\n };\n if (diagnosticsOptions) {\n if (diagnosticsOptions.backendVersion) {\n getDiagnostics().backendVersion = packageJsonVersion;\n }\n managerRequestOptions.diagnostics = {\n ...diagnosticsOptions,\n handler: (d: Diagnostics) => {\n if (d.logs) {\n const target = getDiagnostics();\n if (target.logs)\n target.logs.push(...d.logs);\n else\n target.logs = [...d.logs];\n }\n },\n };\n }\n\n // initiate request\n resultPromise = request(managerRequestOptions)\n .then((result) => this.successResponse(result, diagnostics))\n .catch((e: PresentationError) => this.errorResponse(e.errorNumber, e.message, diagnostics));\n\n // store the request promise\n this._pendingRequests.addValue(requestKey, resultPromise);\n this._cancelEvents.set(requestKey, managerRequestOptions.cancelEvent);\n }\n\n if (this._requestTimeout === 0) {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request timeout not configured, returning promise without a timeout.`);\n resultPromise.finally(() => {\n this._pendingRequests.deleteValue(requestKey);\n });\n return resultPromise;\n }\n\n let timeout: NodeJS.Timeout;\n const timeoutPromise = new Promise<any>((_resolve, reject) => {\n timeout = setTimeout(() => {\n reject(\"Timed out\");\n }, this._requestTimeout);\n });\n\n /* eslint-disable @typescript-eslint/indent */\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Returning a promise with a timeout of ${this._requestTimeout}.`);\n return Promise\n .race([resultPromise, timeoutPromise])\n .catch<PresentationRpcResponseData>(() => {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request timeout, returning \"BackendTimeout\" status.`);\n return this.errorResponse(PresentationStatus.BackendTimeout);\n })\n .then((response: PresentationRpcResponseData<any>) => {\n if (response.statusCode !== PresentationStatus.BackendTimeout) {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request completed, returning result.`);\n this._pendingRequests.deleteValue(requestKey);\n }\n clearTimeout(timeout);\n return response;\n });\n /* eslint-enable @typescript-eslint/indent */\n }\n\n public override async getNodesCount(token: IModelRpcProps, requestOptions: HierarchyRpcRequestOptions): PresentationRpcResponse<number> {\n return this.makeRequest(token, \"getNodesCount\", requestOptions, async (options) => {\n options = {\n ...options,\n parentKey: nodeKeyFromJson(options.parentKey),\n };\n return this.getManager(requestOptions.clientId).getNodesCount(options);\n });\n }\n\n public override async getPagedNodes(token: IModelRpcProps, requestOptions: Paged<HierarchyRpcRequestOptions>): PresentationRpcResponse<PagedResponse<NodeJSON>> {\n return this.makeRequest(token, \"getPagedNodes\", requestOptions, async (options) => {\n options = enforceValidPageSize({\n ...options,\n parentKey: nodeKeyFromJson(options.parentKey),\n });\n const [nodes, count] = await Promise.all([\n this.getManager(requestOptions.clientId).getDetail().getNodes(options),\n this.getManager(requestOptions.clientId).getNodesCount(options),\n ]);\n return { total: count, items: nodes.map(Node.toJSON) };\n });\n }\n\n public override async getNodePaths(token: IModelRpcProps, requestOptions: FilterByInstancePathsHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElementJSON[]> {\n return this.makeRequest(token, \"getNodePaths\", requestOptions, async (options) => {\n const result = await this.getManager(requestOptions.clientId).getNodePaths(options);\n return result.map(NodePathElement.toJSON);\n });\n }\n\n public override async getFilteredNodePaths(token: IModelRpcProps, requestOptions: FilterByTextHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElementJSON[]> {\n return this.makeRequest(token, \"getFilteredNodePaths\", requestOptions, async (options) => {\n const result = await this.getManager(requestOptions.clientId).getFilteredNodePaths(options);\n return result.map(NodePathElement.toJSON);\n });\n }\n\n public override async getContentSources(token: IModelRpcProps, requestOptions: ContentSourcesRpcRequestOptions): PresentationRpcResponse<ContentSourcesRpcResult> {\n return this.makeRequest(token, \"getContentSources\", requestOptions, async (options) => {\n const result = await this.getManager(requestOptions.clientId).getContentSources(options);\n const classesMap = {};\n const selectClasses = result.map((sci) => SelectClassInfo.toCompressedJSON(sci, classesMap));\n return { sources: selectClasses, classesMap };\n });\n }\n\n public override async getContentDescriptor(token: IModelRpcProps, requestOptions: ContentDescriptorRpcRequestOptions): PresentationRpcResponse<DescriptorJSON | undefined> {\n return this.makeRequest(token, \"getContentDescriptor\", requestOptions, async (options) => {\n options = {\n ...options,\n keys: KeySet.fromJSON(options.keys),\n };\n if (options.transport === \"unparsed-json\") {\n // Here we send a plain JSON string but we will parse it to DescriptorJSON on the frontend. This way we are\n // bypassing unnecessary deserialization and serialization.\n return Presentation.getManager().getDetail().getContentDescriptor(options) as unknown as DescriptorJSON | undefined;\n } else {\n // Support for older frontends that still expect a parsed descriptor\n const descriptor = await Presentation.getManager().getContentDescriptor(options);\n return descriptor?.toJSON();\n }\n });\n }\n\n public override async getContentSetSize(token: IModelRpcProps, requestOptions: ContentRpcRequestOptions): PresentationRpcResponse<number> {\n return this.makeRequest(token, \"getContentSetSize\", requestOptions, async (options) => {\n options = {\n ...options,\n keys: KeySet.fromJSON(options.keys),\n };\n return this.getManager(requestOptions.clientId).getContentSetSize(options);\n });\n }\n\n public override async getPagedContent(token: IModelRpcProps, requestOptions: Paged<ContentRpcRequestOptions>): PresentationRpcResponse<{ descriptor: DescriptorJSON, contentSet: PagedResponse<ItemJSON> } | undefined> {\n return this.makeRequest(token, \"getPagedContent\", requestOptions, async (options) => {\n options = enforceValidPageSize({\n ...options,\n keys: KeySet.fromJSON(options.keys),\n });\n\n const [size, content] = await Promise.all([\n this.getManager(requestOptions.clientId).getContentSetSize(options),\n this.getManager(requestOptions.clientId).getDetail().getContent(options),\n ]);\n\n if (!content)\n return undefined;\n\n return {\n descriptor: content.descriptor.toJSON(),\n contentSet: {\n total: size,\n items: content.contentSet.map((i) => i.toJSON()),\n },\n };\n });\n }\n\n public override async getPagedContentSet(token: IModelRpcProps, requestOptions: Paged<ContentRpcRequestOptions>): PresentationRpcResponse<PagedResponse<ItemJSON>> {\n const content = await this.getPagedContent(token, requestOptions);\n return this.successResponse(content.result ? content.result.contentSet : { total: 0, items: [] });\n }\n\n public override async getElementProperties(token: IModelRpcProps, requestOptions: SingleElementPropertiesRpcRequestOptions): PresentationRpcResponse<ElementProperties | undefined> {\n return this.makeRequest(token, \"getElementProperties\", { ...requestOptions }, async (options) => {\n return this.getManager(requestOptions.clientId).getDetail().getElementProperties(options);\n });\n }\n\n public override async getPagedDistinctValues(token: IModelRpcProps, requestOptions: DistinctValuesRpcRequestOptions): PresentationRpcResponse<PagedResponse<DisplayValueGroupJSON>> {\n return this.makeRequest(token, \"getPagedDistinctValues\", requestOptions, async (options) => {\n options = enforceValidPageSize({\n ...options,\n keys: KeySet.fromJSON(options.keys),\n });\n const response = await this.getManager(requestOptions.clientId).getPagedDistinctValues(options);\n return {\n ...response,\n items: response.items.map(DisplayValueGroup.toJSON),\n };\n });\n }\n\n public override async getContentInstanceKeys(token: IModelRpcProps, requestOptions: ContentInstanceKeysRpcRequestOptions): PresentationRpcResponse<{ total: number, items: KeySetJSON }> {\n return this.makeRequest(token, \"getContentInstanceKeys\", requestOptions, async (options) => {\n const { displayType, ...optionsNoDisplayType } = options;\n options = enforceValidPageSize({\n ...optionsNoDisplayType,\n keys: KeySet.fromJSON(optionsNoDisplayType.keys),\n descriptor: {\n displayType,\n contentFlags: ContentFlags.KeysOnly,\n },\n }, MAX_ALLOWED_KEYS_PAGE_SIZE);\n\n const [size, content] = await Promise.all([\n this.getManager(requestOptions.clientId).getContentSetSize(options),\n this.getManager(requestOptions.clientId).getDetail().getContent(options),\n ]);\n\n if (size === 0 || !content)\n return { total: 0, items: new KeySet().toJSON() };\n\n return {\n total: size,\n items: content.contentSet.reduce((keys, item) => keys.add(item.primaryKeys), new KeySet()).toJSON(),\n };\n });\n }\n\n public override async getDisplayLabelDefinition(token: IModelRpcProps, requestOptions: DisplayLabelRpcRequestOptions): PresentationRpcResponse<LabelDefinitionJSON> {\n return this.makeRequest(token, \"getDisplayLabelDefinition\", requestOptions, async (options) => {\n const label = await this.getManager(requestOptions.clientId).getDetail().getDisplayLabelDefinition(options);\n return LabelDefinition.toJSON(label);\n });\n }\n\n public override async getPagedDisplayLabelDefinitions(token: IModelRpcProps, requestOptions: DisplayLabelsRpcRequestOptions): PresentationRpcResponse<PagedResponse<LabelDefinitionJSON>> {\n const pageOpts = enforceValidPageSize({ paging: { start: 0, size: requestOptions.keys.length } });\n if (pageOpts.paging.size < requestOptions.keys.length)\n requestOptions.keys.splice(pageOpts.paging.size);\n return this.makeRequest(token, \"getPagedDisplayLabelDefinitions\", requestOptions, async (options) => {\n const labels = await this.getManager(requestOptions.clientId).getDetail().getDisplayLabelDefinitions({ ...options, keys: options.keys.map(InstanceKey.fromJSON) });\n return {\n total: options.keys.length,\n items: labels.map(LabelDefinition.toJSON),\n };\n });\n }\n\n public override async getSelectionScopes(token: IModelRpcProps, requestOptions: SelectionScopeRpcRequestOptions): PresentationRpcResponse<SelectionScope[]> {\n return this.makeRequest(token, \"getSelectionScopes\", requestOptions, async (options) =>\n this.getManager(requestOptions.clientId).getSelectionScopes(options),\n );\n }\n\n public override async computeSelection(token: IModelRpcProps, requestOptions: ComputeSelectionRpcRequestOptions | SelectionScopeRpcRequestOptions, ids?: Id64String[], scopeId?: string): PresentationRpcResponse<KeySetJSON> {\n return this.makeRequest(token, \"computeSelection\", requestOptions, async (options) => {\n if (!isComputeSelectionRequestOptions(options)) {\n options = {\n ...options,\n elementIds: ids!,\n scope: { id: scopeId! },\n };\n }\n const keys = await this.getManager(requestOptions.clientId).computeSelection(options);\n return keys.toJSON();\n });\n }\n}\n\nconst enforceValidPageSize = <TOptions extends Paged<object>>(requestOptions: TOptions, maxPageSize = MAX_ALLOWED_PAGE_SIZE): TOptions & { paging: PageOptions } => {\n const validPageSize = getValidPageSize(requestOptions.paging?.size, maxPageSize);\n if (!requestOptions.paging || requestOptions.paging.size !== validPageSize)\n return { ...requestOptions, paging: { ...requestOptions.paging, size: validPageSize } };\n return requestOptions as (TOptions & { paging: PageOptions });\n};\n\nconst getValidPageSize = (size: number | undefined, maxPageSize: number) => {\n const requestedSize = size ?? 0;\n return (requestedSize === 0 || requestedSize > maxPageSize) ? maxPageSize : requestedSize;\n};\n\nconst nodeKeyFromJson = (json: NodeKeyJSON | undefined): NodeKey | undefined => {\n if (!json)\n return undefined;\n return NodeKey.fromJSON(json);\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/presentation-backend",
|
|
3
|
-
"version": "3.5.0-dev.
|
|
3
|
+
"version": "3.5.0-dev.14",
|
|
4
4
|
"description": "Backend of iTwin.js Presentation library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -22,20 +22,20 @@
|
|
|
22
22
|
"main": "lib/cjs/presentation-backend.js",
|
|
23
23
|
"typings": "lib/cjs/presentation-backend",
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@itwin/core-backend": "^3.5.0-dev.
|
|
26
|
-
"@itwin/core-bentley": "^3.5.0-dev.
|
|
27
|
-
"@itwin/core-common": "^3.5.0-dev.
|
|
28
|
-
"@itwin/core-quantity": "^3.5.0-dev.
|
|
29
|
-
"@itwin/presentation-common": "^3.5.0-dev.
|
|
25
|
+
"@itwin/core-backend": "^3.5.0-dev.14",
|
|
26
|
+
"@itwin/core-bentley": "^3.5.0-dev.14",
|
|
27
|
+
"@itwin/core-common": "^3.5.0-dev.14",
|
|
28
|
+
"@itwin/core-quantity": "^3.5.0-dev.14",
|
|
29
|
+
"@itwin/presentation-common": "^3.5.0-dev.14"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@itwin/build-tools": "3.5.0-dev.
|
|
33
|
-
"@itwin/core-backend": "3.5.0-dev.
|
|
34
|
-
"@itwin/core-bentley": "3.5.0-dev.
|
|
35
|
-
"@itwin/core-common": "3.5.0-dev.
|
|
36
|
-
"@itwin/core-quantity": "3.5.0-dev.
|
|
37
|
-
"@itwin/eslint-plugin": "3.5.0-dev.
|
|
38
|
-
"@itwin/presentation-common": "3.5.0-dev.
|
|
32
|
+
"@itwin/build-tools": "3.5.0-dev.14",
|
|
33
|
+
"@itwin/core-backend": "3.5.0-dev.14",
|
|
34
|
+
"@itwin/core-bentley": "3.5.0-dev.14",
|
|
35
|
+
"@itwin/core-common": "3.5.0-dev.14",
|
|
36
|
+
"@itwin/core-quantity": "3.5.0-dev.14",
|
|
37
|
+
"@itwin/eslint-plugin": "3.5.0-dev.14",
|
|
38
|
+
"@itwin/presentation-common": "3.5.0-dev.14",
|
|
39
39
|
"@types/chai": "4.3.1",
|
|
40
40
|
"@types/chai-as-promised": "^7",
|
|
41
41
|
"@types/chai-jest-snapshot": "^1.3.0",
|