@itwin/presentation-backend 5.1.0-dev.5 → 5.1.0-dev.51
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 +71 -1
- package/lib/cjs/presentation-backend/BackendLoggerCategory.d.ts +9 -9
- package/lib/cjs/presentation-backend/BackendLoggerCategory.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/BackendLoggerCategory.js +9 -9
- package/lib/cjs/presentation-backend/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/presentation-backend/ElementPropertiesHelper.js +14 -14
- package/lib/cjs/presentation-backend/ElementPropertiesHelper.js.map +1 -1
- package/lib/cjs/presentation-backend/InternalSymbols.js.map +1 -1
- package/lib/cjs/presentation-backend/NativePlatform.js.map +1 -1
- package/lib/cjs/presentation-backend/Presentation.d.ts +3 -3
- package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationIpcHandler.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManager.d.ts +19 -8
- package/lib/cjs/presentation-backend/PresentationManager.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManager.js +27 -18
- package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManagerDetail.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManagerDetail.js +16 -8
- package/lib/cjs/presentation-backend/PresentationManagerDetail.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js +3 -16
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
- package/lib/cjs/presentation-backend/RulesetEmbedder.js +3 -3
- package/lib/cjs/presentation-backend/RulesetEmbedder.js.map +1 -1
- package/lib/cjs/presentation-backend/RulesetManager.js.map +1 -1
- package/lib/cjs/presentation-backend/RulesetVariablesManager.js.map +1 -1
- package/lib/cjs/presentation-backend/SelectionScopesHelper.js +16 -16
- package/lib/cjs/presentation-backend/SelectionScopesHelper.js.map +1 -1
- package/lib/cjs/presentation-backend/TemporaryStorage.js.map +1 -1
- package/lib/cjs/presentation-backend/Utils.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/Utils.js.map +1 -1
- package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js.map +1 -1
- package/lib/cjs/presentation-backend/domain/RulesetElements.js.map +1 -1
- package/lib/cjs/presentation-backend-internal.js.map +1 -1
- package/lib/cjs/presentation-backend.js +20 -0
- package/lib/cjs/presentation-backend.js.map +1 -1
- package/lib/esm/presentation-backend/BackendLoggerCategory.d.ts +9 -9
- package/lib/esm/presentation-backend/BackendLoggerCategory.d.ts.map +1 -1
- package/lib/esm/presentation-backend/BackendLoggerCategory.js +9 -9
- package/lib/esm/presentation-backend/BackendLoggerCategory.js.map +1 -1
- package/lib/esm/presentation-backend/ElementPropertiesHelper.js +14 -14
- package/lib/esm/presentation-backend/ElementPropertiesHelper.js.map +1 -1
- package/lib/esm/presentation-backend/InternalSymbols.js.map +1 -1
- package/lib/esm/presentation-backend/NativePlatform.js.map +1 -1
- package/lib/esm/presentation-backend/Presentation.d.ts +3 -3
- package/lib/esm/presentation-backend/Presentation.js.map +1 -1
- package/lib/esm/presentation-backend/PresentationIpcHandler.js.map +1 -1
- package/lib/esm/presentation-backend/PresentationManager.d.ts +19 -8
- package/lib/esm/presentation-backend/PresentationManager.d.ts.map +1 -1
- package/lib/esm/presentation-backend/PresentationManager.js +27 -18
- package/lib/esm/presentation-backend/PresentationManager.js.map +1 -1
- package/lib/esm/presentation-backend/PresentationManagerDetail.d.ts.map +1 -1
- package/lib/esm/presentation-backend/PresentationManagerDetail.js +11 -3
- package/lib/esm/presentation-backend/PresentationManagerDetail.js.map +1 -1
- package/lib/esm/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
- package/lib/esm/presentation-backend/PresentationRpcImpl.js +5 -18
- package/lib/esm/presentation-backend/PresentationRpcImpl.js.map +1 -1
- package/lib/esm/presentation-backend/RulesetEmbedder.js +3 -3
- package/lib/esm/presentation-backend/RulesetEmbedder.js.map +1 -1
- package/lib/esm/presentation-backend/RulesetManager.js.map +1 -1
- package/lib/esm/presentation-backend/RulesetVariablesManager.js.map +1 -1
- package/lib/esm/presentation-backend/SelectionScopesHelper.js +16 -16
- package/lib/esm/presentation-backend/SelectionScopesHelper.js.map +1 -1
- package/lib/esm/presentation-backend/TemporaryStorage.js.map +1 -1
- package/lib/esm/presentation-backend/Utils.d.ts.map +1 -1
- package/lib/esm/presentation-backend/Utils.js +2 -2
- package/lib/esm/presentation-backend/Utils.js.map +1 -1
- package/lib/esm/presentation-backend/domain/PresentationRulesDomain.js.map +1 -1
- package/lib/esm/presentation-backend/domain/RulesetElements.js.map +1 -1
- package/lib/esm/presentation-backend-internal.js.map +1 -1
- package/lib/esm/presentation-backend.js +20 -0
- package/lib/esm/presentation-backend.js.map +1 -1
- package/package.json +15 -14
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { IModelDb } from "@itwin/core-backend";
|
|
5
5
|
import { BeEvent } from "@itwin/core-bentley";
|
|
6
|
-
import { UnitSystemKey } from "@itwin/core-quantity";
|
|
6
|
+
import { FormatsProvider, UnitSystemKey } from "@itwin/core-quantity";
|
|
7
7
|
import { SchemaContext } from "@itwin/ecschema-metadata";
|
|
8
8
|
import { UnitSystemFormat as CommonUnitSystemFormat, ComputeSelectionRequestOptions, Content, ContentDescriptorRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, FormatsMap, HierarchyCompareInfo, HierarchyCompareOptions, HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions, InstanceKey, Item, KeySet, LabelDefinition, MultiElementPropertiesRequestOptions, Node, NodeKey, NodePathElement, Paged, PagedResponse, Prioritized, Ruleset, RulesetVariable, SelectClassInfo, SelectionScope, SelectionScopeRequestOptions, SingleElementPropertiesRequestOptions, WithCancelEvent } from "@itwin/presentation-common";
|
|
9
|
+
import { _presentation_manager_detail } from "./InternalSymbols.js";
|
|
9
10
|
import { PresentationManagerDetail } from "./PresentationManagerDetail.js";
|
|
10
11
|
import { RulesetManager } from "./RulesetManager.js";
|
|
11
12
|
import { RulesetVariablesManager } from "./RulesetVariablesManager.js";
|
|
12
13
|
import { BackendDiagnosticsAttribute, BackendDiagnosticsOptions } from "./Utils.js";
|
|
13
|
-
import { _presentation_manager_detail } from "./InternalSymbols.js";
|
|
14
14
|
/**
|
|
15
15
|
* Presentation hierarchy cache mode.
|
|
16
16
|
* @public
|
|
@@ -134,7 +134,7 @@ export interface PresentationManagerCachingConfig {
|
|
|
134
134
|
* assigning default unit formats for specific phenomenons (see [[PresentationManagerProps.defaultFormats]]).
|
|
135
135
|
*
|
|
136
136
|
* @public
|
|
137
|
-
* @deprecated in 4.3. The type has been moved to `@itwin/presentation-common` package.
|
|
137
|
+
* @deprecated in 4.3 - will not be removed until after 2026-06-13. The type has been moved to `@itwin/presentation-common` package.
|
|
138
138
|
*/
|
|
139
139
|
export type UnitSystemFormat = CommonUnitSystemFormat;
|
|
140
140
|
/**
|
|
@@ -177,7 +177,7 @@ export interface PresentationManagerProps {
|
|
|
177
177
|
*
|
|
178
178
|
* which means the assets can be found through a relative path `./assets/` from the `{source file being executed}`.
|
|
179
179
|
*
|
|
180
|
-
* @deprecated in 4.2. This attribute is not used anymore - the package is not using private assets anymore.
|
|
180
|
+
* @deprecated in 4.2 - will not be removed until after 2026-06-13. This attribute is not used anymore - the package is not using private assets anymore.
|
|
181
181
|
*/
|
|
182
182
|
presentationAssetsRoot?: string | PresentationAssetsRootConfig;
|
|
183
183
|
/**
|
|
@@ -204,8 +204,15 @@ export interface PresentationManagerProps {
|
|
|
204
204
|
/**
|
|
205
205
|
* A map of default unit formats to use for formatting properties that don't have a presentation format
|
|
206
206
|
* in requested unit system.
|
|
207
|
+
*
|
|
208
|
+
* @deprecated in 5.1. Use `formatsProvider` instead. Still used as a fallback if `formatsProvider` is not supplied.
|
|
207
209
|
*/
|
|
208
210
|
defaultFormats?: FormatsMap;
|
|
211
|
+
/**
|
|
212
|
+
* A custom formats provider to use for formatting property values with units. Defaults to [SchemaFormatsProvider]($ecschema-metadata) if
|
|
213
|
+
* not supplied.
|
|
214
|
+
*/
|
|
215
|
+
formatsProvider?: FormatsProvider;
|
|
209
216
|
/**
|
|
210
217
|
* A number of worker threads to use for handling presentation requests. Defaults to `2`.
|
|
211
218
|
*/
|
|
@@ -215,7 +222,7 @@ export interface PresentationManagerProps {
|
|
|
215
222
|
* data changes are not tracked at all.
|
|
216
223
|
*
|
|
217
224
|
* @beta
|
|
218
|
-
* @deprecated in 4.4. The manager now always tracks for iModel data changes without polling.
|
|
225
|
+
* @deprecated in 4.4 - will not be removed until after 2026-06-13. The manager now always tracks for iModel data changes without polling.
|
|
219
226
|
*/
|
|
220
227
|
updatesPollInterval?: number;
|
|
221
228
|
/** Options for caching. */
|
|
@@ -237,6 +244,8 @@ export interface PresentationManagerProps {
|
|
|
237
244
|
/**
|
|
238
245
|
* Callback that provides [SchemaContext]($ecschema-metadata) for supplied [IModelDb]($core-backend).
|
|
239
246
|
* [SchemaContext]($ecschema-metadata) is used for getting metadata required for values formatting.
|
|
247
|
+
*
|
|
248
|
+
* @deprecated in 5.1. [IModelDb.schemaContext]($core-backend) is now used by default instead.
|
|
240
249
|
*/
|
|
241
250
|
schemaContextProvider?: (imodel: IModelDb) => SchemaContext;
|
|
242
251
|
/**
|
|
@@ -257,6 +266,7 @@ export declare class PresentationManager {
|
|
|
257
266
|
private _props;
|
|
258
267
|
private _detail;
|
|
259
268
|
private _localizationHelper;
|
|
269
|
+
private _schemaContextProvider;
|
|
260
270
|
/**
|
|
261
271
|
* Creates an instance of PresentationManager.
|
|
262
272
|
* @param props Optional configuration properties.
|
|
@@ -267,7 +277,7 @@ export declare class PresentationManager {
|
|
|
267
277
|
set activeUnitSystem(value: UnitSystemKey | undefined);
|
|
268
278
|
/** Dispose the presentation manager. Must be called to clean up native resources. */
|
|
269
279
|
[Symbol.dispose](): void;
|
|
270
|
-
/** @deprecated in 5.0 Use [Symbol.dispose] instead. */
|
|
280
|
+
/** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */
|
|
271
281
|
dispose(): void;
|
|
272
282
|
/** An event, that this manager raises whenever any request is made on it. */
|
|
273
283
|
get onUsed(): BeEvent<() => void>;
|
|
@@ -326,6 +336,7 @@ export declare class PresentationManager {
|
|
|
326
336
|
* @public
|
|
327
337
|
*/
|
|
328
338
|
getContentSetSize(requestOptions: WithCancelEvent<Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<number>;
|
|
339
|
+
private createContentFormatter;
|
|
329
340
|
/**
|
|
330
341
|
* Retrieves the content set based on the supplied content descriptor.
|
|
331
342
|
* @public
|
|
@@ -369,13 +380,13 @@ export declare class PresentationManager {
|
|
|
369
380
|
/**
|
|
370
381
|
* Retrieves available selection scopes.
|
|
371
382
|
* @public
|
|
372
|
-
* @deprecated in 5.0. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.
|
|
383
|
+
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.
|
|
373
384
|
*/
|
|
374
385
|
getSelectionScopes(_requestOptions: SelectionScopeRequestOptions<IModelDb> & BackendDiagnosticsAttribute): Promise<SelectionScope[]>;
|
|
375
386
|
/**
|
|
376
387
|
* Computes selection based on provided element IDs and selection scope.
|
|
377
388
|
* @public
|
|
378
|
-
* @deprecated in 5.0. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.
|
|
389
|
+
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.
|
|
379
390
|
*/
|
|
380
391
|
computeSelection(requestOptions: ComputeSelectionRequestOptions<IModelDb> & BackendDiagnosticsAttribute): Promise<KeySet>;
|
|
381
392
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAa,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAa,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAyB,MAAM,0BAA0B,CAAC;AAChF,OAAO,EACL,gBAAgB,IAAI,sBAAsB,EAC1C,8BAA8B,EAC9B,OAAO,EACP,+BAA+B,EAE/B,qBAAqB,EACrB,4BAA4B,EAE5B,UAAU,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,2BAA2B,EAC3B,iBAAiB,EACjB,4BAA4B,EAC5B,iBAAiB,EACjB,4CAA4C,EAC5C,mCAAmC,EACnC,UAAU,EACV,oBAAoB,EACpB,uBAAuB,EAEvB,sCAAsC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AAC,8BAA8B,CAAC,cAAc,CAAC,CAAC;YAa5C,0BAA0B;YAqB1B,4BAA4B;IA4E1C;;;OAGG;IACU,yBAAyB,CACpC,cAAc,EAAE,eAAe,CAAC,WAAW,CAAC,0BAA0B,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,2BAA2B,GAC5H,OAAO,CAAC,eAAe,CAAC;IAK3B;;;OAGG;IACU,0BAA0B,CACrC,cAAc,EAAE,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,2BAA2B,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,2BAA2B,GACpI,OAAO,CAAC,eAAe,EAAE,CAAC;IAK7B;;;;OAIG;IAEU,kBAAkB,CAAC,eAAe,EAAE,4BAA4B,CAAC,QAAQ,CAAC,GAAG,2BAA2B,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAIjJ;;;;OAIG;IAEU,gBAAgB,CAAC,cAAc,EAAE,8BAA8B,CAAC,QAAQ,CAAC,GAAG,2BAA2B,GAAG,OAAO,CAAC,MAAM,CAAC;IAItI;;;OAGG;IACU,kBAAkB,CAAC,cAAc,EAAE,uBAAuB,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC;CA4B3H"}
|
|
@@ -10,15 +10,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.PresentationManager = exports.HierarchyCacheMode = void 0;
|
|
11
11
|
const rxjs_1 = require("rxjs");
|
|
12
12
|
const rxjs_for_await_1 = require("rxjs-for-await");
|
|
13
|
+
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
13
14
|
const presentation_common_1 = require("@itwin/presentation-common");
|
|
14
15
|
const internal_1 = require("@itwin/presentation-common/internal");
|
|
15
16
|
const ElementPropertiesHelper_js_1 = require("./ElementPropertiesHelper.js");
|
|
17
|
+
const InternalSymbols_js_1 = require("./InternalSymbols.js");
|
|
16
18
|
const NativePlatform_js_1 = require("./NativePlatform.js");
|
|
17
19
|
const PresentationManagerDetail_js_1 = require("./PresentationManagerDetail.js");
|
|
18
20
|
const RulesetVariablesManager_js_1 = require("./RulesetVariablesManager.js");
|
|
19
21
|
const SelectionScopesHelper_js_1 = require("./SelectionScopesHelper.js");
|
|
20
22
|
const Utils_js_1 = require("./Utils.js");
|
|
21
|
-
const InternalSymbols_js_1 = require("./InternalSymbols.js");
|
|
22
23
|
/**
|
|
23
24
|
* Presentation hierarchy cache mode.
|
|
24
25
|
* @public
|
|
@@ -52,6 +53,7 @@ class PresentationManager {
|
|
|
52
53
|
_props;
|
|
53
54
|
_detail;
|
|
54
55
|
_localizationHelper;
|
|
56
|
+
_schemaContextProvider;
|
|
55
57
|
/**
|
|
56
58
|
* Creates an instance of PresentationManager.
|
|
57
59
|
* @param props Optional configuration properties.
|
|
@@ -60,6 +62,8 @@ class PresentationManager {
|
|
|
60
62
|
this._props = props ?? {};
|
|
61
63
|
this._detail = new PresentationManagerDetail_js_1.PresentationManagerDetail(this._props);
|
|
62
64
|
this._localizationHelper = new internal_1.LocalizationHelper({ getLocalizedString: props?.getLocalizedString ?? Utils_js_1.getLocalizedStringEN });
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
66
|
+
this._schemaContextProvider = props?.schemaContextProvider ?? ((imodel) => imodel.schemaContext);
|
|
63
67
|
}
|
|
64
68
|
/** Get / set active unit system used to format property values with units */
|
|
65
69
|
get activeUnitSystem() {
|
|
@@ -73,7 +77,7 @@ class PresentationManager {
|
|
|
73
77
|
[Symbol.dispose]() {
|
|
74
78
|
this._detail[Symbol.dispose]();
|
|
75
79
|
}
|
|
76
|
-
/** @deprecated in 5.0 Use [Symbol.dispose] instead. */
|
|
80
|
+
/** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */
|
|
77
81
|
/* c8 ignore next 3 */
|
|
78
82
|
dispose() {
|
|
79
83
|
this[Symbol.dispose]();
|
|
@@ -172,18 +176,27 @@ class PresentationManager {
|
|
|
172
176
|
async getContentSetSize(requestOptions) {
|
|
173
177
|
return this._detail.getContentSetSize(requestOptions);
|
|
174
178
|
}
|
|
179
|
+
createContentFormatter({ imodel, unitSystem }) {
|
|
180
|
+
if (!unitSystem) {
|
|
181
|
+
unitSystem = this.props.defaultUnitSystem ?? "metric";
|
|
182
|
+
}
|
|
183
|
+
const schemaContext = this._schemaContextProvider(imodel);
|
|
184
|
+
const koqPropertyFormatter = new presentation_common_1.KoqPropertyValueFormatter({
|
|
185
|
+
schemaContext,
|
|
186
|
+
formatsProvider: this.props.formatsProvider ?? new ecschema_metadata_1.SchemaFormatsProvider(schemaContext, unitSystem),
|
|
187
|
+
});
|
|
188
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
189
|
+
koqPropertyFormatter.defaultFormats = this.props.defaultFormats;
|
|
190
|
+
return new internal_1.ContentFormatter(new internal_1.ContentPropertyValueFormatter(koqPropertyFormatter), unitSystem);
|
|
191
|
+
}
|
|
175
192
|
/**
|
|
176
193
|
* Retrieves the content set based on the supplied content descriptor.
|
|
177
194
|
* @public
|
|
178
195
|
*/
|
|
179
196
|
async getContentSet(requestOptions) {
|
|
180
|
-
let items = await this._detail.getContentSet(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
});
|
|
184
|
-
if (!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined) {
|
|
185
|
-
const koqPropertyFormatter = new presentation_common_1.KoqPropertyValueFormatter(this.props.schemaContextProvider(requestOptions.imodel), this.props.defaultFormats);
|
|
186
|
-
const formatter = new internal_1.ContentFormatter(new internal_1.ContentPropertyValueFormatter(koqPropertyFormatter), requestOptions.unitSystem ?? this.props.defaultUnitSystem);
|
|
197
|
+
let items = await this._detail.getContentSet(requestOptions);
|
|
198
|
+
if (!requestOptions.omitFormattedValues) {
|
|
199
|
+
const formatter = this.createContentFormatter(requestOptions);
|
|
187
200
|
items = await formatter.formatContentItems(items, requestOptions.descriptor);
|
|
188
201
|
}
|
|
189
202
|
return this._localizationHelper.getLocalizedContentItems(items);
|
|
@@ -193,16 +206,12 @@ class PresentationManager {
|
|
|
193
206
|
* @public
|
|
194
207
|
*/
|
|
195
208
|
async getContent(requestOptions) {
|
|
196
|
-
const content = await this._detail.getContent(
|
|
197
|
-
...requestOptions,
|
|
198
|
-
...(!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),
|
|
199
|
-
});
|
|
209
|
+
const content = await this._detail.getContent(requestOptions);
|
|
200
210
|
if (!content) {
|
|
201
211
|
return undefined;
|
|
202
212
|
}
|
|
203
|
-
if (!requestOptions.omitFormattedValues
|
|
204
|
-
const
|
|
205
|
-
const formatter = new internal_1.ContentFormatter(new internal_1.ContentPropertyValueFormatter(koqPropertyFormatter), requestOptions.unitSystem ?? this.props.defaultUnitSystem);
|
|
213
|
+
if (!requestOptions.omitFormattedValues) {
|
|
214
|
+
const formatter = this.createContentFormatter(requestOptions);
|
|
206
215
|
await formatter.formatContent(content);
|
|
207
216
|
}
|
|
208
217
|
return this._localizationHelper.getLocalizedContent(content);
|
|
@@ -308,7 +317,7 @@ class PresentationManager {
|
|
|
308
317
|
/**
|
|
309
318
|
* Retrieves available selection scopes.
|
|
310
319
|
* @public
|
|
311
|
-
* @deprecated in 5.0. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.
|
|
320
|
+
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.
|
|
312
321
|
*/
|
|
313
322
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
314
323
|
async getSelectionScopes(_requestOptions) {
|
|
@@ -317,7 +326,7 @@ class PresentationManager {
|
|
|
317
326
|
/**
|
|
318
327
|
* Computes selection based on provided element IDs and selection scope.
|
|
319
328
|
* @public
|
|
320
|
-
* @deprecated in 5.0. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.
|
|
329
|
+
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.
|
|
321
330
|
*/
|
|
322
331
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
323
332
|
async computeSelection(requestOptions) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAAsC;AACtC,mDAA+C;AAK/C,oEA6CoC;AACpC,kEAO6C;AAC7C,6EAAgI;AAChI,2DAAiE;AACjE,iFAA+F;AAE/F,6EAAoG;AACpG,yEAAmE;AACnE,yCAA0G;AAC1G,6DAAoE;AAEpE;;;GAGG;AACH,IAAY,kBAiBX;AAjBD,WAAY,kBAAkB;IAC5B;;OAEG;IACH,uCAAiB,CAAA;IACjB;;;OAGG;IACH,mCAAa,CAAA;IACb;;;;;OAKG;IACH,uCAAiB,CAAA;AACnB,CAAC,EAjBW,kBAAkB,kCAAlB,kBAAkB,QAiB7B;AAmPD;;;;;GAKG;AACH,MAAa,mBAAmB;IACtB,MAAM,CAA2B;IACjC,OAAO,CAA4B;IACnC,mBAAmB,CAAqB;IAEhD;;;OAGG;IACH,YAAY,KAAgC;QAC1C,IAAI,CAAC,MAAM,GAAG,KAAK,IAAI,EAAE,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,wDAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1D,IAAI,CAAC,mBAAmB,GAAG,IAAI,6BAAkB,CAAC,EAAE,kBAAkB,EAAE,KAAK,EAAE,kBAAkB,IAAI,+BAAoB,EAAE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QAC3E,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAE1C,MAAM,aAAa,GAAG,IAAA,iDAAkB,EAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACrE,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAA,iDAAkB,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;QAC9F,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,KAAK,aAAa,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;YACtD,MAAM,IAAI,uCAAiB,CAAC,wCAAkB,CAAC,eAAe,EAAE,2CAA2C,CAAC,CAAC;QAC/G,CAAC;QAED,MAAM,oBAAoB,GAAG,gBAAgB,IAAI,EAAE,CAAC;QACpD,MAAM,oBAAoB,GAAG,IAAI,CAAC,gBAAgB,IAAI,oBAAoB,CAAC;QAE3E,MAAM,MAAM,GAAG;YACb,SAAS,EAAE,8CAA0B,CAAC,kBAAkB;YACxD,GAAG,OAAO;YACV,aAAa,EAAE,aAAa,CAAC,QAAQ;YACrC,aAAa,EAAE,aAAa,CAAC,QAAQ;YACrC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC;YAC1D,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC;YAC1D,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC;SACjE,CAAC;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACxD,CAAC;CACF;AA5aD,kDA4aC","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 { firstValueFrom } from \"rxjs\";\nimport { eachValueFrom } from \"rxjs-for-await\";\nimport { IModelDb } from \"@itwin/core-backend\";\nimport { BeEvent, Id64Array } from \"@itwin/core-bentley\";\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\nimport { SchemaContext } from \"@itwin/ecschema-metadata\";\nimport {\n UnitSystemFormat as CommonUnitSystemFormat,\n ComputeSelectionRequestOptions,\n Content,\n ContentDescriptorRequestOptions,\n ContentFlags,\n ContentRequestOptions,\n ContentSourcesRequestOptions,\n DefaultContentDisplayTypes,\n Descriptor,\n DescriptorOverrides,\n DisplayLabelRequestOptions,\n DisplayLabelsRequestOptions,\n DisplayValueGroup,\n DistinctValuesRequestOptions,\n ElementProperties,\n FilterByInstancePathsHierarchyRequestOptions,\n FilterByTextHierarchyRequestOptions,\n FormatsMap,\n HierarchyCompareInfo,\n HierarchyCompareOptions,\n HierarchyLevel,\n HierarchyLevelDescriptorRequestOptions,\n HierarchyRequestOptions,\n InstanceKey,\n Item,\n KeySet,\n KoqPropertyValueFormatter,\n LabelDefinition,\n MultiElementPropertiesRequestOptions,\n Node,\n NodeKey,\n NodePathElement,\n Paged,\n PagedResponse,\n PresentationError,\n PresentationStatus,\n Prioritized,\n Ruleset,\n RulesetVariable,\n SelectClassInfo,\n SelectionScope,\n SelectionScopeRequestOptions,\n SingleElementPropertiesRequestOptions,\n WithCancelEvent,\n} from \"@itwin/presentation-common\";\nimport {\n buildElementProperties,\n ContentFormatter,\n ContentPropertyValueFormatter,\n deepReplaceNullsToUndefined,\n isSingleElementPropertiesRequestOptions,\n LocalizationHelper,\n} from \"@itwin/presentation-common/internal\";\nimport { getContentItemsObservableFromClassNames, getContentItemsObservableFromElementIds } from \"./ElementPropertiesHelper.js\";\nimport { NativePlatformRequestTypes } from \"./NativePlatform.js\";\nimport { getRulesetIdObject, PresentationManagerDetail } from \"./PresentationManagerDetail.js\";\nimport { RulesetManager } from \"./RulesetManager.js\";\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager.js\";\nimport { SelectionScopesHelper } from \"./SelectionScopesHelper.js\";\nimport { BackendDiagnosticsAttribute, BackendDiagnosticsOptions, getLocalizedStringEN } from \"./Utils.js\";\nimport { _presentation_manager_detail } from \"./InternalSymbols.js\";\n\n/**\n * Presentation hierarchy cache mode.\n * @public\n */\nexport enum HierarchyCacheMode {\n /**\n * Hierarchy cache is created in memory.\n */\n Memory = \"memory\",\n /**\n * Hierarchy cache is created on disk. In this mode hierarchy cache is persisted between iModel\n * openings.\n */\n Disk = \"disk\",\n /**\n * Hierarchy cache is created on disk. In this mode everything is cached in memory while creating hierarchy level\n * and persisted in disk cache when whole hierarchy level is created.\n *\n * **Note:** This mode is still experimental.\n */\n Hybrid = \"hybrid\",\n}\n\n/**\n * Configuration for hierarchy cache.\n * @public\n */\nexport type HierarchyCacheConfig = MemoryHierarchyCacheConfig | DiskHierarchyCacheConfig | HybridCacheConfig;\n\n/**\n * Base interface for all [[HierarchyCacheConfig]] implementations.\n * @public\n */\nexport interface HierarchyCacheConfigBase {\n mode: HierarchyCacheMode;\n}\n\n/**\n * Configuration for in-memory hierarchy cache.\n *\n * @see [Memory cache documentation page]($docs/presentation/advanced/Caching.md#memory-cache)\n * @public\n */\nexport interface MemoryHierarchyCacheConfig extends HierarchyCacheConfigBase {\n mode: HierarchyCacheMode.Memory;\n}\n\n/**\n * Configuration for persistent disk hierarchy cache.\n *\n * @see [Disk cache documentation page]($docs/presentation/advanced/Caching.md#disk-cache)\n * @public\n */\nexport interface DiskHierarchyCacheConfig extends HierarchyCacheConfigBase {\n mode: HierarchyCacheMode.Disk;\n\n /**\n * A directory for hierarchy caches. If set, the directory must exist. Relative paths start from `process.cwd()`.\n *\n * The default directory depends on the iModel and the way it's opened.\n */\n directory?: string;\n\n /**\n * While the cache itself is stored on a disk, there's still a required small in-memory cache.\n * The parameter allows controlling size of that cache. Defaults to `32768000` bytes (32 MB).\n */\n memoryCacheSize?: number;\n}\n\n/**\n * Configuration for the experimental hybrid hierarchy cache.\n *\n * Hybrid cache uses a combination of in-memory and disk caches, which should make it a better\n * alternative for cases when there are lots of simultaneous requests.\n *\n * @see [Hybrid cache documentation page]($docs/presentation/advanced/Caching.md#hybrid-cache)\n * @public\n */\nexport interface HybridCacheConfig extends HierarchyCacheConfigBase {\n mode: HierarchyCacheMode.Hybrid;\n\n /** Configuration for disk cache used to persist hierarchies. */\n disk?: DiskHierarchyCacheConfig;\n}\n\n/**\n * Configuration for content cache.\n *\n * @see [Content cache documentation page]($docs/presentation/advanced/Caching.md#content-cache)\n * @public\n */\nexport interface ContentCacheConfig {\n /**\n * Maximum number of content descriptors cached in memory for quicker paged content requests.\n *\n * Defaults to `100`.\n */\n size?: number;\n}\n\n/**\n * Caching configuration options for [[PresentationManager]].\n * @public\n */\nexport interface PresentationManagerCachingConfig {\n /**\n * Hierarchies-related caching options.\n *\n * @see [Hierarchies cache documentation page]($docs/presentation/advanced/Caching.md#hierarchies-cache)\n */\n hierarchies?: HierarchyCacheConfig;\n\n /**\n * Content-related caching options.\n *\n * @see [Content cache documentation page]($docs/presentation/advanced/Caching.md#content-cache)\n */\n content?: ContentCacheConfig;\n\n /**\n * Each worker thread (see [[workerThreadsCount]]) opens a connection to an iModel used for a request. This\n * means there could be `{workerThreadsCount} * {iModels count}` number of connections. Each connection\n * uses a memory cache to increase iModel read performance. This parameter allows controlling the size of that\n * cache. Defaults to `32768000` bytes (32 MB).\n *\n * @see [Worker connections cache documentation page]($docs/presentation/advanced/Caching.md#worker-connections-cache)\n */\n workerConnectionCacheSize?: number;\n}\n\n/**\n * A data structure that associates unit systems with a format. The associations are used for\n * assigning default unit formats for specific phenomenons (see [[PresentationManagerProps.defaultFormats]]).\n *\n * @public\n * @deprecated in 4.3. The type has been moved to `@itwin/presentation-common` package.\n */\nexport type UnitSystemFormat = CommonUnitSystemFormat;\n\n/**\n * Data structure for multiple element properties request response.\n * @public\n */\nexport interface MultiElementPropertiesResponse<TParsedContent = ElementProperties> {\n total: number;\n iterator: () => AsyncGenerator<TParsedContent[]>;\n}\n\n/**\n * Configuration options for supplying asset paths to [[PresentationManager]].\n * @public\n */\nexport interface PresentationAssetsRootConfig {\n /**\n * Path to `presentation-backend` assets. Relative paths start from `process.cwd()`.\n */\n backend: string;\n}\n\n/**\n * Properties that can be used to configure [[PresentationManager]]\n * @public\n */\nexport interface PresentationManagerProps {\n /**\n * Path overrides for presentation backend assets. Need to be overriden by application if it puts these assets someplace else than the default.\n *\n * By default the path to assets directory is determined during the call of [[Presentation.initialize]] using this algorithm:\n *\n * - if path of `.js` file that contains [[PresentationManager]] definition contains \"presentation-backend\", assume the package is in `node_modules` and the directory structure is:\n * - `assets/*\\*\\/*`\n * - `presentation-backend/{presentation-backend source files}`\n *\n * which means the assets can be found through a relative path `../assets/` from the JS file being executed.\n *\n * - else, assume the backend is webpacked into a single file with assets next to it:\n * - `assets/*\\*\\/*`\n * - `{source file being executed}.js`\n *\n * which means the assets can be found through a relative path `./assets/` from the `{source file being executed}`.\n *\n * @deprecated in 4.2. This attribute is not used anymore - the package is not using private assets anymore.\n */\n presentationAssetsRoot?: string | PresentationAssetsRootConfig;\n\n /**\n * A list of directories containing application's presentation rulesets. Relative\n * paths start from `process.cwd()`. The directories are traversed recursively.\n *\n * @note Only files with `.PresentationRuleSet.json` are read.\n */\n rulesetDirectories?: string[];\n\n /**\n * A list of directories containing application's supplemental presentation rulesets. Relative\n * paths start from `process.cwd()`. The directories are traversed recursively.\n *\n * @note Only files with `.PresentationRuleSet.json` are read.\n */\n supplementalRulesetDirectories?: string[];\n\n /**\n * Sets the active unit system to use for formatting property values with\n * units. Default presentation units are used if this is not specified. The active unit\n * system can later be changed through [[PresentationManager.activeUnitSystem]] or overriden for each request\n * through request options.\n */\n defaultUnitSystem?: UnitSystemKey;\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 defaultFormats?: FormatsMap;\n\n /**\n * A number of worker threads to use for handling presentation requests. Defaults to `2`.\n */\n workerThreadsCount?: number;\n\n /**\n * The interval (in milliseconds) used to poll for presentation data changes. If not set, presentation\n * data changes are not tracked at all.\n *\n * @beta\n * @deprecated in 4.4. The manager now always tracks for iModel data changes without polling.\n */\n updatesPollInterval?: number;\n\n /** Options for caching. */\n caching?: PresentationManagerCachingConfig;\n\n /**\n * Use [SQLite's Memory-Mapped I/O](https://sqlite.org/mmap.html) for worker connections. This mode improves performance of handling\n * requests with high I/O intensity, e.g. filtering large tables on non-indexed columns. No downsides have been noticed.\n *\n * Set to a falsy value to turn off. `true` for memory-mapping the whole iModel. Number value for memory-mapping the specified amount of bytes.\n */\n useMmap?: boolean | number;\n\n /**\n * Localization function to localize data returned by presentation manager when it's used directly on the backend (as opposed to when used through RPC, where\n * data is localized on the frontend). Defaults to English localization.\n *\n * @see [Localization]($docs/presentation/advanced/Localization)\n */\n getLocalizedString?: (key: string) => string;\n\n /**\n * Callback that provides [SchemaContext]($ecschema-metadata) for supplied [IModelDb]($core-backend).\n * [SchemaContext]($ecschema-metadata) is used for getting metadata required for values formatting.\n */\n schemaContextProvider?: (imodel: IModelDb) => SchemaContext;\n\n /**\n * Parameters for gathering diagnostics at the manager level. When supplied, they're used with every request\n * made through the manager.\n *\n * @see [Diagnostics documentation page]($docs/presentation/advanced/Diagnostics.md)\n */\n diagnostics?: BackendDiagnosticsOptions;\n}\n\n/**\n * Backend Presentation manager which pulls the presentation data from\n * an iModel using native platform.\n *\n * @public\n */\nexport class PresentationManager {\n private _props: PresentationManagerProps;\n private _detail: PresentationManagerDetail;\n private _localizationHelper: LocalizationHelper;\n\n /**\n * Creates an instance of PresentationManager.\n * @param props Optional configuration properties.\n */\n constructor(props?: PresentationManagerProps) {\n this._props = props ?? {};\n this._detail = new PresentationManagerDetail(this._props);\n this._localizationHelper = new LocalizationHelper({ getLocalizedString: props?.getLocalizedString ?? getLocalizedStringEN });\n }\n\n /** Get / set active unit system used to format property values with units */\n public get activeUnitSystem(): UnitSystemKey | undefined {\n return this._detail.activeUnitSystem;\n }\n /* c8 ignore next 3 */\n public set activeUnitSystem(value: UnitSystemKey | undefined) {\n this._detail.activeUnitSystem = value;\n }\n\n /** Dispose the presentation manager. Must be called to clean up native resources. */\n public [Symbol.dispose]() {\n this._detail[Symbol.dispose]();\n }\n\n /** @deprecated in 5.0 Use [Symbol.dispose] instead. */\n /* c8 ignore next 3 */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n /** An event, that this manager raises whenever any request is made on it. */\n public get onUsed(): BeEvent<() => void> {\n return this._detail.onUsed;\n }\n\n /** Properties used to initialize the manager */\n public get props() {\n return this._props;\n }\n\n /** Get rulesets manager */\n public rulesets(): RulesetManager {\n return this._detail.rulesets;\n }\n\n /**\n * Get ruleset variables manager for specific ruleset\n * @param rulesetId Id of the ruleset to get variables manager for\n */\n public vars(rulesetId: string): RulesetVariablesManager {\n return new RulesetVariablesManagerImpl(() => this._detail.getNativePlatform(), rulesetId);\n }\n\n /** @internal */\n /* c8 ignore next 3 */\n public get [_presentation_manager_detail](): PresentationManagerDetail {\n return this._detail;\n }\n\n public getRulesetId(rulesetOrId: Ruleset | string) {\n return this._detail.getRulesetId(rulesetOrId);\n }\n\n /**\n * Retrieves nodes\n * @public\n */\n public async getNodes(\n requestOptions: WithCancelEvent<Prioritized<Paged<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>>> & BackendDiagnosticsAttribute,\n ): Promise<Node[]> {\n const serializedHierarchyLevel = await this._detail.getNodes(requestOptions);\n const hierarchyLevel: HierarchyLevel = deepReplaceNullsToUndefined(JSON.parse(serializedHierarchyLevel));\n return this._localizationHelper.getLocalizedNodes(hierarchyLevel.nodes);\n }\n\n /**\n * Retrieves nodes count\n * @public\n */\n public async getNodesCount(\n requestOptions: WithCancelEvent<Prioritized<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute,\n ): Promise<number> {\n return this._detail.getNodesCount(requestOptions);\n }\n\n /**\n * Retrieves hierarchy level descriptor\n * @public\n */\n public async getNodesDescriptor(\n requestOptions: WithCancelEvent<Prioritized<HierarchyLevelDescriptorRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute,\n ): Promise<Descriptor | undefined> {\n const response = await this._detail.getNodesDescriptor(requestOptions);\n const descriptor = Descriptor.fromJSON(JSON.parse(response));\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\n }\n\n /**\n * Retrieves paths from root nodes to children nodes according to specified instance key paths. Intersecting paths will be merged.\n * TODO: Return results in pages\n * @public\n */\n public async getNodePaths(\n requestOptions: WithCancelEvent<Prioritized<FilterByInstancePathsHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute,\n ): Promise<NodePathElement[]> {\n const result = await this._detail.getNodePaths(requestOptions);\n return result.map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\n }\n\n /**\n * Retrieves paths from root nodes to nodes containing filter text in their label.\n * TODO: Return results in pages\n * @public\n */\n public async getFilteredNodePaths(\n requestOptions: WithCancelEvent<Prioritized<FilterByTextHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute,\n ): Promise<NodePathElement[]> {\n const result = await this._detail.getFilteredNodePaths(requestOptions);\n return result.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(\n requestOptions: WithCancelEvent<Prioritized<ContentSourcesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute,\n ): Promise<SelectClassInfo[]> {\n return this._detail.getContentSources(requestOptions);\n }\n\n /**\n * Retrieves the content descriptor which can be used to get content\n * @public\n */\n public async getContentDescriptor(\n requestOptions: WithCancelEvent<Prioritized<ContentDescriptorRequestOptions<IModelDb, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute,\n ): Promise<Descriptor | undefined> {\n const response = await this._detail.getContentDescriptor(requestOptions);\n const descriptor = Descriptor.fromJSON(JSON.parse(response));\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\n }\n\n /**\n * Retrieves the content set size based on the supplied content descriptor override\n * @public\n */\n public async getContentSetSize(\n requestOptions: WithCancelEvent<Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> &\n BackendDiagnosticsAttribute,\n ): Promise<number> {\n return this._detail.getContentSetSize(requestOptions);\n }\n\n /**\n * Retrieves the content set based on the supplied content descriptor.\n * @public\n */\n public async getContentSet(\n requestOptions: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor, KeySet, RulesetVariable>>>> & BackendDiagnosticsAttribute,\n ): Promise<Item[]> {\n let items = await this._detail.getContentSet({\n ...requestOptions,\n ...(!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),\n });\n\n if (!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined) {\n const koqPropertyFormatter = new KoqPropertyValueFormatter(this.props.schemaContextProvider(requestOptions.imodel), this.props.defaultFormats);\n const formatter = new ContentFormatter(\n new ContentPropertyValueFormatter(koqPropertyFormatter),\n requestOptions.unitSystem ?? this.props.defaultUnitSystem,\n );\n items = await formatter.formatContentItems(items, requestOptions.descriptor);\n }\n\n return this._localizationHelper.getLocalizedContentItems(items);\n }\n\n /**\n * Retrieves the content based on the supplied content descriptor override.\n * @public\n */\n public async getContent(\n requestOptions: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>>> &\n BackendDiagnosticsAttribute,\n ): Promise<Content | undefined> {\n const content = await this._detail.getContent({\n ...requestOptions,\n ...(!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),\n });\n\n if (!content) {\n return undefined;\n }\n\n if (!requestOptions.omitFormattedValues && this.props.schemaContextProvider !== undefined) {\n const koqPropertyFormatter = new KoqPropertyValueFormatter(this.props.schemaContextProvider(requestOptions.imodel), this.props.defaultFormats);\n const formatter = new ContentFormatter(\n new ContentPropertyValueFormatter(koqPropertyFormatter),\n requestOptions.unitSystem ?? this.props.defaultUnitSystem,\n );\n await formatter.formatContent(content);\n }\n\n return this._localizationHelper.getLocalizedContent(content);\n }\n\n /**\n * Retrieves distinct values of specific field from the content based on the supplied content descriptor override.\n * @param requestOptions Options for the request\n * @return A promise object that returns either distinct values on success or an error string on error.\n * @public\n */\n public async getPagedDistinctValues(\n requestOptions: WithCancelEvent<Prioritized<DistinctValuesRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> &\n BackendDiagnosticsAttribute,\n ): Promise<PagedResponse<DisplayValueGroup>> {\n const result = await this._detail.getPagedDistinctValues(requestOptions);\n return {\n ...result,\n items: result.items.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<TParsedContent = ElementProperties>(\n requestOptions: WithCancelEvent<Prioritized<SingleElementPropertiesRequestOptions<IModelDb, TParsedContent>>> & BackendDiagnosticsAttribute,\n ): Promise<TParsedContent | undefined>;\n /**\n * Retrieves property data in simplified format for multiple elements specified by class or all element.\n * @return An object that contains element count and AsyncGenerator to iterate over properties of those elements in batches of undefined size.\n * @public\n */\n public async getElementProperties<TParsedContent = ElementProperties>(\n requestOptions: WithCancelEvent<Prioritized<MultiElementPropertiesRequestOptions<IModelDb, TParsedContent>>> & BackendDiagnosticsAttribute,\n ): Promise<MultiElementPropertiesResponse<TParsedContent>>;\n public async getElementProperties<TParsedContent = ElementProperties>(\n requestOptions: WithCancelEvent<\n Prioritized<SingleElementPropertiesRequestOptions<IModelDb, TParsedContent> | MultiElementPropertiesRequestOptions<IModelDb, TParsedContent>>\n > &\n BackendDiagnosticsAttribute,\n ): Promise<TParsedContent | undefined | MultiElementPropertiesResponse<TParsedContent>> {\n if (isSingleElementPropertiesRequestOptions(requestOptions)) {\n return this.getSingleElementProperties<TParsedContent>(requestOptions);\n }\n return this.getMultipleElementProperties<TParsedContent>(requestOptions);\n }\n\n private async getSingleElementProperties<TParsedContent>(\n requestOptions: WithCancelEvent<Prioritized<SingleElementPropertiesRequestOptions<IModelDb, TParsedContent>>> & BackendDiagnosticsAttribute,\n ): Promise<TParsedContent | undefined> {\n type TParser = Required<typeof requestOptions>[\"contentParser\"];\n const { elementId, contentParser, ...optionsNoElementId } = requestOptions;\n const parser: TParser = contentParser ?? (buildElementProperties as TParser);\n const content = await this.getContent({\n ...optionsNoElementId,\n descriptor: {\n displayType: DefaultContentDisplayTypes.PropertyPane,\n contentFlags: ContentFlags.ShowLabels,\n },\n rulesetOrId: \"ElementProperties\",\n keys: new KeySet([{ className: \"BisCore:Element\", id: elementId }]),\n });\n if (!content || content.contentSet.length === 0) {\n return undefined;\n }\n return parser(content.descriptor, content.contentSet[0]);\n }\n\n private async getMultipleElementProperties<TParsedContent>(\n requestOptions: WithCancelEvent<Prioritized<MultiElementPropertiesRequestOptions<IModelDb, TParsedContent>>> & BackendDiagnosticsAttribute,\n ): Promise<MultiElementPropertiesResponse<TParsedContent>> {\n type TParser = Required<typeof requestOptions>[\"contentParser\"];\n const { contentParser, batchSize: batchSizeOption, ...contentOptions } = requestOptions;\n\n const parser: TParser = contentParser ?? (buildElementProperties as TParser);\n const workerThreadsCount = this._props.workerThreadsCount ?? 2;\n\n // We don't want to request content for all classes at once - each class results in a huge content descriptor object that's cached in memory\n // and can be shared across all batch requests for that class. Handling multiple classes at the same time not only increases memory footprint,\n // but also may push descriptors out of cache, requiring us to recreate them, thus making performance worse. For those reasons we handle at\n // most `workerThreadsCount / 2` classes in parallel.\n /* c8 ignore next */\n const classParallelism = workerThreadsCount > 1 ? Math.ceil(workerThreadsCount / 2) : 1;\n\n // We want all worker threads to be constantly busy. However, there's some fairly expensive work being done after the worker thread is done,\n // but before we receive the response. That means the worker thread would be starving if we sent only `workerThreadsCount` requests in parallel.\n // To avoid that, we keep twice as much requests active.\n /* c8 ignore next */\n const batchesParallelism = workerThreadsCount > 0 ? workerThreadsCount : 1;\n\n /* c8 ignore next */\n const batchSize = batchSizeOption ?? 100;\n\n const elementsIdentifier = ((): { elementIds: Id64Array } | { elementClasses: string[] } => {\n if (\"elementIds\" in contentOptions && contentOptions.elementIds !== undefined) {\n const elementIds = contentOptions.elementIds;\n delete contentOptions.elementIds;\n return { elementIds };\n }\n if (\"elementClasses\" in contentOptions && contentOptions.elementClasses !== undefined) {\n const elementClasses = contentOptions.elementClasses;\n delete contentOptions.elementClasses;\n return { elementClasses };\n }\n /* c8 ignore next */\n return { elementClasses: [\"BisCore:Element\"] };\n })();\n\n const descriptorGetter = async (partialProps: Pick<ContentDescriptorRequestOptions<IModelDb, KeySet, RulesetVariable>, \"rulesetOrId\" | \"keys\">) =>\n this.getContentDescriptor({ ...contentOptions, displayType: DefaultContentDisplayTypes.Grid, contentFlags: ContentFlags.ShowLabels, ...partialProps });\n const contentSetGetter = async (\n partialProps: Pick<ContentRequestOptions<IModelDb, Descriptor, KeySet, RulesetVariable>, \"rulesetOrId\" | \"keys\" | \"descriptor\">,\n ) => this.getContentSet({ ...contentOptions, ...partialProps });\n const { itemBatches, count } =\n \"elementIds\" in elementsIdentifier\n ? getContentItemsObservableFromElementIds(\n requestOptions.imodel,\n descriptorGetter,\n contentSetGetter,\n elementsIdentifier.elementIds,\n classParallelism,\n batchesParallelism,\n batchSize,\n )\n : getContentItemsObservableFromClassNames(\n requestOptions.imodel,\n descriptorGetter,\n contentSetGetter,\n elementsIdentifier.elementClasses,\n classParallelism,\n batchesParallelism,\n batchSize,\n );\n return {\n total: await firstValueFrom(count),\n async *iterator() {\n for await (const itemsBatch of eachValueFrom(itemBatches)) {\n const { descriptor, items } = itemsBatch;\n yield items.map((item) => parser(descriptor, item));\n }\n },\n };\n }\n\n /**\n * Retrieves display label definition of specific item\n * @public\n */\n public async getDisplayLabelDefinition(\n requestOptions: WithCancelEvent<Prioritized<DisplayLabelRequestOptions<IModelDb, InstanceKey>>> & BackendDiagnosticsAttribute,\n ): Promise<LabelDefinition> {\n const labelDefinition = await this._detail.getDisplayLabelDefinition(requestOptions);\n return this._localizationHelper.getLocalizedLabelDefinition(labelDefinition);\n }\n\n /**\n * Retrieves display label definitions of specific items\n * @public\n */\n public async getDisplayLabelDefinitions(\n requestOptions: WithCancelEvent<Prioritized<Paged<DisplayLabelsRequestOptions<IModelDb, InstanceKey>>>> & BackendDiagnosticsAttribute,\n ): Promise<LabelDefinition[]> {\n const labelDefinitions = await this._detail.getDisplayLabelDefinitions(requestOptions);\n return this._localizationHelper.getLocalizedLabelDefinitions(labelDefinitions);\n }\n\n /**\n * Retrieves available selection scopes.\n * @public\n * @deprecated in 5.0. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public async getSelectionScopes(_requestOptions: SelectionScopeRequestOptions<IModelDb> & BackendDiagnosticsAttribute): Promise<SelectionScope[]> {\n return SelectionScopesHelper.getSelectionScopes();\n }\n\n /**\n * Computes selection based on provided element IDs and selection scope.\n * @public\n * @deprecated in 5.0. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public async computeSelection(requestOptions: ComputeSelectionRequestOptions<IModelDb> & BackendDiagnosticsAttribute): Promise<KeySet> {\n return SelectionScopesHelper.computeSelection(requestOptions);\n }\n\n /**\n * Compares two hierarchies specified in the request options\n * @public\n */\n public async compareHierarchies(requestOptions: HierarchyCompareOptions<IModelDb, NodeKey>): Promise<HierarchyCompareInfo> {\n if (!requestOptions.prev.rulesetOrId && !requestOptions.prev.rulesetVariables) {\n return { changes: [] };\n }\n\n const { rulesetOrId, prev, rulesetVariables, ...options } = requestOptions;\n this._detail.registerRuleset(rulesetOrId);\n\n const currRulesetId = getRulesetIdObject(requestOptions.rulesetOrId);\n const prevRulesetId = prev.rulesetOrId ? getRulesetIdObject(prev.rulesetOrId) : currRulesetId;\n if (prevRulesetId.parts.id !== currRulesetId.parts.id) {\n throw new PresentationError(PresentationStatus.InvalidArgument, \"Can't compare rulesets with different IDs\");\n }\n\n const currRulesetVariables = rulesetVariables ?? [];\n const prevRulesetVariables = prev.rulesetVariables ?? currRulesetVariables;\n\n const params = {\n requestId: NativePlatformRequestTypes.CompareHierarchies,\n ...options,\n prevRulesetId: prevRulesetId.uniqueId,\n currRulesetId: currRulesetId.uniqueId,\n prevRulesetVariables: JSON.stringify(prevRulesetVariables),\n currRulesetVariables: JSON.stringify(currRulesetVariables),\n expandedNodeKeys: JSON.stringify(options.expandedNodeKeys ?? []),\n };\n return JSON.parse(await this._detail.request(params));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAAsC;AACtC,mDAA+C;AAI/C,gEAAgF;AAChF,oEA6CoC;AACpC,kEAO6C;AAC7C,6EAAgI;AAChI,6DAAoE;AACpE,2DAAiE;AACjE,iFAA+F;AAE/F,6EAAoG;AACpG,yEAAmE;AACnE,yCAA0G;AAE1G;;;GAGG;AACH,IAAY,kBAiBX;AAjBD,WAAY,kBAAkB;IAC5B;;OAEG;IACH,uCAAiB,CAAA;IACjB;;;OAGG;IACH,mCAAa,CAAA;IACb;;;;;OAKG;IACH,uCAAiB,CAAA;AACnB,CAAC,EAjBW,kBAAkB,kCAAlB,kBAAkB,QAiB7B;AA8PD;;;;;GAKG;AACH,MAAa,mBAAmB;IACtB,MAAM,CAA2B;IACjC,OAAO,CAA4B;IACnC,mBAAmB,CAAqB;IACxC,sBAAsB,CAAs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E,gBAAgB,EAAE,GAAG,OAAO,EAAE,GAAG,cAAc,CAAC;QAC3E,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAE1C,MAAM,aAAa,GAAG,IAAA,iDAAkB,EAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACrE,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAA,iDAAkB,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;QAC9F,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,KAAK,aAAa,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;YACtD,MAAM,IAAI,uCAAiB,CAAC,wCAAkB,CAAC,eAAe,EAAE,2CAA2C,CAAC,CAAC;QAC/G,CAAC;QAED,MAAM,oBAAoB,GAAG,gBAAgB,IAAI,EAAE,CAAC;QACpD,MAAM,oBAAoB,GAAG,IAAI,CAAC,gBAAgB,IAAI,oBAAoB,CAAC;QAE3E,MAAM,MAAM,GAAG;YACb,SAAS,EAAE,8CAA0B,CAAC,kBAAkB;YACxD,GAAG,OAAO;YACV,aAAa,EAAE,aAAa,CAAC,QAAQ;YACrC,aAAa,EAAE,aAAa,CAAC,QAAQ;YACrC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC;YAC1D,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC;YAC1D,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC;SACjE,CAAC;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACxD,CAAC;CACF;AA9aD,kDA8aC","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 { firstValueFrom } from \"rxjs\";\r\nimport { eachValueFrom } from \"rxjs-for-await\";\r\nimport { IModelDb } from \"@itwin/core-backend\";\r\nimport { BeEvent, Id64Array } from \"@itwin/core-bentley\";\r\nimport { FormatsProvider, UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport { SchemaContext, SchemaFormatsProvider } from \"@itwin/ecschema-metadata\";\r\nimport {\r\n UnitSystemFormat as CommonUnitSystemFormat,\r\n ComputeSelectionRequestOptions,\r\n Content,\r\n ContentDescriptorRequestOptions,\r\n ContentFlags,\r\n ContentRequestOptions,\r\n ContentSourcesRequestOptions,\r\n DefaultContentDisplayTypes,\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 HierarchyCompareInfo,\r\n HierarchyCompareOptions,\r\n HierarchyLevel,\r\n HierarchyLevelDescriptorRequestOptions,\r\n HierarchyRequestOptions,\r\n InstanceKey,\r\n Item,\r\n KeySet,\r\n KoqPropertyValueFormatter,\r\n LabelDefinition,\r\n MultiElementPropertiesRequestOptions,\r\n Node,\r\n NodeKey,\r\n NodePathElement,\r\n Paged,\r\n PagedResponse,\r\n PresentationError,\r\n PresentationStatus,\r\n Prioritized,\r\n Ruleset,\r\n RulesetVariable,\r\n SelectClassInfo,\r\n SelectionScope,\r\n SelectionScopeRequestOptions,\r\n SingleElementPropertiesRequestOptions,\r\n WithCancelEvent,\r\n} from \"@itwin/presentation-common\";\r\nimport {\r\n buildElementProperties,\r\n ContentFormatter,\r\n ContentPropertyValueFormatter,\r\n deepReplaceNullsToUndefined,\r\n isSingleElementPropertiesRequestOptions,\r\n LocalizationHelper,\r\n} from \"@itwin/presentation-common/internal\";\r\nimport { getContentItemsObservableFromClassNames, getContentItemsObservableFromElementIds } from \"./ElementPropertiesHelper.js\";\r\nimport { _presentation_manager_detail } from \"./InternalSymbols.js\";\r\nimport { NativePlatformRequestTypes } from \"./NativePlatform.js\";\r\nimport { getRulesetIdObject, PresentationManagerDetail } from \"./PresentationManagerDetail.js\";\r\nimport { RulesetManager } from \"./RulesetManager.js\";\r\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager.js\";\r\nimport { SelectionScopesHelper } from \"./SelectionScopesHelper.js\";\r\nimport { BackendDiagnosticsAttribute, BackendDiagnosticsOptions, getLocalizedStringEN } from \"./Utils.js\";\r\n\r\n/**\r\n * Presentation hierarchy cache mode.\r\n * @public\r\n */\r\nexport enum HierarchyCacheMode {\r\n /**\r\n * Hierarchy cache is created in memory.\r\n */\r\n Memory = \"memory\",\r\n /**\r\n * Hierarchy cache is created on disk. In this mode hierarchy cache is persisted between iModel\r\n * openings.\r\n */\r\n Disk = \"disk\",\r\n /**\r\n * Hierarchy cache is created on disk. In this mode everything is cached in memory while creating hierarchy level\r\n * and persisted in disk cache when whole hierarchy level is created.\r\n *\r\n * **Note:** This mode is still experimental.\r\n */\r\n Hybrid = \"hybrid\",\r\n}\r\n\r\n/**\r\n * Configuration for hierarchy cache.\r\n * @public\r\n */\r\nexport type HierarchyCacheConfig = MemoryHierarchyCacheConfig | DiskHierarchyCacheConfig | HybridCacheConfig;\r\n\r\n/**\r\n * Base interface for all [[HierarchyCacheConfig]] implementations.\r\n * @public\r\n */\r\nexport interface HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode;\r\n}\r\n\r\n/**\r\n * Configuration for in-memory hierarchy cache.\r\n *\r\n * @see [Memory cache documentation page]($docs/presentation/advanced/Caching.md#memory-cache)\r\n * @public\r\n */\r\nexport interface MemoryHierarchyCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Memory;\r\n}\r\n\r\n/**\r\n * Configuration for persistent disk hierarchy cache.\r\n *\r\n * @see [Disk cache documentation page]($docs/presentation/advanced/Caching.md#disk-cache)\r\n * @public\r\n */\r\nexport interface DiskHierarchyCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Disk;\r\n\r\n /**\r\n * A directory for hierarchy caches. If set, the directory must exist. Relative paths start from `process.cwd()`.\r\n *\r\n * The default directory depends on the iModel and the way it's opened.\r\n */\r\n directory?: string;\r\n\r\n /**\r\n * While the cache itself is stored on a disk, there's still a required small in-memory cache.\r\n * The parameter allows controlling size of that cache. Defaults to `32768000` bytes (32 MB).\r\n */\r\n memoryCacheSize?: number;\r\n}\r\n\r\n/**\r\n * Configuration for the experimental hybrid hierarchy cache.\r\n *\r\n * Hybrid cache uses a combination of in-memory and disk caches, which should make it a better\r\n * alternative for cases when there are lots of simultaneous requests.\r\n *\r\n * @see [Hybrid cache documentation page]($docs/presentation/advanced/Caching.md#hybrid-cache)\r\n * @public\r\n */\r\nexport interface HybridCacheConfig extends HierarchyCacheConfigBase {\r\n mode: HierarchyCacheMode.Hybrid;\r\n\r\n /** Configuration for disk cache used to persist hierarchies. */\r\n disk?: DiskHierarchyCacheConfig;\r\n}\r\n\r\n/**\r\n * Configuration for content cache.\r\n *\r\n * @see [Content cache documentation page]($docs/presentation/advanced/Caching.md#content-cache)\r\n * @public\r\n */\r\nexport interface ContentCacheConfig {\r\n /**\r\n * Maximum number of content descriptors cached in memory for quicker paged content requests.\r\n *\r\n * Defaults to `100`.\r\n */\r\n size?: number;\r\n}\r\n\r\n/**\r\n * Caching configuration options for [[PresentationManager]].\r\n * @public\r\n */\r\nexport interface PresentationManagerCachingConfig {\r\n /**\r\n * Hierarchies-related caching options.\r\n *\r\n * @see [Hierarchies cache documentation page]($docs/presentation/advanced/Caching.md#hierarchies-cache)\r\n */\r\n hierarchies?: HierarchyCacheConfig;\r\n\r\n /**\r\n * Content-related caching options.\r\n *\r\n * @see [Content cache documentation page]($docs/presentation/advanced/Caching.md#content-cache)\r\n */\r\n content?: ContentCacheConfig;\r\n\r\n /**\r\n * Each worker thread (see [[workerThreadsCount]]) opens a connection to an iModel used for a request. This\r\n * means there could be `{workerThreadsCount} * {iModels count}` number of connections. Each connection\r\n * uses a memory cache to increase iModel read performance. This parameter allows controlling the size of that\r\n * cache. Defaults to `32768000` bytes (32 MB).\r\n *\r\n * @see [Worker connections cache documentation page]($docs/presentation/advanced/Caching.md#worker-connections-cache)\r\n */\r\n workerConnectionCacheSize?: number;\r\n}\r\n\r\n/**\r\n * A data structure that associates unit systems with a format. The associations are used for\r\n * assigning default unit formats for specific phenomenons (see [[PresentationManagerProps.defaultFormats]]).\r\n *\r\n * @public\r\n * @deprecated in 4.3 - will not be removed until after 2026-06-13. The type has been moved to `@itwin/presentation-common` package.\r\n */\r\nexport type UnitSystemFormat = CommonUnitSystemFormat;\r\n\r\n/**\r\n * Data structure for multiple element properties request response.\r\n * @public\r\n */\r\nexport interface MultiElementPropertiesResponse<TParsedContent = ElementProperties> {\r\n total: number;\r\n iterator: () => AsyncGenerator<TParsedContent[]>;\r\n}\r\n\r\n/**\r\n * Configuration options for supplying asset paths to [[PresentationManager]].\r\n * @public\r\n */\r\nexport interface PresentationAssetsRootConfig {\r\n /**\r\n * Path to `presentation-backend` assets. Relative paths start from `process.cwd()`.\r\n */\r\n backend: string;\r\n}\r\n\r\n/**\r\n * Properties that can be used to configure [[PresentationManager]]\r\n * @public\r\n */\r\nexport interface PresentationManagerProps {\r\n /**\r\n * Path overrides for presentation backend assets. Need to be overriden by application if it puts these assets someplace else than the default.\r\n *\r\n * By default the path to assets directory is determined during the call of [[Presentation.initialize]] using this algorithm:\r\n *\r\n * - if path of `.js` file that contains [[PresentationManager]] definition contains \"presentation-backend\", assume the package is in `node_modules` and the directory structure is:\r\n * - `assets/*\\*\\/*`\r\n * - `presentation-backend/{presentation-backend source files}`\r\n *\r\n * which means the assets can be found through a relative path `../assets/` from the JS file being executed.\r\n *\r\n * - else, assume the backend is webpacked into a single file with assets next to it:\r\n * - `assets/*\\*\\/*`\r\n * - `{source file being executed}.js`\r\n *\r\n * which means the assets can be found through a relative path `./assets/` from the `{source file being executed}`.\r\n *\r\n * @deprecated in 4.2 - will not be removed until after 2026-06-13. This attribute is not used anymore - the package is not using private assets anymore.\r\n */\r\n presentationAssetsRoot?: string | PresentationAssetsRootConfig;\r\n\r\n /**\r\n * A list of directories containing application's presentation rulesets. Relative\r\n * paths start from `process.cwd()`. The directories are traversed recursively.\r\n *\r\n * @note Only files with `.PresentationRuleSet.json` are read.\r\n */\r\n rulesetDirectories?: string[];\r\n\r\n /**\r\n * A list of directories containing application's supplemental presentation rulesets. Relative\r\n * paths start from `process.cwd()`. The directories are traversed recursively.\r\n *\r\n * @note Only files with `.PresentationRuleSet.json` are read.\r\n */\r\n supplementalRulesetDirectories?: string[];\r\n\r\n /**\r\n * Sets the active unit system to use for formatting property values with\r\n * units. Default presentation units are used if this is not specified. The active unit\r\n * system can later be changed through [[PresentationManager.activeUnitSystem]] or overriden for each request\r\n * through request options.\r\n */\r\n defaultUnitSystem?: UnitSystemKey;\r\n\r\n /**\r\n * A map of default unit formats to use for formatting properties that don't have a presentation format\r\n * in requested unit system.\r\n *\r\n * @deprecated in 5.1. Use `formatsProvider` instead. Still used as a fallback if `formatsProvider` is not supplied.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n defaultFormats?: FormatsMap;\r\n\r\n /**\r\n * A custom formats provider to use for formatting property values with units. Defaults to [SchemaFormatsProvider]($ecschema-metadata) if\r\n * not supplied.\r\n */\r\n formatsProvider?: FormatsProvider;\r\n\r\n /**\r\n * A number of worker threads to use for handling presentation requests. Defaults to `2`.\r\n */\r\n workerThreadsCount?: number;\r\n\r\n /**\r\n * The interval (in milliseconds) used to poll for presentation data changes. If not set, presentation\r\n * data changes are not tracked at all.\r\n *\r\n * @beta\r\n * @deprecated in 4.4 - will not be removed until after 2026-06-13. The manager now always tracks for iModel data changes without polling.\r\n */\r\n updatesPollInterval?: number;\r\n\r\n /** Options for caching. */\r\n caching?: PresentationManagerCachingConfig;\r\n\r\n /**\r\n * Use [SQLite's Memory-Mapped I/O](https://sqlite.org/mmap.html) for worker connections. This mode improves performance of handling\r\n * requests with high I/O intensity, e.g. filtering large tables on non-indexed columns. No downsides have been noticed.\r\n *\r\n * Set to a falsy value to turn off. `true` for memory-mapping the whole iModel. Number value for memory-mapping the specified amount of bytes.\r\n */\r\n useMmap?: boolean | number;\r\n\r\n /**\r\n * Localization function to localize data returned by presentation manager when it's used directly on the backend (as opposed to when used through RPC, where\r\n * data is localized on the frontend). Defaults to English localization.\r\n *\r\n * @see [Localization]($docs/presentation/advanced/Localization)\r\n */\r\n getLocalizedString?: (key: string) => string;\r\n\r\n /**\r\n * Callback that provides [SchemaContext]($ecschema-metadata) for supplied [IModelDb]($core-backend).\r\n * [SchemaContext]($ecschema-metadata) is used for getting metadata required for values formatting.\r\n *\r\n * @deprecated in 5.1. [IModelDb.schemaContext]($core-backend) is now used by default instead.\r\n */\r\n schemaContextProvider?: (imodel: IModelDb) => SchemaContext;\r\n\r\n /**\r\n * Parameters for gathering diagnostics at the manager level. When supplied, they're used with every request\r\n * made through the manager.\r\n *\r\n * @see [Diagnostics documentation page]($docs/presentation/advanced/Diagnostics.md)\r\n */\r\n diagnostics?: BackendDiagnosticsOptions;\r\n}\r\n\r\n/**\r\n * Backend Presentation manager which pulls the presentation data from\r\n * an iModel using native platform.\r\n *\r\n * @public\r\n */\r\nexport class PresentationManager {\r\n private _props: PresentationManagerProps;\r\n private _detail: PresentationManagerDetail;\r\n private _localizationHelper: LocalizationHelper;\r\n private _schemaContextProvider: (imodel: IModelDb) => SchemaContext;\r\n\r\n /**\r\n * Creates an instance of PresentationManager.\r\n * @param props Optional configuration properties.\r\n */\r\n constructor(props?: PresentationManagerProps) {\r\n this._props = props ?? {};\r\n this._detail = new PresentationManagerDetail(this._props);\r\n this._localizationHelper = new LocalizationHelper({ getLocalizedString: props?.getLocalizedString ?? getLocalizedStringEN });\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n this._schemaContextProvider = props?.schemaContextProvider ?? ((imodel: IModelDb) => imodel.schemaContext);\r\n }\r\n\r\n /** Get / set active unit system used to format property values with units */\r\n public get activeUnitSystem(): UnitSystemKey | undefined {\r\n return this._detail.activeUnitSystem;\r\n }\r\n /* c8 ignore next 3 */\r\n public set activeUnitSystem(value: UnitSystemKey | undefined) {\r\n this._detail.activeUnitSystem = value;\r\n }\r\n\r\n /** Dispose the presentation manager. Must be called to clean up native resources. */\r\n public [Symbol.dispose]() {\r\n this._detail[Symbol.dispose]();\r\n }\r\n\r\n /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */\r\n /* c8 ignore next 3 */\r\n public dispose() {\r\n this[Symbol.dispose]();\r\n }\r\n\r\n /** An event, that this manager raises whenever any request is made on it. */\r\n public get onUsed(): BeEvent<() => void> {\r\n return this._detail.onUsed;\r\n }\r\n\r\n /** Properties used to initialize the manager */\r\n public get props() {\r\n return this._props;\r\n }\r\n\r\n /** Get rulesets manager */\r\n public rulesets(): RulesetManager {\r\n return this._detail.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 variables manager for\r\n */\r\n public vars(rulesetId: string): RulesetVariablesManager {\r\n return new RulesetVariablesManagerImpl(() => this._detail.getNativePlatform(), rulesetId);\r\n }\r\n\r\n /** @internal */\r\n /* c8 ignore next 3 */\r\n public get [_presentation_manager_detail](): PresentationManagerDetail {\r\n return this._detail;\r\n }\r\n\r\n public getRulesetId(rulesetOrId: Ruleset | string) {\r\n return this._detail.getRulesetId(rulesetOrId);\r\n }\r\n\r\n /**\r\n * Retrieves nodes\r\n * @public\r\n */\r\n public async getNodes(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>>> & BackendDiagnosticsAttribute,\r\n ): Promise<Node[]> {\r\n const serializedHierarchyLevel = await this._detail.getNodes(requestOptions);\r\n const hierarchyLevel: HierarchyLevel = deepReplaceNullsToUndefined(JSON.parse(serializedHierarchyLevel));\r\n return this._localizationHelper.getLocalizedNodes(hierarchyLevel.nodes);\r\n }\r\n\r\n /**\r\n * Retrieves nodes count\r\n * @public\r\n */\r\n public async getNodesCount(\r\n requestOptions: WithCancelEvent<Prioritized<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<number> {\r\n return this._detail.getNodesCount(requestOptions);\r\n }\r\n\r\n /**\r\n * Retrieves hierarchy level descriptor\r\n * @public\r\n */\r\n public async getNodesDescriptor(\r\n requestOptions: WithCancelEvent<Prioritized<HierarchyLevelDescriptorRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<Descriptor | undefined> {\r\n const response = await this._detail.getNodesDescriptor(requestOptions);\r\n const descriptor = Descriptor.fromJSON(JSON.parse(response));\r\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\r\n }\r\n\r\n /**\r\n * Retrieves paths from root nodes to children nodes according to specified instance key paths. Intersecting paths will be merged.\r\n * TODO: Return results in pages\r\n * @public\r\n */\r\n public async getNodePaths(\r\n requestOptions: WithCancelEvent<Prioritized<FilterByInstancePathsHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n const result = await this._detail.getNodePaths(requestOptions);\r\n return result.map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\r\n }\r\n\r\n /**\r\n * Retrieves paths from root nodes to nodes containing filter text in their label.\r\n * TODO: Return results in pages\r\n * @public\r\n */\r\n public async getFilteredNodePaths(\r\n requestOptions: WithCancelEvent<Prioritized<FilterByTextHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n const result = await this._detail.getFilteredNodePaths(requestOptions);\r\n return result.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(\r\n requestOptions: WithCancelEvent<Prioritized<ContentSourcesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute,\r\n ): Promise<SelectClassInfo[]> {\r\n return this._detail.getContentSources(requestOptions);\r\n }\r\n\r\n /**\r\n * Retrieves the content descriptor which can be used to get content\r\n * @public\r\n */\r\n public async getContentDescriptor(\r\n requestOptions: WithCancelEvent<Prioritized<ContentDescriptorRequestOptions<IModelDb, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute,\r\n ): Promise<Descriptor | undefined> {\r\n const response = await this._detail.getContentDescriptor(requestOptions);\r\n const descriptor = Descriptor.fromJSON(JSON.parse(response));\r\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\r\n }\r\n\r\n /**\r\n * Retrieves the content set size based on the supplied content descriptor override\r\n * @public\r\n */\r\n public async getContentSetSize(\r\n requestOptions: WithCancelEvent<Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<number> {\r\n return this._detail.getContentSetSize(requestOptions);\r\n }\r\n\r\n private createContentFormatter({ imodel, unitSystem }: { imodel: IModelDb; unitSystem?: UnitSystemKey }): ContentFormatter {\r\n if (!unitSystem) {\r\n unitSystem = this.props.defaultUnitSystem ?? \"metric\";\r\n }\r\n const schemaContext = this._schemaContextProvider(imodel);\r\n const koqPropertyFormatter = new KoqPropertyValueFormatter({\r\n schemaContext,\r\n formatsProvider: this.props.formatsProvider ?? new SchemaFormatsProvider(schemaContext, unitSystem),\r\n });\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n koqPropertyFormatter.defaultFormats = this.props.defaultFormats;\r\n return new ContentFormatter(new ContentPropertyValueFormatter(koqPropertyFormatter), unitSystem);\r\n }\r\n\r\n /**\r\n * Retrieves the content set based on the supplied content descriptor.\r\n * @public\r\n */\r\n public async getContentSet(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor, KeySet, RulesetVariable>>>> & BackendDiagnosticsAttribute,\r\n ): Promise<Item[]> {\r\n let items = await this._detail.getContentSet(requestOptions);\r\n\r\n if (!requestOptions.omitFormattedValues) {\r\n const formatter = this.createContentFormatter(requestOptions);\r\n items = await formatter.formatContentItems(items, requestOptions.descriptor);\r\n }\r\n\r\n return this._localizationHelper.getLocalizedContentItems(items);\r\n }\r\n\r\n /**\r\n * Retrieves the content based on the supplied content descriptor override.\r\n * @public\r\n */\r\n public async getContent(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<Content | undefined> {\r\n const content = await this._detail.getContent(requestOptions);\r\n if (!content) {\r\n return undefined;\r\n }\r\n\r\n if (!requestOptions.omitFormattedValues) {\r\n const formatter = this.createContentFormatter(requestOptions);\r\n await formatter.formatContent(content);\r\n }\r\n\r\n return this._localizationHelper.getLocalizedContent(content);\r\n }\r\n\r\n /**\r\n * Retrieves distinct values of specific field from the content based on the supplied content descriptor override.\r\n * @param requestOptions Options for the request\r\n * @return A promise object that returns either distinct values on success or an error string on error.\r\n * @public\r\n */\r\n public async getPagedDistinctValues(\r\n requestOptions: WithCancelEvent<Prioritized<DistinctValuesRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<PagedResponse<DisplayValueGroup>> {\r\n const result = await this._detail.getPagedDistinctValues(requestOptions);\r\n return {\r\n ...result,\r\n items: result.items.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<TParsedContent = ElementProperties>(\r\n requestOptions: WithCancelEvent<Prioritized<SingleElementPropertiesRequestOptions<IModelDb, TParsedContent>>> & BackendDiagnosticsAttribute,\r\n ): Promise<TParsedContent | undefined>;\r\n /**\r\n * Retrieves property data in simplified format for multiple elements specified by class or all element.\r\n * @return An object that contains element count and AsyncGenerator to iterate over properties of those elements in batches of undefined size.\r\n * @public\r\n */\r\n public async getElementProperties<TParsedContent = ElementProperties>(\r\n requestOptions: WithCancelEvent<Prioritized<MultiElementPropertiesRequestOptions<IModelDb, TParsedContent>>> & BackendDiagnosticsAttribute,\r\n ): Promise<MultiElementPropertiesResponse<TParsedContent>>;\r\n public async getElementProperties<TParsedContent = ElementProperties>(\r\n requestOptions: WithCancelEvent<\r\n Prioritized<SingleElementPropertiesRequestOptions<IModelDb, TParsedContent> | MultiElementPropertiesRequestOptions<IModelDb, TParsedContent>>\r\n > &\r\n BackendDiagnosticsAttribute,\r\n ): Promise<TParsedContent | undefined | MultiElementPropertiesResponse<TParsedContent>> {\r\n if (isSingleElementPropertiesRequestOptions(requestOptions)) {\r\n return this.getSingleElementProperties<TParsedContent>(requestOptions);\r\n }\r\n return this.getMultipleElementProperties<TParsedContent>(requestOptions);\r\n }\r\n\r\n private async getSingleElementProperties<TParsedContent>(\r\n requestOptions: WithCancelEvent<Prioritized<SingleElementPropertiesRequestOptions<IModelDb, TParsedContent>>> & BackendDiagnosticsAttribute,\r\n ): Promise<TParsedContent | undefined> {\r\n type TParser = Required<typeof requestOptions>[\"contentParser\"];\r\n const { elementId, contentParser, ...optionsNoElementId } = requestOptions;\r\n const parser: TParser = contentParser ?? (buildElementProperties as TParser);\r\n const content = await this.getContent({\r\n ...optionsNoElementId,\r\n descriptor: {\r\n displayType: DefaultContentDisplayTypes.PropertyPane,\r\n contentFlags: ContentFlags.ShowLabels,\r\n },\r\n rulesetOrId: \"ElementProperties\",\r\n keys: new KeySet([{ className: \"BisCore:Element\", id: elementId }]),\r\n });\r\n if (!content || content.contentSet.length === 0) {\r\n return undefined;\r\n }\r\n return parser(content.descriptor, content.contentSet[0]);\r\n }\r\n\r\n private async getMultipleElementProperties<TParsedContent>(\r\n requestOptions: WithCancelEvent<Prioritized<MultiElementPropertiesRequestOptions<IModelDb, TParsedContent>>> & BackendDiagnosticsAttribute,\r\n ): Promise<MultiElementPropertiesResponse<TParsedContent>> {\r\n type TParser = Required<typeof requestOptions>[\"contentParser\"];\r\n const { contentParser, batchSize: batchSizeOption, ...contentOptions } = requestOptions;\r\n\r\n const parser: TParser = contentParser ?? (buildElementProperties as TParser);\r\n const workerThreadsCount = this._props.workerThreadsCount ?? 2;\r\n\r\n // We don't want to request content for all classes at once - each class results in a huge content descriptor object that's cached in memory\r\n // and can be shared across all batch requests for that class. Handling multiple classes at the same time not only increases memory footprint,\r\n // but also may push descriptors out of cache, requiring us to recreate them, thus making performance worse. For those reasons we handle at\r\n // most `workerThreadsCount / 2` classes in parallel.\r\n /* c8 ignore next */\r\n const classParallelism = workerThreadsCount > 1 ? Math.ceil(workerThreadsCount / 2) : 1;\r\n\r\n // We want all worker threads to be constantly busy. However, there's some fairly expensive work being done after the worker thread is done,\r\n // but before we receive the response. That means the worker thread would be starving if we sent only `workerThreadsCount` requests in parallel.\r\n // To avoid that, we keep twice as much requests active.\r\n /* c8 ignore next */\r\n const batchesParallelism = workerThreadsCount > 0 ? workerThreadsCount : 1;\r\n\r\n /* c8 ignore next */\r\n const batchSize = batchSizeOption ?? 100;\r\n\r\n const elementsIdentifier = ((): { elementIds: Id64Array } | { elementClasses: string[] } => {\r\n if (\"elementIds\" in contentOptions && contentOptions.elementIds !== undefined) {\r\n const elementIds = contentOptions.elementIds;\r\n delete contentOptions.elementIds;\r\n return { elementIds };\r\n }\r\n if (\"elementClasses\" in contentOptions && contentOptions.elementClasses !== undefined) {\r\n const elementClasses = contentOptions.elementClasses;\r\n delete contentOptions.elementClasses;\r\n return { elementClasses };\r\n }\r\n /* c8 ignore next */\r\n return { elementClasses: [\"BisCore:Element\"] };\r\n })();\r\n\r\n const descriptorGetter = async (partialProps: Pick<ContentDescriptorRequestOptions<IModelDb, KeySet, RulesetVariable>, \"rulesetOrId\" | \"keys\">) =>\r\n this.getContentDescriptor({ ...contentOptions, displayType: DefaultContentDisplayTypes.Grid, contentFlags: ContentFlags.ShowLabels, ...partialProps });\r\n const contentSetGetter = async (\r\n partialProps: Pick<ContentRequestOptions<IModelDb, Descriptor, KeySet, RulesetVariable>, \"rulesetOrId\" | \"keys\" | \"descriptor\">,\r\n ) => this.getContentSet({ ...contentOptions, ...partialProps });\r\n const { itemBatches, count } =\r\n \"elementIds\" in elementsIdentifier\r\n ? getContentItemsObservableFromElementIds(\r\n requestOptions.imodel,\r\n descriptorGetter,\r\n contentSetGetter,\r\n elementsIdentifier.elementIds,\r\n classParallelism,\r\n batchesParallelism,\r\n batchSize,\r\n )\r\n : getContentItemsObservableFromClassNames(\r\n requestOptions.imodel,\r\n descriptorGetter,\r\n contentSetGetter,\r\n elementsIdentifier.elementClasses,\r\n classParallelism,\r\n batchesParallelism,\r\n batchSize,\r\n );\r\n return {\r\n total: await firstValueFrom(count),\r\n async *iterator() {\r\n for await (const itemsBatch of eachValueFrom(itemBatches)) {\r\n const { descriptor, items } = itemsBatch;\r\n yield items.map((item) => parser(descriptor, item));\r\n }\r\n },\r\n };\r\n }\r\n\r\n /**\r\n * Retrieves display label definition of specific item\r\n * @public\r\n */\r\n public async getDisplayLabelDefinition(\r\n requestOptions: WithCancelEvent<Prioritized<DisplayLabelRequestOptions<IModelDb, InstanceKey>>> & BackendDiagnosticsAttribute,\r\n ): Promise<LabelDefinition> {\r\n const labelDefinition = await this._detail.getDisplayLabelDefinition(requestOptions);\r\n return this._localizationHelper.getLocalizedLabelDefinition(labelDefinition);\r\n }\r\n\r\n /**\r\n * Retrieves display label definitions of specific items\r\n * @public\r\n */\r\n public async getDisplayLabelDefinitions(\r\n requestOptions: WithCancelEvent<Prioritized<Paged<DisplayLabelsRequestOptions<IModelDb, InstanceKey>>>> & BackendDiagnosticsAttribute,\r\n ): Promise<LabelDefinition[]> {\r\n const labelDefinitions = await this._detail.getDisplayLabelDefinitions(requestOptions);\r\n return this._localizationHelper.getLocalizedLabelDefinitions(labelDefinitions);\r\n }\r\n\r\n /**\r\n * Retrieves available selection scopes.\r\n * @public\r\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n public async getSelectionScopes(_requestOptions: SelectionScopeRequestOptions<IModelDb> & BackendDiagnosticsAttribute): Promise<SelectionScope[]> {\r\n return SelectionScopesHelper.getSelectionScopes();\r\n }\r\n\r\n /**\r\n * Computes selection based on provided element IDs and selection scope.\r\n * @public\r\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n public async computeSelection(requestOptions: ComputeSelectionRequestOptions<IModelDb> & BackendDiagnosticsAttribute): Promise<KeySet> {\r\n return SelectionScopesHelper.computeSelection(requestOptions);\r\n }\r\n\r\n /**\r\n * Compares two hierarchies specified in the request options\r\n * @public\r\n */\r\n public async compareHierarchies(requestOptions: HierarchyCompareOptions<IModelDb, NodeKey>): Promise<HierarchyCompareInfo> {\r\n if (!requestOptions.prev.rulesetOrId && !requestOptions.prev.rulesetVariables) {\r\n return { changes: [] };\r\n }\r\n\r\n const { rulesetOrId, prev, rulesetVariables, ...options } = requestOptions;\r\n this._detail.registerRuleset(rulesetOrId);\r\n\r\n const currRulesetId = getRulesetIdObject(requestOptions.rulesetOrId);\r\n const prevRulesetId = prev.rulesetOrId ? getRulesetIdObject(prev.rulesetOrId) : currRulesetId;\r\n if (prevRulesetId.parts.id !== currRulesetId.parts.id) {\r\n throw new PresentationError(PresentationStatus.InvalidArgument, \"Can't compare rulesets with different IDs\");\r\n }\r\n\r\n const currRulesetVariables = rulesetVariables ?? [];\r\n const prevRulesetVariables = prev.rulesetVariables ?? currRulesetVariables;\r\n\r\n const params = {\r\n requestId: NativePlatformRequestTypes.CompareHierarchies,\r\n ...options,\r\n prevRulesetId: prevRulesetId.uniqueId,\r\n currRulesetId: currRulesetId.uniqueId,\r\n prevRulesetVariables: JSON.stringify(prevRulesetVariables),\r\n currRulesetVariables: JSON.stringify(currRulesetVariables),\r\n expandedNodeKeys: JSON.stringify(options.expandedNodeKeys ?? []),\r\n };\r\n return JSON.parse(await this._detail.request(params));\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManagerDetail.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManagerDetail.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PresentationManagerDetail.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/PresentationManagerDetail.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAA2B,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAU,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAEL,OAAO,EACP,+BAA+B,EAE/B,qBAAqB,EACrB,4BAA4B,EAE5B,UAAU,EACV,mBAAmB,EAGnB,0BAA0B,EAC1B,2BAA2B,EAC3B,iBAAiB,EACjB,4BAA4B,EAC5B,4CAA4C,EAC5C,mCAAmC,EAEnC,sCAAsC,EACtC,uBAAuB,EACvB,WAAW,EACX,IAAI,EAGJ,MAAM,EACN,eAAe,EACf,OAAO,EACP,eAAe,EACf,KAAK,EACL,aAAa,EACb,WAAW,EACX,O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K,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,gBAAgB;AAChB,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,eAAe,CAsBjF;AAED,gBAAgB;AAChB,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EACtB,0BAA0B,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,GACpE,4BAA4B,CA2B9B;AAED,gBAAgB;AAChB,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,QAgB5G;AAyHD,gBAAgB;AAChB,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,QAK7D;AAED,gBAAgB;AAEhB,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,QAAI"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
7
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
8
|
if (k2 === undefined) k2 = k;
|
|
4
9
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -32,17 +37,13 @@ exports.getKeysForContentRequest = getKeysForContentRequest;
|
|
|
32
37
|
exports.bisElementInstanceKeysProcessor = bisElementInstanceKeysProcessor;
|
|
33
38
|
exports.ipcUpdatesHandler = ipcUpdatesHandler;
|
|
34
39
|
exports.noopUpdatesHandler = noopUpdatesHandler;
|
|
35
|
-
/*---------------------------------------------------------------------------------------------
|
|
36
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
37
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
38
|
-
*--------------------------------------------------------------------------------------------*/
|
|
39
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
40
40
|
const hash = __importStar(require("object-hash"));
|
|
41
41
|
const path = __importStar(require("path"));
|
|
42
42
|
const core_backend_1 = require("@itwin/core-backend");
|
|
43
43
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
44
44
|
const presentation_common_1 = require("@itwin/presentation-common");
|
|
45
45
|
const internal_1 = require("@itwin/presentation-common/internal");
|
|
46
|
+
const presentation_shared_1 = require("@itwin/presentation-shared");
|
|
46
47
|
const BackendLoggerCategory_js_1 = require("./BackendLoggerCategory.js");
|
|
47
48
|
const NativePlatform_js_1 = require("./NativePlatform.js");
|
|
48
49
|
const PresentationManager_js_1 = require("./PresentationManager.js");
|
|
@@ -72,7 +73,9 @@ class PresentationManagerDetail {
|
|
|
72
73
|
this._disposed = false;
|
|
73
74
|
this._nativePlatform =
|
|
74
75
|
params.addon ??
|
|
75
|
-
createNativePlatform(params.id ?? "", params.workerThreadsCount ?? 2, core_backend_1.IpcHost.isValid ? ipcUpdatesHandler : noopUpdatesHandler, params.caching,
|
|
76
|
+
createNativePlatform(params.id ?? "", params.workerThreadsCount ?? 2, core_backend_1.IpcHost.isValid ? ipcUpdatesHandler : noopUpdatesHandler, params.caching,
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
78
|
+
params.defaultFormats, params.useMmap);
|
|
76
79
|
setupRulesets(this._nativePlatform, params.supplementalRulesetDirectories ?? [], params.rulesetDirectories ?? []);
|
|
77
80
|
this.activeUnitSystem = params.defaultUnitSystem;
|
|
78
81
|
this.onUsed = new core_bentley_1.BeEvent();
|
|
@@ -182,6 +185,7 @@ class PresentationManagerDetail {
|
|
|
182
185
|
requestId: NativePlatform_js_1.NativePlatformRequestTypes.GetContentSet,
|
|
183
186
|
rulesetId: this.registerRuleset(rulesetOrId),
|
|
184
187
|
...strippedOptions,
|
|
188
|
+
omitFormattedValues: true,
|
|
185
189
|
keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),
|
|
186
190
|
descriptorOverrides: createContentDescriptorOverrides(descriptor),
|
|
187
191
|
};
|
|
@@ -195,6 +199,7 @@ class PresentationManagerDetail {
|
|
|
195
199
|
requestId: NativePlatform_js_1.NativePlatformRequestTypes.GetContent,
|
|
196
200
|
rulesetId: this.registerRuleset(rulesetOrId),
|
|
197
201
|
...strippedOptions,
|
|
202
|
+
omitFormattedValues: true,
|
|
198
203
|
keys: getKeysForContentRequest(requestOptions.keys, (map) => bisElementInstanceKeysProcessor(requestOptions.imodel, map)),
|
|
199
204
|
descriptorOverrides: createContentDescriptorOverrides(descriptor),
|
|
200
205
|
};
|
|
@@ -222,7 +227,7 @@ class PresentationManagerDetail {
|
|
|
222
227
|
async getDisplayLabelDefinitions(requestOptions) {
|
|
223
228
|
const concreteKeys = requestOptions.keys
|
|
224
229
|
.map((k) => {
|
|
225
|
-
if (k.className === "BisCore
|
|
230
|
+
if ((0, presentation_shared_1.normalizeFullClassName)(k.className).toLowerCase() === "BisCore.Element".toLowerCase()) {
|
|
226
231
|
return (0, Utils_js_1.getElementKey)(requestOptions.imodel, k.id);
|
|
227
232
|
}
|
|
228
233
|
return k;
|
|
@@ -382,7 +387,9 @@ function addInstanceKey(classInstancesMap, key) {
|
|
|
382
387
|
}
|
|
383
388
|
set.add(key.id);
|
|
384
389
|
}
|
|
385
|
-
function createNativePlatform(id, workerThreadsCount, updateCallback, caching,
|
|
390
|
+
function createNativePlatform(id, workerThreadsCount, updateCallback, caching,
|
|
391
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
392
|
+
defaultFormats, useMmap) {
|
|
386
393
|
return new ((0, NativePlatform_js_1.createDefaultNativePlatform)({
|
|
387
394
|
id,
|
|
388
395
|
taskAllocationsMap: { [Number.MAX_SAFE_INTEGER]: workerThreadsCount },
|
|
@@ -411,6 +418,7 @@ function createNativePlatform(id, workerThreadsCount, updateCallback, caching, d
|
|
|
411
418
|
function normalizeDirectory(directory) {
|
|
412
419
|
return directory ? path.resolve(directory) : "";
|
|
413
420
|
}
|
|
421
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
414
422
|
function toNativeUnitFormatsMap(map) {
|
|
415
423
|
if (!map) {
|
|
416
424
|
return undefined;
|