@itwin/presentation-frontend 3.6.0-dev.8 → 4.0.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -1
- package/LICENSE.md +1 -1
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +0 -1
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts +11 -5
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.js +30 -13
- package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetManager.d.ts +5 -2
- package/lib/cjs/presentation-frontend/RulesetManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/StateTracker.d.ts +18 -3
- package/lib/cjs/presentation-frontend/StateTracker.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/StateTracker.js +104 -49
- package/lib/cjs/presentation-frontend/StateTracker.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/IpcRequestsHandler.js +1 -2
- package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.d.ts +11 -5
- package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.js +31 -14
- package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/esm/presentation-frontend/RulesetManager.d.ts +5 -2
- package/lib/esm/presentation-frontend/RulesetManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/RulesetManager.js.map +1 -1
- package/lib/esm/presentation-frontend/StateTracker.d.ts +18 -3
- package/lib/esm/presentation-frontend/StateTracker.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/StateTracker.js +103 -48
- package/lib/esm/presentation-frontend/StateTracker.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
# Change Log - @itwin/presentation-frontend
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 26 Jan 2023 22:53:28 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 3.5.5
|
|
6
|
+
Thu, 26 Jan 2023 22:53:28 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 3.5.4
|
|
11
|
+
Wed, 18 Jan 2023 15:27:15 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
14
|
+
|
|
15
|
+
## 3.5.3
|
|
16
|
+
Fri, 13 Jan 2023 17:23:07 GMT
|
|
17
|
+
|
|
18
|
+
_Version update only_
|
|
19
|
+
|
|
20
|
+
## 3.5.2
|
|
21
|
+
Wed, 11 Jan 2023 16:46:30 GMT
|
|
22
|
+
|
|
23
|
+
_Version update only_
|
|
24
|
+
|
|
25
|
+
## 3.5.1
|
|
26
|
+
Thu, 15 Dec 2022 16:38:29 GMT
|
|
27
|
+
|
|
28
|
+
_Version update only_
|
|
4
29
|
|
|
5
30
|
## 3.5.0
|
|
6
31
|
Wed, 07 Dec 2022 19:12:37 GMT
|
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MIT License
|
|
2
2
|
|
|
3
|
-
Copyright © 2017-
|
|
3
|
+
Copyright © 2017-2023 Bentley Systems, Incorporated. All rights reserved.
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IpcRequestsHandler.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,OAAO,
|
|
1
|
+
{"version":3,"file":"IpcRequestsHandler.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,OAAO,EAA2D,eAAe,EAAuB,wBAAwB,EAChI,0BAA0B,EAAE,0BAA0B,EACvD,MAAM,4BAA4B,CAAC;AAEpC,gBAAgB;AAChB,qBAAa,kBAAkB;IAC7B,SAAgB,QAAQ,EAAE,MAAM,CAAC;gBAErB,QAAQ,EAAE,MAAM;YAId,IAAI;IAIL,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,EAAE,UAAU,CAAC;IAStF,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,0BAA0B,EAAE,UAAU,CAAC;IAQzE,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC;CAOhG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-frontend/IpcRequestsHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAG/F,wDAA8C;AAC9C,oEAGoC;AAEpC,gBAAgB;AACh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IAEM,KAAK,CAAC,kBAAkB,CAAC,MAAmE;QACjG,MAAM,UAAU,GAAkD;YAChE,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,qCAAe,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;SAClD,CAAC;QACF,OAAO,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;IACrD,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAoD;QACpF,MAAM,UAAU,GAA+B;YAC7C,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;QACF,OAAO,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,UAAU,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAA6D;QAC7F,MAAM,UAAU,GAAwC;YACtD,GAAG,MAAM;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;QACF,OAAO,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,UAAU,CAAC,CAAC;IACvD,CAAC;CACF;AAnCD,gDAmCC","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\r\nimport { AsyncMethodsOf, PromiseReturnType } from \"@itwin/core-bentley\";\r\nimport { IpcApp } from \"@itwin/core-frontend\";\r\nimport {\r\n NodeKey, PRESENTATION_IPC_CHANNEL_NAME, PresentationIpcInterface, RulesetVariable, RulesetVariableJSON, SetRulesetVariableParams,\r\n UnsetRulesetVariableParams, UpdateHierarchyStateParams,\r\n} from \"@itwin/presentation-common\";\r\n\r\n/** @internal */\r\nexport class IpcRequestsHandler {\r\n public readonly clientId: string;\r\n\r\n constructor(clientId: string) {\r\n this.clientId = clientId;\r\n }\r\n\r\n private async call<T extends AsyncMethodsOf<PresentationIpcInterface>>(methodName: T, ...args: Parameters<PresentationIpcInterface[T]>): Promise<PromiseReturnType<PresentationIpcInterface[T]>> {\r\n return IpcApp.callIpcChannel(PRESENTATION_IPC_CHANNEL_NAME, methodName, ...args);\r\n }\r\n\r\n public async setRulesetVariable(params: Omit<SetRulesetVariableParams<RulesetVariable>, \"clientId\">) {\r\n const jsonParams: SetRulesetVariableParams<RulesetVariableJSON> = {\r\n ...params,\r\n clientId: this.clientId,\r\n variable: RulesetVariable.toJSON(params.variable),\r\n };\r\n return this.call(\"setRulesetVariable\", jsonParams);\r\n }\r\n\r\n public async unsetRulesetVariable(params: Omit<UnsetRulesetVariableParams, \"clientId\">) {\r\n const jsonParams: UnsetRulesetVariableParams = {\r\n ...params,\r\n clientId: this.clientId,\r\n };\r\n return this.call(\"unsetRulesetVariable\", jsonParams);\r\n }\r\n\r\n public async updateHierarchyState(params: Omit<UpdateHierarchyStateParams<NodeKey>, \"clientId\">) {\r\n const jsonParams: UpdateHierarchyStateParams<NodeKey> = {\r\n ...params,\r\n clientId: this.clientId,\r\n };\r\n return this.call(\"updateHierarchyState\", jsonParams);\r\n }\r\n}\r\n"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { BeEvent, IDisposable } from "@itwin/core-bentley";
|
|
5
5
|
import { IModelConnection } from "@itwin/core-frontend";
|
|
6
6
|
import { UnitSystemKey } from "@itwin/core-quantity";
|
|
7
|
-
import { ClientDiagnosticsAttribute, Content, ContentDescriptorRequestOptions, ContentInstanceKeysRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, ContentUpdateInfo, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, HierarchyRequestOptions, HierarchyUpdateInfo, InstanceKey, KeySet, LabelDefinition, Node, NodeKey, NodePathElement, Paged, PagedResponse, PageOptions, RpcRequestsHandler, RulesetVariable, SelectClassInfo, SingleElementPropertiesRequestOptions } from "@itwin/presentation-common";
|
|
7
|
+
import { ClientDiagnosticsAttribute, Content, ContentDescriptorRequestOptions, ContentInstanceKeysRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, ContentUpdateInfo, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions, HierarchyUpdateInfo, InstanceKey, KeySet, LabelDefinition, Node, NodeKey, NodePathElement, Paged, PagedResponse, PageOptions, RpcRequestsHandler, RulesetVariable, SelectClassInfo, SingleElementPropertiesRequestOptions } from "@itwin/presentation-common";
|
|
8
8
|
import { IpcRequestsHandler } from "./IpcRequestsHandler";
|
|
9
9
|
import { RulesetManager } from "./RulesetManager";
|
|
10
10
|
import { RulesetVariablesManager } from "./RulesetVariablesManager";
|
|
@@ -136,13 +136,19 @@ export declare class PresentationManager implements IDisposable {
|
|
|
136
136
|
count: number;
|
|
137
137
|
nodes: Node[];
|
|
138
138
|
}>;
|
|
139
|
+
/**
|
|
140
|
+
* Retrieves hierarchy level descriptor.
|
|
141
|
+
* @beta
|
|
142
|
+
*/
|
|
143
|
+
getNodesDescriptor(requestOptions: HierarchyLevelDescriptorRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute): Promise<Descriptor | undefined>;
|
|
139
144
|
/** Retrieves paths from root nodes to children nodes according to specified keys. Intersecting paths will be merged. */
|
|
140
145
|
getNodePaths(requestOptions: FilterByInstancePathsHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute): Promise<NodePathElement[]>;
|
|
141
146
|
/** Retrieves paths from root nodes to nodes containing filter text in their label. */
|
|
142
147
|
getFilteredNodePaths(requestOptions: FilterByTextHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute): Promise<NodePathElement[]>;
|
|
143
148
|
/**
|
|
144
|
-
* Get
|
|
145
|
-
*
|
|
149
|
+
* Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,
|
|
150
|
+
* its related instances for loading related and navigation properties.
|
|
151
|
+
* @public
|
|
146
152
|
*/
|
|
147
153
|
getContentSources(requestOptions: ContentSourcesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute): Promise<SelectClassInfo[]>;
|
|
148
154
|
/** Retrieves the content descriptor which describes the content and can be used to customize it. */
|
|
@@ -160,12 +166,12 @@ export declare class PresentationManager implements IDisposable {
|
|
|
160
166
|
getPagedDistinctValues(requestOptions: DistinctValuesRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<PagedResponse<DisplayValueGroup>>;
|
|
161
167
|
/**
|
|
162
168
|
* Retrieves property data in a simplified format for a single element specified by ID.
|
|
163
|
-
* @
|
|
169
|
+
* @public
|
|
164
170
|
*/
|
|
165
171
|
getElementProperties(requestOptions: SingleElementPropertiesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute): Promise<ElementProperties | undefined>;
|
|
166
172
|
/**
|
|
167
173
|
* Retrieves content item instance keys.
|
|
168
|
-
* @
|
|
174
|
+
* @public
|
|
169
175
|
*/
|
|
170
176
|
getContentInstanceKeys(requestOptions: ContentInstanceKeysRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<{
|
|
171
177
|
total: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAqB,WAAW,EAAuB,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAU,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,0BAA0B,EAAE,OAAO,EAAE,+BAA+B,EAAE,iCAAiC,EAAE,qBAAqB,EAC9H,4BAA4B,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,2BAA2B,EACzI,iBAAiB,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,4CAA4C,EAChH,mCAAmC,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"PresentationManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAqB,WAAW,EAAuB,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAU,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,0BAA0B,EAAE,OAAO,EAAE,+BAA+B,EAAE,iCAAiC,EAAE,qBAAqB,EAC9H,4BAA4B,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,2BAA2B,EACzI,iBAAiB,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,4CAA4C,EAChH,mCAAmC,EAAE,sCAAsC,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,WAAW,EACtI,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAyB,kBAAkB,EACrI,eAAe,EAAE,eAAe,EAAE,qCAAqC,EACxE,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAsB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAA+B,MAAM,2BAA2B,CAAC;AAEjG,OA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AAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IA6B/O,oEAAoE;IACvD,sBAAsB,CAAC,cAAc,EAAE,4BAA4B,CAAC,gBAAgB,EAAE,UAAU,GAAG,mBAAmB,EAAE,MAAM,EAAE,eAAe,CAAC,GAAG,0BAA0B,GAAG,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAgBtO;;;OAGG;IACU,oBAAoB,CAAC,cAAc,EAAE,qCAAqC,CAAC,gBAAgB,CAAC,GAAG,0BAA0B,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;IAS/K;;;OAGG;IACU,sBAAsB,CAAC,cAAc,EAAE,iCAAiC,CAAC,gBAAgB,EAAE,MAAM,EAAE,eAAe,CAAC,GAAG,0BAA0B,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,cAAc,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC;IA0BpO,2DAA2D;IAC9C,yBAAyB,CAAC,cAAc,EAAE,0BAA0B,CAAC,gBAAgB,EAAE,WAAW,CAAC,GAAG,0BAA0B,GAAG,OAAO,CAAC,eAAe,CAAC;IAOxK,4DAA4D;IAC/C,0BAA0B,CAAC,cAAc,EAAE,2BAA2B,CAAC,gBAAgB,EAAE,WAAW,CAAC,GAAG,0BAA0B,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CAU7K;AA+CD,gBAAgB;AAChB,eAAO,MAAM,uBAAuB,yBAAgC,WAAW,GAAG,SAAS,iBAAiB,SAAS,WAAW,CAAC,gBAAgB,MAAM,oEAYtJ,CAAC"}
|
|
@@ -175,34 +175,48 @@ class PresentationManager {
|
|
|
175
175
|
async getNodes(requestOptions) {
|
|
176
176
|
await this.onConnection(requestOptions.imodel);
|
|
177
177
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
178
|
-
const rpcOptions = this.toRpcTokenOptions({ ...options
|
|
178
|
+
const rpcOptions = this.toRpcTokenOptions({ ...options });
|
|
179
179
|
const result = await (0, exports.buildPagedArrayResponse)(options.paging, async (partialPageOptions) => this._requestsHandler.getPagedNodes({ ...rpcOptions, paging: partialPageOptions }));
|
|
180
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
180
181
|
return this._localizationHelper.getLocalizedNodes(result.items.map(presentation_common_1.Node.fromJSON));
|
|
181
182
|
}
|
|
182
183
|
/** Retrieves nodes count. */
|
|
183
184
|
async getNodesCount(requestOptions) {
|
|
184
185
|
await this.onConnection(requestOptions.imodel);
|
|
185
186
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
186
|
-
const rpcOptions = this.toRpcTokenOptions({ ...options
|
|
187
|
+
const rpcOptions = this.toRpcTokenOptions({ ...options });
|
|
187
188
|
return this._requestsHandler.getNodesCount(rpcOptions);
|
|
188
189
|
}
|
|
189
190
|
/** Retrieves total nodes count and a single page of nodes. */
|
|
190
191
|
async getNodesAndCount(requestOptions) {
|
|
191
192
|
await this.onConnection(requestOptions.imodel);
|
|
192
193
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
193
|
-
const rpcOptions = this.toRpcTokenOptions({ ...options
|
|
194
|
+
const rpcOptions = this.toRpcTokenOptions({ ...options });
|
|
194
195
|
const result = await (0, exports.buildPagedArrayResponse)(options.paging, async (partialPageOptions) => this._requestsHandler.getPagedNodes({ ...rpcOptions, paging: partialPageOptions }));
|
|
195
196
|
return {
|
|
196
197
|
count: result.total,
|
|
198
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
197
199
|
nodes: this._localizationHelper.getLocalizedNodes(result.items.map(presentation_common_1.Node.fromJSON)),
|
|
198
200
|
};
|
|
199
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Retrieves hierarchy level descriptor.
|
|
204
|
+
* @beta
|
|
205
|
+
*/
|
|
206
|
+
async getNodesDescriptor(requestOptions) {
|
|
207
|
+
await this.onConnection(requestOptions.imodel);
|
|
208
|
+
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
209
|
+
const rpcOptions = this.toRpcTokenOptions({ ...options });
|
|
210
|
+
const result = await this._requestsHandler.getNodesDescriptor(rpcOptions);
|
|
211
|
+
return presentation_common_1.Descriptor.fromJSON(result);
|
|
212
|
+
}
|
|
200
213
|
/** Retrieves paths from root nodes to children nodes according to specified keys. Intersecting paths will be merged. */
|
|
201
214
|
async getNodePaths(requestOptions) {
|
|
202
215
|
await this.onConnection(requestOptions.imodel);
|
|
203
216
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
204
|
-
const rpcOptions = this.toRpcTokenOptions({ ...options
|
|
217
|
+
const rpcOptions = this.toRpcTokenOptions({ ...options });
|
|
205
218
|
const result = await this._requestsHandler.getNodePaths(rpcOptions);
|
|
219
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
206
220
|
return result.map(presentation_common_1.NodePathElement.fromJSON);
|
|
207
221
|
}
|
|
208
222
|
/** Retrieves paths from root nodes to nodes containing filter text in their label. */
|
|
@@ -210,11 +224,13 @@ class PresentationManager {
|
|
|
210
224
|
await this.onConnection(requestOptions.imodel);
|
|
211
225
|
const options = await this.addRulesetAndVariablesToOptions(requestOptions);
|
|
212
226
|
const result = await this._requestsHandler.getFilteredNodePaths(this.toRpcTokenOptions(options));
|
|
227
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
213
228
|
return result.map(presentation_common_1.NodePathElement.fromJSON);
|
|
214
229
|
}
|
|
215
230
|
/**
|
|
216
|
-
* Get
|
|
217
|
-
*
|
|
231
|
+
* Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,
|
|
232
|
+
* its related instances for loading related and navigation properties.
|
|
233
|
+
* @public
|
|
218
234
|
*/
|
|
219
235
|
async getContentSources(requestOptions) {
|
|
220
236
|
await this.onConnection(requestOptions.imodel);
|
|
@@ -290,12 +306,13 @@ class PresentationManager {
|
|
|
290
306
|
const result = await (0, exports.buildPagedArrayResponse)(requestOptions.paging, async (partialPageOptions) => this._requestsHandler.getPagedDistinctValues({ ...rpcOptions, paging: partialPageOptions }));
|
|
291
307
|
return {
|
|
292
308
|
...result,
|
|
309
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
293
310
|
items: result.items.map(presentation_common_1.DisplayValueGroup.fromJSON),
|
|
294
311
|
};
|
|
295
312
|
}
|
|
296
313
|
/**
|
|
297
314
|
* Retrieves property data in a simplified format for a single element specified by ID.
|
|
298
|
-
* @
|
|
315
|
+
* @public
|
|
299
316
|
*/
|
|
300
317
|
async getElementProperties(requestOptions) {
|
|
301
318
|
await this.onConnection(requestOptions.imodel);
|
|
@@ -307,7 +324,7 @@ class PresentationManager {
|
|
|
307
324
|
}
|
|
308
325
|
/**
|
|
309
326
|
* Retrieves content item instance keys.
|
|
310
|
-
* @
|
|
327
|
+
* @public
|
|
311
328
|
*/
|
|
312
329
|
async getContentInstanceKeys(requestOptions) {
|
|
313
330
|
await this.onConnection(requestOptions.imodel);
|
|
@@ -336,19 +353,19 @@ class PresentationManager {
|
|
|
336
353
|
/** Retrieves display label definition of specific item. */
|
|
337
354
|
async getDisplayLabelDefinition(requestOptions) {
|
|
338
355
|
await this.onConnection(requestOptions.imodel);
|
|
339
|
-
const rpcOptions = this.toRpcTokenOptions({ ...requestOptions
|
|
356
|
+
const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });
|
|
340
357
|
const result = await this._requestsHandler.getDisplayLabelDefinition(rpcOptions);
|
|
341
|
-
return this._localizationHelper.getLocalizedLabelDefinition(
|
|
358
|
+
return this._localizationHelper.getLocalizedLabelDefinition(result);
|
|
342
359
|
}
|
|
343
360
|
/** Retrieves display label definition of specific items. */
|
|
344
361
|
async getDisplayLabelDefinitions(requestOptions) {
|
|
345
362
|
await this.onConnection(requestOptions.imodel);
|
|
346
|
-
const rpcOptions = this.toRpcTokenOptions({ ...requestOptions
|
|
363
|
+
const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });
|
|
347
364
|
const result = await (0, exports.buildPagedArrayResponse)(undefined, async (partialPageOptions) => {
|
|
348
365
|
const partialKeys = (!partialPageOptions.start) ? rpcOptions.keys : rpcOptions.keys.slice(partialPageOptions.start);
|
|
349
366
|
return this._requestsHandler.getPagedDisplayLabelDefinitions({ ...rpcOptions, keys: partialKeys });
|
|
350
367
|
});
|
|
351
|
-
return this._localizationHelper.getLocalizedLabelDefinitions(result.items
|
|
368
|
+
return this._localizationHelper.getLocalizedLabelDefinitions(result.items);
|
|
352
369
|
}
|
|
353
370
|
}
|
|
354
371
|
exports.PresentationManager = PresentationManager;
|
|
@@ -357,7 +374,6 @@ const getDescriptorOverrides = (descriptorOrOverrides) => {
|
|
|
357
374
|
return descriptorOrOverrides.createDescriptorOverrides();
|
|
358
375
|
return descriptorOrOverrides;
|
|
359
376
|
};
|
|
360
|
-
const optionalNodeKeyToJson = (key) => key ? presentation_common_1.NodeKey.toJSON(key) : undefined;
|
|
361
377
|
async function createPagedGeneratorResponse(props) {
|
|
362
378
|
var _a, _b, _c, _d;
|
|
363
379
|
let pageStart = (_b = (_a = props.page) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : 0;
|
|
@@ -399,6 +415,7 @@ const buildPagedArrayResponse = async (requestedPage, getter) => {
|
|
|
399
415
|
return { total: gen.total, items };
|
|
400
416
|
}
|
|
401
417
|
catch {
|
|
418
|
+
// FIXME: we should propagate the error...
|
|
402
419
|
return { total: 0, items: [] };
|
|
403
420
|
}
|
|
404
421
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAmG;AACnG,wDAAgE;AAEhE,oEAOoC;AACpC,6DAA0D;AAC1D,6DAAkE;AAClE,qDAAsE;AACtE,uEAAiG;AACjG,mEAA2E;AAC3E,iDA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,CAAC,WAAW,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { BeEvent, CompressedId64Set, IDisposable, OrderedId64Iterable } from \"@itwin/core-bentley\";\r\nimport { IModelConnection, IpcApp } from \"@itwin/core-frontend\";\r\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport {\r\n ClientDiagnosticsAttribute, Content, ContentDescriptorRequestOptions, ContentInstanceKeysRequestOptions, ContentRequestOptions,\r\n ContentSourcesRequestOptions, ContentUpdateInfo, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions,\r\n DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions,\r\n FilterByTextHierarchyRequestOptions, HierarchyRequestOptions, HierarchyUpdateInfo, InstanceKey, Item, Key, KeySet, LabelDefinition, Node, NodeKey,\r\n NodeKeyJSON, NodePathElement, Paged, PagedResponse, PageOptions, PresentationIpcEvents, RpcRequestsHandler, Ruleset, RulesetVariable,\r\n SelectClassInfo, SingleElementPropertiesRequestOptions, UpdateInfo, UpdateInfoJSON, VariableValueTypes,\r\n} from \"@itwin/presentation-common\";\r\nimport { IpcRequestsHandler } from \"./IpcRequestsHandler\";\r\nimport { FrontendLocalizationHelper } from \"./LocalizationHelper\";\r\nimport { RulesetManager, RulesetManagerImpl } from \"./RulesetManager\";\r\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager\";\r\nimport { TRANSIENT_ELEMENT_CLASSNAME } from \"./selection/SelectionManager\";\r\nimport { StateTracker } from \"./StateTracker\";\r\n\r\n/**\r\n * Data structure that describes IModel hierarchy change event arguments.\r\n * @alpha\r\n */\r\nexport interface IModelHierarchyChangeEventArgs {\r\n /** Id of ruleset that was used to create hierarchy. */\r\n rulesetId: string;\r\n /** Hierarchy changes info. */\r\n updateInfo: HierarchyUpdateInfo;\r\n /** Key of iModel that was used to create hierarchy. It matches [[IModelConnection.key]] property. */\r\n imodelKey: string;\r\n}\r\n\r\n/**\r\n * Data structure that describes iModel content change event arguments.\r\n * @alpha\r\n */\r\nexport interface IModelContentChangeEventArgs {\r\n /** Id of ruleset that was used to create content. */\r\n rulesetId: string;\r\n /** Content changes info. */\r\n updateInfo: ContentUpdateInfo;\r\n /** Key of iModel that was used to create content. It matches [[IModelConnection.key]] property. */\r\n imodelKey: string;\r\n}\r\n\r\n/**\r\n * Properties used to configure [[PresentationManager]]\r\n * @public\r\n */\r\nexport interface PresentationManagerProps {\r\n /**\r\n * Sets the active locale to use when localizing presentation-related\r\n * strings. It can later be changed through [[PresentationManager]].\r\n */\r\n activeLocale?: string;\r\n\r\n /**\r\n * Sets the active unit system to use for formatting property values with\r\n * units. Default presentation units are used if this is not specified. The active unit\r\n * system can later be changed through [[PresentationManager]] or overriden for each request.\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 /** @internal */\r\n rpcRequestsHandler?: RpcRequestsHandler;\r\n\r\n /** @internal */\r\n ipcRequestsHandler?: IpcRequestsHandler;\r\n\r\n /** @internal */\r\n stateTracker?: StateTracker;\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 _rulesetVars: Map<string, RulesetVariablesManager>;\r\n private _clearEventListener?: () => void;\r\n private _connections: Map<IModelConnection, Promise<void>>;\r\n private _ipcRequestsHandler?: IpcRequestsHandler;\r\n private _stateTracker?: StateTracker;\r\n\r\n /**\r\n * An event raised when hierarchies created using specific ruleset change\r\n * @alpha\r\n */\r\n public onIModelHierarchyChanged = new BeEvent<(args: IModelHierarchyChangeEventArgs) => void>();\r\n\r\n /**\r\n * An event raised when content created using specific ruleset changes\r\n * @alpha\r\n */\r\n public onIModelContentChanged = new BeEvent<(args: IModelContentChangeEventArgs) => void>();\r\n\r\n /** Get / set active unit system used to format property values with units */\r\n public activeUnitSystem: UnitSystemKey | undefined;\r\n\r\n private constructor(props?: PresentationManagerProps) {\r\n if (props) {\r\n this.activeUnitSystem = props.activeUnitSystem;\r\n }\r\n\r\n this._requestsHandler = props?.rpcRequestsHandler ?? new RpcRequestsHandler(props ? { clientId: props.clientId } : undefined);\r\n this._rulesetVars = new Map<string, RulesetVariablesManager>();\r\n this._rulesets = RulesetManagerImpl.create();\r\n this._localizationHelper = new FrontendLocalizationHelper(props?.activeLocale);\r\n this._connections = new Map<IModelConnection, Promise<void>>();\r\n\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 this._stateTracker = props?.stateTracker ?? new StateTracker(this._ipcRequestsHandler);\r\n }\r\n }\r\n\r\n /** Get / set active locale used for localizing presentation data */\r\n public get activeLocale(): string | undefined { return this._localizationHelper.locale; }\r\n public set activeLocale(locale: string | undefined) { this._localizationHelper.locale = locale; }\r\n\r\n public dispose() {\r\n this._requestsHandler.dispose();\r\n if (this._clearEventListener) {\r\n this._clearEventListener();\r\n this._clearEventListener = undefined;\r\n }\r\n }\r\n\r\n private async onConnection(imodel: IModelConnection) {\r\n if (!this._connections.has(imodel))\r\n this._connections.set(imodel, this.initializeIModel(imodel));\r\n await this._connections.get(imodel);\r\n }\r\n\r\n private async initializeIModel(imodel: IModelConnection) {\r\n imodel.onClose.addOnce(() => {\r\n this._connections.delete(imodel);\r\n });\r\n await this.onNewiModelConnection(imodel);\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private onUpdate = (_evt: Event, report: UpdateInfoJSON) => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.handleUpdateAsync(UpdateInfo.fromJSON(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 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 const updateInfo = imodelReport[rulesetId];\r\n if (updateInfo.content)\r\n this.onIModelContentChanged.raiseEvent({ rulesetId, updateInfo: updateInfo.content, imodelKey });\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 /** Function that is called when a new IModelConnection is used to retrieve data.\r\n * @internal\r\n */\r\n public async onNewiModelConnection(_: IModelConnection) { }\r\n\r\n /**\r\n * Create a new PresentationManager instance\r\n * @param props Optional properties used to configure the manager\r\n */\r\n public static create(props?: PresentationManagerProps) {\r\n return new PresentationManager(props);\r\n }\r\n\r\n /** @internal */\r\n public get rpcRequestsHandler() { return this._requestsHandler; }\r\n\r\n /** @internal */\r\n public get ipcRequestsHandler() { return this._ipcRequestsHandler; }\r\n\r\n /** @internal */\r\n public get stateTracker() { return this._stateTracker; }\r\n\r\n /**\r\n * Get rulesets manager\r\n */\r\n public rulesets() { return this._rulesets; }\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[] }>(requestOptions: TOptions) {\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 if (this.activeUnitSystem)\r\n defaultOptions.unitSystem = this.activeUnitSystem;\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 return variable;\r\n });\r\n if (!this._ipcRequestsHandler) {\r\n // only need to add variables from variables manager if there's no IPC\r\n // handler - if there is one, the variables are already known by the backend\r\n variables.push(...this.vars(rulesetId).getAllVariables());\r\n }\r\n\r\n return { ...options, rulesetOrId: foundRulesetOrId, rulesetVariables: variables };\r\n }\r\n\r\n /** Retrieves nodes */\r\n public async getNodes(requestOptions: Paged<HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable>> & ClientDiagnosticsAttribute): Promise<Node[]> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options, parentKey: optionalNodeKeyToJson(options.parentKey) });\r\n const result = await buildPagedArrayResponse(options.paging, async (partialPageOptions) => this._requestsHandler.getPagedNodes({ ...rpcOptions, paging: partialPageOptions }));\r\n return this._localizationHelper.getLocalizedNodes(result.items.map(Node.fromJSON));\r\n }\r\n\r\n /** Retrieves nodes count. */\r\n public async getNodesCount(requestOptions: HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute): Promise<number> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options, parentKey: optionalNodeKeyToJson(options.parentKey) });\r\n return this._requestsHandler.getNodesCount(rpcOptions);\r\n }\r\n\r\n /** Retrieves total nodes count and a single page of nodes. */\r\n public async getNodesAndCount(requestOptions: Paged<HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable>> & ClientDiagnosticsAttribute): Promise<{ count: number, nodes: Node[] }> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options, parentKey: optionalNodeKeyToJson(options.parentKey) });\r\n const result = await buildPagedArrayResponse(options.paging, async (partialPageOptions) => this._requestsHandler.getPagedNodes({ ...rpcOptions, paging: partialPageOptions }));\r\n return {\r\n count: result.total,\r\n nodes: this._localizationHelper.getLocalizedNodes(result.items.map(Node.fromJSON)),\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(requestOptions: FilterByInstancePathsHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute): Promise<NodePathElement[]> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options, instancePaths: options.instancePaths.map((p) => p.map(InstanceKey.toJSON)) });\r\n const result = await this._requestsHandler.getNodePaths(rpcOptions);\r\n return result.map(NodePathElement.fromJSON);\r\n }\r\n\r\n /** Retrieves paths from root nodes to nodes containing filter text in their label. */\r\n public async getFilteredNodePaths(requestOptions: FilterByTextHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute): Promise<NodePathElement[]> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const result = await this._requestsHandler.getFilteredNodePaths(this.toRpcTokenOptions(options));\r\n return result.map(NodePathElement.fromJSON);\r\n }\r\n\r\n /**\r\n * Get all content sources for a given list of classes.\r\n * @beta\r\n */\r\n public async getContentSources(requestOptions: ContentSourcesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute): Promise<SelectClassInfo[]> {\r\n await this.onConnection(requestOptions.imodel);\r\n const rpcOptions = this.toRpcTokenOptions(requestOptions);\r\n const result = await this._requestsHandler.getContentSources(rpcOptions);\r\n return SelectClassInfo.listFromCompressedJSON(result.sources, result.classesMap);\r\n }\r\n\r\n /** Retrieves the content descriptor which describes the content and can be used to customize it. */\r\n public async getContentDescriptor(requestOptions: ContentDescriptorRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<Descriptor | undefined> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({\r\n ...options,\r\n keys: stripTransientElementKeys(options.keys).toJSON(),\r\n });\r\n const result = await this._requestsHandler.getContentDescriptor(rpcOptions);\r\n return Descriptor.fromJSON(result);\r\n }\r\n\r\n /** Retrieves overall content set size. */\r\n public async getContentSetSize(requestOptions: ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<number> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({\r\n ...options,\r\n descriptor: getDescriptorOverrides(requestOptions.descriptor),\r\n keys: stripTransientElementKeys(requestOptions.keys).toJSON(),\r\n });\r\n return this._requestsHandler.getContentSetSize(rpcOptions);\r\n }\r\n\r\n /** Retrieves content which consists of a content descriptor and a page of records. */\r\n public async getContent(requestOptions: Paged<ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>> & ClientDiagnosticsAttribute): Promise<Content | undefined> {\r\n return (await this.getContentAndSize(requestOptions))?.content;\r\n }\r\n\r\n /** Retrieves content set size and content which consists of a content descriptor and a page of records. */\r\n public async getContentAndSize(requestOptions: Paged<ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>> & ClientDiagnosticsAttribute): Promise<{ content: Content, size: number } | undefined> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({\r\n ...options,\r\n descriptor: getDescriptorOverrides(requestOptions.descriptor),\r\n keys: stripTransientElementKeys(requestOptions.keys).toJSON(),\r\n });\r\n let descriptor = (requestOptions.descriptor instanceof Descriptor) ? requestOptions.descriptor : undefined;\r\n const result = await buildPagedArrayResponse(options.paging, async (partialPageOptions, requestIndex) => {\r\n if (0 === requestIndex && !descriptor) {\r\n const content = await this._requestsHandler.getPagedContent({ ...rpcOptions, paging: partialPageOptions });\r\n if (content) {\r\n descriptor = Descriptor.fromJSON(content.descriptor);\r\n return content.contentSet;\r\n }\r\n return { total: 0, items: [] };\r\n }\r\n return this._requestsHandler.getPagedContentSet({ ...rpcOptions, paging: partialPageOptions });\r\n });\r\n if (!descriptor)\r\n return undefined;\r\n const items = result.items.map((itemJson) => Item.fromJSON(itemJson)).filter<Item>((item): item is Item => (item !== undefined));\r\n return {\r\n size: result.total,\r\n content: this._localizationHelper.getLocalizedContent(new Content(descriptor, items)),\r\n };\r\n }\r\n\r\n /** Retrieves distinct values of specific field from the content. */\r\n public async getPagedDistinctValues(requestOptions: DistinctValuesRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<PagedResponse<DisplayValueGroup>> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = {\r\n ...this.toRpcTokenOptions(options),\r\n descriptor: getDescriptorOverrides(options.descriptor),\r\n keys: stripTransientElementKeys(options.keys).toJSON(),\r\n };\r\n const result = await buildPagedArrayResponse(requestOptions.paging, async (partialPageOptions) => this._requestsHandler.getPagedDistinctValues({ ...rpcOptions, paging: partialPageOptions }));\r\n return {\r\n ...result,\r\n items: result.items.map(DisplayValueGroup.fromJSON),\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 * @beta\r\n */\r\n public async getElementProperties(requestOptions: SingleElementPropertiesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute): Promise<ElementProperties | undefined> {\r\n await this.onConnection(requestOptions.imodel);\r\n const results = await this._requestsHandler.getElementProperties(this.toRpcTokenOptions(requestOptions));\r\n // istanbul ignore if\r\n if (!results)\r\n return undefined;\r\n return this._localizationHelper.getLocalizedElementProperties(results);\r\n }\r\n\r\n /**\r\n * Retrieves content item instance keys.\r\n * @beta\r\n */\r\n public async getContentInstanceKeys(requestOptions: ContentInstanceKeysRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<{ total: number, items: () => AsyncGenerator<InstanceKey> }> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = {\r\n ...this.toRpcTokenOptions(options),\r\n keys: stripTransientElementKeys(options.keys).toJSON(),\r\n };\r\n\r\n const props = {\r\n page: requestOptions.paging,\r\n get: async (page: Required<PageOptions>) => {\r\n const keys = await this._requestsHandler.getContentInstanceKeys({ ...rpcOptions, paging: page });\r\n return {\r\n total: keys.total,\r\n items: keys.items.instanceKeys.reduce((instanceKeys, entry) => {\r\n for (const id of CompressedId64Set.iterable(entry[1])) {\r\n instanceKeys.push({ className: entry[0], id });\r\n }\r\n return instanceKeys;\r\n }, new Array<InstanceKey>()),\r\n };\r\n },\r\n };\r\n return createPagedGeneratorResponse(props);\r\n }\r\n\r\n /** Retrieves display label definition of specific item. */\r\n public async getDisplayLabelDefinition(requestOptions: DisplayLabelRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute): Promise<LabelDefinition> {\r\n await this.onConnection(requestOptions.imodel);\r\n const rpcOptions = this.toRpcTokenOptions({ ...requestOptions, key: InstanceKey.toJSON(requestOptions.key) });\r\n const result = await this._requestsHandler.getDisplayLabelDefinition(rpcOptions);\r\n return this._localizationHelper.getLocalizedLabelDefinition(LabelDefinition.fromJSON(result));\r\n }\r\n\r\n /** Retrieves display label definition of specific items. */\r\n public async getDisplayLabelDefinitions(requestOptions: DisplayLabelsRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute): Promise<LabelDefinition[]> {\r\n await this.onConnection(requestOptions.imodel);\r\n const rpcOptions = this.toRpcTokenOptions({ ...requestOptions, keys: requestOptions.keys.map(InstanceKey.toJSON) });\r\n const result = await buildPagedArrayResponse(undefined, async (partialPageOptions) => {\r\n const partialKeys = (!partialPageOptions.start) ? rpcOptions.keys : rpcOptions.keys.slice(partialPageOptions.start);\r\n return this._requestsHandler.getPagedDisplayLabelDefinitions({ ...rpcOptions, keys: partialKeys });\r\n });\r\n return this._localizationHelper.getLocalizedLabelDefinitions(result.items.map(LabelDefinition.fromJSON));\r\n }\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 return descriptorOrOverrides;\r\n};\r\n\r\nconst optionalNodeKeyToJson = (key: NodeKey | undefined): NodeKeyJSON | undefined => key ? NodeKey.toJSON(key) : undefined;\r\n\r\ninterface PagedGeneratorCreateProps<TPagedResponseItem> {\r\n page: PageOptions | undefined;\r\n get: (pageStart: Required<PageOptions>, requestIndex: number) => Promise<{ total: number, items: TPagedResponseItem[] }>;\r\n}\r\nasync function createPagedGeneratorResponse<TPagedResponseItem>(props: PagedGeneratorCreateProps<TPagedResponseItem>) {\r\n let pageStart = props.page?.start ?? 0;\r\n let pageSize = props.page?.size ?? 0;\r\n let requestIndex = 0;\r\n\r\n const firstPage = await props.get({ start: pageStart, size: pageSize }, requestIndex++);\r\n return {\r\n total: firstPage.total,\r\n async *items() {\r\n let partialResult = firstPage;\r\n while (true) {\r\n for (const item of partialResult.items) {\r\n yield item;\r\n }\r\n\r\n const receivedItemsCount = partialResult.items.length;\r\n if (partialResult.total !== 0 && receivedItemsCount === 0) {\r\n if (pageStart >= partialResult.total)\r\n throw new Error(`Requested page with start index ${pageStart} is out of bounds. Total number of items: ${partialResult.total}`);\r\n throw new Error(\"Paged request returned non zero total count but no items\");\r\n }\r\n\r\n if (pageSize !== 0 && receivedItemsCount >= pageSize || receivedItemsCount >= (partialResult.total - pageStart))\r\n break;\r\n\r\n if (pageSize !== 0)\r\n pageSize -= receivedItemsCount;\r\n pageStart += receivedItemsCount;\r\n\r\n partialResult = await props.get({ start: pageStart, size: pageSize }, requestIndex++);\r\n }\r\n },\r\n };\r\n}\r\n\r\n/** @internal */\r\nexport const buildPagedArrayResponse = async <TItem>(requestedPage: PageOptions | undefined, getter: (page: Required<PageOptions>, requestIndex: number) => Promise<PagedResponse<TItem>>): Promise<PagedResponse<TItem>> => {\r\n try {\r\n const items = new Array<TItem>();\r\n const gen = await createPagedGeneratorResponse({ page: requestedPage, get: getter });\r\n for await (const item of gen.items()) {\r\n items.push(item);\r\n }\r\n return { total: gen.total, items };\r\n } catch {\r\n return { total: 0, items: [] };\r\n }\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 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 = Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME\r\n || Key.isEntityProps(key) && key.classFullName === TRANSIENT_ELEMENT_CLASSNAME;\r\n return !isTransient;\r\n });\r\n return copy;\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"PresentationManager.js","sourceRoot":"","sources":["../../../src/presentation-frontend/PresentationManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAmG;AACnG,wDAAgE;AAEhE,oEAOoC;AACpC,6DAA0D;AAC1D,6DAAkE;AAClE,qDAAsE;AACtE,uEAAiG;AACjG,mEAA2E;AAC3E,iDAA8C;AA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KAAK,EAAS,CAAC;QACjC,MAAM,GAAG,GAAG,MAAM,4BAA4B,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;QACrF,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,EAAE,EAAE;YACpC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAClB;QACD,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC;KACpC;IAAC,MAAM;QACN,0CAA0C;QAC1C,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;KAChC;AACH,CAAC,CAAC;AAZW,QAAA,uBAAuB,2BAYlC;AAEF,MAAM,yBAAyB,GAAG,CAAC,IAAY,EAAE,EAAE;IACjD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,yBAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,SAAS,KAAK,8CAA2B,CAAC;QAC9F,OAAO,IAAI,CAAC;IAEd,MAAM,IAAI,GAAG,IAAI,4BAAM,EAAE,CAAC;IAC1B,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;QACrB,kFAAkF;QAClF,4EAA4E;QAC5E,uBAAuB;QACvB,MAAM,WAAW,GAAG,yBAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,SAAS,KAAK,8CAA2B;eACtF,yBAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,aAAa,KAAK,8CAA2B,CAAC;QACjF,OAAO,CAAC,WAAW,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { BeEvent, CompressedId64Set, IDisposable, OrderedId64Iterable } from \"@itwin/core-bentley\";\r\nimport { IModelConnection, IpcApp } from \"@itwin/core-frontend\";\r\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport {\r\n ClientDiagnosticsAttribute, Content, ContentDescriptorRequestOptions, ContentInstanceKeysRequestOptions, ContentRequestOptions,\r\n ContentSourcesRequestOptions, ContentUpdateInfo, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions,\r\n DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, FilterByInstancePathsHierarchyRequestOptions,\r\n FilterByTextHierarchyRequestOptions, HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions, HierarchyUpdateInfo, InstanceKey, Item, Key,\r\n KeySet, LabelDefinition, Node, NodeKey, NodePathElement, Paged, PagedResponse, PageOptions, PresentationIpcEvents, RpcRequestsHandler, Ruleset,\r\n RulesetVariable, SelectClassInfo, SingleElementPropertiesRequestOptions, UpdateInfo, UpdateInfoJSON, VariableValueTypes,\r\n} from \"@itwin/presentation-common\";\r\nimport { IpcRequestsHandler } from \"./IpcRequestsHandler\";\r\nimport { FrontendLocalizationHelper } from \"./LocalizationHelper\";\r\nimport { RulesetManager, RulesetManagerImpl } from \"./RulesetManager\";\r\nimport { RulesetVariablesManager, RulesetVariablesManagerImpl } from \"./RulesetVariablesManager\";\r\nimport { TRANSIENT_ELEMENT_CLASSNAME } from \"./selection/SelectionManager\";\r\nimport { StateTracker } from \"./StateTracker\";\r\n\r\n/**\r\n * Data structure that describes IModel hierarchy change event arguments.\r\n * @alpha\r\n */\r\nexport interface IModelHierarchyChangeEventArgs {\r\n /** Id of ruleset that was used to create hierarchy. */\r\n rulesetId: string;\r\n /** Hierarchy changes info. */\r\n updateInfo: HierarchyUpdateInfo;\r\n /** Key of iModel that was used to create hierarchy. It matches [[IModelConnection.key]] property. */\r\n imodelKey: string;\r\n}\r\n\r\n/**\r\n * Data structure that describes iModel content change event arguments.\r\n * @alpha\r\n */\r\nexport interface IModelContentChangeEventArgs {\r\n /** Id of ruleset that was used to create content. */\r\n rulesetId: string;\r\n /** Content changes info. */\r\n updateInfo: ContentUpdateInfo;\r\n /** Key of iModel that was used to create content. It matches [[IModelConnection.key]] property. */\r\n imodelKey: string;\r\n}\r\n\r\n/**\r\n * Properties used to configure [[PresentationManager]]\r\n * @public\r\n */\r\nexport interface PresentationManagerProps {\r\n /**\r\n * Sets the active locale to use when localizing presentation-related\r\n * strings. It can later be changed through [[PresentationManager]].\r\n */\r\n activeLocale?: string;\r\n\r\n /**\r\n * Sets the active unit system to use for formatting property values with\r\n * units. Default presentation units are used if this is not specified. The active unit\r\n * system can later be changed through [[PresentationManager]] or overriden for each request.\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 /** @internal */\r\n rpcRequestsHandler?: RpcRequestsHandler;\r\n\r\n /** @internal */\r\n ipcRequestsHandler?: IpcRequestsHandler;\r\n\r\n /** @internal */\r\n stateTracker?: StateTracker;\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 _rulesetVars: Map<string, RulesetVariablesManager>;\r\n private _clearEventListener?: () => void;\r\n private _connections: Map<IModelConnection, Promise<void>>;\r\n private _ipcRequestsHandler?: IpcRequestsHandler;\r\n private _stateTracker?: StateTracker;\r\n\r\n /**\r\n * An event raised when hierarchies created using specific ruleset change\r\n * @alpha\r\n */\r\n public onIModelHierarchyChanged = new BeEvent<(args: IModelHierarchyChangeEventArgs) => void>();\r\n\r\n /**\r\n * An event raised when content created using specific ruleset changes\r\n * @alpha\r\n */\r\n public onIModelContentChanged = new BeEvent<(args: IModelContentChangeEventArgs) => void>();\r\n\r\n /** Get / set active unit system used to format property values with units */\r\n public activeUnitSystem: UnitSystemKey | undefined;\r\n\r\n private constructor(props?: PresentationManagerProps) {\r\n if (props) {\r\n this.activeUnitSystem = props.activeUnitSystem;\r\n }\r\n\r\n this._requestsHandler = props?.rpcRequestsHandler ?? new RpcRequestsHandler(props ? { clientId: props.clientId } : undefined);\r\n this._rulesetVars = new Map<string, RulesetVariablesManager>();\r\n this._rulesets = RulesetManagerImpl.create();\r\n this._localizationHelper = new FrontendLocalizationHelper(props?.activeLocale);\r\n this._connections = new Map<IModelConnection, Promise<void>>();\r\n\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 this._stateTracker = props?.stateTracker ?? new StateTracker(this._ipcRequestsHandler);\r\n }\r\n }\r\n\r\n /** Get / set active locale used for localizing presentation data */\r\n public get activeLocale(): string | undefined { return this._localizationHelper.locale; }\r\n public set activeLocale(locale: string | undefined) { this._localizationHelper.locale = locale; }\r\n\r\n public dispose() {\r\n this._requestsHandler.dispose();\r\n if (this._clearEventListener) {\r\n this._clearEventListener();\r\n this._clearEventListener = undefined;\r\n }\r\n }\r\n\r\n private async onConnection(imodel: IModelConnection) {\r\n if (!this._connections.has(imodel))\r\n this._connections.set(imodel, this.initializeIModel(imodel));\r\n await this._connections.get(imodel);\r\n }\r\n\r\n private async initializeIModel(imodel: IModelConnection) {\r\n imodel.onClose.addOnce(() => {\r\n this._connections.delete(imodel);\r\n });\r\n await this.onNewiModelConnection(imodel);\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private onUpdate = (_evt: Event, report: UpdateInfoJSON) => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.handleUpdateAsync(UpdateInfo.fromJSON(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 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 const updateInfo = imodelReport[rulesetId];\r\n if (updateInfo.content)\r\n this.onIModelContentChanged.raiseEvent({ rulesetId, updateInfo: updateInfo.content, imodelKey });\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 /** Function that is called when a new IModelConnection is used to retrieve data.\r\n * @internal\r\n */\r\n public async onNewiModelConnection(_: IModelConnection) { }\r\n\r\n /**\r\n * Create a new PresentationManager instance\r\n * @param props Optional properties used to configure the manager\r\n */\r\n public static create(props?: PresentationManagerProps) {\r\n return new PresentationManager(props);\r\n }\r\n\r\n /** @internal */\r\n public get rpcRequestsHandler() { return this._requestsHandler; }\r\n\r\n /** @internal */\r\n public get ipcRequestsHandler() { return this._ipcRequestsHandler; }\r\n\r\n /** @internal */\r\n public get stateTracker() { return this._stateTracker; }\r\n\r\n /**\r\n * Get rulesets manager\r\n */\r\n public rulesets() { return this._rulesets; }\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[] }>(requestOptions: TOptions) {\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 if (this.activeUnitSystem)\r\n defaultOptions.unitSystem = this.activeUnitSystem;\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 return variable;\r\n });\r\n if (!this._ipcRequestsHandler) {\r\n // only need to add variables from variables manager if there's no IPC\r\n // handler - if there is one, the variables are already known by the backend\r\n variables.push(...this.vars(rulesetId).getAllVariables());\r\n }\r\n\r\n return { ...options, rulesetOrId: foundRulesetOrId, rulesetVariables: variables };\r\n }\r\n\r\n /** Retrieves nodes */\r\n public async getNodes(requestOptions: Paged<HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable>> & ClientDiagnosticsAttribute): Promise<Node[]> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options });\r\n const result = await buildPagedArrayResponse(options.paging, async (partialPageOptions) => this._requestsHandler.getPagedNodes({ ...rpcOptions, paging: partialPageOptions }));\r\n // eslint-disable-next-line deprecation/deprecation\r\n return this._localizationHelper.getLocalizedNodes(result.items.map(Node.fromJSON));\r\n }\r\n\r\n /** Retrieves nodes count. */\r\n public async getNodesCount(requestOptions: HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute): Promise<number> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options });\r\n return this._requestsHandler.getNodesCount(rpcOptions);\r\n }\r\n\r\n /** Retrieves total nodes count and a single page of nodes. */\r\n public async getNodesAndCount(requestOptions: Paged<HierarchyRequestOptions<IModelConnection, NodeKey, RulesetVariable>> & ClientDiagnosticsAttribute): Promise<{ count: number, nodes: Node[] }> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options });\r\n const result = await buildPagedArrayResponse(options.paging, async (partialPageOptions) => this._requestsHandler.getPagedNodes({ ...rpcOptions, paging: partialPageOptions }));\r\n return {\r\n count: result.total,\r\n // eslint-disable-next-line deprecation/deprecation\r\n nodes: this._localizationHelper.getLocalizedNodes(result.items.map(Node.fromJSON)),\r\n };\r\n }\r\n\r\n /**\r\n * Retrieves hierarchy level descriptor.\r\n * @beta\r\n */\r\n public async getNodesDescriptor(requestOptions: HierarchyLevelDescriptorRequestOptions<IModelConnection, NodeKey, RulesetVariable> & ClientDiagnosticsAttribute): Promise<Descriptor | undefined> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options });\r\n const result = await this._requestsHandler.getNodesDescriptor(rpcOptions);\r\n return Descriptor.fromJSON(result);\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(requestOptions: FilterByInstancePathsHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute): Promise<NodePathElement[]> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({ ...options });\r\n const result = await this._requestsHandler.getNodePaths(rpcOptions);\r\n // eslint-disable-next-line deprecation/deprecation\r\n return result.map(NodePathElement.fromJSON);\r\n }\r\n\r\n /** Retrieves paths from root nodes to nodes containing filter text in their label. */\r\n public async getFilteredNodePaths(requestOptions: FilterByTextHierarchyRequestOptions<IModelConnection, RulesetVariable> & ClientDiagnosticsAttribute): Promise<NodePathElement[]> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const result = await this._requestsHandler.getFilteredNodePaths(this.toRpcTokenOptions(options));\r\n // eslint-disable-next-line deprecation/deprecation\r\n return result.map(NodePathElement.fromJSON);\r\n }\r\n\r\n /**\r\n * Get information about the sources of content when building it for specific ECClasses. Sources involve classes of the primary select instance,\r\n * its related instances for loading related and navigation properties.\r\n * @public\r\n */\r\n public async getContentSources(requestOptions: ContentSourcesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute): Promise<SelectClassInfo[]> {\r\n await this.onConnection(requestOptions.imodel);\r\n const rpcOptions = this.toRpcTokenOptions(requestOptions);\r\n const result = await this._requestsHandler.getContentSources(rpcOptions);\r\n return SelectClassInfo.listFromCompressedJSON(result.sources, result.classesMap);\r\n }\r\n\r\n /** Retrieves the content descriptor which describes the content and can be used to customize it. */\r\n public async getContentDescriptor(requestOptions: ContentDescriptorRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<Descriptor | undefined> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({\r\n ...options,\r\n keys: stripTransientElementKeys(options.keys).toJSON(),\r\n });\r\n const result = await this._requestsHandler.getContentDescriptor(rpcOptions);\r\n return Descriptor.fromJSON(result);\r\n }\r\n\r\n /** Retrieves overall content set size. */\r\n public async getContentSetSize(requestOptions: ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<number> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({\r\n ...options,\r\n descriptor: getDescriptorOverrides(requestOptions.descriptor),\r\n keys: stripTransientElementKeys(requestOptions.keys).toJSON(),\r\n });\r\n return this._requestsHandler.getContentSetSize(rpcOptions);\r\n }\r\n\r\n /** Retrieves content which consists of a content descriptor and a page of records. */\r\n public async getContent(requestOptions: Paged<ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>> & ClientDiagnosticsAttribute): Promise<Content | undefined> {\r\n return (await this.getContentAndSize(requestOptions))?.content;\r\n }\r\n\r\n /** Retrieves content set size and content which consists of a content descriptor and a page of records. */\r\n public async getContentAndSize(requestOptions: Paged<ContentRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable>> & ClientDiagnosticsAttribute): Promise<{ content: Content, size: number } | undefined> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = this.toRpcTokenOptions({\r\n ...options,\r\n descriptor: getDescriptorOverrides(requestOptions.descriptor),\r\n keys: stripTransientElementKeys(requestOptions.keys).toJSON(),\r\n });\r\n let descriptor = (requestOptions.descriptor instanceof Descriptor) ? requestOptions.descriptor : undefined;\r\n const result = await buildPagedArrayResponse(options.paging, async (partialPageOptions, requestIndex) => {\r\n if (0 === requestIndex && !descriptor) {\r\n const content = await this._requestsHandler.getPagedContent({ ...rpcOptions, paging: partialPageOptions });\r\n if (content) {\r\n descriptor = Descriptor.fromJSON(content.descriptor);\r\n return content.contentSet;\r\n }\r\n return { total: 0, items: [] };\r\n }\r\n return this._requestsHandler.getPagedContentSet({ ...rpcOptions, paging: partialPageOptions });\r\n });\r\n if (!descriptor)\r\n return undefined;\r\n const items = result.items.map((itemJson) => Item.fromJSON(itemJson)).filter<Item>((item): item is Item => (item !== undefined));\r\n return {\r\n size: result.total,\r\n content: this._localizationHelper.getLocalizedContent(new Content(descriptor, items)),\r\n };\r\n }\r\n\r\n /** Retrieves distinct values of specific field from the content. */\r\n public async getPagedDistinctValues(requestOptions: DistinctValuesRequestOptions<IModelConnection, Descriptor | DescriptorOverrides, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<PagedResponse<DisplayValueGroup>> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = {\r\n ...this.toRpcTokenOptions(options),\r\n descriptor: getDescriptorOverrides(options.descriptor),\r\n keys: stripTransientElementKeys(options.keys).toJSON(),\r\n };\r\n const result = await buildPagedArrayResponse(requestOptions.paging, async (partialPageOptions) => this._requestsHandler.getPagedDistinctValues({ ...rpcOptions, paging: partialPageOptions }));\r\n return {\r\n ...result,\r\n // eslint-disable-next-line deprecation/deprecation\r\n items: result.items.map(DisplayValueGroup.fromJSON),\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(requestOptions: SingleElementPropertiesRequestOptions<IModelConnection> & ClientDiagnosticsAttribute): Promise<ElementProperties | undefined> {\r\n await this.onConnection(requestOptions.imodel);\r\n const results = await this._requestsHandler.getElementProperties(this.toRpcTokenOptions(requestOptions));\r\n // istanbul ignore if\r\n if (!results)\r\n return undefined;\r\n return this._localizationHelper.getLocalizedElementProperties(results);\r\n }\r\n\r\n /**\r\n * Retrieves content item instance keys.\r\n * @public\r\n */\r\n public async getContentInstanceKeys(requestOptions: ContentInstanceKeysRequestOptions<IModelConnection, KeySet, RulesetVariable> & ClientDiagnosticsAttribute): Promise<{ total: number, items: () => AsyncGenerator<InstanceKey> }> {\r\n await this.onConnection(requestOptions.imodel);\r\n const options = await this.addRulesetAndVariablesToOptions(requestOptions);\r\n const rpcOptions = {\r\n ...this.toRpcTokenOptions(options),\r\n keys: stripTransientElementKeys(options.keys).toJSON(),\r\n };\r\n\r\n const props = {\r\n page: requestOptions.paging,\r\n get: async (page: Required<PageOptions>) => {\r\n const keys = await this._requestsHandler.getContentInstanceKeys({ ...rpcOptions, paging: page });\r\n return {\r\n total: keys.total,\r\n items: keys.items.instanceKeys.reduce((instanceKeys, entry) => {\r\n for (const id of CompressedId64Set.iterable(entry[1])) {\r\n instanceKeys.push({ className: entry[0], id });\r\n }\r\n return instanceKeys;\r\n }, new Array<InstanceKey>()),\r\n };\r\n },\r\n };\r\n return createPagedGeneratorResponse(props);\r\n }\r\n\r\n /** Retrieves display label definition of specific item. */\r\n public async getDisplayLabelDefinition(requestOptions: DisplayLabelRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute): Promise<LabelDefinition> {\r\n await this.onConnection(requestOptions.imodel);\r\n const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });\r\n const result = await this._requestsHandler.getDisplayLabelDefinition(rpcOptions);\r\n return this._localizationHelper.getLocalizedLabelDefinition(result);\r\n }\r\n\r\n /** Retrieves display label definition of specific items. */\r\n public async getDisplayLabelDefinitions(requestOptions: DisplayLabelsRequestOptions<IModelConnection, InstanceKey> & ClientDiagnosticsAttribute): Promise<LabelDefinition[]> {\r\n await this.onConnection(requestOptions.imodel);\r\n const rpcOptions = this.toRpcTokenOptions({ ...requestOptions });\r\n const result = await buildPagedArrayResponse(undefined, async (partialPageOptions) => {\r\n const partialKeys = (!partialPageOptions.start) ? rpcOptions.keys : rpcOptions.keys.slice(partialPageOptions.start);\r\n return this._requestsHandler.getPagedDisplayLabelDefinitions({ ...rpcOptions, keys: partialKeys });\r\n });\r\n return this._localizationHelper.getLocalizedLabelDefinitions(result.items);\r\n }\r\n\r\n}\r\n\r\nconst getDescriptorOverrides = (descriptorOrOverrides: Descriptor | DescriptorOverrides): DescriptorOverrides => {\r\n if (descriptorOrOverrides instanceof Descriptor)\r\n return descriptorOrOverrides.createDescriptorOverrides();\r\n return descriptorOrOverrides;\r\n};\r\n\r\ninterface PagedGeneratorCreateProps<TPagedResponseItem> {\r\n page: PageOptions | undefined;\r\n get: (pageStart: Required<PageOptions>, requestIndex: number) => Promise<{ total: number, items: TPagedResponseItem[] }>;\r\n}\r\nasync function createPagedGeneratorResponse<TPagedResponseItem>(props: PagedGeneratorCreateProps<TPagedResponseItem>) {\r\n let pageStart = props.page?.start ?? 0;\r\n let pageSize = props.page?.size ?? 0;\r\n let requestIndex = 0;\r\n\r\n const firstPage = await props.get({ start: pageStart, size: pageSize }, requestIndex++);\r\n return {\r\n total: firstPage.total,\r\n async *items() {\r\n let partialResult = firstPage;\r\n while (true) {\r\n for (const item of partialResult.items) {\r\n yield item;\r\n }\r\n\r\n const receivedItemsCount = partialResult.items.length;\r\n if (partialResult.total !== 0 && receivedItemsCount === 0) {\r\n if (pageStart >= partialResult.total)\r\n throw new Error(`Requested page with start index ${pageStart} is out of bounds. Total number of items: ${partialResult.total}`);\r\n throw new Error(\"Paged request returned non zero total count but no items\");\r\n }\r\n\r\n if (pageSize !== 0 && receivedItemsCount >= pageSize || receivedItemsCount >= (partialResult.total - pageStart))\r\n break;\r\n\r\n if (pageSize !== 0)\r\n pageSize -= receivedItemsCount;\r\n pageStart += receivedItemsCount;\r\n\r\n partialResult = await props.get({ start: pageStart, size: pageSize }, requestIndex++);\r\n }\r\n },\r\n };\r\n}\r\n\r\n/** @internal */\r\nexport const buildPagedArrayResponse = async <TItem>(requestedPage: PageOptions | undefined, getter: (page: Required<PageOptions>, requestIndex: number) => Promise<PagedResponse<TItem>>): Promise<PagedResponse<TItem>> => {\r\n try {\r\n const items = new Array<TItem>();\r\n const gen = await createPagedGeneratorResponse({ page: requestedPage, get: getter });\r\n for await (const item of gen.items()) {\r\n items.push(item);\r\n }\r\n return { total: gen.total, items };\r\n } catch {\r\n // FIXME: we should propagate the error...\r\n return { total: 0, items: [] };\r\n }\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 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 = 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"]}
|
|
@@ -8,7 +8,10 @@ import { RegisteredRuleset, Ruleset } from "@itwin/presentation-common";
|
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
10
|
export interface RulesetManager {
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* An event invoked one a ruleset is modified using [[modify]] function.
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
12
15
|
onRulesetModified: BeEvent<(curr: RegisteredRuleset, prev: Ruleset) => void>;
|
|
13
16
|
/**
|
|
14
17
|
* Get a ruleset with the specified id.
|
|
@@ -20,7 +23,7 @@ export interface RulesetManager {
|
|
|
20
23
|
add(ruleset: Ruleset): Promise<RegisteredRuleset>;
|
|
21
24
|
/**
|
|
22
25
|
* Modify the given pre-registered ruleset
|
|
23
|
-
* @
|
|
26
|
+
* @beta
|
|
24
27
|
*/
|
|
25
28
|
modify(ruleset: RegisteredRuleset, newRules: Omit<Ruleset, "id">): Promise<RegisteredRuleset>;
|
|
26
29
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RulesetManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/RulesetManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAQ,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAExE;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B
|
|
1
|
+
{"version":3,"file":"RulesetManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/RulesetManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAQ,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAExE;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,iBAAiB,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC,CAAC;IAE7E;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;IAExD;;OAEG;IACH,GAAG,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AAe,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;CAEF;AA/ED,gDA+EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { BeEvent, Guid } from \"@itwin/core-bentley\";\r\nimport { RegisteredRuleset, Ruleset } from \"@itwin/presentation-common\";\r\n\r\n/**\r\n * Presentation ruleset registry.\r\n * @public\r\n */\r\nexport interface RulesetManager {\r\n /**\r\n * An event invoked one a ruleset is modified using [[modify]] function.\r\n * @beta\r\n */\r\n onRulesetModified: BeEvent<(curr: RegisteredRuleset, prev: Ruleset) => void>;\r\n\r\n /**\r\n * Get a ruleset with the specified id.\r\n */\r\n get(id: string): Promise<RegisteredRuleset | undefined>;\r\n\r\n /**\r\n * Register the supplied ruleset\r\n */\r\n add(ruleset: Ruleset): Promise<RegisteredRuleset>;\r\n\r\n /**\r\n * Modify the given pre-registered ruleset\r\n * @beta\r\n */\r\n modify(ruleset: RegisteredRuleset, newRules: Omit<Ruleset, \"id\">): Promise<RegisteredRuleset>;\r\n\r\n /**\r\n * Unregister the supplied ruleset\r\n */\r\n remove(ruleset: RegisteredRuleset | [string, string]): Promise<boolean>;\r\n\r\n /**\r\n * Remove all rulesets registered in this session.\r\n */\r\n clear(): Promise<void>;\r\n}\r\n\r\n/** @internal */\r\nexport class RulesetManagerImpl implements RulesetManager {\r\n\r\n private _clientRulesets = new Map<string, RegisteredRuleset[]>();\r\n public onRulesetModified = new BeEvent<(curr: RegisteredRuleset, prev: Ruleset) => void>();\r\n\r\n public static create() {\r\n return new RulesetManagerImpl();\r\n }\r\n\r\n /**\r\n * Get a ruleset with the specified id.\r\n */\r\n public async get(id: string): Promise<RegisteredRuleset | undefined> {\r\n const m = this._clientRulesets.get(id);\r\n if (!m)\r\n return undefined;\r\n return m[0];\r\n }\r\n\r\n /**\r\n * Register the supplied ruleset\r\n */\r\n public async add(ruleset: Ruleset): Promise<RegisteredRuleset> {\r\n const registered = new RegisteredRuleset(ruleset, Guid.createValue(), async (r: RegisteredRuleset) => this.remove(r));\r\n if (!this._clientRulesets.has(ruleset.id))\r\n this._clientRulesets.set(ruleset.id, []);\r\n this._clientRulesets.get(ruleset.id)!.push(registered);\r\n return registered;\r\n }\r\n\r\n /**\r\n * Modifies the given pre-registered ruleset\r\n */\r\n public async modify(ruleset: RegisteredRuleset, newRules: Omit<Ruleset, \"id\">): Promise<RegisteredRuleset> {\r\n await this.remove(ruleset);\r\n const modified = await this.add({ ...newRules, id: ruleset.id });\r\n this.onRulesetModified.raiseEvent(modified, ruleset.toJSON());\r\n return modified;\r\n }\r\n\r\n /**\r\n * Unregister the supplied ruleset\r\n */\r\n public async remove(ruleset: RegisteredRuleset | [string, string]): Promise<boolean> {\r\n let rulesetId, uniqueIdentifier: string;\r\n if (Array.isArray(ruleset)) {\r\n rulesetId = ruleset[0];\r\n uniqueIdentifier = ruleset[1];\r\n } else {\r\n rulesetId = ruleset.id;\r\n uniqueIdentifier = ruleset.uniqueIdentifier;\r\n }\r\n\r\n const m = this._clientRulesets.get(rulesetId);\r\n if (!m)\r\n return false;\r\n\r\n let didRemove = false;\r\n for (let i = 0; i < m.length; ++i) {\r\n if (m[i].uniqueIdentifier === uniqueIdentifier) {\r\n m.splice(i, 1);\r\n didRemove = true;\r\n break;\r\n }\r\n }\r\n\r\n return didRemove;\r\n }\r\n\r\n /**\r\n * Remove all rulesets registered in this session.\r\n */\r\n public async clear(): Promise<void> {\r\n if (0 === this._clientRulesets.size)\r\n return;\r\n\r\n this._clientRulesets.clear();\r\n }\r\n\r\n}\r\n"]}
|
|
@@ -12,13 +12,28 @@ export interface NodeIdentifier {
|
|
|
12
12
|
id: string;
|
|
13
13
|
key: NodeKey;
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export interface NodeState {
|
|
19
|
+
isExpanded?: boolean;
|
|
20
|
+
instanceFilter?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The tracker stores up-to-date UI state of the hierarchies on the frontend and reports
|
|
24
|
+
* just the state changes to the backend as soon as component sends in a new hierarchy state.
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
16
28
|
export declare class StateTracker {
|
|
17
|
-
private
|
|
29
|
+
private _hierarchyStates;
|
|
18
30
|
private _ipcRequestsHandler;
|
|
19
31
|
constructor(ipcRequestsHandler: IpcRequestsHandler);
|
|
20
32
|
private updateHierarchyStateIfNeeded;
|
|
21
33
|
onHierarchyClosed(imodel: IModelConnection, rulesetId: string, sourceId: string): Promise<void>;
|
|
22
|
-
|
|
34
|
+
onHierarchyStateChanged(imodel: IModelConnection, rulesetId: string, sourceId: string, newHierarchyState: Array<{
|
|
35
|
+
node: NodeIdentifier | undefined;
|
|
36
|
+
state: NodeState;
|
|
37
|
+
}>): Promise<void>;
|
|
23
38
|
}
|
|
24
39
|
//# sourceMappingURL=StateTracker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateTracker.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/StateTracker.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"StateTracker.d.ts","sourceRoot":"","sources":["../../../src/presentation-frontend/StateTracker.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,OAAO,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAgBD;;;;;GAKG;AACH,qBAAa,YAAY;IAEvB,OAAO,CAAC,gBAAgB,CAAwD;IAChF,OAAO,CAAC,mBAAmB,CAAqB;gBAEpC,kBAAkB,EAAE,kBAAkB;YAKpC,4BAA4B;IAM7B,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAmB/E,uBAAuB,CAAC,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,cAAc,GAAG,SAAS,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAE,CAAC;CA+DrL"}
|