@itwin/presentation-backend 4.0.0-dev.7 → 4.0.0-dev.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +16 -2
  2. package/lib/cjs/presentation-backend/BackendLoggerCategory.d.ts +41 -41
  3. package/lib/cjs/presentation-backend/BackendLoggerCategory.js +50 -50
  4. package/lib/cjs/presentation-backend/Constants.d.ts +8 -8
  5. package/lib/cjs/presentation-backend/Constants.js +40 -36
  6. package/lib/cjs/presentation-backend/Constants.js.map +1 -1
  7. package/lib/cjs/presentation-backend/ElementPropertiesHelper.d.ts +11 -11
  8. package/lib/cjs/presentation-backend/ElementPropertiesHelper.js +260 -262
  9. package/lib/cjs/presentation-backend/ElementPropertiesHelper.js.map +1 -1
  10. package/lib/cjs/presentation-backend/NativePlatform.d.ts +87 -87
  11. package/lib/cjs/presentation-backend/NativePlatform.d.ts.map +1 -1
  12. package/lib/cjs/presentation-backend/NativePlatform.js +140 -140
  13. package/lib/cjs/presentation-backend/NativePlatform.js.map +1 -1
  14. package/lib/cjs/presentation-backend/Presentation.d.ts +106 -106
  15. package/lib/cjs/presentation-backend/Presentation.d.ts.map +1 -1
  16. package/lib/cjs/presentation-backend/Presentation.js +148 -150
  17. package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
  18. package/lib/cjs/presentation-backend/PresentationIpcHandler.d.ts +12 -12
  19. package/lib/cjs/presentation-backend/PresentationIpcHandler.js +41 -41
  20. package/lib/cjs/presentation-backend/PresentationManager.d.ts +456 -445
  21. package/lib/cjs/presentation-backend/PresentationManager.d.ts.map +1 -1
  22. package/lib/cjs/presentation-backend/PresentationManager.js +309 -311
  23. package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
  24. package/lib/cjs/presentation-backend/PresentationManagerDetail.d.ts +61 -61
  25. package/lib/cjs/presentation-backend/PresentationManagerDetail.js +430 -430
  26. package/lib/cjs/presentation-backend/PresentationManagerDetail.js.map +1 -1
  27. package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts +62 -62
  28. package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
  29. package/lib/cjs/presentation-backend/PresentationRpcImpl.js +388 -388
  30. package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
  31. package/lib/cjs/presentation-backend/RulesetEmbedder.d.ts +102 -102
  32. package/lib/cjs/presentation-backend/RulesetEmbedder.d.ts.map +1 -1
  33. package/lib/cjs/presentation-backend/RulesetEmbedder.js +283 -279
  34. package/lib/cjs/presentation-backend/RulesetEmbedder.js.map +1 -1
  35. package/lib/cjs/presentation-backend/RulesetManager.d.ts +53 -53
  36. package/lib/cjs/presentation-backend/RulesetManager.js +73 -73
  37. package/lib/cjs/presentation-backend/RulesetVariablesManager.d.ts +140 -140
  38. package/lib/cjs/presentation-backend/RulesetVariablesManager.js +129 -129
  39. package/lib/cjs/presentation-backend/SelectionScopesHelper.d.ts +28 -28
  40. package/lib/cjs/presentation-backend/SelectionScopesHelper.js +210 -213
  41. package/lib/cjs/presentation-backend/SelectionScopesHelper.js.map +1 -1
  42. package/lib/cjs/presentation-backend/TemporaryStorage.d.ts +123 -123
  43. package/lib/cjs/presentation-backend/TemporaryStorage.js +151 -151
  44. package/lib/cjs/presentation-backend/UpdatesTracker.d.ts +27 -27
  45. package/lib/cjs/presentation-backend/UpdatesTracker.js +54 -54
  46. package/lib/cjs/presentation-backend/Utils.d.ts +49 -49
  47. package/lib/cjs/presentation-backend/Utils.d.ts.map +1 -1
  48. package/lib/cjs/presentation-backend/Utils.js +107 -106
  49. package/lib/cjs/presentation-backend/Utils.js.map +1 -1
  50. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.d.ts +16 -16
  51. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js +55 -51
  52. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js.map +1 -1
  53. package/lib/cjs/presentation-backend/domain/RulesetElements.d.ts +21 -21
  54. package/lib/cjs/presentation-backend/domain/RulesetElements.js +38 -38
  55. package/lib/cjs/presentation-backend.d.ts +19 -19
  56. package/lib/cjs/presentation-backend.js +39 -35
  57. package/lib/cjs/presentation-backend.js.map +1 -1
  58. package/package.json +17 -17
@@ -1,446 +1,457 @@
1
- /** @packageDocumentation
2
- * @module Core
3
- */
4
- import { IModelDb } from "@itwin/core-backend";
5
- import { Id64String } from "@itwin/core-bentley";
6
- import { FormatProps, UnitSystemKey } from "@itwin/core-quantity";
7
- import { ComputeSelectionRequestOptions, Content, ContentDescriptorRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, HierarchyCompareInfo, HierarchyCompareOptions, HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions, InstanceKey, KeySet, LabelDefinition, MultiElementPropertiesRequestOptions, Node, NodeKey, NodePathElement, Paged, PagedResponse, Prioritized, Ruleset, RulesetVariable, SelectClassInfo, SelectionScope, SelectionScopeRequestOptions, SingleElementPropertiesRequestOptions, WithCancelEvent } from "@itwin/presentation-common";
8
- import { NativePlatformDefinition } from "./NativePlatform";
9
- import { PresentationManagerDetail } from "./PresentationManagerDetail";
10
- import { RulesetManager } from "./RulesetManager";
11
- import { RulesetVariablesManager } from "./RulesetVariablesManager";
12
- import { BackendDiagnosticsAttribute, BackendDiagnosticsOptions } from "./Utils";
13
- /**
14
- * Presentation manager working mode.
15
- * @public
16
- * @deprecated in 3.x. The attribute is not used by [[PresentationManager]] anymore
17
- */
18
- export declare enum PresentationManagerMode {
19
- /**
20
- * Presentation manager assumes iModels are opened in read-only mode and avoids doing some work
21
- * related to reacting to changes in iModels.
22
- */
23
- ReadOnly = 0,
24
- /**
25
- * Presentation manager assumes iModels are opened in read-write mode and it may need to
26
- * react to changes. This involves some additional work and gives slightly worse performance.
27
- */
28
- ReadWrite = 1
29
- }
30
- /**
31
- * Presentation hierarchy cache mode.
32
- * @public
33
- */
34
- export declare enum HierarchyCacheMode {
35
- /**
36
- * Hierarchy cache is created in memory.
37
- */
38
- Memory = "memory",
39
- /**
40
- * Hierarchy cache is created on disk. In this mode hierarchy cache is persisted between iModel
41
- * openings.
42
- */
43
- Disk = "disk",
44
- /**
45
- * Hierarchy cache is created on disk. In this mode everything is cached in memory while creating hierarchy level
46
- * and persisted in disk cache when whole hierarchy level is created.
47
- *
48
- * **Note:** This mode is still experimental.
49
- */
50
- Hybrid = "hybrid"
51
- }
52
- /**
53
- * Configuration for hierarchy cache.
54
- * @public
55
- */
56
- export declare type HierarchyCacheConfig = MemoryHierarchyCacheConfig | DiskHierarchyCacheConfig | HybridCacheConfig;
57
- /**
58
- * Base interface for all [[HierarchyCacheConfig]] implementations.
59
- * @public
60
- */
61
- export interface HierarchyCacheConfigBase {
62
- mode: HierarchyCacheMode;
63
- }
64
- /**
65
- * Configuration for in-memory hierarchy cache.
66
- *
67
- * @see [Memory cache documentation page]($docs/presentation/advanced/Caching.md#memory-cache)
68
- * @public
69
- */
70
- export interface MemoryHierarchyCacheConfig extends HierarchyCacheConfigBase {
71
- mode: HierarchyCacheMode.Memory;
72
- }
73
- /**
74
- * Configuration for persistent disk hierarchy cache.
75
- *
76
- * @see [Disk cache documentation page]($docs/presentation/advanced/Caching.md#disk-cache)
77
- * @public
78
- */
79
- export interface DiskHierarchyCacheConfig extends HierarchyCacheConfigBase {
80
- mode: HierarchyCacheMode.Disk;
81
- /**
82
- * A directory for Presentation hierarchy cache. If set, the directory must exist.
83
- *
84
- * The default directory depends on the iModel and the way it's opened.
85
- */
86
- directory?: string;
87
- /**
88
- * While the cache itself is stored on a disk, there's still a required small in-memory cache.
89
- * The parameter allows controlling size of that cache. Defaults to `32768000` bytes (32 MB).
90
- */
91
- memoryCacheSize?: number;
92
- }
93
- /**
94
- * Configuration for the experimental hybrid hierarchy cache.
95
- *
96
- * Hybrid cache uses a combination of in-memory and disk caches, which should make it a better
97
- * alternative for cases when there are lots of simultaneous requests.
98
- *
99
- * @see [Hybrid cache documentation page]($docs/presentation/advanced/Caching.md#hybrid-cache)
100
- * @public
101
- */
102
- export interface HybridCacheConfig extends HierarchyCacheConfigBase {
103
- mode: HierarchyCacheMode.Hybrid;
104
- /** Configuration for disk cache used to persist hierarchies. */
105
- disk?: DiskHierarchyCacheConfig;
106
- }
107
- /**
108
- * Configuration for content cache.
109
- *
110
- * @see [Content cache documentation page]($docs/presentation/advanced/Caching.md#content-cache)
111
- * @public
112
- */
113
- export interface ContentCacheConfig {
114
- /**
115
- * Maximum number of content descriptors cached in memory for quicker paged content requests.
116
- *
117
- * Defaults to `100`.
118
- */
119
- size?: number;
120
- }
121
- /**
122
- * Caching configuration options for [[PresentationManager]].
123
- * @public
124
- */
125
- export interface PresentationManagerCachingConfig {
126
- /**
127
- * Hierarchies-related caching options.
128
- *
129
- * @see [Hierarchies cache documentation page]($docs/presentation/advanced/Caching.md#hierarchies-cache)
130
- */
131
- hierarchies?: HierarchyCacheConfig;
132
- /**
133
- * Content-related caching options.
134
- *
135
- * @see [Content cache documentation page]($docs/presentation/advanced/Caching.md#content-cache)
136
- */
137
- content?: ContentCacheConfig;
138
- /**
139
- * Each worker thread (see [[workerThreadsCount]]) opens a connection to an iModel used for a request. This
140
- * means there could be `{workerThreadsCount} * {iModels count}` number of connections. Each connection
141
- * uses a memory cache to increase iModel read performance. This parameter allows controlling the size of that
142
- * cache. Defaults to `32768000` bytes (32 MB).
143
- *
144
- * @see [Worker connections cache documentation page]($docs/presentation/advanced/Caching.md#worker-connections-cache)
145
- */
146
- workerConnectionCacheSize?: number;
147
- }
148
- /**
149
- * A data structure that associates unit systems with a format. The associations are used for
150
- * assigning default unit formats for specific phenomenons (see [[PresentationManagerProps.defaultFormats]]).
151
- *
152
- * @public
153
- */
154
- export interface UnitSystemFormat {
155
- unitSystems: UnitSystemKey[];
156
- format: FormatProps;
157
- }
158
- /**
159
- * Data structure for multiple element properties request response.
160
- * @public
161
- */
162
- export interface MultiElementPropertiesResponse {
163
- total: number;
164
- iterator: () => AsyncGenerator<ElementProperties[]>;
165
- }
166
- /**
167
- * Configuration options for supplying asset directly paths to [[PresentationManager]].
168
- * @public
169
- */
170
- export interface PresentationAssetsRootConfig {
171
- /** Path to `presentation-backend` assets */
172
- backend: string;
173
- /**
174
- * Path to `presentation-common` assets.
175
- *
176
- * @deprecated in 3.x. This path is not used anymore
177
- */
178
- common: string;
179
- }
180
- /**
181
- * Properties that can be used to configure [[PresentationManager]]
182
- * @public
183
- */
184
- export interface PresentationManagerProps {
185
- /**
186
- * Path overrides for presentation backend assets. Need to be overriden by application if it puts these assets someplace else than the default.
187
- *
188
- * By default the path to assets directory is determined during the call of [[Presentation.initialize]] using this algorithm:
189
- *
190
- * - if path of `.js` file that contains [[PresentationManager]] definition contains "presentation-backend", assume the package is in `node_modules` and the directory structure is:
191
- * - `assets/*\*\/*`
192
- * - `presentation-backend/{presentation-backend source files}`
193
- *
194
- * which means the assets can be found through a relative path `../assets/` from the JS file being executed.
195
- *
196
- * - else, assume the backend is webpacked into a single file with assets next to it:
197
- * - `assets/*\*\/*`
198
- * - `{source file being executed}.js`
199
- *
200
- * which means the assets can be found through a relative path `./assets/` from the `{source file being executed}`.
201
- */
202
- presentationAssetsRoot?: string | PresentationAssetsRootConfig;
203
- /**
204
- * A list of directories containing application's presentation rulesets.
205
- */
206
- rulesetDirectories?: string[];
207
- /**
208
- * A list of directories containing application's supplemental presentation rulesets.
209
- */
210
- supplementalRulesetDirectories?: string[];
211
- /**
212
- * A list of directories containing application's locale-specific localized
213
- * string files (in simplified i18next v3 format)
214
- *
215
- * @deprecated in 3.x. Use [[getLocalizedString]] to localize data returned by [[PresentationManager]].
216
- */
217
- localeDirectories?: string[];
218
- /**
219
- * Sets the active locale to use when localizing presentation-related
220
- * strings. It can later be changed through [[PresentationManager.activeLocale]].
221
- *
222
- * @deprecated in 3.x. Use [[getLocalizedString]] to localize data returned by [[PresentationManager]].
223
- */
224
- defaultLocale?: string;
225
- /**
226
- * Sets the active unit system to use for formatting property values with
227
- * units. Default presentation units are used if this is not specified. The active unit
228
- * system can later be changed through [[PresentationManager.activeUnitSystem]] or overriden for each request
229
- * through request options.
230
- */
231
- defaultUnitSystem?: UnitSystemKey;
232
- /**
233
- * A map of default unit formats to use for formatting properties that don't have a presentation format
234
- * in requested unit system.
235
- */
236
- defaultFormats?: {
237
- [phenomenon: string]: UnitSystemFormat;
238
- };
239
- /**
240
- * Should schemas preloading be enabled. If true, presentation manager listens
241
- * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.
242
- *
243
- * @deprecated in 3.x. Use [[PresentationPropsBase.enableSchemasPreload]] instead.
244
- */
245
- enableSchemasPreload?: boolean;
246
- /**
247
- * A number of worker threads to use for handling presentation requests. Defaults to `2`.
248
- */
249
- workerThreadsCount?: number;
250
- /**
251
- * Presentation manager working mode. Backends that use iModels in read-write mode should
252
- * use `ReadWrite`, others might want to set to `ReadOnly` for better performance.
253
- *
254
- * Defaults to [[PresentationManagerMode.ReadWrite]].
255
- *
256
- * @deprecated in 3.x. The attribute is not used by [[PresentationManager]] anymore
257
- */
258
- mode?: PresentationManagerMode;
259
- /**
260
- * The interval (in milliseconds) used to poll for presentation data changes. Only has
261
- * effect in read-write mode (see [[mode]]).
262
- *
263
- * @beta
264
- */
265
- updatesPollInterval?: number;
266
- /** Options for caching. */
267
- caching?: PresentationManagerCachingConfig;
268
- /**
269
- * Use [SQLite's Memory-Mapped I/O](https://sqlite.org/mmap.html) for worker connections. This mode improves performance of handling
270
- * requests with high I/O intensity, e.g. filtering large tables on non-indexed columns. No downsides have been noticed.
271
- *
272
- * 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.
273
- *
274
- * @beta
275
- */
276
- useMmap?: boolean | number;
277
- /**
278
- * An identifier which helps separate multiple presentation managers. It's
279
- * mostly useful in tests where multiple presentation managers can co-exist
280
- * and try to share the same resources, which we don't want. With this identifier
281
- * set, managers put their resources into id-named subdirectories.
282
- *
283
- * @internal
284
- */
285
- id?: string;
286
- /** @internal */
287
- addon?: NativePlatformDefinition;
288
- /**
289
- * Localization function when only backend is used.
290
- * @beta
291
- */
292
- getLocalizedString?: (key: string) => string;
293
- /**
294
- * Parameters for gathering diagnostics at the manager level. When supplied, they're used with every request
295
- * made through the manager.
296
- *
297
- * @see [Diagnostics documentation page]($docs/presentation/advanced/Diagnostics.md)
298
- * @beta
299
- */
300
- diagnostics?: BackendDiagnosticsOptions;
301
- }
302
- /**
303
- * Backend Presentation manager which pulls the presentation data from
304
- * an iModel using native platform.
305
- *
306
- * @public
307
- */
308
- export declare class PresentationManager {
309
- private _props;
310
- private _detail;
311
- private _localizationHelper;
312
- /**
313
- * Get / set active locale used for localizing presentation data
314
- * @deprecated in 3.x. Use [[getLocalizedString]] to localize data returned by [[PresentationManager]].
315
- */
316
- activeLocale: string | undefined;
317
- /**
318
- * Creates an instance of PresentationManager.
319
- * @param props Optional configuration properties.
320
- */
321
- constructor(props?: PresentationManagerProps);
322
- /** Get / set active unit system used to format property values with units */
323
- get activeUnitSystem(): UnitSystemKey | undefined;
324
- set activeUnitSystem(value: UnitSystemKey | undefined);
325
- /** Dispose the presentation manager. Must be called to clean up native resources. */
326
- dispose(): void;
327
- /** @internal */
328
- setOnManagerUsedHandler(handler: () => void): void;
329
- /** Properties used to initialize the manager */
330
- get props(): PresentationManagerProps;
331
- /** Get rulesets manager */
332
- rulesets(): RulesetManager;
333
- /**
334
- * Get ruleset variables manager for specific ruleset
335
- * @param rulesetId Id of the ruleset to get variables manager for
336
- */
337
- vars(rulesetId: string): RulesetVariablesManager;
338
- /** @internal */
339
- getNativePlatform: () => NativePlatformDefinition;
340
- /** @internal */
341
- getDetail(): PresentationManagerDetail;
342
- /** @internal */
343
- getRulesetId(rulesetOrId: Ruleset | string): string;
344
- /**
345
- * Retrieves nodes
346
- * @public
347
- */
348
- getNodes(requestOptions: WithCancelEvent<Prioritized<Paged<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>>> & BackendDiagnosticsAttribute): Promise<Node[]>;
349
- /**
350
- * Retrieves nodes count
351
- * @public
352
- */
353
- getNodesCount(requestOptions: WithCancelEvent<Prioritized<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<number>;
354
- /**
355
- * Retrieves hierarchy level descriptor
356
- * @beta
357
- */
358
- getNodesDescriptor(requestOptions: WithCancelEvent<Prioritized<HierarchyLevelDescriptorRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<Descriptor | undefined>;
359
- /**
360
- * Retrieves paths from root nodes to children nodes according to specified instance key paths. Intersecting paths will be merged.
361
- * TODO: Return results in pages
362
- * @public
363
- */
364
- getNodePaths(requestOptions: WithCancelEvent<Prioritized<FilterByInstancePathsHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<NodePathElement[]>;
365
- /**
366
- * Retrieves paths from root nodes to nodes containing filter text in their label.
367
- * TODO: Return results in pages
368
- * @public
369
- */
370
- getFilteredNodePaths(requestOptions: WithCancelEvent<Prioritized<FilterByTextHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<NodePathElement[]>;
371
- /**
372
- * Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,
373
- * its related instances for loading related and navigation properties.
374
- * @public
375
- */
376
- getContentSources(requestOptions: WithCancelEvent<Prioritized<ContentSourcesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): Promise<SelectClassInfo[]>;
377
- /**
378
- * Retrieves the content descriptor which can be used to get content
379
- * @public
380
- */
381
- getContentDescriptor(requestOptions: WithCancelEvent<Prioritized<ContentDescriptorRequestOptions<IModelDb, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<Descriptor | undefined>;
382
- /**
383
- * Retrieves the content set size based on the supplied content descriptor override
384
- * @public
385
- */
386
- getContentSetSize(requestOptions: WithCancelEvent<Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<number>;
387
- /**
388
- * Retrieves the content based on the supplied content descriptor override.
389
- * @public
390
- */
391
- getContent(requestOptions: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>>> & BackendDiagnosticsAttribute): Promise<Content | undefined>;
392
- /**
393
- * Retrieves distinct values of specific field from the content based on the supplied content descriptor override.
394
- * @param requestOptions Options for the request
395
- * @return A promise object that returns either distinct values on success or an error string on error.
396
- * @public
397
- */
398
- getPagedDistinctValues(requestOptions: WithCancelEvent<Prioritized<DistinctValuesRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<PagedResponse<DisplayValueGroup>>;
399
- /**
400
- * Retrieves property data in a simplified format for a single element specified by ID.
401
- * @public
402
- */
403
- getElementProperties(requestOptions: WithCancelEvent<Prioritized<SingleElementPropertiesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): Promise<ElementProperties | undefined>;
404
- /**
405
- * Retrieves property data in simplified format for multiple elements specified by class or all element.
406
- * @return An object that contains element count and AsyncGenerator to iterate over properties of those elements in batches of undefined size.
407
- * @public
408
- */
409
- getElementProperties(requestOptions: WithCancelEvent<Prioritized<MultiElementPropertiesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): Promise<MultiElementPropertiesResponse>;
410
- private getMultipleElementProperties;
411
- /**
412
- * Retrieves display label definition of specific item
413
- * @public
414
- */
415
- getDisplayLabelDefinition(requestOptions: WithCancelEvent<Prioritized<DisplayLabelRequestOptions<IModelDb, InstanceKey>>> & BackendDiagnosticsAttribute): Promise<LabelDefinition>;
416
- /**
417
- * Retrieves display label definitions of specific items
418
- * @public
419
- */
420
- getDisplayLabelDefinitions(requestOptions: WithCancelEvent<Prioritized<Paged<DisplayLabelsRequestOptions<IModelDb, InstanceKey>>>> & BackendDiagnosticsAttribute): Promise<LabelDefinition[]>;
421
- /**
422
- * Retrieves available selection scopes.
423
- * @public
424
- */
425
- getSelectionScopes(_requestOptions: SelectionScopeRequestOptions<IModelDb> & BackendDiagnosticsAttribute): Promise<SelectionScope[]>;
426
- /**
427
- * Computes selection set based on provided selection scope.
428
- * @public
429
- * @deprecated in 3.x. Use overload with `ComputeSelectionRequestOptions` parameter.
430
- */
431
- computeSelection(requestOptions: SelectionScopeRequestOptions<IModelDb> & {
432
- ids: Id64String[];
433
- scopeId: string;
434
- } & BackendDiagnosticsAttribute): Promise<KeySet>;
435
- /**
436
- * Computes selection based on provided element IDs and selection scope.
437
- * @public
438
- */
439
- computeSelection(requestOptions: ComputeSelectionRequestOptions<IModelDb> & BackendDiagnosticsAttribute): Promise<KeySet>;
440
- /**
441
- * Compares two hierarchies specified in the request options
442
- * @public
443
- */
444
- compareHierarchies(requestOptions: HierarchyCompareOptions<IModelDb, NodeKey>): Promise<HierarchyCompareInfo>;
445
- }
1
+ /** @packageDocumentation
2
+ * @module Core
3
+ */
4
+ import { IModelDb } from "@itwin/core-backend";
5
+ import { Id64String } from "@itwin/core-bentley";
6
+ import { FormatProps, UnitSystemKey } from "@itwin/core-quantity";
7
+ import { ComputeSelectionRequestOptions, Content, ContentDescriptorRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, HierarchyCompareInfo, HierarchyCompareOptions, HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions, InstanceKey, KeySet, LabelDefinition, MultiElementPropertiesRequestOptions, Node, NodeKey, NodePathElement, Paged, PagedResponse, Prioritized, Ruleset, RulesetVariable, SelectClassInfo, SelectionScope, SelectionScopeRequestOptions, SingleElementPropertiesRequestOptions, WithCancelEvent } from "@itwin/presentation-common";
8
+ import { NativePlatformDefinition } from "./NativePlatform";
9
+ import { PresentationManagerDetail } from "./PresentationManagerDetail";
10
+ import { RulesetManager } from "./RulesetManager";
11
+ import { RulesetVariablesManager } from "./RulesetVariablesManager";
12
+ import { BackendDiagnosticsAttribute, BackendDiagnosticsOptions } from "./Utils";
13
+ /**
14
+ * Presentation manager working mode.
15
+ * @public
16
+ * @deprecated in 3.x. The attribute is not used by [[PresentationManager]] anymore
17
+ */
18
+ export declare enum PresentationManagerMode {
19
+ /**
20
+ * Presentation manager assumes iModels are opened in read-only mode and avoids doing some work
21
+ * related to reacting to changes in iModels.
22
+ */
23
+ ReadOnly = 0,
24
+ /**
25
+ * Presentation manager assumes iModels are opened in read-write mode and it may need to
26
+ * react to changes. This involves some additional work and gives slightly worse performance.
27
+ */
28
+ ReadWrite = 1
29
+ }
30
+ /**
31
+ * Presentation hierarchy cache mode.
32
+ * @public
33
+ */
34
+ export declare enum HierarchyCacheMode {
35
+ /**
36
+ * Hierarchy cache is created in memory.
37
+ */
38
+ Memory = "memory",
39
+ /**
40
+ * Hierarchy cache is created on disk. In this mode hierarchy cache is persisted between iModel
41
+ * openings.
42
+ */
43
+ Disk = "disk",
44
+ /**
45
+ * Hierarchy cache is created on disk. In this mode everything is cached in memory while creating hierarchy level
46
+ * and persisted in disk cache when whole hierarchy level is created.
47
+ *
48
+ * **Note:** This mode is still experimental.
49
+ */
50
+ Hybrid = "hybrid"
51
+ }
52
+ /**
53
+ * Configuration for hierarchy cache.
54
+ * @public
55
+ */
56
+ export type HierarchyCacheConfig = MemoryHierarchyCacheConfig | DiskHierarchyCacheConfig | HybridCacheConfig;
57
+ /**
58
+ * Base interface for all [[HierarchyCacheConfig]] implementations.
59
+ * @public
60
+ */
61
+ export interface HierarchyCacheConfigBase {
62
+ mode: HierarchyCacheMode;
63
+ }
64
+ /**
65
+ * Configuration for in-memory hierarchy cache.
66
+ *
67
+ * @see [Memory cache documentation page]($docs/presentation/advanced/Caching.md#memory-cache)
68
+ * @public
69
+ */
70
+ export interface MemoryHierarchyCacheConfig extends HierarchyCacheConfigBase {
71
+ mode: HierarchyCacheMode.Memory;
72
+ }
73
+ /**
74
+ * Configuration for persistent disk hierarchy cache.
75
+ *
76
+ * @see [Disk cache documentation page]($docs/presentation/advanced/Caching.md#disk-cache)
77
+ * @public
78
+ */
79
+ export interface DiskHierarchyCacheConfig extends HierarchyCacheConfigBase {
80
+ mode: HierarchyCacheMode.Disk;
81
+ /**
82
+ * A directory for hierarchy caches. If set, the directory must exist. Relative paths start from `process.cwd()`.
83
+ *
84
+ * The default directory depends on the iModel and the way it's opened.
85
+ */
86
+ directory?: string;
87
+ /**
88
+ * While the cache itself is stored on a disk, there's still a required small in-memory cache.
89
+ * The parameter allows controlling size of that cache. Defaults to `32768000` bytes (32 MB).
90
+ */
91
+ memoryCacheSize?: number;
92
+ }
93
+ /**
94
+ * Configuration for the experimental hybrid hierarchy cache.
95
+ *
96
+ * Hybrid cache uses a combination of in-memory and disk caches, which should make it a better
97
+ * alternative for cases when there are lots of simultaneous requests.
98
+ *
99
+ * @see [Hybrid cache documentation page]($docs/presentation/advanced/Caching.md#hybrid-cache)
100
+ * @public
101
+ */
102
+ export interface HybridCacheConfig extends HierarchyCacheConfigBase {
103
+ mode: HierarchyCacheMode.Hybrid;
104
+ /** Configuration for disk cache used to persist hierarchies. */
105
+ disk?: DiskHierarchyCacheConfig;
106
+ }
107
+ /**
108
+ * Configuration for content cache.
109
+ *
110
+ * @see [Content cache documentation page]($docs/presentation/advanced/Caching.md#content-cache)
111
+ * @public
112
+ */
113
+ export interface ContentCacheConfig {
114
+ /**
115
+ * Maximum number of content descriptors cached in memory for quicker paged content requests.
116
+ *
117
+ * Defaults to `100`.
118
+ */
119
+ size?: number;
120
+ }
121
+ /**
122
+ * Caching configuration options for [[PresentationManager]].
123
+ * @public
124
+ */
125
+ export interface PresentationManagerCachingConfig {
126
+ /**
127
+ * Hierarchies-related caching options.
128
+ *
129
+ * @see [Hierarchies cache documentation page]($docs/presentation/advanced/Caching.md#hierarchies-cache)
130
+ */
131
+ hierarchies?: HierarchyCacheConfig;
132
+ /**
133
+ * Content-related caching options.
134
+ *
135
+ * @see [Content cache documentation page]($docs/presentation/advanced/Caching.md#content-cache)
136
+ */
137
+ content?: ContentCacheConfig;
138
+ /**
139
+ * Each worker thread (see [[workerThreadsCount]]) opens a connection to an iModel used for a request. This
140
+ * means there could be `{workerThreadsCount} * {iModels count}` number of connections. Each connection
141
+ * uses a memory cache to increase iModel read performance. This parameter allows controlling the size of that
142
+ * cache. Defaults to `32768000` bytes (32 MB).
143
+ *
144
+ * @see [Worker connections cache documentation page]($docs/presentation/advanced/Caching.md#worker-connections-cache)
145
+ */
146
+ workerConnectionCacheSize?: number;
147
+ }
148
+ /**
149
+ * A data structure that associates unit systems with a format. The associations are used for
150
+ * assigning default unit formats for specific phenomenons (see [[PresentationManagerProps.defaultFormats]]).
151
+ *
152
+ * @public
153
+ */
154
+ export interface UnitSystemFormat {
155
+ unitSystems: UnitSystemKey[];
156
+ format: FormatProps;
157
+ }
158
+ /**
159
+ * Data structure for multiple element properties request response.
160
+ * @public
161
+ */
162
+ export interface MultiElementPropertiesResponse {
163
+ total: number;
164
+ iterator: () => AsyncGenerator<ElementProperties[]>;
165
+ }
166
+ /**
167
+ * Configuration options for supplying asset paths to [[PresentationManager]].
168
+ * @public
169
+ */
170
+ export interface PresentationAssetsRootConfig {
171
+ /**
172
+ * Path to `presentation-backend` assets. Relative paths start from `process.cwd()`.
173
+ */
174
+ backend: string;
175
+ /**
176
+ * Path to `presentation-common` assets.
177
+ *
178
+ * @deprecated in 3.x. This path is not used anymore
179
+ */
180
+ common: string;
181
+ }
182
+ /**
183
+ * Properties that can be used to configure [[PresentationManager]]
184
+ * @public
185
+ */
186
+ export interface PresentationManagerProps {
187
+ /**
188
+ * Path overrides for presentation backend assets. Need to be overriden by application if it puts these assets someplace else than the default.
189
+ *
190
+ * By default the path to assets directory is determined during the call of [[Presentation.initialize]] using this algorithm:
191
+ *
192
+ * - if path of `.js` file that contains [[PresentationManager]] definition contains "presentation-backend", assume the package is in `node_modules` and the directory structure is:
193
+ * - `assets/*\*\/*`
194
+ * - `presentation-backend/{presentation-backend source files}`
195
+ *
196
+ * which means the assets can be found through a relative path `../assets/` from the JS file being executed.
197
+ *
198
+ * - else, assume the backend is webpacked into a single file with assets next to it:
199
+ * - `assets/*\*\/*`
200
+ * - `{source file being executed}.js`
201
+ *
202
+ * which means the assets can be found through a relative path `./assets/` from the `{source file being executed}`.
203
+ */
204
+ presentationAssetsRoot?: string | PresentationAssetsRootConfig;
205
+ /**
206
+ * A list of directories containing application's presentation rulesets. Relative
207
+ * paths start from `process.cwd()`. The directories are traversed recursively.
208
+ *
209
+ * @note Only files with `.PresentationRuleSet.json` are read.
210
+ */
211
+ rulesetDirectories?: string[];
212
+ /**
213
+ * A list of directories containing application's supplemental presentation rulesets. Relative
214
+ * paths start from `process.cwd()`. The directories are traversed recursively.
215
+ *
216
+ * @note Only files with `.PresentationRuleSet.json` are read.
217
+ */
218
+ supplementalRulesetDirectories?: string[];
219
+ /**
220
+ * A list of directories containing application's locale-specific localized
221
+ * string files (in simplified i18next v3 format)
222
+ *
223
+ * @deprecated in 3.x. Use [[getLocalizedString]] to localize data returned by [[PresentationManager]].
224
+ */
225
+ localeDirectories?: string[];
226
+ /**
227
+ * Sets the active locale to use when localizing presentation-related
228
+ * strings. It can later be changed through [[PresentationManager.activeLocale]].
229
+ *
230
+ * @deprecated in 3.x. Use [[getLocalizedString]] to localize data returned by [[PresentationManager]].
231
+ */
232
+ defaultLocale?: string;
233
+ /**
234
+ * Sets the active unit system to use for formatting property values with
235
+ * units. Default presentation units are used if this is not specified. The active unit
236
+ * system can later be changed through [[PresentationManager.activeUnitSystem]] or overriden for each request
237
+ * through request options.
238
+ */
239
+ defaultUnitSystem?: UnitSystemKey;
240
+ /**
241
+ * A map of default unit formats to use for formatting properties that don't have a presentation format
242
+ * in requested unit system.
243
+ */
244
+ defaultFormats?: {
245
+ [phenomenon: string]: UnitSystemFormat;
246
+ };
247
+ /**
248
+ * Should schemas preloading be enabled. If true, presentation manager listens
249
+ * for `BriefcaseDb.onOpened` event and force pre-loads all ECSchemas.
250
+ *
251
+ * @deprecated in 3.x. Use [[PresentationPropsBase.enableSchemasPreload]] instead.
252
+ */
253
+ enableSchemasPreload?: boolean;
254
+ /**
255
+ * A number of worker threads to use for handling presentation requests. Defaults to `2`.
256
+ */
257
+ workerThreadsCount?: number;
258
+ /**
259
+ * Presentation manager working mode. Backends that use iModels in read-write mode should
260
+ * use `ReadWrite`, others might want to set to `ReadOnly` for better performance.
261
+ *
262
+ * Defaults to [[PresentationManagerMode.ReadWrite]].
263
+ *
264
+ * @deprecated in 3.x. The attribute is not used by [[PresentationManager]] anymore
265
+ */
266
+ mode?: PresentationManagerMode;
267
+ /**
268
+ * The interval (in milliseconds) used to poll for presentation data changes. If not set, presentation
269
+ * data changes are not tracked at all.
270
+ *
271
+ * @beta
272
+ */
273
+ updatesPollInterval?: number;
274
+ /** Options for caching. */
275
+ caching?: PresentationManagerCachingConfig;
276
+ /**
277
+ * Use [SQLite's Memory-Mapped I/O](https://sqlite.org/mmap.html) for worker connections. This mode improves performance of handling
278
+ * requests with high I/O intensity, e.g. filtering large tables on non-indexed columns. No downsides have been noticed.
279
+ *
280
+ * 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.
281
+ *
282
+ * @beta
283
+ */
284
+ useMmap?: boolean | number;
285
+ /**
286
+ * An identifier which helps separate multiple presentation managers. It's
287
+ * mostly useful in tests where multiple presentation managers can co-exist
288
+ * and try to share the same resources, which we don't want. With this identifier
289
+ * set, managers put their resources into id-named subdirectories.
290
+ *
291
+ * @internal
292
+ */
293
+ id?: string;
294
+ /** @internal */
295
+ addon?: NativePlatformDefinition;
296
+ /**
297
+ * 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
298
+ * data is localized on the frontend). Defaults to English localization.
299
+ *
300
+ * @see [Localization]($docs/presentation/advanced/Localization)
301
+ * @beta
302
+ */
303
+ getLocalizedString?: (key: string) => string;
304
+ /**
305
+ * Parameters for gathering diagnostics at the manager level. When supplied, they're used with every request
306
+ * made through the manager.
307
+ *
308
+ * @see [Diagnostics documentation page]($docs/presentation/advanced/Diagnostics.md)
309
+ * @beta
310
+ */
311
+ diagnostics?: BackendDiagnosticsOptions;
312
+ }
313
+ /**
314
+ * Backend Presentation manager which pulls the presentation data from
315
+ * an iModel using native platform.
316
+ *
317
+ * @public
318
+ */
319
+ export declare class PresentationManager {
320
+ private _props;
321
+ private _detail;
322
+ private _localizationHelper;
323
+ /**
324
+ * Get / set active locale used for localizing presentation data
325
+ * @deprecated in 3.x. Use [[PresentationManagerProps.getLocalizedString]] to localize data returned by [[PresentationManager]].
326
+ */
327
+ activeLocale: string | undefined;
328
+ /**
329
+ * Creates an instance of PresentationManager.
330
+ * @param props Optional configuration properties.
331
+ */
332
+ constructor(props?: PresentationManagerProps);
333
+ /** Get / set active unit system used to format property values with units */
334
+ get activeUnitSystem(): UnitSystemKey | undefined;
335
+ set activeUnitSystem(value: UnitSystemKey | undefined);
336
+ /** Dispose the presentation manager. Must be called to clean up native resources. */
337
+ dispose(): void;
338
+ /** @internal */
339
+ setOnManagerUsedHandler(handler: () => void): void;
340
+ /** Properties used to initialize the manager */
341
+ get props(): PresentationManagerProps;
342
+ /** Get rulesets manager */
343
+ rulesets(): RulesetManager;
344
+ /**
345
+ * Get ruleset variables manager for specific ruleset
346
+ * @param rulesetId Id of the ruleset to get variables manager for
347
+ */
348
+ vars(rulesetId: string): RulesetVariablesManager;
349
+ /** @internal */
350
+ getNativePlatform: () => NativePlatformDefinition;
351
+ /** @internal */
352
+ getDetail(): PresentationManagerDetail;
353
+ /** @internal */
354
+ getRulesetId(rulesetOrId: Ruleset | string): string;
355
+ /**
356
+ * Retrieves nodes
357
+ * @public
358
+ */
359
+ getNodes(requestOptions: WithCancelEvent<Prioritized<Paged<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>>> & BackendDiagnosticsAttribute): Promise<Node[]>;
360
+ /**
361
+ * Retrieves nodes count
362
+ * @public
363
+ */
364
+ getNodesCount(requestOptions: WithCancelEvent<Prioritized<HierarchyRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<number>;
365
+ /**
366
+ * Retrieves hierarchy level descriptor
367
+ * @beta
368
+ */
369
+ getNodesDescriptor(requestOptions: WithCancelEvent<Prioritized<HierarchyLevelDescriptorRequestOptions<IModelDb, NodeKey, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<Descriptor | undefined>;
370
+ /**
371
+ * Retrieves paths from root nodes to children nodes according to specified instance key paths. Intersecting paths will be merged.
372
+ * TODO: Return results in pages
373
+ * @public
374
+ */
375
+ getNodePaths(requestOptions: WithCancelEvent<Prioritized<FilterByInstancePathsHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<NodePathElement[]>;
376
+ /**
377
+ * Retrieves paths from root nodes to nodes containing filter text in their label.
378
+ * TODO: Return results in pages
379
+ * @public
380
+ */
381
+ getFilteredNodePaths(requestOptions: WithCancelEvent<Prioritized<FilterByTextHierarchyRequestOptions<IModelDb, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<NodePathElement[]>;
382
+ /**
383
+ * Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,
384
+ * its related instances for loading related and navigation properties.
385
+ * @public
386
+ */
387
+ getContentSources(requestOptions: WithCancelEvent<Prioritized<ContentSourcesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): Promise<SelectClassInfo[]>;
388
+ /**
389
+ * Retrieves the content descriptor which can be used to get content
390
+ * @public
391
+ */
392
+ getContentDescriptor(requestOptions: WithCancelEvent<Prioritized<ContentDescriptorRequestOptions<IModelDb, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<Descriptor | undefined>;
393
+ /**
394
+ * Retrieves the content set size based on the supplied content descriptor override
395
+ * @public
396
+ */
397
+ getContentSetSize(requestOptions: WithCancelEvent<Prioritized<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<number>;
398
+ /**
399
+ * Retrieves the content based on the supplied content descriptor override.
400
+ * @public
401
+ */
402
+ getContent(requestOptions: WithCancelEvent<Prioritized<Paged<ContentRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>>> & BackendDiagnosticsAttribute): Promise<Content | undefined>;
403
+ /**
404
+ * Retrieves distinct values of specific field from the content based on the supplied content descriptor override.
405
+ * @param requestOptions Options for the request
406
+ * @return A promise object that returns either distinct values on success or an error string on error.
407
+ * @public
408
+ */
409
+ getPagedDistinctValues(requestOptions: WithCancelEvent<Prioritized<DistinctValuesRequestOptions<IModelDb, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>>> & BackendDiagnosticsAttribute): Promise<PagedResponse<DisplayValueGroup>>;
410
+ /**
411
+ * Retrieves property data in a simplified format for a single element specified by ID.
412
+ * @public
413
+ */
414
+ getElementProperties(requestOptions: WithCancelEvent<Prioritized<SingleElementPropertiesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): Promise<ElementProperties | undefined>;
415
+ /**
416
+ * Retrieves property data in simplified format for multiple elements specified by class or all element.
417
+ * @return An object that contains element count and AsyncGenerator to iterate over properties of those elements in batches of undefined size.
418
+ * @public
419
+ */
420
+ getElementProperties(requestOptions: WithCancelEvent<Prioritized<MultiElementPropertiesRequestOptions<IModelDb>>> & BackendDiagnosticsAttribute): Promise<MultiElementPropertiesResponse>;
421
+ private getMultipleElementProperties;
422
+ /**
423
+ * Retrieves display label definition of specific item
424
+ * @public
425
+ */
426
+ getDisplayLabelDefinition(requestOptions: WithCancelEvent<Prioritized<DisplayLabelRequestOptions<IModelDb, InstanceKey>>> & BackendDiagnosticsAttribute): Promise<LabelDefinition>;
427
+ /**
428
+ * Retrieves display label definitions of specific items
429
+ * @public
430
+ */
431
+ getDisplayLabelDefinitions(requestOptions: WithCancelEvent<Prioritized<Paged<DisplayLabelsRequestOptions<IModelDb, InstanceKey>>>> & BackendDiagnosticsAttribute): Promise<LabelDefinition[]>;
432
+ /**
433
+ * Retrieves available selection scopes.
434
+ * @public
435
+ */
436
+ getSelectionScopes(_requestOptions: SelectionScopeRequestOptions<IModelDb> & BackendDiagnosticsAttribute): Promise<SelectionScope[]>;
437
+ /**
438
+ * Computes selection set based on provided selection scope.
439
+ * @public
440
+ * @deprecated in 3.x. Use overload with `ComputeSelectionRequestOptions` parameter.
441
+ */
442
+ computeSelection(requestOptions: SelectionScopeRequestOptions<IModelDb> & {
443
+ ids: Id64String[];
444
+ scopeId: string;
445
+ } & BackendDiagnosticsAttribute): Promise<KeySet>;
446
+ /**
447
+ * Computes selection based on provided element IDs and selection scope.
448
+ * @public
449
+ */
450
+ computeSelection(requestOptions: ComputeSelectionRequestOptions<IModelDb> & BackendDiagnosticsAttribute): Promise<KeySet>;
451
+ /**
452
+ * Compares two hierarchies specified in the request options
453
+ * @public
454
+ */
455
+ compareHierarchies(requestOptions: HierarchyCompareOptions<IModelDb, NodeKey>): Promise<HierarchyCompareInfo>;
456
+ }
446
457
  //# sourceMappingURL=PresentationManager.d.ts.map