@itwin/presentation-backend 3.2.0-dev.9 → 3.3.0-dev.0
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 +28 -1
- package/lib/cjs/assets/supplemental-presentation-rules/BisCore.PresentationRuleSet.json +27 -1
- package/lib/cjs/presentation-backend/NativePlatform.d.ts +0 -1
- package/lib/cjs/presentation-backend/NativePlatform.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/NativePlatform.js +0 -1
- package/lib/cjs/presentation-backend/NativePlatform.js.map +1 -1
- package/lib/cjs/presentation-backend/Presentation.d.ts +21 -12
- package/lib/cjs/presentation-backend/Presentation.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/Presentation.js +18 -4
- package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManager.d.ts +2 -2
- package/lib/cjs/presentation-backend/PresentationManager.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManager.js +1 -11
- package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts +0 -6
- package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js +0 -6
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
- package/lib/cjs/presentation-backend/Utils.d.ts +2 -0
- package/lib/cjs/presentation-backend/Utils.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/Utils.js +9 -1
- package/lib/cjs/presentation-backend/Utils.js.map +1 -1
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
# Change Log - @itwin/presentation-backend
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 15 Apr 2022 13:49:25 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 3.1.3
|
|
6
|
+
Fri, 15 Apr 2022 13:49:25 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 3.1.2
|
|
11
|
+
Wed, 06 Apr 2022 22:27:56 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
14
|
+
|
|
15
|
+
## 3.1.1
|
|
16
|
+
Thu, 31 Mar 2022 15:55:48 GMT
|
|
17
|
+
|
|
18
|
+
_Version update only_
|
|
19
|
+
|
|
20
|
+
## 3.1.0
|
|
21
|
+
Tue, 29 Mar 2022 20:53:47 GMT
|
|
22
|
+
|
|
23
|
+
### Updates
|
|
24
|
+
|
|
25
|
+
- Fix RPC requests' memoization causing similar requests to different iModels to be memoized as a single request.
|
|
26
|
+
|
|
27
|
+
## 3.0.3
|
|
28
|
+
Fri, 25 Mar 2022 15:10:02 GMT
|
|
29
|
+
|
|
30
|
+
_Version update only_
|
|
4
31
|
|
|
5
32
|
## 3.0.2
|
|
6
33
|
Thu, 10 Mar 2022 21:18:13 GMT
|
|
@@ -187,6 +187,30 @@
|
|
|
187
187
|
}
|
|
188
188
|
]
|
|
189
189
|
},
|
|
190
|
+
{
|
|
191
|
+
"ruleType": "InstanceLabelOverride",
|
|
192
|
+
"onlyIfNotHandled": true,
|
|
193
|
+
"class": {
|
|
194
|
+
"schemaName": "BisCore",
|
|
195
|
+
"className": "RepositoryModel"
|
|
196
|
+
},
|
|
197
|
+
"values": [
|
|
198
|
+
{
|
|
199
|
+
"specType": "RelatedInstanceLabel",
|
|
200
|
+
"pathToRelatedInstance": {
|
|
201
|
+
"relationship": {
|
|
202
|
+
"schemaName": "BisCore",
|
|
203
|
+
"className": "ModelModelsElement"
|
|
204
|
+
},
|
|
205
|
+
"direction": "Forward",
|
|
206
|
+
"targetClass": {
|
|
207
|
+
"schemaName": "BisCore",
|
|
208
|
+
"className": "Subject"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
},
|
|
190
214
|
{
|
|
191
215
|
"ruleType": "InstanceLabelOverride",
|
|
192
216
|
"onlyIfNotHandled": true,
|
|
@@ -379,6 +403,7 @@
|
|
|
379
403
|
}
|
|
380
404
|
}
|
|
381
405
|
],
|
|
406
|
+
"instanceFilter": "this.Kind <> \"Relationship\"",
|
|
382
407
|
"properties": [
|
|
383
408
|
{
|
|
384
409
|
"name": "Identifier",
|
|
@@ -436,6 +461,7 @@
|
|
|
436
461
|
}
|
|
437
462
|
}
|
|
438
463
|
],
|
|
464
|
+
"instanceFilter": "this.Kind <> \"Relationship\"",
|
|
439
465
|
"properties": "_none_",
|
|
440
466
|
"autoExpand": true,
|
|
441
467
|
"nestedRelatedProperties": [
|
|
@@ -733,4 +759,4 @@
|
|
|
733
759
|
]
|
|
734
760
|
}
|
|
735
761
|
]
|
|
736
|
-
}
|
|
762
|
+
}
|
|
@@ -18,7 +18,6 @@ export declare enum NativePlatformRequestTypes {
|
|
|
18
18
|
GetContentDescriptor = "GetContentDescriptor",
|
|
19
19
|
GetContentSetSize = "GetContentSetSize",
|
|
20
20
|
GetContent = "GetContent",
|
|
21
|
-
GetDistinctValues = "GetDistinctValues",
|
|
22
21
|
GetPagedDistinctValues = "GetPagedDistinctValues",
|
|
23
22
|
GetDisplayLabel = "GetDisplayLabel",
|
|
24
23
|
CompareHierarchies = "CompareHierarchies"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativePlatform.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/NativePlatform.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAc,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EACL,oBAAoB,EAAE,WAAW,EAAyC,cAAc,EAAE,aAAa,EAAqB,kBAAkB,EAC/I,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAsB,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEpF,gBAAgB;AAChB,oBAAY,0BAA0B;IACpC,YAAY,iBAAiB;IAC7B,iBAAiB,sBAAsB;IACvC,WAAW,gBAAgB;IAC3B,gBAAgB,qBAAqB;IACrC,YAAY,iBAAiB;IAC7B,oBAAoB,yBAAyB;IAC7C,iBAAiB,sBAAsB;IACvC,oBAAoB,yBAAyB;IAC7C,iBAAiB,sBAAsB;IACvC,UAAU,eAAe;IACzB,
|
|
1
|
+
{"version":3,"file":"NativePlatform.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/NativePlatform.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAc,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EACL,oBAAoB,EAAE,WAAW,EAAyC,cAAc,EAAE,aAAa,EAAqB,kBAAkB,EAC/I,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAsB,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEpF,gBAAgB;AAChB,oBAAY,0BAA0B;IACpC,YAAY,iBAAiB;IAC7B,iBAAiB,sBAAsB;IACvC,WAAW,gBAAgB;IAC3B,gBAAgB,qBAAqB;IACrC,YAAY,iBAAiB;IAC7B,oBAAoB,yBAAyB;IAC7C,iBAAiB,sBAAsB;IACvC,oBAAoB,yBAAyB;IAC7C,iBAAiB,sBAAsB;IACvC,UAAU,eAAe;IACzB,sBAAsB,2BAA2B;IACjD,eAAe,oBAAoB;IACnC,kBAAkB,uBAAuB;CAC1C;AAED;;;GAGG;AACH,oBAAY,4BAA4B;IACtC,MAAM,WAAW;IACjB,eAAe,qBAAqB;IACpC,WAAW,iBAAiB;IAC5B,QAAQ,cAAc;CACvB;AAED,gBAAgB;AA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etContentDescriptor";
|
|
25
25
|
NativePlatformRequestTypes["GetContentSetSize"] = "GetContentSetSize";
|
|
26
26
|
NativePlatformRequestTypes["GetContent"] = "GetContent";
|
|
27
|
-
NativePlatformRequestTypes["GetDistinctValues"] = "GetDistinctValues";
|
|
28
27
|
NativePlatformRequestTypes["GetPagedDistinctValues"] = "GetPagedDistinctValues";
|
|
29
28
|
NativePlatformRequestTypes["GetDisplayLabel"] = "GetDisplayLabel";
|
|
30
29
|
NativePlatformRequestTypes["CompareHierarchies"] = "CompareHierarchies";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativePlatform.js","sourceRoot":"","sources":["../../../src/presentation-backend/NativePlatform.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2E;AAG3E,oEAEoC;AACpC,+DAAoF;AAEpF,gBAAgB;AAChB,IAAY,0BAeX;AAfD,WAAY,0BAA0B;IACpC,2DAA6B,CAAA;IAC7B,qEAAuC,CAAA;IACvC,yDAA2B,CAAA;IAC3B,mEAAqC,CAAA;IACrC,2DAA6B,CAAA;IAC7B,2EAA6C,CAAA;IAC7C,qEAAuC,CAAA;IACvC,2EAA6C,CAAA;IAC7C,qEAAuC,CAAA;IACvC,uDAAyB,CAAA;IACzB,qEAAuC,CAAA;IACvC,+EAAiD,CAAA;IACjD,iEAAmC,CAAA;IACnC,uEAAyC,CAAA;AAC3C,CAAC,EAfW,0BAA0B,GAA1B,kCAA0B,KAA1B,kCAA0B,QAerC;AAED;;;GAGG;AACH,IAAY,4BAKX;AALD,WAAY,4BAA4B;IACtC,iDAAiB,CAAA;IACjB,oEAAoC,CAAA;IACpC,4DAA4B,CAAA;IAC5B,sDAAsB,CAAA;AACxB,CAAC,EALW,4BAA4B,GAA5B,oCAA4B,KAA5B,oCAA4B,QAKvC;AA2DD,gBAAgB;AACT,MAAM,2BAA2B,GAAG,CAAC,KAAiC,EAAsC,EAAE;IACnH,0EAA0E;IAC1E,+EAA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Y,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC,CAAC;QAC9D,CAAC;QACM,oBAAoB,CAAC,EAAO,EAAE,SAAiB,EAAE,UAA8C,EAAE,cAAsB;YAC5H,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;QAC9G,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAjHW,QAAA,2BAA2B,+BAiHtC","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 { IModelDb, IModelHost, IModelJsNative } from \"@itwin/core-backend\";\r\nimport { IDisposable } from \"@itwin/core-bentley\";\r\nimport { FormatProps } from \"@itwin/core-quantity\";\r\nimport {\r\n DiagnosticsScopeLogs, NodeKeyJSON, PresentationError, PresentationStatus, UpdateInfoJSON, VariableValue, VariableValueJSON, VariableValueTypes,\r\n} from \"@itwin/presentation-common\";\r\nimport { HierarchyCacheMode, PresentationManagerMode } from \"./PresentationManager\";\r\n\r\n/** @internal */\r\nexport enum NativePlatformRequestTypes {\r\n GetRootNodes = \"GetRootNodes\",\r\n GetRootNodesCount = \"GetRootNodesCount\",\r\n GetChildren = \"GetChildren\",\r\n GetChildrenCount = \"GetChildrenCount\",\r\n GetNodePaths = \"GetNodePaths\",\r\n GetFilteredNodePaths = \"GetFilteredNodePaths\",\r\n GetContentSources = \"GetContentSources\",\r\n GetContentDescriptor = \"GetContentDescriptor\",\r\n GetContentSetSize = \"GetContentSetSize\",\r\n GetContent = \"GetContent\",\r\n GetDistinctValues = \"GetDistinctValues\",\r\n GetPagedDistinctValues = \"GetPagedDistinctValues\",\r\n GetDisplayLabel = \"GetDisplayLabel\",\r\n CompareHierarchies = \"CompareHierarchies\",\r\n}\r\n\r\n/**\r\n * Enumeration of unit systems supported by native presentation manager.\r\n * @internal\r\n */\r\nexport enum NativePresentationUnitSystem {\r\n Metric = \"metric\",\r\n BritishImperial = \"british-imperial\",\r\n UsCustomary = \"us-customary\",\r\n UsSurvey = \"us-survey\",\r\n}\r\n\r\n/** @internal */\r\nexport interface NativePresentationDefaultUnitFormats {\r\n [phenomenon: string]: {\r\n unitSystems: NativePresentationUnitSystem[];\r\n format: FormatProps;\r\n };\r\n}\r\n\r\n/** @internal */\r\nexport interface NativePresentationKeySetJSON {\r\n instanceKeys: Array<[string, string[]]>;\r\n nodeKeys: NodeKeyJSON[];\r\n}\r\n\r\n/** @internal */\r\nexport interface NativePlatformResponse<TResult> {\r\n result: TResult;\r\n diagnostics?: DiagnosticsScopeLogs;\r\n}\r\n\r\n/** @internal */\r\nexport interface NativePlatformDefinition extends IDisposable {\r\n getImodelAddon(imodel: IModelDb): any;\r\n\r\n setupRulesetDirectories(directories: string[]): NativePlatformResponse<void>;\r\n setupSupplementalRulesetDirectories(directories: string[]): NativePlatformResponse<void>;\r\n\r\n forceLoadSchemas(db: any): Promise<NativePlatformResponse<void>>;\r\n\r\n getRulesets(rulesetId: string): NativePlatformResponse<string>;\r\n addRuleset(serializedRulesetJson: string): NativePlatformResponse<string>;\r\n removeRuleset(rulesetId: string, hash: string): NativePlatformResponse<boolean>;\r\n clearRulesets(): NativePlatformResponse<void>;\r\n\r\n handleRequest(db: any, options: string): Promise<NativePlatformResponse<string>>;\r\n\r\n getRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes): NativePlatformResponse<VariableValue>;\r\n setRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes, value: VariableValue): NativePlatformResponse<void>;\r\n unsetRulesetVariableValue(rulesetId: string, variableId: string): NativePlatformResponse<void>;\r\n\r\n getUpdateInfo(): NativePlatformResponse<UpdateInfoJSON | undefined>;\r\n updateHierarchyState(db: any, rulesetId: string, changeType: \"nodesExpanded\" | \"nodesCollapsed\", serializedKeys: string): NativePlatformResponse<void>;\r\n}\r\n\r\n/** @internal */\r\nexport interface DefaultNativePlatformProps {\r\n id: string;\r\n localeDirectories: string[];\r\n taskAllocationsMap: { [priority: number]: number };\r\n mode: PresentationManagerMode;\r\n isChangeTrackingEnabled: boolean;\r\n cacheConfig?: IModelJsNative.ECPresentationHierarchyCacheConfig;\r\n contentCacheSize?: number;\r\n defaultFormats?: NativePresentationDefaultUnitFormats;\r\n useMmap?: boolean | number;\r\n}\r\n\r\n/** @internal */\r\nexport const createDefaultNativePlatform = (props: DefaultNativePlatformProps): new () => NativePlatformDefinition => {\r\n // note the implementation is constructed here to make PresentationManager\r\n // usable without loading the actual addon (if addon is set to something other)\r\n return class implements NativePlatformDefinition {\r\n private _nativeAddon: IModelJsNative.ECPresentationManager;\r\n public constructor() {\r\n const mode = (props.mode === PresentationManagerMode.ReadOnly) ? IModelJsNative.ECPresentationManagerMode.ReadOnly : IModelJsNative.ECPresentationManagerMode.ReadWrite;\r\n const cacheConfig = props.cacheConfig ?? { mode: HierarchyCacheMode.Disk, directory: \"\" };\r\n const defaultFormats = props.defaultFormats ? this.getSerializedDefaultFormatsMap(props.defaultFormats) : {};\r\n this._nativeAddon = new IModelHost.platform.ECPresentationManager({ ...props, mode, cacheConfig, defaultFormats });\r\n }\r\n private getStatus(responseStatus: IModelJsNative.ECPresentationStatus): PresentationStatus {\r\n switch (responseStatus) {\r\n case IModelJsNative.ECPresentationStatus.InvalidArgument: return PresentationStatus.InvalidArgument;\r\n case IModelJsNative.ECPresentationStatus.Canceled: return PresentationStatus.Canceled;\r\n default: return PresentationStatus.Error;\r\n }\r\n }\r\n private getSerializedDefaultFormatsMap(defaultMap: NativePresentationDefaultUnitFormats) {\r\n const res: {\r\n [phenomenon: string]: {\r\n unitSystems: string[];\r\n serializedFormat: string;\r\n };\r\n } = {};\r\n Object.keys(defaultMap).forEach((key) => {\r\n const value = defaultMap[key];\r\n res[key] = { unitSystems: value.unitSystems, serializedFormat: JSON.stringify(value.format) };\r\n });\r\n\r\n return res;\r\n }\r\n private createSuccessResponse<T>(response: IModelJsNative.ECPresentationManagerResponse<T>): NativePlatformResponse<T> {\r\n const retValue: NativePlatformResponse<T> = { result: response.result! };\r\n if (response.diagnostics)\r\n retValue.diagnostics = response.diagnostics;\r\n return retValue;\r\n }\r\n private handleResult<T>(response: IModelJsNative.ECPresentationManagerResponse<T>): NativePlatformResponse<T> {\r\n if (response.error)\r\n throw new PresentationError(this.getStatus(response.error.status), response.error.message);\r\n return this.createSuccessResponse(response);\r\n }\r\n private handleVoidResult(response: IModelJsNative.ECPresentationManagerResponse<void>): NativePlatformResponse<void> {\r\n if (response.error)\r\n throw new PresentationError(this.getStatus(response.error.status), response.error.message);\r\n return this.createSuccessResponse(response);\r\n }\r\n public dispose() {\r\n this._nativeAddon.dispose();\r\n }\r\n public async forceLoadSchemas(db: any): Promise<NativePlatformResponse<void>> {\r\n const response = await this._nativeAddon.forceLoadSchemas(db);\r\n if (response.error)\r\n throw new PresentationError(PresentationStatus.Error, response.error.message);\r\n return this.createSuccessResponse(response);\r\n }\r\n public setupRulesetDirectories(directories: string[]) {\r\n return this.handleVoidResult(this._nativeAddon.setupRulesetDirectories(directories));\r\n }\r\n public setupSupplementalRulesetDirectories(directories: string[]) {\r\n return this.handleVoidResult(this._nativeAddon.setupSupplementalRulesetDirectories(directories));\r\n }\r\n public getImodelAddon(imodel: IModelDb): any {\r\n if (!imodel.nativeDb)\r\n throw new PresentationError(PresentationStatus.InvalidArgument, \"imodel\");\r\n return imodel.nativeDb;\r\n }\r\n public getRulesets(rulesetId: string) {\r\n return this.handleResult(this._nativeAddon.getRulesets(rulesetId));\r\n }\r\n public addRuleset(serializedRulesetJson: string) {\r\n return this.handleResult(this._nativeAddon.addRuleset(serializedRulesetJson));\r\n }\r\n public removeRuleset(rulesetId: string, hash: string) {\r\n return this.handleResult(this._nativeAddon.removeRuleset(rulesetId, hash));\r\n }\r\n public clearRulesets() {\r\n return this.handleVoidResult(this._nativeAddon.clearRulesets());\r\n }\r\n public async handleRequest(db: any, options: string) {\r\n const requestGuid = this.handleResult(this._nativeAddon.queueRequest(db, options)).result;\r\n return new Promise((resolve: (result: NativePlatformResponse<any>) => void, reject) => {\r\n const interval = setInterval(() => {\r\n const pollResult = this._nativeAddon.pollResponse(requestGuid);\r\n if (pollResult.error) {\r\n if (pollResult.error.status !== IModelJsNative.ECPresentationStatus.Pending) {\r\n reject(new PresentationError(this.getStatus(pollResult.error.status), pollResult.error.message));\r\n clearInterval(interval);\r\n }\r\n return; // ignore 'pending' responses\r\n }\r\n resolve(this.createSuccessResponse(pollResult));\r\n clearInterval(interval);\r\n }, 20);\r\n });\r\n }\r\n public getRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes) {\r\n return this.handleResult(this._nativeAddon.getRulesetVariableValue(rulesetId, variableId, type));\r\n }\r\n public setRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes, value: VariableValueJSON) {\r\n return this.handleVoidResult(this._nativeAddon.setRulesetVariableValue(rulesetId, variableId, type, value));\r\n }\r\n public unsetRulesetVariableValue(rulesetId: string, variableId: string) {\r\n return this.handleVoidResult(this._nativeAddon.unsetRulesetVariableValue(rulesetId, variableId));\r\n }\r\n public getUpdateInfo() {\r\n return this.handleResult(this._nativeAddon.getUpdateInfo());\r\n }\r\n public updateHierarchyState(db: any, rulesetId: string, changeType: \"nodesExpanded\" | \"nodesCollapsed\", serializedKeys: string) {\r\n return this.handleResult(this._nativeAddon.updateHierarchyState(db, rulesetId, changeType, serializedKeys));\r\n }\r\n };\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"NativePlatform.js","sourceRoot":"","sources":["../../../src/presentation-backend/NativePlatform.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2E;AAG3E,oEAEoC;AACpC,+DAAoF;AAEpF,gBAAgB;AAChB,IAAY,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E,CAAC,CAAC;YACT,CAAC,CAAC,CAAC;QACL,CAAC;QACM,uBAAuB,CAAC,SAAiB,EAAE,UAAkB,EAAE,IAAwB;YAC5F,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,uBAAuB,CAAC,SAAS,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;QACnG,CAAC;QACM,uBAAuB,CAAC,SAAiB,EAAE,UAAkB,EAAE,IAAwB,EAAE,KAAwB;YACtH,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,uBAAuB,CAAC,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QAC9G,CAAC;QACM,yBAAyB,CAAC,SAAiB,EAAE,UAAkB;YACpE,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,yBAAyB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;QACnG,CAAC;QACM,aAAa;YAClB,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC,CAAC;QAC9D,CAAC;QACM,oBAAoB,CAAC,EAAO,EAAE,SAAiB,EAAE,UAA8C,EAAE,cAAsB;YAC5H,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;QAC9G,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAjHW,QAAA,2BAA2B,+BAiHtC","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 { IModelDb, IModelHost, IModelJsNative } from \"@itwin/core-backend\";\r\nimport { IDisposable } from \"@itwin/core-bentley\";\r\nimport { FormatProps } from \"@itwin/core-quantity\";\r\nimport {\r\n DiagnosticsScopeLogs, NodeKeyJSON, PresentationError, PresentationStatus, UpdateInfoJSON, VariableValue, VariableValueJSON, VariableValueTypes,\r\n} from \"@itwin/presentation-common\";\r\nimport { HierarchyCacheMode, PresentationManagerMode } from \"./PresentationManager\";\r\n\r\n/** @internal */\r\nexport enum NativePlatformRequestTypes {\r\n GetRootNodes = \"GetRootNodes\",\r\n GetRootNodesCount = \"GetRootNodesCount\",\r\n GetChildren = \"GetChildren\",\r\n GetChildrenCount = \"GetChildrenCount\",\r\n GetNodePaths = \"GetNodePaths\",\r\n GetFilteredNodePaths = \"GetFilteredNodePaths\",\r\n GetContentSources = \"GetContentSources\",\r\n GetContentDescriptor = \"GetContentDescriptor\",\r\n GetContentSetSize = \"GetContentSetSize\",\r\n GetContent = \"GetContent\",\r\n GetPagedDistinctValues = \"GetPagedDistinctValues\",\r\n GetDisplayLabel = \"GetDisplayLabel\",\r\n CompareHierarchies = \"CompareHierarchies\",\r\n}\r\n\r\n/**\r\n * Enumeration of unit systems supported by native presentation manager.\r\n * @internal\r\n */\r\nexport enum NativePresentationUnitSystem {\r\n Metric = \"metric\",\r\n BritishImperial = \"british-imperial\",\r\n UsCustomary = \"us-customary\",\r\n UsSurvey = \"us-survey\",\r\n}\r\n\r\n/** @internal */\r\nexport interface NativePresentationDefaultUnitFormats {\r\n [phenomenon: string]: {\r\n unitSystems: NativePresentationUnitSystem[];\r\n format: FormatProps;\r\n };\r\n}\r\n\r\n/** @internal */\r\nexport interface NativePresentationKeySetJSON {\r\n instanceKeys: Array<[string, string[]]>;\r\n nodeKeys: NodeKeyJSON[];\r\n}\r\n\r\n/** @internal */\r\nexport interface NativePlatformResponse<TResult> {\r\n result: TResult;\r\n diagnostics?: DiagnosticsScopeLogs;\r\n}\r\n\r\n/** @internal */\r\nexport interface NativePlatformDefinition extends IDisposable {\r\n getImodelAddon(imodel: IModelDb): any;\r\n\r\n setupRulesetDirectories(directories: string[]): NativePlatformResponse<void>;\r\n setupSupplementalRulesetDirectories(directories: string[]): NativePlatformResponse<void>;\r\n\r\n forceLoadSchemas(db: any): Promise<NativePlatformResponse<void>>;\r\n\r\n getRulesets(rulesetId: string): NativePlatformResponse<string>;\r\n addRuleset(serializedRulesetJson: string): NativePlatformResponse<string>;\r\n removeRuleset(rulesetId: string, hash: string): NativePlatformResponse<boolean>;\r\n clearRulesets(): NativePlatformResponse<void>;\r\n\r\n handleRequest(db: any, options: string): Promise<NativePlatformResponse<string>>;\r\n\r\n getRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes): NativePlatformResponse<VariableValue>;\r\n setRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes, value: VariableValue): NativePlatformResponse<void>;\r\n unsetRulesetVariableValue(rulesetId: string, variableId: string): NativePlatformResponse<void>;\r\n\r\n getUpdateInfo(): NativePlatformResponse<UpdateInfoJSON | undefined>;\r\n updateHierarchyState(db: any, rulesetId: string, changeType: \"nodesExpanded\" | \"nodesCollapsed\", serializedKeys: string): NativePlatformResponse<void>;\r\n}\r\n\r\n/** @internal */\r\nexport interface DefaultNativePlatformProps {\r\n id: string;\r\n localeDirectories: string[];\r\n taskAllocationsMap: { [priority: number]: number };\r\n mode: PresentationManagerMode;\r\n isChangeTrackingEnabled: boolean;\r\n cacheConfig?: IModelJsNative.ECPresentationHierarchyCacheConfig;\r\n contentCacheSize?: number;\r\n defaultFormats?: NativePresentationDefaultUnitFormats;\r\n useMmap?: boolean | number;\r\n}\r\n\r\n/** @internal */\r\nexport const createDefaultNativePlatform = (props: DefaultNativePlatformProps): new () => NativePlatformDefinition => {\r\n // note the implementation is constructed here to make PresentationManager\r\n // usable without loading the actual addon (if addon is set to something other)\r\n return class implements NativePlatformDefinition {\r\n private _nativeAddon: IModelJsNative.ECPresentationManager;\r\n public constructor() {\r\n const mode = (props.mode === PresentationManagerMode.ReadOnly) ? IModelJsNative.ECPresentationManagerMode.ReadOnly : IModelJsNative.ECPresentationManagerMode.ReadWrite;\r\n const cacheConfig = props.cacheConfig ?? { mode: HierarchyCacheMode.Disk, directory: \"\" };\r\n const defaultFormats = props.defaultFormats ? this.getSerializedDefaultFormatsMap(props.defaultFormats) : {};\r\n this._nativeAddon = new IModelHost.platform.ECPresentationManager({ ...props, mode, cacheConfig, defaultFormats });\r\n }\r\n private getStatus(responseStatus: IModelJsNative.ECPresentationStatus): PresentationStatus {\r\n switch (responseStatus) {\r\n case IModelJsNative.ECPresentationStatus.InvalidArgument: return PresentationStatus.InvalidArgument;\r\n case IModelJsNative.ECPresentationStatus.Canceled: return PresentationStatus.Canceled;\r\n default: return PresentationStatus.Error;\r\n }\r\n }\r\n private getSerializedDefaultFormatsMap(defaultMap: NativePresentationDefaultUnitFormats) {\r\n const res: {\r\n [phenomenon: string]: {\r\n unitSystems: string[];\r\n serializedFormat: string;\r\n };\r\n } = {};\r\n Object.keys(defaultMap).forEach((key) => {\r\n const value = defaultMap[key];\r\n res[key] = { unitSystems: value.unitSystems, serializedFormat: JSON.stringify(value.format) };\r\n });\r\n\r\n return res;\r\n }\r\n private createSuccessResponse<T>(response: IModelJsNative.ECPresentationManagerResponse<T>): NativePlatformResponse<T> {\r\n const retValue: NativePlatformResponse<T> = { result: response.result! };\r\n if (response.diagnostics)\r\n retValue.diagnostics = response.diagnostics;\r\n return retValue;\r\n }\r\n private handleResult<T>(response: IModelJsNative.ECPresentationManagerResponse<T>): NativePlatformResponse<T> {\r\n if (response.error)\r\n throw new PresentationError(this.getStatus(response.error.status), response.error.message);\r\n return this.createSuccessResponse(response);\r\n }\r\n private handleVoidResult(response: IModelJsNative.ECPresentationManagerResponse<void>): NativePlatformResponse<void> {\r\n if (response.error)\r\n throw new PresentationError(this.getStatus(response.error.status), response.error.message);\r\n return this.createSuccessResponse(response);\r\n }\r\n public dispose() {\r\n this._nativeAddon.dispose();\r\n }\r\n public async forceLoadSchemas(db: any): Promise<NativePlatformResponse<void>> {\r\n const response = await this._nativeAddon.forceLoadSchemas(db);\r\n if (response.error)\r\n throw new PresentationError(PresentationStatus.Error, response.error.message);\r\n return this.createSuccessResponse(response);\r\n }\r\n public setupRulesetDirectories(directories: string[]) {\r\n return this.handleVoidResult(this._nativeAddon.setupRulesetDirectories(directories));\r\n }\r\n public setupSupplementalRulesetDirectories(directories: string[]) {\r\n return this.handleVoidResult(this._nativeAddon.setupSupplementalRulesetDirectories(directories));\r\n }\r\n public getImodelAddon(imodel: IModelDb): any {\r\n if (!imodel.nativeDb)\r\n throw new PresentationError(PresentationStatus.InvalidArgument, \"imodel\");\r\n return imodel.nativeDb;\r\n }\r\n public getRulesets(rulesetId: string) {\r\n return this.handleResult(this._nativeAddon.getRulesets(rulesetId));\r\n }\r\n public addRuleset(serializedRulesetJson: string) {\r\n return this.handleResult(this._nativeAddon.addRuleset(serializedRulesetJson));\r\n }\r\n public removeRuleset(rulesetId: string, hash: string) {\r\n return this.handleResult(this._nativeAddon.removeRuleset(rulesetId, hash));\r\n }\r\n public clearRulesets() {\r\n return this.handleVoidResult(this._nativeAddon.clearRulesets());\r\n }\r\n public async handleRequest(db: any, options: string) {\r\n const requestGuid = this.handleResult(this._nativeAddon.queueRequest(db, options)).result;\r\n return new Promise((resolve: (result: NativePlatformResponse<any>) => void, reject) => {\r\n const interval = setInterval(() => {\r\n const pollResult = this._nativeAddon.pollResponse(requestGuid);\r\n if (pollResult.error) {\r\n if (pollResult.error.status !== IModelJsNative.ECPresentationStatus.Pending) {\r\n reject(new PresentationError(this.getStatus(pollResult.error.status), pollResult.error.message));\r\n clearInterval(interval);\r\n }\r\n return; // ignore 'pending' responses\r\n }\r\n resolve(this.createSuccessResponse(pollResult));\r\n clearInterval(interval);\r\n }, 20);\r\n });\r\n }\r\n public getRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes) {\r\n return this.handleResult(this._nativeAddon.getRulesetVariableValue(rulesetId, variableId, type));\r\n }\r\n public setRulesetVariableValue(rulesetId: string, variableId: string, type: VariableValueTypes, value: VariableValueJSON) {\r\n return this.handleVoidResult(this._nativeAddon.setRulesetVariableValue(rulesetId, variableId, type, value));\r\n }\r\n public unsetRulesetVariableValue(rulesetId: string, variableId: string) {\r\n return this.handleVoidResult(this._nativeAddon.unsetRulesetVariableValue(rulesetId, variableId));\r\n }\r\n public getUpdateInfo() {\r\n return this.handleResult(this._nativeAddon.getUpdateInfo());\r\n }\r\n public updateHierarchyState(db: any, rulesetId: string, changeType: \"nodesExpanded\" | \"nodesCollapsed\", serializedKeys: string) {\r\n return this.handleResult(this._nativeAddon.updateHierarchyState(db, rulesetId, changeType, serializedKeys));\r\n }\r\n };\r\n};\r\n"]}
|
|
@@ -2,22 +2,34 @@
|
|
|
2
2
|
* @module Core
|
|
3
3
|
*/
|
|
4
4
|
import { PresentationManager, PresentationManagerProps } from "./PresentationManager";
|
|
5
|
+
/**
|
|
6
|
+
* Base props for initializing the [[Presentation]] library.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface PresentationPropsBase extends PresentationManagerProps {
|
|
11
|
+
/**
|
|
12
|
+
* Time in milliseconds after which the request will timeout.
|
|
13
|
+
*/
|
|
14
|
+
requestTimeout?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Should schemas preloading be enabled. If true, [[Presentation]] library listens
|
|
17
|
+
* for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.
|
|
18
|
+
*/
|
|
19
|
+
enableSchemasPreload?: boolean;
|
|
20
|
+
}
|
|
5
21
|
/**
|
|
6
22
|
* Props for initializing the [[Presentation]] library for using multiple [[PresentationManager]]
|
|
7
23
|
* instances, one for each frontend.
|
|
8
24
|
*
|
|
9
25
|
* @public
|
|
10
26
|
*/
|
|
11
|
-
export interface MultiManagerPresentationProps extends
|
|
27
|
+
export interface MultiManagerPresentationProps extends PresentationPropsBase {
|
|
12
28
|
/**
|
|
13
29
|
* Factory method for creating separate managers for each client
|
|
14
30
|
* @internal
|
|
15
31
|
*/
|
|
16
32
|
clientManagerFactory?: (clientId: string, props: PresentationManagerProps) => PresentationManager;
|
|
17
|
-
/**
|
|
18
|
-
* Time in milliseconds after which the request will timeout.
|
|
19
|
-
*/
|
|
20
|
-
requestTimeout?: number;
|
|
21
33
|
/**
|
|
22
34
|
* How much time should an unused client manager be stored in memory
|
|
23
35
|
* before it's disposed.
|
|
@@ -30,12 +42,7 @@ export interface MultiManagerPresentationProps extends PresentationManagerProps
|
|
|
30
42
|
*
|
|
31
43
|
* @public
|
|
32
44
|
*/
|
|
33
|
-
export interface SingleManagerPresentationProps extends
|
|
34
|
-
/**
|
|
35
|
-
* How much time should an unused client manager be stored in memory
|
|
36
|
-
* before it's disposed.
|
|
37
|
-
*/
|
|
38
|
-
requestTimeout?: number;
|
|
45
|
+
export interface SingleManagerPresentationProps extends PresentationPropsBase {
|
|
39
46
|
/**
|
|
40
47
|
* Specifies to use single manager for all clients.
|
|
41
48
|
* @alpha
|
|
@@ -62,6 +69,7 @@ export declare class Presentation {
|
|
|
62
69
|
private static _clientsStorage;
|
|
63
70
|
private static _disposeIpcHandler;
|
|
64
71
|
private static _shutdownListener;
|
|
72
|
+
private static _disposeIModelOpenedListener;
|
|
65
73
|
private static _manager;
|
|
66
74
|
private static _rpcImpl;
|
|
67
75
|
private constructor();
|
|
@@ -70,7 +78,7 @@ export declare class Presentation {
|
|
|
70
78
|
/**
|
|
71
79
|
* Initializes Presentation library for the backend.
|
|
72
80
|
*
|
|
73
|
-
* See [
|
|
81
|
+
* See [Setting up iTwin.js Presentation library documentation page]($docs/presentation/setup/index.md#backend) for an example.
|
|
74
82
|
*
|
|
75
83
|
* **Important:** The method should be called after a call to [IModelHost.startup]($core-backend)
|
|
76
84
|
*
|
|
@@ -94,5 +102,6 @@ export declare class Presentation {
|
|
|
94
102
|
* Get the time in milliseconds that backend should respond in .
|
|
95
103
|
*/
|
|
96
104
|
static getRequestTimeout(): number;
|
|
105
|
+
private static onIModelOpened;
|
|
97
106
|
}
|
|
98
107
|
//# sourceMappingURL=Presentation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Presentation.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/Presentation.ts"],"names":[],"mappings":"AAIA;;GAEG;AAQH,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAMtF;;;;;GAKG;AACH,MAAM,WAAW,6BAA8B,SAAQ,
|
|
1
|
+
{"version":3,"file":"Presentation.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/Presentation.ts"],"names":[],"mappings":"AAIA;;GAEG;AAQH,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAMtF;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,wBAAwB;IACrE;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;;;GAKG;AACH,MAAM,WAAW,6BAA8B,SAAQ,qBAAqB;IAC1E;;;OAGG;IACH,oBAAoB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,wBAAwB,KAAK,mBAAmB,CAAC;IAElG;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,8BAA+B,SAAQ,qBAAqB;IAC3E;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;GAGG;AACH,oBAAY,iBAAiB,GAAG,6BAA6B,GAAG,8BAA8B,CAAC;AAM/F;;;;;;;;;GASG;AACH,qBAAa,YAAY;IAEvB,OAAO,CAAC,MAAM,CAAC,UAAU,CAAgC;IACzD,OAAO,CAAC,MAAM,CAAC,eAAe,CAA4D;IAC1F,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAA0B;IAC3D,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAA0B;IAC1D,OAAO,CAAC,MAAM,CAAC,4BAA4B,CAA0B;IACrE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkC;IACzD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkC;IAGzD,OAAO;IAEP,+DAA+D;IAC/D,WAAkB,SAAS,kCAA8B;IAEzD;;;;;;;;OAQG;WACW,UAAU,CAAC,KAAK,CAAC,EAAE,iBAAiB,GAAG,IAAI;IAkCzD;;;OAGG;WACW,SAAS,IAAI,IAAI;IA4B/B,OAAO,CAAC,MAAM,CAAC,mBAAmB;IASlC,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAInC;;;;OAIG;WACW,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,mBAAmB;IAShE;;OAEG;WACW,iBAAiB,IAAI,MAAM;IAMzC,OAAO,CAAC,MAAM,CAAC,cAAc,CAK3B;CACH"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
/** @packageDocumentation
|
|
7
7
|
* @module Core
|
|
8
8
|
*/
|
|
9
|
+
var _a;
|
|
9
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
11
|
exports.Presentation = void 0;
|
|
11
12
|
const core_backend_1 = require("@itwin/core-backend");
|
|
@@ -36,18 +37,18 @@ class Presentation {
|
|
|
36
37
|
/**
|
|
37
38
|
* Initializes Presentation library for the backend.
|
|
38
39
|
*
|
|
39
|
-
* See [
|
|
40
|
+
* See [Setting up iTwin.js Presentation library documentation page]($docs/presentation/setup/index.md#backend) for an example.
|
|
40
41
|
*
|
|
41
42
|
* **Important:** The method should be called after a call to [IModelHost.startup]($core-backend)
|
|
42
43
|
*
|
|
43
44
|
* @param props Optional properties for [[PresentationManager]]
|
|
44
45
|
*/
|
|
45
46
|
static initialize(props) {
|
|
46
|
-
var
|
|
47
|
+
var _b, _c;
|
|
47
48
|
this._initProps = props || {};
|
|
48
49
|
this._shutdownListener = core_backend_1.IModelHost.onBeforeShutdown.addListener(() => Presentation.terminate());
|
|
49
50
|
this._rpcImpl = new PresentationRpcImpl_1.PresentationRpcImpl({
|
|
50
|
-
requestTimeout: (
|
|
51
|
+
requestTimeout: (_b = this._initProps.requestTimeout) !== null && _b !== void 0 ? _b : defaultRequestTimeout,
|
|
51
52
|
});
|
|
52
53
|
core_common_1.RpcManager.registerImpl(presentation_common_1.PresentationRpcInterface, PresentationRpcImpl_1.PresentationRpcImpl);
|
|
53
54
|
core_common_1.RpcManager.supplyImplInstance(presentation_common_1.PresentationRpcInterface, this._rpcImpl);
|
|
@@ -64,12 +65,14 @@ class Presentation {
|
|
|
64
65
|
// cleanup unused managers every minute
|
|
65
66
|
cleanupInterval: 60 * 1000,
|
|
66
67
|
// by default, manager is disposed after 1 hour of being unused
|
|
67
|
-
unusedValueLifetime: (
|
|
68
|
+
unusedValueLifetime: (_c = this._initProps.unusedClientLifetime) !== null && _c !== void 0 ? _c : 60 * 60 * 1000,
|
|
68
69
|
// add some logging
|
|
69
70
|
onDisposedSingle: /* istanbul ignore next */ (id) => core_bentley_1.Logger.logInfo(BackendLoggerCategory_1.PresentationBackendLoggerCategory.PresentationManager, `Disposed PresentationManager instance with ID: ${id}. Total instances: ${this._clientsStorage.values.length}.`),
|
|
70
71
|
onDisposedAll: /* istanbul ignore next */ () => core_bentley_1.Logger.logInfo(BackendLoggerCategory_1.PresentationBackendLoggerCategory.PresentationManager, `Disposed all PresentationManager instances.`),
|
|
71
72
|
});
|
|
72
73
|
}
|
|
74
|
+
if (this._initProps.enableSchemasPreload)
|
|
75
|
+
this._disposeIModelOpenedListener = core_backend_1.BriefcaseDb.onOpened.addListener(this.onIModelOpened);
|
|
73
76
|
}
|
|
74
77
|
/**
|
|
75
78
|
* Terminates Presentation. Consumers don't need to call this as it's automatically
|
|
@@ -80,6 +83,10 @@ class Presentation {
|
|
|
80
83
|
this._clientsStorage.dispose();
|
|
81
84
|
this._clientsStorage = undefined;
|
|
82
85
|
}
|
|
86
|
+
if (this._disposeIModelOpenedListener) {
|
|
87
|
+
this._disposeIModelOpenedListener();
|
|
88
|
+
this._disposeIModelOpenedListener = undefined;
|
|
89
|
+
}
|
|
83
90
|
if (this._shutdownListener) {
|
|
84
91
|
this._shutdownListener();
|
|
85
92
|
this._shutdownListener = undefined;
|
|
@@ -131,6 +138,13 @@ class Presentation {
|
|
|
131
138
|
}
|
|
132
139
|
}
|
|
133
140
|
exports.Presentation = Presentation;
|
|
141
|
+
_a = Presentation;
|
|
142
|
+
Presentation.onIModelOpened = (imodel) => {
|
|
143
|
+
const manager = _a.getManager();
|
|
144
|
+
const imodelAddon = manager.getNativePlatform().getImodelAddon(imodel);
|
|
145
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
146
|
+
manager.getNativePlatform().forceLoadSchemas(imodelAddon);
|
|
147
|
+
};
|
|
134
148
|
function isSingleManagerProps(props) {
|
|
135
149
|
return !!props.useSingleManager;
|
|
136
150
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../../src/presentation-backend/Presentation.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA0D;AAC1D,sDAA0D;AAC1D,oDAAgD;AAChD,oEAA6G;AAC7G,mEAA4E;AAC5E,qEAAkE;AAClE,+DAAsF;AACtF,+DAA4D;AAC5D,yDAAkE;AAElE,MAAM,qBAAqB,GAAW,KAAK,CAAC;AAyD5C;;;;;;;;;GASG;AACH,MAAa,YAAY;IASvB,0BAA0B;IAC1B,gBAAwB,CAAC;IAEzB,+DAA+D;IACxD,MAAM,KAAK,SAAS,KAAK,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAEzD;;;;;;;;OAQG;IACI,MAAM,CAAC,UAAU,CAAC,KAAyB;;QAChD,IAAI,CAAC,UAAU,GAAG,KAAK,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,iBAAiB,GAAG,yBAAU,CAAC,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uBAAuB,CAAC,aAAa,CAAC,CAAC;QAC/C,qBAAM,CAAC,OAAO,CAAC,yDAAiC,CAAC,mBAAmB,EAAE,mDAAmD,QAAQ,sBAAsB,IAAI,CAAC,eAAgB,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QAC/L,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,UAAU,IAAI,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,QAAQ;YAC3E,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,IAAI,IAAI,CAAC,eAAe;YACtB,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC;QAE/D,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;YAC7B,MAAM,IAAI,uCAAiB,CAAC,wCAAkB,CAAC,cAAc,EAAE,2EAA2E,CAAC,CAAC;QAC9I,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;IACtC,CAAC;CACF;AAtHD,oCAsHC;AAED,SAAS,oBAAoB,CAAC,KAAwB;IACpD,OAAO,CAAC,CAAE,KAAwC,CAAC,gBAAgB,CAAC;AACtE,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 { 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\nconst defaultRequestTimeout: number = 90000;\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 */\r\nexport interface MultiManagerPresentationProps extends PresentationManagerProps {\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 * Time in milliseconds after which the request will timeout.\r\n */\r\n requestTimeout?: number;\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 with ability to use a single\r\n * [[PresentationManager]] instance for handling all requests.\r\n *\r\n * @public\r\n */\r\nexport interface SingleManagerPresentationProps extends PresentationManagerProps {\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 requestTimeout?: number;\r\n\r\n /**\r\n * Specifies to use single manager for all clients.\r\n * @alpha\r\n */\r\n useSingleManager?: boolean;\r\n}\r\n\r\n/**\r\n * Properties that can be used to configure [[Presentation]] API\r\n * @public\r\n */\r\nexport type PresentationProps = MultiManagerPresentationProps | SingleManagerPresentationProps;\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\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 _manager: PresentationManager | 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() { return this._initProps; }\r\n\r\n /**\r\n * Initializes Presentation library for the backend.\r\n *\r\n * See [this]($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 ?? defaultRequestTimeout,\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 if (isSingleManagerProps(this._initProps)) {\r\n this._manager = new PresentationManager(Presentation._initProps);\r\n } else {\r\n this._clientsStorage = new FactoryBasedTemporaryStorage<ClientStoreItem>({\r\n factory: this.createClientManager.bind(this),\r\n cleanupHandler: this.disposeClientManager,\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) => Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Disposed PresentationManager instance with ID: ${id}. Total instances: ${this._clientsStorage!.values.length}.`),\r\n onDisposedAll: /* istanbul ignore next */() => Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Disposed all PresentationManager instances.`),\r\n });\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._shutdownListener) {\r\n this._shutdownListener();\r\n this._shutdownListener = undefined;\r\n }\r\n if (this._manager) {\r\n this._manager.dispose();\r\n this._manager = 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 = (Presentation._initProps && !isSingleManagerProps(Presentation._initProps) && Presentation._initProps.clientManagerFactory)\r\n ? Presentation._initProps.clientManagerFactory(clientId, Presentation._initProps)\r\n : new PresentationManager(Presentation._initProps);\r\n manager.setOnManagerUsedHandler(onManagerUsed);\r\n Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Created a PresentationManager instance with ID: ${clientId}. Total instances: ${this._clientsStorage!.values.length}.`);\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._initProps && isSingleManagerProps(this._initProps) && this._manager)\r\n return this._manager;\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 return this._rpcImpl.requestTimeout;\r\n }\r\n}\r\n\r\nfunction isSingleManagerProps(props: PresentationProps): props is SingleManagerPresentationProps {\r\n return !!(props as SingleManagerPresentationProps).useSingleManager;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../../src/presentation-backend/Presentation.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;AAEH,sDAAuE;AACvE,sDAA0D;AAC1D,oDAAgD;AAChD,oEAA6G;AAC7G,mEAA4E;AAC5E,qEAAkE;AAClE,+DAAsF;AACtF,+DAA4D;AAC5D,yDAAkE;AAElE,MAAM,qBAAqB,GAAW,KAAK,CAAC;AAgE5C;;;;;;;;;GASG;AACH,MAAa,YAAY;IAUvB,0BAA0B;IAC1B,gBAAwB,CAAC;IAEzB,+DAA+D;IACxD,MAAM,KAAK,SAAS,KAAK,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAEzD;;;;;;;;OAQG;IACI,MAAM,CAAC,UAAU,CAAC,KAAyB;;QAChD,IAAI,CAAC,UAAU,GAAG,KAAK,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,iBAAiB,GAAG,yBAAU,CAAC,gBAAgB,CAAC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;;AA7HH,oCAqIC;;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,CAAE,CAAA;AAGJ,SAAS,oBAAoB,CAAC,KAAwB;IACpD,OAAO,CAAC,CAAE,KAAwC,CAAC,gBAAgB,CAAC;AACtE,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 { 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\nconst defaultRequestTimeout: number = 90000;\r\n\r\n/**\r\n * Base props for initializing the [[Presentation]] library.\r\n *\r\n * @public\r\n */\r\nexport interface PresentationPropsBase 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/**\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 */\r\nexport interface MultiManagerPresentationProps extends PresentationPropsBase {\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 with ability to use a single\r\n * [[PresentationManager]] instance for handling all requests.\r\n *\r\n * @public\r\n */\r\nexport interface SingleManagerPresentationProps extends PresentationPropsBase {\r\n /**\r\n * Specifies to use single manager for all clients.\r\n * @alpha\r\n */\r\n useSingleManager?: boolean;\r\n}\r\n\r\n/**\r\n * Properties that can be used to configure [[Presentation]] API\r\n * @public\r\n */\r\nexport type PresentationProps = MultiManagerPresentationProps | SingleManagerPresentationProps;\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\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 _manager: PresentationManager | 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() { return this._initProps; }\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 ?? defaultRequestTimeout,\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 if (isSingleManagerProps(this._initProps)) {\r\n this._manager = new PresentationManager(Presentation._initProps);\r\n } else {\r\n this._clientsStorage = new FactoryBasedTemporaryStorage<ClientStoreItem>({\r\n factory: this.createClientManager.bind(this),\r\n cleanupHandler: this.disposeClientManager,\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) => Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Disposed PresentationManager instance with ID: ${id}. Total instances: ${this._clientsStorage!.values.length}.`),\r\n onDisposedAll: /* istanbul ignore next */() => Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Disposed all PresentationManager instances.`),\r\n });\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 * 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 if (this._manager) {\r\n this._manager.dispose();\r\n this._manager = 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 = (Presentation._initProps && !isSingleManagerProps(Presentation._initProps) && Presentation._initProps.clientManagerFactory)\r\n ? Presentation._initProps.clientManagerFactory(clientId, Presentation._initProps)\r\n : new PresentationManager(Presentation._initProps);\r\n manager.setOnManagerUsedHandler(onManagerUsed);\r\n Logger.logInfo(PresentationBackendLoggerCategory.PresentationManager, `Created a PresentationManager instance with ID: ${clientId}. Total instances: ${this._clientsStorage!.values.length}.`);\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._initProps && isSingleManagerProps(this._initProps) && this._manager)\r\n return this._manager;\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 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\r\nfunction isSingleManagerProps(props: PresentationProps): props is SingleManagerPresentationProps {\r\n return !!(props as SingleManagerPresentationProps).useSingleManager;\r\n}\r\n"]}
|
|
@@ -196,6 +196,8 @@ export interface PresentationManagerProps {
|
|
|
196
196
|
/**
|
|
197
197
|
* Should schemas preloading be enabled. If true, presentation manager listens
|
|
198
198
|
* for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.
|
|
199
|
+
*
|
|
200
|
+
* @deprecated Use [[PresentationPropsBase.enableSchemasPreload]] instead.
|
|
199
201
|
*/
|
|
200
202
|
enableSchemasPreload?: boolean;
|
|
201
203
|
/**
|
|
@@ -258,7 +260,6 @@ export declare class PresentationManager {
|
|
|
258
260
|
private _nativePlatform?;
|
|
259
261
|
private _rulesets;
|
|
260
262
|
private _isDisposed;
|
|
261
|
-
private _disposeIModelOpenedListener?;
|
|
262
263
|
private _updatesTracker?;
|
|
263
264
|
private _onManagerUsed?;
|
|
264
265
|
/** Get / set active locale used for localizing presentation data */
|
|
@@ -287,7 +288,6 @@ export declare class PresentationManager {
|
|
|
287
288
|
* @param rulesetId Id of the ruleset to get variables manager for
|
|
288
289
|
*/
|
|
289
290
|
vars(rulesetId: string): RulesetVariablesManager;
|
|
290
|
-
private onIModelOpened;
|
|
291
291
|
/** @internal */
|
|
292
292
|
getNativePlatform: () => NativePlatformDefinition;
|
|
293
293
|
private setupRulesetDirectories;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,
|
|
1
|
+
{"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,QAAQ,EAA2B,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EACL,OAAO,EAAE,+BAA+B,EAAgB,qBAAqB,EAAE,4BAA4B,EAA8B,UAAU,EACnJ,mBAAmB,EAAiC,0BAA0B,EAAE,2BAA2B,EAAE,iBAAiB,EAC9H,4BAA4B,EAAE,iBAAiB,EAAmC,4CAA4C,EAC9H,mCAAmC,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,WAAW,EAC1E,MAAM,EAAE,eAAe,EAAE,oCAAoC,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAClJ,aAAa,EAAyC,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,4BAA4B,EACzI,qCAAqC,EACtC,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACwB,wBAAwB,EACrD,4BAA4B,EAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAsB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAA+B,MAAM,2BAA2B,CAAC;AAKjG;;;GAGG;AACH,oBAAY,uBAAuB;IACjC;;;OAGG;IACH,QAAQ,IAAA;IAER;;;OAGG;IACH,SAAS,IAAA;CACV;AAED;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B;;OAEG;IACH,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WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAwB3J;;;OAGG;IACU,kBAAkB,CAAC,eAAe,EAAE,4BAA4B,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAInH;;;OAGG;IACU,gBAAgB,CAAC,cAAc,EAAE,4BAA4B,CAAC,QAAQ,CAAC,GAAG;QAAE,GAAG,EAAE,UAAU,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;YAKjI,OAAO;IA0BrB;;;OAGG;IACU,kBAAkB,CAAC,cAAc,EAAE,uBAAuB,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAyB3H;AA2BD,gBAAgB;AAChB,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,0BAA0B,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,GAAG,4BAA4B,CAsBpK"}
|
|
@@ -90,12 +90,6 @@ class PresentationManager {
|
|
|
90
90
|
*/
|
|
91
91
|
constructor(props) {
|
|
92
92
|
var _a, _b, _c, _d, _e;
|
|
93
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
94
|
-
this.onIModelOpened = (imodel) => {
|
|
95
|
-
const imodelAddon = this.getNativePlatform().getImodelAddon(imodel);
|
|
96
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
97
|
-
this.getNativePlatform().forceLoadSchemas(imodelAddon);
|
|
98
|
-
};
|
|
99
93
|
/** @internal */
|
|
100
94
|
this.getNativePlatform = () => {
|
|
101
95
|
if (this._isDisposed)
|
|
@@ -129,8 +123,6 @@ class PresentationManager {
|
|
|
129
123
|
this.activeUnitSystem = props.defaultUnitSystem;
|
|
130
124
|
}
|
|
131
125
|
this._rulesets = new RulesetManager_1.RulesetManagerImpl(this.getNativePlatform);
|
|
132
|
-
if (this._props.enableSchemasPreload)
|
|
133
|
-
this._disposeIModelOpenedListener = core_backend_1.BriefcaseDb.onOpened.addListener(this.onIModelOpened);
|
|
134
126
|
if (core_backend_1.IpcHost.isValid && isChangeTrackingEnabled) {
|
|
135
127
|
this._updatesTracker = UpdatesTracker_1.UpdatesTracker.create({
|
|
136
128
|
nativePlatformGetter: this.getNativePlatform,
|
|
@@ -146,8 +138,6 @@ class PresentationManager {
|
|
|
146
138
|
this.getNativePlatform().dispose();
|
|
147
139
|
this._nativePlatform = undefined;
|
|
148
140
|
}
|
|
149
|
-
if (this._disposeIModelOpenedListener)
|
|
150
|
-
this._disposeIModelOpenedListener();
|
|
151
141
|
if (this._updatesTracker) {
|
|
152
142
|
this._updatesTracker.dispose();
|
|
153
143
|
this._updatesTracker = undefined;
|
|
@@ -571,7 +561,7 @@ const createContentDescriptorOverrides = (descriptorOrOverrides) => {
|
|
|
571
561
|
return descriptorOrOverrides;
|
|
572
562
|
};
|
|
573
563
|
const createLocaleDirectoryList = (props) => {
|
|
574
|
-
const localeDirectories = [(0,
|
|
564
|
+
const localeDirectories = [(0, Utils_1.getLocalesDirectory)(getPresentationCommonAssetsRoot(props === null || props === void 0 ? void 0 : props.presentationAssetsRoot))];
|
|
575
565
|
if (props && props.localeDirectories) {
|
|
576
566
|
props.localeDirectories.forEach((dir) => {
|
|
577
567
|
if (-1 === localeDirectories.indexOf(dir))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,kDAAoC;AACpC,2CAA6B;AAC7B,sDAAqF;AAGrF,oEAQoC;AACpC,2CAAgG;AAChG,uEAAyG;AACzG,qDAG0B;AAC1B,qDAAsE;AACtE,uEAAiG;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------------------------------------------------------------------------------------\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 * as hash from \"object-hash\";\r\nimport * as path from \"path\";\r\nimport { BriefcaseDb, IModelDb, IModelJsNative, IpcHost } from \"@itwin/core-backend\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { FormatProps, UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport {\r\n Content, ContentDescriptorRequestOptions, ContentFlags, ContentRequestOptions, ContentSourcesRequestOptions, DefaultContentDisplayTypes, Descriptor,\r\n DescriptorOverrides, DiagnosticsOptionsWithHandler, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup,\r\n DistinctValuesRequestOptions, ElementProperties, ElementPropertiesRequestOptions, FilterByInstancePathsHierarchyRequestOptions,\r\n FilterByTextHierarchyRequestOptions, getLocalesDirectory, HierarchyCompareInfo, HierarchyCompareOptions, HierarchyRequestOptions, InstanceKey,\r\n isSingleElementPropertiesRequestOptions, Key, KeySet, LabelDefinition, MultiElementPropertiesRequestOptions, Node, NodeKey, NodePathElement, Paged,\r\n PagedResponse, PresentationError, PresentationStatus, Prioritized, Ruleset, SelectClassInfo, SelectionScope, SelectionScopeRequestOptions,\r\n SingleElementPropertiesRequestOptions,\r\n} from \"@itwin/presentation-common\";\r\nimport { PRESENTATION_BACKEND_ASSETS_ROOT, PRESENTATION_COMMON_ASSETS_ROOT } from \"./Constants\";\r\nimport { buildElementsProperties, getElementsCount, iterateElementIds } from \"./ElementPropertiesHelper\";\r\nimport {\r\n createDefaultNativePlatform, NativePlatformDefinition, NativePlatformRequestTypes, NativePresentationDefaultUnitFormats,\r\n NativePresentationKeySetJSON, NativePresentationUnitSystem,\r\n} from \"./NativePlatform\";\r\nimport { RulesetManager, RulesetManagerImpl } from \"./RulesetManager\";\r\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager\";\r\nimport { SelectionScopesHelper } from \"./SelectionScopesHelper\";\r\nimport { UpdatesTracker } from \"./UpdatesTracker\";\r\nimport { getElementKey } from \"./Utils\";\r\n\r\n/**\r\n * Presentation manager working mode.\r\n * @public\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 * @beta\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 Hybrid = \"hybrid\",\r\n}\r\n\r\n/**\r\n * Configuration for hierarchy cache.\r\n * @beta\r\n */\r\nexport type HierarchyCacheConfig = MemoryHierarchyCacheConfig | DiskHierarchyCacheConfig | HybridCacheConfig;\r\n\r\n/**\r\n * Base interface for all [[HierarchyCacheConfig]] implementations.\r\n * @beta\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 * @beta\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 * @beta\r\n */\r\nexport interface DiskHierarchyCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Disk;\r\n\r\n /**\r\n * A directory for Presentation hierarchy cache. If set, the directory must exist.\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/**\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 * @beta\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 * @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 * @alpha\r\n */\r\n size?: 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 */\r\nexport interface UnitSystemFormat {\r\n unitSystems: UnitSystemKey[];\r\n format: FormatProps;\r\n}\r\n\r\n/**\r\n * Data structure for multiple element properties request response.\r\n * @alpha\r\n */\r\nexport interface MultiElementPropertiesResponse {\r\n total: number;\r\n iterator: () => AsyncGenerator<ElementProperties[]>;\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 assets. Need to be overriden by application if it puts these assets someplace else than the default.\r\n *\r\n * By default paths to asset directories are determined during the call of [[Presentation.initialize]] using this algorithm:\r\n *\r\n * - for `presentation-backend` assets:\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 * - for `presentation-common` assets:\r\n *\r\n * - if path of `.js` files of `presentation-common` package contain \"presentation-common\", assume the package is in `node_modules` and the directory structure is:\r\n * - `assets/*\\*\\/*`\r\n * - `presentation-common/{presentation-common source files}`\r\n *\r\n * which means the assets can be found through a relative path `../assets/` from the package's source files.\r\n *\r\n * - in both cases, if we determine that source files are not in `node_modules`, 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 * The overrides can be specified as a single path (when assets of both `presentation-backend` and `presentation-common` packages are merged into a single directory) or as an object with two separate paths for each package.\r\n */\r\n presentationAssetsRoot?: string | {\r\n /** Path to `presentation-backend` assets */\r\n backend: string;\r\n /** Path to `presentation-common` assets */\r\n common: string;\r\n };\r\n\r\n /**\r\n * A list of directories containing application's presentation rulesets.\r\n */\r\n rulesetDirectories?: string[];\r\n\r\n /**\r\n * A list of directories containing application's supplemental presentation rulesets.\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 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 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?: {\r\n [phenomenon: string]: UnitSystemFormat;\r\n };\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 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 mode?: PresentationManagerMode;\r\n\r\n /**\r\n * The interval (in milliseconds) used to poll for presentation data changes. Only has\r\n * effect in read-write mode (see [[mode]]).\r\n *\r\n * @alpha\r\n */\r\n updatesPollInterval?: number;\r\n\r\n /** Options for caching. */\r\n caching?: {\r\n /**\r\n * Hierarchies-related caching options.\r\n * @beta\r\n */\r\n hierarchies?: HierarchyCacheConfig;\r\n\r\n /** Content-related caching options. */\r\n content?: ContentCacheConfig;\r\n };\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 * @alpha\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/**\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\r\n private _props: PresentationManagerProps;\r\n private _nativePlatform?: NativePlatformDefinition;\r\n private _rulesets: RulesetManager;\r\n private _isDisposed: boolean;\r\n private _disposeIModelOpenedListener?: () => void;\r\n private _updatesTracker?: UpdatesTracker;\r\n private _onManagerUsed?: () => void;\r\n\r\n /** Get / set active locale used for localizing presentation data */\r\n public activeLocale: string | undefined;\r\n\r\n /** Get / set active unit system used to format property values with units */\r\n public activeUnitSystem: UnitSystemKey | 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._isDisposed = false;\r\n\r\n const mode = props?.mode ?? PresentationManagerMode.ReadWrite;\r\n const isChangeTrackingEnabled = (mode === PresentationManagerMode.ReadWrite && !!props?.updatesPollInterval);\r\n\r\n if (props && props.addon) {\r\n this._nativePlatform = props.addon;\r\n } else {\r\n const nativePlatformImpl = createDefaultNativePlatform({\r\n id: this._props.id ?? \"\",\r\n localeDirectories: createLocaleDirectoryList(props),\r\n taskAllocationsMap: createTaskAllocationsMap(props),\r\n mode,\r\n isChangeTrackingEnabled,\r\n cacheConfig: createCacheConfig(this._props.caching?.hierarchies),\r\n contentCacheSize: this._props.caching?.content?.size,\r\n defaultFormats: toNativeUnitFormatsMap(this._props.defaultFormats),\r\n useMmap: this._props.useMmap,\r\n });\r\n this._nativePlatform = new nativePlatformImpl();\r\n }\r\n\r\n this.setupRulesetDirectories(props);\r\n if (props) {\r\n this.activeLocale = props.defaultLocale;\r\n this.activeUnitSystem = props.defaultUnitSystem;\r\n }\r\n\r\n this._rulesets = new RulesetManagerImpl(this.getNativePlatform);\r\n\r\n if (this._props.enableSchemasPreload)\r\n this._disposeIModelOpenedListener = BriefcaseDb.onOpened.addListener(this.onIModelOpened);\r\n\r\n if (IpcHost.isValid && isChangeTrackingEnabled) {\r\n this._updatesTracker = UpdatesTracker.create({\r\n nativePlatformGetter: this.getNativePlatform,\r\n pollInterval: props.updatesPollInterval!,\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the presentation manager. Must be called to clean up native resources.\r\n */\r\n public dispose() {\r\n if (this._nativePlatform) {\r\n this.getNativePlatform().dispose();\r\n this._nativePlatform = undefined;\r\n }\r\n\r\n if (this._disposeIModelOpenedListener)\r\n this._disposeIModelOpenedListener();\r\n\r\n if (this._updatesTracker) {\r\n this._updatesTracker.dispose();\r\n this._updatesTracker = undefined;\r\n }\r\n\r\n this._isDisposed = true;\r\n }\r\n\r\n /** @internal */\r\n public setOnManagerUsedHandler(handler: () => void) {\r\n this._onManagerUsed = handler;\r\n }\r\n\r\n /** Properties used to initialize the manager */\r\n public get props() { return this._props; }\r\n\r\n /**\r\n * Get rulesets manager\r\n */\r\n public rulesets(): RulesetManager { return this._rulesets; }\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 // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private onIModelOpened = (imodel: BriefcaseDb) => {\r\n const imodelAddon = this.getNativePlatform().getImodelAddon(imodel);\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.getNativePlatform().forceLoadSchemas(imodelAddon);\r\n };\r\n\r\n /** @internal */\r\n public getNativePlatform = (): NativePlatformDefinition => {\r\n if (this._isDisposed)\r\n throw new PresentationError(PresentationStatus.NotInitialized, \"Attempting to use Presentation manager after disposal\");\r\n return this._nativePlatform!;\r\n };\r\n\r\n private setupRulesetDirectories(props?: PresentationManagerProps) {\r\n const supplementalRulesetDirectories = [path.join(getPresentationBackendAssetsRoot(props?.presentationAssetsRoot), \"supplemental-presentation-rules\")];\r\n if (props && props.supplementalRulesetDirectories) {\r\n props.supplementalRulesetDirectories.forEach((dir) => {\r\n if (-1 === supplementalRulesetDirectories.indexOf(dir))\r\n supplementalRulesetDirectories.push(dir);\r\n });\r\n }\r\n this.getNativePlatform().setupSupplementalRulesetDirectories(supplementalRulesetDirectories);\r\n\r\n const primaryRulesetDirectories = [path.join(getPresentationBackendAssetsRoot(props?.presentationAssetsRoot), \"primary-presentation-rules\")];\r\n if (props && props.rulesetDirectories) {\r\n props.rulesetDirectories.forEach((dir) => {\r\n if (-1 === primaryRulesetDirectories.indexOf(dir))\r\n primaryRulesetDirectories.push(dir);\r\n });\r\n }\r\n this.getNativePlatform().setupRulesetDirectories(primaryRulesetDirectories);\r\n }\r\n\r\n private getRulesetIdObject(rulesetOrId: Ruleset | string): { uniqueId: string, parts: { id: string, hash?: string } } {\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 return { uniqueId: rulesetOrId, parts: { id: rulesetOrId } };\r\n }\r\n\r\n /** @internal */\r\n public getRulesetId(rulesetOrId: Ruleset | string) {\r\n return this.getRulesetIdObject(rulesetOrId).uniqueId;\r\n }\r\n\r\n private ensureRulesetRegistered(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 return rulesetOrId;\r\n }\r\n\r\n /** Registers given ruleset and replaces the ruleset with its ID in the resulting object */\r\n private registerRuleset<TOptions extends { rulesetOrId: Ruleset | string }>(options: TOptions) {\r\n const { rulesetOrId, ...strippedOptions } = options;\r\n const registeredRulesetId = this.ensureRulesetRegistered(rulesetOrId);\r\n return { rulesetId: registeredRulesetId, strippedOptions };\r\n }\r\n\r\n /**\r\n * Retrieves nodes\r\n * @public\r\n */\r\n public async getNodes(requestOptions: Prioritized<Paged<HierarchyRequestOptions<IModelDb, NodeKey>>>): Promise<Node[]> {\r\n const { rulesetId, strippedOptions: { parentKey, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: parentKey ? NativePlatformRequestTypes.GetChildren : NativePlatformRequestTypes.GetRootNodes,\r\n rulesetId,\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return this.request(params, Node.listReviver);\r\n }\r\n\r\n /**\r\n * Retrieves nodes count\r\n * @public\r\n */\r\n public async getNodesCount(requestOptions: Prioritized<HierarchyRequestOptions<IModelDb, NodeKey>>): Promise<number> {\r\n const { rulesetId, strippedOptions: { parentKey, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: parentKey ? NativePlatformRequestTypes.GetChildrenCount : NativePlatformRequestTypes.GetRootNodesCount,\r\n rulesetId,\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return this.request(params);\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(requestOptions: Prioritized<FilterByInstancePathsHierarchyRequestOptions<IModelDb>>): Promise<NodePathElement[]> {\r\n const { rulesetId, strippedOptions: { instancePaths, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetNodePaths,\r\n rulesetId,\r\n ...strippedOptions,\r\n paths: instancePaths.map((p) => p.map((s) => InstanceKey.toJSON(s))),\r\n };\r\n return this.request(params, NodePathElement.listReviver);\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(requestOptions: Prioritized<FilterByTextHierarchyRequestOptions<IModelDb>>): Promise<NodePathElement[]> {\r\n const { rulesetId, strippedOptions } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetFilteredNodePaths,\r\n rulesetId,\r\n ...strippedOptions,\r\n };\r\n return this.request(params, NodePathElement.listReviver);\r\n }\r\n\r\n /** @beta */\r\n public async getContentSources(requestOptions: Prioritized<ContentSourcesRequestOptions<IModelDb>>): 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 this.request(params, reviver);\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(requestOptions: Prioritized<ContentDescriptorRequestOptions<IModelDb, KeySet>>): Promise<Descriptor | undefined> {\r\n const { rulesetId, strippedOptions } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentDescriptor,\r\n rulesetId,\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n };\r\n const reviver = (key: string, value: any) => {\r\n return key === \"\" ? Descriptor.fromJSON(value) : value;\r\n };\r\n return this.request(params, reviver);\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(requestOptions: Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet>>): Promise<number> {\r\n const { rulesetId, strippedOptions: { descriptor, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentSetSize,\r\n rulesetId,\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n return this.request(params);\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(requestOptions: Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet>>>): Promise<Content | undefined> {\r\n const { rulesetId, strippedOptions: { descriptor, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContent,\r\n rulesetId,\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n return this.request(params, Content.reviver);\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(requestOptions: Prioritized<DistinctValuesRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet>>): Promise<PagedResponse<DisplayValueGroup>> {\r\n const { rulesetId, strippedOptions } = this.registerRuleset(requestOptions);\r\n const { descriptor, keys, ...strippedOptionsNoDescriptorAndKeys } = strippedOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetPagedDistinctValues,\r\n rulesetId,\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 total: value.total,\r\n items: value.items.map(DisplayValueGroup.fromJSON),\r\n } : value;\r\n };\r\n return this.request(params, reviver);\r\n }\r\n\r\n /**\r\n * Retrieves property data in a simplified format for a single element specified by ID.\r\n * @beta\r\n */\r\n public async getElementProperties(requestOptions: Prioritized<SingleElementPropertiesRequestOptions<IModelDb>>): Promise<ElementProperties | 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 * @alpha\r\n */\r\n public async getElementProperties(requestOptions: Prioritized<MultiElementPropertiesRequestOptions<IModelDb>>): Promise<MultiElementPropertiesResponse>;\r\n public async getElementProperties(requestOptions: Prioritized<ElementPropertiesRequestOptions<IModelDb>>): Promise<ElementProperties | undefined | MultiElementPropertiesResponse> {\r\n if (isSingleElementPropertiesRequestOptions(requestOptions)) {\r\n const { elementId, ...optionsNoElementId } = requestOptions;\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 const properties = buildElementsProperties(content);\r\n return properties[0];\r\n }\r\n\r\n return this.getMultipleElementProperties(requestOptions);\r\n }\r\n\r\n private async getMultipleElementProperties(requestOptions: Prioritized<MultiElementPropertiesRequestOptions<IModelDb>>): Promise<MultiElementPropertiesResponse> {\r\n const { elementClasses, ...optionsNoElementClasses } = requestOptions;\r\n const elementsCount = getElementsCount(requestOptions.imodel, requestOptions.elementClasses);\r\n\r\n const propertiesGetter = async (className: string, ids: string[]) => buildElementsPropertiesInPages(className, ids, async (keys) => {\r\n const content = await this.getContent({\r\n ...optionsNoElementClasses,\r\n descriptor: {\r\n displayType: DefaultContentDisplayTypes.PropertyPane,\r\n contentFlags: ContentFlags.ShowLabels,\r\n },\r\n rulesetOrId: \"ElementProperties\",\r\n keys,\r\n });\r\n return buildElementsProperties(content);\r\n });\r\n\r\n const ELEMENT_IDS_BATCH_SIZE = 1000;\r\n return {\r\n total: elementsCount,\r\n async *iterator() {\r\n for (const idsByClass of iterateElementIds(requestOptions.imodel, elementClasses, ELEMENT_IDS_BATCH_SIZE)) {\r\n const propertiesPage: ElementProperties[] = [];\r\n for (const entry of idsByClass) {\r\n propertiesPage.push(...(await propertiesGetter(entry[0], entry[1])));\r\n }\r\n yield propertiesPage;\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(requestOptions: Prioritized<DisplayLabelRequestOptions<IModelDb, InstanceKey>>): Promise<LabelDefinition> {\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetDisplayLabel,\r\n ...requestOptions,\r\n key: InstanceKey.toJSON(requestOptions.key),\r\n };\r\n return this.request(params, LabelDefinition.reviver);\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(requestOptions: Prioritized<Paged<DisplayLabelsRequestOptions<IModelDb, InstanceKey>>>): Promise<LabelDefinition[]> {\r\n const concreteKeys = requestOptions.keys.map((k) => {\r\n if (k.className === \"BisCore:Element\")\r\n return getElementKey(requestOptions.imodel, k.id);\r\n return k;\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 return item.label;\r\n });\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>): 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 */\r\n public async computeSelection(requestOptions: SelectionScopeRequestOptions<IModelDb> & { ids: Id64String[], scopeId: string }): Promise<KeySet> {\r\n const { ids, scopeId, ...opts } = requestOptions; // eslint-disable-line @typescript-eslint/no-unused-vars\r\n return SelectionScopesHelper.computeSelection(opts, ids, scopeId);\r\n }\r\n\r\n private async request<TParams extends { diagnostics?: DiagnosticsOptionsWithHandler, requestId: string, imodel: IModelDb, locale?: string, unitSystem?: UnitSystemKey }, TResult>(params: TParams, reviver?: (key: string, value: any) => any): Promise<TResult> {\r\n const { requestId, imodel, locale, unitSystem, diagnostics, ...strippedParams } = params;\r\n if (this._onManagerUsed)\r\n this._onManagerUsed();\r\n const imodelAddon = this.getNativePlatform().getImodelAddon(imodel);\r\n const nativeRequestParams: any = {\r\n requestId,\r\n params: {\r\n locale: normalizeLocale(locale ?? this.activeLocale),\r\n unitSystem: toOptionalNativeUnitSystem(unitSystem ?? this.activeUnitSystem),\r\n ...strippedParams,\r\n },\r\n };\r\n\r\n let diagnosticsListener;\r\n if (diagnostics) {\r\n const { handler: tempDiagnosticsListener, ...diagnosticsOptions } = diagnostics;\r\n diagnosticsListener = tempDiagnosticsListener;\r\n nativeRequestParams.params.diagnostics = diagnosticsOptions;\r\n }\r\n\r\n const response = await this.getNativePlatform().handleRequest(imodelAddon, JSON.stringify(nativeRequestParams));\r\n diagnosticsListener && response.diagnostics && diagnosticsListener([response.diagnostics]);\r\n return JSON.parse(response.result, reviver);\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 const { strippedOptions: { prev, rulesetVariables, ...options } } = this.registerRuleset(requestOptions);\r\n\r\n const currRulesetId = this.getRulesetIdObject(requestOptions.rulesetOrId);\r\n const prevRulesetId = prev.rulesetOrId ? this.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 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 return this.request(params, (key: string, value: any) => ((key === \"\") ? HierarchyCompareInfo.fromJSON(value) : value));\r\n }\r\n}\r\n\r\nfunction addInstanceKey(classInstancesMap: Map<string, Set<string>>, key: InstanceKey) {\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\nfunction 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/** @internal */\r\nexport function getKeysForContentRequest(keys: Readonly<KeySet>, classInstanceKeysProcessor?: (keys: Map<string, Set<string>>) => void): 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 if (Key.isInstanceKey(key))\r\n addInstanceKey(classInstancesMap, key);\r\n });\r\n\r\n if (classInstanceKeysProcessor)\r\n classInstanceKeysProcessor(classInstancesMap);\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 return result;\r\n}\r\n\r\nconst createContentDescriptorOverrides = (descriptorOrOverrides: Descriptor | DescriptorOverrides): DescriptorOverrides => {\r\n if (descriptorOrOverrides instanceof Descriptor)\r\n return descriptorOrOverrides.createDescriptorOverrides();\r\n return descriptorOrOverrides;\r\n};\r\n\r\nconst createLocaleDirectoryList = (props?: PresentationManagerProps) => {\r\n const localeDirectories = [getLocalesDirectory(getPresentationCommonAssetsRoot(props?.presentationAssetsRoot))];\r\n if (props && props.localeDirectories) {\r\n props.localeDirectories.forEach((dir) => {\r\n if (-1 === localeDirectories.indexOf(dir))\r\n localeDirectories.push(dir);\r\n });\r\n }\r\n return localeDirectories;\r\n};\r\n\r\nconst createTaskAllocationsMap = (props?: PresentationManagerProps) => {\r\n const count = props?.workerThreadsCount ?? 2;\r\n return {\r\n [Number.MAX_SAFE_INTEGER]: count,\r\n };\r\n};\r\n\r\nconst normalizeLocale = (locale?: string) => {\r\n if (!locale)\r\n return undefined;\r\n return locale.toLocaleLowerCase();\r\n};\r\n\r\nconst normalizeDirectory = (directory?: string) => {\r\n return directory ? path.resolve(directory) : \"\";\r\n};\r\n\r\nconst toNativeUnitSystem = (unitSystem: UnitSystemKey) => {\r\n switch (unitSystem) {\r\n case \"imperial\": return NativePresentationUnitSystem.BritishImperial;\r\n case \"metric\": return NativePresentationUnitSystem.Metric;\r\n case \"usCustomary\": return NativePresentationUnitSystem.UsCustomary;\r\n case \"usSurvey\": return NativePresentationUnitSystem.UsSurvey;\r\n }\r\n};\r\n\r\nconst toOptionalNativeUnitSystem = (unitSystem: UnitSystemKey | undefined) => {\r\n return unitSystem ? toNativeUnitSystem(unitSystem) : undefined;\r\n};\r\n\r\nconst toNativeUnitFormatsMap = (map: { [phenomenon: string]: UnitSystemFormat } | undefined) => {\r\n if (!map)\r\n return undefined;\r\n\r\n const nativeFormatsMap: NativePresentationDefaultUnitFormats = {};\r\n Object.keys(map).forEach((phenomenon) => {\r\n const unitSystemsFormat = map[phenomenon];\r\n nativeFormatsMap[phenomenon] = {\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\nconst createCacheConfig = (config?: HierarchyCacheConfig): IModelJsNative.ECPresentationHierarchyCacheConfig => {\r\n if (config?.mode === HierarchyCacheMode.Disk)\r\n return { ...config, directory: normalizeDirectory(config.directory) };\r\n if (config?.mode === HierarchyCacheMode.Hybrid)\r\n return { ...config, disk: config.disk ? { ...config.disk, directory: normalizeDirectory(config.disk.directory) } : undefined };\r\n if (config?.mode === HierarchyCacheMode.Memory)\r\n return config;\r\n return { mode: HierarchyCacheMode.Disk, directory: \"\" };\r\n};\r\n\r\nconst getPresentationBackendAssetsRoot = (ovr?: string | { backend: string }) => {\r\n if (typeof ovr === \"string\")\r\n return ovr;\r\n if (typeof ovr === \"object\")\r\n return ovr.backend;\r\n return PRESENTATION_BACKEND_ASSETS_ROOT;\r\n};\r\n\r\nconst getPresentationCommonAssetsRoot = (ovr?: string | { common: string }) => {\r\n if (typeof ovr === \"string\")\r\n return ovr;\r\n if (typeof ovr === \"object\")\r\n return ovr.common;\r\n return PRESENTATION_COMMON_ASSETS_ROOT;\r\n};\r\n\r\nconst ELEMENT_PROPERTIES_CONTENT_BATCH_SIZE = 100;\r\nasync function buildElementsPropertiesInPages(className: string, ids: string[], getter: (keys: KeySet) => Promise<ElementProperties[]>) {\r\n const elementProperties: ElementProperties[] = [];\r\n const elementIds = [...ids];\r\n while (elementIds.length > 0) {\r\n const idsPage = elementIds.splice(0, ELEMENT_PROPERTIES_CONTENT_BATCH_SIZE);\r\n const keys = new KeySet(idsPage.map((id) => ({ id, className })));\r\n elementProperties.push(...(await getter(keys)));\r\n }\r\n return elementProperties;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,kDAAoC;AACpC,2CAA6B;AAC7B,sDAAwE;AAGxE,oEAQoC;AACpC,2CAAgG;AAChG,uEAAyG;AACzG,qDAG0B;AAC1B,qDAAsE;AACtE,uEAAiG;AACjG,mEAAgE;AAChE,qDAAkD;AAClD,mCAA6D;AAE7D;;;GAGG;AACH,IAAY,uBAYX;AAZD,WAAY,uBAAuB;IACjC;;;OAGG;IACH,6EAAQ,CAAA;IAER;;;OAGG;IACH,+EAAS,CAAA;AACX,CAAC,EAZW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAYlC;AAED;;;GAGG;AACH,IAAY,kBAeX;AAfD,WAAY,kBAAkB;IAC5B;;OAEG;IACH,uCAAiB,CAAA;IACjB;;;OAGG;IACH,mCAAa,CAAA;IACb;;;OAGG;IACH,uCAAiB,CAAA;AACnB,CAAC,EAfW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAe7B;AAyOD;;;;;GAKG;AACH,MAAa,mBAAmB;IAe9B;;;OAGG;IACH,YAAY,KAAgC;;QA8E5C,gBAAgB;QACT,sBAAiB,GAAG,GAA6B,EAAE;YACxD,IAAI,IAAI,CAAC,WAAW;gBAClB,MAAM,IAAI,uCAAiB,C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,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjD;IACD,OAAO,iBAAiB,CAAC;AAC3B,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 * as hash from \"object-hash\";\r\nimport * as path from \"path\";\r\nimport { IModelDb, IModelJsNative, IpcHost } from \"@itwin/core-backend\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { FormatProps, UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport {\r\n Content, ContentDescriptorRequestOptions, ContentFlags, ContentRequestOptions, ContentSourcesRequestOptions, DefaultContentDisplayTypes, Descriptor,\r\n DescriptorOverrides, DiagnosticsOptionsWithHandler, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup,\r\n DistinctValuesRequestOptions, ElementProperties, ElementPropertiesRequestOptions, FilterByInstancePathsHierarchyRequestOptions,\r\n FilterByTextHierarchyRequestOptions, HierarchyCompareInfo, HierarchyCompareOptions, HierarchyRequestOptions, InstanceKey,\r\n isSingleElementPropertiesRequestOptions, Key, KeySet, LabelDefinition, MultiElementPropertiesRequestOptions, Node, NodeKey, NodePathElement, Paged,\r\n PagedResponse, PresentationError, PresentationStatus, Prioritized, Ruleset, SelectClassInfo, SelectionScope, SelectionScopeRequestOptions,\r\n SingleElementPropertiesRequestOptions,\r\n} from \"@itwin/presentation-common\";\r\nimport { PRESENTATION_BACKEND_ASSETS_ROOT, PRESENTATION_COMMON_ASSETS_ROOT } from \"./Constants\";\r\nimport { buildElementsProperties, getElementsCount, iterateElementIds } from \"./ElementPropertiesHelper\";\r\nimport {\r\n createDefaultNativePlatform, NativePlatformDefinition, NativePlatformRequestTypes, NativePresentationDefaultUnitFormats,\r\n NativePresentationKeySetJSON, NativePresentationUnitSystem,\r\n} from \"./NativePlatform\";\r\nimport { RulesetManager, RulesetManagerImpl } from \"./RulesetManager\";\r\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager\";\r\nimport { SelectionScopesHelper } from \"./SelectionScopesHelper\";\r\nimport { UpdatesTracker } from \"./UpdatesTracker\";\r\nimport { getElementKey, getLocalesDirectory } from \"./Utils\";\r\n\r\n/**\r\n * Presentation manager working mode.\r\n * @public\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 * @beta\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 Hybrid = \"hybrid\",\r\n}\r\n\r\n/**\r\n * Configuration for hierarchy cache.\r\n * @beta\r\n */\r\nexport type HierarchyCacheConfig = MemoryHierarchyCacheConfig | DiskHierarchyCacheConfig | HybridCacheConfig;\r\n\r\n/**\r\n * Base interface for all [[HierarchyCacheConfig]] implementations.\r\n * @beta\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 * @beta\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 * @beta\r\n */\r\nexport interface DiskHierarchyCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Disk;\r\n\r\n /**\r\n * A directory for Presentation hierarchy cache. If set, the directory must exist.\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/**\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 * @beta\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 * @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 * @alpha\r\n */\r\n size?: 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 */\r\nexport interface UnitSystemFormat {\r\n unitSystems: UnitSystemKey[];\r\n format: FormatProps;\r\n}\r\n\r\n/**\r\n * Data structure for multiple element properties request response.\r\n * @alpha\r\n */\r\nexport interface MultiElementPropertiesResponse {\r\n total: number;\r\n iterator: () => AsyncGenerator<ElementProperties[]>;\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 assets. Need to be overriden by application if it puts these assets someplace else than the default.\r\n *\r\n * By default paths to asset directories are determined during the call of [[Presentation.initialize]] using this algorithm:\r\n *\r\n * - for `presentation-backend` assets:\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 * - for `presentation-common` assets:\r\n *\r\n * - if path of `.js` files of `presentation-common` package contain \"presentation-common\", assume the package is in `node_modules` and the directory structure is:\r\n * - `assets/*\\*\\/*`\r\n * - `presentation-common/{presentation-common source files}`\r\n *\r\n * which means the assets can be found through a relative path `../assets/` from the package's source files.\r\n *\r\n * - in both cases, if we determine that source files are not in `node_modules`, 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 * The overrides can be specified as a single path (when assets of both `presentation-backend` and `presentation-common` packages are merged into a single directory) or as an object with two separate paths for each package.\r\n */\r\n presentationAssetsRoot?: string | {\r\n /** Path to `presentation-backend` assets */\r\n backend: string;\r\n /** Path to `presentation-common` assets */\r\n common: string;\r\n };\r\n\r\n /**\r\n * A list of directories containing application's presentation rulesets.\r\n */\r\n rulesetDirectories?: string[];\r\n\r\n /**\r\n * A list of directories containing application's supplemental presentation rulesets.\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 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 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?: {\r\n [phenomenon: string]: UnitSystemFormat;\r\n };\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 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 mode?: PresentationManagerMode;\r\n\r\n /**\r\n * The interval (in milliseconds) used to poll for presentation data changes. Only has\r\n * effect in read-write mode (see [[mode]]).\r\n *\r\n * @alpha\r\n */\r\n updatesPollInterval?: number;\r\n\r\n /** Options for caching. */\r\n caching?: {\r\n /**\r\n * Hierarchies-related caching options.\r\n * @beta\r\n */\r\n hierarchies?: HierarchyCacheConfig;\r\n\r\n /** Content-related caching options. */\r\n content?: ContentCacheConfig;\r\n };\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 * @alpha\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/**\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\r\n private _props: PresentationManagerProps;\r\n private _nativePlatform?: NativePlatformDefinition;\r\n private _rulesets: RulesetManager;\r\n private _isDisposed: boolean;\r\n private _updatesTracker?: UpdatesTracker;\r\n private _onManagerUsed?: () => void;\r\n\r\n /** Get / set active locale used for localizing presentation data */\r\n public activeLocale: string | undefined;\r\n\r\n /** Get / set active unit system used to format property values with units */\r\n public activeUnitSystem: UnitSystemKey | 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._isDisposed = false;\r\n\r\n const mode = props?.mode ?? PresentationManagerMode.ReadWrite;\r\n const isChangeTrackingEnabled = (mode === PresentationManagerMode.ReadWrite && !!props?.updatesPollInterval);\r\n\r\n if (props && props.addon) {\r\n this._nativePlatform = props.addon;\r\n } else {\r\n const nativePlatformImpl = createDefaultNativePlatform({\r\n id: this._props.id ?? \"\",\r\n localeDirectories: createLocaleDirectoryList(props),\r\n taskAllocationsMap: createTaskAllocationsMap(props),\r\n mode,\r\n isChangeTrackingEnabled,\r\n cacheConfig: createCacheConfig(this._props.caching?.hierarchies),\r\n contentCacheSize: this._props.caching?.content?.size,\r\n defaultFormats: toNativeUnitFormatsMap(this._props.defaultFormats),\r\n useMmap: this._props.useMmap,\r\n });\r\n this._nativePlatform = new nativePlatformImpl();\r\n }\r\n\r\n this.setupRulesetDirectories(props);\r\n if (props) {\r\n this.activeLocale = props.defaultLocale;\r\n this.activeUnitSystem = props.defaultUnitSystem;\r\n }\r\n\r\n this._rulesets = new RulesetManagerImpl(this.getNativePlatform);\r\n\r\n if (IpcHost.isValid && isChangeTrackingEnabled) {\r\n this._updatesTracker = UpdatesTracker.create({\r\n nativePlatformGetter: this.getNativePlatform,\r\n pollInterval: props.updatesPollInterval!,\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the presentation manager. Must be called to clean up native resources.\r\n */\r\n public dispose() {\r\n if (this._nativePlatform) {\r\n this.getNativePlatform().dispose();\r\n this._nativePlatform = undefined;\r\n }\r\n\r\n if (this._updatesTracker) {\r\n this._updatesTracker.dispose();\r\n this._updatesTracker = undefined;\r\n }\r\n\r\n this._isDisposed = true;\r\n }\r\n\r\n /** @internal */\r\n public setOnManagerUsedHandler(handler: () => void) {\r\n this._onManagerUsed = handler;\r\n }\r\n\r\n /** Properties used to initialize the manager */\r\n public get props() { return this._props; }\r\n\r\n /**\r\n * Get rulesets manager\r\n */\r\n public rulesets(): RulesetManager { return this._rulesets; }\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 if (this._isDisposed)\r\n throw new PresentationError(PresentationStatus.NotInitialized, \"Attempting to use Presentation manager after disposal\");\r\n return this._nativePlatform!;\r\n };\r\n\r\n private setupRulesetDirectories(props?: PresentationManagerProps) {\r\n const supplementalRulesetDirectories = [path.join(getPresentationBackendAssetsRoot(props?.presentationAssetsRoot), \"supplemental-presentation-rules\")];\r\n if (props && props.supplementalRulesetDirectories) {\r\n props.supplementalRulesetDirectories.forEach((dir) => {\r\n if (-1 === supplementalRulesetDirectories.indexOf(dir))\r\n supplementalRulesetDirectories.push(dir);\r\n });\r\n }\r\n this.getNativePlatform().setupSupplementalRulesetDirectories(supplementalRulesetDirectories);\r\n\r\n const primaryRulesetDirectories = [path.join(getPresentationBackendAssetsRoot(props?.presentationAssetsRoot), \"primary-presentation-rules\")];\r\n if (props && props.rulesetDirectories) {\r\n props.rulesetDirectories.forEach((dir) => {\r\n if (-1 === primaryRulesetDirectories.indexOf(dir))\r\n primaryRulesetDirectories.push(dir);\r\n });\r\n }\r\n this.getNativePlatform().setupRulesetDirectories(primaryRulesetDirectories);\r\n }\r\n\r\n private getRulesetIdObject(rulesetOrId: Ruleset | string): { uniqueId: string, parts: { id: string, hash?: string } } {\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 return { uniqueId: rulesetOrId, parts: { id: rulesetOrId } };\r\n }\r\n\r\n /** @internal */\r\n public getRulesetId(rulesetOrId: Ruleset | string) {\r\n return this.getRulesetIdObject(rulesetOrId).uniqueId;\r\n }\r\n\r\n private ensureRulesetRegistered(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 return rulesetOrId;\r\n }\r\n\r\n /** Registers given ruleset and replaces the ruleset with its ID in the resulting object */\r\n private registerRuleset<TOptions extends { rulesetOrId: Ruleset | string }>(options: TOptions) {\r\n const { rulesetOrId, ...strippedOptions } = options;\r\n const registeredRulesetId = this.ensureRulesetRegistered(rulesetOrId);\r\n return { rulesetId: registeredRulesetId, strippedOptions };\r\n }\r\n\r\n /**\r\n * Retrieves nodes\r\n * @public\r\n */\r\n public async getNodes(requestOptions: Prioritized<Paged<HierarchyRequestOptions<IModelDb, NodeKey>>>): Promise<Node[]> {\r\n const { rulesetId, strippedOptions: { parentKey, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: parentKey ? NativePlatformRequestTypes.GetChildren : NativePlatformRequestTypes.GetRootNodes,\r\n rulesetId,\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return this.request(params, Node.listReviver);\r\n }\r\n\r\n /**\r\n * Retrieves nodes count\r\n * @public\r\n */\r\n public async getNodesCount(requestOptions: Prioritized<HierarchyRequestOptions<IModelDb, NodeKey>>): Promise<number> {\r\n const { rulesetId, strippedOptions: { parentKey, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: parentKey ? NativePlatformRequestTypes.GetChildrenCount : NativePlatformRequestTypes.GetRootNodesCount,\r\n rulesetId,\r\n ...strippedOptions,\r\n nodeKey: parentKey,\r\n };\r\n return this.request(params);\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(requestOptions: Prioritized<FilterByInstancePathsHierarchyRequestOptions<IModelDb>>): Promise<NodePathElement[]> {\r\n const { rulesetId, strippedOptions: { instancePaths, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetNodePaths,\r\n rulesetId,\r\n ...strippedOptions,\r\n paths: instancePaths.map((p) => p.map((s) => InstanceKey.toJSON(s))),\r\n };\r\n return this.request(params, NodePathElement.listReviver);\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(requestOptions: Prioritized<FilterByTextHierarchyRequestOptions<IModelDb>>): Promise<NodePathElement[]> {\r\n const { rulesetId, strippedOptions } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetFilteredNodePaths,\r\n rulesetId,\r\n ...strippedOptions,\r\n };\r\n return this.request(params, NodePathElement.listReviver);\r\n }\r\n\r\n /** @beta */\r\n public async getContentSources(requestOptions: Prioritized<ContentSourcesRequestOptions<IModelDb>>): 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 this.request(params, reviver);\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(requestOptions: Prioritized<ContentDescriptorRequestOptions<IModelDb, KeySet>>): Promise<Descriptor | undefined> {\r\n const { rulesetId, strippedOptions } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentDescriptor,\r\n rulesetId,\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n };\r\n const reviver = (key: string, value: any) => {\r\n return key === \"\" ? Descriptor.fromJSON(value) : value;\r\n };\r\n return this.request(params, reviver);\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(requestOptions: Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet>>): Promise<number> {\r\n const { rulesetId, strippedOptions: { descriptor, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContentSetSize,\r\n rulesetId,\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n return this.request(params);\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(requestOptions: Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet>>>): Promise<Content | undefined> {\r\n const { rulesetId, strippedOptions: { descriptor, ...strippedOptions } } = this.registerRuleset(requestOptions);\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetContent,\r\n rulesetId,\r\n ...strippedOptions,\r\n keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),\r\n descriptorOverrides: createContentDescriptorOverrides(descriptor),\r\n };\r\n return this.request(params, Content.reviver);\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(requestOptions: Prioritized<DistinctValuesRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet>>): Promise<PagedResponse<DisplayValueGroup>> {\r\n const { rulesetId, strippedOptions } = this.registerRuleset(requestOptions);\r\n const { descriptor, keys, ...strippedOptionsNoDescriptorAndKeys } = strippedOptions;\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetPagedDistinctValues,\r\n rulesetId,\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 total: value.total,\r\n items: value.items.map(DisplayValueGroup.fromJSON),\r\n } : value;\r\n };\r\n return this.request(params, reviver);\r\n }\r\n\r\n /**\r\n * Retrieves property data in a simplified format for a single element specified by ID.\r\n * @beta\r\n */\r\n public async getElementProperties(requestOptions: Prioritized<SingleElementPropertiesRequestOptions<IModelDb>>): Promise<ElementProperties | 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 * @alpha\r\n */\r\n public async getElementProperties(requestOptions: Prioritized<MultiElementPropertiesRequestOptions<IModelDb>>): Promise<MultiElementPropertiesResponse>;\r\n public async getElementProperties(requestOptions: Prioritized<ElementPropertiesRequestOptions<IModelDb>>): Promise<ElementProperties | undefined | MultiElementPropertiesResponse> {\r\n if (isSingleElementPropertiesRequestOptions(requestOptions)) {\r\n const { elementId, ...optionsNoElementId } = requestOptions;\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 const properties = buildElementsProperties(content);\r\n return properties[0];\r\n }\r\n\r\n return this.getMultipleElementProperties(requestOptions);\r\n }\r\n\r\n private async getMultipleElementProperties(requestOptions: Prioritized<MultiElementPropertiesRequestOptions<IModelDb>>): Promise<MultiElementPropertiesResponse> {\r\n const { elementClasses, ...optionsNoElementClasses } = requestOptions;\r\n const elementsCount = getElementsCount(requestOptions.imodel, requestOptions.elementClasses);\r\n\r\n const propertiesGetter = async (className: string, ids: string[]) => buildElementsPropertiesInPages(className, ids, async (keys) => {\r\n const content = await this.getContent({\r\n ...optionsNoElementClasses,\r\n descriptor: {\r\n displayType: DefaultContentDisplayTypes.PropertyPane,\r\n contentFlags: ContentFlags.ShowLabels,\r\n },\r\n rulesetOrId: \"ElementProperties\",\r\n keys,\r\n });\r\n return buildElementsProperties(content);\r\n });\r\n\r\n const ELEMENT_IDS_BATCH_SIZE = 1000;\r\n return {\r\n total: elementsCount,\r\n async *iterator() {\r\n for (const idsByClass of iterateElementIds(requestOptions.imodel, elementClasses, ELEMENT_IDS_BATCH_SIZE)) {\r\n const propertiesPage: ElementProperties[] = [];\r\n for (const entry of idsByClass) {\r\n propertiesPage.push(...(await propertiesGetter(entry[0], entry[1])));\r\n }\r\n yield propertiesPage;\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(requestOptions: Prioritized<DisplayLabelRequestOptions<IModelDb, InstanceKey>>): Promise<LabelDefinition> {\r\n const params = {\r\n requestId: NativePlatformRequestTypes.GetDisplayLabel,\r\n ...requestOptions,\r\n key: InstanceKey.toJSON(requestOptions.key),\r\n };\r\n return this.request(params, LabelDefinition.reviver);\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(requestOptions: Prioritized<Paged<DisplayLabelsRequestOptions<IModelDb, InstanceKey>>>): Promise<LabelDefinition[]> {\r\n const concreteKeys = requestOptions.keys.map((k) => {\r\n if (k.className === \"BisCore:Element\")\r\n return getElementKey(requestOptions.imodel, k.id);\r\n return k;\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 return item.label;\r\n });\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>): 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 */\r\n public async computeSelection(requestOptions: SelectionScopeRequestOptions<IModelDb> & { ids: Id64String[], scopeId: string }): Promise<KeySet> {\r\n const { ids, scopeId, ...opts } = requestOptions; // eslint-disable-line @typescript-eslint/no-unused-vars\r\n return SelectionScopesHelper.computeSelection(opts, ids, scopeId);\r\n }\r\n\r\n private async request<TParams extends { diagnostics?: DiagnosticsOptionsWithHandler, requestId: string, imodel: IModelDb, locale?: string, unitSystem?: UnitSystemKey }, TResult>(params: TParams, reviver?: (key: string, value: any) => any): Promise<TResult> {\r\n const { requestId, imodel, locale, unitSystem, diagnostics, ...strippedParams } = params;\r\n if (this._onManagerUsed)\r\n this._onManagerUsed();\r\n const imodelAddon = this.getNativePlatform().getImodelAddon(imodel);\r\n const nativeRequestParams: any = {\r\n requestId,\r\n params: {\r\n locale: normalizeLocale(locale ?? this.activeLocale),\r\n unitSystem: toOptionalNativeUnitSystem(unitSystem ?? this.activeUnitSystem),\r\n ...strippedParams,\r\n },\r\n };\r\n\r\n let diagnosticsListener;\r\n if (diagnostics) {\r\n const { handler: tempDiagnosticsListener, ...diagnosticsOptions } = diagnostics;\r\n diagnosticsListener = tempDiagnosticsListener;\r\n nativeRequestParams.params.diagnostics = diagnosticsOptions;\r\n }\r\n\r\n const response = await this.getNativePlatform().handleRequest(imodelAddon, JSON.stringify(nativeRequestParams));\r\n diagnosticsListener && response.diagnostics && diagnosticsListener([response.diagnostics]);\r\n return JSON.parse(response.result, reviver);\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 const { strippedOptions: { prev, rulesetVariables, ...options } } = this.registerRuleset(requestOptions);\r\n\r\n const currRulesetId = this.getRulesetIdObject(requestOptions.rulesetOrId);\r\n const prevRulesetId = prev.rulesetOrId ? this.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 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 return this.request(params, (key: string, value: any) => ((key === \"\") ? HierarchyCompareInfo.fromJSON(value) : value));\r\n }\r\n}\r\n\r\nfunction addInstanceKey(classInstancesMap: Map<string, Set<string>>, key: InstanceKey) {\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\nfunction 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/** @internal */\r\nexport function getKeysForContentRequest(keys: Readonly<KeySet>, classInstanceKeysProcessor?: (keys: Map<string, Set<string>>) => void): 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 if (Key.isInstanceKey(key))\r\n addInstanceKey(classInstancesMap, key);\r\n });\r\n\r\n if (classInstanceKeysProcessor)\r\n classInstanceKeysProcessor(classInstancesMap);\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 return result;\r\n}\r\n\r\nconst createContentDescriptorOverrides = (descriptorOrOverrides: Descriptor | DescriptorOverrides): DescriptorOverrides => {\r\n if (descriptorOrOverrides instanceof Descriptor)\r\n return descriptorOrOverrides.createDescriptorOverrides();\r\n return descriptorOrOverrides;\r\n};\r\n\r\nconst createLocaleDirectoryList = (props?: PresentationManagerProps) => {\r\n const localeDirectories = [getLocalesDirectory(getPresentationCommonAssetsRoot(props?.presentationAssetsRoot))];\r\n if (props && props.localeDirectories) {\r\n props.localeDirectories.forEach((dir) => {\r\n if (-1 === localeDirectories.indexOf(dir))\r\n localeDirectories.push(dir);\r\n });\r\n }\r\n return localeDirectories;\r\n};\r\n\r\nconst createTaskAllocationsMap = (props?: PresentationManagerProps) => {\r\n const count = props?.workerThreadsCount ?? 2;\r\n return {\r\n [Number.MAX_SAFE_INTEGER]: count,\r\n };\r\n};\r\n\r\nconst normalizeLocale = (locale?: string) => {\r\n if (!locale)\r\n return undefined;\r\n return locale.toLocaleLowerCase();\r\n};\r\n\r\nconst normalizeDirectory = (directory?: string) => {\r\n return directory ? path.resolve(directory) : \"\";\r\n};\r\n\r\nconst toNativeUnitSystem = (unitSystem: UnitSystemKey) => {\r\n switch (unitSystem) {\r\n case \"imperial\": return NativePresentationUnitSystem.BritishImperial;\r\n case \"metric\": return NativePresentationUnitSystem.Metric;\r\n case \"usCustomary\": return NativePresentationUnitSystem.UsCustomary;\r\n case \"usSurvey\": return NativePresentationUnitSystem.UsSurvey;\r\n }\r\n};\r\n\r\nconst toOptionalNativeUnitSystem = (unitSystem: UnitSystemKey | undefined) => {\r\n return unitSystem ? toNativeUnitSystem(unitSystem) : undefined;\r\n};\r\n\r\nconst toNativeUnitFormatsMap = (map: { [phenomenon: string]: UnitSystemFormat } | undefined) => {\r\n if (!map)\r\n return undefined;\r\n\r\n const nativeFormatsMap: NativePresentationDefaultUnitFormats = {};\r\n Object.keys(map).forEach((phenomenon) => {\r\n const unitSystemsFormat = map[phenomenon];\r\n nativeFormatsMap[phenomenon] = {\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\nconst createCacheConfig = (config?: HierarchyCacheConfig): IModelJsNative.ECPresentationHierarchyCacheConfig => {\r\n if (config?.mode === HierarchyCacheMode.Disk)\r\n return { ...config, directory: normalizeDirectory(config.directory) };\r\n if (config?.mode === HierarchyCacheMode.Hybrid)\r\n return { ...config, disk: config.disk ? { ...config.disk, directory: normalizeDirectory(config.disk.directory) } : undefined };\r\n if (config?.mode === HierarchyCacheMode.Memory)\r\n return config;\r\n return { mode: HierarchyCacheMode.Disk, directory: \"\" };\r\n};\r\n\r\nconst getPresentationBackendAssetsRoot = (ovr?: string | { backend: string }) => {\r\n if (typeof ovr === \"string\")\r\n return ovr;\r\n if (typeof ovr === \"object\")\r\n return ovr.backend;\r\n return PRESENTATION_BACKEND_ASSETS_ROOT;\r\n};\r\n\r\nconst getPresentationCommonAssetsRoot = (ovr?: string | { common: string }) => {\r\n if (typeof ovr === \"string\")\r\n return ovr;\r\n if (typeof ovr === \"object\")\r\n return ovr.common;\r\n return PRESENTATION_COMMON_ASSETS_ROOT;\r\n};\r\n\r\nconst ELEMENT_PROPERTIES_CONTENT_BATCH_SIZE = 100;\r\nasync function buildElementsPropertiesInPages(className: string, ids: string[], getter: (keys: KeySet) => Promise<ElementProperties[]>) {\r\n const elementProperties: ElementProperties[] = [];\r\n const elementIds = [...ids];\r\n while (elementIds.length > 0) {\r\n const idsPage = elementIds.splice(0, ELEMENT_PROPERTIES_CONTENT_BATCH_SIZE);\r\n const keys = new KeySet(idsPage.map((id) => ({ id, className })));\r\n elementProperties.push(...(await getter(keys)));\r\n }\r\n return elementProperties;\r\n}\r\n"]}
|
|
@@ -13,12 +13,6 @@ export declare const MAX_ALLOWED_KEYS_PAGE_SIZE = 10000;
|
|
|
13
13
|
* The backend implementation of PresentationRpcInterface. All it's basically
|
|
14
14
|
* responsible for is forwarding calls to [[Presentation.manager]].
|
|
15
15
|
*
|
|
16
|
-
* Consumers should not use this class. Instead, they should register
|
|
17
|
-
* [PresentationRpcInterface]($presentation-common):
|
|
18
|
-
* ``` ts
|
|
19
|
-
* [[include:Backend.Initialization.RpcInterface]]
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
16
|
* @internal
|
|
23
17
|
*/
|
|
24
18
|
export declare class PresentationRpcImpl extends PresentationRpcInterface implements IDisposable {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationRpcImpl.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationRpcImpl.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAU,UAAU,EAAE,WAAW,EAAU,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,kCAAkC,EAAgB,oCAAoC,EAAE,wBAAwB,EAAE,+BAA+B,EACjJ,uBAAuB,EAAE,cAAc,EAA4C,6BAA6B,EAAE,8BAA8B,EAC7H,qBAAqB,EAAE,+BAA+B,EAAE,iBAAiB,EAAE,+CAA+C,EAC7I,sCAAsC,EAAE,0BAA0B,EAAe,QAAQ,EAAU,UAAU,EAAmB,mBAAmB,EAC7I,QAAQ,EAAyC,mBAAmB,EAAE,KAAK,EAAE,aAAa,EAChG,wBAAwB,EAAE,uBAAuB,EAChC,cAAc,EAAE,+BAA+B,EAAE,wCAAwC,EAC3G,MAAM,4BAA4B,CAAC;AAGpC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,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,+BAA+B,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,uBAAuB,CAAC,UAAU,CAAC;CAMxL"}
|
|
@@ -22,12 +22,6 @@ exports.MAX_ALLOWED_KEYS_PAGE_SIZE = 10000;
|
|
|
22
22
|
* The backend implementation of PresentationRpcInterface. All it's basically
|
|
23
23
|
* responsible for is forwarding calls to [[Presentation.manager]].
|
|
24
24
|
*
|
|
25
|
-
* Consumers should not use this class. Instead, they should register
|
|
26
|
-
* [PresentationRpcInterface]($presentation-common):
|
|
27
|
-
* ``` ts
|
|
28
|
-
* [[include:Backend.Initialization.RpcInterface]]
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
25
|
* @internal
|
|
32
26
|
*/
|
|
33
27
|
class PresentationRpcImpl extends presentation_common_1.PresentationRpcInterface {
|
|
@@ -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,sDAA8E;AAE9E,oEAQoC;AACpC,mEAA4E;AAC5E,iDAA8C;AAE9C,yDAAsD;AAItD,gBAAgB;AACH,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAC1C,gBAAgB;AACH,QAAA,0BAA0B,GAAG,KAAK,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,MAAa,mBAAoB,SAAQ,8CAAwB;IAK/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,qFAAqF;YACrF,mBAAmB,EAAE,IAAI,CAAC,eAAe,GAAG,EAAE,GAAG,IAAI;YAErD,mCAAmC;YACnC,eAAe,EAAE,IAAI;YAErB,cAAc,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE;gBAChC,IAAI,MAAM,KAAK,SAAS;oBACtB,qBAAM,CAAC,QAAQ,CAAC,yDAAiC,CAAC,GAAG,EAAE,uDAAuD,EAAE,GAAG,CAAC,CAAC;YACzH,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;IAClC,CAAC;IAED,IAAW,cAAc,KAAK,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;IAE5D,gDAAgD;IACxC,eAA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AgB,CAAC,OAAO,CAAC,CAAC;YACtF,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAxUD,kDAwUC;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":["/*---------------------------------------------------------------------------------------------\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 } from \"@itwin/core-backend\";\r\nimport { assert, Id64String, IDisposable, Logger } from \"@itwin/core-bentley\";\r\nimport { IModelRpcProps } from \"@itwin/core-common\";\r\nimport {\r\n ContentDescriptorRpcRequestOptions, ContentFlags, ContentInstanceKeysRpcRequestOptions, ContentRpcRequestOptions, ContentSourcesRpcRequestOptions,\r\n ContentSourcesRpcResult, DescriptorJSON, DiagnosticsOptions, DiagnosticsScopeLogs, DisplayLabelRpcRequestOptions, DisplayLabelsRpcRequestOptions,\r\n DisplayValueGroup, DisplayValueGroupJSON, DistinctValuesRpcRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRpcRequestOptions,\r\n FilterByTextHierarchyRpcRequestOptions, HierarchyRpcRequestOptions, InstanceKey, ItemJSON, KeySet, KeySetJSON, LabelDefinition, LabelDefinitionJSON,\r\n Node, NodeJSON, NodeKey, NodeKeyJSON, NodePathElement, NodePathElementJSON, Paged, PagedResponse, PageOptions, PresentationError,\r\n PresentationRpcInterface, PresentationRpcResponse, PresentationRpcResponseData, PresentationStatus, Ruleset, RulesetVariable, RulesetVariableJSON,\r\n SelectClassInfo, SelectionScope, SelectionScopeRpcRequestOptions, 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\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\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 * Consumers should not use this class. Instead, they should register\r\n * [PresentationRpcInterface]($presentation-common):\r\n * ``` ts\r\n * [[include:Backend.Initialization.RpcInterface]]\r\n * ```\r\n *\r\n * @internal\r\n */\r\nexport class PresentationRpcImpl extends PresentationRpcInterface implements IDisposable {\r\n\r\n private _requestTimeout: number;\r\n private _pendingRequests: TemporaryStorage<PresentationRpcResponse<any>>;\r\n\r\n public constructor(props?: { requestTimeout: number }) {\r\n super();\r\n this._requestTimeout = props?.requestTimeout ?? 90 * 1000;\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 + 10 * 1000,\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 },\r\n });\r\n }\r\n\r\n public dispose() {\r\n this._pendingRequests.dispose();\r\n }\r\n\r\n public get requestTimeout() { return this._requestTimeout; }\r\n\r\n /** Returns an ok response with result inside */\r\n private successResponse<TResult>(result: TResult, diagnostics?: DiagnosticsScopeLogs[]) {\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?: DiagnosticsScopeLogs[]) {\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 getIModel(token: IModelRpcProps): IModelDb {\r\n let imodel: IModelDb;\r\n try {\r\n imodel = IModelDb.findByKey(token.key);\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<TRpcOptions extends { rulesetOrId?: Ruleset | string, clientId?: string, diagnostics?: DiagnosticsOptions, rulesetVariables?: RulesetVariableJSON[] }, TResult>(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 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 let imodel: IModelDb;\r\n try {\r\n imodel = 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 const { clientId: _, diagnostics: diagnosticsOptions, rulesetVariables, ...options } = requestOptions;\r\n const managerRequestOptions: any = {\r\n ...options,\r\n imodel,\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 // set up diagnostics listener\r\n let diagnosticLogs: DiagnosticsScopeLogs[] | undefined;\r\n if (diagnosticsOptions) {\r\n managerRequestOptions.diagnostics = {\r\n ...diagnosticsOptions,\r\n handler: (logs: DiagnosticsScopeLogs[]) => {\r\n if (!diagnosticLogs)\r\n diagnosticLogs = [];\r\n diagnosticLogs.push(...logs);\r\n },\r\n };\r\n }\r\n\r\n // initiate request\r\n resultPromise = request(managerRequestOptions)\r\n .then((result) => this.successResponse(result, diagnosticLogs))\r\n .catch((e: PresentationError) => this.errorResponse(e.errorNumber, e.message, diagnosticLogs));\r\n\r\n // store the request promise\r\n this._pendingRequests.addValue(requestKey, resultPromise);\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 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(\"Timed out\");\r\n }, this._requestTimeout);\r\n });\r\n\r\n /* eslint-disable @typescript-eslint/indent */\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Returning a promise with a timeout of ${this._requestTimeout}.`);\r\n return Promise\r\n .race([resultPromise, timeoutPromise])\r\n .catch<PresentationRpcResponseData>(() => {\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<any>) => {\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 /* eslint-enable @typescript-eslint/indent */\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(token: IModelRpcProps, requestOptions: Paged<HierarchyRpcRequestOptions>): 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 [nodes, count] = await Promise.all([\r\n this.getManager(requestOptions.clientId).getNodes(options),\r\n this.getManager(requestOptions.clientId).getNodesCount(options),\r\n ]);\r\n return { total: count, items: nodes.map(Node.toJSON) };\r\n });\r\n }\r\n\r\n public override async getNodePaths(token: IModelRpcProps, requestOptions: FilterByInstancePathsHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElementJSON[]> {\r\n return this.makeRequest(token, \"getNodePaths\", requestOptions, async (options) => {\r\n const result = await this.getManager(requestOptions.clientId).getNodePaths(options);\r\n return result.map(NodePathElement.toJSON);\r\n });\r\n }\r\n\r\n public override async getFilteredNodePaths(token: IModelRpcProps, requestOptions: FilterByTextHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElementJSON[]> {\r\n return this.makeRequest(token, \"getFilteredNodePaths\", requestOptions, async (options) => {\r\n const result = await this.getManager(requestOptions.clientId).getFilteredNodePaths(options);\r\n return result.map(NodePathElement.toJSON);\r\n });\r\n }\r\n\r\n public override async getContentSources(token: IModelRpcProps, requestOptions: ContentSourcesRpcRequestOptions): 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(token: IModelRpcProps, requestOptions: ContentDescriptorRpcRequestOptions): PresentationRpcResponse<DescriptorJSON | undefined> {\r\n return this.makeRequest(token, \"getContentDescriptor\", requestOptions, async (options) => {\r\n options = {\r\n ...options,\r\n keys: KeySet.fromJSON(options.keys),\r\n };\r\n const descriptor = await this.getManager(requestOptions.clientId).getContentDescriptor(options);\r\n if (descriptor)\r\n return descriptor.toJSON();\r\n return undefined;\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(token: IModelRpcProps, requestOptions: Paged<ContentRpcRequestOptions>): 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).getContent(options),\r\n ]);\r\n\r\n if (!content)\r\n return undefined;\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(token: IModelRpcProps, requestOptions: Paged<ContentRpcRequestOptions>): PresentationRpcResponse<PagedResponse<ItemJSON>> {\r\n const content = await this.getPagedContent(token, requestOptions);\r\n return this.successResponse(content.result ? content.result.contentSet : { total: 0, items: [] });\r\n }\r\n\r\n public override async getElementProperties(token: IModelRpcProps, requestOptions: SingleElementPropertiesRpcRequestOptions): PresentationRpcResponse<ElementProperties | undefined> {\r\n return this.makeRequest(token, \"getElementProperties\", { ...requestOptions }, async (options) => {\r\n return this.getManager(requestOptions.clientId).getElementProperties(options);\r\n });\r\n }\r\n\r\n public override async getPagedDistinctValues(token: IModelRpcProps, requestOptions: DistinctValuesRpcRequestOptions): 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).getPagedDistinctValues(options);\r\n return {\r\n ...response,\r\n items: response.items.map(DisplayValueGroup.toJSON),\r\n };\r\n });\r\n }\r\n\r\n public override async getContentInstanceKeys(token: IModelRpcProps, requestOptions: ContentInstanceKeysRpcRequestOptions): 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 ...optionsNoDisplayType,\r\n keys: KeySet.fromJSON(optionsNoDisplayType.keys),\r\n descriptor: {\r\n displayType,\r\n contentFlags: ContentFlags.KeysOnly,\r\n },\r\n }, MAX_ALLOWED_KEYS_PAGE_SIZE);\r\n\r\n const [size, content] = await Promise.all([\r\n this.getManager(requestOptions.clientId).getContentSetSize(options),\r\n this.getManager(requestOptions.clientId).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 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(token: IModelRpcProps, requestOptions: DisplayLabelRpcRequestOptions): PresentationRpcResponse<LabelDefinitionJSON> {\r\n return this.makeRequest(token, \"getDisplayLabelDefinition\", requestOptions, async (options) => {\r\n const label = await this.getManager(requestOptions.clientId).getDisplayLabelDefinition(options);\r\n return LabelDefinition.toJSON(label);\r\n });\r\n }\r\n\r\n public override async getPagedDisplayLabelDefinitions(token: IModelRpcProps, requestOptions: DisplayLabelsRpcRequestOptions): PresentationRpcResponse<PagedResponse<LabelDefinitionJSON>> {\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 return this.makeRequest(token, \"getPagedDisplayLabelDefinitions\", requestOptions, async (options) => {\r\n const labels = await this.getManager(requestOptions.clientId).getDisplayLabelDefinitions({ ...options, keys: options.keys.map(InstanceKey.fromJSON) });\r\n return {\r\n total: options.keys.length,\r\n items: labels.map(LabelDefinition.toJSON),\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(token: IModelRpcProps, requestOptions: SelectionScopeRpcRequestOptions, ids: Id64String[], scopeId: string): PresentationRpcResponse<KeySetJSON> {\r\n return this.makeRequest(token, \"computeSelection\", { ...requestOptions, ids, scopeId }, async (options) => {\r\n const keys = await this.getManager(requestOptions.clientId).computeSelection(options);\r\n return keys.toJSON();\r\n });\r\n }\r\n}\r\n\r\nconst enforceValidPageSize = <TOptions extends Paged<object>>(requestOptions: TOptions, maxPageSize = MAX_ALLOWED_PAGE_SIZE): 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 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\nconst nodeKeyFromJson = (json: NodeKeyJSON | undefined): NodeKey | undefined => {\r\n if (!json)\r\n return undefined;\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;;;+FAG+F;AAC/F;;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B,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":["/*---------------------------------------------------------------------------------------------\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 } from \"@itwin/core-backend\";\r\nimport { assert, Id64String, IDisposable, Logger } from \"@itwin/core-bentley\";\r\nimport { IModelRpcProps } from \"@itwin/core-common\";\r\nimport {\r\n ContentDescriptorRpcRequestOptions, ContentFlags, ContentInstanceKeysRpcRequestOptions, ContentRpcRequestOptions, ContentSourcesRpcRequestOptions,\r\n ContentSourcesRpcResult, DescriptorJSON, DiagnosticsOptions, DiagnosticsScopeLogs, DisplayLabelRpcRequestOptions, DisplayLabelsRpcRequestOptions,\r\n DisplayValueGroup, DisplayValueGroupJSON, DistinctValuesRpcRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRpcRequestOptions,\r\n FilterByTextHierarchyRpcRequestOptions, HierarchyRpcRequestOptions, InstanceKey, ItemJSON, KeySet, KeySetJSON, LabelDefinition, LabelDefinitionJSON,\r\n Node, NodeJSON, NodeKey, NodeKeyJSON, NodePathElement, NodePathElementJSON, Paged, PagedResponse, PageOptions, PresentationError,\r\n PresentationRpcInterface, PresentationRpcResponse, PresentationRpcResponseData, PresentationStatus, Ruleset, RulesetVariable, RulesetVariableJSON,\r\n SelectClassInfo, SelectionScope, SelectionScopeRpcRequestOptions, 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\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\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\r\n private _requestTimeout: number;\r\n private _pendingRequests: TemporaryStorage<PresentationRpcResponse<any>>;\r\n\r\n public constructor(props?: { requestTimeout: number }) {\r\n super();\r\n this._requestTimeout = props?.requestTimeout ?? 90 * 1000;\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 + 10 * 1000,\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 },\r\n });\r\n }\r\n\r\n public dispose() {\r\n this._pendingRequests.dispose();\r\n }\r\n\r\n public get requestTimeout() { return this._requestTimeout; }\r\n\r\n /** Returns an ok response with result inside */\r\n private successResponse<TResult>(result: TResult, diagnostics?: DiagnosticsScopeLogs[]) {\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?: DiagnosticsScopeLogs[]) {\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 getIModel(token: IModelRpcProps): IModelDb {\r\n let imodel: IModelDb;\r\n try {\r\n imodel = IModelDb.findByKey(token.key);\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<TRpcOptions extends { rulesetOrId?: Ruleset | string, clientId?: string, diagnostics?: DiagnosticsOptions, rulesetVariables?: RulesetVariableJSON[] }, TResult>(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 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 let imodel: IModelDb;\r\n try {\r\n imodel = 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 const { clientId: _, diagnostics: diagnosticsOptions, rulesetVariables, ...options } = requestOptions;\r\n const managerRequestOptions: any = {\r\n ...options,\r\n imodel,\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 // set up diagnostics listener\r\n let diagnosticLogs: DiagnosticsScopeLogs[] | undefined;\r\n if (diagnosticsOptions) {\r\n managerRequestOptions.diagnostics = {\r\n ...diagnosticsOptions,\r\n handler: (logs: DiagnosticsScopeLogs[]) => {\r\n if (!diagnosticLogs)\r\n diagnosticLogs = [];\r\n diagnosticLogs.push(...logs);\r\n },\r\n };\r\n }\r\n\r\n // initiate request\r\n resultPromise = request(managerRequestOptions)\r\n .then((result) => this.successResponse(result, diagnosticLogs))\r\n .catch((e: PresentationError) => this.errorResponse(e.errorNumber, e.message, diagnosticLogs));\r\n\r\n // store the request promise\r\n this._pendingRequests.addValue(requestKey, resultPromise);\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 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(\"Timed out\");\r\n }, this._requestTimeout);\r\n });\r\n\r\n /* eslint-disable @typescript-eslint/indent */\r\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Returning a promise with a timeout of ${this._requestTimeout}.`);\r\n return Promise\r\n .race([resultPromise, timeoutPromise])\r\n .catch<PresentationRpcResponseData>(() => {\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<any>) => {\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 /* eslint-enable @typescript-eslint/indent */\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(token: IModelRpcProps, requestOptions: Paged<HierarchyRpcRequestOptions>): 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 [nodes, count] = await Promise.all([\r\n this.getManager(requestOptions.clientId).getNodes(options),\r\n this.getManager(requestOptions.clientId).getNodesCount(options),\r\n ]);\r\n return { total: count, items: nodes.map(Node.toJSON) };\r\n });\r\n }\r\n\r\n public override async getNodePaths(token: IModelRpcProps, requestOptions: FilterByInstancePathsHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElementJSON[]> {\r\n return this.makeRequest(token, \"getNodePaths\", requestOptions, async (options) => {\r\n const result = await this.getManager(requestOptions.clientId).getNodePaths(options);\r\n return result.map(NodePathElement.toJSON);\r\n });\r\n }\r\n\r\n public override async getFilteredNodePaths(token: IModelRpcProps, requestOptions: FilterByTextHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElementJSON[]> {\r\n return this.makeRequest(token, \"getFilteredNodePaths\", requestOptions, async (options) => {\r\n const result = await this.getManager(requestOptions.clientId).getFilteredNodePaths(options);\r\n return result.map(NodePathElement.toJSON);\r\n });\r\n }\r\n\r\n public override async getContentSources(token: IModelRpcProps, requestOptions: ContentSourcesRpcRequestOptions): 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(token: IModelRpcProps, requestOptions: ContentDescriptorRpcRequestOptions): PresentationRpcResponse<DescriptorJSON | undefined> {\r\n return this.makeRequest(token, \"getContentDescriptor\", requestOptions, async (options) => {\r\n options = {\r\n ...options,\r\n keys: KeySet.fromJSON(options.keys),\r\n };\r\n const descriptor = await this.getManager(requestOptions.clientId).getContentDescriptor(options);\r\n if (descriptor)\r\n return descriptor.toJSON();\r\n return undefined;\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(token: IModelRpcProps, requestOptions: Paged<ContentRpcRequestOptions>): 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).getContent(options),\r\n ]);\r\n\r\n if (!content)\r\n return undefined;\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(token: IModelRpcProps, requestOptions: Paged<ContentRpcRequestOptions>): PresentationRpcResponse<PagedResponse<ItemJSON>> {\r\n const content = await this.getPagedContent(token, requestOptions);\r\n return this.successResponse(content.result ? content.result.contentSet : { total: 0, items: [] });\r\n }\r\n\r\n public override async getElementProperties(token: IModelRpcProps, requestOptions: SingleElementPropertiesRpcRequestOptions): PresentationRpcResponse<ElementProperties | undefined> {\r\n return this.makeRequest(token, \"getElementProperties\", { ...requestOptions }, async (options) => {\r\n return this.getManager(requestOptions.clientId).getElementProperties(options);\r\n });\r\n }\r\n\r\n public override async getPagedDistinctValues(token: IModelRpcProps, requestOptions: DistinctValuesRpcRequestOptions): 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).getPagedDistinctValues(options);\r\n return {\r\n ...response,\r\n items: response.items.map(DisplayValueGroup.toJSON),\r\n };\r\n });\r\n }\r\n\r\n public override async getContentInstanceKeys(token: IModelRpcProps, requestOptions: ContentInstanceKeysRpcRequestOptions): 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 ...optionsNoDisplayType,\r\n keys: KeySet.fromJSON(optionsNoDisplayType.keys),\r\n descriptor: {\r\n displayType,\r\n contentFlags: ContentFlags.KeysOnly,\r\n },\r\n }, MAX_ALLOWED_KEYS_PAGE_SIZE);\r\n\r\n const [size, content] = await Promise.all([\r\n this.getManager(requestOptions.clientId).getContentSetSize(options),\r\n this.getManager(requestOptions.clientId).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 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(token: IModelRpcProps, requestOptions: DisplayLabelRpcRequestOptions): PresentationRpcResponse<LabelDefinitionJSON> {\r\n return this.makeRequest(token, \"getDisplayLabelDefinition\", requestOptions, async (options) => {\r\n const label = await this.getManager(requestOptions.clientId).getDisplayLabelDefinition(options);\r\n return LabelDefinition.toJSON(label);\r\n });\r\n }\r\n\r\n public override async getPagedDisplayLabelDefinitions(token: IModelRpcProps, requestOptions: DisplayLabelsRpcRequestOptions): PresentationRpcResponse<PagedResponse<LabelDefinitionJSON>> {\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 return this.makeRequest(token, \"getPagedDisplayLabelDefinitions\", requestOptions, async (options) => {\r\n const labels = await this.getManager(requestOptions.clientId).getDisplayLabelDefinitions({ ...options, keys: options.keys.map(InstanceKey.fromJSON) });\r\n return {\r\n total: options.keys.length,\r\n items: labels.map(LabelDefinition.toJSON),\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(token: IModelRpcProps, requestOptions: SelectionScopeRpcRequestOptions, ids: Id64String[], scopeId: string): PresentationRpcResponse<KeySetJSON> {\r\n return this.makeRequest(token, \"computeSelection\", { ...requestOptions, ids, scopeId }, async (options) => {\r\n const keys = await this.getManager(requestOptions.clientId).computeSelection(options);\r\n return keys.toJSON();\r\n });\r\n }\r\n}\r\n\r\nconst enforceValidPageSize = <TOptions extends Paged<object>>(requestOptions: TOptions, maxPageSize = MAX_ALLOWED_PAGE_SIZE): 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 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\nconst nodeKeyFromJson = (json: NodeKeyJSON | undefined): NodeKey | undefined => {\r\n if (!json)\r\n return undefined;\r\n return NodeKey.fromJSON(json);\r\n};\r\n"]}
|
|
@@ -8,4 +8,6 @@ import { InstanceKey } from "@itwin/presentation-common";
|
|
|
8
8
|
export declare function getElementKey(imodel: IModelDb, id: Id64String): InstanceKey | undefined;
|
|
9
9
|
/** @internal */
|
|
10
10
|
export declare function normalizeVersion(version?: string): string;
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare const getLocalesDirectory: (assetsDirectory: string) => string;
|
|
11
13
|
//# sourceMappingURL=Utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/Utils.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAY,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAW,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/Utils.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAY,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAW,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGzD,gBAAgB;AAChB,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,GAAG,WAAW,GAAG,SAAS,CAWvF;AAED,gBAAgB;AAChB,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,UAOhD;AAED,gBAAgB;AAEhB,eAAO,MAAM,mBAAmB,oBAAqB,MAAM,WAA0C,CAAC"}
|
|
@@ -6,11 +6,15 @@
|
|
|
6
6
|
/** @packageDocumentation
|
|
7
7
|
* @module Core
|
|
8
8
|
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
9
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.normalizeVersion = exports.getElementKey = void 0;
|
|
13
|
+
exports.getLocalesDirectory = exports.normalizeVersion = exports.getElementKey = void 0;
|
|
11
14
|
const semver_1 = require("semver");
|
|
12
15
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
13
16
|
const core_backend_1 = require("@itwin/core-backend");
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
14
18
|
/** @internal */
|
|
15
19
|
function getElementKey(imodel, id) {
|
|
16
20
|
let key;
|
|
@@ -36,4 +40,8 @@ function normalizeVersion(version) {
|
|
|
36
40
|
return "0.0.0";
|
|
37
41
|
}
|
|
38
42
|
exports.normalizeVersion = normalizeVersion;
|
|
43
|
+
/** @internal */
|
|
44
|
+
// istanbul ignore next
|
|
45
|
+
const getLocalesDirectory = (assetsDirectory) => path_1.default.join(assetsDirectory, "locales");
|
|
46
|
+
exports.getLocalesDirectory = getLocalesDirectory;
|
|
39
47
|
//# sourceMappingURL=Utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/presentation-backend/Utils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/presentation-backend/Utils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;AAEH,mCAA+C;AAC/C,sDAA2D;AAC3D,sDAAwD;AAExD,gDAAwB;AAExB,gBAAgB;AAChB,SAAgB,aAAa,CAAC,MAAgB,EAAE,EAAc;IAC5D,IAAI,GAA4B,CAAC;IACjC,MAAM,KAAK,GAAG,yBAAyB,sBAAO,CAAC,aAAa,2BAA2B,CAAC;IACxF,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;QAC3C,IAAI;YACF,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACnB,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,uBAAQ,CAAC,aAAa;gBACxC,GAAG,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,sBAAsB,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC;SACxF;QAAC,MAAM,GAAG;IACb,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC;AAXD,sCAWC;AAED,gBAAgB;AAChB,SAAgB,gBAAgB,CAAC,OAAgB;IAC/C,IAAI,OAAO,EAAE;QACX,MAAM,aAAa,GAAG,IAAA,cAAY,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAClD,IAAI,aAAa;YACf,OAAO,GAAG,aAAa,CAAC,KAAK,IAAI,aAAa,CAAC,KAAK,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC;KACjF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAPD,4CAOC;AAED,gBAAgB;AAChB,uBAAuB;AAChB,MAAM,mBAAmB,GAAG,CAAC,eAAuB,EAAE,EAAE,CAAC,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;AAAzF,QAAA,mBAAmB,uBAAsE","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 { DbResult, Id64String } from \"@itwin/core-bentley\";\r\nimport { Element, IModelDb } from \"@itwin/core-backend\";\r\nimport { InstanceKey } from \"@itwin/presentation-common\";\r\nimport path from \"path\";\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 } 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 return \"0.0.0\";\r\n}\r\n\r\n/** @internal */\r\n// istanbul ignore next\r\nexport const getLocalesDirectory = (assetsDirectory: string) => path.join(assetsDirectory, \"locales\");\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/presentation-backend",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0-dev.0",
|
|
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.
|
|
26
|
-
"@itwin/core-bentley": "^3.
|
|
27
|
-
"@itwin/core-common": "^3.
|
|
28
|
-
"@itwin/core-quantity": "^3.
|
|
29
|
-
"@itwin/presentation-common": "^3.
|
|
25
|
+
"@itwin/core-backend": "^3.3.0-dev.0",
|
|
26
|
+
"@itwin/core-bentley": "^3.3.0-dev.0",
|
|
27
|
+
"@itwin/core-common": "^3.3.0-dev.0",
|
|
28
|
+
"@itwin/core-quantity": "^3.3.0-dev.0",
|
|
29
|
+
"@itwin/presentation-common": "^3.3.0-dev.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@itwin/build-tools": "3.
|
|
33
|
-
"@itwin/core-backend": "3.
|
|
34
|
-
"@itwin/core-bentley": "3.
|
|
35
|
-
"@itwin/core-common": "3.
|
|
36
|
-
"@itwin/core-quantity": "3.
|
|
37
|
-
"@itwin/eslint-plugin": "3.
|
|
38
|
-
"@itwin/presentation-common": "3.
|
|
32
|
+
"@itwin/build-tools": "3.3.0-dev.0",
|
|
33
|
+
"@itwin/core-backend": "3.3.0-dev.0",
|
|
34
|
+
"@itwin/core-bentley": "3.3.0-dev.0",
|
|
35
|
+
"@itwin/core-common": "3.3.0-dev.0",
|
|
36
|
+
"@itwin/core-quantity": "3.3.0-dev.0",
|
|
37
|
+
"@itwin/eslint-plugin": "3.3.0-dev.0",
|
|
38
|
+
"@itwin/presentation-common": "3.3.0-dev.0",
|
|
39
39
|
"@types/chai": "^4.1.4",
|
|
40
40
|
"@types/chai-as-promised": "^7",
|
|
41
41
|
"@types/chai-jest-snapshot": "^1.3.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@types/faker": "^4.1.0",
|
|
45
45
|
"@types/lolex": "^2.1.2",
|
|
46
46
|
"@types/mocha": "^8.2.2",
|
|
47
|
-
"@types/node": "
|
|
47
|
+
"@types/node": "16.11.7",
|
|
48
48
|
"@types/object-hash": "^1.3.0",
|
|
49
49
|
"@types/semver": "^5.5.0",
|
|
50
50
|
"@types/sinon": "^9.0.0",
|