@itwin/presentation-frontend 5.0.0-dev.10 → 5.0.0-dev.100

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 (163) hide show
  1. package/CHANGELOG.md +58 -1
  2. package/lib/cjs/package.json +1 -0
  3. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts +3 -3
  4. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts.map +1 -1
  5. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js +11 -9
  6. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  7. package/lib/cjs/presentation-frontend/Diagnostics.js.map +1 -1
  8. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
  9. package/lib/cjs/presentation-frontend/IModelConnectionInitialization.d.ts +13 -0
  10. package/lib/cjs/presentation-frontend/IModelConnectionInitialization.d.ts.map +1 -0
  11. package/lib/cjs/presentation-frontend/IModelConnectionInitialization.js +22 -0
  12. package/lib/cjs/presentation-frontend/IModelConnectionInitialization.js.map +1 -0
  13. package/lib/cjs/presentation-frontend/InternalSymbols.d.ts +6 -0
  14. package/lib/cjs/presentation-frontend/InternalSymbols.d.ts.map +1 -0
  15. package/lib/cjs/presentation-frontend/InternalSymbols.js +17 -0
  16. package/lib/cjs/presentation-frontend/InternalSymbols.js.map +1 -0
  17. package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts +12 -3
  18. package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
  19. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +7 -7
  20. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  21. package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts +1 -1
  22. package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts.map +1 -1
  23. package/lib/cjs/presentation-frontend/LocalizationHelper.js +7 -6
  24. package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
  25. package/lib/cjs/presentation-frontend/Presentation.d.ts +15 -14
  26. package/lib/cjs/presentation-frontend/Presentation.d.ts.map +1 -1
  27. package/lib/cjs/presentation-frontend/Presentation.js +31 -45
  28. package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
  29. package/lib/cjs/presentation-frontend/PresentationManager.d.ts +12 -23
  30. package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
  31. package/lib/cjs/presentation-frontend/PresentationManager.js +77 -74
  32. package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
  33. package/lib/cjs/presentation-frontend/RulesetManager.js +2 -4
  34. package/lib/cjs/presentation-frontend/RulesetManager.js.map +1 -1
  35. package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts +2 -4
  36. package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
  37. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js +6 -4
  38. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  39. package/lib/cjs/presentation-frontend/StreamedResponseGenerator.d.ts +1 -1
  40. package/lib/cjs/presentation-frontend/StreamedResponseGenerator.d.ts.map +1 -1
  41. package/lib/cjs/presentation-frontend/StreamedResponseGenerator.js +1 -0
  42. package/lib/cjs/presentation-frontend/StreamedResponseGenerator.js.map +1 -1
  43. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +9 -19
  44. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  45. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +163 -153
  46. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  47. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +4 -5
  48. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
  49. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +27 -29
  50. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  51. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts +3 -0
  52. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
  53. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +8 -2
  54. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  55. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts +2 -1
  56. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts.map +1 -1
  57. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js +1 -0
  58. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  59. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts +5 -1
  60. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
  61. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js +3 -0
  62. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  63. package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts +8 -5
  64. package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
  65. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +35 -13
  66. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  67. package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts +2 -0
  68. package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
  69. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +3 -1
  70. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  71. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +31 -13
  72. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
  73. package/lib/cjs/presentation-frontend/selection/SelectionManager.js +216 -116
  74. package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
  75. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +11 -9
  76. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
  77. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +6 -11
  78. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  79. package/lib/cjs/presentation-frontend.d.ts +15 -15
  80. package/lib/cjs/presentation-frontend.d.ts.map +1 -1
  81. package/lib/cjs/presentation-frontend.js +30 -29
  82. package/lib/cjs/presentation-frontend.js.map +1 -1
  83. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts +3 -3
  84. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts.map +1 -1
  85. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js +11 -9
  86. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  87. package/lib/esm/presentation-frontend/Diagnostics.js.map +1 -1
  88. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
  89. package/lib/esm/presentation-frontend/IModelConnectionInitialization.d.ts +13 -0
  90. package/lib/esm/presentation-frontend/IModelConnectionInitialization.d.ts.map +1 -0
  91. package/lib/esm/presentation-frontend/IModelConnectionInitialization.js +17 -0
  92. package/lib/esm/presentation-frontend/IModelConnectionInitialization.js.map +1 -0
  93. package/lib/esm/presentation-frontend/InternalSymbols.d.ts +6 -0
  94. package/lib/esm/presentation-frontend/InternalSymbols.d.ts.map +1 -0
  95. package/lib/esm/presentation-frontend/InternalSymbols.js +14 -0
  96. package/lib/esm/presentation-frontend/InternalSymbols.js.map +1 -0
  97. package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts +12 -3
  98. package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
  99. package/lib/esm/presentation-frontend/IpcRequestsHandler.js +8 -8
  100. package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  101. package/lib/esm/presentation-frontend/LocalizationHelper.d.ts +1 -1
  102. package/lib/esm/presentation-frontend/LocalizationHelper.d.ts.map +1 -1
  103. package/lib/esm/presentation-frontend/LocalizationHelper.js +3 -2
  104. package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
  105. package/lib/esm/presentation-frontend/Presentation.d.ts +15 -14
  106. package/lib/esm/presentation-frontend/Presentation.d.ts.map +1 -1
  107. package/lib/esm/presentation-frontend/Presentation.js +24 -38
  108. package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
  109. package/lib/esm/presentation-frontend/PresentationManager.d.ts +12 -23
  110. package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
  111. package/lib/esm/presentation-frontend/PresentationManager.js +66 -63
  112. package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
  113. package/lib/esm/presentation-frontend/RulesetManager.js +2 -4
  114. package/lib/esm/presentation-frontend/RulesetManager.js.map +1 -1
  115. package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts +2 -4
  116. package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
  117. package/lib/esm/presentation-frontend/RulesetVariablesManager.js +6 -4
  118. package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  119. package/lib/esm/presentation-frontend/StreamedResponseGenerator.d.ts +1 -1
  120. package/lib/esm/presentation-frontend/StreamedResponseGenerator.d.ts.map +1 -1
  121. package/lib/esm/presentation-frontend/StreamedResponseGenerator.js +1 -0
  122. package/lib/esm/presentation-frontend/StreamedResponseGenerator.js.map +1 -1
  123. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +9 -19
  124. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  125. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +164 -154
  126. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  127. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +4 -5
  128. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
  129. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +27 -29
  130. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  131. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts +3 -0
  132. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
  133. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +8 -2
  134. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  135. package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts +2 -1
  136. package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts.map +1 -1
  137. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js +1 -0
  138. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  139. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts +5 -1
  140. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
  141. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js +3 -0
  142. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  143. package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts +8 -5
  144. package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
  145. package/lib/esm/presentation-frontend/selection/SelectionHandler.js +35 -13
  146. package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  147. package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts +2 -0
  148. package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
  149. package/lib/esm/presentation-frontend/selection/SelectionHelper.js +3 -1
  150. package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  151. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +31 -13
  152. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
  153. package/lib/esm/presentation-frontend/selection/SelectionManager.js +202 -102
  154. package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
  155. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +11 -9
  156. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
  157. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +7 -11
  158. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  159. package/lib/esm/presentation-frontend.d.ts +15 -15
  160. package/lib/esm/presentation-frontend.d.ts.map +1 -1
  161. package/lib/esm/presentation-frontend.js +12 -15
  162. package/lib/esm/presentation-frontend.js.map +1 -1
  163. package/package.json +42 -42
@@ -11,12 +11,15 @@ exports.PresentationManager = void 0;
11
11
  const core_bentley_1 = require("@itwin/core-bentley");
12
12
  const core_frontend_1 = require("@itwin/core-frontend");
13
13
  const presentation_common_1 = require("@itwin/presentation-common");
14
- const IpcRequestsHandler_1 = require("./IpcRequestsHandler");
15
- const LocalizationHelper_1 = require("./LocalizationHelper");
16
- const RulesetManager_1 = require("./RulesetManager");
17
- const RulesetVariablesManager_1 = require("./RulesetVariablesManager");
18
- const StreamedResponseGenerator_1 = require("./StreamedResponseGenerator");
14
+ const internal_1 = require("@itwin/presentation-common/internal");
19
15
  const unified_selection_1 = require("@itwin/unified-selection");
16
+ const IpcRequestsHandler_js_1 = require("./IpcRequestsHandler.js");
17
+ const LocalizationHelper_js_1 = require("./LocalizationHelper.js");
18
+ const RulesetManager_js_1 = require("./RulesetManager.js");
19
+ const RulesetVariablesManager_js_1 = require("./RulesetVariablesManager.js");
20
+ const StreamedResponseGenerator_js_1 = require("./StreamedResponseGenerator.js");
21
+ const IModelConnectionInitialization_js_1 = require("./IModelConnectionInitialization.js");
22
+ const InternalSymbols_js_1 = require("./InternalSymbols.js");
20
23
  /**
21
24
  * Frontend Presentation manager which basically just forwards all calls to
22
25
  * the backend implementation.
@@ -24,6 +27,23 @@ const unified_selection_1 = require("@itwin/unified-selection");
24
27
  * @public
25
28
  */
26
29
  class PresentationManager {
30
+ _requestsHandler;
31
+ _rulesets;
32
+ _localizationHelper;
33
+ _explicitActiveUnitSystem;
34
+ _rulesetVars;
35
+ _clearEventListener;
36
+ _schemaContextProvider;
37
+ _defaultFormats;
38
+ _ipcRequestsHandler;
39
+ /**
40
+ * An event raised when hierarchies created using specific ruleset change
41
+ */
42
+ onIModelHierarchyChanged = new core_bentley_1.BeEvent();
43
+ /**
44
+ * An event raised when content created using specific ruleset changes
45
+ */
46
+ onIModelContentChanged = new core_bentley_1.BeEvent();
27
47
  /**
28
48
  * Get / set active unit system used to format property values with units.
29
49
  *
@@ -38,33 +58,22 @@ class PresentationManager {
38
58
  this._explicitActiveUnitSystem = value;
39
59
  }
40
60
  constructor(props) {
41
- /**
42
- * An event raised when hierarchies created using specific ruleset change
43
- */
44
- this.onIModelHierarchyChanged = new core_bentley_1.BeEvent();
45
- /**
46
- * An event raised when content created using specific ruleset changes
47
- */
48
- this.onIModelContentChanged = new core_bentley_1.BeEvent();
49
- this.onUpdate = (_evt, report) => {
50
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
51
- this.handleUpdateAsync(report);
52
- };
53
61
  if (props) {
54
62
  // eslint-disable-next-line @typescript-eslint/no-deprecated
55
63
  this._explicitActiveUnitSystem = props.activeUnitSystem;
56
64
  }
57
65
  this._requestsHandler =
58
- props?.rpcRequestsHandler ?? new presentation_common_1.RpcRequestsHandler(props ? { clientId: props.clientId, timeout: props.requestTimeout } : undefined);
66
+ props?.rpcRequestsHandler ??
67
+ new internal_1.RpcRequestsHandler(props ? { clientId: props.clientId, timeout: props.requestTimeout } : undefined);
59
68
  this._rulesetVars = new Map();
60
- this._rulesets = RulesetManager_1.RulesetManagerImpl.create();
61
- this._localizationHelper = new LocalizationHelper_1.FrontendLocalizationHelper(props?.activeLocale);
69
+ this._rulesets = RulesetManager_js_1.RulesetManagerImpl.create();
70
+ this._localizationHelper = new LocalizationHelper_js_1.FrontendLocalizationHelper(props?.activeLocale);
62
71
  this._schemaContextProvider = props?.schemaContextProvider;
63
72
  this._defaultFormats = props?.defaultFormats;
64
73
  if (core_frontend_1.IpcApp.isValid) {
65
74
  // Ipc only works in ipc apps, so the `onUpdate` callback will only be called there.
66
- this._clearEventListener = core_frontend_1.IpcApp.addListener(presentation_common_1.PresentationIpcEvents.Update, this.onUpdate);
67
- this._ipcRequestsHandler = props?.ipcRequestsHandler ?? new IpcRequestsHandler_1.IpcRequestsHandler(this._requestsHandler.clientId);
75
+ this._clearEventListener = core_frontend_1.IpcApp.addListener(internal_1.PresentationIpcEvents.Update, this.onUpdate);
76
+ this._ipcRequestsHandler = props?.ipcRequestsHandler ?? new IpcRequestsHandler_js_1.IpcRequestsHandler(this._requestsHandler.clientId);
68
77
  }
69
78
  }
70
79
  /** Get / set active locale used for localizing presentation data */
@@ -74,22 +83,31 @@ class PresentationManager {
74
83
  set activeLocale(locale) {
75
84
  this._localizationHelper.locale = locale;
76
85
  }
77
- dispose() {
86
+ [Symbol.dispose]() {
78
87
  if (this._clearEventListener) {
79
88
  this._clearEventListener();
80
89
  this._clearEventListener = undefined;
81
90
  }
82
91
  }
92
+ /** @deprecated in 5.0 Use [Symbol.dispose] instead. */
93
+ /* c8 ignore next 3 */
94
+ dispose() {
95
+ this[Symbol.dispose]();
96
+ }
97
+ onUpdate = (_evt, report) => {
98
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
99
+ this.handleUpdateAsync(report);
100
+ };
83
101
  /** @note This is only called in native apps after changes in iModels */
84
102
  async handleUpdateAsync(report) {
85
103
  for (const imodelKey in report) {
86
- // istanbul ignore if
104
+ /* c8 ignore next 3 */
87
105
  if (!report.hasOwnProperty(imodelKey)) {
88
106
  continue;
89
107
  }
90
108
  const imodelReport = report[imodelKey];
91
109
  for (const rulesetId in imodelReport) {
92
- // istanbul ignore if
110
+ /* c8 ignore next 3 */
93
111
  if (!imodelReport.hasOwnProperty(rulesetId)) {
94
112
  continue;
95
113
  }
@@ -103,17 +121,6 @@ class PresentationManager {
103
121
  }
104
122
  }
105
123
  }
106
- /**
107
- * Function that is called when a new IModelConnection is used to retrieve data.
108
- * @internal
109
- */
110
- startIModelInitialization(_) { }
111
- /**
112
- * Function that should be called to finish initialization that was started at [[PresentationManager.startIModelInitialization]].
113
- * Can be removed when [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]] are removed.
114
- * @internal
115
- */
116
- async ensureIModelInitialized(_) { }
117
124
  /**
118
125
  * Create a new PresentationManager instance
119
126
  * @param props Optional properties used to configure the manager
@@ -122,11 +129,11 @@ class PresentationManager {
122
129
  return new PresentationManager(props);
123
130
  }
124
131
  /** @internal */
125
- get rpcRequestsHandler() {
132
+ get [InternalSymbols_js_1._presentation_manager_rpcRequestsHandler]() {
126
133
  return this._requestsHandler;
127
134
  }
128
135
  /** @internal */
129
- get ipcRequestsHandler() {
136
+ get [InternalSymbols_js_1._presentation_manager_ipcRequestsHandler]() {
130
137
  return this._ipcRequestsHandler;
131
138
  }
132
139
  /**
@@ -141,7 +148,7 @@ class PresentationManager {
141
148
  */
142
149
  vars(rulesetId) {
143
150
  if (!this._rulesetVars.has(rulesetId)) {
144
- const varsManager = new RulesetVariablesManager_1.RulesetVariablesManagerImpl(rulesetId, this._ipcRequestsHandler);
151
+ const varsManager = new RulesetVariablesManager_js_1.RulesetVariablesManagerImpl(rulesetId, this._ipcRequestsHandler);
145
152
  this._rulesetVars.set(rulesetId, varsManager);
146
153
  }
147
154
  return this._rulesetVars.get(rulesetId);
@@ -192,17 +199,16 @@ class PresentationManager {
192
199
  }
193
200
  /** Returns an iterator that polls nodes asynchronously. */
194
201
  async getNodesIterator(requestOptions) {
195
- this.startIModelInitialization(requestOptions.imodel);
202
+ (0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
196
203
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
197
204
  const rpcOptions = this.toRpcTokenOptions({ ...options });
198
- const generator = new StreamedResponseGenerator_1.StreamedResponseGenerator({
205
+ const generator = new StreamedResponseGenerator_js_1.StreamedResponseGenerator({
199
206
  ...requestOptions,
200
207
  getBatch: async (paging) => {
201
208
  const result = await this._requestsHandler.getPagedNodes({ ...rpcOptions, paging });
202
209
  return {
203
210
  total: result.total,
204
- // eslint-disable-next-line @typescript-eslint/no-deprecated
205
- items: this._localizationHelper.getLocalizedNodes(result.items.map(presentation_common_1.Node.fromJSON)),
211
+ items: this._localizationHelper.getLocalizedNodes(result.items),
206
212
  };
207
213
  },
208
214
  });
@@ -218,7 +224,7 @@ class PresentationManager {
218
224
  }
219
225
  /** Retrieves nodes count. */
220
226
  async getNodesCount(requestOptions) {
221
- this.startIModelInitialization(requestOptions.imodel);
227
+ (0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
222
228
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
223
229
  const rpcOptions = this.toRpcTokenOptions({ ...options });
224
230
  return this._requestsHandler.getNodesCount(rpcOptions);
@@ -239,7 +245,7 @@ class PresentationManager {
239
245
  * @public
240
246
  */
241
247
  async getNodesDescriptor(requestOptions) {
242
- this.startIModelInitialization(requestOptions.imodel);
248
+ (0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
243
249
  try {
244
250
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
245
251
  const rpcOptions = this.toRpcTokenOptions({ ...options });
@@ -248,25 +254,23 @@ class PresentationManager {
248
254
  return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;
249
255
  }
250
256
  finally {
251
- await this.ensureIModelInitialized(requestOptions.imodel);
257
+ await (0, IModelConnectionInitialization_js_1.ensureIModelInitialized)(requestOptions.imodel);
252
258
  }
253
259
  }
254
260
  /** Retrieves paths from root nodes to children nodes according to specified keys. Intersecting paths will be merged. */
255
261
  async getNodePaths(requestOptions) {
256
- this.startIModelInitialization(requestOptions.imodel);
262
+ (0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
257
263
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
258
264
  const rpcOptions = this.toRpcTokenOptions({ ...options });
259
265
  const result = await this._requestsHandler.getNodePaths(rpcOptions);
260
- // eslint-disable-next-line @typescript-eslint/no-deprecated
261
- return result.map(presentation_common_1.NodePathElement.fromJSON).map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));
266
+ return result.map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));
262
267
  }
263
268
  /** Retrieves paths from root nodes to nodes containing filter text in their label. */
264
269
  async getFilteredNodePaths(requestOptions) {
265
- this.startIModelInitialization(requestOptions.imodel);
270
+ (0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
266
271
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
267
272
  const result = await this._requestsHandler.getFilteredNodePaths(this.toRpcTokenOptions(options));
268
- // eslint-disable-next-line @typescript-eslint/no-deprecated
269
- return result.map(presentation_common_1.NodePathElement.fromJSON).map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));
273
+ return result.map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));
270
274
  }
271
275
  /**
272
276
  * Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,
@@ -274,14 +278,14 @@ class PresentationManager {
274
278
  * @public
275
279
  */
276
280
  async getContentSources(requestOptions) {
277
- this.startIModelInitialization(requestOptions.imodel);
281
+ (0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
278
282
  const rpcOptions = this.toRpcTokenOptions(requestOptions);
279
283
  const result = await this._requestsHandler.getContentSources(rpcOptions);
280
- return presentation_common_1.SelectClassInfo.listFromCompressedJSON(result.sources, result.classesMap);
284
+ return result.sources.map((sourceJson) => presentation_common_1.SelectClassInfo.fromCompressedJSON(sourceJson, result.classesMap));
281
285
  }
282
286
  /** Retrieves the content descriptor which describes the content and can be used to customize it. */
283
287
  async getContentDescriptor(requestOptions) {
284
- this.startIModelInitialization(requestOptions.imodel);
288
+ (0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
285
289
  try {
286
290
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
287
291
  const rpcOptions = this.toRpcTokenOptions({
@@ -293,12 +297,12 @@ class PresentationManager {
293
297
  return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;
294
298
  }
295
299
  finally {
296
- await this.ensureIModelInitialized(requestOptions.imodel);
300
+ await (0, IModelConnectionInitialization_js_1.ensureIModelInitialized)(requestOptions.imodel);
297
301
  }
298
302
  }
299
303
  /** Retrieves overall content set size. */
300
304
  async getContentSetSize(requestOptions) {
301
- this.startIModelInitialization(requestOptions.imodel);
305
+ (0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
302
306
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
303
307
  const rpcOptions = this.toRpcTokenOptions({
304
308
  ...options,
@@ -320,7 +324,7 @@ class PresentationManager {
320
324
  let contentFormatter;
321
325
  if (!requestOptions.omitFormattedValues && this._schemaContextProvider) {
322
326
  const koqPropertyFormatter = new presentation_common_1.KoqPropertyValueFormatter(this._schemaContextProvider(requestOptions.imodel), this._defaultFormats);
323
- contentFormatter = new presentation_common_1.ContentFormatter(new presentation_common_1.ContentPropertyValueFormatter(koqPropertyFormatter), requestOptions.unitSystem ?? this._explicitActiveUnitSystem ?? core_frontend_1.IModelApp.quantityFormatter.activeUnitSystem);
327
+ contentFormatter = new internal_1.ContentFormatter(new internal_1.ContentPropertyValueFormatter(koqPropertyFormatter), requestOptions.unitSystem ?? this._explicitActiveUnitSystem ?? core_frontend_1.IModelApp.quantityFormatter.activeUnitSystem);
324
328
  }
325
329
  let descriptor = requestOptions.descriptor instanceof presentation_common_1.Descriptor ? requestOptions.descriptor : undefined;
326
330
  let firstPage;
@@ -332,7 +336,7 @@ class PresentationManager {
332
336
  descriptor = presentation_common_1.Descriptor.fromJSON(firstPageResponse?.descriptor);
333
337
  firstPage = firstPageResponse?.contentSet;
334
338
  }
335
- // istanbul ignore if
339
+ /* c8 ignore next 3 */
336
340
  if (!descriptor) {
337
341
  return undefined;
338
342
  }
@@ -350,7 +354,7 @@ class PresentationManager {
350
354
  items,
351
355
  };
352
356
  };
353
- const generator = new StreamedResponseGenerator_1.StreamedResponseGenerator({
357
+ const generator = new StreamedResponseGenerator_js_1.StreamedResponseGenerator({
354
358
  ...requestOptions,
355
359
  getBatch: getPage,
356
360
  });
@@ -361,12 +365,12 @@ class PresentationManager {
361
365
  }
362
366
  /** Retrieves a content descriptor, item count and async generator for the items themselves. */
363
367
  async getContentIterator(requestOptions) {
364
- this.startIModelInitialization(requestOptions.imodel);
368
+ (0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
365
369
  const response = await this.getContentIteratorInternal(requestOptions);
366
370
  if (!response) {
367
371
  return undefined;
368
372
  }
369
- await this.ensureIModelInitialized(requestOptions.imodel);
373
+ await (0, IModelConnectionInitialization_js_1.ensureIModelInitialized)(requestOptions.imodel);
370
374
  return response;
371
375
  }
372
376
  /**
@@ -395,21 +399,20 @@ class PresentationManager {
395
399
  }
396
400
  /** Returns an iterator that asynchronously polls distinct values of specific field from the content. */
397
401
  async getDistinctValuesIterator(requestOptions) {
398
- this.startIModelInitialization(requestOptions.imodel);
402
+ (0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
399
403
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
400
404
  const rpcOptions = {
401
405
  ...this.toRpcTokenOptions(options),
402
406
  descriptor: getDescriptorOverrides(options.descriptor),
403
407
  keys: stripTransientElementKeys(options.keys).toJSON(),
404
408
  };
405
- const generator = new StreamedResponseGenerator_1.StreamedResponseGenerator({
409
+ const generator = new StreamedResponseGenerator_js_1.StreamedResponseGenerator({
406
410
  ...requestOptions,
407
411
  getBatch: async (paging) => {
408
412
  const response = await this._requestsHandler.getPagedDistinctValues({ ...rpcOptions, paging });
409
413
  return {
410
414
  total: response.total,
411
- // eslint-disable-next-line @typescript-eslint/no-deprecated
412
- items: response.items.map((x) => this._localizationHelper.getLocalizedDisplayValueGroup(presentation_common_1.DisplayValueGroup.fromJSON(x))),
415
+ items: response.items.map((x) => this._localizationHelper.getLocalizedDisplayValueGroup(x)),
413
416
  };
414
417
  },
415
418
  });
@@ -431,9 +434,9 @@ class PresentationManager {
431
434
  * @public
432
435
  */
433
436
  async getElementProperties(requestOptions) {
434
- this.startIModelInitialization(requestOptions.imodel);
437
+ (0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
435
438
  const { elementId, contentParser, ...optionsNoElementId } = requestOptions;
436
- const parser = contentParser ?? presentation_common_1.buildElementProperties;
439
+ const parser = contentParser ?? internal_1.buildElementProperties;
437
440
  const iter = await this.getContentIterator({
438
441
  ...optionsNoElementId,
439
442
  descriptor: {
@@ -453,13 +456,13 @@ class PresentationManager {
453
456
  * @public
454
457
  */
455
458
  async getContentInstanceKeys(requestOptions) {
456
- this.startIModelInitialization(requestOptions.imodel);
459
+ (0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
457
460
  const options = await this.addRulesetAndVariablesToOptions(requestOptions);
458
461
  const rpcOptions = {
459
462
  ...this.toRpcTokenOptions(options),
460
463
  keys: stripTransientElementKeys(options.keys).toJSON(),
461
464
  };
462
- const generator = new StreamedResponseGenerator_1.StreamedResponseGenerator({
465
+ const generator = new StreamedResponseGenerator_js_1.StreamedResponseGenerator({
463
466
  ...requestOptions,
464
467
  getBatch: async (page) => {
465
468
  const keys = await this._requestsHandler.getContentInstanceKeys({ ...rpcOptions, paging: page });
@@ -484,16 +487,16 @@ class PresentationManager {
484
487
  }
485
488
  /** Retrieves display label definition of specific item. */
486
489
  async getDisplayLabelDefinition(requestOptions) {
487
- this.startIModelInitialization(requestOptions.imodel);
490
+ (0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
488
491
  const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });
489
492
  const result = await this._requestsHandler.getDisplayLabelDefinition(rpcOptions);
490
493
  return this._localizationHelper.getLocalizedLabelDefinition(result);
491
494
  }
492
495
  /** Retrieves display label definition of specific items. */
493
496
  async getDisplayLabelDefinitionsIterator(requestOptions) {
494
- this.startIModelInitialization(requestOptions.imodel);
497
+ (0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
495
498
  const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });
496
- const generator = new StreamedResponseGenerator_1.StreamedResponseGenerator({
499
+ const generator = new StreamedResponseGenerator_js_1.StreamedResponseGenerator({
497
500
  ...requestOptions,
498
501
  getBatch: async (page) => {
499
502
  const partialKeys = !page.start ? rpcOptions.keys : rpcOptions.keys.slice(page.start);
@@ -528,7 +531,7 @@ const stripTransientElementKeys = (keys) => {
528
531
  copy.add(keys, (key) => {
529
532
  // the callback is not going to be called with EntityProps as KeySet converts them
530
533
  // to InstanceKeys, but we want to keep the EntityProps case for correctness
531
- // istanbul ignore next
534
+ /* c8 ignore next 3 */
532
535
  const isTransient = (presentation_common_1.Key.isInstanceKey(key) && key.className === unified_selection_1.TRANSIENT_ELEMENT_CLASSNAME) ||
533
536
  (presentation_common_1.Key.isEntityProps(key) && key.classFullName === unified_selection_1.TRANSIENT_ELEMENT_CLASSNAME);
534
537
  return !isTransient;
@@ -1 +1 @@
1
- {"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAAmG;AACnG,wDAA2E;AAG3E,oEA+CoC;AACpC,6DAA0D;AAC1D,6DAAkE;AAClE,qDAAsE;AACtE,uEAAiG;AACjG,2EAAwE;AACxE,gEAAuE;AA8HvE;;;;;GAKG;AACH,MAAa,mBAAmB;IAqB9B;;;;;;OAMG;IACH,IAAW,gBAAgB;QACzB,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WAAW,GACf,CAAC,yBAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,SAAS,KAAK,+CAA2B,CAAC;YACzE,CAAC,yBAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,aAAa,KAAK,+CAA2B,CAAC,CAAC;QAChF,OAAO,CAAC,WAAW,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,KAAK,UAAU,OAAO,CAAI,IAAsB;IAC9C,MAAM,MAAM,GAAG,IAAI,KAAK,EAAK,CAAC;IAC9B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { BeEvent, CompressedId64Set, IDisposable, OrderedId64Iterable } from \"@itwin/core-bentley\";\r\nimport { IModelApp, IModelConnection, IpcApp } from \"@itwin/core-frontend\";\r\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport { SchemaContext } from \"@itwin/ecschema-metadata\";\r\nimport {\r\n buildElementProperties,\r\n ClientDiagnosticsAttribute,\r\n Content,\r\n ContentDescriptorRequestOptions,\r\n ContentFlags,\r\n ContentFormatter,\r\n ContentInstanceKeysRequestOptions,\r\n ContentPropertyValueFormatter,\r\n ContentRequestOptions,\r\n ContentSourcesRequestOptions,\r\n ContentUpdateInfo,\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 HierarchyLevelDescriptorRequestOptions,\r\n HierarchyRequestOptions,\r\n HierarchyUpdateInfo,\r\n InstanceKey,\r\n Item,\r\n ItemJSON,\r\n Key,\r\n KeySet,\r\n KoqPropertyValueFormatter,\r\n LabelDefinition,\r\n Node,\r\n NodeKey,\r\n NodePathElement,\r\n Paged,\r\n PagedResponse,\r\n PageOptions,\r\n PresentationIpcEvents,\r\n RpcRequestsHandler,\r\n Ruleset,\r\n RulesetVariable,\r\n SelectClassInfo,\r\n SingleElementPropertiesRequestOptions,\r\n UpdateInfo,\r\n VariableValueTypes,\r\n} from \"@itwin/presentation-common\";\r\nimport { IpcRequestsHandler } from \"./IpcRequestsHandler\";\r\nimport { FrontendLocalizationHelper } from \"./LocalizationHelper\";\r\nimport { RulesetManager, RulesetManagerImpl } from \"./RulesetManager\";\r\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager\";\r\nimport { StreamedResponseGenerator } from \"./StreamedResponseGenerator\";\r\nimport { TRANSIENT_ELEMENT_CLASSNAME } from \"@itwin/unified-selection\";\r\n\r\n/**\r\n * Data structure that describes IModel hierarchy change event arguments.\r\n * @public\r\n */\r\nexport interface IModelHierarchyChangeEventArgs {\r\n /** Id of ruleset that was used to create hierarchy. */\r\n rulesetId: string;\r\n /** Hierarchy changes info. */\r\n updateInfo: HierarchyUpdateInfo;\r\n /** Key of iModel that was used to create hierarchy. It matches [[IModelConnection.key]] property. */\r\n imodelKey: string;\r\n}\r\n\r\n/**\r\n * Data structure that describes iModel content change event arguments.\r\n * @public\r\n */\r\nexport interface IModelContentChangeEventArgs {\r\n /** Id of ruleset that was used to create content. */\r\n rulesetId: string;\r\n /** Content changes info. */\r\n updateInfo: ContentUpdateInfo;\r\n /** Key of iModel that was used to create content. It matches [[IModelConnection.key]] property. */\r\n imodelKey: string;\r\n}\r\n\r\n/**\r\n * Options for requests that can return multiple pages of items concurrently.\r\n * @public\r\n */\r\nexport type MultipleValuesRequestOptions = Paged<{\r\n /**\r\n * Max number of requests that should be made to the backend to fulfill the whole request.\r\n * `undefined` means no limit, so in that case all requests are sent at once.\r\n */\r\n maxParallelRequests?: number;\r\n\r\n /**\r\n * Size of a single batch when fetching data through multiple requests. If not set,\r\n * the fall back is requested page size. If the page size is not set, the backend\r\n * decides how many items to return.\r\n */\r\n batchSize?: number;\r\n}>;\r\n\r\n/**\r\n * Options for requests that retrieve nodes.\r\n * @public\r\n */\r\nexport type GetNodesRequestOptions = HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute;\r\n\r\n/**\r\n * Options for requests that retrieve content.\r\n * @public\r\n */\r\nexport type GetContentRequestOptions = ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> &\r\n ClientDiagnosticsAttribute;\r\n\r\n/**\r\n * Options for requests that retrieve distinct values.\r\n * @public\r\n */\r\nexport type GetDistinctValuesRequestOptions = DistinctValuesRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> &\r\n ClientDiagnosticsAttribute;\r\n\r\n/**\r\n * Properties used to configure [[PresentationManager]]\r\n * @public\r\n */\r\nexport interface PresentationManagerProps {\r\n /**\r\n * Sets the active locale to use when localizing presentation-related\r\n * strings. It can later be changed through [[PresentationManager]].\r\n */\r\n activeLocale?: string;\r\n\r\n /**\r\n * Sets the active unit system to use for formatting property values with\r\n * units. The value can later be changed through [[PresentationManager.activeUnitSystem]] setter or\r\n * overriden for each request through request parameters. If not set, `IModelApp.quantityFormatter.activeUnitSystem`\r\n * is used by default.\r\n *\r\n * @deprecated in 4.0. Use [IModelApp.quantityFormatter]($core-frontend) to set the active unit system.\r\n */\r\n activeUnitSystem?: UnitSystemKey;\r\n\r\n /**\r\n * ID used to identify client that requests data. Generally, clients should\r\n * store this ID in their local storage so the ID can be reused across\r\n * sessions - this allows reusing some caches.\r\n *\r\n * Defaults to a unique GUID as a client id.\r\n */\r\n clientId?: string;\r\n\r\n /**\r\n * Timeout (in milliseconds) for how long we're going to wait for RPC request to be fulfilled before throwing\r\n * a timeout error.\r\n *\r\n * Defaults to 10 minutes.\r\n */\r\n requestTimeout?: number;\r\n\r\n /**\r\n * Callback that provides [SchemaContext]($ecschema-metadata) for supplied [IModelConnection]($core-frontend).\r\n * [SchemaContext]($ecschema-metadata) is used for getting metadata required for values formatting.\r\n */\r\n schemaContextProvider?: (imodel: IModelConnection) => SchemaContext;\r\n\r\n /**\r\n * A map of default unit formats to use for formatting properties that don't have a presentation format\r\n * in requested unit system.\r\n *\r\n * @note Only has effect when frontend value formatting is enabled by supplying the `schemaContextProvider` prop.\r\n */\r\n defaultFormats?: FormatsMap;\r\n\r\n /** @internal */\r\n rpcRequestsHandler?: RpcRequestsHandler;\r\n\r\n /** @internal */\r\n ipcRequestsHandler?: IpcRequestsHandler;\r\n}\r\n\r\n/**\r\n * Frontend Presentation manager which basically just forwards all calls to\r\n * the backend implementation.\r\n *\r\n * @public\r\n */\r\nexport class PresentationManager implements IDisposable {\r\n private _requestsHandler: RpcRequestsHandler;\r\n private _rulesets: RulesetManager;\r\n private _localizationHelper: FrontendLocalizationHelper;\r\n private _explicitActiveUnitSystem: UnitSystemKey | undefined;\r\n private _rulesetVars: Map<string, RulesetVariablesManager>;\r\n private _clearEventListener?: () => void;\r\n private _schemaContextProvider?: (imodel: IModelConnection) => SchemaContext;\r\n private _defaultFormats?: FormatsMap;\r\n private _ipcRequestsHandler?: IpcRequestsHandler;\r\n\r\n /**\r\n * An event raised when hierarchies created using specific ruleset change\r\n */\r\n public onIModelHierarchyChanged = new BeEvent<(args: IModelHierarchyChangeEventArgs) => void>();\r\n\r\n /**\r\n * An event raised when content created using specific ruleset changes\r\n */\r\n public onIModelContentChanged = new BeEvent<(args: IModelContentChangeEventArgs) => void>();\r\n\r\n /**\r\n * Get / set active unit system used to format property values with units.\r\n *\r\n * @deprecated in 4.0. `IModelApp.quantityFormatter` should be used to get/set the active unit system. At the moment\r\n * [[PresentationManager]] allows overriding it, but returns `IModelApp.quantityFormatter.activeUnitSystem` if override\r\n * is not set.\r\n */\r\n public get activeUnitSystem(): UnitSystemKey {\r\n return this._explicitActiveUnitSystem ?? IModelApp.quantityFormatter.activeUnitSystem;\r\n }\r\n public set activeUnitSystem(value: UnitSystemKey | undefined) {\r\n this._explicitActiveUnitSystem = value;\r\n }\r\n\r\n private constructor(props?: PresentationManagerProps) {\r\n if (props) {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n this._explicitActiveUnitSystem = props.activeUnitSystem;\r\n }\r\n\r\n this._requestsHandler =\r\n props?.rpcRequestsHandler ?? new RpcRequestsHandler(props ? { clientId: props.clientId, timeout: props.requestTimeout } : undefined);\r\n this._rulesetVars = new Map<string, RulesetVariablesManager>();\r\n this._rulesets = RulesetManagerImpl.create();\r\n this._localizationHelper = new FrontendLocalizationHelper(props?.activeLocale);\r\n this._schemaContextProvider = props?.schemaContextProvider;\r\n this._defaultFormats = props?.defaultFormats;\r\n\r\n if (IpcApp.isValid) {\r\n // Ipc only works in ipc apps, so the `onUpdate` callback will only be called there.\r\n this._clearEventListener = IpcApp.addListener(PresentationIpcEvents.Update, this.onUpdate);\r\n this._ipcRequestsHandler = props?.ipcRequestsHandler ?? new IpcRequestsHandler(this._requestsHandler.clientId);\r\n }\r\n }\r\n\r\n /** Get / set active locale used for localizing presentation data */\r\n public get activeLocale(): string | undefined {\r\n return this._localizationHelper.locale;\r\n }\r\n public set activeLocale(locale: string | undefined) {\r\n this._localizationHelper.locale = locale;\r\n }\r\n\r\n public dispose() {\r\n if (this._clearEventListener) {\r\n this._clearEventListener();\r\n this._clearEventListener = undefined;\r\n }\r\n }\r\n\r\n private onUpdate = (_evt: Event, report: UpdateInfo) => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.handleUpdateAsync(report);\r\n };\r\n\r\n /** @note This is only called in native apps after changes in iModels */\r\n private async handleUpdateAsync(report: UpdateInfo) {\r\n for (const imodelKey in report) {\r\n // istanbul ignore if\r\n if (!report.hasOwnProperty(imodelKey)) {\r\n continue;\r\n }\r\n\r\n const imodelReport = report[imodelKey];\r\n for (const rulesetId in imodelReport) {\r\n // istanbul ignore if\r\n if (!imodelReport.hasOwnProperty(rulesetId)) {\r\n continue;\r\n }\r\n\r\n const updateInfo = imodelReport[rulesetId];\r\n if (updateInfo.content) {\r\n this.onIModelContentChanged.raiseEvent({ rulesetId, updateInfo: updateInfo.content, imodelKey });\r\n }\r\n if (updateInfo.hierarchy) {\r\n this.onIModelHierarchyChanged.raiseEvent({ rulesetId, updateInfo: updateInfo.hierarchy, imodelKey });\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Function that is called when a new IModelConnection is used to retrieve data.\r\n * @internal\r\n */\r\n public startIModelInitialization(_: IModelConnection) {}\r\n\r\n /**\r\n * Function that should be called to finish initialization that was started at [[PresentationManager.startIModelInitialization]].\r\n * Can be removed when [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]] are removed.\r\n * @internal\r\n */\r\n public async ensureIModelInitialized(_: IModelConnection) {}\r\n\r\n /**\r\n * Create a new PresentationManager instance\r\n * @param props Optional properties used to configure the manager\r\n */\r\n public static create(props?: PresentationManagerProps) {\r\n return new PresentationManager(props);\r\n }\r\n\r\n /** @internal */\r\n public get rpcRequestsHandler() {\r\n return this._requestsHandler;\r\n }\r\n\r\n /** @internal */\r\n public get ipcRequestsHandler() {\r\n return this._ipcRequestsHandler;\r\n }\r\n\r\n /**\r\n * Get rulesets manager\r\n */\r\n public rulesets() {\r\n return this._rulesets;\r\n }\r\n\r\n /**\r\n * Get ruleset variables manager for specific ruleset\r\n * @param rulesetId Id of the ruleset to get the vars manager for\r\n */\r\n public vars(rulesetId: string) {\r\n if (!this._rulesetVars.has(rulesetId)) {\r\n const varsManager = new RulesetVariablesManagerImpl(rulesetId, this._ipcRequestsHandler);\r\n this._rulesetVars.set(rulesetId, varsManager);\r\n }\r\n return this._rulesetVars.get(rulesetId)!;\r\n }\r\n\r\n private toRpcTokenOptions<TOptions extends { imodel: IModelConnection; locale?: string; unitSystem?: UnitSystemKey; rulesetVariables?: RulesetVariable[] }>(\r\n requestOptions: TOptions,\r\n ) {\r\n // 1. put default `locale` and `unitSystem`\r\n // 2. put all `requestOptions` members (if `locale` or `unitSystem` are set, they'll override the defaults put at #1)\r\n // 3. put `imodel` of type `IModelRpcProps` which overwrites the `imodel` from `requestOptions` put at #2\r\n const defaultOptions: Pick<TOptions, \"locale\" | \"unitSystem\"> = {};\r\n if (this.activeLocale) {\r\n defaultOptions.locale = this.activeLocale;\r\n }\r\n defaultOptions.unitSystem = this.activeUnitSystem; // eslint-disable-line @typescript-eslint/no-deprecated\r\n\r\n const { imodel, rulesetVariables, ...rpcRequestOptions } = requestOptions;\r\n return {\r\n ...defaultOptions,\r\n ...rpcRequestOptions,\r\n ...(rulesetVariables ? { rulesetVariables: rulesetVariables.map(RulesetVariable.toJSON) } : {}),\r\n imodel: imodel.getRpcProps(),\r\n };\r\n }\r\n\r\n private async addRulesetAndVariablesToOptions<TOptions extends { rulesetOrId: Ruleset | string; rulesetVariables?: RulesetVariable[] }>(options: TOptions) {\r\n const { rulesetOrId, rulesetVariables } = options;\r\n let foundRulesetOrId: Ruleset | string;\r\n if (typeof rulesetOrId === \"object\") {\r\n foundRulesetOrId = rulesetOrId;\r\n } else {\r\n const foundRuleset = await this._rulesets.get(rulesetOrId);\r\n foundRulesetOrId = foundRuleset ? foundRuleset.toJSON() : rulesetOrId;\r\n }\r\n const rulesetId = typeof foundRulesetOrId === \"object\" ? foundRulesetOrId.id : foundRulesetOrId;\r\n\r\n // All Id64Array variable values must be sorted for serialization to JSON to work. RulesetVariablesManager\r\n // sorts them before storing, so that part is taken care of, but we need to ensure that variables coming from\r\n // request options are also sorted.\r\n const variables = (rulesetVariables ?? []).map((variable) => {\r\n if (variable.type === VariableValueTypes.Id64Array) {\r\n return { ...variable, value: OrderedId64Iterable.sortArray(variable.value) };\r\n }\r\n return variable;\r\n });\r\n if (!this._ipcRequestsHandler) {\r\n // only need to add variables from variables manager if there's no IPC\r\n // handler - if there is one, the variables are already known by the backend\r\n variables.push(...this.vars(rulesetId).getAllVariables());\r\n }\r\n\r\n return { ...options, rulesetOrId: foundRulesetOrId, rulesetVariables: variables };\r\n }\r\n\r\n /** Returns an iterator that polls nodes asynchronously. */\r\n public async getNodesIterator(\r\n requestOptions: GetNodesRequestOptions & MultipleValuesRequestOptions,\r\n ): Promise<{ total: number; items: AsyncIterableIterator<Node> }> {\r\n this.startIModelInitialization(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options });\r\n\r\n const generator = new StreamedResponseGenerator({\r\n ...requestOptions,\r\n getBatch: async (paging) => {\r\n const result = await this._requestsHandler.getPagedNodes({ ...rpcOptions, paging });\r\n return {\r\n total: result.total,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n items: this._localizationHelper.getLocalizedNodes(result.items.map(Node.fromJSON)),\r\n };\r\n },\r\n });\r\n\r\n return generator.createAsyncIteratorResponse();\r\n }\r\n\r\n /**\r\n * Retrieves nodes\r\n * @deprecated in 4.5. Use [[getNodesIterator]] instead.\r\n */\r\n public async getNodes(requestOptions: GetNodesRequestOptions & MultipleValuesRequestOptions): Promise<Node[]> {\r\n const result = await this.getNodesIterator(requestOptions);\r\n return collect(result.items);\r\n }\r\n\r\n /** Retrieves nodes count. */\r\n public async getNodesCount(requestOptions: GetNodesRequestOptions): Promise<number> {\r\n this.startIModelInitialization(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options });\r\n return this._requestsHandler.getNodesCount(rpcOptions);\r\n }\r\n\r\n /**\r\n * Retrieves total nodes count and a single page of nodes.\r\n * @deprecated in 4.5. Use [[getNodesIterator]] instead.\r\n */\r\n public async getNodesAndCount(requestOptions: GetNodesRequestOptions & MultipleValuesRequestOptions): Promise<{ count: number; nodes: Node[] }> {\r\n const result = await this.getNodesIterator(requestOptions);\r\n return {\r\n count: result.total,\r\n nodes: await collect(result.items),\r\n };\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: HierarchyLevelDescriptorRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute,\r\n ): Promise<Descriptor | undefined> {\r\n this.startIModelInitialization(requestOptions.imodel);\r\n try {\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options });\r\n const result = await this._requestsHandler.getNodesDescriptor(rpcOptions);\r\n const descriptor = Descriptor.fromJSON(result);\r\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\r\n } finally {\r\n await this.ensureIModelInitialized(requestOptions.imodel);\r\n }\r\n }\r\n\r\n /** Retrieves paths from root nodes to children nodes according to specified keys. Intersecting paths will be merged. */\r\n public async getNodePaths(\r\n requestOptions: FilterByInstancePathsHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n this.startIModelInitialization(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options });\r\n const result = await this._requestsHandler.getNodePaths(rpcOptions);\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return result.map(NodePathElement.fromJSON).map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\r\n }\r\n\r\n /** Retrieves paths from root nodes to nodes containing filter text in their label. */\r\n public async getFilteredNodePaths(\r\n requestOptions: FilterByTextHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n this.startIModelInitialization(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const result = await this._requestsHandler.getFilteredNodePaths(this.toRpcTokenOptions(options));\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return result.map(NodePathElement.fromJSON).map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\r\n }\r\n\r\n /**\r\n * Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,\r\n * its related instances for loading related and navigation properties.\r\n * @public\r\n */\r\n public async getContentSources(requestOptions: ContentSourcesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute): Promise<SelectClassInfo[]> {\r\n this.startIModelInitialization(requestOptions.imodel);\r\n const rpcOptions = this.toRpcTokenOptions(requestOptions);\r\n const result = await this._requestsHandler.getContentSources(rpcOptions);\r\n return SelectClassInfo.listFromCompressedJSON(result.sources, result.classesMap);\r\n }\r\n\r\n /** Retrieves the content descriptor which describes the content and can be used to customize it. */\r\n public async getContentDescriptor(\r\n requestOptions: ContentDescriptorRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute,\r\n ): Promise<Descriptor | undefined> {\r\n this.startIModelInitialization(requestOptions.imodel);\r\n try {\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({\r\n ...options,\r\n keys: stripTransientElementKeys(options.keys).toJSON(),\r\n });\r\n const result = await this._requestsHandler.getContentDescriptor(rpcOptions);\r\n const descriptor = Descriptor.fromJSON(result);\r\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\r\n } finally {\r\n await this.ensureIModelInitialized(requestOptions.imodel);\r\n }\r\n }\r\n\r\n /** Retrieves overall content set size. */\r\n public async getContentSetSize(requestOptions: GetContentRequestOptions): Promise<number> {\r\n this.startIModelInitialization(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({\r\n ...options,\r\n descriptor: getDescriptorOverrides(requestOptions.descriptor),\r\n keys: stripTransientElementKeys(requestOptions.keys).toJSON(),\r\n });\r\n return this._requestsHandler.getContentSetSize(rpcOptions);\r\n }\r\n\r\n private async getContentIteratorInternal(\r\n requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions,\r\n ): Promise<{ descriptor: Descriptor; total: number; items: AsyncIterableIterator<Item> } | undefined> {\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const firstPageSize = options.batchSize ?? requestOptions.paging?.size;\r\n const rpcOptions = this.toRpcTokenOptions({\r\n ...options,\r\n descriptor: getDescriptorOverrides(requestOptions.descriptor),\r\n keys: stripTransientElementKeys(requestOptions.keys).toJSON(),\r\n ...(firstPageSize ? { paging: { ...requestOptions.paging, size: firstPageSize } } : undefined),\r\n ...(!requestOptions.omitFormattedValues && this._schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),\r\n });\r\n\r\n let contentFormatter: ContentFormatter | undefined;\r\n if (!requestOptions.omitFormattedValues && this._schemaContextProvider) {\r\n const koqPropertyFormatter = new KoqPropertyValueFormatter(this._schemaContextProvider(requestOptions.imodel), this._defaultFormats);\r\n contentFormatter = new ContentFormatter(\r\n new ContentPropertyValueFormatter(koqPropertyFormatter),\r\n requestOptions.unitSystem ?? this._explicitActiveUnitSystem ?? IModelApp.quantityFormatter.activeUnitSystem,\r\n );\r\n }\r\n\r\n let descriptor = requestOptions.descriptor instanceof Descriptor ? requestOptions.descriptor : undefined;\r\n let firstPage: PagedResponse<ItemJSON> | undefined;\r\n if (!descriptor) {\r\n const firstPageResponse = await this._requestsHandler.getPagedContent(rpcOptions);\r\n if (!firstPageResponse?.descriptor || !firstPageResponse.contentSet) {\r\n return undefined;\r\n }\r\n descriptor = Descriptor.fromJSON(firstPageResponse?.descriptor);\r\n firstPage = firstPageResponse?.contentSet;\r\n }\r\n\r\n // istanbul ignore if\r\n if (!descriptor) {\r\n return undefined;\r\n }\r\n\r\n descriptor = this._localizationHelper.getLocalizedContentDescriptor(descriptor);\r\n\r\n const getPage = async (paging: Required<PageOptions>, requestIndex: number) => {\r\n let contentSet = requestIndex === 0 ? firstPage : undefined;\r\n contentSet ??= await this._requestsHandler.getPagedContentSet({ ...rpcOptions, paging });\r\n\r\n let items = contentSet.items.map((x) => Item.fromJSON(x)).filter((x): x is Item => x !== undefined);\r\n if (contentFormatter) {\r\n items = await contentFormatter.formatContentItems(items, descriptor);\r\n }\r\n\r\n items = this._localizationHelper.getLocalizedContentItems(items);\r\n return {\r\n total: contentSet.total,\r\n items,\r\n };\r\n };\r\n\r\n const generator = new StreamedResponseGenerator({\r\n ...requestOptions,\r\n getBatch: getPage,\r\n });\r\n\r\n return {\r\n ...(await generator.createAsyncIteratorResponse()),\r\n descriptor,\r\n };\r\n }\r\n\r\n /** Retrieves a content descriptor, item count and async generator for the items themselves. */\r\n public async getContentIterator(\r\n requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions,\r\n ): Promise<{ descriptor: Descriptor; total: number; items: AsyncIterableIterator<Item> } | undefined> {\r\n this.startIModelInitialization(requestOptions.imodel);\r\n const response = await this.getContentIteratorInternal(requestOptions);\r\n if (!response) {\r\n return undefined;\r\n }\r\n\r\n await this.ensureIModelInitialized(requestOptions.imodel);\r\n return response;\r\n }\r\n\r\n /**\r\n * Retrieves content which consists of a content descriptor and a page of records.\r\n * @deprecated in 4.5. Use [[getContentIterator]] instead.\r\n */\r\n public async getContent(requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions): Promise<Content | undefined> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return (await this.getContentAndSize(requestOptions))?.content;\r\n }\r\n\r\n /**\r\n * Retrieves content set size and content which consists of a content descriptor and a page of records.\r\n * @deprecated in 4.5. Use [[getContentIterator]] instead.\r\n */\r\n public async getContentAndSize(\r\n requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions,\r\n ): Promise<{ content: Content; size: number } | undefined> {\r\n const response = await this.getContentIterator(requestOptions);\r\n if (!response) {\r\n return undefined;\r\n }\r\n\r\n const { descriptor, total } = response;\r\n const items = await collect(response.items);\r\n return {\r\n content: new Content(descriptor, items),\r\n size: total,\r\n };\r\n }\r\n\r\n /** Returns an iterator that asynchronously polls distinct values of specific field from the content. */\r\n public async getDistinctValuesIterator(\r\n requestOptions: GetDistinctValuesRequestOptions & MultipleValuesRequestOptions,\r\n ): Promise<{ total: number; items: AsyncIterableIterator<DisplayValueGroup> }> {\r\n this.startIModelInitialization(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = {\r\n ...this.toRpcTokenOptions(options),\r\n descriptor: getDescriptorOverrides(options.descriptor),\r\n keys: stripTransientElementKeys(options.keys).toJSON(),\r\n };\r\n\r\n const generator = new StreamedResponseGenerator({\r\n ...requestOptions,\r\n getBatch: async (paging) => {\r\n const response = await this._requestsHandler.getPagedDistinctValues({ ...rpcOptions, paging });\r\n return {\r\n total: response.total,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n items: response.items.map((x) => this._localizationHelper.getLocalizedDisplayValueGroup(DisplayValueGroup.fromJSON(x))),\r\n };\r\n },\r\n });\r\n\r\n return generator.createAsyncIteratorResponse();\r\n }\r\n\r\n /**\r\n * Retrieves distinct values of specific field from the content.\r\n * @deprecated in 4.5. Use [[getDistinctValuesIterator]] instead.\r\n */\r\n public async getPagedDistinctValues(\r\n requestOptions: GetDistinctValuesRequestOptions & MultipleValuesRequestOptions,\r\n ): Promise<PagedResponse<DisplayValueGroup>> {\r\n const result = await this.getDistinctValuesIterator(requestOptions);\r\n return {\r\n total: result.total,\r\n items: await collect(result.items),\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: SingleElementPropertiesRequestOptions<IModelConnection, TParsedContent> & ClientDiagnosticsAttribute,\r\n ): Promise<TParsedContent | undefined> {\r\n this.startIModelInitialization(requestOptions.imodel);\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 iter = await this.getContentIterator({\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 (!iter || iter.total === 0) {\r\n return undefined;\r\n }\r\n return parser(iter.descriptor, (await iter.items.next()).value);\r\n }\r\n\r\n /**\r\n * Retrieves content item instance keys.\r\n * @public\r\n */\r\n public async getContentInstanceKeys(\r\n requestOptions: ContentInstanceKeysRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute & MultipleValuesRequestOptions,\r\n ): Promise<{ total: number; items: () => AsyncGenerator<InstanceKey> }> {\r\n this.startIModelInitialization(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = {\r\n ...this.toRpcTokenOptions(options),\r\n keys: stripTransientElementKeys(options.keys).toJSON(),\r\n };\r\n\r\n const generator = new StreamedResponseGenerator({\r\n ...requestOptions,\r\n getBatch: async (page) => {\r\n const keys = await this._requestsHandler.getContentInstanceKeys({ ...rpcOptions, paging: page });\r\n return {\r\n total: keys.total,\r\n items: keys.items.instanceKeys.reduce((instanceKeys, entry) => {\r\n for (const id of CompressedId64Set.iterable(entry[1])) {\r\n instanceKeys.push({ className: entry[0], id });\r\n }\r\n return instanceKeys;\r\n }, new Array<InstanceKey>()),\r\n };\r\n },\r\n });\r\n\r\n const { total, items } = await generator.createAsyncIteratorResponse();\r\n return {\r\n total,\r\n async *items() {\r\n yield* items;\r\n },\r\n };\r\n }\r\n\r\n /** Retrieves display label definition of specific item. */\r\n public async getDisplayLabelDefinition(\r\n requestOptions: DisplayLabelRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute,\r\n ): Promise<LabelDefinition> {\r\n this.startIModelInitialization(requestOptions.imodel);\r\n const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });\r\n const result = await this._requestsHandler.getDisplayLabelDefinition(rpcOptions);\r\n return this._localizationHelper.getLocalizedLabelDefinition(result);\r\n }\r\n\r\n /** Retrieves display label definition of specific items. */\r\n public async getDisplayLabelDefinitionsIterator(\r\n requestOptions: DisplayLabelsRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute & MultipleValuesRequestOptions,\r\n ): Promise<{ total: number; items: AsyncIterableIterator<LabelDefinition> }> {\r\n this.startIModelInitialization(requestOptions.imodel);\r\n const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });\r\n const generator = new StreamedResponseGenerator({\r\n ...requestOptions,\r\n getBatch: async (page) => {\r\n const partialKeys = !page.start ? rpcOptions.keys : rpcOptions.keys.slice(page.start);\r\n const result = await this._requestsHandler.getPagedDisplayLabelDefinitions({ ...rpcOptions, keys: partialKeys });\r\n result.items = this._localizationHelper.getLocalizedLabelDefinitions(result.items);\r\n return result;\r\n },\r\n });\r\n\r\n return generator.createAsyncIteratorResponse();\r\n }\r\n\r\n /**\r\n * Retrieves display label definition of specific items.\r\n * @deprecated in 4.5. Use [[getDisplayLabelDefinitionsIterator]] instead.\r\n */\r\n public async getDisplayLabelDefinitions(\r\n requestOptions: DisplayLabelsRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute & MultipleValuesRequestOptions,\r\n ): Promise<LabelDefinition[]> {\r\n const { items } = await this.getDisplayLabelDefinitionsIterator(requestOptions);\r\n return collect(items);\r\n }\r\n}\r\n\r\nconst getDescriptorOverrides = (descriptorOrOverrides: Descriptor | DescriptorOverrides): DescriptorOverrides => {\r\n if (descriptorOrOverrides instanceof Descriptor) {\r\n return descriptorOrOverrides.createDescriptorOverrides();\r\n }\r\n return descriptorOrOverrides;\r\n};\r\n\r\nconst stripTransientElementKeys = (keys: KeySet) => {\r\n if (!keys.some((key) => Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME)) {\r\n return keys;\r\n }\r\n\r\n const copy = new KeySet();\r\n copy.add(keys, (key) => {\r\n // the callback is not going to be called with EntityProps as KeySet converts them\r\n // to InstanceKeys, but we want to keep the EntityProps case for correctness\r\n // istanbul ignore next\r\n const isTransient =\r\n (Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME) ||\r\n (Key.isEntityProps(key) && key.classFullName === TRANSIENT_ELEMENT_CLASSNAME);\r\n return !isTransient;\r\n });\r\n return copy;\r\n};\r\n\r\nasync function collect<T>(iter: AsyncIterable<T>): Promise<T[]> {\r\n const result = new Array<T>();\r\n for await (const value of iter) {\r\n result.push(value);\r\n }\r\n return result;\r\n}\r\n"]}
1
+ {"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAAsF;AACtF,wDAA2E;AAG3E,oEA0CoC;AACpC,kEAM6C;AAC7C,gEAAuE;AACvE,mEAA6D;AAC7D,mEAAqE;AACrE,2DAAyE;AACzE,6EAAoG;AACpG,iFAA2E;AAC3E,2FAAyG;AACzG,6DAA0H;AA8H1H;;;;;GAKG;AACH,MAAa,mBAAmB;IACtB,gBAAgB,CAAqB;IACrC,SAAS,CAAiB;IAC1B,mBAAmB,CAA6B;IAChD,yBAAyB,CAA4B;IACrD,YAAY,CAAuC;IACnD,mBAAmB,CAAc;IACjC,sBAAsB,CAA+C;IACrE,eAAe,CAAc;IAC7B,mBAAmB,CAAsB;IAEjD;;OAEG;IACI,wBAAwB,GAAG,IAAI,sBAAO,EAAkD,CAAC;IAEhG;;OAEG;IACI,sBAAsB,GAAG,IAAI,sBAAO,EAAgD,CAAC;IAE5F;;;;;;OAMG;IACH,IAAW,gBAAg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G,IAAI,KAAK,EAAK,CAAC;IAC9B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { BeEvent, CompressedId64Set, OrderedId64Iterable } from \"@itwin/core-bentley\";\nimport { IModelApp, IModelConnection, IpcApp } from \"@itwin/core-frontend\";\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\nimport { SchemaContext } from \"@itwin/ecschema-metadata\";\nimport {\n ClientDiagnosticsAttribute,\n Content,\n ContentDescriptorRequestOptions,\n ContentFlags,\n ContentInstanceKeysRequestOptions,\n ContentRequestOptions,\n ContentSourcesRequestOptions,\n ContentUpdateInfo,\n DefaultContentDisplayTypes,\n Descriptor,\n DescriptorOverrides,\n DisplayLabelRequestOptions,\n DisplayLabelsRequestOptions,\n DisplayValueGroup,\n DistinctValuesRequestOptions,\n ElementProperties,\n FilterByInstancePathsHierarchyRequestOptions,\n FilterByTextHierarchyRequestOptions,\n FormatsMap,\n HierarchyLevelDescriptorRequestOptions,\n HierarchyRequestOptions,\n HierarchyUpdateInfo,\n InstanceKey,\n Item,\n ItemJSON,\n Key,\n KeySet,\n KoqPropertyValueFormatter,\n LabelDefinition,\n Node,\n NodeKey,\n NodePathElement,\n Paged,\n PagedResponse,\n PageOptions,\n Ruleset,\n RulesetVariable,\n SelectClassInfo,\n SingleElementPropertiesRequestOptions,\n UpdateInfo,\n VariableValueTypes,\n} from \"@itwin/presentation-common\";\nimport {\n buildElementProperties,\n ContentFormatter,\n ContentPropertyValueFormatter,\n PresentationIpcEvents,\n RpcRequestsHandler,\n} from \"@itwin/presentation-common/internal\";\nimport { TRANSIENT_ELEMENT_CLASSNAME } from \"@itwin/unified-selection\";\nimport { IpcRequestsHandler } from \"./IpcRequestsHandler.js\";\nimport { FrontendLocalizationHelper } from \"./LocalizationHelper.js\";\nimport { RulesetManager, RulesetManagerImpl } from \"./RulesetManager.js\";\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager.js\";\nimport { StreamedResponseGenerator } from \"./StreamedResponseGenerator.js\";\nimport { ensureIModelInitialized, startIModelInitialization } from \"./IModelConnectionInitialization.js\";\nimport { _presentation_manager_ipcRequestsHandler, _presentation_manager_rpcRequestsHandler } from \"./InternalSymbols.js\";\n\n/**\n * Data structure that describes IModel hierarchy change event arguments.\n * @public\n */\nexport interface IModelHierarchyChangeEventArgs {\n /** Id of ruleset that was used to create hierarchy. */\n rulesetId: string;\n /** Hierarchy changes info. */\n updateInfo: HierarchyUpdateInfo;\n /** Key of iModel that was used to create hierarchy. It matches [[IModelConnection.key]] property. */\n imodelKey: string;\n}\n\n/**\n * Data structure that describes iModel content change event arguments.\n * @public\n */\nexport interface IModelContentChangeEventArgs {\n /** Id of ruleset that was used to create content. */\n rulesetId: string;\n /** Content changes info. */\n updateInfo: ContentUpdateInfo;\n /** Key of iModel that was used to create content. It matches [[IModelConnection.key]] property. */\n imodelKey: string;\n}\n\n/**\n * Options for requests that can return multiple pages of items concurrently.\n * @public\n */\nexport type MultipleValuesRequestOptions = Paged<{\n /**\n * Max number of requests that should be made to the backend to fulfill the whole request.\n * `undefined` means no limit, so in that case all requests are sent at once.\n */\n maxParallelRequests?: number;\n\n /**\n * Size of a single batch when fetching data through multiple requests. If not set,\n * the fall back is requested page size. If the page size is not set, the backend\n * decides how many items to return.\n */\n batchSize?: number;\n}>;\n\n/**\n * Options for requests that retrieve nodes.\n * @public\n */\nexport type GetNodesRequestOptions = HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute;\n\n/**\n * Options for requests that retrieve content.\n * @public\n */\nexport type GetContentRequestOptions = ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> &\n ClientDiagnosticsAttribute;\n\n/**\n * Options for requests that retrieve distinct values.\n * @public\n */\nexport type GetDistinctValuesRequestOptions = DistinctValuesRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> &\n ClientDiagnosticsAttribute;\n\n/**\n * Properties used to configure [[PresentationManager]]\n * @public\n */\nexport interface PresentationManagerProps {\n /**\n * Sets the active locale to use when localizing presentation-related\n * strings. It can later be changed through [[PresentationManager]].\n */\n activeLocale?: string;\n\n /**\n * Sets the active unit system to use for formatting property values with\n * units. The value can later be changed through [[PresentationManager.activeUnitSystem]] setter or\n * overriden for each request through request parameters. If not set, `IModelApp.quantityFormatter.activeUnitSystem`\n * is used by default.\n *\n * @deprecated in 4.0. Use [IModelApp.quantityFormatter]($core-frontend) to set the active unit system.\n */\n activeUnitSystem?: UnitSystemKey;\n\n /**\n * ID used to identify client that requests data. Generally, clients should\n * store this ID in their local storage so the ID can be reused across\n * sessions - this allows reusing some caches.\n *\n * Defaults to a unique GUID as a client id.\n */\n clientId?: string;\n\n /**\n * Timeout (in milliseconds) for how long we're going to wait for RPC request to be fulfilled before throwing\n * a timeout error.\n *\n * Defaults to 10 minutes.\n */\n requestTimeout?: number;\n\n /**\n * Callback that provides [SchemaContext]($ecschema-metadata) for supplied [IModelConnection]($core-frontend).\n * [SchemaContext]($ecschema-metadata) is used for getting metadata required for values formatting.\n */\n schemaContextProvider?: (imodel: IModelConnection) => SchemaContext;\n\n /**\n * A map of default unit formats to use for formatting properties that don't have a presentation format\n * in requested unit system.\n *\n * @note Only has effect when frontend value formatting is enabled by supplying the `schemaContextProvider` prop.\n */\n defaultFormats?: FormatsMap;\n}\n\n/** @internal */\ninterface PresentationManagerInternalProps {\n rpcRequestsHandler?: RpcRequestsHandler;\n ipcRequestsHandler?: IpcRequestsHandler;\n}\n\n/**\n * Frontend Presentation manager which basically just forwards all calls to\n * the backend implementation.\n *\n * @public\n */\nexport class PresentationManager implements Disposable {\n private _requestsHandler: RpcRequestsHandler;\n private _rulesets: RulesetManager;\n private _localizationHelper: FrontendLocalizationHelper;\n private _explicitActiveUnitSystem: UnitSystemKey | undefined;\n private _rulesetVars: Map<string, RulesetVariablesManager>;\n private _clearEventListener?: () => void;\n private _schemaContextProvider?: (imodel: IModelConnection) => SchemaContext;\n private _defaultFormats?: FormatsMap;\n private _ipcRequestsHandler?: IpcRequestsHandler;\n\n /**\n * An event raised when hierarchies created using specific ruleset change\n */\n public onIModelHierarchyChanged = new BeEvent<(args: IModelHierarchyChangeEventArgs) => void>();\n\n /**\n * An event raised when content created using specific ruleset changes\n */\n public onIModelContentChanged = new BeEvent<(args: IModelContentChangeEventArgs) => void>();\n\n /**\n * Get / set active unit system used to format property values with units.\n *\n * @deprecated in 4.0. `IModelApp.quantityFormatter` should be used to get/set the active unit system. At the moment\n * [[PresentationManager]] allows overriding it, but returns `IModelApp.quantityFormatter.activeUnitSystem` if override\n * is not set.\n */\n public get activeUnitSystem(): UnitSystemKey {\n return this._explicitActiveUnitSystem ?? IModelApp.quantityFormatter.activeUnitSystem;\n }\n public set activeUnitSystem(value: UnitSystemKey | undefined) {\n this._explicitActiveUnitSystem = value;\n }\n\n private constructor(props?: PresentationManagerProps) {\n if (props) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n this._explicitActiveUnitSystem = props.activeUnitSystem;\n }\n\n this._requestsHandler =\n (props as PresentationManagerInternalProps)?.rpcRequestsHandler ??\n new RpcRequestsHandler(props ? { clientId: props.clientId, timeout: props.requestTimeout } : undefined);\n this._rulesetVars = new Map<string, RulesetVariablesManager>();\n this._rulesets = RulesetManagerImpl.create();\n this._localizationHelper = new FrontendLocalizationHelper(props?.activeLocale);\n this._schemaContextProvider = props?.schemaContextProvider;\n this._defaultFormats = props?.defaultFormats;\n\n if (IpcApp.isValid) {\n // Ipc only works in ipc apps, so the `onUpdate` callback will only be called there.\n this._clearEventListener = IpcApp.addListener(PresentationIpcEvents.Update, this.onUpdate);\n this._ipcRequestsHandler = (props as PresentationManagerInternalProps)?.ipcRequestsHandler ?? new IpcRequestsHandler(this._requestsHandler.clientId);\n }\n }\n\n /** Get / set active locale used for localizing presentation data */\n public get activeLocale(): string | undefined {\n return this._localizationHelper.locale;\n }\n public set activeLocale(locale: string | undefined) {\n this._localizationHelper.locale = locale;\n }\n\n public [Symbol.dispose]() {\n if (this._clearEventListener) {\n this._clearEventListener();\n this._clearEventListener = undefined;\n }\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 private onUpdate = (_evt: Event, report: UpdateInfo) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.handleUpdateAsync(report);\n };\n\n /** @note This is only called in native apps after changes in iModels */\n private async handleUpdateAsync(report: UpdateInfo) {\n for (const imodelKey in report) {\n /* c8 ignore next 3 */\n if (!report.hasOwnProperty(imodelKey)) {\n continue;\n }\n\n const imodelReport = report[imodelKey];\n for (const rulesetId in imodelReport) {\n /* c8 ignore next 3 */\n if (!imodelReport.hasOwnProperty(rulesetId)) {\n continue;\n }\n\n const updateInfo = imodelReport[rulesetId];\n if (updateInfo.content) {\n this.onIModelContentChanged.raiseEvent({ rulesetId, updateInfo: updateInfo.content, imodelKey });\n }\n if (updateInfo.hierarchy) {\n this.onIModelHierarchyChanged.raiseEvent({ rulesetId, updateInfo: updateInfo.hierarchy, imodelKey });\n }\n }\n }\n }\n\n /**\n * Create a new PresentationManager instance\n * @param props Optional properties used to configure the manager\n */\n public static create(props?: PresentationManagerProps) {\n return new PresentationManager(props);\n }\n\n /** @internal */\n public get [_presentation_manager_rpcRequestsHandler]() {\n return this._requestsHandler;\n }\n\n /** @internal */\n public get [_presentation_manager_ipcRequestsHandler]() {\n return this._ipcRequestsHandler;\n }\n\n /**\n * Get rulesets manager\n */\n public rulesets() {\n return this._rulesets;\n }\n\n /**\n * Get ruleset variables manager for specific ruleset\n * @param rulesetId Id of the ruleset to get the vars manager for\n */\n public vars(rulesetId: string) {\n if (!this._rulesetVars.has(rulesetId)) {\n const varsManager = new RulesetVariablesManagerImpl(rulesetId, this._ipcRequestsHandler);\n this._rulesetVars.set(rulesetId, varsManager);\n }\n return this._rulesetVars.get(rulesetId)!;\n }\n\n private toRpcTokenOptions<TOptions extends { imodel: IModelConnection; locale?: string; unitSystem?: UnitSystemKey; rulesetVariables?: RulesetVariable[] }>(\n requestOptions: TOptions,\n ) {\n // 1. put default `locale` and `unitSystem`\n // 2. put all `requestOptions` members (if `locale` or `unitSystem` are set, they'll override the defaults put at #1)\n // 3. put `imodel` of type `IModelRpcProps` which overwrites the `imodel` from `requestOptions` put at #2\n const defaultOptions: Pick<TOptions, \"locale\" | \"unitSystem\"> = {};\n if (this.activeLocale) {\n defaultOptions.locale = this.activeLocale;\n }\n defaultOptions.unitSystem = this.activeUnitSystem; // eslint-disable-line @typescript-eslint/no-deprecated\n\n const { imodel, rulesetVariables, ...rpcRequestOptions } = requestOptions;\n return {\n ...defaultOptions,\n ...rpcRequestOptions,\n ...(rulesetVariables ? { rulesetVariables: rulesetVariables.map(RulesetVariable.toJSON) } : {}),\n imodel: imodel.getRpcProps(),\n };\n }\n\n private async addRulesetAndVariablesToOptions<TOptions extends { rulesetOrId: Ruleset | string; rulesetVariables?: RulesetVariable[] }>(options: TOptions) {\n const { rulesetOrId, rulesetVariables } = options;\n let foundRulesetOrId: Ruleset | string;\n if (typeof rulesetOrId === \"object\") {\n foundRulesetOrId = rulesetOrId;\n } else {\n const foundRuleset = await this._rulesets.get(rulesetOrId);\n foundRulesetOrId = foundRuleset ? foundRuleset.toJSON() : rulesetOrId;\n }\n const rulesetId = typeof foundRulesetOrId === \"object\" ? foundRulesetOrId.id : foundRulesetOrId;\n\n // All Id64Array variable values must be sorted for serialization to JSON to work. RulesetVariablesManager\n // sorts them before storing, so that part is taken care of, but we need to ensure that variables coming from\n // request options are also sorted.\n const variables = (rulesetVariables ?? []).map((variable) => {\n if (variable.type === VariableValueTypes.Id64Array) {\n return { ...variable, value: OrderedId64Iterable.sortArray(variable.value) };\n }\n return variable;\n });\n if (!this._ipcRequestsHandler) {\n // only need to add variables from variables manager if there's no IPC\n // handler - if there is one, the variables are already known by the backend\n variables.push(...this.vars(rulesetId).getAllVariables());\n }\n\n return { ...options, rulesetOrId: foundRulesetOrId, rulesetVariables: variables };\n }\n\n /** Returns an iterator that polls nodes asynchronously. */\n public async getNodesIterator(\n requestOptions: GetNodesRequestOptions & MultipleValuesRequestOptions,\n ): Promise<{ total: number; items: AsyncIterableIterator<Node> }> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n\n const generator = new StreamedResponseGenerator({\n ...requestOptions,\n getBatch: async (paging) => {\n const result = await this._requestsHandler.getPagedNodes({ ...rpcOptions, paging });\n return {\n total: result.total,\n items: this._localizationHelper.getLocalizedNodes(result.items),\n };\n },\n });\n\n return generator.createAsyncIteratorResponse();\n }\n\n /**\n * Retrieves nodes\n * @deprecated in 4.5. Use [[getNodesIterator]] instead.\n */\n public async getNodes(requestOptions: GetNodesRequestOptions & MultipleValuesRequestOptions): Promise<Node[]> {\n const result = await this.getNodesIterator(requestOptions);\n return collect(result.items);\n }\n\n /** Retrieves nodes count. */\n public async getNodesCount(requestOptions: GetNodesRequestOptions): Promise<number> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n return this._requestsHandler.getNodesCount(rpcOptions);\n }\n\n /**\n * Retrieves total nodes count and a single page of nodes.\n * @deprecated in 4.5. Use [[getNodesIterator]] instead.\n */\n public async getNodesAndCount(requestOptions: GetNodesRequestOptions & MultipleValuesRequestOptions): Promise<{ count: number; nodes: Node[] }> {\n const result = await this.getNodesIterator(requestOptions);\n return {\n count: result.total,\n nodes: await collect(result.items),\n };\n }\n\n /**\n * Retrieves hierarchy level descriptor.\n * @public\n */\n public async getNodesDescriptor(\n requestOptions: HierarchyLevelDescriptorRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute,\n ): Promise<Descriptor | undefined> {\n startIModelInitialization(requestOptions.imodel);\n try {\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n const result = await this._requestsHandler.getNodesDescriptor(rpcOptions);\n const descriptor = Descriptor.fromJSON(result);\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\n } finally {\n await ensureIModelInitialized(requestOptions.imodel);\n }\n }\n\n /** Retrieves paths from root nodes to children nodes according to specified keys. Intersecting paths will be merged. */\n public async getNodePaths(\n requestOptions: FilterByInstancePathsHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute,\n ): Promise<NodePathElement[]> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({ ...options });\n const result = await this._requestsHandler.getNodePaths(rpcOptions);\n return result.map((npe) => this._localizationHelper.getLocalizedNodePathElement(npe));\n }\n\n /** Retrieves paths from root nodes to nodes containing filter text in their label. */\n public async getFilteredNodePaths(\n requestOptions: FilterByTextHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute,\n ): Promise<NodePathElement[]> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const result = await this._requestsHandler.getFilteredNodePaths(this.toRpcTokenOptions(options));\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(requestOptions: ContentSourcesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute): Promise<SelectClassInfo[]> {\n startIModelInitialization(requestOptions.imodel);\n const rpcOptions = this.toRpcTokenOptions(requestOptions);\n const result = await this._requestsHandler.getContentSources(rpcOptions);\n return result.sources.map((sourceJson) => SelectClassInfo.fromCompressedJSON(sourceJson, result.classesMap));\n }\n\n /** Retrieves the content descriptor which describes the content and can be used to customize it. */\n public async getContentDescriptor(\n requestOptions: ContentDescriptorRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute,\n ): Promise<Descriptor | undefined> {\n startIModelInitialization(requestOptions.imodel);\n try {\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({\n ...options,\n keys: stripTransientElementKeys(options.keys).toJSON(),\n });\n const result = await this._requestsHandler.getContentDescriptor(rpcOptions);\n const descriptor = Descriptor.fromJSON(result);\n return descriptor ? this._localizationHelper.getLocalizedContentDescriptor(descriptor) : undefined;\n } finally {\n await ensureIModelInitialized(requestOptions.imodel);\n }\n }\n\n /** Retrieves overall content set size. */\n public async getContentSetSize(requestOptions: GetContentRequestOptions): Promise<number> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = this.toRpcTokenOptions({\n ...options,\n descriptor: getDescriptorOverrides(requestOptions.descriptor),\n keys: stripTransientElementKeys(requestOptions.keys).toJSON(),\n });\n return this._requestsHandler.getContentSetSize(rpcOptions);\n }\n\n private async getContentIteratorInternal(\n requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions,\n ): Promise<{ descriptor: Descriptor; total: number; items: AsyncIterableIterator<Item> } | undefined> {\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const firstPageSize = options.batchSize ?? requestOptions.paging?.size;\n const rpcOptions = this.toRpcTokenOptions({\n ...options,\n descriptor: getDescriptorOverrides(requestOptions.descriptor),\n keys: stripTransientElementKeys(requestOptions.keys).toJSON(),\n ...(firstPageSize ? { paging: { ...requestOptions.paging, size: firstPageSize } } : undefined),\n ...(!requestOptions.omitFormattedValues && this._schemaContextProvider !== undefined ? { omitFormattedValues: true } : undefined),\n });\n\n let contentFormatter: ContentFormatter | undefined;\n if (!requestOptions.omitFormattedValues && this._schemaContextProvider) {\n const koqPropertyFormatter = new KoqPropertyValueFormatter(this._schemaContextProvider(requestOptions.imodel), this._defaultFormats);\n contentFormatter = new ContentFormatter(\n new ContentPropertyValueFormatter(koqPropertyFormatter),\n requestOptions.unitSystem ?? this._explicitActiveUnitSystem ?? IModelApp.quantityFormatter.activeUnitSystem,\n );\n }\n\n let descriptor = requestOptions.descriptor instanceof Descriptor ? requestOptions.descriptor : undefined;\n let firstPage: PagedResponse<ItemJSON> | undefined;\n if (!descriptor) {\n const firstPageResponse = await this._requestsHandler.getPagedContent(rpcOptions);\n if (!firstPageResponse?.descriptor || !firstPageResponse.contentSet) {\n return undefined;\n }\n descriptor = Descriptor.fromJSON(firstPageResponse?.descriptor);\n firstPage = firstPageResponse?.contentSet;\n }\n\n /* c8 ignore next 3 */\n if (!descriptor) {\n return undefined;\n }\n\n descriptor = this._localizationHelper.getLocalizedContentDescriptor(descriptor);\n\n const getPage = async (paging: Required<PageOptions>, requestIndex: number) => {\n let contentSet = requestIndex === 0 ? firstPage : undefined;\n contentSet ??= await this._requestsHandler.getPagedContentSet({ ...rpcOptions, paging });\n\n let items = contentSet.items.map((x) => Item.fromJSON(x)).filter((x): x is Item => x !== undefined);\n if (contentFormatter) {\n items = await contentFormatter.formatContentItems(items, descriptor);\n }\n\n items = this._localizationHelper.getLocalizedContentItems(items);\n return {\n total: contentSet.total,\n items,\n };\n };\n\n const generator = new StreamedResponseGenerator({\n ...requestOptions,\n getBatch: getPage,\n });\n\n return {\n ...(await generator.createAsyncIteratorResponse()),\n descriptor,\n };\n }\n\n /** Retrieves a content descriptor, item count and async generator for the items themselves. */\n public async getContentIterator(\n requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions,\n ): Promise<{ descriptor: Descriptor; total: number; items: AsyncIterableIterator<Item> } | undefined> {\n startIModelInitialization(requestOptions.imodel);\n const response = await this.getContentIteratorInternal(requestOptions);\n if (!response) {\n return undefined;\n }\n\n await ensureIModelInitialized(requestOptions.imodel);\n return response;\n }\n\n /**\n * Retrieves content which consists of a content descriptor and a page of records.\n * @deprecated in 4.5. Use [[getContentIterator]] instead.\n */\n public async getContent(requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions): Promise<Content | undefined> {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return (await this.getContentAndSize(requestOptions))?.content;\n }\n\n /**\n * Retrieves content set size and content which consists of a content descriptor and a page of records.\n * @deprecated in 4.5. Use [[getContentIterator]] instead.\n */\n public async getContentAndSize(\n requestOptions: GetContentRequestOptions & MultipleValuesRequestOptions,\n ): Promise<{ content: Content; size: number } | undefined> {\n const response = await this.getContentIterator(requestOptions);\n if (!response) {\n return undefined;\n }\n\n const { descriptor, total } = response;\n const items = await collect(response.items);\n return {\n content: new Content(descriptor, items),\n size: total,\n };\n }\n\n /** Returns an iterator that asynchronously polls distinct values of specific field from the content. */\n public async getDistinctValuesIterator(\n requestOptions: GetDistinctValuesRequestOptions & MultipleValuesRequestOptions,\n ): Promise<{ total: number; items: AsyncIterableIterator<DisplayValueGroup> }> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = {\n ...this.toRpcTokenOptions(options),\n descriptor: getDescriptorOverrides(options.descriptor),\n keys: stripTransientElementKeys(options.keys).toJSON(),\n };\n\n const generator = new StreamedResponseGenerator({\n ...requestOptions,\n getBatch: async (paging) => {\n const response = await this._requestsHandler.getPagedDistinctValues({ ...rpcOptions, paging });\n return {\n total: response.total,\n items: response.items.map((x) => this._localizationHelper.getLocalizedDisplayValueGroup(x)),\n };\n },\n });\n\n return generator.createAsyncIteratorResponse();\n }\n\n /**\n * Retrieves distinct values of specific field from the content.\n * @deprecated in 4.5. Use [[getDistinctValuesIterator]] instead.\n */\n public async getPagedDistinctValues(\n requestOptions: GetDistinctValuesRequestOptions & MultipleValuesRequestOptions,\n ): Promise<PagedResponse<DisplayValueGroup>> {\n const result = await this.getDistinctValuesIterator(requestOptions);\n return {\n total: result.total,\n items: await collect(result.items),\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: SingleElementPropertiesRequestOptions<IModelConnection, TParsedContent> & ClientDiagnosticsAttribute,\n ): Promise<TParsedContent | undefined> {\n startIModelInitialization(requestOptions.imodel);\n type TParser = Required<typeof requestOptions>[\"contentParser\"];\n const { elementId, contentParser, ...optionsNoElementId } = requestOptions;\n const parser: TParser = contentParser ?? (buildElementProperties as TParser);\n const iter = await this.getContentIterator({\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 (!iter || iter.total === 0) {\n return undefined;\n }\n return parser(iter.descriptor, (await iter.items.next()).value);\n }\n\n /**\n * Retrieves content item instance keys.\n * @public\n */\n public async getContentInstanceKeys(\n requestOptions: ContentInstanceKeysRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute & MultipleValuesRequestOptions,\n ): Promise<{ total: number; items: () => AsyncGenerator<InstanceKey> }> {\n startIModelInitialization(requestOptions.imodel);\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\n const rpcOptions = {\n ...this.toRpcTokenOptions(options),\n keys: stripTransientElementKeys(options.keys).toJSON(),\n };\n\n const generator = new StreamedResponseGenerator({\n ...requestOptions,\n getBatch: async (page) => {\n const keys = await this._requestsHandler.getContentInstanceKeys({ ...rpcOptions, paging: page });\n return {\n total: keys.total,\n items: keys.items.instanceKeys.reduce((instanceKeys, entry) => {\n for (const id of CompressedId64Set.iterable(entry[1])) {\n instanceKeys.push({ className: entry[0], id });\n }\n return instanceKeys;\n }, new Array<InstanceKey>()),\n };\n },\n });\n\n const { total, items } = await generator.createAsyncIteratorResponse();\n return {\n total,\n async *items() {\n yield* items;\n },\n };\n }\n\n /** Retrieves display label definition of specific item. */\n public async getDisplayLabelDefinition(\n requestOptions: DisplayLabelRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute,\n ): Promise<LabelDefinition> {\n startIModelInitialization(requestOptions.imodel);\n const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });\n const result = await this._requestsHandler.getDisplayLabelDefinition(rpcOptions);\n return this._localizationHelper.getLocalizedLabelDefinition(result);\n }\n\n /** Retrieves display label definition of specific items. */\n public async getDisplayLabelDefinitionsIterator(\n requestOptions: DisplayLabelsRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute & MultipleValuesRequestOptions,\n ): Promise<{ total: number; items: AsyncIterableIterator<LabelDefinition> }> {\n startIModelInitialization(requestOptions.imodel);\n const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });\n const generator = new StreamedResponseGenerator({\n ...requestOptions,\n getBatch: async (page) => {\n const partialKeys = !page.start ? rpcOptions.keys : rpcOptions.keys.slice(page.start);\n const result = await this._requestsHandler.getPagedDisplayLabelDefinitions({ ...rpcOptions, keys: partialKeys });\n result.items = this._localizationHelper.getLocalizedLabelDefinitions(result.items);\n return result;\n },\n });\n\n return generator.createAsyncIteratorResponse();\n }\n\n /**\n * Retrieves display label definition of specific items.\n * @deprecated in 4.5. Use [[getDisplayLabelDefinitionsIterator]] instead.\n */\n public async getDisplayLabelDefinitions(\n requestOptions: DisplayLabelsRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute & MultipleValuesRequestOptions,\n ): Promise<LabelDefinition[]> {\n const { items } = await this.getDisplayLabelDefinitionsIterator(requestOptions);\n return collect(items);\n }\n}\n\nconst getDescriptorOverrides = (descriptorOrOverrides: Descriptor | DescriptorOverrides): DescriptorOverrides => {\n if (descriptorOrOverrides instanceof Descriptor) {\n return descriptorOrOverrides.createDescriptorOverrides();\n }\n return descriptorOrOverrides;\n};\n\nconst stripTransientElementKeys = (keys: KeySet) => {\n if (!keys.some((key) => Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME)) {\n return keys;\n }\n\n const copy = new KeySet();\n copy.add(keys, (key) => {\n // the callback is not going to be called with EntityProps as KeySet converts them\n // to InstanceKeys, but we want to keep the EntityProps case for correctness\n /* c8 ignore next 3 */\n const isTransient =\n (Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME) ||\n (Key.isEntityProps(key) && key.classFullName === TRANSIENT_ELEMENT_CLASSNAME);\n return !isTransient;\n });\n return copy;\n};\n\nasync function collect<T>(iter: AsyncIterable<T>): Promise<T[]> {\n const result = new Array<T>();\n for await (const value of iter) {\n result.push(value);\n }\n return result;\n}\n"]}