@itwin/presentation-frontend 4.5.0-dev.0 → 4.5.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -1
- package/README.md +1 -1
- package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js +10 -6
- package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/Diagnostics.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/Diagnostics.js +18 -13
- package/lib/cjs/presentation-frontend/Diagnostics.js.map +1 -1
- package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js +3 -3
- package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +3 -3
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
- package/lib/cjs/presentation-frontend/LocalizationHelper.js +3 -3
- package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
- package/lib/cjs/presentation-frontend/Presentation.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/Presentation.js +24 -14
- package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.js +57 -30
- package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetManager.js +11 -7
- package/lib/cjs/presentation-frontend/RulesetManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.js +53 -31
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +111 -66
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +54 -25
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/HiliteRules.json +172 -172
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +16 -10
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js +3 -3
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js +3 -3
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +15 -9
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +7 -5
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js +31 -16
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +25 -14
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend.js +3 -3
- package/lib/cjs/presentation-frontend.js.map +1 -1
- package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js +10 -6
- package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/Diagnostics.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/Diagnostics.js +18 -13
- package/lib/esm/presentation-frontend/Diagnostics.js.map +1 -1
- package/lib/esm/presentation-frontend/FrontendLoggerCategory.js +3 -3
- package/lib/esm/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
- package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/IpcRequestsHandler.js +3 -3
- package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
- package/lib/esm/presentation-frontend/LocalizationHelper.js +3 -3
- package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
- package/lib/esm/presentation-frontend/Presentation.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/Presentation.js +24 -14
- package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.js +57 -30
- package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/esm/presentation-frontend/RulesetManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/RulesetManager.js +11 -7
- package/lib/esm/presentation-frontend/RulesetManager.js.map +1 -1
- package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/RulesetVariablesManager.js +53 -31
- package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +111 -66
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +54 -25
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/HiliteRules.json +172 -172
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +17 -11
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.js +3 -3
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js +3 -3
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHandler.js +15 -9
- package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHelper.js +7 -5
- package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.js +31 -16
- package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +25 -14
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/lib/esm/presentation-frontend.js +3 -3
- package/lib/esm/presentation-frontend.js.map +1 -1
- package/package.json +19 -16
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
*--------------------------------------------------------------------------------------------*/
|
|
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
5
|
/** @packageDocumentation
|
|
6
6
|
* @module Core
|
|
7
7
|
*/
|
|
@@ -30,7 +30,9 @@ export class PresentationManager {
|
|
|
30
30
|
get activeUnitSystem() {
|
|
31
31
|
return this._explicitActiveUnitSystem ?? IModelApp.quantityFormatter.activeUnitSystem;
|
|
32
32
|
}
|
|
33
|
-
set activeUnitSystem(value) {
|
|
33
|
+
set activeUnitSystem(value) {
|
|
34
|
+
this._explicitActiveUnitSystem = value;
|
|
35
|
+
}
|
|
34
36
|
constructor(props) {
|
|
35
37
|
/**
|
|
36
38
|
* An event raised when hierarchies created using specific ruleset change
|
|
@@ -51,7 +53,8 @@ export class PresentationManager {
|
|
|
51
53
|
// eslint-disable-next-line deprecation/deprecation
|
|
52
54
|
this._explicitActiveUnitSystem = props.activeUnitSystem;
|
|
53
55
|
}
|
|
54
|
-
this._requestsHandler =
|
|
56
|
+
this._requestsHandler =
|
|
57
|
+
props?.rpcRequestsHandler ?? new RpcRequestsHandler(props ? { clientId: props.clientId, timeout: props.requestTimeout } : undefined);
|
|
55
58
|
this._rulesetVars = new Map();
|
|
56
59
|
this._rulesets = RulesetManagerImpl.create();
|
|
57
60
|
this._localizationHelper = new FrontendLocalizationHelper(props?.activeLocale);
|
|
@@ -65,8 +68,12 @@ export class PresentationManager {
|
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
70
|
/** Get / set active locale used for localizing presentation data */
|
|
68
|
-
get activeLocale() {
|
|
69
|
-
|
|
71
|
+
get activeLocale() {
|
|
72
|
+
return this._localizationHelper.locale;
|
|
73
|
+
}
|
|
74
|
+
set activeLocale(locale) {
|
|
75
|
+
this._localizationHelper.locale = locale;
|
|
76
|
+
}
|
|
70
77
|
dispose() {
|
|
71
78
|
if (this._clearEventListener) {
|
|
72
79
|
this._clearEventListener();
|
|
@@ -74,8 +81,9 @@ export class PresentationManager {
|
|
|
74
81
|
}
|
|
75
82
|
}
|
|
76
83
|
async onConnection(imodel) {
|
|
77
|
-
if (!this._connections.has(imodel))
|
|
84
|
+
if (!this._connections.has(imodel)) {
|
|
78
85
|
this._connections.set(imodel, this.initializeIModel(imodel));
|
|
86
|
+
}
|
|
79
87
|
await this._connections.get(imodel);
|
|
80
88
|
}
|
|
81
89
|
async initializeIModel(imodel) {
|
|
@@ -88,18 +96,22 @@ export class PresentationManager {
|
|
|
88
96
|
async handleUpdateAsync(report) {
|
|
89
97
|
for (const imodelKey in report) {
|
|
90
98
|
// istanbul ignore if
|
|
91
|
-
if (!report.hasOwnProperty(imodelKey))
|
|
99
|
+
if (!report.hasOwnProperty(imodelKey)) {
|
|
92
100
|
continue;
|
|
101
|
+
}
|
|
93
102
|
const imodelReport = report[imodelKey];
|
|
94
103
|
for (const rulesetId in imodelReport) {
|
|
95
104
|
// istanbul ignore if
|
|
96
|
-
if (!imodelReport.hasOwnProperty(rulesetId))
|
|
105
|
+
if (!imodelReport.hasOwnProperty(rulesetId)) {
|
|
97
106
|
continue;
|
|
107
|
+
}
|
|
98
108
|
const updateInfo = imodelReport[rulesetId];
|
|
99
|
-
if (updateInfo.content)
|
|
109
|
+
if (updateInfo.content) {
|
|
100
110
|
this.onIModelContentChanged.raiseEvent({ rulesetId, updateInfo: updateInfo.content, imodelKey });
|
|
101
|
-
|
|
111
|
+
}
|
|
112
|
+
if (updateInfo.hierarchy) {
|
|
102
113
|
this.onIModelHierarchyChanged.raiseEvent({ rulesetId, updateInfo: updateInfo.hierarchy, imodelKey });
|
|
114
|
+
}
|
|
103
115
|
}
|
|
104
116
|
}
|
|
105
117
|
}
|
|
@@ -116,13 +128,19 @@ export class PresentationManager {
|
|
|
116
128
|
return new PresentationManager(props);
|
|
117
129
|
}
|
|
118
130
|
/** @internal */
|
|
119
|
-
get rpcRequestsHandler() {
|
|
131
|
+
get rpcRequestsHandler() {
|
|
132
|
+
return this._requestsHandler;
|
|
133
|
+
}
|
|
120
134
|
/** @internal */
|
|
121
|
-
get ipcRequestsHandler() {
|
|
135
|
+
get ipcRequestsHandler() {
|
|
136
|
+
return this._ipcRequestsHandler;
|
|
137
|
+
}
|
|
122
138
|
/**
|
|
123
139
|
* Get rulesets manager
|
|
124
140
|
*/
|
|
125
|
-
rulesets() {
|
|
141
|
+
rulesets() {
|
|
142
|
+
return this._rulesets;
|
|
143
|
+
}
|
|
126
144
|
/**
|
|
127
145
|
* Get ruleset variables manager for specific ruleset
|
|
128
146
|
* @param rulesetId Id of the ruleset to get the vars manager for
|
|
@@ -139,8 +157,9 @@ export class PresentationManager {
|
|
|
139
157
|
// 2. put all `requestOptions` members (if `locale` or `unitSystem` are set, they'll override the defaults put at #1)
|
|
140
158
|
// 3. put `imodel` of type `IModelRpcProps` which overwrites the `imodel` from `requestOptions` put at #2
|
|
141
159
|
const defaultOptions = {};
|
|
142
|
-
if (this.activeLocale)
|
|
160
|
+
if (this.activeLocale) {
|
|
143
161
|
defaultOptions.locale = this.activeLocale;
|
|
162
|
+
}
|
|
144
163
|
defaultOptions.unitSystem = this.activeUnitSystem; // eslint-disable-line deprecation/deprecation
|
|
145
164
|
const { imodel, rulesetVariables, ...rpcRequestOptions } = requestOptions;
|
|
146
165
|
return {
|
|
@@ -160,13 +179,14 @@ export class PresentationManager {
|
|
|
160
179
|
const foundRuleset = await this._rulesets.get(rulesetOrId);
|
|
161
180
|
foundRulesetOrId = foundRuleset ? foundRuleset.toJSON() : rulesetOrId;
|
|
162
181
|
}
|
|
163
|
-
const rulesetId =
|
|
182
|
+
const rulesetId = typeof foundRulesetOrId === "object" ? foundRulesetOrId.id : foundRulesetOrId;
|
|
164
183
|
// All Id64Array variable values must be sorted for serialization to JSON to work. RulesetVariablesManager
|
|
165
184
|
// sorts them before storing, so that part is taken care of, but we need to ensure that variables coming from
|
|
166
185
|
// request options are also sorted.
|
|
167
186
|
const variables = (rulesetVariables ?? []).map((variable) => {
|
|
168
|
-
if (variable.type === VariableValueTypes.Id64Array)
|
|
187
|
+
if (variable.type === VariableValueTypes.Id64Array) {
|
|
169
188
|
return { ...variable, value: OrderedId64Iterable.sortArray(variable.value) };
|
|
189
|
+
}
|
|
170
190
|
return variable;
|
|
171
191
|
});
|
|
172
192
|
if (!this._ipcRequestsHandler) {
|
|
@@ -281,7 +301,7 @@ export class PresentationManager {
|
|
|
281
301
|
keys: stripTransientElementKeys(requestOptions.keys).toJSON(),
|
|
282
302
|
...(!requestOptions.omitFormattedValues && this._schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),
|
|
283
303
|
});
|
|
284
|
-
let descriptor =
|
|
304
|
+
let descriptor = requestOptions.descriptor instanceof Descriptor ? requestOptions.descriptor : undefined;
|
|
285
305
|
const result = await buildPagedArrayResponse(options.paging, async (partialPageOptions, requestIndex) => {
|
|
286
306
|
if (0 === requestIndex && !descriptor) {
|
|
287
307
|
const content = await this._requestsHandler.getPagedContent({ ...rpcOptions, paging: partialPageOptions });
|
|
@@ -293,9 +313,10 @@ export class PresentationManager {
|
|
|
293
313
|
}
|
|
294
314
|
return this._requestsHandler.getPagedContentSet({ ...rpcOptions, paging: partialPageOptions });
|
|
295
315
|
});
|
|
296
|
-
if (!descriptor)
|
|
316
|
+
if (!descriptor) {
|
|
297
317
|
return undefined;
|
|
298
|
-
|
|
318
|
+
}
|
|
319
|
+
const items = result.items.map((itemJson) => Item.fromJSON(itemJson)).filter((item) => item !== undefined);
|
|
299
320
|
const resultContent = new Content(descriptor, items);
|
|
300
321
|
if (!requestOptions.omitFormattedValues && this._schemaContextProvider) {
|
|
301
322
|
const koqPropertyFormatter = new KoqPropertyValueFormatter(this._schemaContextProvider(requestOptions.imodel), this._defaultFormats);
|
|
@@ -331,8 +352,9 @@ export class PresentationManager {
|
|
|
331
352
|
await this.onConnection(requestOptions.imodel);
|
|
332
353
|
const results = await this._requestsHandler.getElementProperties(this.toRpcTokenOptions(requestOptions));
|
|
333
354
|
// istanbul ignore if
|
|
334
|
-
if (!results)
|
|
355
|
+
if (!results) {
|
|
335
356
|
return undefined;
|
|
357
|
+
}
|
|
336
358
|
return this._localizationHelper.getLocalizedElementProperties(results);
|
|
337
359
|
}
|
|
338
360
|
/**
|
|
@@ -375,15 +397,16 @@ export class PresentationManager {
|
|
|
375
397
|
await this.onConnection(requestOptions.imodel);
|
|
376
398
|
const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });
|
|
377
399
|
const result = await buildPagedArrayResponse(undefined, async (partialPageOptions) => {
|
|
378
|
-
const partialKeys =
|
|
400
|
+
const partialKeys = !partialPageOptions.start ? rpcOptions.keys : rpcOptions.keys.slice(partialPageOptions.start);
|
|
379
401
|
return this._requestsHandler.getPagedDisplayLabelDefinitions({ ...rpcOptions, keys: partialKeys });
|
|
380
402
|
});
|
|
381
403
|
return this._localizationHelper.getLocalizedLabelDefinitions(result.items);
|
|
382
404
|
}
|
|
383
405
|
}
|
|
384
406
|
const getDescriptorOverrides = (descriptorOrOverrides) => {
|
|
385
|
-
if (descriptorOrOverrides instanceof Descriptor)
|
|
407
|
+
if (descriptorOrOverrides instanceof Descriptor) {
|
|
386
408
|
return descriptorOrOverrides.createDescriptorOverrides();
|
|
409
|
+
}
|
|
387
410
|
return descriptorOrOverrides;
|
|
388
411
|
};
|
|
389
412
|
async function createPagedGeneratorResponse(props) {
|
|
@@ -401,14 +424,17 @@ async function createPagedGeneratorResponse(props) {
|
|
|
401
424
|
}
|
|
402
425
|
const receivedItemsCount = partialResult.items.length;
|
|
403
426
|
if (partialResult.total !== 0 && receivedItemsCount === 0) {
|
|
404
|
-
if (pageStart >= partialResult.total)
|
|
427
|
+
if (pageStart >= partialResult.total) {
|
|
405
428
|
throw new Error(`Requested page with start index ${pageStart} is out of bounds. Total number of items: ${partialResult.total}`);
|
|
429
|
+
}
|
|
406
430
|
throw new Error("Paged request returned non zero total count but no items");
|
|
407
431
|
}
|
|
408
|
-
if (pageSize !== 0 && receivedItemsCount >= pageSize || receivedItemsCount >=
|
|
432
|
+
if ((pageSize !== 0 && receivedItemsCount >= pageSize) || receivedItemsCount >= partialResult.total - pageStart) {
|
|
409
433
|
break;
|
|
410
|
-
|
|
434
|
+
}
|
|
435
|
+
if (pageSize !== 0) {
|
|
411
436
|
pageSize -= receivedItemsCount;
|
|
437
|
+
}
|
|
412
438
|
pageStart += receivedItemsCount;
|
|
413
439
|
partialResult = await props.get({ start: pageStart, size: pageSize }, requestIndex++);
|
|
414
440
|
}
|
|
@@ -425,15 +451,16 @@ export const buildPagedArrayResponse = async (requestedPage, getter) => {
|
|
|
425
451
|
return { total: gen.total, items };
|
|
426
452
|
};
|
|
427
453
|
const stripTransientElementKeys = (keys) => {
|
|
428
|
-
if (!keys.some((key) => Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME))
|
|
454
|
+
if (!keys.some((key) => Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME)) {
|
|
429
455
|
return keys;
|
|
456
|
+
}
|
|
430
457
|
const copy = new KeySet();
|
|
431
458
|
copy.add(keys, (key) => {
|
|
432
459
|
// the callback is not going to be called with EntityProps as KeySet converts them
|
|
433
460
|
// to InstanceKeys, but we want to keep the EntityProps case for correctness
|
|
434
461
|
// istanbul ignore next
|
|
435
|
-
const isTransient = Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME
|
|
436
|
-
|
|
462
|
+
const isTransient = (Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME) ||
|
|
463
|
+
(Key.isEntityProps(key) && key.classFullName === TRANSIENT_ELEMENT_CLASSNAME);
|
|
437
464
|
return !isTransient;
|
|
438
465
|
});
|
|
439
466
|
return copy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAe,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAE,SAAS,EAAoB,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG3E,OAAO,EACuB,OAAO,EAAmC,gBAAgB,EACtF,6BAA6B,EAA0E,UAAU,EACxD,iBAAiB,EAEf,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,yBAAyB,EAAmB,IAAI,EAC9H,eAAe,EAAqC,qBAAqB,EAAE,kBAAkB,EAAW,eAAe,EAAE,eAAe,EACrF,kBAAkB,GACtE,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAkB,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAA2B,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAyF3E;;;;;GAKG;AACH,MAAM,OAAO,mBAAmB;IAwB9B;;;;;;OAMG;IACH,IAAW,gBAAgB;QACzB,OAAO,IAAI,CAAC,yBAAyB,IAAI,SAAS,CAAC,iBAAiB,CAAC,gBAAgB,CAAC;IACxF,CAAC;IACD,IAAW,gBAAgB,CAAC,KAAgC,IAAI,IAAI,CAAC,yBAAyB,GAAG,KAAK,CAAC,CAAC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AAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,SAAS,KAAK,2BAA2B,CAAC;QAC9F,OAAO,IAAI,CAAC;IAEd,MAAM,IAAI,GAAG,IAAI,MAAM,EAAE,CAAC;IAC1B,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;QACrB,kFAAkF;QAClF,4EAA4E;QAC5E,uBAAuB;QACvB,MAAM,WAAW,GAAG,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,SAAS,KAAK,2BAA2B;eACtF,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,aAAa,KAAK,2BAA2B,CAAC;QACjF,OAAO,CAAC,WAAW,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { BeEvent, CompressedId64Set, IDisposable, OrderedId64Iterable } from \"@itwin/core-bentley\";\nimport { IModelApp, IModelConnection, IpcApp } from \"@itwin/core-frontend\";\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\nimport { SchemaContext } from \"@itwin/ecschema-metadata\";\nimport {\n ClientDiagnosticsAttribute, Content, ContentDescriptorRequestOptions, ContentFormatter, ContentInstanceKeysRequestOptions,\n ContentPropertyValueFormatter, ContentRequestOptions, ContentSourcesRequestOptions, ContentUpdateInfo, Descriptor, DescriptorOverrides,\n DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties,\n FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, FormatsMap, HierarchyLevelDescriptorRequestOptions,\n HierarchyRequestOptions, HierarchyUpdateInfo, InstanceKey, Item, Key, KeySet, KoqPropertyValueFormatter, LabelDefinition, Node, NodeKey,\n NodePathElement, Paged, PagedResponse, PageOptions, PresentationIpcEvents, RpcRequestsHandler, Ruleset, RulesetVariable, SelectClassInfo,\n SingleElementPropertiesRequestOptions, UpdateInfo, VariableValueTypes,\n} from \"@itwin/presentation-common\";\nimport { IpcRequestsHandler } from \"./IpcRequestsHandler\";\nimport { FrontendLocalizationHelper } from \"./LocalizationHelper\";\nimport { RulesetManager, RulesetManagerImpl } from \"./RulesetManager\";\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager\";\nimport { TRANSIENT_ELEMENT_CLASSNAME } from \"./selection/SelectionManager\";\n\n/**\n * Data structure that describes IModel hierarchy change event arguments.\n * @alpha\n */\nexport interface IModelHierarchyChangeEventArgs {\n /** Id of ruleset that was used to create hierarchy. */\n rulesetId: string;\n /** Hierarchy changes info. */\n updateInfo: HierarchyUpdateInfo;\n /** Key of iModel that was used to create hierarchy. It matches [[IModelConnection.key]] property. */\n imodelKey: string;\n}\n\n/**\n * Data structure that describes iModel content change event arguments.\n * @alpha\n */\nexport interface IModelContentChangeEventArgs {\n /** Id of ruleset that was used to create content. */\n rulesetId: string;\n /** Content changes info. */\n updateInfo: ContentUpdateInfo;\n /** Key of iModel that was used to create content. It matches [[IModelConnection.key]] property. */\n imodelKey: string;\n}\n\n/**\n * Properties used to configure [[PresentationManager]]\n * @public\n */\nexport interface PresentationManagerProps {\n /**\n * Sets the active locale to use when localizing presentation-related\n * strings. It can later be changed through [[PresentationManager]].\n */\n activeLocale?: string;\n\n /**\n * Sets the active unit system to use for formatting property values with\n * units. The value can later be changed through [[PresentationManager.activeUnitSystem]] setter or\n * overriden for each request through request parameters. If not set, `IModelApp.quantityFormatter.activeUnitSystem`\n * is used by default.\n *\n * @deprecated in 4.0. Use [IModelApp.quantityFormatter]($core-frontend) to set the active unit system.\n */\n activeUnitSystem?: UnitSystemKey;\n\n /**\n * ID used to identify client that requests data. Generally, clients should\n * store this ID in their local storage so the ID can be reused across\n * sessions - this allows reusing some caches.\n *\n * Defaults to a unique GUID as a client id.\n */\n clientId?: string;\n\n /**\n * Timeout (in milliseconds) for how long we're going to wait for RPC request to be fulfilled before throwing\n * a timeout error.\n *\n * Defaults to 10 minutes.\n */\n requestTimeout?: number;\n\n /**\n * Callback that provides [SchemaContext]($ecschema-metadata) for supplied [IModelConnection]($core-frontend).\n * [SchemaContext]($ecschema-metadata) is used for getting metadata required for values formatting.\n * @alpha\n */\n schemaContextProvider?: (imodel: IModelConnection) => SchemaContext;\n\n /**\n * A map of default unit formats to use for formatting properties that don't have a presentation format\n * in requested unit system.\n *\n * @note Only has effect when frontend value formatting is enabled by supplying the `schemaContextProvider` prop.\n * @alpha\n */\n defaultFormats?: FormatsMap;\n\n /** @internal */\n rpcRequestsHandler?: RpcRequestsHandler;\n\n /** @internal */\n ipcRequestsHandler?: IpcRequestsHandler;\n}\n\n/**\n * Frontend Presentation manager which basically just forwards all calls to\n * the backend implementation.\n *\n * @public\n */\nexport class PresentationManager implements IDisposable {\n private _requestsHandler: RpcRequestsHandler;\n private _rulesets: RulesetManager;\n private _localizationHelper: FrontendLocalizationHelper;\n private _explicitActiveUnitSystem: UnitSystemKey | undefined;\n private _rulesetVars: Map<string, RulesetVariablesManager>;\n private _clearEventListener?: () => void;\n private _connections: Map<IModelConnection, Promise<void>>;\n private _schemaContextProvider?: (imodel: IModelConnection) => SchemaContext;\n private _defaultFormats?: FormatsMap;\n private _ipcRequestsHandler?: IpcRequestsHandler;\n\n /**\n * An event raised when hierarchies created using specific ruleset change\n * @alpha\n */\n public onIModelHierarchyChanged = new BeEvent<(args: IModelHierarchyChangeEventArgs) => void>();\n\n /**\n * An event raised when content created using specific ruleset changes\n * @alpha\n */\n public onIModelContentChanged = new BeEvent<(args: IModelContentChangeEventArgs) => void>();\n\n /**\n * Get / set active unit system used to format property values with units.\n *\n * @deprecated in 4.0. `IModelApp.quantityFormatter` should be used to get/set the active unit system. At the moment\n * [[PresentationManager]] allows overriding it, but returns `IModelApp.quantityFormatter.activeUnitSystem` if override\n * is not set.\n */\n public get activeUnitSystem(): UnitSystemKey {\n return this._explicitActiveUnitSystem ?? IModelApp.quantityFormatter.activeUnitSystem;\n }\n public set activeUnitSystem(value: UnitSystemKey | undefined) { this._explicitActiveUnitSystem = value; }\n\n private constructor(props?: PresentationManagerProps) {\n if (props) {\n // eslint-disable-next-line deprecation/deprecation\n this._explicitActiveUnitSystem = props.activeUnitSystem;\n }\n\n this._requestsHandler = props?.rpcRequestsHandler ?? new RpcRequestsHandler(props ? { clientId: props.clientId, timeout: props.requestTimeout } : undefined);\n this._rulesetVars = new Map<string, RulesetVariablesManager>();\n this._rulesets = RulesetManagerImpl.create();\n this._localizationHelper = new FrontendLocalizationHelper(props?.activeLocale);\n this._connections = new Map<IModelConnection, Promise<void>>();\n this._schemaContextProvider = props?.schemaContextProvider;\n this._defaultFormats = props?.defaultFormats;\n\n if (IpcApp.isValid) {\n // Ipc only works in ipc apps, so the `onUpdate` callback will only be called there.\n this._clearEventListener = IpcApp.addListener(PresentationIpcEvents.Update, this.onUpdate);\n this._ipcRequestsHandler = props?.ipcRequestsHandler ?? new IpcRequestsHandler(this._requestsHandler.clientId);\n }\n }\n\n /** Get / set active locale used for localizing presentation data */\n public get activeLocale(): string | undefined { return this._localizationHelper.locale; }\n public set activeLocale(locale: string | undefined) { this._localizationHelper.locale = locale; }\n\n public dispose() {\n if (this._clearEventListener) {\n this._clearEventListener();\n this._clearEventListener = undefined;\n }\n }\n\n private async onConnection(imodel: IModelConnection) {\n if (!this._connections.has(imodel))\n this._connections.set(imodel, this.initializeIModel(imodel));\n await this._connections.get(imodel);\n }\n\n private async initializeIModel(imodel: IModelConnection) {\n imodel.onClose.addOnce(() => {\n this._connections.delete(imodel);\n });\n await this.onNewiModelConnection(imodel);\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private onUpdate = (_evt: Event, report: UpdateInfo) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.handleUpdateAsync(report);\n };\n\n /** @note This is only called in native apps after changes in iModels */\n private async handleUpdateAsync(report: UpdateInfo) {\n for (const imodelKey in report) {\n // istanbul ignore if\n if (!report.hasOwnProperty(imodelKey))\n continue;\n\n const imodelReport = report[imodelKey];\n for (const rulesetId in imodelReport) {\n // istanbul ignore if\n if (!imodelReport.hasOwnProperty(rulesetId))\n continue;\n\n const updateInfo = imodelReport[rulesetId];\n if (updateInfo.content)\n this.onIModelContentChanged.raiseEvent({ rulesetId, updateInfo: updateInfo.content, imodelKey });\n if (updateInfo.hierarchy)\n this.onIModelHierarchyChanged.raiseEvent({ rulesetId, updateInfo: updateInfo.hierarchy, imodelKey });\n }\n }\n }\n\n /**\n * Function that is called when a new IModelConnection is used to retrieve data.\n * @internal\n */\n public async onNewiModelConnection(_: IModelConnection) { }\n\n /**\n * Create a new PresentationManager instance\n * @param props Optional properties used to configure the manager\n */\n public static create(props?: PresentationManagerProps) {\n return new PresentationManager(props);\n }\n\n /** @internal */\n public get rpcRequestsHandler() { return this._requestsHandler; }\n\n /** @internal */\n public get ipcRequestsHandler() { return this._ipcRequestsHandler; }\n\n /**\n * Get rulesets manager\n */\n public rulesets() { return this._rulesets; }\n\n /**\n * Get ruleset variables manager for specific ruleset\n * @param rulesetId Id of the ruleset to get the vars manager for\n */\n public vars(rulesetId: string) {\n if (!this._rulesetVars.has(rulesetId)) {\n const varsManager = new RulesetVariablesManagerImpl(rulesetId, this._ipcRequestsHandler);\n this._rulesetVars.set(rulesetId, varsManager);\n }\n return this._rulesetVars.get(rulesetId)!;\n }\n\n private toRpcTokenOptions<TOptions extends { imodel: IModelConnection, locale?: string, unitSystem?: UnitSystemKey, rulesetVariables?: RulesetVariable[] }>(requestOptions: TOptions) {\n // 1. put default `locale` and `unitSystem`\n // 2. put all `requestOptions` members (if `locale` or `unitSystem` are set, they'll override the defaults put at #1)\n // 3. put `imodel` of type `IModelRpcProps` which overwrites the `imodel` from `requestOptions` put at #2\n const defaultOptions: Pick<TOptions, \"locale\" | \"unitSystem\"> = {};\n if (this.activeLocale)\n defaultOptions.locale = this.activeLocale;\n defaultOptions.unitSystem = this.activeUnitSystem; // eslint-disable-line deprecation/deprecation\n\n const { imodel, rulesetVariables, ...rpcRequestOptions } = requestOptions;\n return {\n ...defaultOptions,\n ...rpcRequestOptions,\n ...(rulesetVariables ? { rulesetVariables: rulesetVariables.map(RulesetVariable.toJSON) } : {}),\n imodel: imodel.getRpcProps(),\n };\n }\n\n private async addRulesetAndVariablesToOptions<TOptions extends { rulesetOrId: Ruleset | string, rulesetVariables?: RulesetVariable[] }>(options: TOptions) {\n const { rulesetOrId, rulesetVariables } = options;\n let foundRulesetOrId: Ruleset | string;\n if (typeof rulesetOrId === \"object\") {\n foundRulesetOrId = rulesetOrId;\n } else {\n const foundRuleset = await this._rulesets.get(rulesetOrId);\n foundRulesetOrId = foundRuleset ? foundRuleset.toJSON() : rulesetOrId;\n }\n const rulesetId = (typeof foundRulesetOrId === \"object\") ? foundRulesetOrId.id : foundRulesetOrId;\n\n // All Id64Array variable values must be sorted for serialization to JSON to work. RulesetVariablesManager\n // sorts them before storing, so that part is taken care of, but we need to ensure that variables coming from\n // request options are also sorted.\n const variables = (rulesetVariables ?? []).map((variable) => {\n if (variable.type === VariableValueTypes.Id64Array)\n return { ...variable, value: OrderedId64Iterable.sortArray(variable.value) };\n return variable;\n });\n if (!this._ipcRequestsHandler) {\n // only need to add variables from variables manager if there's no IPC\n // handler - if there is one, the variables are already known by the backend\n variables.push(...this.vars(rulesetId).getAllVariables());\n }\n\n return { ...options, rulesetOrId: foundRulesetOrId, rulesetVariables: variables };\n }\n\n /** Retrieves nodes */\n public async getNodes(requestOptions: Paged<HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable>> & ClientDiagnosticsAttribute): Promise<Node[]> {\n await this.onConnection(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n const result = await buildPagedArrayResponse(options.paging, async (partialPageOptions) => this._requestsHandler.getPagedNodes({ ...rpcOptions, paging: partialPageOptions }));\n // eslint-disable-next-line deprecation/deprecation\n return this._localizationHelper.getLocalizedNodes(result.items.map(Node.fromJSON));\n }\n\n /** Retrieves nodes count. */\n public async getNodesCount(requestOptions: HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute): Promise<number> {\n await this.onConnection(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n return this._requestsHandler.getNodesCount(rpcOptions);\n }\n\n /** Retrieves total nodes count and a single page of nodes. */\n public async getNodesAndCount(requestOptions: Paged<HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable>> & ClientDiagnosticsAttribute): Promise<{ count: number, nodes: Node[] }> {\n await this.onConnection(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n const result = await buildPagedArrayResponse(options.paging, async (partialPageOptions) => this._requestsHandler.getPagedNodes({ ...rpcOptions, paging: partialPageOptions }));\n return {\n count: result.total,\n // eslint-disable-next-line deprecation/deprecation\n nodes: this._localizationHelper.getLocalizedNodes(result.items.map(Node.fromJSON)),\n };\n }\n\n /**\n * Retrieves hierarchy level descriptor.\n * @beta\n */\n public async getNodesDescriptor(requestOptions: HierarchyLevelDescriptorRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute): Promise<Descriptor | undefined> {\n await this.onConnection(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n const result = await this._requestsHandler.getNodesDescriptor(rpcOptions);\n const descriptor = Descriptor.fromJSON(result);\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\n }\n\n /** Retrieves paths from root nodes to children nodes according to specified keys. Intersecting paths will be merged. */\n public async getNodePaths(requestOptions: FilterByInstancePathsHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute): Promise<NodePathElement[]> {\n await this.onConnection(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n const result = await this._requestsHandler.getNodePaths(rpcOptions);\n // eslint-disable-next-line deprecation/deprecation\n return result.map(NodePathElement.fromJSON).map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\n }\n\n /** Retrieves paths from root nodes to nodes containing filter text in their label. */\n public async getFilteredNodePaths(requestOptions: FilterByTextHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute): Promise<NodePathElement[]> {\n await this.onConnection(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const result = await this._requestsHandler.getFilteredNodePaths(this.toRpcTokenOptions(options));\n // eslint-disable-next-line deprecation/deprecation\n return result.map(NodePathElement.fromJSON).map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\n }\n\n /**\n * Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,\n * its related instances for loading related and navigation properties.\n * @public\n */\n public async getContentSources(requestOptions: ContentSourcesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute): Promise<SelectClassInfo[]> {\n await this.onConnection(requestOptions.imodel);\n const rpcOptions = this.toRpcTokenOptions(requestOptions);\n const result = await this._requestsHandler.getContentSources(rpcOptions);\n return SelectClassInfo.listFromCompressedJSON(result.sources, result.classesMap);\n }\n\n /** Retrieves the content descriptor which describes the content and can be used to customize it. */\n public async getContentDescriptor(requestOptions: ContentDescriptorRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<Descriptor | undefined> {\n await this.onConnection(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({\n ...options,\n keys: stripTransientElementKeys(options.keys).toJSON(),\n });\n const result = await this._requestsHandler.getContentDescriptor(rpcOptions);\n const descriptor = Descriptor.fromJSON(result);\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\n }\n\n /** Retrieves overall content set size. */\n public async getContentSetSize(requestOptions: ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<number> {\n await this.onConnection(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({\n ...options,\n descriptor: getDescriptorOverrides(requestOptions.descriptor),\n keys: stripTransientElementKeys(requestOptions.keys).toJSON(),\n });\n return this._requestsHandler.getContentSetSize(rpcOptions);\n }\n\n /** Retrieves content which consists of a content descriptor and a page of records. */\n public async getContent(requestOptions: Paged<ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>> & ClientDiagnosticsAttribute): Promise<Content | undefined> {\n return (await this.getContentAndSize(requestOptions))?.content;\n }\n\n /** Retrieves content set size and content which consists of a content descriptor and a page of records. */\n public async getContentAndSize(requestOptions: Paged<ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>> & ClientDiagnosticsAttribute): Promise<{ content: Content, size: number } | undefined> {\n await this.onConnection(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({\n ...options,\n descriptor: getDescriptorOverrides(requestOptions.descriptor),\n keys: stripTransientElementKeys(requestOptions.keys).toJSON(),\n ...(!requestOptions.omitFormattedValues && this._schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),\n });\n let descriptor = (requestOptions.descriptor instanceof Descriptor) ? requestOptions.descriptor : undefined;\n const result = await buildPagedArrayResponse(options.paging, async (partialPageOptions, requestIndex) => {\n if (0 === requestIndex && !descriptor) {\n const content = await this._requestsHandler.getPagedContent({ ...rpcOptions, paging: partialPageOptions });\n if (content) {\n descriptor = Descriptor.fromJSON(content.descriptor);\n return content.contentSet;\n }\n return { total: 0, items: [] };\n }\n return this._requestsHandler.getPagedContentSet({ ...rpcOptions, paging: partialPageOptions });\n });\n if (!descriptor)\n return undefined;\n\n const items = result.items.map((itemJson) => Item.fromJSON(itemJson)).filter<Item>((item): item is Item => (item !== undefined));\n const resultContent = new Content(descriptor, items);\n if (!requestOptions.omitFormattedValues && this._schemaContextProvider) {\n const koqPropertyFormatter = new KoqPropertyValueFormatter(this._schemaContextProvider(requestOptions.imodel), this._defaultFormats);\n const contentFormatter = new ContentFormatter(\n new ContentPropertyValueFormatter(koqPropertyFormatter),\n requestOptions.unitSystem ?? this._explicitActiveUnitSystem ?? IModelApp.quantityFormatter.activeUnitSystem,\n );\n await contentFormatter.formatContent(resultContent);\n }\n\n return {\n size: result.total,\n content: this._localizationHelper.getLocalizedContent(resultContent),\n };\n }\n\n /** Retrieves distinct values of specific field from the content. */\n public async getPagedDistinctValues(requestOptions: DistinctValuesRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<PagedResponse<DisplayValueGroup>> {\n await this.onConnection(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = {\n ...this.toRpcTokenOptions(options),\n descriptor: getDescriptorOverrides(options.descriptor),\n keys: stripTransientElementKeys(options.keys).toJSON(),\n };\n const result = await buildPagedArrayResponse(requestOptions.paging, async (partialPageOptions) => this._requestsHandler.getPagedDistinctValues({ ...rpcOptions, paging: partialPageOptions }));\n return {\n ...result,\n // eslint-disable-next-line deprecation/deprecation\n items: result.items.map(DisplayValueGroup.fromJSON).map((g) => this._localizationHelper.getLocalizedDisplayValueGroup(g)),\n };\n }\n\n /**\n * Retrieves property data in a simplified format for a single element specified by ID.\n * @public\n */\n public async getElementProperties(requestOptions: SingleElementPropertiesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute): Promise<ElementProperties | undefined> {\n await this.onConnection(requestOptions.imodel);\n const results = await this._requestsHandler.getElementProperties(this.toRpcTokenOptions(requestOptions));\n // istanbul ignore if\n if (!results)\n return undefined;\n return this._localizationHelper.getLocalizedElementProperties(results);\n }\n\n /**\n * Retrieves content item instance keys.\n * @public\n */\n public async getContentInstanceKeys(requestOptions: ContentInstanceKeysRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<{ total: number, items: () => AsyncGenerator<InstanceKey> }> {\n await this.onConnection(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = {\n ...this.toRpcTokenOptions(options),\n keys: stripTransientElementKeys(options.keys).toJSON(),\n };\n\n const props = {\n page: requestOptions.paging,\n get: async (page: Required<PageOptions>) => {\n const keys = await this._requestsHandler.getContentInstanceKeys({ ...rpcOptions, paging: page });\n return {\n total: keys.total,\n items: keys.items.instanceKeys.reduce((instanceKeys, entry) => {\n for (const id of CompressedId64Set.iterable(entry[1])) {\n instanceKeys.push({ className: entry[0], id });\n }\n return instanceKeys;\n }, new Array<InstanceKey>()),\n };\n },\n };\n return createPagedGeneratorResponse(props);\n }\n\n /** Retrieves display label definition of specific item. */\n public async getDisplayLabelDefinition(requestOptions: DisplayLabelRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute): Promise<LabelDefinition> {\n await this.onConnection(requestOptions.imodel);\n const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });\n const result = await this._requestsHandler.getDisplayLabelDefinition(rpcOptions);\n return this._localizationHelper.getLocalizedLabelDefinition(result);\n }\n\n /** Retrieves display label definition of specific items. */\n public async getDisplayLabelDefinitions(requestOptions: DisplayLabelsRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute): Promise<LabelDefinition[]> {\n await this.onConnection(requestOptions.imodel);\n const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });\n const result = await buildPagedArrayResponse(undefined, async (partialPageOptions) => {\n const partialKeys = (!partialPageOptions.start) ? rpcOptions.keys : rpcOptions.keys.slice(partialPageOptions.start);\n return this._requestsHandler.getPagedDisplayLabelDefinitions({ ...rpcOptions, keys: partialKeys });\n });\n return this._localizationHelper.getLocalizedLabelDefinitions(result.items);\n }\n\n}\n\nconst getDescriptorOverrides = (descriptorOrOverrides: Descriptor | DescriptorOverrides): DescriptorOverrides => {\n if (descriptorOrOverrides instanceof Descriptor)\n return descriptorOrOverrides.createDescriptorOverrides();\n return descriptorOrOverrides;\n};\n\ninterface PagedGeneratorCreateProps<TPagedResponseItem> {\n page: PageOptions | undefined;\n get: (pageStart: Required<PageOptions>, requestIndex: number) => Promise<{ total: number, items: TPagedResponseItem[] }>;\n}\nasync function createPagedGeneratorResponse<TPagedResponseItem>(props: PagedGeneratorCreateProps<TPagedResponseItem>) {\n let pageStart = props.page?.start ?? 0;\n let pageSize = props.page?.size ?? 0;\n let requestIndex = 0;\n\n const firstPage = await props.get({ start: pageStart, size: pageSize }, requestIndex++);\n return {\n total: firstPage.total,\n async *items() {\n let partialResult = firstPage;\n while (true) {\n for (const item of partialResult.items) {\n yield item;\n }\n\n const receivedItemsCount = partialResult.items.length;\n if (partialResult.total !== 0 && receivedItemsCount === 0) {\n if (pageStart >= partialResult.total)\n throw new Error(`Requested page with start index ${pageStart} is out of bounds. Total number of items: ${partialResult.total}`);\n throw new Error(\"Paged request returned non zero total count but no items\");\n }\n\n if (pageSize !== 0 && receivedItemsCount >= pageSize || receivedItemsCount >= (partialResult.total - pageStart))\n break;\n\n if (pageSize !== 0)\n pageSize -= receivedItemsCount;\n pageStart += receivedItemsCount;\n\n partialResult = await props.get({ start: pageStart, size: pageSize }, requestIndex++);\n }\n },\n };\n}\n\n/** @internal */\nexport const buildPagedArrayResponse = async <TItem>(requestedPage: PageOptions | undefined, getter: (page: Required<PageOptions>, requestIndex: number) => Promise<PagedResponse<TItem>>): Promise<PagedResponse<TItem>> => {\n const items = new Array<TItem>();\n const gen = await createPagedGeneratorResponse({ page: requestedPage, get: getter });\n for await (const item of gen.items()) {\n items.push(item);\n }\n return { total: gen.total, items };\n};\n\nconst stripTransientElementKeys = (keys: KeySet) => {\n if (!keys.some((key) => Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME))\n return keys;\n\n const copy = new KeySet();\n copy.add(keys, (key) => {\n // the callback is not going to be called with EntityProps as KeySet converts them\n // to InstanceKeys, but we want to keep the EntityProps case for correctness\n // istanbul ignore next\n const isTransient = Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME\n || Key.isEntityProps(key) && key.classFullName === TRANSIENT_ELEMENT_CLASSNAME;\n return !isTransient;\n });\n return copy;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAe,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAE,SAAS,EAAoB,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG3E,OAAO,EAEL,OAAO,EAEP,gBAAgB,EAEhB,6BAA6B,EAI7B,UAAU,EAIV,iBAAiB,EAUjB,IAAI,EACJ,GAAG,EACH,MAAM,EACN,yBAAyB,EAEzB,IAAI,EAEJ,eAAe,EAIf,qBAAqB,EACrB,kBAAkB,EAElB,eAAe,EACf,eAAe,EAGf,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAkB,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAA2B,2BAA2B,EAAE,MAAM,2BAA2B,CAA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AAG,IAAI,KAAK,EAAS,CAAC;IACjC,MAAM,GAAG,GAAG,MAAM,4BAA4B,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;IACrF,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,EAAE,EAAE;QACpC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAClB;IACD,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,CAAC,IAAY,EAAE,EAAE;IACjD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,SAAS,KAAK,2BAA2B,CAAC,EAAE;QAChG,OAAO,IAAI,CAAC;KACb;IAED,MAAM,IAAI,GAAG,IAAI,MAAM,EAAE,CAAC;IAC1B,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;QACrB,kFAAkF;QAClF,4EAA4E;QAC5E,uBAAuB;QACvB,MAAM,WAAW,GACf,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,SAAS,KAAK,2BAA2B,CAAC;YACzE,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,aAAa,KAAK,2BAA2B,CAAC,CAAC;QAChF,OAAO,CAAC,WAAW,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { BeEvent, CompressedId64Set, IDisposable, OrderedId64Iterable } from \"@itwin/core-bentley\";\r\nimport { IModelApp, IModelConnection, IpcApp } from \"@itwin/core-frontend\";\r\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport { SchemaContext } from \"@itwin/ecschema-metadata\";\r\nimport {\r\n ClientDiagnosticsAttribute,\r\n Content,\r\n ContentDescriptorRequestOptions,\r\n ContentFormatter,\r\n ContentInstanceKeysRequestOptions,\r\n ContentPropertyValueFormatter,\r\n ContentRequestOptions,\r\n ContentSourcesRequestOptions,\r\n ContentUpdateInfo,\r\n Descriptor,\r\n DescriptorOverrides,\r\n DisplayLabelRequestOptions,\r\n DisplayLabelsRequestOptions,\r\n DisplayValueGroup,\r\n DistinctValuesRequestOptions,\r\n ElementProperties,\r\n FilterByInstancePathsHierarchyRequestOptions,\r\n FilterByTextHierarchyRequestOptions,\r\n FormatsMap,\r\n HierarchyLevelDescriptorRequestOptions,\r\n HierarchyRequestOptions,\r\n HierarchyUpdateInfo,\r\n InstanceKey,\r\n Item,\r\n Key,\r\n KeySet,\r\n KoqPropertyValueFormatter,\r\n LabelDefinition,\r\n Node,\r\n NodeKey,\r\n NodePathElement,\r\n Paged,\r\n PagedResponse,\r\n PageOptions,\r\n PresentationIpcEvents,\r\n RpcRequestsHandler,\r\n Ruleset,\r\n RulesetVariable,\r\n SelectClassInfo,\r\n SingleElementPropertiesRequestOptions,\r\n UpdateInfo,\r\n VariableValueTypes,\r\n} from \"@itwin/presentation-common\";\r\nimport { IpcRequestsHandler } from \"./IpcRequestsHandler\";\r\nimport { FrontendLocalizationHelper } from \"./LocalizationHelper\";\r\nimport { RulesetManager, RulesetManagerImpl } from \"./RulesetManager\";\r\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager\";\r\nimport { TRANSIENT_ELEMENT_CLASSNAME } from \"./selection/SelectionManager\";\r\n\r\n/**\r\n * Data structure that describes IModel hierarchy change event arguments.\r\n * @alpha\r\n */\r\nexport interface IModelHierarchyChangeEventArgs {\r\n /** Id of ruleset that was used to create hierarchy. */\r\n rulesetId: string;\r\n /** Hierarchy changes info. */\r\n updateInfo: HierarchyUpdateInfo;\r\n /** Key of iModel that was used to create hierarchy. It matches [[IModelConnection.key]] property. */\r\n imodelKey: string;\r\n}\r\n\r\n/**\r\n * Data structure that describes iModel content change event arguments.\r\n * @alpha\r\n */\r\nexport interface IModelContentChangeEventArgs {\r\n /** Id of ruleset that was used to create content. */\r\n rulesetId: string;\r\n /** Content changes info. */\r\n updateInfo: ContentUpdateInfo;\r\n /** Key of iModel that was used to create content. It matches [[IModelConnection.key]] property. */\r\n imodelKey: string;\r\n}\r\n\r\n/**\r\n * Properties used to configure [[PresentationManager]]\r\n * @public\r\n */\r\nexport interface PresentationManagerProps {\r\n /**\r\n * Sets the active locale to use when localizing presentation-related\r\n * strings. It can later be changed through [[PresentationManager]].\r\n */\r\n activeLocale?: string;\r\n\r\n /**\r\n * Sets the active unit system to use for formatting property values with\r\n * units. The value can later be changed through [[PresentationManager.activeUnitSystem]] setter or\r\n * overriden for each request through request parameters. If not set, `IModelApp.quantityFormatter.activeUnitSystem`\r\n * is used by default.\r\n *\r\n * @deprecated in 4.0. Use [IModelApp.quantityFormatter]($core-frontend) to set the active unit system.\r\n */\r\n activeUnitSystem?: UnitSystemKey;\r\n\r\n /**\r\n * ID used to identify client that requests data. Generally, clients should\r\n * store this ID in their local storage so the ID can be reused across\r\n * sessions - this allows reusing some caches.\r\n *\r\n * Defaults to a unique GUID as a client id.\r\n */\r\n clientId?: string;\r\n\r\n /**\r\n * Timeout (in milliseconds) for how long we're going to wait for RPC request to be fulfilled before throwing\r\n * a timeout error.\r\n *\r\n * Defaults to 10 minutes.\r\n */\r\n requestTimeout?: number;\r\n\r\n /**\r\n * Callback that provides [SchemaContext]($ecschema-metadata) for supplied [IModelConnection]($core-frontend).\r\n * [SchemaContext]($ecschema-metadata) is used for getting metadata required for values formatting.\r\n * @alpha\r\n */\r\n schemaContextProvider?: (imodel: IModelConnection) => SchemaContext;\r\n\r\n /**\r\n * A map of default unit formats to use for formatting properties that don't have a presentation format\r\n * in requested unit system.\r\n *\r\n * @note Only has effect when frontend value formatting is enabled by supplying the `schemaContextProvider` prop.\r\n * @alpha\r\n */\r\n defaultFormats?: FormatsMap;\r\n\r\n /** @internal */\r\n rpcRequestsHandler?: RpcRequestsHandler;\r\n\r\n /** @internal */\r\n ipcRequestsHandler?: IpcRequestsHandler;\r\n}\r\n\r\n/**\r\n * Frontend Presentation manager which basically just forwards all calls to\r\n * the backend implementation.\r\n *\r\n * @public\r\n */\r\nexport class PresentationManager implements IDisposable {\r\n private _requestsHandler: RpcRequestsHandler;\r\n private _rulesets: RulesetManager;\r\n private _localizationHelper: FrontendLocalizationHelper;\r\n private _explicitActiveUnitSystem: UnitSystemKey | undefined;\r\n private _rulesetVars: Map<string, RulesetVariablesManager>;\r\n private _clearEventListener?: () => void;\r\n private _connections: Map<IModelConnection, Promise<void>>;\r\n private _schemaContextProvider?: (imodel: IModelConnection) => SchemaContext;\r\n private _defaultFormats?: FormatsMap;\r\n private _ipcRequestsHandler?: IpcRequestsHandler;\r\n\r\n /**\r\n * An event raised when hierarchies created using specific ruleset change\r\n * @alpha\r\n */\r\n public onIModelHierarchyChanged = new BeEvent<(args: IModelHierarchyChangeEventArgs) => void>();\r\n\r\n /**\r\n * An event raised when content created using specific ruleset changes\r\n * @alpha\r\n */\r\n public onIModelContentChanged = new BeEvent<(args: IModelContentChangeEventArgs) => void>();\r\n\r\n /**\r\n * Get / set active unit system used to format property values with units.\r\n *\r\n * @deprecated in 4.0. `IModelApp.quantityFormatter` should be used to get/set the active unit system. At the moment\r\n * [[PresentationManager]] allows overriding it, but returns `IModelApp.quantityFormatter.activeUnitSystem` if override\r\n * is not set.\r\n */\r\n public get activeUnitSystem(): UnitSystemKey {\r\n return this._explicitActiveUnitSystem ?? IModelApp.quantityFormatter.activeUnitSystem;\r\n }\r\n public set activeUnitSystem(value: UnitSystemKey | undefined) {\r\n this._explicitActiveUnitSystem = value;\r\n }\r\n\r\n private constructor(props?: PresentationManagerProps) {\r\n if (props) {\r\n // eslint-disable-next-line deprecation/deprecation\r\n this._explicitActiveUnitSystem = props.activeUnitSystem;\r\n }\r\n\r\n this._requestsHandler =\r\n props?.rpcRequestsHandler ?? new RpcRequestsHandler(props ? { clientId: props.clientId, timeout: props.requestTimeout } : undefined);\r\n this._rulesetVars = new Map<string, RulesetVariablesManager>();\r\n this._rulesets = RulesetManagerImpl.create();\r\n this._localizationHelper = new FrontendLocalizationHelper(props?.activeLocale);\r\n this._connections = new Map<IModelConnection, Promise<void>>();\r\n this._schemaContextProvider = props?.schemaContextProvider;\r\n this._defaultFormats = props?.defaultFormats;\r\n\r\n if (IpcApp.isValid) {\r\n // Ipc only works in ipc apps, so the `onUpdate` callback will only be called there.\r\n this._clearEventListener = IpcApp.addListener(PresentationIpcEvents.Update, this.onUpdate);\r\n this._ipcRequestsHandler = props?.ipcRequestsHandler ?? new IpcRequestsHandler(this._requestsHandler.clientId);\r\n }\r\n }\r\n\r\n /** Get / set active locale used for localizing presentation data */\r\n public get activeLocale(): string | undefined {\r\n return this._localizationHelper.locale;\r\n }\r\n public set activeLocale(locale: string | undefined) {\r\n this._localizationHelper.locale = locale;\r\n }\r\n\r\n public dispose() {\r\n if (this._clearEventListener) {\r\n this._clearEventListener();\r\n this._clearEventListener = undefined;\r\n }\r\n }\r\n\r\n private async onConnection(imodel: IModelConnection) {\r\n if (!this._connections.has(imodel)) {\r\n this._connections.set(imodel, this.initializeIModel(imodel));\r\n }\r\n await this._connections.get(imodel);\r\n }\r\n\r\n private async initializeIModel(imodel: IModelConnection) {\r\n imodel.onClose.addOnce(() => {\r\n this._connections.delete(imodel);\r\n });\r\n await this.onNewiModelConnection(imodel);\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private onUpdate = (_evt: Event, report: UpdateInfo) => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.handleUpdateAsync(report);\r\n };\r\n\r\n /** @note This is only called in native apps after changes in iModels */\r\n private async handleUpdateAsync(report: UpdateInfo) {\r\n for (const imodelKey in report) {\r\n // istanbul ignore if\r\n if (!report.hasOwnProperty(imodelKey)) {\r\n continue;\r\n }\r\n\r\n const imodelReport = report[imodelKey];\r\n for (const rulesetId in imodelReport) {\r\n // istanbul ignore if\r\n if (!imodelReport.hasOwnProperty(rulesetId)) {\r\n continue;\r\n }\r\n\r\n const updateInfo = imodelReport[rulesetId];\r\n if (updateInfo.content) {\r\n this.onIModelContentChanged.raiseEvent({ rulesetId, updateInfo: updateInfo.content, imodelKey });\r\n }\r\n if (updateInfo.hierarchy) {\r\n this.onIModelHierarchyChanged.raiseEvent({ rulesetId, updateInfo: updateInfo.hierarchy, imodelKey });\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Function that is called when a new IModelConnection is used to retrieve data.\r\n * @internal\r\n */\r\n public async onNewiModelConnection(_: IModelConnection) {}\r\n\r\n /**\r\n * Create a new PresentationManager instance\r\n * @param props Optional properties used to configure the manager\r\n */\r\n public static create(props?: PresentationManagerProps) {\r\n return new PresentationManager(props);\r\n }\r\n\r\n /** @internal */\r\n public get rpcRequestsHandler() {\r\n return this._requestsHandler;\r\n }\r\n\r\n /** @internal */\r\n public get ipcRequestsHandler() {\r\n return this._ipcRequestsHandler;\r\n }\r\n\r\n /**\r\n * Get rulesets manager\r\n */\r\n public rulesets() {\r\n return this._rulesets;\r\n }\r\n\r\n /**\r\n * Get ruleset variables manager for specific ruleset\r\n * @param rulesetId Id of the ruleset to get the vars manager for\r\n */\r\n public vars(rulesetId: string) {\r\n if (!this._rulesetVars.has(rulesetId)) {\r\n const varsManager = new RulesetVariablesManagerImpl(rulesetId, this._ipcRequestsHandler);\r\n this._rulesetVars.set(rulesetId, varsManager);\r\n }\r\n return this._rulesetVars.get(rulesetId)!;\r\n }\r\n\r\n private toRpcTokenOptions<TOptions extends { imodel: IModelConnection; locale?: string; unitSystem?: UnitSystemKey; rulesetVariables?: RulesetVariable[] }>(\r\n requestOptions: TOptions,\r\n ) {\r\n // 1. put default `locale` and `unitSystem`\r\n // 2. put all `requestOptions` members (if `locale` or `unitSystem` are set, they'll override the defaults put at #1)\r\n // 3. put `imodel` of type `IModelRpcProps` which overwrites the `imodel` from `requestOptions` put at #2\r\n const defaultOptions: Pick<TOptions, \"locale\" | \"unitSystem\"> = {};\r\n if (this.activeLocale) {\r\n defaultOptions.locale = this.activeLocale;\r\n }\r\n defaultOptions.unitSystem = this.activeUnitSystem; // eslint-disable-line deprecation/deprecation\r\n\r\n const { imodel, rulesetVariables, ...rpcRequestOptions } = requestOptions;\r\n return {\r\n ...defaultOptions,\r\n ...rpcRequestOptions,\r\n ...(rulesetVariables ? { rulesetVariables: rulesetVariables.map(RulesetVariable.toJSON) } : {}),\r\n imodel: imodel.getRpcProps(),\r\n };\r\n }\r\n\r\n private async addRulesetAndVariablesToOptions<TOptions extends { rulesetOrId: Ruleset | string; rulesetVariables?: RulesetVariable[] }>(options: TOptions) {\r\n const { rulesetOrId, rulesetVariables } = options;\r\n let foundRulesetOrId: Ruleset | string;\r\n if (typeof rulesetOrId === \"object\") {\r\n foundRulesetOrId = rulesetOrId;\r\n } else {\r\n const foundRuleset = await this._rulesets.get(rulesetOrId);\r\n foundRulesetOrId = foundRuleset ? foundRuleset.toJSON() : rulesetOrId;\r\n }\r\n const rulesetId = typeof foundRulesetOrId === \"object\" ? foundRulesetOrId.id : foundRulesetOrId;\r\n\r\n // All Id64Array variable values must be sorted for serialization to JSON to work. RulesetVariablesManager\r\n // sorts them before storing, so that part is taken care of, but we need to ensure that variables coming from\r\n // request options are also sorted.\r\n const variables = (rulesetVariables ?? []).map((variable) => {\r\n if (variable.type === VariableValueTypes.Id64Array) {\r\n return { ...variable, value: OrderedId64Iterable.sortArray(variable.value) };\r\n }\r\n return variable;\r\n });\r\n if (!this._ipcRequestsHandler) {\r\n // only need to add variables from variables manager if there's no IPC\r\n // handler - if there is one, the variables are already known by the backend\r\n variables.push(...this.vars(rulesetId).getAllVariables());\r\n }\r\n\r\n return { ...options, rulesetOrId: foundRulesetOrId, rulesetVariables: variables };\r\n }\r\n\r\n /** Retrieves nodes */\r\n public async getNodes(\r\n requestOptions: Paged<HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable>> & ClientDiagnosticsAttribute,\r\n ): Promise<Node[]> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options });\r\n const result = await buildPagedArrayResponse(options.paging, async (partialPageOptions) =>\r\n this._requestsHandler.getPagedNodes({ ...rpcOptions, paging: partialPageOptions }),\r\n );\r\n // eslint-disable-next-line deprecation/deprecation\r\n return this._localizationHelper.getLocalizedNodes(result.items.map(Node.fromJSON));\r\n }\r\n\r\n /** Retrieves nodes count. */\r\n public async getNodesCount(\r\n requestOptions: HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute,\r\n ): Promise<number> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options });\r\n return this._requestsHandler.getNodesCount(rpcOptions);\r\n }\r\n\r\n /** Retrieves total nodes count and a single page of nodes. */\r\n public async getNodesAndCount(\r\n requestOptions: Paged<HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable>> & ClientDiagnosticsAttribute,\r\n ): Promise<{ count: number; nodes: Node[] }> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options });\r\n const result = await buildPagedArrayResponse(options.paging, async (partialPageOptions) =>\r\n this._requestsHandler.getPagedNodes({ ...rpcOptions, paging: partialPageOptions }),\r\n );\r\n return {\r\n count: result.total,\r\n // eslint-disable-next-line deprecation/deprecation\r\n nodes: this._localizationHelper.getLocalizedNodes(result.items.map(Node.fromJSON)),\r\n };\r\n }\r\n\r\n /**\r\n * Retrieves hierarchy level descriptor.\r\n * @beta\r\n */\r\n public async getNodesDescriptor(\r\n requestOptions: HierarchyLevelDescriptorRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute,\r\n ): Promise<Descriptor | undefined> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options });\r\n const result = await this._requestsHandler.getNodesDescriptor(rpcOptions);\r\n const descriptor = Descriptor.fromJSON(result);\r\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\r\n }\r\n\r\n /** Retrieves paths from root nodes to children nodes according to specified keys. Intersecting paths will be merged. */\r\n public async getNodePaths(\r\n requestOptions: FilterByInstancePathsHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options });\r\n const result = await this._requestsHandler.getNodePaths(rpcOptions);\r\n // eslint-disable-next-line deprecation/deprecation\r\n return result.map(NodePathElement.fromJSON).map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\r\n }\r\n\r\n /** Retrieves paths from root nodes to nodes containing filter text in their label. */\r\n public async getFilteredNodePaths(\r\n requestOptions: FilterByTextHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const result = await this._requestsHandler.getFilteredNodePaths(this.toRpcTokenOptions(options));\r\n // eslint-disable-next-line deprecation/deprecation\r\n return result.map(NodePathElement.fromJSON).map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\r\n }\r\n\r\n /**\r\n * Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,\r\n * its related instances for loading related and navigation properties.\r\n * @public\r\n */\r\n public async getContentSources(requestOptions: ContentSourcesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute): Promise<SelectClassInfo[]> {\r\n await this.onConnection(requestOptions.imodel);\r\n const rpcOptions = this.toRpcTokenOptions(requestOptions);\r\n const result = await this._requestsHandler.getContentSources(rpcOptions);\r\n return SelectClassInfo.listFromCompressedJSON(result.sources, result.classesMap);\r\n }\r\n\r\n /** Retrieves the content descriptor which describes the content and can be used to customize it. */\r\n public async getContentDescriptor(\r\n requestOptions: ContentDescriptorRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute,\r\n ): Promise<Descriptor | undefined> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({\r\n ...options,\r\n keys: stripTransientElementKeys(options.keys).toJSON(),\r\n });\r\n const result = await this._requestsHandler.getContentDescriptor(rpcOptions);\r\n const descriptor = Descriptor.fromJSON(result);\r\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\r\n }\r\n\r\n /** Retrieves overall content set size. */\r\n public async getContentSetSize(\r\n requestOptions: ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> & ClientDiagnosticsAttribute,\r\n ): Promise<number> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({\r\n ...options,\r\n descriptor: getDescriptorOverrides(requestOptions.descriptor),\r\n keys: stripTransientElementKeys(requestOptions.keys).toJSON(),\r\n });\r\n return this._requestsHandler.getContentSetSize(rpcOptions);\r\n }\r\n\r\n /** Retrieves content which consists of a content descriptor and a page of records. */\r\n public async getContent(\r\n requestOptions: Paged<ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>> & ClientDiagnosticsAttribute,\r\n ): Promise<Content | undefined> {\r\n return (await this.getContentAndSize(requestOptions))?.content;\r\n }\r\n\r\n /** Retrieves content set size and content which consists of a content descriptor and a page of records. */\r\n public async getContentAndSize(\r\n requestOptions: Paged<ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>> & ClientDiagnosticsAttribute,\r\n ): Promise<{ content: Content; size: number } | undefined> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({\r\n ...options,\r\n descriptor: getDescriptorOverrides(requestOptions.descriptor),\r\n keys: stripTransientElementKeys(requestOptions.keys).toJSON(),\r\n ...(!requestOptions.omitFormattedValues && this._schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),\r\n });\r\n let descriptor = requestOptions.descriptor instanceof Descriptor ? requestOptions.descriptor : undefined;\r\n const result = await buildPagedArrayResponse(options.paging, async (partialPageOptions, requestIndex) => {\r\n if (0 === requestIndex && !descriptor) {\r\n const content = await this._requestsHandler.getPagedContent({ ...rpcOptions, paging: partialPageOptions });\r\n if (content) {\r\n descriptor = Descriptor.fromJSON(content.descriptor);\r\n return content.contentSet;\r\n }\r\n return { total: 0, items: [] };\r\n }\r\n return this._requestsHandler.getPagedContentSet({ ...rpcOptions, paging: partialPageOptions });\r\n });\r\n if (!descriptor) {\r\n return undefined;\r\n }\r\n\r\n const items = result.items.map((itemJson) => Item.fromJSON(itemJson)).filter<Item>((item): item is Item => item !== undefined);\r\n const resultContent = new Content(descriptor, items);\r\n if (!requestOptions.omitFormattedValues && this._schemaContextProvider) {\r\n const koqPropertyFormatter = new KoqPropertyValueFormatter(this._schemaContextProvider(requestOptions.imodel), this._defaultFormats);\r\n const contentFormatter = new ContentFormatter(\r\n new ContentPropertyValueFormatter(koqPropertyFormatter),\r\n requestOptions.unitSystem ?? this._explicitActiveUnitSystem ?? IModelApp.quantityFormatter.activeUnitSystem,\r\n );\r\n await contentFormatter.formatContent(resultContent);\r\n }\r\n\r\n return {\r\n size: result.total,\r\n content: this._localizationHelper.getLocalizedContent(resultContent),\r\n };\r\n }\r\n\r\n /** Retrieves distinct values of specific field from the content. */\r\n public async getPagedDistinctValues(\r\n requestOptions: DistinctValuesRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> & ClientDiagnosticsAttribute,\r\n ): Promise<PagedResponse<DisplayValueGroup>> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = {\r\n ...this.toRpcTokenOptions(options),\r\n descriptor: getDescriptorOverrides(options.descriptor),\r\n keys: stripTransientElementKeys(options.keys).toJSON(),\r\n };\r\n const result = await buildPagedArrayResponse(requestOptions.paging, async (partialPageOptions) =>\r\n this._requestsHandler.getPagedDistinctValues({ ...rpcOptions, paging: partialPageOptions }),\r\n );\r\n return {\r\n ...result,\r\n // eslint-disable-next-line deprecation/deprecation\r\n items: result.items.map(DisplayValueGroup.fromJSON).map((g) => this._localizationHelper.getLocalizedDisplayValueGroup(g)),\r\n };\r\n }\r\n\r\n /**\r\n * Retrieves property data in a simplified format for a single element specified by ID.\r\n * @public\r\n */\r\n public async getElementProperties(\r\n requestOptions: SingleElementPropertiesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute,\r\n ): Promise<ElementProperties | undefined> {\r\n await this.onConnection(requestOptions.imodel);\r\n const results = await this._requestsHandler.getElementProperties(this.toRpcTokenOptions(requestOptions));\r\n // istanbul ignore if\r\n if (!results) {\r\n return undefined;\r\n }\r\n return this._localizationHelper.getLocalizedElementProperties(results);\r\n }\r\n\r\n /**\r\n * Retrieves content item instance keys.\r\n * @public\r\n */\r\n public async getContentInstanceKeys(\r\n requestOptions: ContentInstanceKeysRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute,\r\n ): Promise<{ total: number; items: () => AsyncGenerator<InstanceKey> }> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = {\r\n ...this.toRpcTokenOptions(options),\r\n keys: stripTransientElementKeys(options.keys).toJSON(),\r\n };\r\n\r\n const props = {\r\n page: requestOptions.paging,\r\n get: async (page: Required<PageOptions>) => {\r\n const keys = await this._requestsHandler.getContentInstanceKeys({ ...rpcOptions, paging: page });\r\n return {\r\n total: keys.total,\r\n items: keys.items.instanceKeys.reduce((instanceKeys, entry) => {\r\n for (const id of CompressedId64Set.iterable(entry[1])) {\r\n instanceKeys.push({ className: entry[0], id });\r\n }\r\n return instanceKeys;\r\n }, new Array<InstanceKey>()),\r\n };\r\n },\r\n };\r\n return createPagedGeneratorResponse(props);\r\n }\r\n\r\n /** Retrieves display label definition of specific item. */\r\n public async getDisplayLabelDefinition(\r\n requestOptions: DisplayLabelRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute,\r\n ): Promise<LabelDefinition> {\r\n await this.onConnection(requestOptions.imodel);\r\n const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });\r\n const result = await this._requestsHandler.getDisplayLabelDefinition(rpcOptions);\r\n return this._localizationHelper.getLocalizedLabelDefinition(result);\r\n }\r\n\r\n /** Retrieves display label definition of specific items. */\r\n public async getDisplayLabelDefinitions(\r\n requestOptions: DisplayLabelsRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute,\r\n ): Promise<LabelDefinition[]> {\r\n await this.onConnection(requestOptions.imodel);\r\n const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });\r\n const result = await buildPagedArrayResponse(undefined, async (partialPageOptions) => {\r\n const partialKeys = !partialPageOptions.start ? rpcOptions.keys : rpcOptions.keys.slice(partialPageOptions.start);\r\n return this._requestsHandler.getPagedDisplayLabelDefinitions({ ...rpcOptions, keys: partialKeys });\r\n });\r\n return this._localizationHelper.getLocalizedLabelDefinitions(result.items);\r\n }\r\n}\r\n\r\nconst getDescriptorOverrides = (descriptorOrOverrides: Descriptor | DescriptorOverrides): DescriptorOverrides => {\r\n if (descriptorOrOverrides instanceof Descriptor) {\r\n return descriptorOrOverrides.createDescriptorOverrides();\r\n }\r\n return descriptorOrOverrides;\r\n};\r\n\r\ninterface PagedGeneratorCreateProps<TPagedResponseItem> {\r\n page: PageOptions | undefined;\r\n get: (pageStart: Required<PageOptions>, requestIndex: number) => Promise<{ total: number; items: TPagedResponseItem[] }>;\r\n}\r\nasync function createPagedGeneratorResponse<TPagedResponseItem>(props: PagedGeneratorCreateProps<TPagedResponseItem>) {\r\n let pageStart = props.page?.start ?? 0;\r\n let pageSize = props.page?.size ?? 0;\r\n let requestIndex = 0;\r\n\r\n const firstPage = await props.get({ start: pageStart, size: pageSize }, requestIndex++);\r\n return {\r\n total: firstPage.total,\r\n async *items() {\r\n let partialResult = firstPage;\r\n while (true) {\r\n for (const item of partialResult.items) {\r\n yield item;\r\n }\r\n\r\n const receivedItemsCount = partialResult.items.length;\r\n if (partialResult.total !== 0 && receivedItemsCount === 0) {\r\n if (pageStart >= partialResult.total) {\r\n throw new Error(`Requested page with start index ${pageStart} is out of bounds. Total number of items: ${partialResult.total}`);\r\n }\r\n throw new Error(\"Paged request returned non zero total count but no items\");\r\n }\r\n\r\n if ((pageSize !== 0 && receivedItemsCount >= pageSize) || receivedItemsCount >= partialResult.total - pageStart) {\r\n break;\r\n }\r\n\r\n if (pageSize !== 0) {\r\n pageSize -= receivedItemsCount;\r\n }\r\n pageStart += receivedItemsCount;\r\n\r\n partialResult = await props.get({ start: pageStart, size: pageSize }, requestIndex++);\r\n }\r\n },\r\n };\r\n}\r\n\r\n/** @internal */\r\nexport const buildPagedArrayResponse = async <TItem>(\r\n requestedPage: PageOptions | undefined,\r\n getter: (page: Required<PageOptions>, requestIndex: number) => Promise<PagedResponse<TItem>>,\r\n): Promise<PagedResponse<TItem>> => {\r\n const items = new Array<TItem>();\r\n const gen = await createPagedGeneratorResponse({ page: requestedPage, get: getter });\r\n for await (const item of gen.items()) {\r\n items.push(item);\r\n }\r\n return { total: gen.total, items };\r\n};\r\n\r\nconst stripTransientElementKeys = (keys: KeySet) => {\r\n if (!keys.some((key) => Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME)) {\r\n return keys;\r\n }\r\n\r\n const copy = new KeySet();\r\n copy.add(keys, (key) => {\r\n // the callback is not going to be called with EntityProps as KeySet converts them\r\n // to InstanceKeys, but we want to keep the EntityProps case for correctness\r\n // istanbul ignore next\r\n const isTransient =\r\n (Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME) ||\r\n (Key.isEntityProps(key) && key.classFullName === TRANSIENT_ELEMENT_CLASSNAME);\r\n return !isTransient;\r\n });\r\n return copy;\r\n};\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RulesetManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/RulesetManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAQ,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAExE;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,iBAAiB,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC,CAAC;IAE7E;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;IAExD;;OAEG;IACH,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAElD;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GA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D,OAAO,CAAC,eAAe,CAA0C;IAC1D,iBAAiB,iBAAsB,iBAAiB,QAAQ,OAAO,KAAK,IAAI,EAAI;WAE7E,MAAM;IAIpB;;OAEG;IACU,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;IAQpE;;OAEG;IACU,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAS9D;;OAEG;IACU,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAO1G;;OAEG;IACU,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IA2BpF;;OAEG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAOpC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
*--------------------------------------------------------------------------------------------*/
|
|
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
5
|
/** @packageDocumentation
|
|
6
6
|
* @module Core
|
|
7
7
|
*/
|
|
@@ -21,8 +21,9 @@ export class RulesetManagerImpl {
|
|
|
21
21
|
*/
|
|
22
22
|
async get(id) {
|
|
23
23
|
const m = this._clientRulesets.get(id);
|
|
24
|
-
if (!m)
|
|
24
|
+
if (!m) {
|
|
25
25
|
return undefined;
|
|
26
|
+
}
|
|
26
27
|
return m[0];
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
@@ -30,8 +31,9 @@ export class RulesetManagerImpl {
|
|
|
30
31
|
*/
|
|
31
32
|
async add(ruleset) {
|
|
32
33
|
const registered = new RegisteredRuleset(ruleset, Guid.createValue(), async (r) => this.remove(r));
|
|
33
|
-
if (!this._clientRulesets.has(ruleset.id))
|
|
34
|
+
if (!this._clientRulesets.has(ruleset.id)) {
|
|
34
35
|
this._clientRulesets.set(ruleset.id, []);
|
|
36
|
+
}
|
|
35
37
|
this._clientRulesets.get(ruleset.id).push(registered);
|
|
36
38
|
return registered;
|
|
37
39
|
}
|
|
@@ -58,8 +60,9 @@ export class RulesetManagerImpl {
|
|
|
58
60
|
uniqueIdentifier = ruleset.uniqueIdentifier;
|
|
59
61
|
}
|
|
60
62
|
const m = this._clientRulesets.get(rulesetId);
|
|
61
|
-
if (!m)
|
|
63
|
+
if (!m) {
|
|
62
64
|
return false;
|
|
65
|
+
}
|
|
63
66
|
let didRemove = false;
|
|
64
67
|
for (let i = 0; i < m.length; ++i) {
|
|
65
68
|
if (m[i].uniqueIdentifier === uniqueIdentifier) {
|
|
@@ -74,8 +77,9 @@ export class RulesetManagerImpl {
|
|
|
74
77
|
* Remove all rulesets registered in this session.
|
|
75
78
|
*/
|
|
76
79
|
async clear() {
|
|
77
|
-
if (0 === this._clientRulesets.size)
|
|
80
|
+
if (0 === this._clientRulesets.size) {
|
|
78
81
|
return;
|
|
82
|
+
}
|
|
79
83
|
this._clientRulesets.clear();
|
|
80
84
|
}
|
|
81
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RulesetManager.js","sourceRoot":"","sources":["../../../src/presentation-frontend/RulesetManager.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"RulesetManager.js","sourceRoot":"","sources":["../../../src/presentation-frontend/RulesetManager.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE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AAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;QACjE,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC9D,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,MAAM,CAAC,OAA6C;QAC/D,IAAI,SAAS,EAAE,gBAAwB,CAAC;QACxC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAC1B,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YACvB,gBAAgB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;SAC/B;aAAM;YACL,SAAS,GAAG,OAAO,CAAC,EAAE,CAAC;YACvB,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;SAC7C;QAED,MAAM,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,CAAC,CAAC,EAAE;YACN,OAAO,KAAK,CAAC;SACd;QAED,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;YACjC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,KAAK,gBAAgB,EAAE;gBAC9C,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBACf,SAAS,GAAG,IAAI,CAAC;gBACjB,MAAM;aACP;SACF;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC,KAAK,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE;YACnC,OAAO;SACR;QAED,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { BeEvent, Guid } from \"@itwin/core-bentley\";\r\nimport { RegisteredRuleset, Ruleset } from \"@itwin/presentation-common\";\r\n\r\n/**\r\n * Presentation ruleset registry.\r\n * @public\r\n */\r\nexport interface RulesetManager {\r\n /**\r\n * An event invoked one a ruleset is modified using [[modify]] function.\r\n * @beta\r\n */\r\n onRulesetModified: BeEvent<(curr: RegisteredRuleset, prev: Ruleset) => void>;\r\n\r\n /**\r\n * Get a ruleset with the specified id.\r\n */\r\n get(id: string): Promise<RegisteredRuleset | undefined>;\r\n\r\n /**\r\n * Register the supplied ruleset\r\n */\r\n add(ruleset: Ruleset): Promise<RegisteredRuleset>;\r\n\r\n /**\r\n * Modify the given pre-registered ruleset\r\n * @beta\r\n */\r\n modify(ruleset: RegisteredRuleset, newRules: Omit<Ruleset, \"id\">): Promise<RegisteredRuleset>;\r\n\r\n /**\r\n * Unregister the supplied ruleset\r\n */\r\n remove(ruleset: RegisteredRuleset | [string, string]): Promise<boolean>;\r\n\r\n /**\r\n * Remove all rulesets registered in this session.\r\n */\r\n clear(): Promise<void>;\r\n}\r\n\r\n/** @internal */\r\nexport class RulesetManagerImpl implements RulesetManager {\r\n private _clientRulesets = new Map<string, RegisteredRuleset[]>();\r\n public onRulesetModified = new BeEvent<(curr: RegisteredRuleset, prev: Ruleset) => void>();\r\n\r\n public static create() {\r\n return new RulesetManagerImpl();\r\n }\r\n\r\n /**\r\n * Get a ruleset with the specified id.\r\n */\r\n public async get(id: string): Promise<RegisteredRuleset | undefined> {\r\n const m = this._clientRulesets.get(id);\r\n if (!m) {\r\n return undefined;\r\n }\r\n return m[0];\r\n }\r\n\r\n /**\r\n * Register the supplied ruleset\r\n */\r\n public async add(ruleset: Ruleset): Promise<RegisteredRuleset> {\r\n const registered = new RegisteredRuleset(ruleset, Guid.createValue(), async (r: RegisteredRuleset) => this.remove(r));\r\n if (!this._clientRulesets.has(ruleset.id)) {\r\n this._clientRulesets.set(ruleset.id, []);\r\n }\r\n this._clientRulesets.get(ruleset.id)!.push(registered);\r\n return registered;\r\n }\r\n\r\n /**\r\n * Modifies the given pre-registered ruleset\r\n */\r\n public async modify(ruleset: RegisteredRuleset, newRules: Omit<Ruleset, \"id\">): Promise<RegisteredRuleset> {\r\n await this.remove(ruleset);\r\n const modified = await this.add({ ...newRules, id: ruleset.id });\r\n this.onRulesetModified.raiseEvent(modified, ruleset.toJSON());\r\n return modified;\r\n }\r\n\r\n /**\r\n * Unregister the supplied ruleset\r\n */\r\n public async remove(ruleset: RegisteredRuleset | [string, string]): Promise<boolean> {\r\n let rulesetId, uniqueIdentifier: string;\r\n if (Array.isArray(ruleset)) {\r\n rulesetId = ruleset[0];\r\n uniqueIdentifier = ruleset[1];\r\n } else {\r\n rulesetId = ruleset.id;\r\n uniqueIdentifier = ruleset.uniqueIdentifier;\r\n }\r\n\r\n const m = this._clientRulesets.get(rulesetId);\r\n if (!m) {\r\n return false;\r\n }\r\n\r\n let didRemove = false;\r\n for (let i = 0; i < m.length; ++i) {\r\n if (m[i].uniqueIdentifier === uniqueIdentifier) {\r\n m.splice(i, 1);\r\n didRemove = true;\r\n break;\r\n }\r\n }\r\n\r\n return didRemove;\r\n }\r\n\r\n /**\r\n * Remove all rulesets registered in this session.\r\n */\r\n public async clear(): Promise<void> {\r\n if (0 === this._clientRulesets.size) {\r\n return;\r\n }\r\n\r\n this._clientRulesets.clear();\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RulesetVariablesManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/RulesetVariablesManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,OAAO,EAAQ,UAAU,EAAuB,MAAM,qBAAqB,CAAC;AAC7F,OAAO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