@itwin/presentation-common 5.0.0-dev.7 → 5.0.0-dev.72
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 +31 -1
- package/Ruleset.schema.json +3 -258
- package/lib/cjs/presentation-common/AsyncTasks.d.ts +4 -4
- package/lib/cjs/presentation-common/AsyncTasks.d.ts.map +1 -1
- package/lib/cjs/presentation-common/AsyncTasks.js +5 -6
- package/lib/cjs/presentation-common/AsyncTasks.js.map +1 -1
- package/lib/cjs/presentation-common/EC.d.ts +36 -80
- package/lib/cjs/presentation-common/EC.d.ts.map +1 -1
- package/lib/cjs/presentation-common/EC.js +1 -97
- package/lib/cjs/presentation-common/EC.js.map +1 -1
- package/lib/cjs/presentation-common/ElementProperties.js +16 -9
- package/lib/cjs/presentation-common/ElementProperties.js.map +1 -1
- package/lib/cjs/presentation-common/Error.d.ts +2 -0
- package/lib/cjs/presentation-common/Error.d.ts.map +1 -1
- package/lib/cjs/presentation-common/Error.js +2 -0
- package/lib/cjs/presentation-common/Error.js.map +1 -1
- package/lib/cjs/presentation-common/KeySet.d.ts +2 -2
- package/lib/cjs/presentation-common/KeySet.d.ts.map +1 -1
- package/lib/cjs/presentation-common/KeySet.js +9 -11
- package/lib/cjs/presentation-common/KeySet.js.map +1 -1
- package/lib/cjs/presentation-common/KoqPropertyValueFormatter.js +4 -1
- package/lib/cjs/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
- package/lib/cjs/presentation-common/LabelDefinition.d.ts +0 -48
- package/lib/cjs/presentation-common/LabelDefinition.d.ts.map +1 -1
- package/lib/cjs/presentation-common/LabelDefinition.js +1 -44
- package/lib/cjs/presentation-common/LabelDefinition.js.map +1 -1
- package/lib/cjs/presentation-common/LocalizationHelper.js +1 -0
- package/lib/cjs/presentation-common/LocalizationHelper.js.map +1 -1
- package/lib/cjs/presentation-common/PresentationManagerOptions.d.ts +31 -10
- package/lib/cjs/presentation-common/PresentationManagerOptions.d.ts.map +1 -1
- package/lib/cjs/presentation-common/PresentationManagerOptions.js +0 -5
- package/lib/cjs/presentation-common/PresentationManagerOptions.js.map +1 -1
- package/lib/cjs/presentation-common/PresentationRpcInterface.d.ts +9 -9
- package/lib/cjs/presentation-common/PresentationRpcInterface.d.ts.map +1 -1
- package/lib/cjs/presentation-common/PresentationRpcInterface.js +36 -21
- package/lib/cjs/presentation-common/PresentationRpcInterface.js.map +1 -1
- package/lib/cjs/presentation-common/RegisteredRuleset.d.ts +3 -2
- package/lib/cjs/presentation-common/RegisteredRuleset.d.ts.map +1 -1
- package/lib/cjs/presentation-common/RegisteredRuleset.js +9 -1
- package/lib/cjs/presentation-common/RegisteredRuleset.js.map +1 -1
- package/lib/cjs/presentation-common/RpcRequestsHandler.d.ts +9 -12
- package/lib/cjs/presentation-common/RpcRequestsHandler.d.ts.map +1 -1
- package/lib/cjs/presentation-common/RpcRequestsHandler.js +37 -30
- package/lib/cjs/presentation-common/RpcRequestsHandler.js.map +1 -1
- package/lib/cjs/presentation-common/RulesetVariables.d.ts +1 -46
- package/lib/cjs/presentation-common/RulesetVariables.d.ts.map +1 -1
- package/lib/cjs/presentation-common/RulesetVariables.js.map +1 -1
- package/lib/cjs/presentation-common/Update.d.ts +2 -79
- package/lib/cjs/presentation-common/Update.d.ts.map +1 -1
- package/lib/cjs/presentation-common/Update.js +1 -104
- package/lib/cjs/presentation-common/Update.js.map +1 -1
- package/lib/cjs/presentation-common/Utils.d.ts +21 -0
- package/lib/cjs/presentation-common/Utils.d.ts.map +1 -1
- package/lib/cjs/presentation-common/Utils.js +57 -0
- package/lib/cjs/presentation-common/Utils.js.map +1 -1
- package/lib/cjs/presentation-common/content/Content.d.ts +0 -7
- package/lib/cjs/presentation-common/content/Content.d.ts.map +1 -1
- package/lib/cjs/presentation-common/content/Content.js +5 -10
- package/lib/cjs/presentation-common/content/Content.js.map +1 -1
- package/lib/cjs/presentation-common/content/ContentTraverser.d.ts +1 -1
- package/lib/cjs/presentation-common/content/ContentTraverser.d.ts.map +1 -1
- package/lib/cjs/presentation-common/content/ContentTraverser.js +116 -28
- package/lib/cjs/presentation-common/content/ContentTraverser.js.map +1 -1
- package/lib/cjs/presentation-common/content/Descriptor.d.ts +2 -31
- package/lib/cjs/presentation-common/content/Descriptor.d.ts.map +1 -1
- package/lib/cjs/presentation-common/content/Descriptor.js +68 -22
- package/lib/cjs/presentation-common/content/Descriptor.js.map +1 -1
- package/lib/cjs/presentation-common/content/Fields.d.ts +151 -27
- package/lib/cjs/presentation-common/content/Fields.d.ts.map +1 -1
- package/lib/cjs/presentation-common/content/Fields.js +264 -140
- package/lib/cjs/presentation-common/content/Fields.js.map +1 -1
- package/lib/cjs/presentation-common/content/Item.d.ts +26 -31
- package/lib/cjs/presentation-common/content/Item.d.ts.map +1 -1
- package/lib/cjs/presentation-common/content/Item.js +52 -67
- package/lib/cjs/presentation-common/content/Item.js.map +1 -1
- package/lib/cjs/presentation-common/content/Property.d.ts +2 -12
- package/lib/cjs/presentation-common/content/Property.d.ts.map +1 -1
- package/lib/cjs/presentation-common/content/Property.js +0 -18
- package/lib/cjs/presentation-common/content/Property.js.map +1 -1
- package/lib/cjs/presentation-common/content/PropertyValueFormatter.js +3 -0
- package/lib/cjs/presentation-common/content/PropertyValueFormatter.js.map +1 -1
- package/lib/cjs/presentation-common/content/Value.d.ts +5 -107
- package/lib/cjs/presentation-common/content/Value.d.ts.map +1 -1
- package/lib/cjs/presentation-common/content/Value.js +1 -215
- package/lib/cjs/presentation-common/content/Value.js.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.d.ts +1 -22
- package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.d.ts.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js +0 -23
- package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/Key.d.ts +0 -83
- package/lib/cjs/presentation-common/hierarchy/Key.d.ts.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/Key.js +6 -24
- package/lib/cjs/presentation-common/hierarchy/Key.js.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/Node.d.ts +4 -107
- package/lib/cjs/presentation-common/hierarchy/Node.d.ts.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/Node.js +0 -99
- package/lib/cjs/presentation-common/hierarchy/Node.js.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/NodePathElement.d.ts +1 -67
- package/lib/cjs/presentation-common/hierarchy/NodePathElement.d.ts.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/NodePathElement.js +0 -117
- package/lib/cjs/presentation-common/hierarchy/NodePathElement.js.map +1 -1
- package/lib/cjs/presentation-common/rules/Rule.d.ts +0 -14
- package/lib/cjs/presentation-common/rules/Rule.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/Rule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/ContentSpecification.d.ts +0 -7
- package/lib/cjs/presentation-common/rules/content/ContentSpecification.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/content/ContentSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/customization/CustomizationRule.d.ts +1 -5
- package/lib/cjs/presentation-common/rules/customization/CustomizationRule.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/customization/GroupingRule.d.ts +2 -28
- package/lib/cjs/presentation-common/rules/customization/GroupingRule.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/customization/GroupingRule.js +1 -15
- package/lib/cjs/presentation-common/rules/customization/GroupingRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts +2 -0
- package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts +0 -9
- package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/selection/SelectionScope.d.ts +3 -0
- package/lib/cjs/presentation-common/selection/SelectionScope.d.ts.map +1 -1
- package/lib/cjs/presentation-common/selection/SelectionScope.js +1 -0
- package/lib/cjs/presentation-common/selection/SelectionScope.js.map +1 -1
- package/lib/cjs/presentation-common.d.ts +1 -5
- package/lib/cjs/presentation-common.d.ts.map +1 -1
- package/lib/cjs/presentation-common.js +6 -5
- package/lib/cjs/presentation-common.js.map +1 -1
- package/lib/esm/presentation-common/AsyncTasks.d.ts +4 -4
- package/lib/esm/presentation-common/AsyncTasks.d.ts.map +1 -1
- package/lib/esm/presentation-common/AsyncTasks.js +5 -6
- package/lib/esm/presentation-common/AsyncTasks.js.map +1 -1
- package/lib/esm/presentation-common/EC.d.ts +36 -80
- package/lib/esm/presentation-common/EC.d.ts.map +1 -1
- package/lib/esm/presentation-common/EC.js +0 -96
- package/lib/esm/presentation-common/EC.js.map +1 -1
- package/lib/esm/presentation-common/ElementProperties.js +16 -9
- package/lib/esm/presentation-common/ElementProperties.js.map +1 -1
- package/lib/esm/presentation-common/Error.d.ts +2 -0
- package/lib/esm/presentation-common/Error.d.ts.map +1 -1
- package/lib/esm/presentation-common/Error.js +2 -0
- package/lib/esm/presentation-common/Error.js.map +1 -1
- package/lib/esm/presentation-common/KeySet.d.ts +2 -2
- package/lib/esm/presentation-common/KeySet.d.ts.map +1 -1
- package/lib/esm/presentation-common/KeySet.js +9 -11
- package/lib/esm/presentation-common/KeySet.js.map +1 -1
- package/lib/esm/presentation-common/KoqPropertyValueFormatter.js +5 -2
- package/lib/esm/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
- package/lib/esm/presentation-common/LabelDefinition.d.ts +0 -48
- package/lib/esm/presentation-common/LabelDefinition.d.ts.map +1 -1
- package/lib/esm/presentation-common/LabelDefinition.js +0 -43
- package/lib/esm/presentation-common/LabelDefinition.js.map +1 -1
- package/lib/esm/presentation-common/LocalizationHelper.js +1 -0
- package/lib/esm/presentation-common/LocalizationHelper.js.map +1 -1
- package/lib/esm/presentation-common/PresentationManagerOptions.d.ts +31 -10
- package/lib/esm/presentation-common/PresentationManagerOptions.d.ts.map +1 -1
- package/lib/esm/presentation-common/PresentationManagerOptions.js +0 -4
- package/lib/esm/presentation-common/PresentationManagerOptions.js.map +1 -1
- package/lib/esm/presentation-common/PresentationRpcInterface.d.ts +9 -9
- package/lib/esm/presentation-common/PresentationRpcInterface.d.ts.map +1 -1
- package/lib/esm/presentation-common/PresentationRpcInterface.js +38 -22
- package/lib/esm/presentation-common/PresentationRpcInterface.js.map +1 -1
- package/lib/esm/presentation-common/RegisteredRuleset.d.ts +3 -2
- package/lib/esm/presentation-common/RegisteredRuleset.d.ts.map +1 -1
- package/lib/esm/presentation-common/RegisteredRuleset.js +9 -1
- package/lib/esm/presentation-common/RegisteredRuleset.js.map +1 -1
- package/lib/esm/presentation-common/RpcRequestsHandler.d.ts +9 -12
- package/lib/esm/presentation-common/RpcRequestsHandler.d.ts.map +1 -1
- package/lib/esm/presentation-common/RpcRequestsHandler.js +39 -32
- package/lib/esm/presentation-common/RpcRequestsHandler.js.map +1 -1
- package/lib/esm/presentation-common/RulesetVariables.d.ts +1 -46
- package/lib/esm/presentation-common/RulesetVariables.d.ts.map +1 -1
- package/lib/esm/presentation-common/RulesetVariables.js.map +1 -1
- package/lib/esm/presentation-common/Update.d.ts +2 -79
- package/lib/esm/presentation-common/Update.d.ts.map +1 -1
- package/lib/esm/presentation-common/Update.js +0 -103
- package/lib/esm/presentation-common/Update.js.map +1 -1
- package/lib/esm/presentation-common/Utils.d.ts +21 -0
- package/lib/esm/presentation-common/Utils.d.ts.map +1 -1
- package/lib/esm/presentation-common/Utils.js +54 -0
- package/lib/esm/presentation-common/Utils.js.map +1 -1
- package/lib/esm/presentation-common/content/Content.d.ts +0 -7
- package/lib/esm/presentation-common/content/Content.d.ts.map +1 -1
- package/lib/esm/presentation-common/content/Content.js +5 -10
- package/lib/esm/presentation-common/content/Content.js.map +1 -1
- package/lib/esm/presentation-common/content/ContentTraverser.d.ts +1 -1
- package/lib/esm/presentation-common/content/ContentTraverser.d.ts.map +1 -1
- package/lib/esm/presentation-common/content/ContentTraverser.js +117 -29
- package/lib/esm/presentation-common/content/ContentTraverser.js.map +1 -1
- package/lib/esm/presentation-common/content/Descriptor.d.ts +2 -31
- package/lib/esm/presentation-common/content/Descriptor.d.ts.map +1 -1
- package/lib/esm/presentation-common/content/Descriptor.js +68 -22
- package/lib/esm/presentation-common/content/Descriptor.js.map +1 -1
- package/lib/esm/presentation-common/content/Fields.d.ts +151 -27
- package/lib/esm/presentation-common/content/Fields.d.ts.map +1 -1
- package/lib/esm/presentation-common/content/Fields.js +264 -140
- package/lib/esm/presentation-common/content/Fields.js.map +1 -1
- package/lib/esm/presentation-common/content/Item.d.ts +26 -31
- package/lib/esm/presentation-common/content/Item.d.ts.map +1 -1
- package/lib/esm/presentation-common/content/Item.js +52 -67
- package/lib/esm/presentation-common/content/Item.js.map +1 -1
- package/lib/esm/presentation-common/content/Property.d.ts +2 -12
- package/lib/esm/presentation-common/content/Property.d.ts.map +1 -1
- package/lib/esm/presentation-common/content/Property.js +0 -18
- package/lib/esm/presentation-common/content/Property.js.map +1 -1
- package/lib/esm/presentation-common/content/PropertyValueFormatter.js +3 -0
- package/lib/esm/presentation-common/content/PropertyValueFormatter.js.map +1 -1
- package/lib/esm/presentation-common/content/Value.d.ts +5 -107
- package/lib/esm/presentation-common/content/Value.d.ts.map +1 -1
- package/lib/esm/presentation-common/content/Value.js +0 -214
- package/lib/esm/presentation-common/content/Value.js.map +1 -1
- package/lib/esm/presentation-common/hierarchy/HierarchyLevel.d.ts +1 -22
- package/lib/esm/presentation-common/hierarchy/HierarchyLevel.d.ts.map +1 -1
- package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js +1 -22
- package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
- package/lib/esm/presentation-common/hierarchy/Key.d.ts +0 -83
- package/lib/esm/presentation-common/hierarchy/Key.d.ts.map +1 -1
- package/lib/esm/presentation-common/hierarchy/Key.js +6 -24
- package/lib/esm/presentation-common/hierarchy/Key.js.map +1 -1
- package/lib/esm/presentation-common/hierarchy/Node.d.ts +4 -107
- package/lib/esm/presentation-common/hierarchy/Node.d.ts.map +1 -1
- package/lib/esm/presentation-common/hierarchy/Node.js +1 -98
- package/lib/esm/presentation-common/hierarchy/Node.js.map +1 -1
- package/lib/esm/presentation-common/hierarchy/NodePathElement.d.ts +1 -67
- package/lib/esm/presentation-common/hierarchy/NodePathElement.d.ts.map +1 -1
- package/lib/esm/presentation-common/hierarchy/NodePathElement.js +1 -116
- package/lib/esm/presentation-common/hierarchy/NodePathElement.js.map +1 -1
- package/lib/esm/presentation-common/rules/Rule.d.ts +0 -14
- package/lib/esm/presentation-common/rules/Rule.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/Rule.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/ContentSpecification.d.ts +0 -7
- package/lib/esm/presentation-common/rules/content/ContentSpecification.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/content/ContentSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/customization/CustomizationRule.d.ts +1 -5
- package/lib/esm/presentation-common/rules/customization/CustomizationRule.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/customization/GroupingRule.d.ts +2 -28
- package/lib/esm/presentation-common/rules/customization/GroupingRule.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/customization/GroupingRule.js +0 -14
- package/lib/esm/presentation-common/rules/customization/GroupingRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts +2 -0
- package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts +0 -9
- package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/selection/SelectionScope.d.ts +3 -0
- package/lib/esm/presentation-common/selection/SelectionScope.d.ts.map +1 -1
- package/lib/esm/presentation-common/selection/SelectionScope.js +1 -0
- package/lib/esm/presentation-common/selection/SelectionScope.js.map +1 -1
- package/lib/esm/presentation-common.d.ts +1 -5
- package/lib/esm/presentation-common.d.ts.map +1 -1
- package/lib/esm/presentation-common.js +1 -5
- package/lib/esm/presentation-common.js.map +1 -1
- package/package.json +12 -12
- package/lib/cjs/presentation-common/rules/customization/CheckBoxRule.d.ts +0 -45
- package/lib/cjs/presentation-common/rules/customization/CheckBoxRule.d.ts.map +0 -1
- package/lib/cjs/presentation-common/rules/customization/CheckBoxRule.js +0 -10
- package/lib/cjs/presentation-common/rules/customization/CheckBoxRule.js.map +0 -1
- package/lib/cjs/presentation-common/rules/customization/ImageIdOverride.d.ts +0 -30
- package/lib/cjs/presentation-common/rules/customization/ImageIdOverride.d.ts.map +0 -1
- package/lib/cjs/presentation-common/rules/customization/ImageIdOverride.js +0 -10
- package/lib/cjs/presentation-common/rules/customization/ImageIdOverride.js.map +0 -1
- package/lib/cjs/presentation-common/rules/customization/LabelOverride.d.ts +0 -41
- package/lib/cjs/presentation-common/rules/customization/LabelOverride.d.ts.map +0 -1
- package/lib/cjs/presentation-common/rules/customization/LabelOverride.js +0 -10
- package/lib/cjs/presentation-common/rules/customization/LabelOverride.js.map +0 -1
- package/lib/cjs/presentation-common/rules/customization/StyleOverride.d.ts +0 -49
- package/lib/cjs/presentation-common/rules/customization/StyleOverride.d.ts.map +0 -1
- package/lib/cjs/presentation-common/rules/customization/StyleOverride.js +0 -10
- package/lib/cjs/presentation-common/rules/customization/StyleOverride.js.map +0 -1
- package/lib/esm/presentation-common/rules/customization/CheckBoxRule.d.ts +0 -45
- package/lib/esm/presentation-common/rules/customization/CheckBoxRule.d.ts.map +0 -1
- package/lib/esm/presentation-common/rules/customization/CheckBoxRule.js +0 -9
- package/lib/esm/presentation-common/rules/customization/CheckBoxRule.js.map +0 -1
- package/lib/esm/presentation-common/rules/customization/ImageIdOverride.d.ts +0 -30
- package/lib/esm/presentation-common/rules/customization/ImageIdOverride.d.ts.map +0 -1
- package/lib/esm/presentation-common/rules/customization/ImageIdOverride.js +0 -9
- package/lib/esm/presentation-common/rules/customization/ImageIdOverride.js.map +0 -1
- package/lib/esm/presentation-common/rules/customization/LabelOverride.d.ts +0 -41
- package/lib/esm/presentation-common/rules/customization/LabelOverride.d.ts.map +0 -1
- package/lib/esm/presentation-common/rules/customization/LabelOverride.js +0 -9
- package/lib/esm/presentation-common/rules/customization/LabelOverride.js.map +0 -1
- package/lib/esm/presentation-common/rules/customization/StyleOverride.d.ts +0 -49
- package/lib/esm/presentation-common/rules/customization/StyleOverride.d.ts.map +0 -1
- package/lib/esm/presentation-common/rules/customization/StyleOverride.js +0 -9
- package/lib/esm/presentation-common/rules/customization/StyleOverride.js.map +0 -1
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module RPC
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
9
|
-
import { RpcManager } from "@itwin/core-common";
|
|
8
|
+
import { Guid, Logger } from "@itwin/core-bentley";
|
|
9
|
+
import { RpcManager, RpcRequest } from "@itwin/core-common";
|
|
10
10
|
import { PresentationCommonLoggerCategory } from "./CommonLoggerCategory";
|
|
11
11
|
import { PresentationError, PresentationStatus } from "./Error";
|
|
12
12
|
import { PresentationRpcInterface } from "./PresentationRpcInterface";
|
|
13
|
+
import { createCancellableTimeoutPromise } from "./Utils";
|
|
13
14
|
/**
|
|
14
15
|
* Default timeout for how long we're going to wait for RPC request to be fulfilled before throwing
|
|
15
16
|
* a timeout error.
|
|
@@ -23,6 +24,10 @@ const DEFAULT_REQUEST_TIMEOUT = 10 * 60 * 1000; // 10 minutes
|
|
|
23
24
|
* @internal
|
|
24
25
|
*/
|
|
25
26
|
export class RpcRequestsHandler {
|
|
27
|
+
/** Timeout for how long the handler going to wait for RPC request to be fulfilled before throwing a timeout error. */
|
|
28
|
+
timeout;
|
|
29
|
+
/** ID that identifies this handler as a client */
|
|
30
|
+
clientId;
|
|
26
31
|
constructor(props) {
|
|
27
32
|
this.clientId = props?.clientId ?? Guid.createValue();
|
|
28
33
|
this.timeout = props?.timeout ?? DEFAULT_REQUEST_TIMEOUT;
|
|
@@ -32,34 +37,37 @@ export class RpcRequestsHandler {
|
|
|
32
37
|
return RpcManager.getClientForInterface(PresentationRpcInterface);
|
|
33
38
|
}
|
|
34
39
|
async requestWithTimeout(func, diagnosticsHandler) {
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
const rpcResponsePromise = func();
|
|
41
|
+
const rpcRequest = RpcRequest.current(this.rpcClient);
|
|
42
|
+
const timeout = createCancellableTimeoutPromise(this.timeout);
|
|
43
|
+
return Promise.race([
|
|
44
|
+
(async () => {
|
|
45
|
+
let diagnostics;
|
|
46
|
+
try {
|
|
47
|
+
const response = await rpcResponsePromise;
|
|
48
|
+
diagnostics = response.diagnostics;
|
|
49
|
+
switch (response.statusCode) {
|
|
50
|
+
case PresentationStatus.Success:
|
|
51
|
+
return response.result;
|
|
52
|
+
default:
|
|
53
|
+
throw new PresentationError(response.statusCode, response.errorMessage);
|
|
54
|
+
}
|
|
49
55
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
finally {
|
|
57
|
+
diagnosticsHandler && diagnostics && diagnosticsHandler(diagnostics);
|
|
58
|
+
}
|
|
59
|
+
})(),
|
|
60
|
+
timeout.promise.then(() => {
|
|
61
|
+
throw new Error(`Processing the request took longer than the configured limit of ${this.timeout} ms`);
|
|
62
|
+
}),
|
|
63
|
+
]).finally(() => {
|
|
64
|
+
rpcRequest?.cancel();
|
|
65
|
+
timeout.cancel();
|
|
66
|
+
});
|
|
56
67
|
}
|
|
57
68
|
/**
|
|
58
|
-
* Send the request to backend.
|
|
59
|
-
*
|
|
60
|
-
* If the backend responds with [[PresentationStatus.BackendTimeout]], the request is repeated until we hit `timeout` or get
|
|
61
|
-
* a response. If the response is other than [[PresentationStatus.BackendTimeout]] or [[PresentationStatus.Success]], a [[PresentationError]]
|
|
62
|
-
* is thrown with the details from the response.
|
|
69
|
+
* Send the request to backend. We'll wait for the response for `this.timeout` ms, and if we don't get the response by
|
|
70
|
+
* then, we'll throw an error.
|
|
63
71
|
*/
|
|
64
72
|
async request(func, options, ...additionalOptions) {
|
|
65
73
|
const { imodel, diagnostics, ...optionsNoIModel } = options;
|
|
@@ -75,7 +83,8 @@ export class RpcRequestsHandler {
|
|
|
75
83
|
rpcOptions.diagnostics = diagnosticsOptions;
|
|
76
84
|
}
|
|
77
85
|
const doRequest = async () => func(imodel, rpcOptions, ...additionalOptions);
|
|
78
|
-
|
|
86
|
+
const result = await this.requestWithTimeout(doRequest, diagnosticsHandler);
|
|
87
|
+
return result;
|
|
79
88
|
}
|
|
80
89
|
async getNodesCount(options) {
|
|
81
90
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
@@ -138,14 +147,12 @@ export class RpcRequestsHandler {
|
|
|
138
147
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
139
148
|
return this.request(this.rpcClient.getPagedDisplayLabelDefinitions.bind(this.rpcClient), options);
|
|
140
149
|
}
|
|
150
|
+
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
141
151
|
async getSelectionScopes(options) {
|
|
142
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
143
152
|
return this.request(this.rpcClient.getSelectionScopes.bind(this.rpcClient), options);
|
|
144
153
|
}
|
|
145
154
|
async computeSelection(options) {
|
|
146
|
-
return this.request(
|
|
147
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
148
|
-
this.rpcClient.computeSelection.bind(this.rpcClient), options);
|
|
155
|
+
return this.request(this.rpcClient.computeSelection.bind(this.rpcClient), options);
|
|
149
156
|
}
|
|
150
157
|
}
|
|
151
158
|
function isOptionsWithRuleset(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-common/RpcRequestsHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAkB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAM1E,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAwBhE,OAAO,EAA2B,wBAAwB,EAA0D,MAAM,4BAA4B,CAAC;AAMvJ;;;GAGG;AACH,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAmB7D;;;;;;GAMG;AACH,MAAM,OAAO,kBAAkB;IAO7B,YAAmB,KAA+B;QAChD,IAAI,CAAC,QAAQ,GAAG,KAAK,EAAE,QAAQ,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACtD,IAAI,CAAC,OAAO,GAAG,KAAK,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AAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC;IACzH,CAAC;IACM,KAAK,CAAC,gBAAgB,CAAC,OAAoF;QAChH,OAAO,IAAI,CAAC,OAAO;QACjB,4DAA4D;QAC5D,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EACpD,OAAO,CACR,CAAC;IACJ,CAAC;CACF;AAED,SAAS,oBAAoB,CAAC,OAAe;IAC3C,OAAO,OAAQ,OAA+C,CAAC,WAAW,KAAK,QAAQ,CAAC;AAC1F,CAAC;AAMD,MAAM,gCAAgC,GAAkC;IACtE,EAAE,EAAE,IAAI;IACR,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,IAAI;IACrB,mBAAmB,EAAE,IAAI;IACzB,IAAI,EAAE,IAAI;CACX,CAAC;AAEF,SAAS,cAAc,CAAC,OAAgB;IACtC,MAAM,gBAAgB,GAAY,EAAE,GAAG,OAAO,EAAE,CAAC;IAEjD,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACxD,IAAI,CAAC,gCAAgC,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,CAAC;YAClE,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC9B,OAAQ,gBAAwB,CAAC,WAAW,CAAC,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,UAAU,CACf,gCAAgC,CAAC,OAAO,EACxC,qDAAqD,WAAW,2DAA2D,CAC5H,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,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 RPC\r\n */\r\n\r\nimport { BeDuration, BeTimePoint, Guid, Logger } from \"@itwin/core-bentley\";\r\nimport { IModelRpcProps, RpcManager } from \"@itwin/core-common\";\r\nimport { PresentationCommonLoggerCategory } from \"./CommonLoggerCategory\";\r\nimport { DescriptorJSON, DescriptorOverrides } from \"./content/Descriptor\";\r\nimport { ItemJSON } from \"./content/Item\";\r\nimport { DisplayValueGroupJSON } from \"./content/Value\";\r\nimport { ClientDiagnostics, ClientDiagnosticsAttribute, ClientDiagnosticsHandler } from \"./Diagnostics\";\r\nimport { InstanceKey } from \"./EC\";\r\nimport { PresentationError, PresentationStatus } from \"./Error\";\r\nimport { NodeKey } from \"./hierarchy/Key\";\r\nimport { NodeJSON } from \"./hierarchy/Node\";\r\nimport { NodePathElementJSON } from \"./hierarchy/NodePathElement\";\r\nimport { KeySetJSON } from \"./KeySet\";\r\nimport { LabelDefinition } from \"./LabelDefinition\";\r\nimport {\r\n ComputeSelectionRequestOptions,\r\n ContentDescriptorRequestOptions,\r\n ContentInstanceKeysRequestOptions,\r\n ContentRequestOptions,\r\n ContentSourcesRequestOptions,\r\n DisplayLabelRequestOptions,\r\n DisplayLabelsRequestOptions,\r\n DistinctValuesRequestOptions,\r\n FilterByInstancePathsHierarchyRequestOptions,\r\n FilterByTextHierarchyRequestOptions,\r\n HierarchyLevelDescriptorRequestOptions,\r\n HierarchyRequestOptions,\r\n Paged,\r\n RequestOptions,\r\n RequestOptionsWithRuleset,\r\n SelectionScopeRequestOptions,\r\n} from \"./PresentationManagerOptions\";\r\nimport { ContentSourcesRpcResult, PresentationRpcInterface, PresentationRpcRequestOptions, PresentationRpcResponse } from \"./PresentationRpcInterface\";\r\nimport { Ruleset } from \"./rules/Ruleset\";\r\nimport { RulesetVariableJSON } from \"./RulesetVariables\";\r\nimport { SelectionScope } from \"./selection/SelectionScope\";\r\nimport { PagedResponse } from \"./Utils\";\r\n\r\n/**\r\n * Default timeout for how long we're going to wait for RPC request to be fulfilled before throwing\r\n * a timeout error.\r\n */\r\nconst DEFAULT_REQUEST_TIMEOUT = 10 * 60 * 1000; // 10 minutes\r\n\r\n/**\r\n * Configuration parameters for [[RpcRequestsHandler]].\r\n *\r\n * @internal\r\n */\r\nexport interface RpcRequestsHandlerProps {\r\n /**\r\n * Optional ID used to identify client that requests data. If not specified,\r\n * the handler creates a unique GUID as a client id.\r\n * @internal\r\n */\r\n clientId?: string;\r\n\r\n /** @internal */\r\n timeout?: number;\r\n}\r\n\r\n/**\r\n * RPC requests handler that wraps [[PresentationRpcInterface]] and\r\n * adds handling for cases when backend needs to be synced with client\r\n * state.\r\n *\r\n * @internal\r\n */\r\nexport class RpcRequestsHandler {\r\n /** Timeout for how long the handler going to wait for RPC request to be fulfilled before throwing a timeout error. */\r\n public readonly timeout: number;\r\n\r\n /** ID that identifies this handler as a client */\r\n public readonly clientId: string;\r\n\r\n public constructor(props?: RpcRequestsHandlerProps) {\r\n this.clientId = props?.clientId ?? Guid.createValue();\r\n this.timeout = props?.timeout ?? DEFAULT_REQUEST_TIMEOUT;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private get rpcClient(): PresentationRpcInterface {\r\n return RpcManager.getClientForInterface(PresentationRpcInterface);\r\n }\r\n\r\n private async requestWithTimeout<TResult>(func: () => PresentationRpcResponse<TResult>, diagnosticsHandler?: ClientDiagnosticsHandler): Promise<TResult> {\r\n const start = BeTimePoint.now();\r\n const timeout = BeDuration.fromMilliseconds(this.timeout);\r\n let diagnostics: ClientDiagnostics | undefined;\r\n while (start.plus(timeout).isInFuture) {\r\n try {\r\n const response = await func();\r\n diagnostics = response.diagnostics;\r\n switch (response.statusCode) {\r\n case PresentationStatus.Success:\r\n return response.result!;\r\n case PresentationStatus.BackendTimeout:\r\n break;\r\n default:\r\n throw new PresentationError(response.statusCode, response.errorMessage);\r\n }\r\n } finally {\r\n diagnosticsHandler && diagnostics && diagnosticsHandler(diagnostics);\r\n }\r\n }\r\n throw new PresentationError(PresentationStatus.BackendTimeout);\r\n }\r\n\r\n /**\r\n * Send the request to backend.\r\n *\r\n * If the backend responds with [[PresentationStatus.BackendTimeout]], the request is repeated until we hit `timeout` or get\r\n * a response. If the response is other than [[PresentationStatus.BackendTimeout]] or [[PresentationStatus.Success]], a [[PresentationError]]\r\n * is thrown with the details from the response.\r\n */\r\n public async request<TResult, TOptions extends RequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute, TArg = any>(\r\n func: (token: IModelRpcProps, options: PresentationRpcRequestOptions<TOptions>, ...args: TArg[]) => PresentationRpcResponse<TResult>,\r\n options: TOptions,\r\n ...additionalOptions: TArg[]\r\n ): Promise<TResult> {\r\n const { imodel, diagnostics, ...optionsNoIModel } = options;\r\n const { handler: diagnosticsHandler, ...diagnosticsOptions } = diagnostics ?? {};\r\n if (isOptionsWithRuleset(optionsNoIModel)) {\r\n optionsNoIModel.rulesetOrId = cleanupRuleset(optionsNoIModel.rulesetOrId);\r\n }\r\n const rpcOptions: PresentationRpcRequestOptions<TOptions> = {\r\n ...optionsNoIModel,\r\n clientId: this.clientId,\r\n };\r\n if (diagnostics) {\r\n rpcOptions.diagnostics = diagnosticsOptions;\r\n }\r\n const doRequest = async () => func(imodel, rpcOptions, ...additionalOptions);\r\n return this.requestWithTimeout(doRequest, diagnosticsHandler);\r\n }\r\n\r\n public async getNodesCount(options: HierarchyRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<number> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<number, typeof options>(this.rpcClient.getNodesCount.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getPagedNodes(\r\n options: Paged<HierarchyRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON>> & ClientDiagnosticsAttribute,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n ): Promise<PagedResponse<NodeJSON>> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<PagedResponse<NodeJSON>, typeof options>(this.rpcClient.getPagedNodes.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getNodesDescriptor(\r\n options: HierarchyLevelDescriptorRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<DescriptorJSON | undefined> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const response = await this.request<string | DescriptorJSON | undefined, typeof options>(this.rpcClient.getNodesDescriptor.bind(this.rpcClient), options);\r\n if (typeof response === \"string\") {\r\n return JSON.parse(response);\r\n }\r\n return response;\r\n }\r\n\r\n public async getNodePaths(\r\n options: FilterByInstancePathsHierarchyRequestOptions<IModelRpcProps, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n ): Promise<NodePathElementJSON[]> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<NodePathElementJSON[], typeof options>(this.rpcClient.getNodePaths.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getFilteredNodePaths(\r\n options: FilterByTextHierarchyRequestOptions<IModelRpcProps, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n ): Promise<NodePathElementJSON[]> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<NodePathElementJSON[], typeof options>(this.rpcClient.getFilteredNodePaths.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getContentSources(options: ContentSourcesRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<ContentSourcesRpcResult> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<ContentSourcesRpcResult, typeof options>(this.rpcClient.getContentSources.bind(this.rpcClient), options);\r\n }\r\n public async getContentDescriptor(\r\n options: ContentDescriptorRequestOptions<IModelRpcProps, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<DescriptorJSON | undefined> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<DescriptorJSON | undefined, typeof options>(this.rpcClient.getContentDescriptor.bind(this.rpcClient), options);\r\n }\r\n public async getContentSetSize(\r\n options: ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<number> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<number, typeof options>(this.rpcClient.getContentSetSize.bind(this.rpcClient), options);\r\n }\r\n public async getPagedContent(\r\n options: Paged<ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute>,\r\n ) {\r\n return this.request<{ descriptor: DescriptorJSON; contentSet: PagedResponse<ItemJSON> } | undefined, typeof options>(\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n this.rpcClient.getPagedContent.bind(this.rpcClient),\r\n options,\r\n );\r\n }\r\n public async getPagedContentSet(\r\n options: Paged<ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute>,\r\n ) {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<PagedResponse<ItemJSON>, typeof options>(this.rpcClient.getPagedContentSet.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getPagedDistinctValues(\r\n options: DistinctValuesRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n ): Promise<PagedResponse<DisplayValueGroupJSON>> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<PagedResponse<DisplayValueGroupJSON>, typeof options>(this.rpcClient.getPagedDistinctValues.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getContentInstanceKeys(\r\n options: ContentInstanceKeysRequestOptions<IModelRpcProps, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<{ total: number; items: KeySetJSON }> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<{ total: number; items: KeySetJSON }, typeof options>(this.rpcClient.getContentInstanceKeys.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getDisplayLabelDefinition(\r\n options: DisplayLabelRequestOptions<IModelRpcProps, InstanceKey> & ClientDiagnosticsAttribute,\r\n ): Promise<LabelDefinition> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<LabelDefinition, typeof options>(this.rpcClient.getDisplayLabelDefinition.bind(this.rpcClient), options);\r\n }\r\n public async getPagedDisplayLabelDefinitions(\r\n options: DisplayLabelsRequestOptions<IModelRpcProps, InstanceKey> & ClientDiagnosticsAttribute,\r\n ): Promise<PagedResponse<LabelDefinition>> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<PagedResponse<LabelDefinition>, typeof options>(this.rpcClient.getPagedDisplayLabelDefinitions.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getSelectionScopes(options: SelectionScopeRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<SelectionScope[]> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<SelectionScope[], typeof options>(this.rpcClient.getSelectionScopes.bind(this.rpcClient), options);\r\n }\r\n public async computeSelection(options: ComputeSelectionRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<KeySetJSON> {\r\n return this.request<KeySetJSON, typeof options>(\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n this.rpcClient.computeSelection.bind(this.rpcClient),\r\n options,\r\n );\r\n }\r\n}\r\n\r\nfunction isOptionsWithRuleset(options: object): options is { rulesetOrId: Ruleset } {\r\n return typeof (options as RequestOptionsWithRuleset<any, any>).rulesetOrId === \"object\";\r\n}\r\n\r\ntype RulesetWithRequiredProperties = {\r\n [key in keyof Ruleset]-?: true;\r\n};\r\n\r\nconst RULESET_SUPPORTED_PROPERTIES_OBJ: RulesetWithRequiredProperties = {\r\n id: true,\r\n rules: true,\r\n version: true,\r\n requiredSchemas: true,\r\n supplementationInfo: true,\r\n vars: true,\r\n};\r\n\r\nfunction cleanupRuleset(ruleset: Ruleset): Ruleset {\r\n const cleanedUpRuleset: Ruleset = { ...ruleset };\r\n\r\n for (const propertyKey of Object.keys(cleanedUpRuleset)) {\r\n if (!RULESET_SUPPORTED_PROPERTIES_OBJ.hasOwnProperty(propertyKey)) {\r\n if (propertyKey === \"$schema\") {\r\n delete (cleanedUpRuleset as any)[propertyKey];\r\n } else {\r\n Logger.logWarning(\r\n PresentationCommonLoggerCategory.Package,\r\n `Provided ruleset contains unrecognized attribute '${propertyKey}'. It either doesn't exist or may be no longer supported.`,\r\n );\r\n }\r\n }\r\n }\r\n\r\n return cleanedUpRuleset;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"RpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-common/RpcRequestsHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAkB,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAK1E,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAuBhE,OAAO,EAA2B,wBAAwB,EAA0D,MAAM,4BAA4B,CAAC;AAIvJ,OAAO,EAAE,+BAA+B,EAAiB,MAAM,SAAS,CAAC;AAIzE;;;GAGG;AACH,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAmB7D;;;;;;GAMG;AACH,MAAM,OAAO,kBAAkB;IAC7B,sHAAsH;IACtG,OAAO,CAAS;IAEhC,kDAAkD;IAClC,QAAQ,CAAS;I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K,SAAS,EAAE,CAAC;gBAC9B,OAAQ,gBAAwB,CAAC,WAAW,CAAC,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,UAAU,CACf,gCAAgC,CAAC,OAAO,EACxC,qDAAqD,WAAW,2DAA2D,CAC5H,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,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 RPC\r\n */\r\n\r\nimport { Guid, Logger } from \"@itwin/core-bentley\";\r\nimport { IModelRpcProps, RpcManager, RpcRequest } from \"@itwin/core-common\";\r\nimport { PresentationCommonLoggerCategory } from \"./CommonLoggerCategory\";\r\nimport { DescriptorJSON, DescriptorOverrides } from \"./content/Descriptor\";\r\nimport { ItemJSON } from \"./content/Item\";\r\nimport { ClientDiagnostics, ClientDiagnosticsAttribute, ClientDiagnosticsHandler } from \"./Diagnostics\";\r\nimport { InstanceKey } from \"./EC\";\r\nimport { PresentationError, PresentationStatus } from \"./Error\";\r\nimport { NodeKey } from \"./hierarchy/Key\";\r\nimport { Node } from \"./hierarchy/Node\";\r\nimport { KeySetJSON } from \"./KeySet\";\r\nimport { LabelDefinition } from \"./LabelDefinition\";\r\nimport {\r\n ComputeSelectionRequestOptions,\r\n ContentDescriptorRequestOptions,\r\n ContentInstanceKeysRequestOptions,\r\n ContentRequestOptions,\r\n ContentSourcesRequestOptions,\r\n DisplayLabelRequestOptions,\r\n DisplayLabelsRequestOptions,\r\n DistinctValuesRequestOptions,\r\n FilterByInstancePathsHierarchyRequestOptions,\r\n FilterByTextHierarchyRequestOptions,\r\n HierarchyLevelDescriptorRequestOptions,\r\n HierarchyRequestOptions,\r\n Paged,\r\n RequestOptions,\r\n RequestOptionsWithRuleset,\r\n SelectionScopeRequestOptions,\r\n} from \"./PresentationManagerOptions\";\r\nimport { ContentSourcesRpcResult, PresentationRpcInterface, PresentationRpcRequestOptions, PresentationRpcResponse } from \"./PresentationRpcInterface\";\r\nimport { Ruleset } from \"./rules/Ruleset\";\r\nimport { RulesetVariableJSON } from \"./RulesetVariables\";\r\nimport { SelectionScope } from \"./selection/SelectionScope\";\r\nimport { createCancellableTimeoutPromise, PagedResponse } from \"./Utils\";\r\nimport { NodePathElement } from \"./hierarchy/NodePathElement\";\r\nimport { DisplayValueGroup } from \"./content/Value\";\r\n\r\n/**\r\n * Default timeout for how long we're going to wait for RPC request to be fulfilled before throwing\r\n * a timeout error.\r\n */\r\nconst DEFAULT_REQUEST_TIMEOUT = 10 * 60 * 1000; // 10 minutes\r\n\r\n/**\r\n * Configuration parameters for [[RpcRequestsHandler]].\r\n *\r\n * @internal\r\n */\r\nexport interface RpcRequestsHandlerProps {\r\n /**\r\n * Optional ID used to identify client that requests data. If not specified,\r\n * the handler creates a unique GUID as a client id.\r\n * @internal\r\n */\r\n clientId?: string;\r\n\r\n /** @internal */\r\n timeout?: number;\r\n}\r\n\r\n/**\r\n * RPC requests handler that wraps [[PresentationRpcInterface]] and\r\n * adds handling for cases when backend needs to be synced with client\r\n * state.\r\n *\r\n * @internal\r\n */\r\nexport class RpcRequestsHandler {\r\n /** Timeout for how long the handler going to wait for RPC request to be fulfilled before throwing a timeout error. */\r\n public readonly timeout: number;\r\n\r\n /** ID that identifies this handler as a client */\r\n public readonly clientId: string;\r\n\r\n public constructor(props?: RpcRequestsHandlerProps) {\r\n this.clientId = props?.clientId ?? Guid.createValue();\r\n this.timeout = props?.timeout ?? DEFAULT_REQUEST_TIMEOUT;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private get rpcClient(): PresentationRpcInterface {\r\n return RpcManager.getClientForInterface(PresentationRpcInterface);\r\n }\r\n\r\n private async requestWithTimeout<TResult>(func: () => PresentationRpcResponse<TResult>, diagnosticsHandler?: ClientDiagnosticsHandler): Promise<TResult> {\r\n const rpcResponsePromise = func();\r\n const rpcRequest: RpcRequest | undefined = RpcRequest.current(this.rpcClient);\r\n const timeout = createCancellableTimeoutPromise(this.timeout);\r\n return Promise.race([\r\n (async () => {\r\n let diagnostics: ClientDiagnostics | undefined;\r\n try {\r\n const response = await rpcResponsePromise;\r\n diagnostics = response.diagnostics;\r\n switch (response.statusCode) {\r\n case PresentationStatus.Success:\r\n return response.result!;\r\n default:\r\n throw new PresentationError(response.statusCode, response.errorMessage);\r\n }\r\n } finally {\r\n diagnosticsHandler && diagnostics && diagnosticsHandler(diagnostics);\r\n }\r\n })(),\r\n timeout.promise.then(() => {\r\n throw new Error(`Processing the request took longer than the configured limit of ${this.timeout} ms`);\r\n }),\r\n ]).finally(() => {\r\n rpcRequest?.cancel();\r\n timeout.cancel();\r\n });\r\n }\r\n\r\n /**\r\n * Send the request to backend. We'll wait for the response for `this.timeout` ms, and if we don't get the response by\r\n * then, we'll throw an error.\r\n */\r\n public async request<TResult, TOptions extends RequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute, TArg = any>(\r\n func: (token: IModelRpcProps, options: PresentationRpcRequestOptions<TOptions>, ...args: TArg[]) => PresentationRpcResponse<TResult>,\r\n options: TOptions,\r\n ...additionalOptions: TArg[]\r\n ): Promise<TResult> {\r\n const { imodel, diagnostics, ...optionsNoIModel } = options;\r\n const { handler: diagnosticsHandler, ...diagnosticsOptions } = diagnostics ?? {};\r\n if (isOptionsWithRuleset(optionsNoIModel)) {\r\n optionsNoIModel.rulesetOrId = cleanupRuleset(optionsNoIModel.rulesetOrId);\r\n }\r\n const rpcOptions: PresentationRpcRequestOptions<TOptions> = {\r\n ...optionsNoIModel,\r\n clientId: this.clientId,\r\n };\r\n if (diagnostics) {\r\n rpcOptions.diagnostics = diagnosticsOptions;\r\n }\r\n const doRequest = async () => func(imodel, rpcOptions, ...additionalOptions);\r\n const result = await this.requestWithTimeout(doRequest, diagnosticsHandler);\r\n return result;\r\n }\r\n\r\n public async getNodesCount(options: HierarchyRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<number> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<number, typeof options>(this.rpcClient.getNodesCount.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getPagedNodes(\r\n options: Paged<HierarchyRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON>> & ClientDiagnosticsAttribute,\r\n ): Promise<PagedResponse<Node>> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<PagedResponse<Node>, typeof options>(this.rpcClient.getPagedNodes.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getNodesDescriptor(\r\n options: HierarchyLevelDescriptorRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<DescriptorJSON | undefined> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const response = await this.request<string | DescriptorJSON | undefined, typeof options>(this.rpcClient.getNodesDescriptor.bind(this.rpcClient), options);\r\n if (typeof response === \"string\") {\r\n return JSON.parse(response);\r\n }\r\n return response;\r\n }\r\n\r\n public async getNodePaths(\r\n options: FilterByInstancePathsHierarchyRequestOptions<IModelRpcProps, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<NodePathElement[], typeof options>(this.rpcClient.getNodePaths.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getFilteredNodePaths(\r\n options: FilterByTextHierarchyRequestOptions<IModelRpcProps, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<NodePathElement[], typeof options>(this.rpcClient.getFilteredNodePaths.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getContentSources(options: ContentSourcesRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<ContentSourcesRpcResult> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<ContentSourcesRpcResult, typeof options>(this.rpcClient.getContentSources.bind(this.rpcClient), options);\r\n }\r\n public async getContentDescriptor(\r\n options: ContentDescriptorRequestOptions<IModelRpcProps, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<DescriptorJSON | undefined> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<DescriptorJSON | undefined, typeof options>(this.rpcClient.getContentDescriptor.bind(this.rpcClient), options);\r\n }\r\n public async getContentSetSize(\r\n options: ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<number> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<number, typeof options>(this.rpcClient.getContentSetSize.bind(this.rpcClient), options);\r\n }\r\n public async getPagedContent(\r\n options: Paged<ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute>,\r\n ) {\r\n return this.request<{ descriptor: DescriptorJSON; contentSet: PagedResponse<ItemJSON> } | undefined, typeof options>(\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n this.rpcClient.getPagedContent.bind(this.rpcClient),\r\n options,\r\n );\r\n }\r\n public async getPagedContentSet(\r\n options: Paged<ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute>,\r\n ) {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<PagedResponse<ItemJSON>, typeof options>(this.rpcClient.getPagedContentSet.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getPagedDistinctValues(\r\n options: DistinctValuesRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<PagedResponse<DisplayValueGroup>> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<PagedResponse<DisplayValueGroup>, typeof options>(this.rpcClient.getPagedDistinctValues.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getContentInstanceKeys(\r\n options: ContentInstanceKeysRequestOptions<IModelRpcProps, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<{ total: number; items: KeySetJSON }> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<{ total: number; items: KeySetJSON }, typeof options>(this.rpcClient.getContentInstanceKeys.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getDisplayLabelDefinition(\r\n options: DisplayLabelRequestOptions<IModelRpcProps, InstanceKey> & ClientDiagnosticsAttribute,\r\n ): Promise<LabelDefinition> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<LabelDefinition, typeof options>(this.rpcClient.getDisplayLabelDefinition.bind(this.rpcClient), options);\r\n }\r\n public async getPagedDisplayLabelDefinitions(\r\n options: DisplayLabelsRequestOptions<IModelRpcProps, InstanceKey> & ClientDiagnosticsAttribute,\r\n ): Promise<PagedResponse<LabelDefinition>> {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return this.request<PagedResponse<LabelDefinition>, typeof options>(this.rpcClient.getPagedDisplayLabelDefinitions.bind(this.rpcClient), options);\r\n }\r\n\r\n /* eslint-disable @typescript-eslint/no-deprecated */\r\n public async getSelectionScopes(options: SelectionScopeRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<SelectionScope[]> {\r\n return this.request<SelectionScope[], typeof options>(this.rpcClient.getSelectionScopes.bind(this.rpcClient), options);\r\n }\r\n public async computeSelection(options: ComputeSelectionRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<KeySetJSON> {\r\n return this.request<KeySetJSON, typeof options>(this.rpcClient.computeSelection.bind(this.rpcClient), options);\r\n }\r\n /* eslint-enable @typescript-eslint/no-deprecated */\r\n}\r\n\r\nfunction isOptionsWithRuleset(options: object): options is { rulesetOrId: Ruleset } {\r\n return typeof (options as RequestOptionsWithRuleset<any, any>).rulesetOrId === \"object\";\r\n}\r\n\r\ntype RulesetWithRequiredProperties = {\r\n [key in keyof Ruleset]-?: true;\r\n};\r\n\r\nconst RULESET_SUPPORTED_PROPERTIES_OBJ: RulesetWithRequiredProperties = {\r\n id: true,\r\n rules: true,\r\n version: true,\r\n requiredSchemas: true,\r\n supplementationInfo: true,\r\n vars: true,\r\n};\r\n\r\nfunction cleanupRuleset(ruleset: Ruleset): Ruleset {\r\n const cleanedUpRuleset: Ruleset = { ...ruleset };\r\n\r\n for (const propertyKey of Object.keys(cleanedUpRuleset)) {\r\n if (!RULESET_SUPPORTED_PROPERTIES_OBJ.hasOwnProperty(propertyKey)) {\r\n if (propertyKey === \"$schema\") {\r\n delete (cleanedUpRuleset as any)[propertyKey];\r\n } else {\r\n Logger.logWarning(\r\n PresentationCommonLoggerCategory.Package,\r\n `Provided ruleset contains unrecognized attribute '${propertyKey}'. It either doesn't exist or may be no longer supported.`,\r\n );\r\n }\r\n }\r\n }\r\n\r\n return cleanedUpRuleset;\r\n}\r\n"]}
|
|
@@ -101,51 +101,6 @@ export interface RulesetVariableBaseJSON {
|
|
|
101
101
|
type: VariableValueTypes;
|
|
102
102
|
value: VariableValueJSON;
|
|
103
103
|
}
|
|
104
|
-
/**
|
|
105
|
-
* JSON representation of [[BooleanRulesetVariable]].
|
|
106
|
-
* @public
|
|
107
|
-
* @deprecated in 3.x. Use [[BooleanRulesetVariable]]
|
|
108
|
-
*/
|
|
109
|
-
export interface BooleanRulesetVariableJSON extends RulesetVariableBaseJSON {
|
|
110
|
-
type: VariableValueTypes.Bool;
|
|
111
|
-
value: boolean;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* JSON representation of [[StringRulesetVariable]].
|
|
115
|
-
* @public
|
|
116
|
-
* @deprecated in 3.x. Use [[StringRulesetVariable]]
|
|
117
|
-
*/
|
|
118
|
-
export interface StringRulesetVariableJSON extends RulesetVariableBaseJSON {
|
|
119
|
-
type: VariableValueTypes.String;
|
|
120
|
-
value: string;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* JSON representation of [[IntRulesetVariable]].
|
|
124
|
-
* @public
|
|
125
|
-
* @deprecated in 3.x. Use [[IntRulesetVariable]]
|
|
126
|
-
*/
|
|
127
|
-
export interface IntRulesetVariableJSON extends RulesetVariableBaseJSON {
|
|
128
|
-
type: VariableValueTypes.Int;
|
|
129
|
-
value: number;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* JSON representation of [[IntsRulesetVariable]].
|
|
133
|
-
* @public
|
|
134
|
-
* @deprecated in 3.x. Use [[IntsRulesetVariable]]
|
|
135
|
-
*/
|
|
136
|
-
export interface IntsRulesetVariableJSON extends RulesetVariableBaseJSON {
|
|
137
|
-
type: VariableValueTypes.IntArray;
|
|
138
|
-
value: number[];
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* JSON representation of [[Id64RulesetVariable]].
|
|
142
|
-
* @public
|
|
143
|
-
* @deprecated in 3.x. Use [[Id64RulesetVariable]]
|
|
144
|
-
*/
|
|
145
|
-
export interface Id64RulesetVariableJSON extends RulesetVariableBaseJSON {
|
|
146
|
-
type: VariableValueTypes.Id64;
|
|
147
|
-
value: Id64String;
|
|
148
|
-
}
|
|
149
104
|
/**
|
|
150
105
|
* JSON representation of [[Id64sRulesetVariable]].
|
|
151
106
|
* @public
|
|
@@ -158,7 +113,7 @@ export interface Id64sRulesetVariableJSON extends RulesetVariableBaseJSON {
|
|
|
158
113
|
* JSON representation of [[RulesetVariable]].
|
|
159
114
|
* @public
|
|
160
115
|
*/
|
|
161
|
-
export type RulesetVariableJSON =
|
|
116
|
+
export type RulesetVariableJSON = BooleanRulesetVariable | StringRulesetVariable | IntRulesetVariable | IntsRulesetVariable | Id64RulesetVariable | Id64sRulesetVariableJSON;
|
|
162
117
|
/** @public */
|
|
163
118
|
export declare namespace RulesetVariable {
|
|
164
119
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RulesetVariables.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/RulesetVariables.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEpE;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B,oBAAoB;IACpB,GAAG,QAAQ;IAEX,8BAA8B;IAC9B,QAAQ,UAAU;IAElB,oBAAoB;IACpB,IAAI,SAAS;IAEb,mBAAmB;IACnB,MAAM,WAAW;IAEjB,uBAAuB;IACvB,IAAI,SAAS;IAEb,iCAAiC;IACjC,SAAS,WAAW;CACrB;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU,GAAG,UAAU,EAAE,CAAC;AAE7F;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU,GAAG,UAAU,EAAE,GAAG,iBAAiB,CAAC;AAErH;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,EAAE,aAAa,CAAC;CACtB;AACD;;;GAGG;AACH,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;CAChB;AACD;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;IAChE,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;CACf;AACD;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC7D,IAAI,EAAE,kBAAkB,CAAC,GAAG,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;CACf;AACD;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,IAAI,EAAE,kBAAkB,CAAC,QAAQ,CAAC;IAClC,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AACD;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC;IAC9B,KAAK,EAAE,UAAU,CAAC;CACnB;AACD;;;GAGG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D,IAAI,EAAE,kBAAkB,CAAC,SAAS,CAAC;IACnC,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AACD;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB,sBAAsB,GACtB,qBAAqB,GACrB,kBAAkB,GAClB,mBAAmB,GACnB,mBAAmB,GACnB,oBAAoB,CAAC;AAEzB;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,EAAE,iBAAiB,CAAC;CAC1B;AACD
|
|
1
|
+
{"version":3,"file":"RulesetVariables.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/RulesetVariables.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEpE;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B,oBAAoB;IACpB,GAAG,QAAQ;IAEX,8BAA8B;IAC9B,QAAQ,UAAU;IAElB,oBAAoB;IACpB,IAAI,SAAS;IAEb,mBAAmB;IACnB,MAAM,WAAW;IAEjB,uBAAuB;IACvB,IAAI,SAAS;IAEb,iCAAiC;IACjC,SAAS,WAAW;CACrB;AAED;;;GAGG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GAGG;AACH,MAAM,MAAM,eAAe,GACvB,sBAAsB,GACtB,qBAAqB,GACrB,kBAAkB,GAClB,mBAAmB,GACnB,mBAAmB,GACnB,oBAAoB,CAAC;AAEzB;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,EAAE,iBAAiB,CAAC;CAC1B;AACD;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,uBAAuB;IACvE,IAAI,EAAE,kBAAkB,CAAC,SAAS,CAAC;IACnC,KAAK,EAAE,UAAU,EAAE,GAAG,iBAAiB,CAAC;CACzC;AACD;;;GAGG;AAEH,MAAM,MAAM,mBAAmB,GAC3B,sBAAsB,GACtB,qBAAqB,GACrB,kBAAkB,GAClB,mBAAmB,GACnB,mBAAmB,GACnB,wBAAwB,CAAC;AAE7B,cAAc;AAEd,yBAAiB,eAAe,CAAC;IAC/B;;;OAGG;IACH,SAAgB,MAAM,CAAC,QAAQ,EAAE,eAAe,GAAG,mBAAmB,CAKrE;IAED,iDAAiD;IACjD,SAAgB,QAAQ,CAAC,IAAI,EAAE,mBAAmB,GAAG,eAAe,CAQnE;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RulesetVariables.js","sourceRoot":"","sources":["../../../src/presentation-common/RulesetVariables.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAc,MAAM,qBAAqB,CAAC;AAEpE;;;GAGG;AACH,MAAM,CAAN,IAAY,kBAkBX;AAlBD,WAAY,kBAAkB;IAC5B,oBAAoB;IACpB,iCAAW,CAAA;IAEX,8BAA8B;IAC9B,wCAAkB,CAAA;IAElB,oBAAoB;IACpB,mCAAa,CAAA;IAEb,mBAAmB;IACnB,uCAAiB,CAAA;IAEjB,uBAAuB;IACvB,mCAAa,CAAA;IAEb,iCAAiC;IACjC,0CAAoB,CAA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AC;YAC3E,CAAC;YACD,OAAO,IAAW,CAAC,CAAC,kFAAkF;QACxG,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IARe,wBAAQ,WAQvB,CAAA;AACH,CAAC,EAtBgB,eAAe,KAAf,eAAe,QAsB/B","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 { CompressedId64Set, Id64String } from \"@itwin/core-bentley\";\r\n\r\n/**\r\n * Possible variable value types\r\n * @public\r\n */\r\nexport enum VariableValueTypes {\r\n /** Integer value */\r\n Int = \"int\",\r\n\r\n /** Array of integer values */\r\n IntArray = \"int[]\",\r\n\r\n /** Boolean value */\r\n Bool = \"bool\",\r\n\r\n /** String value */\r\n String = \"string\",\r\n\r\n /** Id64String value */\r\n Id64 = \"id64\",\r\n\r\n /** Array of Id64String values */\r\n Id64Array = \"id64[]\",\r\n}\r\n\r\n/**\r\n * Union of all supported variable value types\r\n * @public\r\n */\r\nexport type VariableValue = boolean | string | number | number[] | Id64String | Id64String[];\r\n\r\n/**\r\n * JSON representation of [[VariableValue]]\r\n * @public\r\n */\r\nexport type VariableValueJSON = boolean | string | number | number[] | Id64String | Id64String[] | CompressedId64Set;\r\n\r\n/**\r\n * Base data structure for representing ruleset variables.\r\n * @public\r\n */\r\nexport interface RulesetVariableBase {\r\n id: string;\r\n type: VariableValueTypes;\r\n value: VariableValue;\r\n}\r\n/**\r\n * Data structure for representing boolean ruleset variables.\r\n * @public\r\n */\r\nexport interface BooleanRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.Bool;\r\n value: boolean;\r\n}\r\n/**\r\n * Data structure for representing string ruleset variables.\r\n * @public\r\n */\r\nexport interface StringRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.String;\r\n value: string;\r\n}\r\n/**\r\n * Data structure for representing int ruleset variables.\r\n * @public\r\n */\r\nexport interface IntRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.Int;\r\n value: number;\r\n}\r\n/**\r\n * Data structure for representing int array ruleset variables.\r\n * @public\r\n */\r\nexport interface IntsRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.IntArray;\r\n value: number[];\r\n}\r\n/**\r\n * Data structure for representing ID ruleset variables.\r\n * @public\r\n */\r\nexport interface Id64RulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.Id64;\r\n value: Id64String;\r\n}\r\n/**\r\n * Data structure for representing ID array ruleset variables.\r\n * @public\r\n */\r\nexport interface Id64sRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.Id64Array;\r\n value: Id64String[];\r\n}\r\n/**\r\n * Data structure for representing ruleset variables.\r\n * @public\r\n */\r\nexport type RulesetVariable =\r\n | BooleanRulesetVariable\r\n | StringRulesetVariable\r\n | IntRulesetVariable\r\n | IntsRulesetVariable\r\n | Id64RulesetVariable\r\n | Id64sRulesetVariable;\r\n\r\n/**\r\n * JSON representation of [[RulesetVariableBase]].\r\n * @public\r\n */\r\nexport interface RulesetVariableBaseJSON {\r\n id: string;\r\n type: VariableValueTypes;\r\n value: VariableValueJSON;\r\n}\r\n/**\r\n * JSON representation of [[Id64sRulesetVariable]].\r\n * @public\r\n */\r\nexport interface Id64sRulesetVariableJSON extends RulesetVariableBaseJSON {\r\n type: VariableValueTypes.Id64Array;\r\n value: Id64String[] | CompressedId64Set;\r\n}\r\n/**\r\n * JSON representation of [[RulesetVariable]].\r\n * @public\r\n */\r\n\r\nexport type RulesetVariableJSON =\r\n | BooleanRulesetVariable\r\n | StringRulesetVariable\r\n | IntRulesetVariable\r\n | IntsRulesetVariable\r\n | Id64RulesetVariable\r\n | Id64sRulesetVariableJSON;\r\n\r\n/** @public */\r\n// eslint-disable-next-line @typescript-eslint/no-redeclare\r\nexport namespace RulesetVariable {\r\n /**\r\n * Serialize given RulesetVariable to JSON.\r\n * Note: In case of [[Id64sRulesetVariable]], this method expects IDs are sorted. See [[OrderedId64Iterable.sortArray]].\r\n */\r\n export function toJSON(variable: RulesetVariable): RulesetVariableJSON {\r\n if (variable.type === VariableValueTypes.Id64Array) {\r\n return { ...variable, value: CompressedId64Set.compressArray(variable.value) };\r\n }\r\n return variable;\r\n }\r\n\r\n /** Deserialize [[RulesetVariable]] from JSON. */\r\n export function fromJSON(json: RulesetVariableJSON): RulesetVariable {\r\n if (json.type === VariableValueTypes.Id64Array) {\r\n if (typeof json.value === \"string\") {\r\n return { ...json, value: CompressedId64Set.decompressArray(json.value) };\r\n }\r\n return json as any; // for some reason TS doesn't understand that `json.value` is always an array here\r\n }\r\n return json;\r\n }\r\n}\r\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Core
|
|
3
3
|
*/
|
|
4
|
-
import { NodeKey
|
|
5
|
-
import { Node,
|
|
4
|
+
import { NodeKey } from "./hierarchy/Key";
|
|
5
|
+
import { Node, PartialNode } from "./hierarchy/Node";
|
|
6
6
|
/**
|
|
7
7
|
* A constant for indicating that a full update is required.
|
|
8
8
|
* @public
|
|
@@ -32,30 +32,11 @@ export type HierarchyUpdateInfo = typeof UPDATE_FULL;
|
|
|
32
32
|
* @public
|
|
33
33
|
*/
|
|
34
34
|
export type ContentUpdateInfo = typeof UPDATE_FULL;
|
|
35
|
-
/**
|
|
36
|
-
* JSON representation of [[PartialHierarchyModification]].
|
|
37
|
-
* @public
|
|
38
|
-
* @deprecated in 3.x. Use [[PartialHierarchyModification]]
|
|
39
|
-
*/
|
|
40
|
-
export type PartialHierarchyModificationJSON = NodeInsertionInfoJSON | NodeDeletionInfoJSON | NodeUpdateInfoJSON;
|
|
41
35
|
/**
|
|
42
36
|
* Information about a hierarchy change: insertion, deletion or node update.
|
|
43
37
|
* @public
|
|
44
38
|
*/
|
|
45
39
|
export type PartialHierarchyModification = NodeInsertionInfo | NodeDeletionInfo | NodeUpdateInfo;
|
|
46
|
-
/** @public */
|
|
47
|
-
export declare namespace PartialHierarchyModification {
|
|
48
|
-
/**
|
|
49
|
-
* Serialize given object to JSON.
|
|
50
|
-
* @deprecated in 3.x. Use [[PartialHierarchyModification]]
|
|
51
|
-
*/
|
|
52
|
-
function toJSON(obj: PartialHierarchyModification): PartialHierarchyModificationJSON;
|
|
53
|
-
/**
|
|
54
|
-
* Deserialize given object from JSON
|
|
55
|
-
* @deprecated in 3.x. Use [[PartialHierarchyModification]]
|
|
56
|
-
*/
|
|
57
|
-
function fromJSON(json: PartialHierarchyModificationJSON): PartialHierarchyModification;
|
|
58
|
-
}
|
|
59
40
|
/**
|
|
60
41
|
* Information about node insertion.
|
|
61
42
|
* @public
|
|
@@ -69,17 +50,6 @@ export interface NodeInsertionInfo {
|
|
|
69
50
|
/** Inserted node */
|
|
70
51
|
node: Node;
|
|
71
52
|
}
|
|
72
|
-
/**
|
|
73
|
-
* JSON representation of [[NodeInsertionInfo]].
|
|
74
|
-
* @public
|
|
75
|
-
* @deprecated in 3.x. Use [[NodeInsertionInfo]]
|
|
76
|
-
*/
|
|
77
|
-
export interface NodeInsertionInfoJSON {
|
|
78
|
-
type: "Insert";
|
|
79
|
-
parent?: NodeKeyJSON;
|
|
80
|
-
position: number;
|
|
81
|
-
node: NodeJSON;
|
|
82
|
-
}
|
|
83
53
|
/**
|
|
84
54
|
* Information about node deletion.
|
|
85
55
|
* @public
|
|
@@ -91,18 +61,6 @@ export interface NodeDeletionInfo {
|
|
|
91
61
|
/** Position of the deleted node among its siblings in the initial, not updated tree */
|
|
92
62
|
position: number;
|
|
93
63
|
}
|
|
94
|
-
/**
|
|
95
|
-
* JSON representation of [[NodeDeletionInfo]].
|
|
96
|
-
* @public
|
|
97
|
-
* @deprecated in 3.x. Use [[NodeDeletionInfo]]
|
|
98
|
-
*/
|
|
99
|
-
export interface NodeDeletionInfoJSON {
|
|
100
|
-
type: "Delete";
|
|
101
|
-
/** Parent of the deleted node */
|
|
102
|
-
parent?: NodeKeyJSON;
|
|
103
|
-
/** Position of the deleted node among its siblings in the initial, not updated tree */
|
|
104
|
-
position: number;
|
|
105
|
-
}
|
|
106
64
|
/**
|
|
107
65
|
* Information about node update.
|
|
108
66
|
* @public
|
|
@@ -114,28 +72,6 @@ export interface NodeUpdateInfo {
|
|
|
114
72
|
/** Updated node attributes */
|
|
115
73
|
changes: PartialNode;
|
|
116
74
|
}
|
|
117
|
-
/**
|
|
118
|
-
* JSON representation of [[NodeUpdateInfo]].
|
|
119
|
-
* @public
|
|
120
|
-
* @deprecated in 3.x. Use [[NodeUpdateInfo]]
|
|
121
|
-
*/
|
|
122
|
-
export interface NodeUpdateInfoJSON {
|
|
123
|
-
type: "Update";
|
|
124
|
-
target: NodeKeyJSON;
|
|
125
|
-
changes: PartialNodeJSON;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* JSON representation of [[HierarchyCompareInfo]].
|
|
129
|
-
* @public
|
|
130
|
-
* @deprecated in 3.x. Use [[HierarchyCompareInfo]].
|
|
131
|
-
*/
|
|
132
|
-
export interface HierarchyCompareInfoJSON {
|
|
133
|
-
changes: PartialHierarchyModificationJSON[];
|
|
134
|
-
continuationToken?: {
|
|
135
|
-
prevHierarchyNode: string;
|
|
136
|
-
currHierarchyNode: string;
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
75
|
/**
|
|
140
76
|
* Information about hierarchy modification / differences.
|
|
141
77
|
* @public
|
|
@@ -149,17 +85,4 @@ export interface HierarchyCompareInfo {
|
|
|
149
85
|
currHierarchyNode: string;
|
|
150
86
|
};
|
|
151
87
|
}
|
|
152
|
-
/** @public */
|
|
153
|
-
export declare namespace HierarchyCompareInfo {
|
|
154
|
-
/**
|
|
155
|
-
* Serialize given object to JSON.
|
|
156
|
-
* @deprecated in 3.x. Use [[HierarchyCompareInfo]]
|
|
157
|
-
*/
|
|
158
|
-
function toJSON(obj: HierarchyCompareInfo): HierarchyCompareInfoJSON;
|
|
159
|
-
/**
|
|
160
|
-
* Deserialize given object from JSON
|
|
161
|
-
* @deprecated in 3.x. Use [[HierarchyCompareInfo]]
|
|
162
|
-
*/
|
|
163
|
-
function fromJSON(json: HierarchyCompareInfoJSON): HierarchyCompareInfo;
|
|
164
|
-
}
|
|
165
88
|
//# sourceMappingURL=Update.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Update.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/Update.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Update.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/Update.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,WAAW,SAAS,CAAC;AAElC;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,CAAC,SAAS,EAAE,MAAM,GAAG;YACnB,SAAS,CAAC,EAAE,mBAAmB,CAAC;YAChC,OAAO,CAAC,EAAE,iBAAiB,CAAC;SAC7B,CAAC;KACH,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,WAAW,CAAC;AAErD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,WAAW,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,cAAc,CAAC;AAEjG;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,QAAQ,CAAC;IACf,sBAAsB;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB;IACpB,IAAI,EAAE,IAAI,CAAC;CACZ;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,iCAAiC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,uFAAuF;IACvF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,8BAA8B;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,8BAA8B;IAC9B,OAAO,EAAE,WAAW,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,kCAAkC;IAClC,OAAO,EAAE,4BAA4B,EAAE,CAAC;IACxC,sDAAsD;IACtD,iBAAiB,CAAC,EAAE;QAClB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH"}
|
|
@@ -5,112 +5,9 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module Core
|
|
7
7
|
*/
|
|
8
|
-
import { NodeKey } from "./hierarchy/Key";
|
|
9
|
-
import { Node } from "./hierarchy/Node";
|
|
10
8
|
/**
|
|
11
9
|
* A constant for indicating that a full update is required.
|
|
12
10
|
* @public
|
|
13
11
|
*/
|
|
14
12
|
export const UPDATE_FULL = "FULL";
|
|
15
|
-
/** @public */
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
17
|
-
export var PartialHierarchyModification;
|
|
18
|
-
(function (PartialHierarchyModification) {
|
|
19
|
-
/**
|
|
20
|
-
* Serialize given object to JSON.
|
|
21
|
-
* @deprecated in 3.x. Use [[PartialHierarchyModification]]
|
|
22
|
-
*/
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
24
|
-
function toJSON(obj) {
|
|
25
|
-
switch (obj.type) {
|
|
26
|
-
case "Insert":
|
|
27
|
-
return {
|
|
28
|
-
type: "Insert",
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
30
|
-
parent: obj.parent === undefined ? undefined : NodeKey.toJSON(obj.parent),
|
|
31
|
-
position: obj.position,
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
33
|
-
node: Node.toJSON(obj.node),
|
|
34
|
-
};
|
|
35
|
-
case "Update":
|
|
36
|
-
return {
|
|
37
|
-
type: "Update",
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
39
|
-
target: NodeKey.toJSON(obj.target),
|
|
40
|
-
changes: Node.toPartialJSON(obj.changes),
|
|
41
|
-
};
|
|
42
|
-
case "Delete":
|
|
43
|
-
return {
|
|
44
|
-
type: "Delete",
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
46
|
-
parent: obj.parent === undefined ? undefined : NodeKey.toJSON(obj.parent),
|
|
47
|
-
position: obj.position,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
PartialHierarchyModification.toJSON = toJSON;
|
|
52
|
-
/**
|
|
53
|
-
* Deserialize given object from JSON
|
|
54
|
-
* @deprecated in 3.x. Use [[PartialHierarchyModification]]
|
|
55
|
-
*/
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
57
|
-
function fromJSON(json) {
|
|
58
|
-
switch (json.type) {
|
|
59
|
-
case "Insert":
|
|
60
|
-
return {
|
|
61
|
-
type: "Insert",
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
63
|
-
parent: json.parent === undefined ? undefined : NodeKey.fromJSON(json.parent),
|
|
64
|
-
position: json.position,
|
|
65
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
66
|
-
node: Node.fromJSON(json.node),
|
|
67
|
-
};
|
|
68
|
-
case "Update":
|
|
69
|
-
return {
|
|
70
|
-
type: "Update",
|
|
71
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
72
|
-
target: NodeKey.fromJSON(json.target),
|
|
73
|
-
changes: Node.fromPartialJSON(json.changes),
|
|
74
|
-
};
|
|
75
|
-
case "Delete":
|
|
76
|
-
return {
|
|
77
|
-
type: "Delete",
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
79
|
-
parent: json.parent === undefined ? undefined : NodeKey.fromJSON(json.parent),
|
|
80
|
-
position: json.position,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
PartialHierarchyModification.fromJSON = fromJSON;
|
|
85
|
-
})(PartialHierarchyModification || (PartialHierarchyModification = {}));
|
|
86
|
-
/** @public */
|
|
87
|
-
export var HierarchyCompareInfo;
|
|
88
|
-
(function (HierarchyCompareInfo) {
|
|
89
|
-
/**
|
|
90
|
-
* Serialize given object to JSON.
|
|
91
|
-
* @deprecated in 3.x. Use [[HierarchyCompareInfo]]
|
|
92
|
-
*/
|
|
93
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
94
|
-
function toJSON(obj) {
|
|
95
|
-
return {
|
|
96
|
-
...obj,
|
|
97
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
98
|
-
changes: obj.changes.map((change) => PartialHierarchyModification.toJSON(change)),
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
HierarchyCompareInfo.toJSON = toJSON;
|
|
102
|
-
/**
|
|
103
|
-
* Deserialize given object from JSON
|
|
104
|
-
* @deprecated in 3.x. Use [[HierarchyCompareInfo]]
|
|
105
|
-
*/
|
|
106
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
107
|
-
function fromJSON(json) {
|
|
108
|
-
return {
|
|
109
|
-
...json,
|
|
110
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
111
|
-
changes: json.changes.map((change) => PartialHierarchyModification.fromJSON(change)),
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
HierarchyCompareInfo.fromJSON = fromJSON;
|
|
115
|
-
})(HierarchyCompareInfo || (HierarchyCompareInfo = {}));
|
|
116
13
|
//# sourceMappingURL=Update.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Update.js","sourceRoot":"","sources":["../../../src/presentation-common/Update.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAe,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,IAAI,EAA0C,MAAM,kBAAkB,CAAC;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC;AA2ClC,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,4BAA4B,CAsE5C;AAtED,WAAiB,4BAA4B;IAC3C;;;OAGG;IACH,4DAA4D;IAC5D,SAAgB,MAAM,CAAC,GAAiC;QACtD,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;YACjB,KAAK,QAAQ;gBACX,OAAO;oBACL,IAAI,EAAE,QAAQ;oBACd,4DAA4D;oBAC5D,MAAM,EAAE,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;oBACzE,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,4DAA4D;oBAC5D,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;iBAC5B,CAAC;YAEJ,KAAK,QAAQ;gBACX,OAAO;oBACL,IAAI,EAAE,QAAQ;oBACd,4DAA4D;oBAC5D,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;oBAClC,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC;iBACzC,CAAC;YAEJ,KAAK,QAAQ;gBACX,OAAO;oBACL,IAAI,EAAE,QAAQ;oBACd,4D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CAAQ,WA4BvB,CAAA;AACH,CAAC,EAtEgB,4BAA4B,KAA5B,4BAA4B,QAsE5C;AA6GD,cAAc;AACd,MAAM,KAAW,oBAAoB,CA0BpC;AA1BD,WAAiB,oBAAoB;IACnC;;;OAGG;IACH,4DAA4D;IAC5D,SAAgB,MAAM,CAAC,GAAyB;QAC9C,OAAO;YACL,GAAG,GAAG;YACN,4DAA4D;YAC5D,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,4BAA4B,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SAClF,CAAC;IACJ,CAAC;IANe,2BAAM,SAMrB,CAAA;IAED;;;OAGG;IACH,4DAA4D;IAC5D,SAAgB,QAAQ,CAAC,IAA8B;QACrD,OAAO;YACL,GAAG,IAAI;YACP,4DAA4D;YAC5D,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,4BAA4B,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;SACrF,CAAC;IACJ,CAAC;IANe,6BAAQ,WAMvB,CAAA;AACH,CAAC,EA1BgB,oBAAoB,KAApB,oBAAoB,QA0BpC","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 { NodeKey, NodeKeyJSON } from \"./hierarchy/Key\";\r\nimport { Node, NodeJSON, PartialNode, PartialNodeJSON } from \"./hierarchy/Node\";\r\n\r\n/**\r\n * A constant for indicating that a full update is required.\r\n * @public\r\n */\r\nexport const UPDATE_FULL = \"FULL\";\r\n\r\n/**\r\n * A data structure that describes changes that need to be applied to the hierarchy and\r\n * content components due to some changes on the backend.\r\n *\r\n * @public\r\n */\r\nexport interface UpdateInfo {\r\n [imodel: string]: {\r\n [rulesetId: string]: {\r\n hierarchy?: HierarchyUpdateInfo;\r\n content?: ContentUpdateInfo;\r\n };\r\n };\r\n}\r\n\r\n/**\r\n * Information about a required hierarchy update.\r\n * @public\r\n */\r\nexport type HierarchyUpdateInfo = typeof UPDATE_FULL;\r\n\r\n/**\r\n * Information about a required content update.\r\n * @public\r\n */\r\nexport type ContentUpdateInfo = typeof UPDATE_FULL;\r\n\r\n/**\r\n * JSON representation of [[PartialHierarchyModification]].\r\n * @public\r\n * @deprecated in 3.x. Use [[PartialHierarchyModification]]\r\n */\r\n// eslint-disable-next-line @typescript-eslint/no-deprecated\r\nexport type PartialHierarchyModificationJSON = NodeInsertionInfoJSON | NodeDeletionInfoJSON | NodeUpdateInfoJSON;\r\n\r\n/**\r\n * Information about a hierarchy change: insertion, deletion or node update.\r\n * @public\r\n */\r\nexport type PartialHierarchyModification = NodeInsertionInfo | NodeDeletionInfo | NodeUpdateInfo;\r\n\r\n/** @public */\r\n// eslint-disable-next-line @typescript-eslint/no-redeclare\r\nexport namespace PartialHierarchyModification {\r\n /**\r\n * Serialize given object to JSON.\r\n * @deprecated in 3.x. Use [[PartialHierarchyModification]]\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function toJSON(obj: PartialHierarchyModification): PartialHierarchyModificationJSON {\r\n switch (obj.type) {\r\n case \"Insert\":\r\n return {\r\n type: \"Insert\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent: obj.parent === undefined ? undefined : NodeKey.toJSON(obj.parent),\r\n position: obj.position,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n node: Node.toJSON(obj.node),\r\n };\r\n\r\n case \"Update\":\r\n return {\r\n type: \"Update\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n target: NodeKey.toJSON(obj.target),\r\n changes: Node.toPartialJSON(obj.changes),\r\n };\r\n\r\n case \"Delete\":\r\n return {\r\n type: \"Delete\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent: obj.parent === undefined ? undefined : NodeKey.toJSON(obj.parent),\r\n position: obj.position,\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Deserialize given object from JSON\r\n * @deprecated in 3.x. Use [[PartialHierarchyModification]]\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function fromJSON(json: PartialHierarchyModificationJSON): PartialHierarchyModification {\r\n switch (json.type) {\r\n case \"Insert\":\r\n return {\r\n type: \"Insert\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent: json.parent === undefined ? undefined : NodeKey.fromJSON(json.parent),\r\n position: json.position,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n node: Node.fromJSON(json.node),\r\n };\r\n\r\n case \"Update\":\r\n return {\r\n type: \"Update\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n target: NodeKey.fromJSON(json.target),\r\n changes: Node.fromPartialJSON(json.changes),\r\n };\r\n\r\n case \"Delete\":\r\n return {\r\n type: \"Delete\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent: json.parent === undefined ? undefined : NodeKey.fromJSON(json.parent),\r\n position: json.position,\r\n };\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Information about node insertion.\r\n * @public\r\n */\r\nexport interface NodeInsertionInfo {\r\n type: \"Insert\";\r\n /** Parent node key */\r\n parent?: NodeKey;\r\n /** Index of the new node under its parent */\r\n position: number;\r\n /** Inserted node */\r\n node: Node;\r\n}\r\n\r\n/**\r\n * JSON representation of [[NodeInsertionInfo]].\r\n * @public\r\n * @deprecated in 3.x. Use [[NodeInsertionInfo]]\r\n */\r\nexport interface NodeInsertionInfoJSON {\r\n type: \"Insert\";\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent?: NodeKeyJSON;\r\n position: number;\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n node: NodeJSON;\r\n}\r\n\r\n/**\r\n * Information about node deletion.\r\n * @public\r\n */\r\nexport interface NodeDeletionInfo {\r\n type: \"Delete\";\r\n /** Parent of the deleted node */\r\n parent?: NodeKey;\r\n /** Position of the deleted node among its siblings in the initial, not updated tree */\r\n position: number;\r\n}\r\n\r\n/**\r\n * JSON representation of [[NodeDeletionInfo]].\r\n * @public\r\n * @deprecated in 3.x. Use [[NodeDeletionInfo]]\r\n */\r\nexport interface NodeDeletionInfoJSON {\r\n type: \"Delete\";\r\n /** Parent of the deleted node */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent?: NodeKeyJSON;\r\n /** Position of the deleted node among its siblings in the initial, not updated tree */\r\n position: number;\r\n}\r\n\r\n/**\r\n * Information about node update.\r\n * @public\r\n */\r\nexport interface NodeUpdateInfo {\r\n type: \"Update\";\r\n /** Key of the updated node */\r\n target: NodeKey;\r\n /** Updated node attributes */\r\n changes: PartialNode;\r\n}\r\n\r\n/**\r\n * JSON representation of [[NodeUpdateInfo]].\r\n * @public\r\n * @deprecated in 3.x. Use [[NodeUpdateInfo]]\r\n */\r\nexport interface NodeUpdateInfoJSON {\r\n type: \"Update\";\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n target: NodeKeyJSON;\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n changes: PartialNodeJSON;\r\n}\r\n\r\n/**\r\n * JSON representation of [[HierarchyCompareInfo]].\r\n * @public\r\n * @deprecated in 3.x. Use [[HierarchyCompareInfo]].\r\n */\r\nexport interface HierarchyCompareInfoJSON {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n changes: PartialHierarchyModificationJSON[];\r\n continuationToken?: {\r\n prevHierarchyNode: string;\r\n currHierarchyNode: string;\r\n };\r\n}\r\n\r\n/**\r\n * Information about hierarchy modification / differences.\r\n * @public\r\n */\r\nexport interface HierarchyCompareInfo {\r\n /** A list of hierarchy changes */\r\n changes: PartialHierarchyModification[];\r\n /** Continuation token for requesting more changes. */\r\n continuationToken?: {\r\n prevHierarchyNode: string;\r\n currHierarchyNode: string;\r\n };\r\n}\r\n\r\n/** @public */\r\nexport namespace HierarchyCompareInfo {\r\n /**\r\n * Serialize given object to JSON.\r\n * @deprecated in 3.x. Use [[HierarchyCompareInfo]]\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function toJSON(obj: HierarchyCompareInfo): HierarchyCompareInfoJSON {\r\n return {\r\n ...obj,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n changes: obj.changes.map((change) => PartialHierarchyModification.toJSON(change)),\r\n };\r\n }\r\n\r\n /**\r\n * Deserialize given object from JSON\r\n * @deprecated in 3.x. Use [[HierarchyCompareInfo]]\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function fromJSON(json: HierarchyCompareInfoJSON): HierarchyCompareInfo {\r\n return {\r\n ...json,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n changes: json.changes.map((change) => PartialHierarchyModification.fromJSON(change)),\r\n };\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Update.js","sourceRoot":"","sources":["../../../src/presentation-common/Update.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAKH;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,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 { NodeKey } from \"./hierarchy/Key\";\r\nimport { Node, PartialNode } from \"./hierarchy/Node\";\r\n\r\n/**\r\n * A constant for indicating that a full update is required.\r\n * @public\r\n */\r\nexport const UPDATE_FULL = \"FULL\";\r\n\r\n/**\r\n * A data structure that describes changes that need to be applied to the hierarchy and\r\n * content components due to some changes on the backend.\r\n *\r\n * @public\r\n */\r\nexport interface UpdateInfo {\r\n [imodel: string]: {\r\n [rulesetId: string]: {\r\n hierarchy?: HierarchyUpdateInfo;\r\n content?: ContentUpdateInfo;\r\n };\r\n };\r\n}\r\n\r\n/**\r\n * Information about a required hierarchy update.\r\n * @public\r\n */\r\nexport type HierarchyUpdateInfo = typeof UPDATE_FULL;\r\n\r\n/**\r\n * Information about a required content update.\r\n * @public\r\n */\r\nexport type ContentUpdateInfo = typeof UPDATE_FULL;\r\n\r\n/**\r\n * Information about a hierarchy change: insertion, deletion or node update.\r\n * @public\r\n */\r\nexport type PartialHierarchyModification = NodeInsertionInfo | NodeDeletionInfo | NodeUpdateInfo;\r\n\r\n/**\r\n * Information about node insertion.\r\n * @public\r\n */\r\nexport interface NodeInsertionInfo {\r\n type: \"Insert\";\r\n /** Parent node key */\r\n parent?: NodeKey;\r\n /** Index of the new node under its parent */\r\n position: number;\r\n /** Inserted node */\r\n node: Node;\r\n}\r\n\r\n/**\r\n * Information about node deletion.\r\n * @public\r\n */\r\nexport interface NodeDeletionInfo {\r\n type: \"Delete\";\r\n /** Parent of the deleted node */\r\n parent?: NodeKey;\r\n /** Position of the deleted node among its siblings in the initial, not updated tree */\r\n position: number;\r\n}\r\n\r\n/**\r\n * Information about node update.\r\n * @public\r\n */\r\nexport interface NodeUpdateInfo {\r\n type: \"Update\";\r\n /** Key of the updated node */\r\n target: NodeKey;\r\n /** Updated node attributes */\r\n changes: PartialNode;\r\n}\r\n\r\n/**\r\n * Information about hierarchy modification / differences.\r\n * @public\r\n */\r\nexport interface HierarchyCompareInfo {\r\n /** A list of hierarchy changes */\r\n changes: PartialHierarchyModification[];\r\n /** Continuation token for requesting more changes. */\r\n continuationToken?: {\r\n prevHierarchyNode: string;\r\n currHierarchyNode: string;\r\n };\r\n}\r\n"]}
|
|
@@ -60,4 +60,25 @@ export declare const getInstancesCount: (keys: Readonly<KeySet>) => number;
|
|
|
60
60
|
* @public
|
|
61
61
|
*/
|
|
62
62
|
export declare const DEFAULT_KEYS_BATCH_SIZE = 5000;
|
|
63
|
+
/**
|
|
64
|
+
* Removes all `undefined` properties from given `obj` object and returns
|
|
65
|
+
* the same (mutated) object.
|
|
66
|
+
*
|
|
67
|
+
* Example: `omitUndefined({ a: 1, b: undefined })` will return `{ a: 1 }`
|
|
68
|
+
*
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
export declare function omitUndefined<T extends object>(obj: T): T;
|
|
72
|
+
/** @internal */
|
|
73
|
+
type NullToUndefined<T> = T extends null ? undefined : T extends Array<infer U> ? Array<NullToUndefined<U>> : T extends object ? {
|
|
74
|
+
[K in keyof T]: NullToUndefined<T[K]>;
|
|
75
|
+
} : T;
|
|
76
|
+
/** @internal */
|
|
77
|
+
export declare function deepReplaceNullsToUndefined<T>(obj: T): NullToUndefined<T>;
|
|
78
|
+
/** @internal */
|
|
79
|
+
export declare function createCancellableTimeoutPromise(timeoutMs: number): {
|
|
80
|
+
promise: Promise<void>;
|
|
81
|
+
cancel: () => void;
|
|
82
|
+
};
|
|
83
|
+
export {};
|
|
63
84
|
//# sourceMappingURL=Utils.d.ts.map
|