@itwin/presentation-backend 5.0.0-dev.11 → 5.0.0-dev.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/CHANGELOG.md +73 -1
  2. package/lib/cjs/package.json +1 -0
  3. package/lib/cjs/presentation-backend/BackendLoggerCategory.js.map +1 -1
  4. package/lib/cjs/presentation-backend/ElementPropertiesHelper.d.ts +31 -4
  5. package/lib/cjs/presentation-backend/ElementPropertiesHelper.d.ts.map +1 -1
  6. package/lib/cjs/presentation-backend/ElementPropertiesHelper.js +161 -56
  7. package/lib/cjs/presentation-backend/ElementPropertiesHelper.js.map +1 -1
  8. package/lib/cjs/presentation-backend/InternalSymbols.d.ts +5 -0
  9. package/lib/cjs/presentation-backend/InternalSymbols.d.ts.map +1 -0
  10. package/lib/cjs/presentation-backend/InternalSymbols.js +16 -0
  11. package/lib/cjs/presentation-backend/InternalSymbols.js.map +1 -0
  12. package/lib/cjs/presentation-backend/NativePlatform.d.ts +2 -2
  13. package/lib/cjs/presentation-backend/NativePlatform.d.ts.map +1 -1
  14. package/lib/cjs/presentation-backend/NativePlatform.js +5 -3
  15. package/lib/cjs/presentation-backend/NativePlatform.js.map +1 -1
  16. package/lib/cjs/presentation-backend/Presentation.d.ts +2 -7
  17. package/lib/cjs/presentation-backend/Presentation.d.ts.map +1 -1
  18. package/lib/cjs/presentation-backend/Presentation.js +40 -29
  19. package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
  20. package/lib/cjs/presentation-backend/PresentationIpcHandler.d.ts +3 -3
  21. package/lib/cjs/presentation-backend/PresentationIpcHandler.d.ts.map +1 -1
  22. package/lib/cjs/presentation-backend/PresentationIpcHandler.js +5 -7
  23. package/lib/cjs/presentation-backend/PresentationIpcHandler.js.map +1 -1
  24. package/lib/cjs/presentation-backend/PresentationManager.d.ts +13 -90
  25. package/lib/cjs/presentation-backend/PresentationManager.d.ts.map +1 -1
  26. package/lib/cjs/presentation-backend/PresentationManager.js +79 -130
  27. package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
  28. package/lib/cjs/presentation-backend/PresentationManagerDetail.d.ts +19 -10
  29. package/lib/cjs/presentation-backend/PresentationManagerDetail.d.ts.map +1 -1
  30. package/lib/cjs/presentation-backend/PresentationManagerDetail.js +83 -76
  31. package/lib/cjs/presentation-backend/PresentationManagerDetail.js.map +1 -1
  32. package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts +11 -11
  33. package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
  34. package/lib/cjs/presentation-backend/PresentationRpcImpl.js +110 -118
  35. package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
  36. package/lib/cjs/presentation-backend/RulesetEmbedder.d.ts.map +1 -1
  37. package/lib/cjs/presentation-backend/RulesetEmbedder.js +26 -27
  38. package/lib/cjs/presentation-backend/RulesetEmbedder.js.map +1 -1
  39. package/lib/cjs/presentation-backend/RulesetManager.d.ts +1 -1
  40. package/lib/cjs/presentation-backend/RulesetManager.d.ts.map +1 -1
  41. package/lib/cjs/presentation-backend/RulesetManager.js +2 -1
  42. package/lib/cjs/presentation-backend/RulesetManager.js.map +1 -1
  43. package/lib/cjs/presentation-backend/RulesetVariablesManager.d.ts +1 -1
  44. package/lib/cjs/presentation-backend/RulesetVariablesManager.d.ts.map +1 -1
  45. package/lib/cjs/presentation-backend/RulesetVariablesManager.js +2 -0
  46. package/lib/cjs/presentation-backend/RulesetVariablesManager.js.map +1 -1
  47. package/lib/cjs/presentation-backend/SelectionScopesHelper.d.ts +2 -4
  48. package/lib/cjs/presentation-backend/SelectionScopesHelper.d.ts.map +1 -1
  49. package/lib/cjs/presentation-backend/SelectionScopesHelper.js +85 -98
  50. package/lib/cjs/presentation-backend/SelectionScopesHelper.js.map +1 -1
  51. package/lib/cjs/presentation-backend/TemporaryStorage.d.ts +2 -3
  52. package/lib/cjs/presentation-backend/TemporaryStorage.d.ts.map +1 -1
  53. package/lib/cjs/presentation-backend/TemporaryStorage.js +30 -28
  54. package/lib/cjs/presentation-backend/TemporaryStorage.js.map +1 -1
  55. package/lib/cjs/presentation-backend/Utils.d.ts.map +1 -1
  56. package/lib/cjs/presentation-backend/Utils.js +15 -21
  57. package/lib/cjs/presentation-backend/Utils.js.map +1 -1
  58. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js +2 -2
  59. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js.map +1 -1
  60. package/lib/cjs/presentation-backend/domain/RulesetElements.js +4 -4
  61. package/lib/cjs/presentation-backend/domain/RulesetElements.js.map +1 -1
  62. package/lib/cjs/presentation-backend-internal.d.ts +2 -0
  63. package/lib/cjs/presentation-backend-internal.d.ts.map +1 -0
  64. package/lib/cjs/presentation-backend-internal.js +12 -0
  65. package/lib/cjs/presentation-backend-internal.js.map +1 -0
  66. package/lib/cjs/presentation-backend.d.ts +7 -7
  67. package/lib/cjs/presentation-backend.d.ts.map +1 -1
  68. package/lib/cjs/presentation-backend.js +11 -21
  69. package/lib/cjs/presentation-backend.js.map +1 -1
  70. package/lib/esm/presentation-backend/BackendLoggerCategory.d.ts +62 -0
  71. package/lib/esm/presentation-backend/BackendLoggerCategory.d.ts.map +1 -0
  72. package/lib/esm/presentation-backend/BackendLoggerCategory.js +69 -0
  73. package/lib/esm/presentation-backend/BackendLoggerCategory.js.map +1 -0
  74. package/lib/esm/presentation-backend/ElementPropertiesHelper.d.ts +45 -0
  75. package/lib/esm/presentation-backend/ElementPropertiesHelper.d.ts.map +1 -0
  76. package/lib/esm/presentation-backend/ElementPropertiesHelper.js +187 -0
  77. package/lib/esm/presentation-backend/ElementPropertiesHelper.js.map +1 -0
  78. package/lib/esm/presentation-backend/InternalSymbols.d.ts +5 -0
  79. package/lib/esm/presentation-backend/InternalSymbols.d.ts.map +1 -0
  80. package/lib/esm/presentation-backend/InternalSymbols.js +13 -0
  81. package/lib/esm/presentation-backend/InternalSymbols.js.map +1 -0
  82. package/lib/esm/presentation-backend/NativePlatform.d.ts +89 -0
  83. package/lib/esm/presentation-backend/NativePlatform.d.ts.map +1 -0
  84. package/lib/esm/presentation-backend/NativePlatform.js +156 -0
  85. package/lib/esm/presentation-backend/NativePlatform.js.map +1 -0
  86. package/lib/esm/presentation-backend/Presentation.d.ts +97 -0
  87. package/lib/esm/presentation-backend/Presentation.d.ts.map +1 -0
  88. package/lib/esm/presentation-backend/Presentation.js +147 -0
  89. package/lib/esm/presentation-backend/Presentation.js.map +1 -0
  90. package/lib/esm/presentation-backend/PresentationIpcHandler.d.ts +12 -0
  91. package/lib/esm/presentation-backend/PresentationIpcHandler.d.ts.map +1 -0
  92. package/lib/esm/presentation-backend/PresentationIpcHandler.js +25 -0
  93. package/lib/esm/presentation-backend/PresentationIpcHandler.js.map +1 -0
  94. package/lib/esm/presentation-backend/PresentationManager.d.ts +387 -0
  95. package/lib/esm/presentation-backend/PresentationManager.d.ts.map +1 -0
  96. package/lib/esm/presentation-backend/PresentationManager.js +352 -0
  97. package/lib/esm/presentation-backend/PresentationManager.js.map +1 -0
  98. package/lib/esm/presentation-backend/PresentationManagerDetail.d.ts +74 -0
  99. package/lib/esm/presentation-backend/PresentationManagerDetail.d.ts.map +1 -0
  100. package/lib/esm/presentation-backend/PresentationManagerDetail.js +446 -0
  101. package/lib/esm/presentation-backend/PresentationManagerDetail.js.map +1 -0
  102. package/lib/esm/presentation-backend/PresentationRpcImpl.d.ts +63 -0
  103. package/lib/esm/presentation-backend/PresentationRpcImpl.d.ts.map +1 -0
  104. package/lib/esm/presentation-backend/PresentationRpcImpl.js +409 -0
  105. package/lib/esm/presentation-backend/PresentationRpcImpl.js.map +1 -0
  106. package/lib/esm/presentation-backend/RulesetEmbedder.d.ts +109 -0
  107. package/lib/esm/presentation-backend/RulesetEmbedder.d.ts.map +1 -0
  108. package/lib/esm/presentation-backend/RulesetEmbedder.js +269 -0
  109. package/lib/esm/presentation-backend/RulesetEmbedder.js.map +1 -0
  110. package/lib/esm/presentation-backend/RulesetManager.d.ts +54 -0
  111. package/lib/esm/presentation-backend/RulesetManager.d.ts.map +1 -0
  112. package/lib/esm/presentation-backend/RulesetManager.js +74 -0
  113. package/lib/esm/presentation-backend/RulesetManager.js.map +1 -0
  114. package/lib/esm/presentation-backend/RulesetVariablesManager.d.ts +141 -0
  115. package/lib/esm/presentation-backend/RulesetVariablesManager.d.ts.map +1 -0
  116. package/lib/esm/presentation-backend/RulesetVariablesManager.js +140 -0
  117. package/lib/esm/presentation-backend/RulesetVariablesManager.js.map +1 -0
  118. package/lib/esm/presentation-backend/SelectionScopesHelper.d.ts +27 -0
  119. package/lib/esm/presentation-backend/SelectionScopesHelper.d.ts.map +1 -0
  120. package/lib/esm/presentation-backend/SelectionScopesHelper.js +227 -0
  121. package/lib/esm/presentation-backend/SelectionScopesHelper.js.map +1 -0
  122. package/lib/esm/presentation-backend/TemporaryStorage.d.ts +123 -0
  123. package/lib/esm/presentation-backend/TemporaryStorage.d.ts.map +1 -0
  124. package/lib/esm/presentation-backend/TemporaryStorage.js +157 -0
  125. package/lib/esm/presentation-backend/TemporaryStorage.js.map +1 -0
  126. package/lib/esm/presentation-backend/Utils.d.ts +50 -0
  127. package/lib/esm/presentation-backend/Utils.d.ts.map +1 -0
  128. package/lib/esm/presentation-backend/Utils.js +101 -0
  129. package/lib/esm/presentation-backend/Utils.js.map +1 -0
  130. package/lib/esm/presentation-backend/domain/PresentationRulesDomain.d.ts +17 -0
  131. package/lib/esm/presentation-backend/domain/PresentationRulesDomain.d.ts.map +1 -0
  132. package/lib/esm/presentation-backend/domain/PresentationRulesDomain.js +31 -0
  133. package/lib/esm/presentation-backend/domain/PresentationRulesDomain.js.map +1 -0
  134. package/lib/esm/presentation-backend/domain/RulesetElements.d.ts +22 -0
  135. package/lib/esm/presentation-backend/domain/RulesetElements.d.ts.map +1 -0
  136. package/lib/esm/presentation-backend/domain/RulesetElements.js +38 -0
  137. package/lib/esm/presentation-backend/domain/RulesetElements.js.map +1 -0
  138. package/lib/esm/presentation-backend/primary-presentation-rules/ElementProperties.PresentationRuleSet.json +14 -0
  139. package/lib/esm/presentation-backend/supplemental-presentation-rules/BisCore.PresentationRuleSet.json +701 -0
  140. package/lib/esm/presentation-backend/supplemental-presentation-rules/Functional.PresentationRuleSet.json +139 -0
  141. package/lib/esm/presentation-backend-internal.d.ts +2 -0
  142. package/lib/esm/presentation-backend-internal.d.ts.map +1 -0
  143. package/lib/esm/presentation-backend-internal.js +8 -0
  144. package/lib/esm/presentation-backend-internal.js.map +1 -0
  145. package/lib/esm/presentation-backend.d.ts +20 -0
  146. package/lib/esm/presentation-backend.d.ts.map +1 -0
  147. package/lib/esm/presentation-backend.js +21 -0
  148. package/lib/esm/presentation-backend.js.map +1 -0
  149. package/package.json +42 -35
@@ -0,0 +1,409 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module RPC
7
+ */
8
+ import { IModelDb, RpcTrace } from "@itwin/core-backend";
9
+ import { BeEvent, ErrorCategory, Logger, omit, StatusCategory, SuccessCategory } from "@itwin/core-bentley";
10
+ import { RpcPendingResponse } from "@itwin/core-common";
11
+ import { ContentFlags, DefaultContentDisplayTypes, KeySet, PresentationError, PresentationRpcInterface, PresentationStatus, RulesetVariable, SelectClassInfo, } from "@itwin/presentation-common";
12
+ import { buildElementProperties, createCancellableTimeoutPromise, deepReplaceNullsToUndefined } from "@itwin/presentation-common/internal";
13
+ // @ts-expect-error TS complains about `with` in CJS builds; The path is fine at runtime, but not at compile time
14
+ // eslint-disable-next-line @itwin/import-within-package
15
+ import packageJson from "../../../package.json" with { type: "json" };
16
+ import { PresentationBackendLoggerCategory } from "./BackendLoggerCategory.js";
17
+ import { Presentation } from "./Presentation.js";
18
+ import { DESCRIPTOR_ONLY_CONTENT_FLAG, getRulesetIdObject } from "./PresentationManagerDetail.js";
19
+ import { TemporaryStorage } from "./TemporaryStorage.js";
20
+ import { _presentation_manager_detail } from "./InternalSymbols.js";
21
+ const packageJsonVersion = packageJson.version;
22
+ /** @internal */
23
+ export const MAX_ALLOWED_PAGE_SIZE = 1000;
24
+ /** @internal */
25
+ export const MAX_ALLOWED_KEYS_PAGE_SIZE = 10000;
26
+ const DEFAULT_REQUEST_TIMEOUT = 5000;
27
+ /**
28
+ * The backend implementation of PresentationRpcInterface. All it's basically
29
+ * responsible for is forwarding calls to [[Presentation.manager]].
30
+ *
31
+ * @internal
32
+ */
33
+ export class PresentationRpcImpl extends PresentationRpcInterface {
34
+ _requestTimeout;
35
+ _pendingRequests;
36
+ _cancelEvents;
37
+ _statusHandler;
38
+ constructor(props) {
39
+ super();
40
+ this._requestTimeout = props?.requestTimeout ?? DEFAULT_REQUEST_TIMEOUT;
41
+ this._pendingRequests = new TemporaryStorage({
42
+ // remove the pending request after request timeout + 10 seconds - this gives
43
+ // frontend 10 seconds to re-send the request until it's removed from requests' cache
44
+ unusedValueLifetime: this._requestTimeout > 0 ? this._requestTimeout + 10 * 1000 : undefined,
45
+ // attempt to clean up every second
46
+ cleanupInterval: 1000,
47
+ cleanupHandler: (id, _, reason) => {
48
+ if (reason !== "request") {
49
+ Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Cleaning up request without frontend retrieving it: ${id}.`);
50
+ /* c8 ignore next */
51
+ this._cancelEvents.get(id)?.raiseEvent();
52
+ }
53
+ this._cancelEvents.delete(id);
54
+ },
55
+ });
56
+ this._cancelEvents = new Map();
57
+ this._statusHandler = createStatusCategoryHandler();
58
+ StatusCategory.handlers.add(this._statusHandler);
59
+ }
60
+ [Symbol.dispose]() {
61
+ this._pendingRequests[Symbol.dispose]();
62
+ StatusCategory.handlers.delete(this._statusHandler);
63
+ }
64
+ get requestTimeout() {
65
+ return this._requestTimeout;
66
+ }
67
+ get pendingRequests() {
68
+ return this._pendingRequests;
69
+ }
70
+ /** Returns an ok response with result inside */
71
+ successResponse(result, diagnostics) {
72
+ return {
73
+ statusCode: PresentationStatus.Success,
74
+ result,
75
+ diagnostics,
76
+ };
77
+ }
78
+ /** Returns a bad request response with empty result and an error code */
79
+ errorResponse(errorCode, errorMessage, diagnostics) {
80
+ return {
81
+ statusCode: errorCode,
82
+ result: undefined,
83
+ errorMessage,
84
+ diagnostics,
85
+ };
86
+ }
87
+ /**
88
+ * Get the [[PresentationManager]] used by this RPC impl.
89
+ */
90
+ getManager(clientId) {
91
+ return Presentation.getManager(clientId);
92
+ }
93
+ async getIModel(token) {
94
+ const imodel = IModelDb.findByKey(token.key);
95
+ // call refreshContainer, just in case this is a V2 checkpoint whose sasToken is about to expire, or its default transaction is about to be restarted.
96
+ await imodel.refreshContainerForRpc(RpcTrace.expectCurrentActivity.accessToken);
97
+ return imodel;
98
+ }
99
+ async makeRequest(token, requestId, requestOptions, request) {
100
+ const serializedRequestOptionsForLogging = JSON.stringify({
101
+ ...omit(requestOptions, ["rulesetOrId"]),
102
+ ...(requestOptions.rulesetOrId ? { rulesetId: getRulesetIdObject(requestOptions.rulesetOrId).uniqueId } : undefined),
103
+ });
104
+ Logger.logInfo(PresentationBackendLoggerCategory.Rpc, `Received '${requestId}' request. Params: ${serializedRequestOptionsForLogging}`);
105
+ const imodel = await this.getIModel(token);
106
+ const requestKey = JSON.stringify({ iModelKey: token.key, requestId, requestOptions });
107
+ let resultPromise = this._pendingRequests.getValue(requestKey);
108
+ if (resultPromise) {
109
+ Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request already pending`);
110
+ }
111
+ else {
112
+ Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request not found, creating a new one`);
113
+ const { clientId: _, diagnostics: diagnosticsOptions, rulesetVariables, ...options } = requestOptions;
114
+ const managerRequestOptions = {
115
+ ...options,
116
+ imodel,
117
+ cancelEvent: new BeEvent(),
118
+ };
119
+ // set up ruleset variables
120
+ if (rulesetVariables) {
121
+ managerRequestOptions.rulesetVariables = rulesetVariables.map(RulesetVariable.fromJSON);
122
+ }
123
+ // set up diagnostics listener
124
+ let diagnostics;
125
+ const getDiagnostics = () => {
126
+ if (!diagnostics) {
127
+ diagnostics = {};
128
+ }
129
+ return diagnostics;
130
+ };
131
+ if (diagnosticsOptions) {
132
+ if (diagnosticsOptions.backendVersion) {
133
+ getDiagnostics().backendVersion = packageJsonVersion;
134
+ }
135
+ managerRequestOptions.diagnostics = {
136
+ ...diagnosticsOptions,
137
+ handler: (d) => {
138
+ if (d.logs) {
139
+ const target = getDiagnostics();
140
+ if (target.logs) {
141
+ target.logs.push(...d.logs);
142
+ }
143
+ else {
144
+ target.logs = [...d.logs];
145
+ }
146
+ }
147
+ },
148
+ };
149
+ }
150
+ // initiate request
151
+ resultPromise = request(managerRequestOptions).then((result) => this.successResponse(result, diagnostics));
152
+ // store the request promise
153
+ this._pendingRequests.addValue(requestKey, resultPromise);
154
+ this._cancelEvents.set(requestKey, managerRequestOptions.cancelEvent);
155
+ }
156
+ if (this._requestTimeout === 0) {
157
+ Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request timeout not configured, returning promise without a timeout.`);
158
+ void resultPromise.finally(() => {
159
+ this._pendingRequests.deleteValue(requestKey);
160
+ });
161
+ return resultPromise;
162
+ }
163
+ Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Returning a promise with a timeout of ${this._requestTimeout}.`);
164
+ const timeout = createCancellableTimeoutPromise(this._requestTimeout);
165
+ return Promise.race([
166
+ resultPromise,
167
+ timeout.promise.then(() => {
168
+ // eslint-disable-next-line @typescript-eslint/only-throw-error
169
+ throw new RpcPendingResponse("Timeout");
170
+ }),
171
+ ])
172
+ .then((response) => {
173
+ Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request completed, returning result.`);
174
+ this._pendingRequests.deleteValue(requestKey);
175
+ return response;
176
+ })
177
+ .finally(() => {
178
+ timeout.cancel();
179
+ });
180
+ }
181
+ async getNodesCount(token, requestOptions) {
182
+ return this.makeRequest(token, "getNodesCount", requestOptions, async (options) => {
183
+ return this.getManager(requestOptions.clientId).getNodesCount(options);
184
+ });
185
+ }
186
+ async getPagedNodes(token, requestOptions) {
187
+ return this.makeRequest(token, "getPagedNodes", requestOptions, async (options) => {
188
+ options = enforceValidPageSize(options);
189
+ const [serializedHierarchyLevel, count] = await Promise.all([
190
+ this.getManager(requestOptions.clientId)[_presentation_manager_detail].getNodes(options),
191
+ this.getManager(requestOptions.clientId).getNodesCount(options),
192
+ ]);
193
+ const hierarchyLevel = deepReplaceNullsToUndefined(JSON.parse(serializedHierarchyLevel));
194
+ return {
195
+ total: count,
196
+ items: hierarchyLevel.nodes,
197
+ };
198
+ });
199
+ }
200
+ async getNodesDescriptor(token, requestOptions) {
201
+ return this.makeRequest(token, "getNodesDescriptor", requestOptions, async (options) => {
202
+ return this.getManager(requestOptions.clientId)[_presentation_manager_detail].getNodesDescriptor(options);
203
+ });
204
+ }
205
+ async getNodePaths(token, requestOptions) {
206
+ return this.makeRequest(token, "getNodePaths", requestOptions, async (options) => {
207
+ return this.getManager(requestOptions.clientId)[_presentation_manager_detail].getNodePaths(options);
208
+ });
209
+ }
210
+ async getFilteredNodePaths(token, requestOptions) {
211
+ return this.makeRequest(token, "getFilteredNodePaths", requestOptions, async (options) => {
212
+ return this.getManager(requestOptions.clientId)[_presentation_manager_detail].getFilteredNodePaths(options);
213
+ });
214
+ }
215
+ async getContentSources(token, requestOptions) {
216
+ return this.makeRequest(token, "getContentSources", requestOptions, async (options) => {
217
+ const result = await this.getManager(requestOptions.clientId).getContentSources(options);
218
+ const classesMap = {};
219
+ const selectClasses = result.map((sci) => SelectClassInfo.toCompressedJSON(sci, classesMap));
220
+ return { sources: selectClasses, classesMap };
221
+ });
222
+ }
223
+ async getContentDescriptor(token, requestOptions) {
224
+ return this.makeRequest(token, "getContentDescriptor", requestOptions, async (options) => {
225
+ options = {
226
+ ...options,
227
+ contentFlags: (options.contentFlags ?? 0) | DESCRIPTOR_ONLY_CONTENT_FLAG, // always append the "descriptor only" flag when handling request from the frontend
228
+ keys: KeySet.fromJSON(options.keys),
229
+ };
230
+ // Here we send a plain JSON string but we will parse it to DescriptorJSON on the frontend. This way we are
231
+ // bypassing unnecessary deserialization and serialization.
232
+ return Presentation.getManager(requestOptions.clientId)[_presentation_manager_detail].getContentDescriptor(options);
233
+ });
234
+ }
235
+ async getContentSetSize(token, requestOptions) {
236
+ return this.makeRequest(token, "getContentSetSize", requestOptions, async (options) => {
237
+ options = {
238
+ ...options,
239
+ keys: KeySet.fromJSON(options.keys),
240
+ };
241
+ return this.getManager(requestOptions.clientId).getContentSetSize(options);
242
+ });
243
+ }
244
+ async getPagedContent(token, requestOptions) {
245
+ return this.makeRequest(token, "getPagedContent", requestOptions, async (options) => {
246
+ options = enforceValidPageSize({
247
+ ...options,
248
+ keys: KeySet.fromJSON(options.keys),
249
+ });
250
+ const [size, content] = await Promise.all([
251
+ this.getManager(requestOptions.clientId).getContentSetSize(options),
252
+ this.getManager(requestOptions.clientId)[_presentation_manager_detail].getContent(options),
253
+ ]);
254
+ if (!content) {
255
+ return undefined;
256
+ }
257
+ return {
258
+ descriptor: content.descriptor.toJSON(),
259
+ contentSet: {
260
+ total: size,
261
+ items: content.contentSet.map((i) => i.toJSON()),
262
+ },
263
+ };
264
+ });
265
+ }
266
+ async getPagedContentSet(token, requestOptions) {
267
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
268
+ const response = await this.getPagedContent(token, requestOptions);
269
+ if (response.statusCode !== PresentationStatus.Success) {
270
+ return this.errorResponse(response.statusCode, response.errorMessage, response.diagnostics);
271
+ }
272
+ if (!response.result) {
273
+ return this.errorResponse(PresentationStatus.Error, `Failed to get content set (received a success response with empty result)`, response.diagnostics);
274
+ }
275
+ return {
276
+ ...response,
277
+ result: response.result.contentSet,
278
+ };
279
+ }
280
+ async getElementProperties(token, requestOptions) {
281
+ return this.makeRequest(token, "getElementProperties", { ...requestOptions }, async (options) => {
282
+ const manager = this.getManager(requestOptions.clientId);
283
+ const { elementId, ...optionsNoElementId } = options;
284
+ const content = await manager[_presentation_manager_detail].getContent({
285
+ ...optionsNoElementId,
286
+ descriptor: {
287
+ displayType: DefaultContentDisplayTypes.PropertyPane,
288
+ contentFlags: ContentFlags.ShowLabels,
289
+ },
290
+ rulesetOrId: "ElementProperties",
291
+ keys: new KeySet([{ className: "BisCore:Element", id: elementId }]),
292
+ });
293
+ if (!content || content.contentSet.length === 0) {
294
+ return undefined;
295
+ }
296
+ return buildElementProperties(content.descriptor, content.contentSet[0]);
297
+ });
298
+ }
299
+ async getPagedDistinctValues(token, requestOptions) {
300
+ return this.makeRequest(token, "getPagedDistinctValues", requestOptions, async (options) => {
301
+ options = enforceValidPageSize({
302
+ ...options,
303
+ keys: KeySet.fromJSON(options.keys),
304
+ });
305
+ return this.getManager(requestOptions.clientId)[_presentation_manager_detail].getPagedDistinctValues(options);
306
+ });
307
+ }
308
+ async getContentInstanceKeys(token, requestOptions) {
309
+ return this.makeRequest(token, "getContentInstanceKeys", requestOptions, async (options) => {
310
+ const { displayType, ...optionsNoDisplayType } = options;
311
+ options = enforceValidPageSize({
312
+ ...optionsNoDisplayType,
313
+ keys: KeySet.fromJSON(optionsNoDisplayType.keys),
314
+ descriptor: {
315
+ displayType,
316
+ contentFlags: ContentFlags.KeysOnly,
317
+ },
318
+ }, MAX_ALLOWED_KEYS_PAGE_SIZE);
319
+ const [size, content] = await Promise.all([
320
+ this.getManager(requestOptions.clientId).getContentSetSize(options),
321
+ this.getManager(requestOptions.clientId)[_presentation_manager_detail].getContent(options),
322
+ ]);
323
+ if (size === 0 || !content) {
324
+ return { total: 0, items: new KeySet().toJSON() };
325
+ }
326
+ return {
327
+ total: size,
328
+ items: content.contentSet.reduce((keys, item) => keys.add(item.primaryKeys), new KeySet()).toJSON(),
329
+ };
330
+ });
331
+ }
332
+ async getDisplayLabelDefinition(token, requestOptions) {
333
+ return this.makeRequest(token, "getDisplayLabelDefinition", requestOptions, async (options) => {
334
+ const label = await this.getManager(requestOptions.clientId)[_presentation_manager_detail].getDisplayLabelDefinition(options);
335
+ return label;
336
+ });
337
+ }
338
+ async getPagedDisplayLabelDefinitions(token, requestOptions) {
339
+ const pageOpts = enforceValidPageSize({ paging: { start: 0, size: requestOptions.keys.length } });
340
+ if (pageOpts.paging.size < requestOptions.keys.length) {
341
+ requestOptions.keys.splice(pageOpts.paging.size);
342
+ }
343
+ return this.makeRequest(token, "getPagedDisplayLabelDefinitions", requestOptions, async (options) => {
344
+ const labels = await this.getManager(requestOptions.clientId)[_presentation_manager_detail].getDisplayLabelDefinitions({
345
+ ...options,
346
+ keys: options.keys,
347
+ });
348
+ return {
349
+ total: options.keys.length,
350
+ items: labels,
351
+ };
352
+ });
353
+ }
354
+ /* eslint-disable @typescript-eslint/no-deprecated */
355
+ async getSelectionScopes(token, requestOptions) {
356
+ return this.makeRequest(token, "getSelectionScopes", requestOptions, async (options) => this.getManager(requestOptions.clientId).getSelectionScopes(options));
357
+ }
358
+ async computeSelection(token, requestOptions) {
359
+ return this.makeRequest(token, "computeSelection", requestOptions, async (options) => {
360
+ const keys = await this.getManager(requestOptions.clientId).computeSelection(options);
361
+ return keys.toJSON();
362
+ });
363
+ }
364
+ }
365
+ const enforceValidPageSize = (requestOptions, maxPageSize = MAX_ALLOWED_PAGE_SIZE) => {
366
+ const validPageSize = getValidPageSize(requestOptions.paging?.size, maxPageSize);
367
+ if (!requestOptions.paging || requestOptions.paging.size !== validPageSize) {
368
+ return { ...requestOptions, paging: { ...requestOptions.paging, size: validPageSize } };
369
+ }
370
+ return requestOptions;
371
+ };
372
+ const getValidPageSize = (size, maxPageSize) => {
373
+ const requestedSize = size ?? 0;
374
+ return requestedSize === 0 || requestedSize > maxPageSize ? maxPageSize : requestedSize;
375
+ };
376
+ // not testing temporary solution
377
+ /* c8 ignore start */
378
+ function createStatusCategoryHandler() {
379
+ return (e) => {
380
+ if (e instanceof PresentationError) {
381
+ switch (e.errorNumber) {
382
+ case PresentationStatus.NotInitialized:
383
+ return new (class extends ErrorCategory {
384
+ name = "Internal server error";
385
+ code = 500;
386
+ })();
387
+ case PresentationStatus.Canceled:
388
+ return new (class extends SuccessCategory {
389
+ name = "Cancelled";
390
+ code = 204;
391
+ })();
392
+ case PresentationStatus.ResultSetTooLarge:
393
+ return new (class extends ErrorCategory {
394
+ name = "Result set is too large";
395
+ code = 413;
396
+ })();
397
+ case PresentationStatus.Error:
398
+ case PresentationStatus.InvalidArgument:
399
+ return new (class extends ErrorCategory {
400
+ name = "Invalid request props";
401
+ code = 422;
402
+ })();
403
+ }
404
+ }
405
+ return undefined;
406
+ };
407
+ }
408
+ /* c8 ignore end */
409
+ //# sourceMappingURL=PresentationRpcImpl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PresentationRpcImpl.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationRpcImpl.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC5G,OAAO,EAAkB,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAIL,YAAY,EAKZ,0BAA0B,EAc1B,MAAM,EAQN,iBAAiB,EACjB,wBAAwB,EAGxB,kBAAkB,EAGlB,eAAe,EAEf,eAAe,GAIhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,+BAA+B,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAC3I,iHAAiH;AACjH,wDAAwD;AACxD,OAAO,WAAW,MAAM,uBAAuB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACtE,OAAO,EAAE,iCAAiC,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE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AC,CAAC;IAChC,OAAO,aAAa,KAAK,CAAC,IAAI,aAAa,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC;AAC1F,CAAC,CAAC;AAEF,iCAAiC;AACjC,qBAAqB;AACrB,SAAS,2BAA2B;IAClC,OAAO,CAAC,CAAQ,EAAE,EAAE;QAClB,IAAI,CAAC,YAAY,iBAAiB,EAAE,CAAC;YACnC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;gBACtB,KAAK,kBAAkB,CAAC,cAAc;oBACpC,OAAO,IAAI,CAAC,KAAM,SAAQ,aAAa;wBAC9B,IAAI,GAAG,uBAAuB,CAAC;wBAC/B,IAAI,GAAG,GAAG,CAAC;qBACnB,CAAC,EAAE,CAAC;gBACP,KAAK,kBAAkB,CAAC,QAAQ;oBAC9B,OAAO,IAAI,CAAC,KAAM,SAAQ,eAAe;wBAChC,IAAI,GAAG,WAAW,CAAC;wBACnB,IAAI,GAAG,GAAG,CAAC;qBACnB,CAAC,EAAE,CAAC;gBACP,KAAK,kBAAkB,CAAC,iBAAiB;oBACvC,OAAO,IAAI,CAAC,KAAM,SAAQ,aAAa;wBAC9B,IAAI,GAAG,yBAAyB,CAAC;wBACjC,IAAI,GAAG,GAAG,CAAC;qBACnB,CAAC,EAAE,CAAC;gBACP,KAAK,kBAAkB,CAAC,KAAK,CAAC;gBAC9B,KAAK,kBAAkB,CAAC,eAAe;oBACrC,OAAO,IAAI,CAAC,KAAM,SAAQ,aAAa;wBAC9B,IAAI,GAAG,uBAAuB,CAAC;wBAC/B,IAAI,GAAG,GAAG,CAAC;qBACnB,CAAC,EAAE,CAAC;YACT,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC;AACD,mBAAmB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RPC\n */\n\nimport { IModelDb, RpcTrace } from \"@itwin/core-backend\";\nimport { BeEvent, ErrorCategory, Logger, omit, StatusCategory, SuccessCategory } from \"@itwin/core-bentley\";\nimport { IModelRpcProps, RpcPendingResponse } from \"@itwin/core-common\";\nimport {\n ClientDiagnostics,\n ComputeSelectionRpcRequestOptions,\n ContentDescriptorRpcRequestOptions,\n ContentFlags,\n ContentInstanceKeysRpcRequestOptions,\n ContentRpcRequestOptions,\n ContentSourcesRpcRequestOptions,\n ContentSourcesRpcResult,\n DefaultContentDisplayTypes,\n DescriptorJSON,\n Diagnostics,\n DisplayLabelRpcRequestOptions,\n DisplayLabelsRpcRequestOptions,\n DisplayValueGroup,\n DistinctValuesRpcRequestOptions,\n ElementProperties,\n FilterByInstancePathsHierarchyRpcRequestOptions,\n FilterByTextHierarchyRpcRequestOptions,\n HierarchyLevel,\n HierarchyLevelDescriptorRpcRequestOptions,\n HierarchyRpcRequestOptions,\n ItemJSON,\n KeySet,\n KeySetJSON,\n LabelDefinition,\n Node,\n NodePathElement,\n Paged,\n PagedResponse,\n PageOptions,\n PresentationError,\n PresentationRpcInterface,\n PresentationRpcResponse,\n PresentationRpcResponseData,\n PresentationStatus,\n RpcDiagnosticsOptions,\n Ruleset,\n RulesetVariable,\n RulesetVariableJSON,\n SelectClassInfo,\n SelectionScope,\n SelectionScopeRpcRequestOptions,\n SingleElementPropertiesRpcRequestOptions,\n} from \"@itwin/presentation-common\";\nimport { buildElementProperties, createCancellableTimeoutPromise, deepReplaceNullsToUndefined } from \"@itwin/presentation-common/internal\";\n// @ts-expect-error TS complains about `with` in CJS builds; The path is fine at runtime, but not at compile time\n// eslint-disable-next-line @itwin/import-within-package\nimport packageJson from \"../../../package.json\" with { type: \"json\" };\nimport { PresentationBackendLoggerCategory } from \"./BackendLoggerCategory.js\";\nimport { Presentation } from \"./Presentation.js\";\nimport { PresentationManager } from \"./PresentationManager.js\";\nimport { DESCRIPTOR_ONLY_CONTENT_FLAG, getRulesetIdObject } from \"./PresentationManagerDetail.js\";\nimport { TemporaryStorage } from \"./TemporaryStorage.js\";\nimport { _presentation_manager_detail } from \"./InternalSymbols.js\";\n\nconst packageJsonVersion = packageJson.version;\n\ntype ContentGetter<TResult = any, TOptions = any> = (requestOptions: TOptions) => TResult;\n\n/** @internal */\nexport const MAX_ALLOWED_PAGE_SIZE = 1000;\n/** @internal */\nexport const MAX_ALLOWED_KEYS_PAGE_SIZE = 10000;\n\nconst DEFAULT_REQUEST_TIMEOUT = 5000;\n\n/**\n * The backend implementation of PresentationRpcInterface. All it's basically\n * responsible for is forwarding calls to [[Presentation.manager]].\n *\n * @internal\n */\nexport class PresentationRpcImpl extends PresentationRpcInterface implements Disposable {\n private _requestTimeout: number;\n private _pendingRequests: TemporaryStorage<PresentationRpcResponse<any>>;\n private _cancelEvents: Map<string, BeEvent<() => void>>;\n private _statusHandler: (e: Error) => StatusCategory | undefined;\n\n public constructor(props?: { requestTimeout?: number }) {\n super();\n this._requestTimeout = props?.requestTimeout ?? DEFAULT_REQUEST_TIMEOUT;\n this._pendingRequests = new TemporaryStorage({\n // remove the pending request after request timeout + 10 seconds - this gives\n // frontend 10 seconds to re-send the request until it's removed from requests' cache\n unusedValueLifetime: this._requestTimeout > 0 ? this._requestTimeout + 10 * 1000 : undefined,\n\n // attempt to clean up every second\n cleanupInterval: 1000,\n\n cleanupHandler: (id, _, reason) => {\n if (reason !== \"request\") {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Cleaning up request without frontend retrieving it: ${id}.`);\n /* c8 ignore next */\n this._cancelEvents.get(id)?.raiseEvent();\n }\n this._cancelEvents.delete(id);\n },\n });\n this._cancelEvents = new Map<string, BeEvent<() => void>>();\n\n this._statusHandler = createStatusCategoryHandler();\n StatusCategory.handlers.add(this._statusHandler);\n }\n\n public [Symbol.dispose]() {\n this._pendingRequests[Symbol.dispose]();\n StatusCategory.handlers.delete(this._statusHandler);\n }\n\n public get requestTimeout() {\n return this._requestTimeout;\n }\n\n public get pendingRequests() {\n return this._pendingRequests;\n }\n\n /** Returns an ok response with result inside */\n private successResponse<TResult>(result: TResult, diagnostics?: ClientDiagnostics) {\n return {\n statusCode: PresentationStatus.Success,\n result,\n diagnostics,\n };\n }\n\n /** Returns a bad request response with empty result and an error code */\n private errorResponse(errorCode: PresentationStatus, errorMessage?: string, diagnostics?: ClientDiagnostics) {\n return {\n statusCode: errorCode,\n result: undefined,\n errorMessage,\n diagnostics,\n };\n }\n\n /**\n * Get the [[PresentationManager]] used by this RPC impl.\n */\n public getManager(clientId?: string): PresentationManager {\n return Presentation.getManager(clientId);\n }\n\n private async getIModel(token: IModelRpcProps): Promise<IModelDb> {\n const imodel = IModelDb.findByKey(token.key);\n // call refreshContainer, just in case this is a V2 checkpoint whose sasToken is about to expire, or its default transaction is about to be restarted.\n await imodel.refreshContainerForRpc(RpcTrace.expectCurrentActivity.accessToken);\n return imodel;\n }\n\n private async makeRequest<\n TRpcOptions extends { rulesetOrId?: Ruleset | string; clientId?: string; diagnostics?: RpcDiagnosticsOptions; rulesetVariables?: RulesetVariableJSON[] },\n TResult,\n >(token: IModelRpcProps, requestId: string, requestOptions: TRpcOptions, request: ContentGetter<Promise<TResult>>): PresentationRpcResponse<TResult> {\n const serializedRequestOptionsForLogging = JSON.stringify({\n ...omit(requestOptions, [\"rulesetOrId\"]),\n ...(requestOptions.rulesetOrId ? { rulesetId: getRulesetIdObject(requestOptions.rulesetOrId).uniqueId } : undefined),\n });\n Logger.logInfo(PresentationBackendLoggerCategory.Rpc, `Received '${requestId}' request. Params: ${serializedRequestOptionsForLogging}`);\n\n const imodel = await this.getIModel(token);\n const requestKey = JSON.stringify({ iModelKey: token.key, requestId, requestOptions });\n let resultPromise = this._pendingRequests.getValue(requestKey);\n if (resultPromise) {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request already pending`);\n } else {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request not found, creating a new one`);\n const { clientId: _, diagnostics: diagnosticsOptions, rulesetVariables, ...options } = requestOptions;\n const managerRequestOptions: any = {\n ...options,\n imodel,\n cancelEvent: new BeEvent<() => void>(),\n };\n\n // set up ruleset variables\n if (rulesetVariables) {\n managerRequestOptions.rulesetVariables = rulesetVariables.map(RulesetVariable.fromJSON);\n }\n\n // set up diagnostics listener\n let diagnostics: ClientDiagnostics | undefined;\n const getDiagnostics = (): ClientDiagnostics => {\n if (!diagnostics) {\n diagnostics = {};\n }\n return diagnostics;\n };\n if (diagnosticsOptions) {\n if (diagnosticsOptions.backendVersion) {\n getDiagnostics().backendVersion = packageJsonVersion;\n }\n managerRequestOptions.diagnostics = {\n ...diagnosticsOptions,\n handler: (d: Diagnostics) => {\n if (d.logs) {\n const target = getDiagnostics();\n if (target.logs) {\n target.logs.push(...d.logs);\n } else {\n target.logs = [...d.logs];\n }\n }\n },\n };\n }\n\n // initiate request\n resultPromise = request(managerRequestOptions).then((result) => this.successResponse(result, diagnostics));\n\n // store the request promise\n this._pendingRequests.addValue(requestKey, resultPromise);\n this._cancelEvents.set(requestKey, managerRequestOptions.cancelEvent);\n }\n\n if (this._requestTimeout === 0) {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request timeout not configured, returning promise without a timeout.`);\n void resultPromise.finally(() => {\n this._pendingRequests.deleteValue(requestKey);\n });\n return resultPromise;\n }\n\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Returning a promise with a timeout of ${this._requestTimeout}.`);\n const timeout = createCancellableTimeoutPromise(this._requestTimeout);\n return Promise.race([\n resultPromise,\n timeout.promise.then(() => {\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw new RpcPendingResponse(\"Timeout\");\n }),\n ])\n .then((response: PresentationRpcResponseData<TResult>) => {\n Logger.logTrace(PresentationBackendLoggerCategory.Rpc, `Request completed, returning result.`);\n this._pendingRequests.deleteValue(requestKey);\n return response;\n })\n .finally(() => {\n timeout.cancel();\n });\n }\n\n public override async getNodesCount(token: IModelRpcProps, requestOptions: HierarchyRpcRequestOptions): PresentationRpcResponse<number> {\n return this.makeRequest(token, \"getNodesCount\", requestOptions, async (options) => {\n return this.getManager(requestOptions.clientId).getNodesCount(options);\n });\n }\n\n public override async getPagedNodes(token: IModelRpcProps, requestOptions: Paged<HierarchyRpcRequestOptions>): PresentationRpcResponse<PagedResponse<Node>> {\n return this.makeRequest(token, \"getPagedNodes\", requestOptions, async (options) => {\n options = enforceValidPageSize(options);\n const [serializedHierarchyLevel, count] = await Promise.all([\n this.getManager(requestOptions.clientId)[_presentation_manager_detail].getNodes(options),\n this.getManager(requestOptions.clientId).getNodesCount(options),\n ]);\n const hierarchyLevel: HierarchyLevel = deepReplaceNullsToUndefined(JSON.parse(serializedHierarchyLevel));\n return {\n total: count,\n items: hierarchyLevel.nodes,\n };\n });\n }\n\n public override async getNodesDescriptor(\n token: IModelRpcProps,\n requestOptions: HierarchyLevelDescriptorRpcRequestOptions,\n ): PresentationRpcResponse<string | DescriptorJSON | undefined> {\n return this.makeRequest(token, \"getNodesDescriptor\", requestOptions, async (options) => {\n return this.getManager(requestOptions.clientId)[_presentation_manager_detail].getNodesDescriptor(options);\n });\n }\n\n public override async getNodePaths(\n token: IModelRpcProps,\n requestOptions: FilterByInstancePathsHierarchyRpcRequestOptions,\n ): PresentationRpcResponse<NodePathElement[]> {\n return this.makeRequest(token, \"getNodePaths\", requestOptions, async (options) => {\n return this.getManager(requestOptions.clientId)[_presentation_manager_detail].getNodePaths(options);\n });\n }\n\n public override async getFilteredNodePaths(\n token: IModelRpcProps,\n requestOptions: FilterByTextHierarchyRpcRequestOptions,\n ): PresentationRpcResponse<NodePathElement[]> {\n return this.makeRequest(token, \"getFilteredNodePaths\", requestOptions, async (options) => {\n return this.getManager(requestOptions.clientId)[_presentation_manager_detail].getFilteredNodePaths(options);\n });\n }\n\n public override async getContentSources(\n token: IModelRpcProps,\n requestOptions: ContentSourcesRpcRequestOptions,\n ): PresentationRpcResponse<ContentSourcesRpcResult> {\n return this.makeRequest(token, \"getContentSources\", requestOptions, async (options) => {\n const result = await this.getManager(requestOptions.clientId).getContentSources(options);\n const classesMap = {};\n const selectClasses = result.map((sci) => SelectClassInfo.toCompressedJSON(sci, classesMap));\n return { sources: selectClasses, classesMap };\n });\n }\n\n public override async getContentDescriptor(\n token: IModelRpcProps,\n requestOptions: ContentDescriptorRpcRequestOptions,\n ): PresentationRpcResponse<DescriptorJSON | undefined> {\n return this.makeRequest(token, \"getContentDescriptor\", requestOptions, async (options) => {\n options = {\n ...options,\n contentFlags: (options.contentFlags ?? 0) | DESCRIPTOR_ONLY_CONTENT_FLAG, // always append the \"descriptor only\" flag when handling request from the frontend\n keys: KeySet.fromJSON(options.keys),\n };\n // Here we send a plain JSON string but we will parse it to DescriptorJSON on the frontend. This way we are\n // bypassing unnecessary deserialization and serialization.\n return Presentation.getManager(requestOptions.clientId)[_presentation_manager_detail].getContentDescriptor(options) as unknown as\n | DescriptorJSON\n | undefined;\n });\n }\n\n public override async getContentSetSize(token: IModelRpcProps, requestOptions: ContentRpcRequestOptions): PresentationRpcResponse<number> {\n return this.makeRequest(token, \"getContentSetSize\", requestOptions, async (options) => {\n options = {\n ...options,\n keys: KeySet.fromJSON(options.keys),\n };\n return this.getManager(requestOptions.clientId).getContentSetSize(options);\n });\n }\n\n public override async getPagedContent(\n token: IModelRpcProps,\n requestOptions: Paged<ContentRpcRequestOptions>,\n ): PresentationRpcResponse<{ descriptor: DescriptorJSON; contentSet: PagedResponse<ItemJSON> } | undefined> {\n return this.makeRequest(token, \"getPagedContent\", requestOptions, async (options) => {\n options = enforceValidPageSize({\n ...options,\n keys: KeySet.fromJSON(options.keys),\n });\n\n const [size, content] = await Promise.all([\n this.getManager(requestOptions.clientId).getContentSetSize(options),\n this.getManager(requestOptions.clientId)[_presentation_manager_detail].getContent(options),\n ]);\n\n if (!content) {\n return undefined;\n }\n\n return {\n descriptor: content.descriptor.toJSON(),\n contentSet: {\n total: size,\n items: content.contentSet.map((i) => i.toJSON()),\n },\n };\n });\n }\n\n public override async getPagedContentSet(\n token: IModelRpcProps,\n requestOptions: Paged<ContentRpcRequestOptions>,\n ): PresentationRpcResponse<PagedResponse<ItemJSON>> {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const response = await this.getPagedContent(token, requestOptions);\n if (response.statusCode !== PresentationStatus.Success) {\n return this.errorResponse(response.statusCode, response.errorMessage, response.diagnostics);\n }\n if (!response.result) {\n return this.errorResponse(PresentationStatus.Error, `Failed to get content set (received a success response with empty result)`, response.diagnostics);\n }\n return {\n ...response,\n result: response.result.contentSet,\n };\n }\n\n public override async getElementProperties(\n token: IModelRpcProps,\n requestOptions: SingleElementPropertiesRpcRequestOptions,\n ): PresentationRpcResponse<ElementProperties | undefined> {\n return this.makeRequest(token, \"getElementProperties\", { ...requestOptions }, async (options) => {\n const manager = this.getManager(requestOptions.clientId);\n const { elementId, ...optionsNoElementId } = options;\n const content = await manager[_presentation_manager_detail].getContent({\n ...optionsNoElementId,\n descriptor: {\n displayType: DefaultContentDisplayTypes.PropertyPane,\n contentFlags: ContentFlags.ShowLabels,\n },\n rulesetOrId: \"ElementProperties\",\n keys: new KeySet([{ className: \"BisCore:Element\", id: elementId }]),\n });\n if (!content || content.contentSet.length === 0) {\n return undefined;\n }\n return buildElementProperties(content.descriptor, content.contentSet[0]);\n });\n }\n\n public override async getPagedDistinctValues(\n token: IModelRpcProps,\n requestOptions: DistinctValuesRpcRequestOptions,\n ): PresentationRpcResponse<PagedResponse<DisplayValueGroup>> {\n return this.makeRequest(token, \"getPagedDistinctValues\", requestOptions, async (options) => {\n options = enforceValidPageSize({\n ...options,\n keys: KeySet.fromJSON(options.keys),\n });\n return this.getManager(requestOptions.clientId)[_presentation_manager_detail].getPagedDistinctValues(options);\n });\n }\n\n public override async getContentInstanceKeys(\n token: IModelRpcProps,\n requestOptions: ContentInstanceKeysRpcRequestOptions,\n ): PresentationRpcResponse<{ total: number; items: KeySetJSON }> {\n return this.makeRequest(token, \"getContentInstanceKeys\", requestOptions, async (options) => {\n const { displayType, ...optionsNoDisplayType } = options;\n options = enforceValidPageSize(\n {\n ...optionsNoDisplayType,\n keys: KeySet.fromJSON(optionsNoDisplayType.keys),\n descriptor: {\n displayType,\n contentFlags: ContentFlags.KeysOnly,\n },\n },\n MAX_ALLOWED_KEYS_PAGE_SIZE,\n );\n\n const [size, content] = await Promise.all([\n this.getManager(requestOptions.clientId).getContentSetSize(options),\n this.getManager(requestOptions.clientId)[_presentation_manager_detail].getContent(options),\n ]);\n\n if (size === 0 || !content) {\n return { total: 0, items: new KeySet().toJSON() };\n }\n\n return {\n total: size,\n items: content.contentSet.reduce((keys, item) => keys.add(item.primaryKeys), new KeySet()).toJSON(),\n };\n });\n }\n\n public override async getDisplayLabelDefinition(\n token: IModelRpcProps,\n requestOptions: DisplayLabelRpcRequestOptions,\n ): PresentationRpcResponse<LabelDefinition> {\n return this.makeRequest(token, \"getDisplayLabelDefinition\", requestOptions, async (options) => {\n const label = await this.getManager(requestOptions.clientId)[_presentation_manager_detail].getDisplayLabelDefinition(options);\n return label;\n });\n }\n\n public override async getPagedDisplayLabelDefinitions(\n token: IModelRpcProps,\n requestOptions: DisplayLabelsRpcRequestOptions,\n ): PresentationRpcResponse<PagedResponse<LabelDefinition>> {\n const pageOpts = enforceValidPageSize({ paging: { start: 0, size: requestOptions.keys.length } });\n if (pageOpts.paging.size < requestOptions.keys.length) {\n requestOptions.keys.splice(pageOpts.paging.size);\n }\n return this.makeRequest(token, \"getPagedDisplayLabelDefinitions\", requestOptions, async (options) => {\n const labels = await this.getManager(requestOptions.clientId)[_presentation_manager_detail].getDisplayLabelDefinitions({\n ...options,\n keys: options.keys,\n });\n return {\n total: options.keys.length,\n items: labels,\n };\n });\n }\n\n /* eslint-disable @typescript-eslint/no-deprecated */\n public override async getSelectionScopes(token: IModelRpcProps, requestOptions: SelectionScopeRpcRequestOptions): PresentationRpcResponse<SelectionScope[]> {\n return this.makeRequest(token, \"getSelectionScopes\", requestOptions, async (options) =>\n this.getManager(requestOptions.clientId).getSelectionScopes(options),\n );\n }\n\n public override async computeSelection(token: IModelRpcProps, requestOptions: ComputeSelectionRpcRequestOptions): PresentationRpcResponse<KeySetJSON> {\n return this.makeRequest(token, \"computeSelection\", requestOptions, async (options) => {\n const keys = await this.getManager(requestOptions.clientId).computeSelection(options);\n return keys.toJSON();\n });\n }\n /* eslint-enable @typescript-eslint/no-deprecated */\n}\n\nconst enforceValidPageSize = <TOptions extends Paged<object>>(\n requestOptions: TOptions,\n maxPageSize = MAX_ALLOWED_PAGE_SIZE,\n): TOptions & { paging: PageOptions } => {\n const validPageSize = getValidPageSize(requestOptions.paging?.size, maxPageSize);\n if (!requestOptions.paging || requestOptions.paging.size !== validPageSize) {\n return { ...requestOptions, paging: { ...requestOptions.paging, size: validPageSize } };\n }\n return requestOptions as TOptions & { paging: PageOptions };\n};\n\nconst getValidPageSize = (size: number | undefined, maxPageSize: number) => {\n const requestedSize = size ?? 0;\n return requestedSize === 0 || requestedSize > maxPageSize ? maxPageSize : requestedSize;\n};\n\n// not testing temporary solution\n/* c8 ignore start */\nfunction createStatusCategoryHandler() {\n return (e: Error) => {\n if (e instanceof PresentationError) {\n switch (e.errorNumber) {\n case PresentationStatus.NotInitialized:\n return new (class extends ErrorCategory {\n public name = \"Internal server error\";\n public code = 500;\n })();\n case PresentationStatus.Canceled:\n return new (class extends SuccessCategory {\n public name = \"Cancelled\";\n public code = 204;\n })();\n case PresentationStatus.ResultSetTooLarge:\n return new (class extends ErrorCategory {\n public name = \"Result set is too large\";\n public code = 413;\n })();\n case PresentationStatus.Error:\n case PresentationStatus.InvalidArgument:\n return new (class extends ErrorCategory {\n public name = \"Invalid request props\";\n public code = 422;\n })();\n }\n }\n return undefined;\n };\n}\n/* c8 ignore end */\n"]}
@@ -0,0 +1,109 @@
1
+ /** @packageDocumentation
2
+ * @module Core
3
+ */
4
+ import { Entity, IModelDb } from "@itwin/core-backend";
5
+ import { Id64String } from "@itwin/core-bentley";
6
+ import { Ruleset } from "@itwin/presentation-common";
7
+ /**
8
+ * Interface for callbacks which will be called before and after Element/Model updates
9
+ * @public
10
+ */
11
+ interface UpdateCallbacks {
12
+ onBeforeUpdate: (props: Entity) => Promise<void>;
13
+ onAfterUpdate: (props: Entity) => Promise<void>;
14
+ }
15
+ /**
16
+ * Interface for callbacks which will be called before and after Element/Model is inserted
17
+ * @public
18
+ */
19
+ interface InsertCallbacks {
20
+ onBeforeInsert: (props: Entity) => Promise<void>;
21
+ onAfterInsert: (props: Entity) => Promise<void>;
22
+ }
23
+ /**
24
+ * Options for [[RulesetEmbedder.insertRuleset]] operation.
25
+ * @public
26
+ */
27
+ export interface RulesetInsertOptions {
28
+ /**
29
+ * When should insertion be skipped:
30
+ * - `same-id` - if iModel already contains a ruleset with the same id and **any** version
31
+ * - `same-id-and-version-eq` - if iModel already contains a ruleset with same id and version
32
+ * - `same-id-and-version-gte` - if iModel already contains a ruleset with same id and
33
+ * version greater or equal to version of the inserted ruleset.
34
+ *
35
+ * Defaults to `same-id-and-version-eq`.
36
+ */
37
+ skip?: "never" | "same-id" | "same-id-and-version-eq" | "same-id-and-version-gte";
38
+ /**
39
+ * Which existing versions of rulesets with same id should be replaced when we insert a new one:
40
+ * - `all` - replace all rulesets with same id.
41
+ * - `all-lower` - replace rulesets with same id and version lower than the version of inserted ruleset.
42
+ * - `exact` - replace only the ruleset whose id and version matches the inserted ruleset.
43
+ *
44
+ * Defaults to `exact`.
45
+ */
46
+ replaceVersions?: "all" | "all-lower" | "exact";
47
+ /**
48
+ * Callbacks that will be called before and after `Entity` updates
49
+ */
50
+ onEntityUpdate?: UpdateCallbacks;
51
+ /**
52
+ * Callbacks that will be called before and after `Entity` is inserted
53
+ */
54
+ onEntityInsert?: InsertCallbacks;
55
+ }
56
+ /**
57
+ * Properties for creating a `RulesetEmbedder` instance.
58
+ * @public
59
+ */
60
+ export interface RulesetEmbedderProps {
61
+ /** iModel to embed rulesets to */
62
+ imodel: IModelDb;
63
+ /**
64
+ * An ID of existing subject under which presentation ruleset will be located or created.
65
+ * Defaults to 'IModel.rootSubjectId'.
66
+ */
67
+ parentSubjectId?: Id64String;
68
+ }
69
+ /**
70
+ * An API for embedding presentation rulesets into iModels.
71
+ * @public
72
+ */
73
+ export declare class RulesetEmbedder {
74
+ private _imodel;
75
+ private _parentSubjectId;
76
+ private readonly _schemaPath;
77
+ private readonly _rulesetModelName;
78
+ private readonly _rulesetSubjectName;
79
+ /**
80
+ * Constructs RulesetEmbedder
81
+ */
82
+ constructor(props: RulesetEmbedderProps);
83
+ /**
84
+ * Inserts a ruleset into iModel.
85
+ * @param ruleset Ruleset to insert.
86
+ * @param options Options for inserting a ruleset.
87
+ * @returns ID of inserted ruleset element or, if insertion was skipped, ID of existing ruleset with the same ID and highest version.
88
+ */
89
+ insertRuleset(ruleset: Ruleset, options?: RulesetInsertOptions): Promise<Id64String>;
90
+ private updateRuleset;
91
+ private insertNewRuleset;
92
+ /**
93
+ * Get all rulesets embedded in the iModel.
94
+ */
95
+ getRulesets(): Promise<Ruleset[]>;
96
+ private getOrCreateRulesetModel;
97
+ private queryRulesetModel;
98
+ private queryDefinitionPartition;
99
+ private querySubject;
100
+ private insertDefinitionModel;
101
+ private insertDefinitionPartition;
102
+ private insertSubject;
103
+ private handleElementOperationPrerequisites;
104
+ private insertElement;
105
+ private insertModel;
106
+ private updateElement;
107
+ }
108
+ export {};
109
+ //# sourceMappingURL=RulesetEmbedder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RulesetEmbedder.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/RulesetEmbedder.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAoE,MAAM,EAAE,QAAQ,EAAkC,MAAM,qBAAqB,CAAC;AACzJ,OAAO,EAAU,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAezD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAKrD;;;GAGG;AACH,UA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