@itwin/presentation-backend 4.0.0-dev.44 → 4.0.0-dev.48

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 (64) hide show
  1. package/lib/cjs/assets/primary-presentation-rules/ElementProperties.PresentationRuleSet.json +14 -14
  2. package/lib/cjs/assets/supplemental-presentation-rules/BisCore.PresentationRuleSet.json +761 -761
  3. package/lib/cjs/assets/supplemental-presentation-rules/Functional.PresentationRuleSet.json +139 -139
  4. package/lib/cjs/presentation-backend/BackendLoggerCategory.d.ts +41 -41
  5. package/lib/cjs/presentation-backend/BackendLoggerCategory.js +50 -50
  6. package/lib/cjs/presentation-backend/BackendLoggerCategory.js.map +1 -1
  7. package/lib/cjs/presentation-backend/Constants.d.ts +8 -8
  8. package/lib/cjs/presentation-backend/Constants.js +36 -36
  9. package/lib/cjs/presentation-backend/Constants.js.map +1 -1
  10. package/lib/cjs/presentation-backend/ElementPropertiesHelper.d.ts +11 -11
  11. package/lib/cjs/presentation-backend/ElementPropertiesHelper.js +272 -272
  12. package/lib/cjs/presentation-backend/ElementPropertiesHelper.js.map +1 -1
  13. package/lib/cjs/presentation-backend/NativePlatform.d.ts +87 -87
  14. package/lib/cjs/presentation-backend/NativePlatform.d.ts.map +1 -1
  15. package/lib/cjs/presentation-backend/NativePlatform.js +140 -139
  16. package/lib/cjs/presentation-backend/NativePlatform.js.map +1 -1
  17. package/lib/cjs/presentation-backend/Presentation.d.ts +106 -106
  18. package/lib/cjs/presentation-backend/Presentation.js +148 -148
  19. package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
  20. package/lib/cjs/presentation-backend/PresentationIpcHandler.d.ts +12 -12
  21. package/lib/cjs/presentation-backend/PresentationIpcHandler.js +41 -41
  22. package/lib/cjs/presentation-backend/PresentationIpcHandler.js.map +1 -1
  23. package/lib/cjs/presentation-backend/PresentationManager.d.ts +456 -445
  24. package/lib/cjs/presentation-backend/PresentationManager.d.ts.map +1 -1
  25. package/lib/cjs/presentation-backend/PresentationManager.js +309 -309
  26. package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
  27. package/lib/cjs/presentation-backend/PresentationManagerDetail.d.ts +61 -61
  28. package/lib/cjs/presentation-backend/PresentationManagerDetail.js +426 -426
  29. package/lib/cjs/presentation-backend/PresentationManagerDetail.js.map +1 -1
  30. package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts +62 -62
  31. package/lib/cjs/presentation-backend/PresentationRpcImpl.js +388 -388
  32. package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
  33. package/lib/cjs/presentation-backend/RulesetEmbedder.d.ts +102 -102
  34. package/lib/cjs/presentation-backend/RulesetEmbedder.js +281 -281
  35. package/lib/cjs/presentation-backend/RulesetEmbedder.js.map +1 -1
  36. package/lib/cjs/presentation-backend/RulesetManager.d.ts +53 -53
  37. package/lib/cjs/presentation-backend/RulesetManager.js +73 -73
  38. package/lib/cjs/presentation-backend/RulesetManager.js.map +1 -1
  39. package/lib/cjs/presentation-backend/RulesetVariablesManager.d.ts +140 -140
  40. package/lib/cjs/presentation-backend/RulesetVariablesManager.js +129 -129
  41. package/lib/cjs/presentation-backend/RulesetVariablesManager.js.map +1 -1
  42. package/lib/cjs/presentation-backend/SelectionScopesHelper.d.ts +28 -28
  43. package/lib/cjs/presentation-backend/SelectionScopesHelper.js +226 -226
  44. package/lib/cjs/presentation-backend/SelectionScopesHelper.js.map +1 -1
  45. package/lib/cjs/presentation-backend/TemporaryStorage.d.ts +123 -123
  46. package/lib/cjs/presentation-backend/TemporaryStorage.js +151 -151
  47. package/lib/cjs/presentation-backend/TemporaryStorage.js.map +1 -1
  48. package/lib/cjs/presentation-backend/UpdatesTracker.d.ts +27 -27
  49. package/lib/cjs/presentation-backend/UpdatesTracker.js +54 -54
  50. package/lib/cjs/presentation-backend/UpdatesTracker.js.map +1 -1
  51. package/lib/cjs/presentation-backend/Utils.d.ts +49 -49
  52. package/lib/cjs/presentation-backend/Utils.d.ts.map +1 -1
  53. package/lib/cjs/presentation-backend/Utils.js +107 -105
  54. package/lib/cjs/presentation-backend/Utils.js.map +1 -1
  55. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.d.ts +16 -16
  56. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js +51 -51
  57. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js.map +1 -1
  58. package/lib/cjs/presentation-backend/domain/RulesetElements.d.ts +21 -21
  59. package/lib/cjs/presentation-backend/domain/RulesetElements.js +38 -38
  60. package/lib/cjs/presentation-backend/domain/RulesetElements.js.map +1 -1
  61. package/lib/cjs/presentation-backend.d.ts +19 -19
  62. package/lib/cjs/presentation-backend.js +35 -35
  63. package/lib/cjs/presentation-backend.js.map +1 -1
  64. package/package.json +13 -13
@@ -1,427 +1,427 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.bisElementInstanceKeysProcessor = exports.getKeysForContentRequest = exports.getRulesetIdObject = exports.PresentationManagerDetail = void 0;
23
- /*---------------------------------------------------------------------------------------------
24
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
- * See LICENSE.md in the project root for license terms and full copyright notice.
26
- *--------------------------------------------------------------------------------------------*/
27
- const hash = __importStar(require("object-hash"));
28
- const path = __importStar(require("path"));
29
- const core_backend_1 = require("@itwin/core-backend");
30
- const presentation_common_1 = require("@itwin/presentation-common");
31
- const Constants_1 = require("./Constants");
32
- const ElementPropertiesHelper_1 = require("./ElementPropertiesHelper");
33
- const NativePlatform_1 = require("./NativePlatform");
34
- const PresentationManager_1 = require("./PresentationManager");
35
- const RulesetManager_1 = require("./RulesetManager");
36
- const UpdatesTracker_1 = require("./UpdatesTracker");
37
- const Utils_1 = require("./Utils");
38
- /** @internal */
39
- class PresentationManagerDetail {
40
- constructor(params) {
41
- this._disposed = false;
42
- const backendAssetsRoot = ((typeof params.presentationAssetsRoot === "string")
43
- ? params.presentationAssetsRoot
44
- : params.presentationAssetsRoot?.backend) ?? Constants_1.PRESENTATION_BACKEND_ASSETS_ROOT;
45
- const changeTrackingEnabled = !!params.updatesPollInterval;
46
- this._nativePlatform = params.addon ?? createNativePlatform(params.id ?? "", params.workerThreadsCount ?? 2, changeTrackingEnabled, params.caching, params.defaultFormats, params.useMmap);
47
- const getNativePlatform = () => this.getNativePlatform();
48
- if (core_backend_1.IpcHost.isValid && changeTrackingEnabled) {
49
- this._updatesTracker = UpdatesTracker_1.UpdatesTracker.create({
50
- nativePlatformGetter: getNativePlatform,
51
- pollInterval: params.updatesPollInterval,
52
- });
53
- }
54
- else {
55
- this._updatesTracker = undefined;
56
- }
57
- setupRulesetDirectories(this._nativePlatform, backendAssetsRoot, params.supplementalRulesetDirectories ?? [], params.rulesetDirectories ?? []);
58
- this.activeUnitSystem = params.defaultUnitSystem;
59
- this._onManagerUsed = undefined;
60
- this.rulesets = new RulesetManager_1.RulesetManagerImpl(getNativePlatform);
61
- this._diagnosticsOptions = params.diagnostics;
62
- }
63
- dispose() {
64
- if (this._disposed) {
65
- return;
66
- }
67
- this.getNativePlatform().dispose();
68
- this._nativePlatform = undefined;
69
- this._updatesTracker?.dispose();
70
- this._updatesTracker = undefined;
71
- this._disposed = true;
72
- }
73
- getNativePlatform() {
74
- if (this._disposed) {
75
- throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.NotInitialized, "Attempting to use Presentation manager after disposal");
76
- }
77
- return this._nativePlatform;
78
- }
79
- setOnManagerUsedHandler(handler) {
80
- this._onManagerUsed = handler;
81
- }
82
- async getNodes(requestOptions) {
83
- const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;
84
- const params = {
85
- requestId: parentKey ? NativePlatform_1.NativePlatformRequestTypes.GetChildren : NativePlatform_1.NativePlatformRequestTypes.GetRootNodes,
86
- rulesetId: this.registerRuleset(rulesetOrId),
87
- ...strippedOptions,
88
- nodeKey: parentKey,
89
- };
90
- return this.request(params);
91
- }
92
- async getNodesCount(requestOptions) {
93
- const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;
94
- const params = {
95
- requestId: parentKey ? NativePlatform_1.NativePlatformRequestTypes.GetChildrenCount : NativePlatform_1.NativePlatformRequestTypes.GetRootNodesCount,
96
- rulesetId: this.registerRuleset(rulesetOrId),
97
- ...strippedOptions,
98
- nodeKey: parentKey,
99
- };
100
- return JSON.parse(await this.request(params));
101
- }
102
- async getNodesDescriptor(requestOptions) {
103
- const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;
104
- const params = {
105
- requestId: NativePlatform_1.NativePlatformRequestTypes.GetNodesDescriptor,
106
- rulesetId: this.registerRuleset(rulesetOrId),
107
- ...strippedOptions,
108
- nodeKey: parentKey,
109
- };
110
- return this.request(params);
111
- }
112
- async getNodePaths(requestOptions) {
113
- const { rulesetOrId, instancePaths, ...strippedOptions } = requestOptions;
114
- const params = {
115
- requestId: NativePlatform_1.NativePlatformRequestTypes.GetNodePaths,
116
- rulesetId: this.registerRuleset(rulesetOrId),
117
- ...strippedOptions,
118
- paths: instancePaths,
119
- };
120
- return JSON.parse(await this.request(params), presentation_common_1.NodePathElement.listReviver);
121
- }
122
- async getFilteredNodePaths(requestOptions) {
123
- const { rulesetOrId, ...strippedOptions } = requestOptions;
124
- const params = {
125
- requestId: NativePlatform_1.NativePlatformRequestTypes.GetFilteredNodePaths,
126
- rulesetId: this.registerRuleset(rulesetOrId),
127
- ...strippedOptions,
128
- };
129
- return JSON.parse(await this.request(params), presentation_common_1.NodePathElement.listReviver);
130
- }
131
- async getContentDescriptor(requestOptions) {
132
- const { rulesetOrId, ...strippedOptions } = requestOptions;
133
- const params = {
134
- requestId: NativePlatform_1.NativePlatformRequestTypes.GetContentDescriptor,
135
- rulesetId: this.registerRuleset(rulesetOrId),
136
- ...strippedOptions,
137
- contentFlags: presentation_common_1.ContentFlags.DescriptorOnly,
138
- keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),
139
- };
140
- return this.request(params);
141
- }
142
- async getContentSources(requestOptions) {
143
- const params = {
144
- requestId: NativePlatform_1.NativePlatformRequestTypes.GetContentSources,
145
- rulesetId: "ElementProperties",
146
- ...requestOptions,
147
- };
148
- const reviver = (key, value) => {
149
- return key === "" ? presentation_common_1.SelectClassInfo.listFromCompressedJSON(value.sources, value.classesMap) : value;
150
- };
151
- return JSON.parse(await this.request(params), reviver);
152
- }
153
- async getContentSetSize(requestOptions) {
154
- const { rulesetOrId, descriptor, ...strippedOptions } = requestOptions;
155
- const params = {
156
- requestId: NativePlatform_1.NativePlatformRequestTypes.GetContentSetSize,
157
- rulesetId: this.registerRuleset(rulesetOrId),
158
- ...strippedOptions,
159
- keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),
160
- descriptorOverrides: createContentDescriptorOverrides(descriptor),
161
- };
162
- return JSON.parse(await this.request(params));
163
- }
164
- async getContent(requestOptions) {
165
- const { rulesetOrId, descriptor, ...strippedOptions } = requestOptions;
166
- const params = {
167
- requestId: NativePlatform_1.NativePlatformRequestTypes.GetContent,
168
- rulesetId: this.registerRuleset(rulesetOrId),
169
- ...strippedOptions,
170
- keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),
171
- descriptorOverrides: createContentDescriptorOverrides(descriptor),
172
- };
173
- return JSON.parse(await this.request(params), presentation_common_1.Content.reviver);
174
- }
175
- async getPagedDistinctValues(requestOptions) {
176
- const { rulesetOrId, ...strippedOptions } = requestOptions;
177
- const { descriptor, keys, ...strippedOptionsNoDescriptorAndKeys } = strippedOptions;
178
- const params = {
179
- requestId: NativePlatform_1.NativePlatformRequestTypes.GetPagedDistinctValues,
180
- rulesetId: this.registerRuleset(rulesetOrId),
181
- ...strippedOptionsNoDescriptorAndKeys,
182
- keys: getKeysForContentRequest(keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),
183
- descriptorOverrides: createContentDescriptorOverrides(descriptor),
184
- };
185
- const reviver = (key, value) => {
186
- return key === "" ? {
187
- total: value.total,
188
- // eslint-disable-next-line deprecation/deprecation
189
- items: value.items.map(presentation_common_1.DisplayValueGroup.fromJSON),
190
- } : value;
191
- };
192
- return JSON.parse(await this.request(params), reviver);
193
- }
194
- async getDisplayLabelDefinition(requestOptions) {
195
- const params = {
196
- requestId: NativePlatform_1.NativePlatformRequestTypes.GetDisplayLabel,
197
- ...requestOptions,
198
- };
199
- return JSON.parse(await this.request(params));
200
- }
201
- async getDisplayLabelDefinitions(requestOptions) {
202
- const concreteKeys = requestOptions.keys.map((k) => {
203
- if (k.className === "BisCore:Element")
204
- return (0, Utils_1.getElementKey)(requestOptions.imodel, k.id);
205
- return k;
206
- }).filter((k) => !!k);
207
- const contentRequestOptions = {
208
- ...requestOptions,
209
- rulesetOrId: "RulesDrivenECPresentationManager_RulesetId_DisplayLabel",
210
- descriptor: {
211
- displayType: presentation_common_1.DefaultContentDisplayTypes.List,
212
- contentFlags: presentation_common_1.ContentFlags.ShowLabels | presentation_common_1.ContentFlags.NoFields,
213
- },
214
- keys: new presentation_common_1.KeySet(concreteKeys),
215
- };
216
- const content = await this.getContent(contentRequestOptions);
217
- return concreteKeys.map((key) => {
218
- const item = content ? content.contentSet.find((it) => it.primaryKeys.length > 0 && presentation_common_1.InstanceKey.compare(it.primaryKeys[0], key) === 0) : undefined;
219
- if (!item)
220
- return { displayValue: "", rawValue: "", typeName: "" };
221
- return item.label;
222
- });
223
- }
224
- async getElementProperties(requestOptions) {
225
- const { elementId, ...optionsNoElementId } = requestOptions;
226
- const content = await this.getContent({
227
- ...optionsNoElementId,
228
- descriptor: {
229
- displayType: presentation_common_1.DefaultContentDisplayTypes.PropertyPane,
230
- contentFlags: presentation_common_1.ContentFlags.ShowLabels,
231
- },
232
- rulesetOrId: "ElementProperties",
233
- keys: new presentation_common_1.KeySet([{ className: "BisCore:Element", id: elementId }]),
234
- });
235
- const properties = (0, ElementPropertiesHelper_1.buildElementsProperties)(content);
236
- return properties[0];
237
- }
238
- /** Registers given ruleset and replaces the ruleset with its ID in the resulting object */
239
- registerRuleset(rulesetOrId) {
240
- if (typeof rulesetOrId === "object") {
241
- const rulesetWithNativeId = { ...rulesetOrId, id: this.getRulesetId(rulesetOrId) };
242
- return this.rulesets.add(rulesetWithNativeId).id;
243
- }
244
- return rulesetOrId;
245
- }
246
- /** @internal */
247
- getRulesetId(rulesetOrId) {
248
- return getRulesetIdObject(rulesetOrId).uniqueId;
249
- }
250
- async request(params) {
251
- this._onManagerUsed?.();
252
- const { requestId, imodel, unitSystem, diagnostics: requestDiagnostics, cancelEvent, ...strippedParams } = params;
253
- const imodelAddon = this.getNativePlatform().getImodelAddon(imodel);
254
- const response = await withOptionalDiagnostics([this._diagnosticsOptions, requestDiagnostics], async (diagnosticsOptions) => {
255
- const nativeRequestParams = {
256
- requestId,
257
- params: {
258
- unitSystem: toOptionalNativeUnitSystem(unitSystem ?? this.activeUnitSystem),
259
- ...strippedParams,
260
- ...(diagnosticsOptions ? { diagnostics: diagnosticsOptions } : undefined),
261
- },
262
- };
263
- return this.getNativePlatform().handleRequest(imodelAddon, JSON.stringify(nativeRequestParams), cancelEvent);
264
- });
265
- return response.result;
266
- }
267
- }
268
- exports.PresentationManagerDetail = PresentationManagerDetail;
269
- async function withOptionalDiagnostics(diagnosticsOptions, nativePlatformRequestHandler) {
270
- const contexts = diagnosticsOptions.map((d) => d?.requestContextSupplier?.());
271
- const combinedOptions = (0, Utils_1.combineDiagnosticsOptions)(...diagnosticsOptions);
272
- const response = await nativePlatformRequestHandler(combinedOptions);
273
- if (response.diagnostics) {
274
- const diagnostics = { logs: [response.diagnostics] };
275
- diagnosticsOptions.forEach((options, i) => {
276
- options && (0, Utils_1.reportDiagnostics)(diagnostics, options, contexts[i]);
277
- });
278
- }
279
- return response;
280
- }
281
- function setupRulesetDirectories(nativePlatform, presentationAssetsRoot, supplementalRulesetDirectoriesOverrides, rulesetDirectories) {
282
- const supplementalRulesetDirectories = collateAssetDirectories(path.join(presentationAssetsRoot, "supplemental-presentation-rules"), supplementalRulesetDirectoriesOverrides);
283
- nativePlatform.setupSupplementalRulesetDirectories(supplementalRulesetDirectories);
284
- const primaryRulesetDirectories = collateAssetDirectories(path.join(presentationAssetsRoot, "primary-presentation-rules"), rulesetDirectories);
285
- nativePlatform.setupRulesetDirectories(primaryRulesetDirectories);
286
- }
287
- /** @internal */
288
- function getRulesetIdObject(rulesetOrId) {
289
- if (typeof rulesetOrId === "object") {
290
- if (core_backend_1.IpcHost.isValid) {
291
- // in case of native apps we don't want to enforce ruleset id uniqueness as ruleset variables
292
- // are stored on a backend and creating new id will lose those variables
293
- return {
294
- uniqueId: rulesetOrId.id,
295
- parts: { id: rulesetOrId.id },
296
- };
297
- }
298
- const hashedId = hash.MD5(rulesetOrId);
299
- return {
300
- uniqueId: `${rulesetOrId.id}-${hashedId}`,
301
- parts: {
302
- id: rulesetOrId.id,
303
- hash: hashedId,
304
- },
305
- };
306
- }
307
- return { uniqueId: rulesetOrId, parts: { id: rulesetOrId } };
308
- }
309
- exports.getRulesetIdObject = getRulesetIdObject;
310
- /** @internal */
311
- function getKeysForContentRequest(keys, classInstanceKeysProcessor) {
312
- const result = {
313
- instanceKeys: [],
314
- nodeKeys: [],
315
- };
316
- const classInstancesMap = new Map();
317
- keys.forEach((key) => {
318
- if (presentation_common_1.Key.isNodeKey(key)) {
319
- result.nodeKeys.push(key);
320
- }
321
- if (presentation_common_1.Key.isInstanceKey(key)) {
322
- addInstanceKey(classInstancesMap, key);
323
- }
324
- });
325
- if (classInstanceKeysProcessor) {
326
- classInstanceKeysProcessor(classInstancesMap);
327
- }
328
- for (const entry of classInstancesMap) {
329
- if (entry[1].size > 0) {
330
- result.instanceKeys.push([entry["0"], [...entry[1]]]);
331
- }
332
- }
333
- return result;
334
- }
335
- exports.getKeysForContentRequest = getKeysForContentRequest;
336
- /** @internal */
337
- function bisElementInstanceKeysProcessor(imodel, classInstancesMap) {
338
- const elementClassName = "BisCore:Element";
339
- const elementIds = classInstancesMap.get(elementClassName);
340
- if (elementIds) {
341
- const deleteElementIds = new Array();
342
- elementIds.forEach((elementId) => {
343
- const concreteKey = (0, Utils_1.getElementKey)(imodel, elementId);
344
- if (concreteKey && concreteKey.className !== elementClassName) {
345
- deleteElementIds.push(elementId);
346
- addInstanceKey(classInstancesMap, { className: concreteKey.className, id: elementId });
347
- }
348
- });
349
- for (const id of deleteElementIds) {
350
- elementIds.delete(id);
351
- }
352
- }
353
- }
354
- exports.bisElementInstanceKeysProcessor = bisElementInstanceKeysProcessor;
355
- function addInstanceKey(classInstancesMap, key) {
356
- let set = classInstancesMap.get(key.className);
357
- // istanbul ignore else
358
- if (!set) {
359
- set = new Set();
360
- classInstancesMap.set(key.className, set);
361
- }
362
- set.add(key.id);
363
- }
364
- function createNativePlatform(id, workerThreadsCount, changeTrackingEnabled, caching, defaultFormats, useMmap) {
365
- return new ((0, NativePlatform_1.createDefaultNativePlatform)({
366
- id,
367
- taskAllocationsMap: { [Number.MAX_SAFE_INTEGER]: workerThreadsCount },
368
- isChangeTrackingEnabled: changeTrackingEnabled,
369
- cacheConfig: createCacheConfig(caching?.hierarchies),
370
- contentCacheSize: caching?.content?.size,
371
- workerConnectionCacheSize: caching?.workerConnectionCacheSize,
372
- defaultFormats: toNativeUnitFormatsMap(defaultFormats),
373
- useMmap,
374
- }))();
375
- function createCacheConfig(config) {
376
- switch (config?.mode) {
377
- case PresentationManager_1.HierarchyCacheMode.Disk:
378
- return { ...config, directory: normalizeDirectory(config.directory) };
379
- case PresentationManager_1.HierarchyCacheMode.Hybrid:
380
- return {
381
- ...config,
382
- disk: config.disk ? { ...config.disk, directory: normalizeDirectory(config.disk.directory) } : undefined,
383
- };
384
- case PresentationManager_1.HierarchyCacheMode.Memory:
385
- return config;
386
- default:
387
- return { mode: PresentationManager_1.HierarchyCacheMode.Disk, directory: "" };
388
- }
389
- }
390
- function normalizeDirectory(directory) {
391
- return directory ? path.resolve(directory) : "";
392
- }
393
- function toNativeUnitFormatsMap(map) {
394
- if (!map) {
395
- return undefined;
396
- }
397
- const nativeFormatsMap = {};
398
- Object.keys(map).forEach((phenomenon) => {
399
- const unitSystemsFormat = map[phenomenon];
400
- nativeFormatsMap[phenomenon] = {
401
- unitSystems: unitSystemsFormat.unitSystems.map(toNativeUnitSystem),
402
- format: unitSystemsFormat.format,
403
- };
404
- });
405
- return nativeFormatsMap;
406
- }
407
- }
408
- function toOptionalNativeUnitSystem(unitSystem) {
409
- return unitSystem ? toNativeUnitSystem(unitSystem) : undefined;
410
- }
411
- function toNativeUnitSystem(unitSystem) {
412
- switch (unitSystem) {
413
- case "imperial": return NativePlatform_1.NativePresentationUnitSystem.BritishImperial;
414
- case "metric": return NativePlatform_1.NativePresentationUnitSystem.Metric;
415
- case "usCustomary": return NativePlatform_1.NativePresentationUnitSystem.UsCustomary;
416
- case "usSurvey": return NativePlatform_1.NativePresentationUnitSystem.UsSurvey;
417
- }
418
- }
419
- function collateAssetDirectories(mainDirectory, additionalDirectories) {
420
- return [...new Set([mainDirectory, ...additionalDirectories])];
421
- }
422
- const createContentDescriptorOverrides = (descriptorOrOverrides) => {
423
- if (descriptorOrOverrides instanceof presentation_common_1.Descriptor)
424
- return descriptorOrOverrides.createDescriptorOverrides();
425
- return descriptorOrOverrides;
426
- };
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.bisElementInstanceKeysProcessor = exports.getKeysForContentRequest = exports.getRulesetIdObject = exports.PresentationManagerDetail = void 0;
23
+ /*---------------------------------------------------------------------------------------------
24
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
+ * See LICENSE.md in the project root for license terms and full copyright notice.
26
+ *--------------------------------------------------------------------------------------------*/
27
+ const hash = __importStar(require("object-hash"));
28
+ const path = __importStar(require("path"));
29
+ const core_backend_1 = require("@itwin/core-backend");
30
+ const presentation_common_1 = require("@itwin/presentation-common");
31
+ const Constants_1 = require("./Constants");
32
+ const ElementPropertiesHelper_1 = require("./ElementPropertiesHelper");
33
+ const NativePlatform_1 = require("./NativePlatform");
34
+ const PresentationManager_1 = require("./PresentationManager");
35
+ const RulesetManager_1 = require("./RulesetManager");
36
+ const UpdatesTracker_1 = require("./UpdatesTracker");
37
+ const Utils_1 = require("./Utils");
38
+ /** @internal */
39
+ class PresentationManagerDetail {
40
+ constructor(params) {
41
+ this._disposed = false;
42
+ const backendAssetsRoot = ((typeof params.presentationAssetsRoot === "string")
43
+ ? params.presentationAssetsRoot
44
+ : params.presentationAssetsRoot?.backend) ?? Constants_1.PRESENTATION_BACKEND_ASSETS_ROOT;
45
+ const changeTrackingEnabled = !!params.updatesPollInterval;
46
+ this._nativePlatform = params.addon ?? createNativePlatform(params.id ?? "", params.workerThreadsCount ?? 2, changeTrackingEnabled, params.caching, params.defaultFormats, params.useMmap);
47
+ const getNativePlatform = () => this.getNativePlatform();
48
+ if (core_backend_1.IpcHost.isValid && changeTrackingEnabled) {
49
+ this._updatesTracker = UpdatesTracker_1.UpdatesTracker.create({
50
+ nativePlatformGetter: getNativePlatform,
51
+ pollInterval: params.updatesPollInterval,
52
+ });
53
+ }
54
+ else {
55
+ this._updatesTracker = undefined;
56
+ }
57
+ setupRulesetDirectories(this._nativePlatform, backendAssetsRoot, params.supplementalRulesetDirectories ?? [], params.rulesetDirectories ?? []);
58
+ this.activeUnitSystem = params.defaultUnitSystem;
59
+ this._onManagerUsed = undefined;
60
+ this.rulesets = new RulesetManager_1.RulesetManagerImpl(getNativePlatform);
61
+ this._diagnosticsOptions = params.diagnostics;
62
+ }
63
+ dispose() {
64
+ if (this._disposed) {
65
+ return;
66
+ }
67
+ this.getNativePlatform().dispose();
68
+ this._nativePlatform = undefined;
69
+ this._updatesTracker?.dispose();
70
+ this._updatesTracker = undefined;
71
+ this._disposed = true;
72
+ }
73
+ getNativePlatform() {
74
+ if (this._disposed) {
75
+ throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.NotInitialized, "Attempting to use Presentation manager after disposal");
76
+ }
77
+ return this._nativePlatform;
78
+ }
79
+ setOnManagerUsedHandler(handler) {
80
+ this._onManagerUsed = handler;
81
+ }
82
+ async getNodes(requestOptions) {
83
+ const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;
84
+ const params = {
85
+ requestId: parentKey ? NativePlatform_1.NativePlatformRequestTypes.GetChildren : NativePlatform_1.NativePlatformRequestTypes.GetRootNodes,
86
+ rulesetId: this.registerRuleset(rulesetOrId),
87
+ ...strippedOptions,
88
+ nodeKey: parentKey,
89
+ };
90
+ return this.request(params);
91
+ }
92
+ async getNodesCount(requestOptions) {
93
+ const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;
94
+ const params = {
95
+ requestId: parentKey ? NativePlatform_1.NativePlatformRequestTypes.GetChildrenCount : NativePlatform_1.NativePlatformRequestTypes.GetRootNodesCount,
96
+ rulesetId: this.registerRuleset(rulesetOrId),
97
+ ...strippedOptions,
98
+ nodeKey: parentKey,
99
+ };
100
+ return JSON.parse(await this.request(params));
101
+ }
102
+ async getNodesDescriptor(requestOptions) {
103
+ const { rulesetOrId, parentKey, ...strippedOptions } = requestOptions;
104
+ const params = {
105
+ requestId: NativePlatform_1.NativePlatformRequestTypes.GetNodesDescriptor,
106
+ rulesetId: this.registerRuleset(rulesetOrId),
107
+ ...strippedOptions,
108
+ nodeKey: parentKey,
109
+ };
110
+ return this.request(params);
111
+ }
112
+ async getNodePaths(requestOptions) {
113
+ const { rulesetOrId, instancePaths, ...strippedOptions } = requestOptions;
114
+ const params = {
115
+ requestId: NativePlatform_1.NativePlatformRequestTypes.GetNodePaths,
116
+ rulesetId: this.registerRuleset(rulesetOrId),
117
+ ...strippedOptions,
118
+ paths: instancePaths,
119
+ };
120
+ return JSON.parse(await this.request(params), presentation_common_1.NodePathElement.listReviver);
121
+ }
122
+ async getFilteredNodePaths(requestOptions) {
123
+ const { rulesetOrId, ...strippedOptions } = requestOptions;
124
+ const params = {
125
+ requestId: NativePlatform_1.NativePlatformRequestTypes.GetFilteredNodePaths,
126
+ rulesetId: this.registerRuleset(rulesetOrId),
127
+ ...strippedOptions,
128
+ };
129
+ return JSON.parse(await this.request(params), presentation_common_1.NodePathElement.listReviver);
130
+ }
131
+ async getContentDescriptor(requestOptions) {
132
+ const { rulesetOrId, ...strippedOptions } = requestOptions;
133
+ const params = {
134
+ requestId: NativePlatform_1.NativePlatformRequestTypes.GetContentDescriptor,
135
+ rulesetId: this.registerRuleset(rulesetOrId),
136
+ ...strippedOptions,
137
+ contentFlags: presentation_common_1.ContentFlags.DescriptorOnly,
138
+ keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),
139
+ };
140
+ return this.request(params);
141
+ }
142
+ async getContentSources(requestOptions) {
143
+ const params = {
144
+ requestId: NativePlatform_1.NativePlatformRequestTypes.GetContentSources,
145
+ rulesetId: "ElementProperties",
146
+ ...requestOptions,
147
+ };
148
+ const reviver = (key, value) => {
149
+ return key === "" ? presentation_common_1.SelectClassInfo.listFromCompressedJSON(value.sources, value.classesMap) : value;
150
+ };
151
+ return JSON.parse(await this.request(params), reviver);
152
+ }
153
+ async getContentSetSize(requestOptions) {
154
+ const { rulesetOrId, descriptor, ...strippedOptions } = requestOptions;
155
+ const params = {
156
+ requestId: NativePlatform_1.NativePlatformRequestTypes.GetContentSetSize,
157
+ rulesetId: this.registerRuleset(rulesetOrId),
158
+ ...strippedOptions,
159
+ keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),
160
+ descriptorOverrides: createContentDescriptorOverrides(descriptor),
161
+ };
162
+ return JSON.parse(await this.request(params));
163
+ }
164
+ async getContent(requestOptions) {
165
+ const { rulesetOrId, descriptor, ...strippedOptions } = requestOptions;
166
+ const params = {
167
+ requestId: NativePlatform_1.NativePlatformRequestTypes.GetContent,
168
+ rulesetId: this.registerRuleset(rulesetOrId),
169
+ ...strippedOptions,
170
+ keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),
171
+ descriptorOverrides: createContentDescriptorOverrides(descriptor),
172
+ };
173
+ return JSON.parse(await this.request(params), presentation_common_1.Content.reviver);
174
+ }
175
+ async getPagedDistinctValues(requestOptions) {
176
+ const { rulesetOrId, ...strippedOptions } = requestOptions;
177
+ const { descriptor, keys, ...strippedOptionsNoDescriptorAndKeys } = strippedOptions;
178
+ const params = {
179
+ requestId: NativePlatform_1.NativePlatformRequestTypes.GetPagedDistinctValues,
180
+ rulesetId: this.registerRuleset(rulesetOrId),
181
+ ...strippedOptionsNoDescriptorAndKeys,
182
+ keys: getKeysForContentRequest(keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),
183
+ descriptorOverrides: createContentDescriptorOverrides(descriptor),
184
+ };
185
+ const reviver = (key, value) => {
186
+ return key === "" ? {
187
+ total: value.total,
188
+ // eslint-disable-next-line deprecation/deprecation
189
+ items: value.items.map(presentation_common_1.DisplayValueGroup.fromJSON),
190
+ } : value;
191
+ };
192
+ return JSON.parse(await this.request(params), reviver);
193
+ }
194
+ async getDisplayLabelDefinition(requestOptions) {
195
+ const params = {
196
+ requestId: NativePlatform_1.NativePlatformRequestTypes.GetDisplayLabel,
197
+ ...requestOptions,
198
+ };
199
+ return JSON.parse(await this.request(params));
200
+ }
201
+ async getDisplayLabelDefinitions(requestOptions) {
202
+ const concreteKeys = requestOptions.keys.map((k) => {
203
+ if (k.className === "BisCore:Element")
204
+ return (0, Utils_1.getElementKey)(requestOptions.imodel, k.id);
205
+ return k;
206
+ }).filter((k) => !!k);
207
+ const contentRequestOptions = {
208
+ ...requestOptions,
209
+ rulesetOrId: "RulesDrivenECPresentationManager_RulesetId_DisplayLabel",
210
+ descriptor: {
211
+ displayType: presentation_common_1.DefaultContentDisplayTypes.List,
212
+ contentFlags: presentation_common_1.ContentFlags.ShowLabels | presentation_common_1.ContentFlags.NoFields,
213
+ },
214
+ keys: new presentation_common_1.KeySet(concreteKeys),
215
+ };
216
+ const content = await this.getContent(contentRequestOptions);
217
+ return concreteKeys.map((key) => {
218
+ const item = content ? content.contentSet.find((it) => it.primaryKeys.length > 0 && presentation_common_1.InstanceKey.compare(it.primaryKeys[0], key) === 0) : undefined;
219
+ if (!item)
220
+ return { displayValue: "", rawValue: "", typeName: "" };
221
+ return item.label;
222
+ });
223
+ }
224
+ async getElementProperties(requestOptions) {
225
+ const { elementId, ...optionsNoElementId } = requestOptions;
226
+ const content = await this.getContent({
227
+ ...optionsNoElementId,
228
+ descriptor: {
229
+ displayType: presentation_common_1.DefaultContentDisplayTypes.PropertyPane,
230
+ contentFlags: presentation_common_1.ContentFlags.ShowLabels,
231
+ },
232
+ rulesetOrId: "ElementProperties",
233
+ keys: new presentation_common_1.KeySet([{ className: "BisCore:Element", id: elementId }]),
234
+ });
235
+ const properties = (0, ElementPropertiesHelper_1.buildElementsProperties)(content);
236
+ return properties[0];
237
+ }
238
+ /** Registers given ruleset and replaces the ruleset with its ID in the resulting object */
239
+ registerRuleset(rulesetOrId) {
240
+ if (typeof rulesetOrId === "object") {
241
+ const rulesetWithNativeId = { ...rulesetOrId, id: this.getRulesetId(rulesetOrId) };
242
+ return this.rulesets.add(rulesetWithNativeId).id;
243
+ }
244
+ return rulesetOrId;
245
+ }
246
+ /** @internal */
247
+ getRulesetId(rulesetOrId) {
248
+ return getRulesetIdObject(rulesetOrId).uniqueId;
249
+ }
250
+ async request(params) {
251
+ this._onManagerUsed?.();
252
+ const { requestId, imodel, unitSystem, diagnostics: requestDiagnostics, cancelEvent, ...strippedParams } = params;
253
+ const imodelAddon = this.getNativePlatform().getImodelAddon(imodel);
254
+ const response = await withOptionalDiagnostics([this._diagnosticsOptions, requestDiagnostics], async (diagnosticsOptions) => {
255
+ const nativeRequestParams = {
256
+ requestId,
257
+ params: {
258
+ unitSystem: toOptionalNativeUnitSystem(unitSystem ?? this.activeUnitSystem),
259
+ ...strippedParams,
260
+ ...(diagnosticsOptions ? { diagnostics: diagnosticsOptions } : undefined),
261
+ },
262
+ };
263
+ return this.getNativePlatform().handleRequest(imodelAddon, JSON.stringify(nativeRequestParams), cancelEvent);
264
+ });
265
+ return response.result;
266
+ }
267
+ }
268
+ exports.PresentationManagerDetail = PresentationManagerDetail;
269
+ async function withOptionalDiagnostics(diagnosticsOptions, nativePlatformRequestHandler) {
270
+ const contexts = diagnosticsOptions.map((d) => d?.requestContextSupplier?.());
271
+ const combinedOptions = (0, Utils_1.combineDiagnosticsOptions)(...diagnosticsOptions);
272
+ const response = await nativePlatformRequestHandler(combinedOptions);
273
+ if (response.diagnostics) {
274
+ const diagnostics = { logs: [response.diagnostics] };
275
+ diagnosticsOptions.forEach((options, i) => {
276
+ options && (0, Utils_1.reportDiagnostics)(diagnostics, options, contexts[i]);
277
+ });
278
+ }
279
+ return response;
280
+ }
281
+ function setupRulesetDirectories(nativePlatform, presentationAssetsRoot, supplementalRulesetDirectoriesOverrides, rulesetDirectories) {
282
+ const supplementalRulesetDirectories = collateAssetDirectories(path.join(presentationAssetsRoot, "supplemental-presentation-rules"), supplementalRulesetDirectoriesOverrides);
283
+ nativePlatform.setupSupplementalRulesetDirectories(supplementalRulesetDirectories);
284
+ const primaryRulesetDirectories = collateAssetDirectories(path.join(presentationAssetsRoot, "primary-presentation-rules"), rulesetDirectories);
285
+ nativePlatform.setupRulesetDirectories(primaryRulesetDirectories);
286
+ }
287
+ /** @internal */
288
+ function getRulesetIdObject(rulesetOrId) {
289
+ if (typeof rulesetOrId === "object") {
290
+ if (core_backend_1.IpcHost.isValid) {
291
+ // in case of native apps we don't want to enforce ruleset id uniqueness as ruleset variables
292
+ // are stored on a backend and creating new id will lose those variables
293
+ return {
294
+ uniqueId: rulesetOrId.id,
295
+ parts: { id: rulesetOrId.id },
296
+ };
297
+ }
298
+ const hashedId = hash.MD5(rulesetOrId);
299
+ return {
300
+ uniqueId: `${rulesetOrId.id}-${hashedId}`,
301
+ parts: {
302
+ id: rulesetOrId.id,
303
+ hash: hashedId,
304
+ },
305
+ };
306
+ }
307
+ return { uniqueId: rulesetOrId, parts: { id: rulesetOrId } };
308
+ }
309
+ exports.getRulesetIdObject = getRulesetIdObject;
310
+ /** @internal */
311
+ function getKeysForContentRequest(keys, classInstanceKeysProcessor) {
312
+ const result = {
313
+ instanceKeys: [],
314
+ nodeKeys: [],
315
+ };
316
+ const classInstancesMap = new Map();
317
+ keys.forEach((key) => {
318
+ if (presentation_common_1.Key.isNodeKey(key)) {
319
+ result.nodeKeys.push(key);
320
+ }
321
+ if (presentation_common_1.Key.isInstanceKey(key)) {
322
+ addInstanceKey(classInstancesMap, key);
323
+ }
324
+ });
325
+ if (classInstanceKeysProcessor) {
326
+ classInstanceKeysProcessor(classInstancesMap);
327
+ }
328
+ for (const entry of classInstancesMap) {
329
+ if (entry[1].size > 0) {
330
+ result.instanceKeys.push([entry["0"], [...entry[1]]]);
331
+ }
332
+ }
333
+ return result;
334
+ }
335
+ exports.getKeysForContentRequest = getKeysForContentRequest;
336
+ /** @internal */
337
+ function bisElementInstanceKeysProcessor(imodel, classInstancesMap) {
338
+ const elementClassName = "BisCore:Element";
339
+ const elementIds = classInstancesMap.get(elementClassName);
340
+ if (elementIds) {
341
+ const deleteElementIds = new Array();
342
+ elementIds.forEach((elementId) => {
343
+ const concreteKey = (0, Utils_1.getElementKey)(imodel, elementId);
344
+ if (concreteKey && concreteKey.className !== elementClassName) {
345
+ deleteElementIds.push(elementId);
346
+ addInstanceKey(classInstancesMap, { className: concreteKey.className, id: elementId });
347
+ }
348
+ });
349
+ for (const id of deleteElementIds) {
350
+ elementIds.delete(id);
351
+ }
352
+ }
353
+ }
354
+ exports.bisElementInstanceKeysProcessor = bisElementInstanceKeysProcessor;
355
+ function addInstanceKey(classInstancesMap, key) {
356
+ let set = classInstancesMap.get(key.className);
357
+ // istanbul ignore else
358
+ if (!set) {
359
+ set = new Set();
360
+ classInstancesMap.set(key.className, set);
361
+ }
362
+ set.add(key.id);
363
+ }
364
+ function createNativePlatform(id, workerThreadsCount, changeTrackingEnabled, caching, defaultFormats, useMmap) {
365
+ return new ((0, NativePlatform_1.createDefaultNativePlatform)({
366
+ id,
367
+ taskAllocationsMap: { [Number.MAX_SAFE_INTEGER]: workerThreadsCount },
368
+ isChangeTrackingEnabled: changeTrackingEnabled,
369
+ cacheConfig: createCacheConfig(caching?.hierarchies),
370
+ contentCacheSize: caching?.content?.size,
371
+ workerConnectionCacheSize: caching?.workerConnectionCacheSize,
372
+ defaultFormats: toNativeUnitFormatsMap(defaultFormats),
373
+ useMmap,
374
+ }))();
375
+ function createCacheConfig(config) {
376
+ switch (config?.mode) {
377
+ case PresentationManager_1.HierarchyCacheMode.Disk:
378
+ return { ...config, directory: normalizeDirectory(config.directory) };
379
+ case PresentationManager_1.HierarchyCacheMode.Hybrid:
380
+ return {
381
+ ...config,
382
+ disk: config.disk ? { ...config.disk, directory: normalizeDirectory(config.disk.directory) } : undefined,
383
+ };
384
+ case PresentationManager_1.HierarchyCacheMode.Memory:
385
+ return config;
386
+ default:
387
+ return { mode: PresentationManager_1.HierarchyCacheMode.Disk, directory: "" };
388
+ }
389
+ }
390
+ function normalizeDirectory(directory) {
391
+ return directory ? path.resolve(directory) : "";
392
+ }
393
+ function toNativeUnitFormatsMap(map) {
394
+ if (!map) {
395
+ return undefined;
396
+ }
397
+ const nativeFormatsMap = {};
398
+ Object.keys(map).forEach((phenomenon) => {
399
+ const unitSystemsFormat = map[phenomenon];
400
+ nativeFormatsMap[phenomenon] = {
401
+ unitSystems: unitSystemsFormat.unitSystems.map(toNativeUnitSystem),
402
+ format: unitSystemsFormat.format,
403
+ };
404
+ });
405
+ return nativeFormatsMap;
406
+ }
407
+ }
408
+ function toOptionalNativeUnitSystem(unitSystem) {
409
+ return unitSystem ? toNativeUnitSystem(unitSystem) : undefined;
410
+ }
411
+ function toNativeUnitSystem(unitSystem) {
412
+ switch (unitSystem) {
413
+ case "imperial": return NativePlatform_1.NativePresentationUnitSystem.BritishImperial;
414
+ case "metric": return NativePlatform_1.NativePresentationUnitSystem.Metric;
415
+ case "usCustomary": return NativePlatform_1.NativePresentationUnitSystem.UsCustomary;
416
+ case "usSurvey": return NativePlatform_1.NativePresentationUnitSystem.UsSurvey;
417
+ }
418
+ }
419
+ function collateAssetDirectories(mainDirectory, additionalDirectories) {
420
+ return [...new Set([mainDirectory, ...additionalDirectories])];
421
+ }
422
+ const createContentDescriptorOverrides = (descriptorOrOverrides) => {
423
+ if (descriptorOrOverrides instanceof presentation_common_1.Descriptor)
424
+ return descriptorOrOverrides.createDescriptorOverrides();
425
+ return descriptorOrOverrides;
426
+ };
427
427
  //# sourceMappingURL=PresentationManagerDetail.js.map