@itwin/presentation-backend 3.5.0-dev.4 → 3.5.0-dev.7

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