@itwin/presentation-common 5.3.0-dev.6 → 5.3.0-dev.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Ruleset.schema.json +18 -18
- package/lib/assets/locales/en/Presentation.json +19 -19
- package/lib/cjs/presentation-common/AsyncTasks.js.map +1 -1
- package/lib/cjs/presentation-common/CommonLoggerCategory.js.map +1 -1
- package/lib/cjs/presentation-common/Diagnostics.js.map +1 -1
- package/lib/cjs/presentation-common/EC.js.map +1 -1
- package/lib/cjs/presentation-common/ElementProperties.js.map +1 -1
- package/lib/cjs/presentation-common/Error.js.map +1 -1
- package/lib/cjs/presentation-common/InstanceFilterDefinition.js.map +1 -1
- package/lib/cjs/presentation-common/KeySet.d.ts +4 -4
- package/lib/cjs/presentation-common/KeySet.js +3 -3
- package/lib/cjs/presentation-common/KeySet.js.map +1 -1
- package/lib/cjs/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
- package/lib/cjs/presentation-common/LabelDefinition.js.map +1 -1
- package/lib/cjs/presentation-common/LocalizationHelper.js.map +1 -1
- package/lib/cjs/presentation-common/PresentationIpcInterface.js.map +1 -1
- package/lib/cjs/presentation-common/PresentationManagerOptions.d.ts +5 -5
- package/lib/cjs/presentation-common/PresentationManagerOptions.js.map +1 -1
- package/lib/cjs/presentation-common/PresentationRpcInterface.d.ts +4 -4
- package/lib/cjs/presentation-common/PresentationRpcInterface.js.map +1 -1
- package/lib/cjs/presentation-common/RegisteredRuleset.js.map +1 -1
- package/lib/cjs/presentation-common/RpcRequestsHandler.js.map +1 -1
- package/lib/cjs/presentation-common/RulesetVariables.js.map +1 -1
- package/lib/cjs/presentation-common/RulesetsFactory.js.map +1 -1
- package/lib/cjs/presentation-common/Update.d.ts +7 -7
- package/lib/cjs/presentation-common/Update.js.map +1 -1
- package/lib/cjs/presentation-common/Utils.js.map +1 -1
- package/lib/cjs/presentation-common/content/Category.js.map +1 -1
- package/lib/cjs/presentation-common/content/Content.js.map +1 -1
- package/lib/cjs/presentation-common/content/ContentTraverser.js.map +1 -1
- package/lib/cjs/presentation-common/content/Descriptor.js.map +1 -1
- package/lib/cjs/presentation-common/content/DisplayTypes.js.map +1 -1
- package/lib/cjs/presentation-common/content/Editor.js.map +1 -1
- package/lib/cjs/presentation-common/content/Fields.js.map +1 -1
- package/lib/cjs/presentation-common/content/Item.js.map +1 -1
- package/lib/cjs/presentation-common/content/Property.js.map +1 -1
- package/lib/cjs/presentation-common/content/PropertyValueFormatter.js.map +1 -1
- package/lib/cjs/presentation-common/content/Renderer.js.map +1 -1
- package/lib/cjs/presentation-common/content/TypeDescription.js.map +1 -1
- package/lib/cjs/presentation-common/content/Value.js.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.d.ts +1 -1
- package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/Key.d.ts +10 -10
- package/lib/cjs/presentation-common/hierarchy/Key.js +2 -2
- package/lib/cjs/presentation-common/hierarchy/Key.js.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/Node.d.ts +2 -2
- package/lib/cjs/presentation-common/hierarchy/Node.js.map +1 -1
- package/lib/cjs/presentation-common/hierarchy/NodePathElement.d.ts +2 -2
- package/lib/cjs/presentation-common/hierarchy/NodePathElement.js.map +1 -1
- package/lib/cjs/presentation-common/rules/ClassSpecifications.js.map +1 -1
- package/lib/cjs/presentation-common/rules/RelatedInstanceSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/RelationshipDirection.js.map +1 -1
- package/lib/cjs/presentation-common/rules/RelationshipPathSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/Rule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/Ruleset.js.map +1 -1
- package/lib/cjs/presentation-common/rules/SchemasSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/Variables.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/ContentRelatedInstancesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/ContentRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/ContentSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/DefaultPropertyCategoryOverride.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/PropertySpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/SelectedNodeInstancesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/modifiers/ContentModifier.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/modifiers/CustomRendererSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/customization/ExtendedDataRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/customization/GroupingRule.d.ts +9 -9
- package/lib/cjs/presentation-common/rules/customization/GroupingRule.js +2 -2
- package/lib/cjs/presentation-common/rules/customization/GroupingRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/customization/InstanceLabelOverride.js.map +1 -1
- package/lib/cjs/presentation-common/rules/customization/SortingRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.d.ts +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts +4 -4
- package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.js +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.d.ts +6 -6
- package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.d.ts +2 -2
- package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.d.ts +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.d.ts +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.d.ts +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.d.ts +1 -1
- package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
- package/lib/cjs/presentation-common/selection/SelectionScope.js.map +1 -1
- package/lib/cjs/presentation-common-internal.js.map +1 -1
- package/lib/cjs/presentation-common.js.map +1 -1
- package/lib/esm/presentation-common/AsyncTasks.js.map +1 -1
- package/lib/esm/presentation-common/CommonLoggerCategory.js.map +1 -1
- package/lib/esm/presentation-common/Diagnostics.js.map +1 -1
- package/lib/esm/presentation-common/EC.js.map +1 -1
- package/lib/esm/presentation-common/ElementProperties.js.map +1 -1
- package/lib/esm/presentation-common/Error.js.map +1 -1
- package/lib/esm/presentation-common/InstanceFilterDefinition.js.map +1 -1
- package/lib/esm/presentation-common/KeySet.d.ts +4 -4
- package/lib/esm/presentation-common/KeySet.js +3 -3
- package/lib/esm/presentation-common/KeySet.js.map +1 -1
- package/lib/esm/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
- package/lib/esm/presentation-common/LabelDefinition.js.map +1 -1
- package/lib/esm/presentation-common/LocalizationHelper.js.map +1 -1
- package/lib/esm/presentation-common/PresentationIpcInterface.js.map +1 -1
- package/lib/esm/presentation-common/PresentationManagerOptions.d.ts +5 -5
- package/lib/esm/presentation-common/PresentationManagerOptions.js.map +1 -1
- package/lib/esm/presentation-common/PresentationRpcInterface.d.ts +4 -4
- package/lib/esm/presentation-common/PresentationRpcInterface.js.map +1 -1
- package/lib/esm/presentation-common/RegisteredRuleset.js.map +1 -1
- package/lib/esm/presentation-common/RpcRequestsHandler.js.map +1 -1
- package/lib/esm/presentation-common/RulesetVariables.js.map +1 -1
- package/lib/esm/presentation-common/RulesetsFactory.js.map +1 -1
- package/lib/esm/presentation-common/Update.d.ts +7 -7
- package/lib/esm/presentation-common/Update.js.map +1 -1
- package/lib/esm/presentation-common/Utils.js.map +1 -1
- package/lib/esm/presentation-common/content/Category.js.map +1 -1
- package/lib/esm/presentation-common/content/Content.js.map +1 -1
- package/lib/esm/presentation-common/content/ContentTraverser.js.map +1 -1
- package/lib/esm/presentation-common/content/Descriptor.js.map +1 -1
- package/lib/esm/presentation-common/content/DisplayTypes.js.map +1 -1
- package/lib/esm/presentation-common/content/Editor.js.map +1 -1
- package/lib/esm/presentation-common/content/Fields.js.map +1 -1
- package/lib/esm/presentation-common/content/Item.js.map +1 -1
- package/lib/esm/presentation-common/content/Property.js.map +1 -1
- package/lib/esm/presentation-common/content/PropertyValueFormatter.js.map +1 -1
- package/lib/esm/presentation-common/content/Renderer.js.map +1 -1
- package/lib/esm/presentation-common/content/TypeDescription.js.map +1 -1
- package/lib/esm/presentation-common/content/Value.js.map +1 -1
- package/lib/esm/presentation-common/hierarchy/HierarchyLevel.d.ts +1 -1
- package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
- package/lib/esm/presentation-common/hierarchy/Key.d.ts +10 -10
- package/lib/esm/presentation-common/hierarchy/Key.js +2 -2
- package/lib/esm/presentation-common/hierarchy/Key.js.map +1 -1
- package/lib/esm/presentation-common/hierarchy/Node.d.ts +2 -2
- package/lib/esm/presentation-common/hierarchy/Node.js.map +1 -1
- package/lib/esm/presentation-common/hierarchy/NodePathElement.d.ts +2 -2
- package/lib/esm/presentation-common/hierarchy/NodePathElement.js.map +1 -1
- package/lib/esm/presentation-common/rules/ClassSpecifications.js.map +1 -1
- package/lib/esm/presentation-common/rules/RelatedInstanceSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/RelationshipDirection.js.map +1 -1
- package/lib/esm/presentation-common/rules/RelationshipPathSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/Rule.js.map +1 -1
- package/lib/esm/presentation-common/rules/Ruleset.js.map +1 -1
- package/lib/esm/presentation-common/rules/SchemasSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/Variables.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/ContentRelatedInstancesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/ContentRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/ContentSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/DefaultPropertyCategoryOverride.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/PropertySpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/SelectedNodeInstancesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/modifiers/ContentModifier.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/modifiers/CustomRendererSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/customization/ExtendedDataRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/customization/GroupingRule.d.ts +9 -9
- package/lib/esm/presentation-common/rules/customization/GroupingRule.js +2 -2
- package/lib/esm/presentation-common/rules/customization/GroupingRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/customization/InstanceLabelOverride.js.map +1 -1
- package/lib/esm/presentation-common/rules/customization/SortingRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.d.ts +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts +4 -4
- package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.js +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.d.ts +6 -6
- package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.d.ts +2 -2
- package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.d.ts +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.d.ts +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.d.ts +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/SubCondition.d.ts +1 -1
- package/lib/esm/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
- package/lib/esm/presentation-common/selection/SelectionScope.js.map +1 -1
- package/lib/esm/presentation-common-internal.js.map +1 -1
- package/lib/esm/presentation-common.js.map +1 -1
- package/lib/public/locales/en/Presentation.json +19 -19
- package/package.json +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationRpcInterface.js","sourceRoot":"","sources":["../../../src/presentation-common/PresentationRpcInterface.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAAqD;AACrD;;GAEG;;;;;;;;;AAGH,oDAAgF;AAgChF,yCAA8E;AAwJ9E;;;GAGG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,0BAAY;IACxD,2CAA2C;IACpC,MAAM,CAAU,aAAa,GAAG,0BAA0B,CAAC;IAElE,6CAA6C;IACtC,MAAM,CAAC,gBAAgB,GAAG,OAAO,CAAC;IAEzC;;;iGAG6F;IAE7F,yKAAyK;IAClK,KAAK,CAAC,aAAa,CAAC,MAAsB,EAAE,QAAoC;QACrF,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;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G,OAAO,IAAA,sCAA2B,EAAC,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,yKAAyK;IAClK,KAAK,CAAC,+BAA+B,CAC1C,MAAsB,EACtB,QAAwC;QAExC,OAAO,IAAA,sCAA2B,EAAC,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,yKAAyK;IAClK,KAAK,CAAC,kBAAkB,CAAC,MAAsB,EAAE,QAAyC;QAC/F,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,yKAAyK;IAClK,KAAK,CAAC,gBAAgB,CAAC,MAAsB,EAAE,QAA2C;QAC/F,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;;AA7HU,4DAAwB;mCAAxB,wBAAwB;IADpC,0BAAY,CAAC,gBAAgB,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;GAC7C,wBAAwB,CA8HpC","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/* eslint-disable @typescript-eslint/no-deprecated */\r\n/** @packageDocumentation\r\n * @module RPC\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { IModelRpcProps, RpcInterface, RpcOperation } from \"@itwin/core-common\";\r\nimport { DescriptorJSON, DescriptorOverrides, SelectClassInfoJSON } from \"./content/Descriptor.js\";\r\nimport { ItemJSON } from \"./content/Item.js\";\r\nimport { DisplayValueGroup } from \"./content/Value.js\";\r\nimport { ClientDiagnostics, ClientDiagnosticsOptions } from \"./Diagnostics.js\";\r\nimport { CompressedClassInfoJSON, InstanceKey } from \"./EC.js\";\r\nimport { ElementProperties } from \"./ElementProperties.js\";\r\nimport { PresentationStatus } from \"./Error.js\";\r\nimport { NodeKey } from \"./hierarchy/Key.js\";\r\nimport { Node } from \"./hierarchy/Node.js\";\r\nimport { NodePathElement } from \"./hierarchy/NodePathElement.js\";\r\nimport { KeySetJSON } from \"./KeySet.js\";\r\nimport { LabelDefinition } from \"./LabelDefinition.js\";\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 SelectionScopeRequestOptions,\r\n SingleElementPropertiesRequestOptions,\r\n} from \"./PresentationManagerOptions.js\";\r\nimport { RulesetVariableJSON } from \"./RulesetVariables.js\";\r\nimport { SelectionScope } from \"./selection/SelectionScope.js\";\r\nimport { deepReplaceNullsToUndefined, Omit, PagedResponse } from \"./Utils.js\";\r\n\r\n/**\r\n * Base options for all presentation RPC requests.\r\n * @public\r\n */\r\nexport type PresentationRpcRequestOptions<TManagerRequestOptions> = Omit<TManagerRequestOptions, \"imodel\" | \"diagnostics\"> & {\r\n /** @internal ID of the client requesting data */\r\n clientId?: string;\r\n /** RPC request diagnostics options. */\r\n diagnostics?: RpcDiagnosticsOptions;\r\n};\r\n\r\n/**\r\n * Data structure for presentation RPC responses\r\n * @public\r\n */\r\nexport interface PresentationRpcResponseData<TResult = undefined> {\r\n /** Response status code */\r\n statusCode: PresentationStatus;\r\n /** In case of an error response, the error message */\r\n errorMessage?: string;\r\n /** In case of a success response, the result */\r\n result?: TResult;\r\n /** Diagnostics response. */\r\n diagnostics?: ClientDiagnostics;\r\n}\r\n\r\n/**\r\n * Data structure for RPC diagnostics options.\r\n * @public\r\n */\r\nexport type RpcDiagnosticsOptions = Omit<ClientDiagnosticsOptions, \"handler\">;\r\n\r\n/**\r\n * A promise of [[PresentationRpcResponseData]].\r\n * @public\r\n */\r\nexport type PresentationRpcResponse<TResult = undefined> = Promise<PresentationRpcResponseData<TResult>>;\r\n\r\n/**\r\n * Data structure for hierarchy request options.\r\n * @public\r\n * @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport type HierarchyRpcRequestOptions = PresentationRpcRequestOptions<HierarchyRequestOptions<never, NodeKey, RulesetVariableJSON>>;\r\n\r\n/**\r\n * Data structure for hierarchy level descriptor RPC request options.\r\n * @public\r\n * @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport type HierarchyLevelDescriptorRpcRequestOptions = PresentationRpcRequestOptions<\r\n HierarchyLevelDescriptorRequestOptions<never, NodeKey, RulesetVariableJSON>\r\n>;\r\n\r\n/**\r\n * Data structure for filtering hierarchy by ECInstance paths request options.\r\n * @public\r\n * @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport type FilterByInstancePathsHierarchyRpcRequestOptions = PresentationRpcRequestOptions<\r\n FilterByInstancePathsHierarchyRequestOptions<never, RulesetVariableJSON>\r\n>;\r\n\r\n/**\r\n * Data structure for filtering hierarchy by text request options.\r\n * @public\r\n * @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport type FilterByTextHierarchyRpcRequestOptions = PresentationRpcRequestOptions<FilterByTextHierarchyRequestOptions<never, RulesetVariableJSON>>;\r\n\r\n/**\r\n * Data structure for content sources RPC request options.\r\n * @public\r\n */\r\nexport type ContentSourcesRpcRequestOptions = PresentationRpcRequestOptions<ContentSourcesRequestOptions<never>>;\r\n/**\r\n * Data structure for content sources RPC response.\r\n * @public\r\n */\r\nexport interface ContentSourcesRpcResult {\r\n /** A list of objects containing content source information. */\r\n sources: SelectClassInfoJSON<Id64String>[];\r\n /** An `ECClassId` => [[CompressedClassInfoJSON]] map for deserializing [[sources]]. */\r\n classesMap: { [id: string]: CompressedClassInfoJSON };\r\n}\r\n\r\n/**\r\n * Data structure for content descriptor RPC request options.\r\n * @public\r\n */\r\nexport type ContentDescriptorRpcRequestOptions = PresentationRpcRequestOptions<ContentDescriptorRequestOptions<never, KeySetJSON, RulesetVariableJSON>>;\r\n\r\n/**\r\n * Data structure for content RPC request options.\r\n * @public\r\n */\r\nexport type ContentRpcRequestOptions = PresentationRpcRequestOptions<ContentRequestOptions<never, DescriptorOverrides, KeySetJSON, RulesetVariableJSON>>;\r\n\r\n/**\r\n * Data structure for single element properties RPC request options.\r\n * @public\r\n */\r\nexport type SingleElementPropertiesRpcRequestOptions = PresentationRpcRequestOptions<\r\n Omit<SingleElementPropertiesRequestOptions<never, never>, \"contentParser\">\r\n>;\r\n\r\n/**\r\n * Data structure for distinct values' request options.\r\n * @public\r\n */\r\nexport type DistinctValuesRpcRequestOptions = PresentationRpcRequestOptions<\r\n DistinctValuesRequestOptions<never, DescriptorOverrides, KeySetJSON, RulesetVariableJSON>\r\n>;\r\n\r\n/**\r\n * Data structure for content instance keys' request options.\r\n * @public\r\n */\r\nexport type ContentInstanceKeysRpcRequestOptions = PresentationRpcRequestOptions<ContentInstanceKeysRequestOptions<never, KeySetJSON, RulesetVariableJSON>>;\r\n\r\n/**\r\n * Data structure for label request options.\r\n * @public\r\n */\r\nexport type DisplayLabelRpcRequestOptions = PresentationRpcRequestOptions<DisplayLabelRequestOptions<never, InstanceKey>>;\r\n\r\n/**\r\n * Data structure for labels request options.\r\n * @public\r\n */\r\nexport type DisplayLabelsRpcRequestOptions = PresentationRpcRequestOptions<DisplayLabelsRequestOptions<never, InstanceKey>>;\r\n\r\n/**\r\n * Data structure for selection scope request options.\r\n * @public\r\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\r\n */\r\nexport type SelectionScopeRpcRequestOptions = PresentationRpcRequestOptions<SelectionScopeRequestOptions<never>>;\r\n\r\n/**\r\n * Request options data structure for computing selection based on given selection scope and element IDs.\r\n * @public\r\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\r\n */\r\nexport type ComputeSelectionRpcRequestOptions = PresentationRpcRequestOptions<ComputeSelectionRequestOptions<never>>;\r\n\r\n/**\r\n * Interface used for communication between Presentation backend and frontend.\r\n * @public\r\n */\r\n@RpcOperation.setDefaultPolicy({ retryInterval: () => 0 })\r\nexport class PresentationRpcInterface extends RpcInterface {\r\n /** The immutable name of the interface. */\r\n public static readonly interfaceName = \"PresentationRpcInterface\";\r\n\r\n /** The semantic version of the interface. */\r\n public static interfaceVersion = \"5.0.0\";\r\n\r\n /*===========================================================================================\r\n NOTE: Any add/remove/change to the methods below requires an update of the interface version.\r\n NOTE: Please consult the README in core/common/src/rpc for the semantic versioning rules.\r\n ===========================================================================================*/\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getNodesCount(_token: IModelRpcProps, _options: HierarchyRpcRequestOptions): PresentationRpcResponse<number> {\r\n return this.forward(arguments);\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getPagedNodes(_token: IModelRpcProps, _options: Paged<HierarchyRpcRequestOptions>): PresentationRpcResponse<PagedResponse<Node>> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getNodesDescriptor(\r\n _token: IModelRpcProps,\r\n _options: HierarchyLevelDescriptorRpcRequestOptions,\r\n ): PresentationRpcResponse<string | DescriptorJSON | undefined> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n // TODO: add paged version of this (#387280)\r\n public async getNodePaths(_token: IModelRpcProps, _options: FilterByInstancePathsHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElement[]> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n // TODO: add paged version of this (#387280)\r\n public async getFilteredNodePaths(_token: IModelRpcProps, _options: FilterByTextHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElement[]> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getContentSources(_token: IModelRpcProps, _options: ContentSourcesRpcRequestOptions): PresentationRpcResponse<ContentSourcesRpcResult> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getContentDescriptor(_token: IModelRpcProps, _options: ContentDescriptorRpcRequestOptions): PresentationRpcResponse<DescriptorJSON | undefined> {\r\n const response: PresentationRpcResponseData<string | undefined> = await this.forward(arguments);\r\n return {\r\n ...response,\r\n ...(response.result ? { result: JSON.parse(response.result) } : {}),\r\n };\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getContentSetSize(_token: IModelRpcProps, _options: ContentRpcRequestOptions): PresentationRpcResponse<number> {\r\n return this.forward(arguments);\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getPagedContent(\r\n _token: IModelRpcProps,\r\n _options: Paged<ContentRpcRequestOptions>,\r\n ): PresentationRpcResponse<{ descriptor: DescriptorJSON; contentSet: PagedResponse<ItemJSON> } | undefined> {\r\n const rpcResponse = await this.forward(arguments);\r\n return {\r\n ...rpcResponse,\r\n ...(rpcResponse.result\r\n ? /* c8 ignore next */ { result: { ...rpcResponse.result, contentSet: deepReplaceNullsToUndefined(rpcResponse.result.contentSet) } }\r\n : {}),\r\n };\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getPagedContentSet(_token: IModelRpcProps, _options: Paged<ContentRpcRequestOptions>): PresentationRpcResponse<PagedResponse<ItemJSON>> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getElementProperties(\r\n _token: IModelRpcProps,\r\n _options: SingleElementPropertiesRpcRequestOptions,\r\n ): PresentationRpcResponse<ElementProperties | undefined> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getPagedDistinctValues(\r\n _token: IModelRpcProps,\r\n _options: DistinctValuesRpcRequestOptions,\r\n ): PresentationRpcResponse<PagedResponse<DisplayValueGroup>> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getContentInstanceKeys(\r\n _token: IModelRpcProps,\r\n _options: ContentInstanceKeysRpcRequestOptions,\r\n ): PresentationRpcResponse<{ total: number; items: KeySetJSON }> {\r\n return this.forward(arguments);\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getDisplayLabelDefinition(_token: IModelRpcProps, _options: DisplayLabelRpcRequestOptions): PresentationRpcResponse<LabelDefinition> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getPagedDisplayLabelDefinitions(\r\n _token: IModelRpcProps,\r\n _options: DisplayLabelsRpcRequestOptions,\r\n ): PresentationRpcResponse<PagedResponse<LabelDefinition>> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getSelectionScopes(_token: IModelRpcProps, _options: SelectionScopeRpcRequestOptions): PresentationRpcResponse<SelectionScope[]> {\r\n return this.forward(arguments);\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async computeSelection(_token: IModelRpcProps, _options: ComputeSelectionRpcRequestOptions): PresentationRpcResponse<KeySetJSON> {\r\n return this.forward(arguments);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"PresentationRpcInterface.js","sourceRoot":"","sources":["../../../src/presentation-common/PresentationRpcInterface.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAA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CAAC,CAAC,CAAC;IACpE,CAAC;IAED,yKAAyK;IAClK,KAAK,CAAC,sBAAsB,CACjC,MAAsB,EACtB,QAAyC;QAEzC,OAAO,IAAA,sCAA2B,EAAC,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,yKAAyK;IAClK,KAAK,CAAC,sBAAsB,CACjC,MAAsB,EACtB,QAA8C;QAE9C,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,yKAAyK;IAClK,KAAK,CAAC,yBAAyB,CAAC,MAAsB,EAAE,QAAuC;QACpG,OAAO,IAAA,sCAA2B,EAAC,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,yKAAyK;IAClK,KAAK,CAAC,+BAA+B,CAC1C,MAAsB,EACtB,QAAwC;QAExC,OAAO,IAAA,sCAA2B,EAAC,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,yKAAyK;IAClK,KAAK,CAAC,kBAAkB,CAAC,MAAsB,EAAE,QAAyC;QAC/F,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,yKAAyK;IAClK,KAAK,CAAC,gBAAgB,CAAC,MAAsB,EAAE,QAA2C;QAC/F,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;;AA7HU,4DAAwB;mCAAxB,wBAAwB;IADpC,0BAAY,CAAC,gBAAgB,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;GAC7C,wBAAwB,CA8HpC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/* eslint-disable @typescript-eslint/no-deprecated */\n/** @packageDocumentation\n * @module RPC\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { IModelRpcProps, RpcInterface, RpcOperation } from \"@itwin/core-common\";\nimport { DescriptorJSON, DescriptorOverrides, SelectClassInfoJSON } from \"./content/Descriptor.js\";\nimport { ItemJSON } from \"./content/Item.js\";\nimport { DisplayValueGroup } from \"./content/Value.js\";\nimport { ClientDiagnostics, ClientDiagnosticsOptions } from \"./Diagnostics.js\";\nimport { CompressedClassInfoJSON, InstanceKey } from \"./EC.js\";\nimport { ElementProperties } from \"./ElementProperties.js\";\nimport { PresentationStatus } from \"./Error.js\";\nimport { NodeKey } from \"./hierarchy/Key.js\";\nimport { Node } from \"./hierarchy/Node.js\";\nimport { NodePathElement } from \"./hierarchy/NodePathElement.js\";\nimport { KeySetJSON } from \"./KeySet.js\";\nimport { LabelDefinition } from \"./LabelDefinition.js\";\nimport {\n ComputeSelectionRequestOptions,\n ContentDescriptorRequestOptions,\n ContentInstanceKeysRequestOptions,\n ContentRequestOptions,\n ContentSourcesRequestOptions,\n DisplayLabelRequestOptions,\n DisplayLabelsRequestOptions,\n DistinctValuesRequestOptions,\n FilterByInstancePathsHierarchyRequestOptions,\n FilterByTextHierarchyRequestOptions,\n HierarchyLevelDescriptorRequestOptions,\n HierarchyRequestOptions,\n Paged,\n SelectionScopeRequestOptions,\n SingleElementPropertiesRequestOptions,\n} from \"./PresentationManagerOptions.js\";\nimport { RulesetVariableJSON } from \"./RulesetVariables.js\";\nimport { SelectionScope } from \"./selection/SelectionScope.js\";\nimport { deepReplaceNullsToUndefined, Omit, PagedResponse } from \"./Utils.js\";\n\n/**\n * Base options for all presentation RPC requests.\n * @public\n */\nexport type PresentationRpcRequestOptions<TManagerRequestOptions> = Omit<TManagerRequestOptions, \"imodel\" | \"diagnostics\"> & {\n /** @internal ID of the client requesting data */\n clientId?: string;\n /** RPC request diagnostics options. */\n diagnostics?: RpcDiagnosticsOptions;\n};\n\n/**\n * Data structure for presentation RPC responses\n * @public\n */\nexport interface PresentationRpcResponseData<TResult = undefined> {\n /** Response status code */\n statusCode: PresentationStatus;\n /** In case of an error response, the error message */\n errorMessage?: string;\n /** In case of a success response, the result */\n result?: TResult;\n /** Diagnostics response. */\n diagnostics?: ClientDiagnostics;\n}\n\n/**\n * Data structure for RPC diagnostics options.\n * @public\n */\nexport type RpcDiagnosticsOptions = Omit<ClientDiagnosticsOptions, \"handler\">;\n\n/**\n * A promise of [[PresentationRpcResponseData]].\n * @public\n */\nexport type PresentationRpcResponse<TResult = undefined> = Promise<PresentationRpcResponseData<TResult>>;\n\n/**\n * Data structure for hierarchy request options.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport type HierarchyRpcRequestOptions = PresentationRpcRequestOptions<HierarchyRequestOptions<never, NodeKey, RulesetVariableJSON>>;\n\n/**\n * Data structure for hierarchy level descriptor RPC request options.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport type HierarchyLevelDescriptorRpcRequestOptions = PresentationRpcRequestOptions<\n HierarchyLevelDescriptorRequestOptions<never, NodeKey, RulesetVariableJSON>\n>;\n\n/**\n * Data structure for filtering hierarchy by ECInstance paths request options.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport type FilterByInstancePathsHierarchyRpcRequestOptions = PresentationRpcRequestOptions<\n FilterByInstancePathsHierarchyRequestOptions<never, RulesetVariableJSON>\n>;\n\n/**\n * Data structure for filtering hierarchy by text request options.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport type FilterByTextHierarchyRpcRequestOptions = PresentationRpcRequestOptions<FilterByTextHierarchyRequestOptions<never, RulesetVariableJSON>>;\n\n/**\n * Data structure for content sources RPC request options.\n * @public\n */\nexport type ContentSourcesRpcRequestOptions = PresentationRpcRequestOptions<ContentSourcesRequestOptions<never>>;\n/**\n * Data structure for content sources RPC response.\n * @public\n */\nexport interface ContentSourcesRpcResult {\n /** A list of objects containing content source information. */\n sources: SelectClassInfoJSON<Id64String>[];\n /** An `ECClassId` => [[CompressedClassInfoJSON]] map for deserializing [[sources]]. */\n classesMap: { [id: string]: CompressedClassInfoJSON };\n}\n\n/**\n * Data structure for content descriptor RPC request options.\n * @public\n */\nexport type ContentDescriptorRpcRequestOptions = PresentationRpcRequestOptions<ContentDescriptorRequestOptions<never, KeySetJSON, RulesetVariableJSON>>;\n\n/**\n * Data structure for content RPC request options.\n * @public\n */\nexport type ContentRpcRequestOptions = PresentationRpcRequestOptions<ContentRequestOptions<never, DescriptorOverrides, KeySetJSON, RulesetVariableJSON>>;\n\n/**\n * Data structure for single element properties RPC request options.\n * @public\n */\nexport type SingleElementPropertiesRpcRequestOptions = PresentationRpcRequestOptions<\n Omit<SingleElementPropertiesRequestOptions<never, never>, \"contentParser\">\n>;\n\n/**\n * Data structure for distinct values' request options.\n * @public\n */\nexport type DistinctValuesRpcRequestOptions = PresentationRpcRequestOptions<\n DistinctValuesRequestOptions<never, DescriptorOverrides, KeySetJSON, RulesetVariableJSON>\n>;\n\n/**\n * Data structure for content instance keys' request options.\n * @public\n */\nexport type ContentInstanceKeysRpcRequestOptions = PresentationRpcRequestOptions<ContentInstanceKeysRequestOptions<never, KeySetJSON, RulesetVariableJSON>>;\n\n/**\n * Data structure for label request options.\n * @public\n */\nexport type DisplayLabelRpcRequestOptions = PresentationRpcRequestOptions<DisplayLabelRequestOptions<never, InstanceKey>>;\n\n/**\n * Data structure for labels request options.\n * @public\n */\nexport type DisplayLabelsRpcRequestOptions = PresentationRpcRequestOptions<DisplayLabelsRequestOptions<never, InstanceKey>>;\n\n/**\n * Data structure for selection scope request options.\n * @public\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\n */\nexport type SelectionScopeRpcRequestOptions = PresentationRpcRequestOptions<SelectionScopeRequestOptions<never>>;\n\n/**\n * Request options data structure for computing selection based on given selection scope and element IDs.\n * @public\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\n */\nexport type ComputeSelectionRpcRequestOptions = PresentationRpcRequestOptions<ComputeSelectionRequestOptions<never>>;\n\n/**\n * Interface used for communication between Presentation backend and frontend.\n * @public\n */\n@RpcOperation.setDefaultPolicy({ retryInterval: () => 0 })\nexport class PresentationRpcInterface extends RpcInterface {\n /** The immutable name of the interface. */\n public static readonly interfaceName = \"PresentationRpcInterface\";\n\n /** The semantic version of the interface. */\n public static interfaceVersion = \"5.0.0\";\n\n /*===========================================================================================\n NOTE: Any add/remove/change to the methods below requires an update of the interface version.\n NOTE: Please consult the README in core/common/src/rpc for the semantic versioning rules.\n ===========================================================================================*/\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getNodesCount(_token: IModelRpcProps, _options: HierarchyRpcRequestOptions): PresentationRpcResponse<number> {\n return this.forward(arguments);\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getPagedNodes(_token: IModelRpcProps, _options: Paged<HierarchyRpcRequestOptions>): PresentationRpcResponse<PagedResponse<Node>> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getNodesDescriptor(\n _token: IModelRpcProps,\n _options: HierarchyLevelDescriptorRpcRequestOptions,\n ): PresentationRpcResponse<string | DescriptorJSON | undefined> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n // TODO: add paged version of this (#387280)\n public async getNodePaths(_token: IModelRpcProps, _options: FilterByInstancePathsHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElement[]> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n // TODO: add paged version of this (#387280)\n public async getFilteredNodePaths(_token: IModelRpcProps, _options: FilterByTextHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElement[]> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getContentSources(_token: IModelRpcProps, _options: ContentSourcesRpcRequestOptions): PresentationRpcResponse<ContentSourcesRpcResult> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getContentDescriptor(_token: IModelRpcProps, _options: ContentDescriptorRpcRequestOptions): PresentationRpcResponse<DescriptorJSON | undefined> {\n const response: PresentationRpcResponseData<string | undefined> = await this.forward(arguments);\n return {\n ...response,\n ...(response.result ? { result: JSON.parse(response.result) } : {}),\n };\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getContentSetSize(_token: IModelRpcProps, _options: ContentRpcRequestOptions): PresentationRpcResponse<number> {\n return this.forward(arguments);\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getPagedContent(\n _token: IModelRpcProps,\n _options: Paged<ContentRpcRequestOptions>,\n ): PresentationRpcResponse<{ descriptor: DescriptorJSON; contentSet: PagedResponse<ItemJSON> } | undefined> {\n const rpcResponse = await this.forward(arguments);\n return {\n ...rpcResponse,\n ...(rpcResponse.result\n ? /* c8 ignore next */ { result: { ...rpcResponse.result, contentSet: deepReplaceNullsToUndefined(rpcResponse.result.contentSet) } }\n : {}),\n };\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getPagedContentSet(_token: IModelRpcProps, _options: Paged<ContentRpcRequestOptions>): PresentationRpcResponse<PagedResponse<ItemJSON>> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getElementProperties(\n _token: IModelRpcProps,\n _options: SingleElementPropertiesRpcRequestOptions,\n ): PresentationRpcResponse<ElementProperties | undefined> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getPagedDistinctValues(\n _token: IModelRpcProps,\n _options: DistinctValuesRpcRequestOptions,\n ): PresentationRpcResponse<PagedResponse<DisplayValueGroup>> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getContentInstanceKeys(\n _token: IModelRpcProps,\n _options: ContentInstanceKeysRpcRequestOptions,\n ): PresentationRpcResponse<{ total: number; items: KeySetJSON }> {\n return this.forward(arguments);\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getDisplayLabelDefinition(_token: IModelRpcProps, _options: DisplayLabelRpcRequestOptions): PresentationRpcResponse<LabelDefinition> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getPagedDisplayLabelDefinitions(\n _token: IModelRpcProps,\n _options: DisplayLabelsRpcRequestOptions,\n ): PresentationRpcResponse<PagedResponse<LabelDefinition>> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getSelectionScopes(_token: IModelRpcProps, _options: SelectionScopeRpcRequestOptions): PresentationRpcResponse<SelectionScope[]> {\n return this.forward(arguments);\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async computeSelection(_token: IModelRpcProps, _options: ComputeSelectionRpcRequestOptions): PresentationRpcResponse<KeySetJSON> {\n return this.forward(arguments);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegisteredRuleset.js","sourceRoot":"","sources":["../../../src/presentation-common/RegisteredRuleset.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAMH;;;GAGG;AACH,MAAa,iBAAiB;IACpB,QAAQ,CAAU;IAClB,iBAAiB,CAAS;IAC1B,YAAY,CAAuC;IAE3D,kCAAkC;IAClC,YAAmB,OAAgB,EAAE,gBAAwB,EAAE,WAAiD;QAC9G,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;IAED,kCAAkC;IAC3B,CAAC,MAAM,CAAC,OAAO,CAAC;QACrB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,qGAAqG;IACrG,sBAAsB;IACf,OAAO;QACZ,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IACzB,CAAC;IAED,IAAW,gBAAgB;QACzB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IACD,IAAW,EAAE;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC1B,CAAC;IACD,IAAW,mBAAmB;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IAC3C,CAAC;IACD,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC7B,CAAC;IACD,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,CAAC;IACM,MAAM;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAzCD,8CAyCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"RegisteredRuleset.js","sourceRoot":"","sources":["../../../src/presentation-common/RegisteredRuleset.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAMH;;;GAGG;AACH,MAAa,iBAAiB;IACpB,QAAQ,CAAU;IAClB,iBAAiB,CAAS;IAC1B,YAAY,CAAuC;IAE3D,kCAAkC;IAClC,YAAmB,OAAgB,EAAE,gBAAwB,EAAE,WAAiD;QAC9G,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;IAED,kCAAkC;IAC3B,CAAC,MAAM,CAAC,OAAO,CAAC;QACrB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,qGAAqG;IACrG,sBAAsB;IACf,OAAO;QACZ,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IACzB,CAAC;IAED,IAAW,gBAAgB;QACzB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IACD,IAAW,EAAE;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC1B,CAAC;IACD,IAAW,mBAAmB;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IAC3C,CAAC;IACD,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC7B,CAAC;IACD,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,CAAC;IACM,MAAM;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAzCD,8CAyCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { Rule } from \"./rules/Rule.js\";\nimport { Ruleset, SupplementationInfo } from \"./rules/Ruleset.js\";\nimport { VariablesGroup } from \"./rules/Variables.js\";\n\n/**\n * A ruleset that is registered in a ruleset manager.\n * @public\n */\nexport class RegisteredRuleset implements Disposable, Ruleset {\n private _ruleset: Ruleset;\n private _uniqueIdentifier: string;\n private _disposeFunc: (ruleset: RegisteredRuleset) => void;\n\n /** Create a registered ruleset */\n public constructor(ruleset: Ruleset, uniqueIdentifier: string, disposeFunc: (ruleset: RegisteredRuleset) => void) {\n this._disposeFunc = disposeFunc;\n this._ruleset = ruleset;\n this._uniqueIdentifier = uniqueIdentifier;\n }\n\n /** Dispose registered ruleset. */\n public [Symbol.dispose]() {\n this._disposeFunc(this);\n }\n\n /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */\n /* c8 ignore next 3 */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n public get uniqueIdentifier() {\n return this._uniqueIdentifier;\n }\n public get id(): string {\n return this._ruleset.id;\n }\n public get supplementationInfo(): SupplementationInfo | undefined {\n return this._ruleset.supplementationInfo;\n }\n public get rules(): Rule[] {\n return this._ruleset.rules;\n }\n public get vars(): VariablesGroup[] | undefined {\n return this._ruleset.vars;\n }\n public toJSON(): Ruleset {\n return this._ruleset;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-common/RpcRequestsHandler.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAAqD;AACrD;;GAEG;;;AAEH,sDAAmD;AACnD,oDAA4E;AAC5E,uEAA6E;AAK7E,yCAAmE;AAuBnE,+EAA0J;AAI1J,yCAA4E;AAI5E;;;GAGG;AACH,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAmB7D;;;;;;GAMG;AACH,MAAa,kBAAkB;IAC7B,sHAAsH;IACtG,OAAO,CAAS;IAEhC,kDAAkD;IAClC,QAAQ,CAAS;IAEjC,YAAmB,KAA+B;QAChD,IAAI,CAAC,QAAQ,GAAG,KAAK,EAAE,QAAQ,IAAI,mBAAI,CAAC,WAAW,EAAE,CAAC;QACtD,IAAI,CAAC,OAAO,GAAG,KAAK,EAAE,OAAO,IAAI,uBAAuB,CAAC;IAC3D,CAAC;IAED,gEAAgE;IAChE,IAAY,SAAS;QACnB,OAAO,wBAAU,CAAC,qBAAqB,CAAC,sDAAwB,CAAC,CAAC;IACpE,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAU,IAA4C,EAAE,kBAA6C;QACnI,MAAM,kBAAkB,GAAG,IAAI,EAAE,CAAC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B,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC;IACjH,CAAC;CAEF;AAlKD,gDAkKC;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,qBAAM,CAAC,UAAU,CACf,0DAAgC,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/* eslint-disable @typescript-eslint/no-deprecated */\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.js\";\r\nimport { DescriptorJSON, DescriptorOverrides } from \"./content/Descriptor.js\";\r\nimport { ItemJSON } from \"./content/Item.js\";\r\nimport { ClientDiagnostics, ClientDiagnosticsAttribute, ClientDiagnosticsHandler } from \"./Diagnostics.js\";\r\nimport { InstanceKey } from \"./EC.js\";\r\nimport { PresentationError, PresentationStatus } from \"./Error.js\";\r\nimport { NodeKey } from \"./hierarchy/Key.js\";\r\nimport { Node } from \"./hierarchy/Node.js\";\r\nimport { KeySetJSON } from \"./KeySet.js\";\r\nimport { LabelDefinition } from \"./LabelDefinition.js\";\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.js\";\r\nimport { ContentSourcesRpcResult, PresentationRpcInterface, PresentationRpcRequestOptions, PresentationRpcResponse } from \"./PresentationRpcInterface.js\";\r\nimport { Ruleset } from \"./rules/Ruleset.js\";\r\nimport { RulesetVariableJSON } from \"./RulesetVariables.js\";\r\nimport { SelectionScope } from \"./selection/SelectionScope.js\";\r\nimport { createCancellableTimeoutPromise, PagedResponse } from \"./Utils.js\";\r\nimport { NodePathElement } from \"./hierarchy/NodePathElement.js\";\r\nimport { DisplayValueGroup } from \"./content/Value.js\";\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 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 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 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 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 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 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 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 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 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 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 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 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 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 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"]}
|
|
1
|
+
{"version":3,"file":"RpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-common/RpcRequestsHandler.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAAqD;AACrD;;GAEG;;;AAEH,sDAAmD;AACnD,oDAA4E;AAC5E,uEAA6E;AAK7E,yCAAmE;AAuBnE,+EAA0J;AAI1J,yCAA4E;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,KAAK,SAAS,EAAE,CAAC;gBAC9B,OAAQ,gBAAwB,CAAC,WAAW,CAAC,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACN,qBAAM,CAAC,UAAU,CACf,0DAAgC,CAAC,OAAO,EACxC,qDAAqD,WAAW,2DAA2D,CAC5H,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/* eslint-disable @typescript-eslint/no-deprecated */\n/** @packageDocumentation\n * @module RPC\n */\n\nimport { Guid, Logger } from \"@itwin/core-bentley\";\nimport { IModelRpcProps, RpcManager, RpcRequest } from \"@itwin/core-common\";\nimport { PresentationCommonLoggerCategory } from \"./CommonLoggerCategory.js\";\nimport { DescriptorJSON, DescriptorOverrides } from \"./content/Descriptor.js\";\nimport { ItemJSON } from \"./content/Item.js\";\nimport { ClientDiagnostics, ClientDiagnosticsAttribute, ClientDiagnosticsHandler } from \"./Diagnostics.js\";\nimport { InstanceKey } from \"./EC.js\";\nimport { PresentationError, PresentationStatus } from \"./Error.js\";\nimport { NodeKey } from \"./hierarchy/Key.js\";\nimport { Node } from \"./hierarchy/Node.js\";\nimport { KeySetJSON } from \"./KeySet.js\";\nimport { LabelDefinition } from \"./LabelDefinition.js\";\nimport {\n ComputeSelectionRequestOptions,\n ContentDescriptorRequestOptions,\n ContentInstanceKeysRequestOptions,\n ContentRequestOptions,\n ContentSourcesRequestOptions,\n DisplayLabelRequestOptions,\n DisplayLabelsRequestOptions,\n DistinctValuesRequestOptions,\n FilterByInstancePathsHierarchyRequestOptions,\n FilterByTextHierarchyRequestOptions,\n HierarchyLevelDescriptorRequestOptions,\n HierarchyRequestOptions,\n Paged,\n RequestOptions,\n RequestOptionsWithRuleset,\n SelectionScopeRequestOptions,\n} from \"./PresentationManagerOptions.js\";\nimport { ContentSourcesRpcResult, PresentationRpcInterface, PresentationRpcRequestOptions, PresentationRpcResponse } from \"./PresentationRpcInterface.js\";\nimport { Ruleset } from \"./rules/Ruleset.js\";\nimport { RulesetVariableJSON } from \"./RulesetVariables.js\";\nimport { SelectionScope } from \"./selection/SelectionScope.js\";\nimport { createCancellableTimeoutPromise, PagedResponse } from \"./Utils.js\";\nimport { NodePathElement } from \"./hierarchy/NodePathElement.js\";\nimport { DisplayValueGroup } from \"./content/Value.js\";\n\n/**\n * Default timeout for how long we're going to wait for RPC request to be fulfilled before throwing\n * a timeout error.\n */\nconst DEFAULT_REQUEST_TIMEOUT = 10 * 60 * 1000; // 10 minutes\n\n/**\n * Configuration parameters for [[RpcRequestsHandler]].\n *\n * @internal\n */\nexport interface RpcRequestsHandlerProps {\n /**\n * Optional ID used to identify client that requests data. If not specified,\n * the handler creates a unique GUID as a client id.\n * @internal\n */\n clientId?: string;\n\n /** @internal */\n timeout?: number;\n}\n\n/**\n * RPC requests handler that wraps [[PresentationRpcInterface]] and\n * adds handling for cases when backend needs to be synced with client\n * state.\n *\n * @internal\n */\nexport class RpcRequestsHandler {\n /** Timeout for how long the handler going to wait for RPC request to be fulfilled before throwing a timeout error. */\n public readonly timeout: number;\n\n /** ID that identifies this handler as a client */\n public readonly clientId: string;\n\n public constructor(props?: RpcRequestsHandlerProps) {\n this.clientId = props?.clientId ?? Guid.createValue();\n this.timeout = props?.timeout ?? DEFAULT_REQUEST_TIMEOUT;\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private get rpcClient(): PresentationRpcInterface {\n return RpcManager.getClientForInterface(PresentationRpcInterface);\n }\n\n private async requestWithTimeout<TResult>(func: () => PresentationRpcResponse<TResult>, diagnosticsHandler?: ClientDiagnosticsHandler): Promise<TResult> {\n const rpcResponsePromise = func();\n const rpcRequest: RpcRequest | undefined = RpcRequest.current(this.rpcClient);\n const timeout = createCancellableTimeoutPromise(this.timeout);\n return Promise.race([\n (async () => {\n let diagnostics: ClientDiagnostics | undefined;\n try {\n const response = await rpcResponsePromise;\n diagnostics = response.diagnostics;\n switch (response.statusCode) {\n case PresentationStatus.Success:\n return response.result!;\n default:\n throw new PresentationError(response.statusCode, response.errorMessage);\n }\n } finally {\n diagnosticsHandler && diagnostics && diagnosticsHandler(diagnostics);\n }\n })(),\n timeout.promise.then(() => {\n throw new Error(`Processing the request took longer than the configured limit of ${this.timeout} ms`);\n }),\n ]).finally(() => {\n rpcRequest?.cancel();\n timeout.cancel();\n });\n }\n\n /**\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\n * then, we'll throw an error.\n */\n public async request<TResult, TOptions extends RequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute, TArg = any>(\n func: (token: IModelRpcProps, options: PresentationRpcRequestOptions<TOptions>, ...args: TArg[]) => PresentationRpcResponse<TResult>,\n options: TOptions,\n ...additionalOptions: TArg[]\n ): Promise<TResult> {\n const { imodel, diagnostics, ...optionsNoIModel } = options;\n const { handler: diagnosticsHandler, ...diagnosticsOptions } = diagnostics ?? {};\n if (isOptionsWithRuleset(optionsNoIModel)) {\n optionsNoIModel.rulesetOrId = cleanupRuleset(optionsNoIModel.rulesetOrId);\n }\n const rpcOptions: PresentationRpcRequestOptions<TOptions> = {\n ...optionsNoIModel,\n clientId: this.clientId,\n };\n if (diagnostics) {\n rpcOptions.diagnostics = diagnosticsOptions;\n }\n const doRequest = async () => func(imodel, rpcOptions, ...additionalOptions);\n const result = await this.requestWithTimeout(doRequest, diagnosticsHandler);\n return result;\n }\n\n public async getNodesCount(options: HierarchyRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<number> {\n return this.request<number, typeof options>(this.rpcClient.getNodesCount.bind(this.rpcClient), options);\n }\n\n public async getPagedNodes(\n options: Paged<HierarchyRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON>> & ClientDiagnosticsAttribute,\n ): Promise<PagedResponse<Node>> {\n return this.request<PagedResponse<Node>, typeof options>(this.rpcClient.getPagedNodes.bind(this.rpcClient), options);\n }\n\n public async getNodesDescriptor(\n options: HierarchyLevelDescriptorRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON> & ClientDiagnosticsAttribute,\n ): Promise<DescriptorJSON | undefined> {\n const response = await this.request<string | DescriptorJSON | undefined, typeof options>(this.rpcClient.getNodesDescriptor.bind(this.rpcClient), options);\n if (typeof response === \"string\") {\n return JSON.parse(response);\n }\n return response;\n }\n\n public async getNodePaths(\n options: FilterByInstancePathsHierarchyRequestOptions<IModelRpcProps, RulesetVariableJSON> & ClientDiagnosticsAttribute,\n ): Promise<NodePathElement[]> {\n return this.request<NodePathElement[], typeof options>(this.rpcClient.getNodePaths.bind(this.rpcClient), options);\n }\n\n public async getFilteredNodePaths(\n options: FilterByTextHierarchyRequestOptions<IModelRpcProps, RulesetVariableJSON> & ClientDiagnosticsAttribute,\n ): Promise<NodePathElement[]> {\n return this.request<NodePathElement[], typeof options>(this.rpcClient.getFilteredNodePaths.bind(this.rpcClient), options);\n }\n\n public async getContentSources(options: ContentSourcesRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<ContentSourcesRpcResult> {\n return this.request<ContentSourcesRpcResult, typeof options>(this.rpcClient.getContentSources.bind(this.rpcClient), options);\n }\n public async getContentDescriptor(\n options: ContentDescriptorRequestOptions<IModelRpcProps, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\n ): Promise<DescriptorJSON | undefined> {\n return this.request<DescriptorJSON | undefined, typeof options>(this.rpcClient.getContentDescriptor.bind(this.rpcClient), options);\n }\n public async getContentSetSize(\n options: ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\n ): Promise<number> {\n return this.request<number, typeof options>(this.rpcClient.getContentSetSize.bind(this.rpcClient), options);\n }\n public async getPagedContent(\n options: Paged<ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute>,\n ) {\n return this.request<{ descriptor: DescriptorJSON; contentSet: PagedResponse<ItemJSON> } | undefined, typeof options>(\n this.rpcClient.getPagedContent.bind(this.rpcClient),\n options,\n );\n }\n public async getPagedContentSet(\n options: Paged<ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute>,\n ) {\n return this.request<PagedResponse<ItemJSON>, typeof options>(this.rpcClient.getPagedContentSet.bind(this.rpcClient), options);\n }\n\n public async getPagedDistinctValues(\n options: DistinctValuesRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\n ): Promise<PagedResponse<DisplayValueGroup>> {\n return this.request<PagedResponse<DisplayValueGroup>, typeof options>(this.rpcClient.getPagedDistinctValues.bind(this.rpcClient), options);\n }\n\n public async getContentInstanceKeys(\n options: ContentInstanceKeysRequestOptions<IModelRpcProps, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\n ): Promise<{ total: number; items: KeySetJSON }> {\n return this.request<{ total: number; items: KeySetJSON }, typeof options>(this.rpcClient.getContentInstanceKeys.bind(this.rpcClient), options);\n }\n\n public async getDisplayLabelDefinition(\n options: DisplayLabelRequestOptions<IModelRpcProps, InstanceKey> & ClientDiagnosticsAttribute,\n ): Promise<LabelDefinition> {\n return this.request<LabelDefinition, typeof options>(this.rpcClient.getDisplayLabelDefinition.bind(this.rpcClient), options);\n }\n public async getPagedDisplayLabelDefinitions(\n options: DisplayLabelsRequestOptions<IModelRpcProps, InstanceKey> & ClientDiagnosticsAttribute,\n ): Promise<PagedResponse<LabelDefinition>> {\n return this.request<PagedResponse<LabelDefinition>, typeof options>(this.rpcClient.getPagedDisplayLabelDefinitions.bind(this.rpcClient), options);\n }\n\n /* eslint-disable @typescript-eslint/no-deprecated */\n public async getSelectionScopes(options: SelectionScopeRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<SelectionScope[]> {\n return this.request<SelectionScope[], typeof options>(this.rpcClient.getSelectionScopes.bind(this.rpcClient), options);\n }\n public async computeSelection(options: ComputeSelectionRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<KeySetJSON> {\n return this.request<KeySetJSON, typeof options>(this.rpcClient.computeSelection.bind(this.rpcClient), options);\n }\n /* eslint-enable @typescript-eslint/no-deprecated */\n}\n\nfunction isOptionsWithRuleset(options: object): options is { rulesetOrId: Ruleset } {\n return typeof (options as RequestOptionsWithRuleset<any, any>).rulesetOrId === \"object\";\n}\n\ntype RulesetWithRequiredProperties = {\n [key in keyof Ruleset]-?: true;\n};\n\nconst RULESET_SUPPORTED_PROPERTIES_OBJ: RulesetWithRequiredProperties = {\n id: true,\n rules: true,\n version: true,\n requiredSchemas: true,\n supplementationInfo: true,\n vars: true,\n};\n\nfunction cleanupRuleset(ruleset: Ruleset): Ruleset {\n const cleanedUpRuleset: Ruleset = { ...ruleset };\n\n for (const propertyKey of Object.keys(cleanedUpRuleset)) {\n if (!RULESET_SUPPORTED_PROPERTIES_OBJ.hasOwnProperty(propertyKey)) {\n if (propertyKey === \"$schema\") {\n delete (cleanedUpRuleset as any)[propertyKey];\n } else {\n Logger.logWarning(\n PresentationCommonLoggerCategory.Package,\n `Provided ruleset contains unrecognized attribute '${propertyKey}'. It either doesn't exist or may be no longer supported.`,\n );\n }\n }\n }\n\n return cleanedUpRuleset;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RulesetVariables.js","sourceRoot":"","sources":["../../../src/presentation-common/RulesetVariables.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAAoE;AAEpE;;;GAGG;AACH,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,CAAA;AACtB,CAAC,EAlBW,kBAAkB,kCAAlB,kBAAkB,QAkB7B;AAiHD,cAAc;AACd,2DAA2D;AAC3D,IAAiB,eAAe,CAsB/B;AAtBD,WAAiB,eAAe;IAC9B;;;OAGG;IACH,SAAgB,MAAM,CAAC,QAAyB;QAC9C,IAAI,QAAQ,CAAC,IAAI,KAAK,kBAAkB,CAAC,SAAS,EAAE,CAAC;YACnD,OAAO,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,gCAAiB,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACjF,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IALe,sBAAM,SAKrB,CAAA;IAED,iDAAiD;IACjD,SAAgB,QAAQ,CAAC,IAAyB;QAChD,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAkB,CAAC,SAAS,EAAE,CAAC;YAC/C,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACnC,OAAO,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,gCAAiB,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3E,CAAC;YACD,OAAO,IAAW,CAAC,CAAC,kFAAkF;QACxG,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IARe,wBAAQ,WAQvB,CAAA;AACH,CAAC,EAtBgB,eAAe,+BAAf,eAAe,QAsB/B","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"RulesetVariables.js","sourceRoot":"","sources":["../../../src/presentation-common/RulesetVariables.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAAoE;AAEpE;;;GAGG;AACH,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,CAAA;AACtB,CAAC,EAlBW,kBAAkB,kCAAlB,kBAAkB,QAkB7B;AAiHD,cAAc;AACd,2DAA2D;AAC3D,IAAiB,eAAe,CAsB/B;AAtBD,WAAiB,eAAe;IAC9B;;;OAGG;IACH,SAAgB,MAAM,CAAC,QAAyB;QAC9C,IAAI,QAAQ,CAAC,IAAI,KAAK,kBAAkB,CAAC,SAAS,EAAE,CAAC;YACnD,OAAO,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,gCAAiB,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACjF,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IALe,sBAAM,SAKrB,CAAA;IAED,iDAAiD;IACjD,SAAgB,QAAQ,CAAC,IAAyB;QAChD,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAkB,CAAC,SAAS,EAAE,CAAC;YAC/C,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACnC,OAAO,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,gCAAiB,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3E,CAAC;YACD,OAAO,IAAW,CAAC,CAAC,kFAAkF;QACxG,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IARe,wBAAQ,WAQvB,CAAA;AACH,CAAC,EAtBgB,eAAe,+BAAf,eAAe,QAsB/B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { CompressedId64Set, Id64String } from \"@itwin/core-bentley\";\n\n/**\n * Possible variable value types\n * @public\n */\nexport enum VariableValueTypes {\n /** Integer value */\n Int = \"int\",\n\n /** Array of integer values */\n IntArray = \"int[]\",\n\n /** Boolean value */\n Bool = \"bool\",\n\n /** String value */\n String = \"string\",\n\n /** Id64String value */\n Id64 = \"id64\",\n\n /** Array of Id64String values */\n Id64Array = \"id64[]\",\n}\n\n/**\n * Union of all supported variable value types\n * @public\n */\nexport type VariableValue = boolean | string | number | number[] | Id64String | Id64String[];\n\n/**\n * JSON representation of [[VariableValue]]\n * @public\n */\nexport type VariableValueJSON = boolean | string | number | number[] | Id64String | Id64String[] | CompressedId64Set;\n\n/**\n * Base data structure for representing ruleset variables.\n * @public\n */\nexport interface RulesetVariableBase {\n id: string;\n type: VariableValueTypes;\n value: VariableValue;\n}\n/**\n * Data structure for representing boolean ruleset variables.\n * @public\n */\nexport interface BooleanRulesetVariable extends RulesetVariableBase {\n type: VariableValueTypes.Bool;\n value: boolean;\n}\n/**\n * Data structure for representing string ruleset variables.\n * @public\n */\nexport interface StringRulesetVariable extends RulesetVariableBase {\n type: VariableValueTypes.String;\n value: string;\n}\n/**\n * Data structure for representing int ruleset variables.\n * @public\n */\nexport interface IntRulesetVariable extends RulesetVariableBase {\n type: VariableValueTypes.Int;\n value: number;\n}\n/**\n * Data structure for representing int array ruleset variables.\n * @public\n */\nexport interface IntsRulesetVariable extends RulesetVariableBase {\n type: VariableValueTypes.IntArray;\n value: number[];\n}\n/**\n * Data structure for representing ID ruleset variables.\n * @public\n */\nexport interface Id64RulesetVariable extends RulesetVariableBase {\n type: VariableValueTypes.Id64;\n value: Id64String;\n}\n/**\n * Data structure for representing ID array ruleset variables.\n * @public\n */\nexport interface Id64sRulesetVariable extends RulesetVariableBase {\n type: VariableValueTypes.Id64Array;\n value: Id64String[];\n}\n/**\n * Data structure for representing ruleset variables.\n * @public\n */\nexport type RulesetVariable =\n | BooleanRulesetVariable\n | StringRulesetVariable\n | IntRulesetVariable\n | IntsRulesetVariable\n | Id64RulesetVariable\n | Id64sRulesetVariable;\n\n/**\n * JSON representation of [[RulesetVariableBase]].\n * @public\n */\nexport interface RulesetVariableBaseJSON {\n id: string;\n type: VariableValueTypes;\n value: VariableValueJSON;\n}\n/**\n * JSON representation of [[Id64sRulesetVariable]].\n * @public\n */\nexport interface Id64sRulesetVariableJSON extends RulesetVariableBaseJSON {\n type: VariableValueTypes.Id64Array;\n value: Id64String[] | CompressedId64Set;\n}\n/**\n * JSON representation of [[RulesetVariable]].\n * @public\n */\n\nexport type RulesetVariableJSON =\n | BooleanRulesetVariable\n | StringRulesetVariable\n | IntRulesetVariable\n | IntsRulesetVariable\n | Id64RulesetVariable\n | Id64sRulesetVariableJSON;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace RulesetVariable {\n /**\n * Serialize given RulesetVariable to JSON.\n * Note: In case of [[Id64sRulesetVariable]], this method expects IDs are sorted. See [[OrderedId64Iterable.sortArray]].\n */\n export function toJSON(variable: RulesetVariable): RulesetVariableJSON {\n if (variable.type === VariableValueTypes.Id64Array) {\n return { ...variable, value: CompressedId64Set.compressArray(variable.value) };\n }\n return variable;\n }\n\n /** Deserialize [[RulesetVariable]] from JSON. */\n export function fromJSON(json: RulesetVariableJSON): RulesetVariable {\n if (json.type === VariableValueTypes.Id64Array) {\n if (typeof json.value === \"string\") {\n return { ...json, value: CompressedId64Set.decompressArray(json.value) };\n }\n return json as any; // for some reason TS doesn't understand that `json.value` is always an array here\n }\n return json;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RulesetsFactory.js","sourceRoot":"","sources":["../../../src/presentation-common/RulesetsFactory.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA6D;AAG7D,qEAA6F;AAC7F,iDAAyD;AACzD,mCAAmE;AAEnE,qFAAoF;A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,KAAK,CAAC;YACnC,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;YAC7B,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAClB,CAAC;QACD,OAAO,KAAK,GAAG,CAAC,EAAE,CAAC;YACjB,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;YACxB,KAAK,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnC,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 { Guid, Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { Field, PropertiesField } from \"./content/Fields.js\";\r\nimport { Item } from \"./content/Item.js\";\r\nimport { PrimitiveTypeDescription, PropertyValueFormat } from \"./content/TypeDescription.js\";\r\nimport { DisplayValue, Value } from \"./content/Value.js\";\r\nimport { ClassInfo, InstanceKey, RelationshipPath } from \"./EC.js\";\r\nimport { MultiSchemaClassesSpecification, SingleSchemaClassSpecification } from \"./rules/ClassSpecifications.js\";\r\nimport { ContentSpecificationTypes } from \"./rules/content/ContentSpecification.js\";\r\nimport { RelatedInstanceSpecification } from \"./rules/RelatedInstanceSpecification.js\";\r\nimport { RelationshipDirection } from \"./rules/RelationshipDirection.js\";\r\nimport { RuleTypes } from \"./rules/Rule.js\";\r\nimport { Ruleset } from \"./rules/Ruleset.js\";\r\n\r\n/**\r\n * A factory class that can be used to create presentation rulesets targeted towards\r\n * specific use cases.\r\n *\r\n * @public\r\n */\r\nexport class RulesetsFactory {\r\n private createSimilarInstancesRulesetInfo(field: Field, record: Item) {\r\n if (!field.isPropertiesField()) {\r\n throw new Error(\"Can only create 'similar instances' ruleset for properties-based records\");\r\n }\r\n if (field.type.valueFormat !== PropertyValueFormat.Primitive) {\r\n throw new Error(\"Can only create 'similar instances' ruleset for primitive properties\");\r\n }\r\n if (field.properties.length === 0) {\r\n throw new Error(\"Invalid properties' field with no properties\");\r\n }\r\n if (record.isFieldMerged(field.name)) {\r\n throw new Error(\"Can't create 'similar instances' ruleset for merged values\");\r\n }\r\n if (!record.classInfo) {\r\n throw new Error(\"Can't create 'similar instances' for records based on multiple different ECClass instances\");\r\n }\r\n const propertyName = getPropertyName(field);\r\n const propertyValue = getPropertyValue(record, field);\r\n const relatedInstanceInfo = createRelatedInstanceSpecInfo(field);\r\n const relatedClass = relatedInstanceInfo?.class;\r\n const ruleset: Ruleset = {\r\n id: `SimilarInstances/${propertyName}/${Guid.createValue()}`,\r\n rules: [],\r\n };\r\n ruleset.rules.push({\r\n ruleType: RuleTypes.Content,\r\n specifications: [\r\n {\r\n specType: ContentSpecificationTypes.ContentInstancesOfSpecificClasses,\r\n classes: createMultiClassSpecification(record.classInfo),\r\n relatedInstances: relatedInstanceInfo ? [relatedInstanceInfo.spec] : [],\r\n instanceFilter: createInstanceFilter(relatedInstanceInfo?.spec, field.type, propertyName, propertyValue.raw),\r\n },\r\n ],\r\n });\r\n return { ruleset, relatedClass, propertyName, propertyValue };\r\n }\r\n\r\n /**\r\n * Create a ruleset with content rules for getting instances are of the\r\n * same ECClass and have the same property value as the provided `record`.\r\n * @param field A field identifying which property of the record we should use\r\n * @param record A record whose similar instances should be found\r\n * @param computeDisplayValue Optional callback function to calculate display value that's\r\n * used in ruleset's description. If not provided, display value from record is used instead.\r\n */\r\n public async createSimilarInstancesRuleset(\r\n field: Field,\r\n record: Item,\r\n computeDisplayValue?: ComputeDisplayValueCallback,\r\n ): Promise<{ ruleset: Ruleset; description: string }> {\r\n const info = this.createSimilarInstancesRulesetInfo(field, record);\r\n const description = await createDescriptionAsync(record, info.relatedClass, field, info.propertyValue, computeDisplayValue);\r\n return { ruleset: info.ruleset, description };\r\n }\r\n}\r\n\r\n/**\r\n * Definition of a function for calculating a display value.\r\n * @public\r\n */\r\nexport type ComputeDisplayValueCallback = (type: string, value: PrimitivePropertyValue, displayValue: string) => Promise<string>;\r\n\r\ninterface PrimitiveValueDef {\r\n raw: PrimitivePropertyValue;\r\n display: string;\r\n}\r\n\r\n/**\r\n * Value of a primitive property.\r\n * @public\r\n */\r\nexport type PrimitivePropertyValue = string | number | boolean | Point | InstanceKey | undefined;\r\n\r\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\r\ntype Point = { x: number; y: number; z?: number };\r\n\r\nconst toString = (displayValue: string | undefined): string => {\r\n if (!displayValue) {\r\n return \"NULL\";\r\n }\r\n return displayValue.toString();\r\n};\r\n\r\nconst createDescription = (record: Item, relatedClass: ClassInfo | undefined, field: Field, value: string): string => {\r\n const classInfo = relatedClass ?? record.classInfo!;\r\n return `[${classInfo.label}].[${field.label}] = ${value}`;\r\n};\r\n\r\nconst createDescriptionAsync = async (\r\n record: Item,\r\n relatedClass: ClassInfo | undefined,\r\n field: Field,\r\n value: PrimitiveValueDef,\r\n computeDisplayValue?: ComputeDisplayValueCallback,\r\n): Promise<string> => {\r\n const displayValue = computeDisplayValue ? await computeDisplayValue(field.type.typeName, value.raw, value.display) : toString(value.display);\r\n return createDescription(record, relatedClass, field, displayValue);\r\n};\r\n\r\nconst getPropertyName = (field: PropertiesField) => {\r\n let name = field.properties[0].property.name;\r\n if (field.type.typeName === \"navigation\") {\r\n name += \".Id\";\r\n }\r\n return name;\r\n};\r\n\r\nconst isPrimitivePropertyValue = (value: Value): value is PrimitivePropertyValue => {\r\n if (Value.isPrimitive(value)) {\r\n return true;\r\n }\r\n\r\n if (Value.isMap(value)) {\r\n if (typeof value.x === \"number\" && typeof value.y === \"number\" && (value.z === undefined || typeof value.z === \"number\")) {\r\n return true;\r\n }\r\n\r\n if (typeof value.className === \"string\" && typeof value.id === \"string\") {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n};\r\n\r\nconst getPropertyValue = (record: Item, field: Field): PrimitiveValueDef => {\r\n const fieldNamesStack = [];\r\n let currField: Field | undefined = field;\r\n while (currField) {\r\n fieldNamesStack.push(currField.name);\r\n currField = currField.parent;\r\n }\r\n let currFieldName = fieldNamesStack.pop();\r\n let displayValue: DisplayValue = record.displayValues[currFieldName!];\r\n let value: Value = record.values[currFieldName!];\r\n currFieldName = fieldNamesStack.pop();\r\n while (currFieldName) {\r\n if (!Value.isNestedContent(value) || value.length === 0) {\r\n throw new Error(\"Invalid record value\");\r\n }\r\n if (value.length > 1) {\r\n throw new Error(\"Can't create 'similar instances' for records related through many part of *-to-many relationship\");\r\n }\r\n if (value[0].mergedFieldNames.indexOf(currFieldName) !== -1) {\r\n throw new Error(\"Can't create 'similar instances' ruleset for merged values\");\r\n }\r\n displayValue = value[0].displayValues[currFieldName];\r\n value = value[0].values[currFieldName];\r\n currFieldName = fieldNamesStack.pop();\r\n }\r\n if (!isPrimitivePropertyValue(value) || !(typeof displayValue === \"undefined\" || typeof displayValue === \"string\")) {\r\n throw new Error(\"Can only create 'similar instances' ruleset for primitive values\");\r\n }\r\n return { raw: value, display: toString(displayValue) };\r\n};\r\n\r\nconst createInstanceFilter = (\r\n relatedInstanceSpec: Readonly<RelatedInstanceSpecification> | undefined,\r\n propertyType: PrimitiveTypeDescription,\r\n propertyName: string,\r\n propertyValue: PrimitivePropertyValue,\r\n): string => {\r\n const alias = relatedInstanceSpec ? relatedInstanceSpec.alias : \"this\";\r\n return createComparison(propertyType, `${alias}.${propertyName}`, \"=\", propertyValue);\r\n};\r\n\r\ntype Operator = \"=\" | \"!=\" | \">\" | \">=\" | \"<\" | \"<=\";\r\nconst createComparison = (type: PrimitiveTypeDescription, name: string, operator: Operator, value: PrimitivePropertyValue): string => {\r\n let compareValue = \"\";\r\n switch (typeof value) {\r\n case \"undefined\":\r\n compareValue = \"NULL\";\r\n break;\r\n case \"string\":\r\n compareValue = `\"${value.replace(/\"/g, `\"\"`)}\"`;\r\n break;\r\n case \"boolean\":\r\n compareValue = value ? \"TRUE\" : \"FALSE\";\r\n break;\r\n case \"number\":\r\n compareValue = value.toString();\r\n break;\r\n }\r\n\r\n if (type.typeName === \"navigation\" && typeof value === \"object\" && Id64.isId64((value as InstanceKey).id)) {\r\n // note: this is temporary until we support hex ids in instance filters\r\n compareValue = hexToDec((value as InstanceKey).id);\r\n }\r\n\r\n if (type.typeName === \"point2d\" || type.typeName === \"point3d\") {\r\n if (typeof value !== \"object\") {\r\n throw new Error(\"Expecting point values to be supplied as objects\");\r\n }\r\n\r\n const dimensionType: PrimitiveTypeDescription = {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n typeName: \"double\",\r\n };\r\n\r\n const pointValue = value as Point;\r\n let comparison = `${createComparison(dimensionType, `${name}.x`, operator, pointValue.x)}`;\r\n comparison += ` AND ${createComparison(dimensionType, `${name}.y`, operator, pointValue.y)}`;\r\n if (type.typeName === \"point3d\" && pointValue.z !== undefined) {\r\n comparison += ` AND ${createComparison(dimensionType, `${name}.z`, operator, pointValue.z)}`;\r\n }\r\n\r\n return comparison;\r\n }\r\n\r\n if (type.typeName === \"double\") {\r\n return `CompareDoubles(${name}, ${compareValue}) ${operator} 0`;\r\n }\r\n\r\n if (type.typeName === \"dateTime\") {\r\n return `CompareDateTimes(${name}, ${compareValue}) ${operator} 0`;\r\n }\r\n\r\n return `${name} ${operator} ${compareValue}`;\r\n};\r\n\r\nconst createMultiClassSpecification = (classInfo: Readonly<ClassInfo>): MultiSchemaClassesSpecification => {\r\n const [schemaName, className] = classInfo.name.split(\":\");\r\n return { schemaName, classNames: [className], arePolymorphic: true };\r\n};\r\n\r\nconst createSingleClassSpecification = (classInfo: Readonly<ClassInfo>): SingleSchemaClassSpecification => {\r\n const [schemaName, className] = classInfo.name.split(\":\");\r\n return { schemaName, className };\r\n};\r\n\r\nconst createRelatedInstanceSpec = (\r\n pathFromSelectToPropertyClass: RelationshipPath,\r\n index: number,\r\n): { spec: RelatedInstanceSpecification; class: ClassInfo } => ({\r\n spec: {\r\n relationshipPath: pathFromSelectToPropertyClass.map((step) => ({\r\n relationship: createSingleClassSpecification(step.relationshipInfo),\r\n direction: step.isForwardRelationship ? RelationshipDirection.Forward : RelationshipDirection.Backward,\r\n targetClass: createSingleClassSpecification(step.targetClassInfo),\r\n })),\r\n isRequired: true,\r\n alias: `related_${index}`,\r\n },\r\n class: pathFromSelectToPropertyClass[pathFromSelectToPropertyClass.length - 1].targetClassInfo,\r\n});\r\n\r\nconst createPathFromSelectToPropertyClass = (field: PropertiesField): RelationshipPath => {\r\n let currField: Field = field;\r\n const pathFromPropertyToSelectClass: RelationshipPath = [];\r\n while (currField.parent) {\r\n pathFromPropertyToSelectClass.push(...currField.parent.pathToPrimaryClass);\r\n currField = currField.parent;\r\n }\r\n return RelationshipPath.reverse(pathFromPropertyToSelectClass);\r\n};\r\n\r\nconst createRelatedInstanceSpecInfo = (field: PropertiesField): { spec: RelatedInstanceSpecification; class: ClassInfo } | undefined => {\r\n const path = createPathFromSelectToPropertyClass(field);\r\n return path.length ? createRelatedInstanceSpec(path, 0) : undefined;\r\n};\r\n\r\nconst hexToDec = (id: Id64String) => {\r\n const digits = [0];\r\n for (let i = 2; i < id.length; ++i) {\r\n let carry = parseInt(id.charAt(i), 16);\r\n for (let j = 0; j < digits.length; ++j) {\r\n digits[j] = digits[j] * 16 + carry;\r\n carry = (digits[j] / 10) | 0;\r\n digits[j] %= 10;\r\n }\r\n while (carry > 0) {\r\n digits.push(carry % 10);\r\n carry = (carry / 10) | 0;\r\n }\r\n }\r\n return digits.reverse().join(\"\");\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"RulesetsFactory.js","sourceRoot":"","sources":["../../../src/presentation-common/RulesetsFactory.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA6D;AA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,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;YACnC,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;YAC7B,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAClB,CAAC;QACD,OAAO,KAAK,GAAG,CAAC,EAAE,CAAC;YACjB,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;YACxB,KAAK,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { Guid, Id64, Id64String } from \"@itwin/core-bentley\";\nimport { Field, PropertiesField } from \"./content/Fields.js\";\nimport { Item } from \"./content/Item.js\";\nimport { PrimitiveTypeDescription, PropertyValueFormat } from \"./content/TypeDescription.js\";\nimport { DisplayValue, Value } from \"./content/Value.js\";\nimport { ClassInfo, InstanceKey, RelationshipPath } from \"./EC.js\";\nimport { MultiSchemaClassesSpecification, SingleSchemaClassSpecification } from \"./rules/ClassSpecifications.js\";\nimport { ContentSpecificationTypes } from \"./rules/content/ContentSpecification.js\";\nimport { RelatedInstanceSpecification } from \"./rules/RelatedInstanceSpecification.js\";\nimport { RelationshipDirection } from \"./rules/RelationshipDirection.js\";\nimport { RuleTypes } from \"./rules/Rule.js\";\nimport { Ruleset } from \"./rules/Ruleset.js\";\n\n/**\n * A factory class that can be used to create presentation rulesets targeted towards\n * specific use cases.\n *\n * @public\n */\nexport class RulesetsFactory {\n private createSimilarInstancesRulesetInfo(field: Field, record: Item) {\n if (!field.isPropertiesField()) {\n throw new Error(\"Can only create 'similar instances' ruleset for properties-based records\");\n }\n if (field.type.valueFormat !== PropertyValueFormat.Primitive) {\n throw new Error(\"Can only create 'similar instances' ruleset for primitive properties\");\n }\n if (field.properties.length === 0) {\n throw new Error(\"Invalid properties' field with no properties\");\n }\n if (record.isFieldMerged(field.name)) {\n throw new Error(\"Can't create 'similar instances' ruleset for merged values\");\n }\n if (!record.classInfo) {\n throw new Error(\"Can't create 'similar instances' for records based on multiple different ECClass instances\");\n }\n const propertyName = getPropertyName(field);\n const propertyValue = getPropertyValue(record, field);\n const relatedInstanceInfo = createRelatedInstanceSpecInfo(field);\n const relatedClass = relatedInstanceInfo?.class;\n const ruleset: Ruleset = {\n id: `SimilarInstances/${propertyName}/${Guid.createValue()}`,\n rules: [],\n };\n ruleset.rules.push({\n ruleType: RuleTypes.Content,\n specifications: [\n {\n specType: ContentSpecificationTypes.ContentInstancesOfSpecificClasses,\n classes: createMultiClassSpecification(record.classInfo),\n relatedInstances: relatedInstanceInfo ? [relatedInstanceInfo.spec] : [],\n instanceFilter: createInstanceFilter(relatedInstanceInfo?.spec, field.type, propertyName, propertyValue.raw),\n },\n ],\n });\n return { ruleset, relatedClass, propertyName, propertyValue };\n }\n\n /**\n * Create a ruleset with content rules for getting instances are of the\n * same ECClass and have the same property value as the provided `record`.\n * @param field A field identifying which property of the record we should use\n * @param record A record whose similar instances should be found\n * @param computeDisplayValue Optional callback function to calculate display value that's\n * used in ruleset's description. If not provided, display value from record is used instead.\n */\n public async createSimilarInstancesRuleset(\n field: Field,\n record: Item,\n computeDisplayValue?: ComputeDisplayValueCallback,\n ): Promise<{ ruleset: Ruleset; description: string }> {\n const info = this.createSimilarInstancesRulesetInfo(field, record);\n const description = await createDescriptionAsync(record, info.relatedClass, field, info.propertyValue, computeDisplayValue);\n return { ruleset: info.ruleset, description };\n }\n}\n\n/**\n * Definition of a function for calculating a display value.\n * @public\n */\nexport type ComputeDisplayValueCallback = (type: string, value: PrimitivePropertyValue, displayValue: string) => Promise<string>;\n\ninterface PrimitiveValueDef {\n raw: PrimitivePropertyValue;\n display: string;\n}\n\n/**\n * Value of a primitive property.\n * @public\n */\nexport type PrimitivePropertyValue = string | number | boolean | Point | InstanceKey | undefined;\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\ntype Point = { x: number; y: number; z?: number };\n\nconst toString = (displayValue: string | undefined): string => {\n if (!displayValue) {\n return \"NULL\";\n }\n return displayValue.toString();\n};\n\nconst createDescription = (record: Item, relatedClass: ClassInfo | undefined, field: Field, value: string): string => {\n const classInfo = relatedClass ?? record.classInfo!;\n return `[${classInfo.label}].[${field.label}] = ${value}`;\n};\n\nconst createDescriptionAsync = async (\n record: Item,\n relatedClass: ClassInfo | undefined,\n field: Field,\n value: PrimitiveValueDef,\n computeDisplayValue?: ComputeDisplayValueCallback,\n): Promise<string> => {\n const displayValue = computeDisplayValue ? await computeDisplayValue(field.type.typeName, value.raw, value.display) : toString(value.display);\n return createDescription(record, relatedClass, field, displayValue);\n};\n\nconst getPropertyName = (field: PropertiesField) => {\n let name = field.properties[0].property.name;\n if (field.type.typeName === \"navigation\") {\n name += \".Id\";\n }\n return name;\n};\n\nconst isPrimitivePropertyValue = (value: Value): value is PrimitivePropertyValue => {\n if (Value.isPrimitive(value)) {\n return true;\n }\n\n if (Value.isMap(value)) {\n if (typeof value.x === \"number\" && typeof value.y === \"number\" && (value.z === undefined || typeof value.z === \"number\")) {\n return true;\n }\n\n if (typeof value.className === \"string\" && typeof value.id === \"string\") {\n return true;\n }\n }\n\n return false;\n};\n\nconst getPropertyValue = (record: Item, field: Field): PrimitiveValueDef => {\n const fieldNamesStack = [];\n let currField: Field | undefined = field;\n while (currField) {\n fieldNamesStack.push(currField.name);\n currField = currField.parent;\n }\n let currFieldName = fieldNamesStack.pop();\n let displayValue: DisplayValue = record.displayValues[currFieldName!];\n let value: Value = record.values[currFieldName!];\n currFieldName = fieldNamesStack.pop();\n while (currFieldName) {\n if (!Value.isNestedContent(value) || value.length === 0) {\n throw new Error(\"Invalid record value\");\n }\n if (value.length > 1) {\n throw new Error(\"Can't create 'similar instances' for records related through many part of *-to-many relationship\");\n }\n if (value[0].mergedFieldNames.indexOf(currFieldName) !== -1) {\n throw new Error(\"Can't create 'similar instances' ruleset for merged values\");\n }\n displayValue = value[0].displayValues[currFieldName];\n value = value[0].values[currFieldName];\n currFieldName = fieldNamesStack.pop();\n }\n if (!isPrimitivePropertyValue(value) || !(typeof displayValue === \"undefined\" || typeof displayValue === \"string\")) {\n throw new Error(\"Can only create 'similar instances' ruleset for primitive values\");\n }\n return { raw: value, display: toString(displayValue) };\n};\n\nconst createInstanceFilter = (\n relatedInstanceSpec: Readonly<RelatedInstanceSpecification> | undefined,\n propertyType: PrimitiveTypeDescription,\n propertyName: string,\n propertyValue: PrimitivePropertyValue,\n): string => {\n const alias = relatedInstanceSpec ? relatedInstanceSpec.alias : \"this\";\n return createComparison(propertyType, `${alias}.${propertyName}`, \"=\", propertyValue);\n};\n\ntype Operator = \"=\" | \"!=\" | \">\" | \">=\" | \"<\" | \"<=\";\nconst createComparison = (type: PrimitiveTypeDescription, name: string, operator: Operator, value: PrimitivePropertyValue): string => {\n let compareValue = \"\";\n switch (typeof value) {\n case \"undefined\":\n compareValue = \"NULL\";\n break;\n case \"string\":\n compareValue = `\"${value.replace(/\"/g, `\"\"`)}\"`;\n break;\n case \"boolean\":\n compareValue = value ? \"TRUE\" : \"FALSE\";\n break;\n case \"number\":\n compareValue = value.toString();\n break;\n }\n\n if (type.typeName === \"navigation\" && typeof value === \"object\" && Id64.isId64((value as InstanceKey).id)) {\n // note: this is temporary until we support hex ids in instance filters\n compareValue = hexToDec((value as InstanceKey).id);\n }\n\n if (type.typeName === \"point2d\" || type.typeName === \"point3d\") {\n if (typeof value !== \"object\") {\n throw new Error(\"Expecting point values to be supplied as objects\");\n }\n\n const dimensionType: PrimitiveTypeDescription = {\n valueFormat: PropertyValueFormat.Primitive,\n typeName: \"double\",\n };\n\n const pointValue = value as Point;\n let comparison = `${createComparison(dimensionType, `${name}.x`, operator, pointValue.x)}`;\n comparison += ` AND ${createComparison(dimensionType, `${name}.y`, operator, pointValue.y)}`;\n if (type.typeName === \"point3d\" && pointValue.z !== undefined) {\n comparison += ` AND ${createComparison(dimensionType, `${name}.z`, operator, pointValue.z)}`;\n }\n\n return comparison;\n }\n\n if (type.typeName === \"double\") {\n return `CompareDoubles(${name}, ${compareValue}) ${operator} 0`;\n }\n\n if (type.typeName === \"dateTime\") {\n return `CompareDateTimes(${name}, ${compareValue}) ${operator} 0`;\n }\n\n return `${name} ${operator} ${compareValue}`;\n};\n\nconst createMultiClassSpecification = (classInfo: Readonly<ClassInfo>): MultiSchemaClassesSpecification => {\n const [schemaName, className] = classInfo.name.split(\":\");\n return { schemaName, classNames: [className], arePolymorphic: true };\n};\n\nconst createSingleClassSpecification = (classInfo: Readonly<ClassInfo>): SingleSchemaClassSpecification => {\n const [schemaName, className] = classInfo.name.split(\":\");\n return { schemaName, className };\n};\n\nconst createRelatedInstanceSpec = (\n pathFromSelectToPropertyClass: RelationshipPath,\n index: number,\n): { spec: RelatedInstanceSpecification; class: ClassInfo } => ({\n spec: {\n relationshipPath: pathFromSelectToPropertyClass.map((step) => ({\n relationship: createSingleClassSpecification(step.relationshipInfo),\n direction: step.isForwardRelationship ? RelationshipDirection.Forward : RelationshipDirection.Backward,\n targetClass: createSingleClassSpecification(step.targetClassInfo),\n })),\n isRequired: true,\n alias: `related_${index}`,\n },\n class: pathFromSelectToPropertyClass[pathFromSelectToPropertyClass.length - 1].targetClassInfo,\n});\n\nconst createPathFromSelectToPropertyClass = (field: PropertiesField): RelationshipPath => {\n let currField: Field = field;\n const pathFromPropertyToSelectClass: RelationshipPath = [];\n while (currField.parent) {\n pathFromPropertyToSelectClass.push(...currField.parent.pathToPrimaryClass);\n currField = currField.parent;\n }\n return RelationshipPath.reverse(pathFromPropertyToSelectClass);\n};\n\nconst createRelatedInstanceSpecInfo = (field: PropertiesField): { spec: RelatedInstanceSpecification; class: ClassInfo } | undefined => {\n const path = createPathFromSelectToPropertyClass(field);\n return path.length ? createRelatedInstanceSpec(path, 0) : undefined;\n};\n\nconst hexToDec = (id: Id64String) => {\n const digits = [0];\n for (let i = 2; i < id.length; ++i) {\n let carry = parseInt(id.charAt(i), 16);\n for (let j = 0; j < digits.length; ++j) {\n digits[j] = digits[j] * 16 + carry;\n carry = (digits[j] / 10) | 0;\n digits[j] %= 10;\n }\n while (carry > 0) {\n digits.push(carry % 10);\n carry = (carry / 10) | 0;\n }\n }\n return digits.reverse().join(\"\");\n};\n"]}
|
|
@@ -18,7 +18,7 @@ export interface UpdateInfo {
|
|
|
18
18
|
[imodel: string]: {
|
|
19
19
|
[rulesetId: string]: {
|
|
20
20
|
/**
|
|
21
|
-
* @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
21
|
+
* @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
22
22
|
* package for creating hierarchies.
|
|
23
23
|
*/
|
|
24
24
|
hierarchy?: HierarchyUpdateInfo;
|
|
@@ -29,7 +29,7 @@ export interface UpdateInfo {
|
|
|
29
29
|
/**
|
|
30
30
|
* Information about a required hierarchy update.
|
|
31
31
|
* @public
|
|
32
|
-
* @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
32
|
+
* @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
33
33
|
* package for creating hierarchies.
|
|
34
34
|
*/
|
|
35
35
|
export type HierarchyUpdateInfo = typeof UPDATE_FULL;
|
|
@@ -41,14 +41,14 @@ export type ContentUpdateInfo = typeof UPDATE_FULL;
|
|
|
41
41
|
/**
|
|
42
42
|
* Information about a hierarchy change: insertion, deletion or node update.
|
|
43
43
|
* @public
|
|
44
|
-
* @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
44
|
+
* @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
45
45
|
* package for creating hierarchies.
|
|
46
46
|
*/
|
|
47
47
|
export type PartialHierarchyModification = NodeInsertionInfo | NodeDeletionInfo | NodeUpdateInfo;
|
|
48
48
|
/**
|
|
49
49
|
* Information about node insertion.
|
|
50
50
|
* @public
|
|
51
|
-
* @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
51
|
+
* @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
52
52
|
* package for creating hierarchies.
|
|
53
53
|
*/
|
|
54
54
|
export interface NodeInsertionInfo {
|
|
@@ -63,7 +63,7 @@ export interface NodeInsertionInfo {
|
|
|
63
63
|
/**
|
|
64
64
|
* Information about node deletion.
|
|
65
65
|
* @public
|
|
66
|
-
* @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
66
|
+
* @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
67
67
|
* package for creating hierarchies.
|
|
68
68
|
*/
|
|
69
69
|
export interface NodeDeletionInfo {
|
|
@@ -76,7 +76,7 @@ export interface NodeDeletionInfo {
|
|
|
76
76
|
/**
|
|
77
77
|
* Information about node update.
|
|
78
78
|
* @public
|
|
79
|
-
* @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
79
|
+
* @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
80
80
|
* package for creating hierarchies.
|
|
81
81
|
*/
|
|
82
82
|
export interface NodeUpdateInfo {
|
|
@@ -89,7 +89,7 @@ export interface NodeUpdateInfo {
|
|
|
89
89
|
/**
|
|
90
90
|
* Information about hierarchy modification / differences.
|
|
91
91
|
* @public
|
|
92
|
-
* @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
92
|
+
* @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
|
|
93
93
|
* package for creating hierarchies.
|
|
94
94
|
*/
|
|
95
95
|
export interface HierarchyCompareInfo {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Update.js","sourceRoot":"","sources":["../../../src/presentation-common/Update.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAAqD;AACrD;;GAEG;;;AAKH;;;GAGG;AACU,QAAA,WAAW,GAAG,MAAM,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"Update.js","sourceRoot":"","sources":["../../../src/presentation-common/Update.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAAqD;AACrD;;GAEG;;;AAKH;;;GAGG;AACU,QAAA,WAAW,GAAG,MAAM,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/* eslint-disable @typescript-eslint/no-deprecated */\n/** @packageDocumentation\n * @module Core\n */\n\nimport { NodeKey } from \"./hierarchy/Key.js\";\nimport { Node, PartialNode } from \"./hierarchy/Node.js\";\n\n/**\n * A constant for indicating that a full update is required.\n * @public\n */\nexport const UPDATE_FULL = \"FULL\";\n\n/**\n * A data structure that describes changes that need to be applied to the hierarchy and\n * content components due to some changes on the backend.\n *\n * @public\n */\nexport interface UpdateInfo {\n [imodel: string]: {\n [rulesetId: string]: {\n /**\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\n hierarchy?: HierarchyUpdateInfo;\n content?: ContentUpdateInfo;\n };\n };\n}\n\n/**\n * Information about a required hierarchy update.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport type HierarchyUpdateInfo = typeof UPDATE_FULL;\n\n/**\n * Information about a required content update.\n * @public\n */\nexport type ContentUpdateInfo = typeof UPDATE_FULL;\n\n/**\n * Information about a hierarchy change: insertion, deletion or node update.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport type PartialHierarchyModification = NodeInsertionInfo | NodeDeletionInfo | NodeUpdateInfo;\n\n/**\n * Information about node insertion.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport interface NodeInsertionInfo {\n type: \"Insert\";\n /** Parent node key */\n parent?: NodeKey;\n /** Index of the new node under its parent */\n position: number;\n /** Inserted node */\n node: Node;\n}\n\n/**\n * Information about node deletion.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport interface NodeDeletionInfo {\n type: \"Delete\";\n /** Parent of the deleted node */\n parent?: NodeKey;\n /** Position of the deleted node among its siblings in the initial, not updated tree */\n position: number;\n}\n\n/**\n * Information about node update.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport interface NodeUpdateInfo {\n type: \"Update\";\n /** Key of the updated node */\n target: NodeKey;\n /** Updated node attributes */\n changes: PartialNode;\n}\n\n/**\n * Information about hierarchy modification / differences.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport interface HierarchyCompareInfo {\n /** A list of hierarchy changes */\n changes: PartialHierarchyModification[];\n /** Continuation token for requesting more changes. */\n continuationToken?: {\n prevHierarchyNode: string;\n currHierarchyNode: string;\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/presentation-common/Utils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AA0FH,sCAOC;AAYD,kEAmBC;AAGD,0EAcC;AA/ID,+CAA6C;AA8C7C;;;;;;;;;;;GAWG;AACI,MAAM,iBAAiB,GAAG,CAAC,IAAsB,EAAU,EAAE;IAClE,IAAI,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC;IACnC,qDAAqD;IACrD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAY,EAAE,EAAE;QACrC,IAAI,gBAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,KAAK,IAAI,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC;Q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,CAAC;YACnF,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAwB,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,GAAU,CAAC;AACpB,CAAC;AAED,gBAAgB;AAChB,SAAgB,+BAA+B,CAAC,SAAiB;IAC/D,IAAI,OAAsC,CAAC;IAC3C,IAAI,aAAyB,CAAC;IAC9B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACpD,aAAa,GAAG,MAAM,CAAC;QACvB,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IACH,OAAO;QACL,OAAO;QACP,MAAM,EAAE,GAAG,EAAE;YACX,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,aAAa,EAAE,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/presentation-common/Utils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AA0FH,sCAOC;AAYD,kEAmBC;AAGD,0EAcC;AA/ID,+CAA6C;AA8C7C;;;;;;;;;;;GAWG;AACI,MAAM,iBAAiB,GAAG,CAAC,IAAsB,EAAU,EAAE;IAClE,IAAI,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC;IACnC,qDAAqD;IACrD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAY,EAAE,EAAE;QACrC,IAAI,gBAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,KAAK,IAAI,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC;QACnC,CAAC;aAAM,IAAI,gBAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1C,KAAK,IAAI,GAAG,CAAC,qBAAqB,CAAC;QACrC,CA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AED,gBAAgB;AAChB,SAAgB,+BAA+B,CAAC,SAAiB;IAC/D,IAAI,OAAsC,CAAC;IAC3C,IAAI,aAAyB,CAAC;IAC9B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACpD,aAAa,GAAG,MAAM,CAAC;QACvB,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IACH,OAAO;QACL,OAAO;QACP,MAAM,EAAE,GAAG,EAAE;YACX,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,aAAa,EAAE,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { NodeKey } from \"./hierarchy/Key.js\";\nimport { KeySet } from \"./KeySet.js\";\n\n/**\n * Create a type with `T` properties excluding properties listed in `K`.\n *\n * Usage example: `Omit<SomeType, \"exclude_prop1\" | \"exclude_prop2\">`\n *\n * @public\n */\nexport type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;\n\n/**\n * Create a type with `T` properties excluding all properties in type `K`.\n *\n * Usage example: `Subtract<SomeType, ExcludePropertiesInThisType>`\n *\n * @public\n */\nexport type Subtract<T, K> = Omit<T, keyof K>;\n\n/**\n * Create a type from given type `T` and make specified properties optional.\n * @public\n */\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\n/**\n * A dictionary data structure.\n * @public\n */\nexport interface ValuesDictionary<T> {\n [key: string]: T;\n}\n\n/**\n * A structure for paged responses\n * @public\n */\nexport interface PagedResponse<T> {\n /** Total number of items */\n total: number;\n /** Items for the requested page */\n items: T[];\n}\n\n/**\n * Get total number of instances included in the supplied key set. The\n * count is calculated by adding all of the following:\n * - `keys.instanceKeysCount`\n * - number of `keys.nodeKeys` which are *ECInstance* keys\n * - for every grouping node key in `keys.nodeKeys`, number of grouped instances\n *\n * E.g. if `keys` contains one instance key, one *ECInstance* node key\n * and one grouping node key which groups 3 instances, the result is 5.\n *\n * @public\n */\nexport const getInstancesCount = (keys: Readonly<KeySet>): number => {\n let count = keys.instanceKeysCount;\n /* eslint-disable @typescript-eslint/no-deprecated */\n keys.nodeKeys.forEach((key: NodeKey) => {\n if (NodeKey.isInstancesNodeKey(key)) {\n count += key.instanceKeys.length;\n } else if (NodeKey.isGroupingNodeKey(key)) {\n count += key.groupedInstancesCount;\n }\n });\n /* eslint-enable @typescript-eslint/no-deprecated */\n return count;\n};\n\n/**\n * Default (recommended) keyset batch size for cases when it needs to be sent\n * over HTTP. Sending keys in batches helps avoid HTTP413 error.\n *\n * @public\n */\nexport const DEFAULT_KEYS_BATCH_SIZE = 5000;\n\n/**\n * Removes all `undefined` properties from given `obj` object and returns\n * the same (mutated) object.\n *\n * Example: `omitUndefined({ a: 1, b: undefined })` will return `{ a: 1 }`\n *\n * @internal\n */\nexport function omitUndefined<T extends object>(obj: T): T {\n Object.entries(obj).forEach(([key, value]) => {\n if (value === undefined) {\n delete obj[key as keyof T];\n }\n });\n return obj;\n}\n\n/** @internal */\ntype NullToUndefined<T> = T extends null\n ? undefined\n : T extends Array<infer U>\n ? Array<NullToUndefined<U>>\n : T extends object\n ? { [K in keyof T]: NullToUndefined<T[K]> }\n : T;\n\n/** @internal */\nexport function deepReplaceNullsToUndefined<T>(obj: T): NullToUndefined<T> {\n /* c8 ignore next 3 */\n if (obj === null) {\n return undefined as any;\n }\n /* c8 ignore next 3 */\n if (Array.isArray(obj)) {\n return obj.map(deepReplaceNullsToUndefined) as NullToUndefined<T>;\n }\n if (typeof obj === \"object\") {\n return Object.keys(obj).reduce((acc, key) => {\n const value = obj[key as keyof T];\n if (value !== null && value !== undefined) {\n acc[key as keyof NullToUndefined<T>] = deepReplaceNullsToUndefined(value) as any;\n }\n return acc;\n }, {} as NullToUndefined<T>);\n }\n return obj as any;\n}\n\n/** @internal */\nexport function createCancellableTimeoutPromise(timeoutMs: number) {\n let timeout: ReturnType<typeof setTimeout>;\n let rejectPromise: () => void;\n const promise = new Promise<void>((resolve, reject) => {\n rejectPromise = reject;\n timeout = setTimeout(resolve, timeoutMs);\n });\n return {\n promise,\n cancel: () => {\n clearTimeout(timeout);\n rejectPromise();\n },\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Category.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/Category.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAwBH,cAAc;AACd,IAAiB,mBAAmB,CAmCnC;AAnCD,WAAiB,mBAAmB;IAClC,uCAAuC;IACvC,SAAgB,MAAM,CAAC,QAA6B;QAClD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC;QACrC,OAAO;YACL,GAAG,IAAI;YACP,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SAClD,CAAC;IACJ,CAAC;IANe,0BAAM,SAMrB,CAAA;IAED;;;OAGG;IACH,SAAgB,QAAQ,CAAC,IAA6B;QACpD,6DAA6D;QAC7D,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAJe,4BAAQ,WAIvB,CAAA;IAED,SAAS,yBAAyB,CAAC,IAA6B,EAAE,aAA+C;QAC/G,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC;QAC/C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,mDAAmD;YACnD,QAAQ,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,+DAA+D;IAC/D,SAAgB,YAAY,CAAC,IAA+B;QAC1D,MAAM,aAAa,GAAG,IAAI,GAAG,EAA+B,CAAC;QAC7D,IAAI,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,mBAAmB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACjH,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,yBAAyB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC;IAC5F,CAAC;IAJe,gCAAY,eAI3B,CAAA;AACH,CAAC,EAnCgB,mBAAmB,mCAAnB,mBAAmB,QAmCnC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"Category.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/Category.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAwBH,cAAc;AACd,IAAiB,mBAAmB,CAmCnC;AAnCD,WAAiB,mBAAmB;IAClC,uCAAuC;IACvC,SAAgB,MAAM,CAAC,QAA6B;QAClD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC;QACrC,OAAO;YACL,GAAG,IAAI;YACP,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SAClD,CAAC;IACJ,CAAC;IANe,0BAAM,SAMrB,CAAA;IAED;;;OAGG;IACH,SAAgB,QAAQ,CAAC,IAA6B;QACpD,6DAA6D;QAC7D,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAJe,4BAAQ,WAIvB,CAAA;IAED,SAAS,yBAAyB,CAAC,IAA6B,EAAE,aAA+C;QAC/G,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC;QAC/C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,mDAAmD;YACnD,QAAQ,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,+DAA+D;IAC/D,SAAgB,YAAY,CAAC,IAA+B;QAC1D,MAAM,aAAa,GAAG,IAAI,GAAG,EAA+B,CAAC;QAC7D,IAAI,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,mBAAmB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACjH,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,yBAAyB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC;IAC5F,CAAC;IAJe,gCAAY,eAI3B,CAAA;AACH,CAAC,EAnCgB,mBAAmB,mCAAnB,mBAAmB,QAmCnC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Content\n */\n\nimport { RendererDescription } from \"./Renderer.js\";\n\n/**\n * A data structure that describes a [[Field]] category.\n * @public\n */\nexport interface CategoryDescription {\n /** Unique name */\n name: string;\n /** Display label */\n label: string;\n /** Extensive description */\n description: string;\n /** Priority. Categories with higher priority should appear higher in the UI */\n priority: number;\n /** Should this category be auto-expanded when it's displayed in the UI */\n expand: boolean;\n /** Parent category description */\n parent?: CategoryDescription;\n /** Custom renderer description */\n renderer?: RendererDescription;\n}\n/** @public */\nexport namespace CategoryDescription {\n /** Serialize given category to JSON */\n export function toJSON(category: CategoryDescription): CategoryDescriptionJSON {\n const { parent, ...rest } = category;\n return {\n ...rest,\n ...(parent ? { parent: parent.name } : undefined),\n };\n }\n\n /**\n * Deserialize [[CategoryDescription]] from JSON. The `parent` is not assigned - use [[CategoryDescription.listFromJSON]]\n * to deserialize the whole categories list and set parents.\n */\n export function fromJSON(json: CategoryDescriptionJSON): CategoryDescription {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { parent, ...rest } = json;\n return rest;\n }\n\n function createCategoriesHierarchy(json: CategoryDescriptionJSON, categoriesMap: Map<string, CategoryDescription>): CategoryDescription {\n const category = categoriesMap.get(json.name)!;\n if (json.parent) {\n // note: mutating categories in the `categoriesMap`\n category.parent = categoriesMap.get(json.parent);\n }\n return category;\n }\n\n /** Deserialize a list of [[CategoryDescription]] from JSON. */\n export function listFromJSON(json: CategoryDescriptionJSON[]): CategoryDescription[] {\n const categoriesMap = new Map<string, CategoryDescription>();\n json.forEach((categoryJson) => categoriesMap.set(categoryJson.name, CategoryDescription.fromJSON(categoryJson)));\n return json.map((categoryJson) => createCategoriesHierarchy(categoryJson, categoriesMap));\n }\n}\n\n/**\n * Serialized [[CategoryDescription]] JSON representation.\n * @public\n */\nexport interface CategoryDescriptionJSON {\n name: string;\n label: string;\n description: string;\n priority: number;\n expand: boolean;\n parent?: string;\n renderer?: RendererDescription;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/Content.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,mDAA6D;AAC7D,uCAA2C;AAW3C;;;;;GAKG;AACH,MAAa,OAAO;IAClB,4CAA4C;IAC5B,UAAU,CAAa;IACvC,oBAAoB;IACJ,UAAU,CAAS;IAEnC,wCAAwC;IACxC,YAAmB,UAAsB,EAAE,KAAa;QACtD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED,oCAAoC;IAC7B,MAAM;QACX,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;YACpC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAU,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;SAC/D,CAAC;IACJ,CAAC;IAED,wCAAwC;IACjC,MAAM,CAAC,QAAQ,CAAC,IAAsC;QAC3D,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5C,CAAC;QAED,MAAM,UAAU,GAAG,0BAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,cAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAO,CAAC,IAAI,EAAgB,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;QACvI,OAAO,IAAI,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC7C,CAAC;CACF;AAtCD,0BAsCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"Content.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/Content.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AA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sCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Content\n */\n\nimport { Descriptor, DescriptorJSON } from \"./Descriptor.js\";\nimport { Item, ItemJSON } from \"./Item.js\";\n\n/**\n * Serialized [[Content]] JSON representation.\n * @public\n */\nexport interface ContentJSON {\n descriptor: DescriptorJSON;\n contentSet: ItemJSON[];\n}\n\n/**\n * A data structure that contains the [[Descriptor]] and a list of [[Item]]\n * objects which are based on that descriptor.\n *\n * @public\n */\nexport class Content {\n /** Descriptor used to create the content */\n public readonly descriptor: Descriptor;\n /** Content items */\n public readonly contentSet: Item[];\n\n /** Create a new [[Content]] instance */\n public constructor(descriptor: Descriptor, items: Item[]) {\n this.descriptor = descriptor;\n this.contentSet = items;\n }\n\n /** Serialize this object to JSON */\n public toJSON(): ContentJSON {\n return {\n descriptor: this.descriptor.toJSON(),\n contentSet: this.contentSet.map((item: Item) => item.toJSON()),\n };\n }\n\n /** Deserialize [[Content]] from JSON */\n public static fromJSON(json: ContentJSON | string | undefined): Content | undefined {\n if (!json) {\n return undefined;\n }\n\n if (typeof json === \"string\") {\n return Content.fromJSON(JSON.parse(json));\n }\n\n const descriptor = Descriptor.fromJSON(json.descriptor);\n if (!descriptor) {\n return undefined;\n }\n\n const contentSet = json.contentSet.map((itemJson) => Item.fromJSON(itemJson)).filter<Item>((item): item is Item => item !== undefined);\n return new Content(descriptor, contentSet);\n }\n}\n"]}
|