@itwin/presentation-common 4.5.0-dev.3 → 4.5.0-dev.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (397) hide show
  1. package/CHANGELOG.md +43 -1
  2. package/LICENSE.md +1 -1
  3. package/README.md +1 -1
  4. package/Ruleset.schema.json +72 -19
  5. package/lib/cjs/assets/locales/en/Presentation.json +1 -1
  6. package/lib/cjs/presentation-common/AsyncTasks.d.ts.map +1 -1
  7. package/lib/cjs/presentation-common/AsyncTasks.js +6 -4
  8. package/lib/cjs/presentation-common/AsyncTasks.js.map +1 -1
  9. package/lib/cjs/presentation-common/CommonLoggerCategory.js +3 -3
  10. package/lib/cjs/presentation-common/CommonLoggerCategory.js.map +1 -1
  11. package/lib/cjs/presentation-common/Diagnostics.d.ts.map +1 -1
  12. package/lib/cjs/presentation-common/Diagnostics.js +27 -15
  13. package/lib/cjs/presentation-common/Diagnostics.js.map +1 -1
  14. package/lib/cjs/presentation-common/EC.d.ts +7 -4
  15. package/lib/cjs/presentation-common/EC.d.ts.map +1 -1
  16. package/lib/cjs/presentation-common/EC.js +22 -17
  17. package/lib/cjs/presentation-common/EC.js.map +1 -1
  18. package/lib/cjs/presentation-common/ElementProperties.js +3 -3
  19. package/lib/cjs/presentation-common/ElementProperties.js.map +1 -1
  20. package/lib/cjs/presentation-common/Error.d.ts.map +1 -1
  21. package/lib/cjs/presentation-common/Error.js +5 -4
  22. package/lib/cjs/presentation-common/Error.js.map +1 -1
  23. package/lib/cjs/presentation-common/InstanceFilterDefinition.d.ts.map +1 -1
  24. package/lib/cjs/presentation-common/InstanceFilterDefinition.js +3 -3
  25. package/lib/cjs/presentation-common/InstanceFilterDefinition.js.map +1 -1
  26. package/lib/cjs/presentation-common/KeySet.d.ts.map +1 -1
  27. package/lib/cjs/presentation-common/KeySet.js +80 -46
  28. package/lib/cjs/presentation-common/KeySet.js.map +1 -1
  29. package/lib/cjs/presentation-common/KoqPropertyValueFormatter.d.ts.map +1 -1
  30. package/lib/cjs/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
  31. package/lib/cjs/presentation-common/LabelDefinition.d.ts.map +1 -1
  32. package/lib/cjs/presentation-common/LabelDefinition.js +5 -4
  33. package/lib/cjs/presentation-common/LabelDefinition.js.map +1 -1
  34. package/lib/cjs/presentation-common/LocalizationHelper.d.ts +1 -1
  35. package/lib/cjs/presentation-common/LocalizationHelper.d.ts.map +1 -1
  36. package/lib/cjs/presentation-common/LocalizationHelper.js.map +1 -1
  37. package/lib/cjs/presentation-common/PresentationIpcInterface.js +3 -3
  38. package/lib/cjs/presentation-common/PresentationIpcInterface.js.map +1 -1
  39. package/lib/cjs/presentation-common/PresentationManagerOptions.d.ts.map +1 -1
  40. package/lib/cjs/presentation-common/PresentationManagerOptions.js +3 -3
  41. package/lib/cjs/presentation-common/PresentationManagerOptions.js.map +1 -1
  42. package/lib/cjs/presentation-common/PresentationRpcInterface.d.ts.map +1 -1
  43. package/lib/cjs/presentation-common/PresentationRpcInterface.js +52 -20
  44. package/lib/cjs/presentation-common/PresentationRpcInterface.js.map +1 -1
  45. package/lib/cjs/presentation-common/RegisteredRuleset.d.ts.map +1 -1
  46. package/lib/cjs/presentation-common/RegisteredRuleset.js +21 -9
  47. package/lib/cjs/presentation-common/RegisteredRuleset.js.map +1 -1
  48. package/lib/cjs/presentation-common/RpcRequestsHandler.d.ts +1 -1
  49. package/lib/cjs/presentation-common/RpcRequestsHandler.d.ts.map +1 -1
  50. package/lib/cjs/presentation-common/RpcRequestsHandler.js +19 -15
  51. package/lib/cjs/presentation-common/RpcRequestsHandler.js.map +1 -1
  52. package/lib/cjs/presentation-common/RulesetVariables.d.ts.map +1 -1
  53. package/lib/cjs/presentation-common/RulesetVariables.js +7 -5
  54. package/lib/cjs/presentation-common/RulesetVariables.js.map +1 -1
  55. package/lib/cjs/presentation-common/RulesetsFactory.d.ts.map +1 -1
  56. package/lib/cjs/presentation-common/RulesetsFactory.js +42 -26
  57. package/lib/cjs/presentation-common/RulesetsFactory.js.map +1 -1
  58. package/lib/cjs/presentation-common/Update.d.ts.map +1 -1
  59. package/lib/cjs/presentation-common/Update.js +4 -3
  60. package/lib/cjs/presentation-common/Update.js.map +1 -1
  61. package/lib/cjs/presentation-common/Utils.js +3 -3
  62. package/lib/cjs/presentation-common/Utils.js.map +1 -1
  63. package/lib/cjs/presentation-common/content/Category.js +3 -3
  64. package/lib/cjs/presentation-common/content/Category.js.map +1 -1
  65. package/lib/cjs/presentation-common/content/Content.d.ts.map +1 -1
  66. package/lib/cjs/presentation-common/content/Content.js +10 -9
  67. package/lib/cjs/presentation-common/content/Content.js.map +1 -1
  68. package/lib/cjs/presentation-common/content/ContentTraverser.d.ts.map +1 -1
  69. package/lib/cjs/presentation-common/content/ContentTraverser.js +47 -25
  70. package/lib/cjs/presentation-common/content/ContentTraverser.js.map +1 -1
  71. package/lib/cjs/presentation-common/content/Descriptor.d.ts.map +1 -1
  72. package/lib/cjs/presentation-common/content/Descriptor.js +56 -21
  73. package/lib/cjs/presentation-common/content/Descriptor.js.map +1 -1
  74. package/lib/cjs/presentation-common/content/DisplayTypes.js +3 -3
  75. package/lib/cjs/presentation-common/content/DisplayTypes.js.map +1 -1
  76. package/lib/cjs/presentation-common/content/Editor.js +3 -3
  77. package/lib/cjs/presentation-common/content/Editor.js.map +1 -1
  78. package/lib/cjs/presentation-common/content/Fields.d.ts.map +1 -1
  79. package/lib/cjs/presentation-common/content/Fields.js +47 -23
  80. package/lib/cjs/presentation-common/content/Fields.js.map +1 -1
  81. package/lib/cjs/presentation-common/content/Item.d.ts.map +1 -1
  82. package/lib/cjs/presentation-common/content/Item.js +8 -6
  83. package/lib/cjs/presentation-common/content/Item.js.map +1 -1
  84. package/lib/cjs/presentation-common/content/Property.d.ts +1 -1
  85. package/lib/cjs/presentation-common/content/Property.d.ts.map +1 -1
  86. package/lib/cjs/presentation-common/content/Property.js +4 -4
  87. package/lib/cjs/presentation-common/content/Property.js.map +1 -1
  88. package/lib/cjs/presentation-common/content/PropertyValueFormatter.d.ts.map +1 -1
  89. package/lib/cjs/presentation-common/content/PropertyValueFormatter.js +13 -11
  90. package/lib/cjs/presentation-common/content/PropertyValueFormatter.js.map +1 -1
  91. package/lib/cjs/presentation-common/content/Renderer.js +3 -3
  92. package/lib/cjs/presentation-common/content/Renderer.js.map +1 -1
  93. package/lib/cjs/presentation-common/content/TypeDescription.js +3 -3
  94. package/lib/cjs/presentation-common/content/TypeDescription.js.map +1 -1
  95. package/lib/cjs/presentation-common/content/Value.d.ts.map +1 -1
  96. package/lib/cjs/presentation-common/content/Value.js +46 -30
  97. package/lib/cjs/presentation-common/content/Value.js.map +1 -1
  98. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js +3 -3
  99. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
  100. package/lib/cjs/presentation-common/hierarchy/Key.d.ts.map +1 -1
  101. package/lib/cjs/presentation-common/hierarchy/Key.js +14 -8
  102. package/lib/cjs/presentation-common/hierarchy/Key.js.map +1 -1
  103. package/lib/cjs/presentation-common/hierarchy/Node.d.ts.map +1 -1
  104. package/lib/cjs/presentation-common/hierarchy/Node.js +7 -5
  105. package/lib/cjs/presentation-common/hierarchy/Node.js.map +1 -1
  106. package/lib/cjs/presentation-common/hierarchy/NodePathElement.d.ts.map +1 -1
  107. package/lib/cjs/presentation-common/hierarchy/NodePathElement.js +11 -7
  108. package/lib/cjs/presentation-common/hierarchy/NodePathElement.js.map +1 -1
  109. package/lib/cjs/presentation-common/rules/ClassSpecifications.js +3 -3
  110. package/lib/cjs/presentation-common/rules/ClassSpecifications.js.map +1 -1
  111. package/lib/cjs/presentation-common/rules/RelatedInstanceSpecification.d.ts +39 -11
  112. package/lib/cjs/presentation-common/rules/RelatedInstanceSpecification.d.ts.map +1 -1
  113. package/lib/cjs/presentation-common/rules/RelatedInstanceSpecification.js +3 -3
  114. package/lib/cjs/presentation-common/rules/RelatedInstanceSpecification.js.map +1 -1
  115. package/lib/cjs/presentation-common/rules/RelationshipDirection.js +3 -3
  116. package/lib/cjs/presentation-common/rules/RelationshipDirection.js.map +1 -1
  117. package/lib/cjs/presentation-common/rules/RelationshipPathSpecification.js +3 -3
  118. package/lib/cjs/presentation-common/rules/RelationshipPathSpecification.js.map +1 -1
  119. package/lib/cjs/presentation-common/rules/Rule.js +3 -3
  120. package/lib/cjs/presentation-common/rules/Rule.js.map +1 -1
  121. package/lib/cjs/presentation-common/rules/Ruleset.js +3 -3
  122. package/lib/cjs/presentation-common/rules/Ruleset.js.map +1 -1
  123. package/lib/cjs/presentation-common/rules/SchemasSpecification.js +3 -3
  124. package/lib/cjs/presentation-common/rules/SchemasSpecification.js.map +1 -1
  125. package/lib/cjs/presentation-common/rules/Variables.js +3 -3
  126. package/lib/cjs/presentation-common/rules/Variables.js.map +1 -1
  127. package/lib/cjs/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js +3 -3
  128. package/lib/cjs/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js.map +1 -1
  129. package/lib/cjs/presentation-common/rules/content/ContentRelatedInstancesSpecification.js +3 -3
  130. package/lib/cjs/presentation-common/rules/content/ContentRelatedInstancesSpecification.js.map +1 -1
  131. package/lib/cjs/presentation-common/rules/content/ContentRule.js +3 -3
  132. package/lib/cjs/presentation-common/rules/content/ContentRule.js.map +1 -1
  133. package/lib/cjs/presentation-common/rules/content/ContentSpecification.d.ts.map +1 -1
  134. package/lib/cjs/presentation-common/rules/content/ContentSpecification.js +3 -3
  135. package/lib/cjs/presentation-common/rules/content/ContentSpecification.js.map +1 -1
  136. package/lib/cjs/presentation-common/rules/content/DefaultPropertyCategoryOverride.js +3 -3
  137. package/lib/cjs/presentation-common/rules/content/DefaultPropertyCategoryOverride.js.map +1 -1
  138. package/lib/cjs/presentation-common/rules/content/PropertySpecification.js +3 -3
  139. package/lib/cjs/presentation-common/rules/content/PropertySpecification.js.map +1 -1
  140. package/lib/cjs/presentation-common/rules/content/SelectedNodeInstancesSpecification.js +3 -3
  141. package/lib/cjs/presentation-common/rules/content/SelectedNodeInstancesSpecification.js.map +1 -1
  142. package/lib/cjs/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js +3 -3
  143. package/lib/cjs/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js.map +1 -1
  144. package/lib/cjs/presentation-common/rules/content/modifiers/ContentModifier.js +3 -3
  145. package/lib/cjs/presentation-common/rules/content/modifiers/ContentModifier.js.map +1 -1
  146. package/lib/cjs/presentation-common/rules/content/modifiers/CustomRendererSpecification.js +3 -3
  147. package/lib/cjs/presentation-common/rules/content/modifiers/CustomRendererSpecification.js.map +1 -1
  148. package/lib/cjs/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js +3 -3
  149. package/lib/cjs/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js.map +1 -1
  150. package/lib/cjs/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.d.ts.map +1 -1
  151. package/lib/cjs/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.js +3 -3
  152. package/lib/cjs/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.js.map +1 -1
  153. package/lib/cjs/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js +3 -3
  154. package/lib/cjs/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js.map +1 -1
  155. package/lib/cjs/presentation-common/rules/customization/CheckBoxRule.js +3 -3
  156. package/lib/cjs/presentation-common/rules/customization/CheckBoxRule.js.map +1 -1
  157. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.d.ts +1 -5
  158. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.d.ts.map +1 -1
  159. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.js +3 -3
  160. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
  161. package/lib/cjs/presentation-common/rules/customization/ExtendedDataRule.js +3 -3
  162. package/lib/cjs/presentation-common/rules/customization/ExtendedDataRule.js.map +1 -1
  163. package/lib/cjs/presentation-common/rules/customization/GroupingRule.js +3 -3
  164. package/lib/cjs/presentation-common/rules/customization/GroupingRule.js.map +1 -1
  165. package/lib/cjs/presentation-common/rules/customization/ImageIdOverride.js +3 -3
  166. package/lib/cjs/presentation-common/rules/customization/ImageIdOverride.js.map +1 -1
  167. package/lib/cjs/presentation-common/rules/customization/InstanceLabelOverride.d.ts.map +1 -1
  168. package/lib/cjs/presentation-common/rules/customization/InstanceLabelOverride.js +3 -3
  169. package/lib/cjs/presentation-common/rules/customization/InstanceLabelOverride.js.map +1 -1
  170. package/lib/cjs/presentation-common/rules/customization/LabelOverride.js +3 -3
  171. package/lib/cjs/presentation-common/rules/customization/LabelOverride.js.map +1 -1
  172. package/lib/cjs/presentation-common/rules/customization/SortingRule.js +3 -3
  173. package/lib/cjs/presentation-common/rules/customization/SortingRule.js.map +1 -1
  174. package/lib/cjs/presentation-common/rules/customization/StyleOverride.js +3 -3
  175. package/lib/cjs/presentation-common/rules/customization/StyleOverride.js.map +1 -1
  176. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.js +3 -3
  177. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
  178. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts.map +1 -1
  179. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.js +3 -3
  180. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
  181. package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.js +3 -3
  182. package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
  183. package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js +3 -3
  184. package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
  185. package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js +3 -3
  186. package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
  187. package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.js +3 -3
  188. package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
  189. package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.js +3 -3
  190. package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
  191. package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js +3 -3
  192. package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
  193. package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.js +3 -3
  194. package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
  195. package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.js +3 -3
  196. package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
  197. package/lib/cjs/presentation-common/selection/SelectionScope.js +3 -3
  198. package/lib/cjs/presentation-common/selection/SelectionScope.js.map +1 -1
  199. package/lib/cjs/presentation-common.js +3 -3
  200. package/lib/cjs/presentation-common.js.map +1 -1
  201. package/lib/esm/presentation-common/AsyncTasks.d.ts.map +1 -1
  202. package/lib/esm/presentation-common/AsyncTasks.js +6 -4
  203. package/lib/esm/presentation-common/AsyncTasks.js.map +1 -1
  204. package/lib/esm/presentation-common/CommonLoggerCategory.js +3 -3
  205. package/lib/esm/presentation-common/CommonLoggerCategory.js.map +1 -1
  206. package/lib/esm/presentation-common/Diagnostics.d.ts.map +1 -1
  207. package/lib/esm/presentation-common/Diagnostics.js +27 -15
  208. package/lib/esm/presentation-common/Diagnostics.js.map +1 -1
  209. package/lib/esm/presentation-common/EC.d.ts +7 -4
  210. package/lib/esm/presentation-common/EC.d.ts.map +1 -1
  211. package/lib/esm/presentation-common/EC.js +22 -17
  212. package/lib/esm/presentation-common/EC.js.map +1 -1
  213. package/lib/esm/presentation-common/ElementProperties.js +3 -3
  214. package/lib/esm/presentation-common/ElementProperties.js.map +1 -1
  215. package/lib/esm/presentation-common/Error.d.ts.map +1 -1
  216. package/lib/esm/presentation-common/Error.js +5 -4
  217. package/lib/esm/presentation-common/Error.js.map +1 -1
  218. package/lib/esm/presentation-common/InstanceFilterDefinition.d.ts.map +1 -1
  219. package/lib/esm/presentation-common/InstanceFilterDefinition.js +3 -3
  220. package/lib/esm/presentation-common/InstanceFilterDefinition.js.map +1 -1
  221. package/lib/esm/presentation-common/KeySet.d.ts.map +1 -1
  222. package/lib/esm/presentation-common/KeySet.js +80 -46
  223. package/lib/esm/presentation-common/KeySet.js.map +1 -1
  224. package/lib/esm/presentation-common/KoqPropertyValueFormatter.d.ts.map +1 -1
  225. package/lib/esm/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
  226. package/lib/esm/presentation-common/LabelDefinition.d.ts.map +1 -1
  227. package/lib/esm/presentation-common/LabelDefinition.js +5 -4
  228. package/lib/esm/presentation-common/LabelDefinition.js.map +1 -1
  229. package/lib/esm/presentation-common/LocalizationHelper.d.ts +1 -1
  230. package/lib/esm/presentation-common/LocalizationHelper.d.ts.map +1 -1
  231. package/lib/esm/presentation-common/LocalizationHelper.js.map +1 -1
  232. package/lib/esm/presentation-common/PresentationIpcInterface.js +3 -3
  233. package/lib/esm/presentation-common/PresentationIpcInterface.js.map +1 -1
  234. package/lib/esm/presentation-common/PresentationManagerOptions.d.ts.map +1 -1
  235. package/lib/esm/presentation-common/PresentationManagerOptions.js +3 -3
  236. package/lib/esm/presentation-common/PresentationManagerOptions.js.map +1 -1
  237. package/lib/esm/presentation-common/PresentationRpcInterface.d.ts.map +1 -1
  238. package/lib/esm/presentation-common/PresentationRpcInterface.js +52 -20
  239. package/lib/esm/presentation-common/PresentationRpcInterface.js.map +1 -1
  240. package/lib/esm/presentation-common/RegisteredRuleset.d.ts.map +1 -1
  241. package/lib/esm/presentation-common/RegisteredRuleset.js +21 -9
  242. package/lib/esm/presentation-common/RegisteredRuleset.js.map +1 -1
  243. package/lib/esm/presentation-common/RpcRequestsHandler.d.ts +1 -1
  244. package/lib/esm/presentation-common/RpcRequestsHandler.d.ts.map +1 -1
  245. package/lib/esm/presentation-common/RpcRequestsHandler.js +20 -16
  246. package/lib/esm/presentation-common/RpcRequestsHandler.js.map +1 -1
  247. package/lib/esm/presentation-common/RulesetVariables.d.ts.map +1 -1
  248. package/lib/esm/presentation-common/RulesetVariables.js +7 -5
  249. package/lib/esm/presentation-common/RulesetVariables.js.map +1 -1
  250. package/lib/esm/presentation-common/RulesetsFactory.d.ts.map +1 -1
  251. package/lib/esm/presentation-common/RulesetsFactory.js +42 -26
  252. package/lib/esm/presentation-common/RulesetsFactory.js.map +1 -1
  253. package/lib/esm/presentation-common/Update.d.ts.map +1 -1
  254. package/lib/esm/presentation-common/Update.js +4 -3
  255. package/lib/esm/presentation-common/Update.js.map +1 -1
  256. package/lib/esm/presentation-common/Utils.js +3 -3
  257. package/lib/esm/presentation-common/Utils.js.map +1 -1
  258. package/lib/esm/presentation-common/content/Category.js +3 -3
  259. package/lib/esm/presentation-common/content/Category.js.map +1 -1
  260. package/lib/esm/presentation-common/content/Content.d.ts.map +1 -1
  261. package/lib/esm/presentation-common/content/Content.js +10 -9
  262. package/lib/esm/presentation-common/content/Content.js.map +1 -1
  263. package/lib/esm/presentation-common/content/ContentTraverser.d.ts.map +1 -1
  264. package/lib/esm/presentation-common/content/ContentTraverser.js +47 -25
  265. package/lib/esm/presentation-common/content/ContentTraverser.js.map +1 -1
  266. package/lib/esm/presentation-common/content/Descriptor.d.ts.map +1 -1
  267. package/lib/esm/presentation-common/content/Descriptor.js +56 -21
  268. package/lib/esm/presentation-common/content/Descriptor.js.map +1 -1
  269. package/lib/esm/presentation-common/content/DisplayTypes.js +3 -3
  270. package/lib/esm/presentation-common/content/DisplayTypes.js.map +1 -1
  271. package/lib/esm/presentation-common/content/Editor.js +3 -3
  272. package/lib/esm/presentation-common/content/Editor.js.map +1 -1
  273. package/lib/esm/presentation-common/content/Fields.d.ts.map +1 -1
  274. package/lib/esm/presentation-common/content/Fields.js +47 -23
  275. package/lib/esm/presentation-common/content/Fields.js.map +1 -1
  276. package/lib/esm/presentation-common/content/Item.d.ts.map +1 -1
  277. package/lib/esm/presentation-common/content/Item.js +8 -6
  278. package/lib/esm/presentation-common/content/Item.js.map +1 -1
  279. package/lib/esm/presentation-common/content/Property.d.ts +1 -1
  280. package/lib/esm/presentation-common/content/Property.d.ts.map +1 -1
  281. package/lib/esm/presentation-common/content/Property.js +4 -4
  282. package/lib/esm/presentation-common/content/Property.js.map +1 -1
  283. package/lib/esm/presentation-common/content/PropertyValueFormatter.d.ts.map +1 -1
  284. package/lib/esm/presentation-common/content/PropertyValueFormatter.js +13 -11
  285. package/lib/esm/presentation-common/content/PropertyValueFormatter.js.map +1 -1
  286. package/lib/esm/presentation-common/content/Renderer.js +3 -3
  287. package/lib/esm/presentation-common/content/Renderer.js.map +1 -1
  288. package/lib/esm/presentation-common/content/TypeDescription.js +3 -3
  289. package/lib/esm/presentation-common/content/TypeDescription.js.map +1 -1
  290. package/lib/esm/presentation-common/content/Value.d.ts.map +1 -1
  291. package/lib/esm/presentation-common/content/Value.js +46 -30
  292. package/lib/esm/presentation-common/content/Value.js.map +1 -1
  293. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js +3 -3
  294. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
  295. package/lib/esm/presentation-common/hierarchy/Key.d.ts.map +1 -1
  296. package/lib/esm/presentation-common/hierarchy/Key.js +14 -8
  297. package/lib/esm/presentation-common/hierarchy/Key.js.map +1 -1
  298. package/lib/esm/presentation-common/hierarchy/Node.d.ts.map +1 -1
  299. package/lib/esm/presentation-common/hierarchy/Node.js +7 -5
  300. package/lib/esm/presentation-common/hierarchy/Node.js.map +1 -1
  301. package/lib/esm/presentation-common/hierarchy/NodePathElement.d.ts.map +1 -1
  302. package/lib/esm/presentation-common/hierarchy/NodePathElement.js +11 -7
  303. package/lib/esm/presentation-common/hierarchy/NodePathElement.js.map +1 -1
  304. package/lib/esm/presentation-common/rules/ClassSpecifications.js +3 -3
  305. package/lib/esm/presentation-common/rules/ClassSpecifications.js.map +1 -1
  306. package/lib/esm/presentation-common/rules/RelatedInstanceSpecification.d.ts +39 -11
  307. package/lib/esm/presentation-common/rules/RelatedInstanceSpecification.d.ts.map +1 -1
  308. package/lib/esm/presentation-common/rules/RelatedInstanceSpecification.js +3 -3
  309. package/lib/esm/presentation-common/rules/RelatedInstanceSpecification.js.map +1 -1
  310. package/lib/esm/presentation-common/rules/RelationshipDirection.js +3 -3
  311. package/lib/esm/presentation-common/rules/RelationshipDirection.js.map +1 -1
  312. package/lib/esm/presentation-common/rules/RelationshipPathSpecification.js +3 -3
  313. package/lib/esm/presentation-common/rules/RelationshipPathSpecification.js.map +1 -1
  314. package/lib/esm/presentation-common/rules/Rule.js +3 -3
  315. package/lib/esm/presentation-common/rules/Rule.js.map +1 -1
  316. package/lib/esm/presentation-common/rules/Ruleset.js +3 -3
  317. package/lib/esm/presentation-common/rules/Ruleset.js.map +1 -1
  318. package/lib/esm/presentation-common/rules/SchemasSpecification.js +3 -3
  319. package/lib/esm/presentation-common/rules/SchemasSpecification.js.map +1 -1
  320. package/lib/esm/presentation-common/rules/Variables.js +3 -3
  321. package/lib/esm/presentation-common/rules/Variables.js.map +1 -1
  322. package/lib/esm/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js +3 -3
  323. package/lib/esm/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js.map +1 -1
  324. package/lib/esm/presentation-common/rules/content/ContentRelatedInstancesSpecification.js +3 -3
  325. package/lib/esm/presentation-common/rules/content/ContentRelatedInstancesSpecification.js.map +1 -1
  326. package/lib/esm/presentation-common/rules/content/ContentRule.js +3 -3
  327. package/lib/esm/presentation-common/rules/content/ContentRule.js.map +1 -1
  328. package/lib/esm/presentation-common/rules/content/ContentSpecification.d.ts.map +1 -1
  329. package/lib/esm/presentation-common/rules/content/ContentSpecification.js +3 -3
  330. package/lib/esm/presentation-common/rules/content/ContentSpecification.js.map +1 -1
  331. package/lib/esm/presentation-common/rules/content/DefaultPropertyCategoryOverride.js +3 -3
  332. package/lib/esm/presentation-common/rules/content/DefaultPropertyCategoryOverride.js.map +1 -1
  333. package/lib/esm/presentation-common/rules/content/PropertySpecification.js +3 -3
  334. package/lib/esm/presentation-common/rules/content/PropertySpecification.js.map +1 -1
  335. package/lib/esm/presentation-common/rules/content/SelectedNodeInstancesSpecification.js +3 -3
  336. package/lib/esm/presentation-common/rules/content/SelectedNodeInstancesSpecification.js.map +1 -1
  337. package/lib/esm/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js +3 -3
  338. package/lib/esm/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js.map +1 -1
  339. package/lib/esm/presentation-common/rules/content/modifiers/ContentModifier.js +3 -3
  340. package/lib/esm/presentation-common/rules/content/modifiers/ContentModifier.js.map +1 -1
  341. package/lib/esm/presentation-common/rules/content/modifiers/CustomRendererSpecification.js +3 -3
  342. package/lib/esm/presentation-common/rules/content/modifiers/CustomRendererSpecification.js.map +1 -1
  343. package/lib/esm/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js +3 -3
  344. package/lib/esm/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js.map +1 -1
  345. package/lib/esm/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.d.ts.map +1 -1
  346. package/lib/esm/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.js +3 -3
  347. package/lib/esm/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.js.map +1 -1
  348. package/lib/esm/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js +3 -3
  349. package/lib/esm/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js.map +1 -1
  350. package/lib/esm/presentation-common/rules/customization/CheckBoxRule.js +3 -3
  351. package/lib/esm/presentation-common/rules/customization/CheckBoxRule.js.map +1 -1
  352. package/lib/esm/presentation-common/rules/customization/CustomizationRule.d.ts +1 -5
  353. package/lib/esm/presentation-common/rules/customization/CustomizationRule.d.ts.map +1 -1
  354. package/lib/esm/presentation-common/rules/customization/CustomizationRule.js +3 -3
  355. package/lib/esm/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
  356. package/lib/esm/presentation-common/rules/customization/ExtendedDataRule.js +3 -3
  357. package/lib/esm/presentation-common/rules/customization/ExtendedDataRule.js.map +1 -1
  358. package/lib/esm/presentation-common/rules/customization/GroupingRule.js +3 -3
  359. package/lib/esm/presentation-common/rules/customization/GroupingRule.js.map +1 -1
  360. package/lib/esm/presentation-common/rules/customization/ImageIdOverride.js +3 -3
  361. package/lib/esm/presentation-common/rules/customization/ImageIdOverride.js.map +1 -1
  362. package/lib/esm/presentation-common/rules/customization/InstanceLabelOverride.d.ts.map +1 -1
  363. package/lib/esm/presentation-common/rules/customization/InstanceLabelOverride.js +3 -3
  364. package/lib/esm/presentation-common/rules/customization/InstanceLabelOverride.js.map +1 -1
  365. package/lib/esm/presentation-common/rules/customization/LabelOverride.js +3 -3
  366. package/lib/esm/presentation-common/rules/customization/LabelOverride.js.map +1 -1
  367. package/lib/esm/presentation-common/rules/customization/SortingRule.js +3 -3
  368. package/lib/esm/presentation-common/rules/customization/SortingRule.js.map +1 -1
  369. package/lib/esm/presentation-common/rules/customization/StyleOverride.js +3 -3
  370. package/lib/esm/presentation-common/rules/customization/StyleOverride.js.map +1 -1
  371. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.js +3 -3
  372. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
  373. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts.map +1 -1
  374. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.js +3 -3
  375. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
  376. package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.js +3 -3
  377. package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
  378. package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js +3 -3
  379. package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
  380. package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js +3 -3
  381. package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
  382. package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.js +3 -3
  383. package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
  384. package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.js +3 -3
  385. package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
  386. package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js +3 -3
  387. package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
  388. package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.js +3 -3
  389. package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
  390. package/lib/esm/presentation-common/rules/hierarchy/SubCondition.js +3 -3
  391. package/lib/esm/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
  392. package/lib/esm/presentation-common/selection/SelectionScope.js +3 -3
  393. package/lib/esm/presentation-common/selection/SelectionScope.js.map +1 -1
  394. package/lib/esm/presentation-common.js +3 -3
  395. package/lib/esm/presentation-common.js.map +1 -1
  396. package/lib/public/locales/en/Presentation.json +1 -1
  397. package/package.json +14 -11
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
6
  /** @packageDocumentation
7
7
  * @module RPC
8
8
  */
@@ -31,7 +31,9 @@ class RpcRequestsHandler {
31
31
  this.timeout = props?.timeout ?? DEFAULT_REQUEST_TIMEOUT;
32
32
  }
33
33
  // eslint-disable-next-line @typescript-eslint/naming-convention
34
- get rpcClient() { return core_common_1.RpcManager.getClientForInterface(PresentationRpcInterface_1.PresentationRpcInterface); }
34
+ get rpcClient() {
35
+ return core_common_1.RpcManager.getClientForInterface(PresentationRpcInterface_1.PresentationRpcInterface);
36
+ }
35
37
  async requestWithTimeout(func, diagnosticsHandler) {
36
38
  const start = core_bentley_1.BeTimePoint.now();
37
39
  const timeout = core_bentley_1.BeDuration.fromMilliseconds(this.timeout);
@@ -41,9 +43,12 @@ class RpcRequestsHandler {
41
43
  const response = await func();
42
44
  diagnostics = response.diagnostics;
43
45
  switch (response.statusCode) {
44
- case Error_1.PresentationStatus.Success: return response.result;
45
- case Error_1.PresentationStatus.BackendTimeout: break;
46
- default: throw new Error_1.PresentationError(response.statusCode, response.errorMessage);
46
+ case Error_1.PresentationStatus.Success:
47
+ return response.result;
48
+ case Error_1.PresentationStatus.BackendTimeout:
49
+ break;
50
+ default:
51
+ throw new Error_1.PresentationError(response.statusCode, response.errorMessage);
47
52
  }
48
53
  }
49
54
  finally {
@@ -78,23 +83,21 @@ class RpcRequestsHandler {
78
83
  async getNodesCount(options) {
79
84
  return this.request(this.rpcClient.getNodesCount.bind(this.rpcClient), options);
80
85
  }
81
- // eslint-disable-next-line deprecation/deprecation
82
86
  async getPagedNodes(options) {
83
87
  // eslint-disable-next-line deprecation/deprecation
84
88
  return this.request(this.rpcClient.getPagedNodes.bind(this.rpcClient), options);
85
89
  }
86
90
  async getNodesDescriptor(options) {
87
91
  const response = await this.request(this.rpcClient.getNodesDescriptor.bind(this.rpcClient), options);
88
- if (typeof response === "string")
92
+ if (typeof response === "string") {
89
93
  return JSON.parse(response);
94
+ }
90
95
  return response;
91
96
  }
92
- // eslint-disable-next-line deprecation/deprecation
93
97
  async getNodePaths(options) {
94
98
  // eslint-disable-next-line deprecation/deprecation
95
99
  return this.request(this.rpcClient.getNodePaths.bind(this.rpcClient), options);
96
100
  }
97
- // eslint-disable-next-line deprecation/deprecation
98
101
  async getFilteredNodePaths(options) {
99
102
  // eslint-disable-next-line deprecation/deprecation
100
103
  return this.request(this.rpcClient.getFilteredNodePaths.bind(this.rpcClient), options);
@@ -114,7 +117,6 @@ class RpcRequestsHandler {
114
117
  async getPagedContentSet(options) {
115
118
  return this.request(this.rpcClient.getPagedContentSet.bind(this.rpcClient), options);
116
119
  }
117
- // eslint-disable-next-line deprecation/deprecation
118
120
  async getPagedDistinctValues(options) {
119
121
  // eslint-disable-next-line deprecation/deprecation
120
122
  return this.request(this.rpcClient.getPagedDistinctValues.bind(this.rpcClient), options);
@@ -142,7 +144,7 @@ class RpcRequestsHandler {
142
144
  }
143
145
  exports.RpcRequestsHandler = RpcRequestsHandler;
144
146
  function isOptionsWithRuleset(options) {
145
- return (typeof options.rulesetOrId === "object");
147
+ return typeof options.rulesetOrId === "object";
146
148
  }
147
149
  const RULESET_SUPPORTED_PROPERTIES_OBJ = {
148
150
  id: true,
@@ -156,10 +158,12 @@ function cleanupRuleset(ruleset) {
156
158
  const cleanedUpRuleset = { ...ruleset };
157
159
  for (const propertyKey of Object.keys(cleanedUpRuleset)) {
158
160
  if (!RULESET_SUPPORTED_PROPERTIES_OBJ.hasOwnProperty(propertyKey)) {
159
- if (propertyKey === "$schema")
161
+ if (propertyKey === "$schema") {
160
162
  delete cleanedUpRuleset[propertyKey];
161
- else
163
+ }
164
+ else {
162
165
  core_bentley_1.Logger.logWarning(CommonLoggerCategory_1.PresentationCommonLoggerCategory.Package, `Provided ruleset contains unrecognized attribute '${propertyKey}'. It either doesn't exist or may be no longer supported.`);
166
+ }
163
167
  }
164
168
  }
165
169
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vD,IAAI,CAAC,gCAAgC,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE;YACjE,IAAI,WAAW,KAAK,SAAS;gBAC3B,OAAQ,gBAAwB,CAAC,WAAW,CAAC,CAAC;;gBAE9C,qBAAM,CAAC,UAAU,CAAC,uDAAgC,CAAC,OAAO,EAAE,qDAAqD,WAAW,2DAA2D,CAAC,CAAC;SAC5L;KACF;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RPC\r\n */\r\n\r\nimport { BeDuration, BeTimePoint, Guid, Logger } from \"@itwin/core-bentley\";\r\nimport { IModelRpcProps, RpcManager } from \"@itwin/core-common\";\r\nimport { PresentationCommonLoggerCategory } from \"./CommonLoggerCategory\";\r\nimport { DescriptorJSON, DescriptorOverrides } from \"./content/Descriptor\";\r\nimport { ItemJSON } from \"./content/Item\";\r\nimport { DisplayValueGroupJSON } from \"./content/Value\";\r\nimport { ClientDiagnostics, ClientDiagnosticsAttribute, ClientDiagnosticsHandler } from \"./Diagnostics\";\r\nimport { InstanceKey } from \"./EC\";\r\nimport { ElementProperties } from \"./ElementProperties\";\r\nimport { PresentationError, PresentationStatus } from \"./Error\";\r\nimport { NodeKey } from \"./hierarchy/Key\";\r\nimport { NodeJSON } from \"./hierarchy/Node\";\r\nimport { NodePathElementJSON } from \"./hierarchy/NodePathElement\";\r\nimport { KeySetJSON } from \"./KeySet\";\r\nimport { LabelDefinition } from \"./LabelDefinition\";\r\nimport {\r\n ComputeSelectionRequestOptions, ContentDescriptorRequestOptions, ContentInstanceKeysRequestOptions, ContentRequestOptions,\r\n ContentSourcesRequestOptions, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DistinctValuesRequestOptions,\r\n FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions,\r\n Paged, RequestOptions, RequestOptionsWithRuleset, SelectionScopeRequestOptions, SingleElementPropertiesRequestOptions,\r\n} from \"./PresentationManagerOptions\";\r\nimport {\r\n ContentSourcesRpcResult, PresentationRpcInterface, PresentationRpcRequestOptions, PresentationRpcResponse,\r\n} from \"./PresentationRpcInterface\";\r\nimport { Ruleset } from \"./rules/Ruleset\";\r\nimport { RulesetVariableJSON } from \"./RulesetVariables\";\r\nimport { SelectionScope } from \"./selection/SelectionScope\";\r\nimport { PagedResponse } from \"./Utils\";\r\n\r\n/**\r\n * Default timeout for how long we're going to wait for RPC request to be fulfilled before throwing\r\n * a timeout error.\r\n */\r\nconst DEFAULT_REQUEST_TIMEOUT = 10 * 60 * 1000; // 10 minutes\r\n\r\n/**\r\n * Configuration parameters for [[RpcRequestsHandler]].\r\n *\r\n * @internal\r\n */\r\nexport interface RpcRequestsHandlerProps {\r\n /**\r\n * Optional ID used to identify client that requests data. If not specified,\r\n * the handler creates a unique GUID as a client id.\r\n * @internal\r\n */\r\n clientId?: string;\r\n\r\n /** @internal */\r\n timeout?: number;\r\n}\r\n\r\n/**\r\n * RPC requests handler that wraps [[PresentationRpcInterface]] and\r\n * adds handling for cases when backend needs to be synced with client\r\n * state.\r\n *\r\n * @internal\r\n */\r\nexport class RpcRequestsHandler {\r\n /** Timeout for how long the handler going to wait for RPC request to be fulfilled before throwing a timeout error. */\r\n public readonly timeout: number;\r\n\r\n /** ID that identifies this handler as a client */\r\n public readonly clientId: string;\r\n\r\n public constructor(props?: RpcRequestsHandlerProps) {\r\n this.clientId = props?.clientId ?? Guid.createValue();\r\n this.timeout = props?.timeout ?? DEFAULT_REQUEST_TIMEOUT;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private get rpcClient(): PresentationRpcInterface { return RpcManager.getClientForInterface(PresentationRpcInterface); }\r\n\r\n private async requestWithTimeout<TResult>(func: () => PresentationRpcResponse<TResult>, diagnosticsHandler?: ClientDiagnosticsHandler): Promise<TResult> {\r\n const start = BeTimePoint.now();\r\n const timeout = BeDuration.fromMilliseconds(this.timeout);\r\n let diagnostics: ClientDiagnostics | undefined;\r\n while (start.plus(timeout).isInFuture) {\r\n try {\r\n const response = await func();\r\n diagnostics = response.diagnostics;\r\n switch (response.statusCode) {\r\n case PresentationStatus.Success: return response.result!;\r\n case PresentationStatus.BackendTimeout: break;\r\n default: throw new PresentationError(response.statusCode, response.errorMessage);\r\n }\r\n } finally {\r\n diagnosticsHandler && diagnostics && diagnosticsHandler(diagnostics);\r\n }\r\n }\r\n throw new PresentationError(PresentationStatus.BackendTimeout);\r\n }\r\n\r\n /**\r\n * Send the request to backend.\r\n *\r\n * If the backend responds with [[PresentationStatus.BackendTimeout]], the request is repeated until we hit `timeout` or get\r\n * a response. If the response is other than [[PresentationStatus.BackendTimeout]] or [[PresentationStatus.Success]], a [[PresentationError]]\r\n * is thrown with the details from the response.\r\n */\r\n public async request<TResult, TOptions extends (RequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute), TArg = any>(\r\n func: (token: IModelRpcProps, options: PresentationRpcRequestOptions<TOptions>, ...args: TArg[]) => PresentationRpcResponse<TResult>,\r\n options: TOptions,\r\n ...additionalOptions: TArg[]\r\n ): Promise<TResult> {\r\n const { imodel, diagnostics, ...optionsNoIModel } = options;\r\n const { handler: diagnosticsHandler, ...diagnosticsOptions } = diagnostics ?? {};\r\n if (isOptionsWithRuleset(optionsNoIModel)) {\r\n optionsNoIModel.rulesetOrId = cleanupRuleset(optionsNoIModel.rulesetOrId);\r\n }\r\n const rpcOptions: PresentationRpcRequestOptions<TOptions> = {\r\n ...optionsNoIModel,\r\n clientId: this.clientId,\r\n };\r\n if (diagnostics) {\r\n rpcOptions.diagnostics = diagnosticsOptions;\r\n }\r\n const doRequest = async () => func(imodel, rpcOptions, ...additionalOptions);\r\n return this.requestWithTimeout(doRequest, diagnosticsHandler);\r\n }\r\n\r\n public async getNodesCount(options: HierarchyRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<number> {\r\n return this.request<number, typeof options>(\r\n this.rpcClient.getNodesCount.bind(this.rpcClient), options);\r\n }\r\n // eslint-disable-next-line deprecation/deprecation\r\n public async getPagedNodes(options: Paged<HierarchyRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON>> & ClientDiagnosticsAttribute): Promise<PagedResponse<NodeJSON>> {\r\n // eslint-disable-next-line deprecation/deprecation\r\n return this.request<PagedResponse<NodeJSON>, typeof options>(\r\n this.rpcClient.getPagedNodes.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getNodesDescriptor(options: HierarchyLevelDescriptorRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<DescriptorJSON | undefined> {\r\n const response = await this.request<string | DescriptorJSON | undefined, typeof options>(\r\n this.rpcClient.getNodesDescriptor.bind(this.rpcClient), options);\r\n if (typeof response === \"string\")\r\n return JSON.parse(response);\r\n return response;\r\n }\r\n\r\n // eslint-disable-next-line deprecation/deprecation\r\n public async getNodePaths(options: FilterByInstancePathsHierarchyRequestOptions<IModelRpcProps, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<NodePathElementJSON[]> {\r\n // eslint-disable-next-line deprecation/deprecation\r\n return this.request<NodePathElementJSON[], typeof options>(\r\n this.rpcClient.getNodePaths.bind(this.rpcClient), options);\r\n }\r\n // eslint-disable-next-line deprecation/deprecation\r\n public async getFilteredNodePaths(options: FilterByTextHierarchyRequestOptions<IModelRpcProps, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<NodePathElementJSON[]> {\r\n // eslint-disable-next-line deprecation/deprecation\r\n return this.request<NodePathElementJSON[], typeof options>(\r\n 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>(\r\n this.rpcClient.getContentSources.bind(this.rpcClient), options);\r\n }\r\n public async getContentDescriptor(options: ContentDescriptorRequestOptions<IModelRpcProps, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<DescriptorJSON | undefined> {\r\n return this.request<DescriptorJSON | undefined, typeof options>(\r\n this.rpcClient.getContentDescriptor.bind(this.rpcClient), options);\r\n }\r\n public async getContentSetSize(options: ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<number> {\r\n return this.request<number, typeof options>(\r\n this.rpcClient.getContentSetSize.bind(this.rpcClient), options);\r\n }\r\n public async getPagedContent(options: Paged<ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute>) {\r\n return this.request<{ descriptor: DescriptorJSON, contentSet: PagedResponse<ItemJSON> } | undefined, typeof options>(\r\n this.rpcClient.getPagedContent.bind(this.rpcClient), options);\r\n }\r\n public async getPagedContentSet(options: Paged<ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute>) {\r\n return this.request<PagedResponse<ItemJSON>, typeof options>(\r\n this.rpcClient.getPagedContentSet.bind(this.rpcClient), options);\r\n }\r\n\r\n // eslint-disable-next-line deprecation/deprecation\r\n public async getPagedDistinctValues(options: DistinctValuesRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<PagedResponse<DisplayValueGroupJSON>> {\r\n // eslint-disable-next-line deprecation/deprecation\r\n return this.request<PagedResponse<DisplayValueGroupJSON>, typeof options>(\r\n this.rpcClient.getPagedDistinctValues.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getElementProperties(options: SingleElementPropertiesRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<ElementProperties | undefined> {\r\n return this.request<ElementProperties | undefined, typeof options>(\r\n this.rpcClient.getElementProperties.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getContentInstanceKeys(options: ContentInstanceKeysRequestOptions<IModelRpcProps, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<{ total: number, items: KeySetJSON }> {\r\n return this.request<{ total: number, items: KeySetJSON }, typeof options>(\r\n this.rpcClient.getContentInstanceKeys.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getDisplayLabelDefinition(options: DisplayLabelRequestOptions<IModelRpcProps, InstanceKey> & ClientDiagnosticsAttribute): Promise<LabelDefinition> {\r\n return this.request<LabelDefinition, typeof options>(\r\n this.rpcClient.getDisplayLabelDefinition.bind(this.rpcClient), options);\r\n }\r\n public async getPagedDisplayLabelDefinitions(options: DisplayLabelsRequestOptions<IModelRpcProps, InstanceKey> & ClientDiagnosticsAttribute): Promise<PagedResponse<LabelDefinition>> {\r\n return this.request<PagedResponse<LabelDefinition>, typeof options>(\r\n this.rpcClient.getPagedDisplayLabelDefinitions.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getSelectionScopes(options: SelectionScopeRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<SelectionScope[]> {\r\n return this.request<SelectionScope[], typeof options>(\r\n this.rpcClient.getSelectionScopes.bind(this.rpcClient), options);\r\n }\r\n public async computeSelection(options: ComputeSelectionRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<KeySetJSON> {\r\n return this.request<KeySetJSON, typeof options>(\r\n // eslint-disable-next-line deprecation/deprecation\r\n this.rpcClient.computeSelection.bind(this.rpcClient), options);\r\n }\r\n}\r\n\r\nfunction isOptionsWithRuleset(options: Object): options is { rulesetOrId: Ruleset } {\r\n return (typeof (options as RequestOptionsWithRuleset<any, any>).rulesetOrId === \"object\");\r\n}\r\n\r\ntype RulesetWithRequiredProperties = {\r\n [key in keyof Ruleset]-?: true;\r\n};\r\n\r\nconst RULESET_SUPPORTED_PROPERTIES_OBJ: RulesetWithRequiredProperties = {\r\n id: true,\r\n rules: true,\r\n version: true,\r\n requiredSchemas: true,\r\n supplementationInfo: true,\r\n vars: true,\r\n};\r\n\r\nfunction cleanupRuleset(ruleset: Ruleset): Ruleset {\r\n const cleanedUpRuleset: Ruleset = { ...ruleset };\r\n\r\n for (const propertyKey of Object.keys(cleanedUpRuleset)) {\r\n if (!RULESET_SUPPORTED_PROPERTIES_OBJ.hasOwnProperty(propertyKey)) {\r\n if (propertyKey === \"$schema\")\r\n delete (cleanedUpRuleset as any)[propertyKey];\r\n else\r\n Logger.logWarning(PresentationCommonLoggerCategory.Package, `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 return cleanedUpRuleset;\r\n}\r\n"]}
1
+ {"version":3,"file":"RpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-common/RpcRequestsHandler.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA4E;AAC5E,oDAAgE;AAChE,iEAA0E;AAO1E,mCAAgE;AAyBhE,yEAAuJ;AAMvJ;;;GAGG;AACH,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAmB7D;;;;;;GAMG;AACH,MAAa,kBAAkB;IAO7B,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,mDAAwB,CAAC,CAAC;IACpE,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAU,IAA4C,EAAE,kBAA6C;QACnI,MAAM,KAAK,GAAG,0BA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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;QACvD,IAAI,CAAC,gCAAgC,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE;YACjE,IAAI,WAAW,KAAK,SAAS,EAAE;gBAC7B,OAAQ,gBAAwB,CAAC,WAAW,CAAC,CAAC;aAC/C;iBAAM;gBACL,qBAAM,CAAC,UAAU,CACf,uDAAgC,CAAC,OAAO,EACxC,qDAAqD,WAAW,2DAA2D,CAC5H,CAAC;aACH;SACF;KACF;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RPC\r\n */\r\n\r\nimport { BeDuration, BeTimePoint, Guid, Logger } from \"@itwin/core-bentley\";\r\nimport { IModelRpcProps, RpcManager } from \"@itwin/core-common\";\r\nimport { PresentationCommonLoggerCategory } from \"./CommonLoggerCategory\";\r\nimport { DescriptorJSON, DescriptorOverrides } from \"./content/Descriptor\";\r\nimport { ItemJSON } from \"./content/Item\";\r\nimport { DisplayValueGroupJSON } from \"./content/Value\";\r\nimport { ClientDiagnostics, ClientDiagnosticsAttribute, ClientDiagnosticsHandler } from \"./Diagnostics\";\r\nimport { InstanceKey } from \"./EC\";\r\nimport { ElementProperties } from \"./ElementProperties\";\r\nimport { PresentationError, PresentationStatus } from \"./Error\";\r\nimport { NodeKey } from \"./hierarchy/Key\";\r\nimport { NodeJSON } from \"./hierarchy/Node\";\r\nimport { NodePathElementJSON } from \"./hierarchy/NodePathElement\";\r\nimport { KeySetJSON } from \"./KeySet\";\r\nimport { LabelDefinition } from \"./LabelDefinition\";\r\nimport {\r\n ComputeSelectionRequestOptions,\r\n ContentDescriptorRequestOptions,\r\n ContentInstanceKeysRequestOptions,\r\n ContentRequestOptions,\r\n ContentSourcesRequestOptions,\r\n DisplayLabelRequestOptions,\r\n DisplayLabelsRequestOptions,\r\n DistinctValuesRequestOptions,\r\n FilterByInstancePathsHierarchyRequestOptions,\r\n FilterByTextHierarchyRequestOptions,\r\n HierarchyLevelDescriptorRequestOptions,\r\n HierarchyRequestOptions,\r\n Paged,\r\n RequestOptions,\r\n RequestOptionsWithRuleset,\r\n SelectionScopeRequestOptions,\r\n SingleElementPropertiesRequestOptions,\r\n} from \"./PresentationManagerOptions\";\r\nimport { ContentSourcesRpcResult, PresentationRpcInterface, PresentationRpcRequestOptions, PresentationRpcResponse } from \"./PresentationRpcInterface\";\r\nimport { Ruleset } from \"./rules/Ruleset\";\r\nimport { RulesetVariableJSON } from \"./RulesetVariables\";\r\nimport { SelectionScope } from \"./selection/SelectionScope\";\r\nimport { PagedResponse } from \"./Utils\";\r\n\r\n/**\r\n * Default timeout for how long we're going to wait for RPC request to be fulfilled before throwing\r\n * a timeout error.\r\n */\r\nconst DEFAULT_REQUEST_TIMEOUT = 10 * 60 * 1000; // 10 minutes\r\n\r\n/**\r\n * Configuration parameters for [[RpcRequestsHandler]].\r\n *\r\n * @internal\r\n */\r\nexport interface RpcRequestsHandlerProps {\r\n /**\r\n * Optional ID used to identify client that requests data. If not specified,\r\n * the handler creates a unique GUID as a client id.\r\n * @internal\r\n */\r\n clientId?: string;\r\n\r\n /** @internal */\r\n timeout?: number;\r\n}\r\n\r\n/**\r\n * RPC requests handler that wraps [[PresentationRpcInterface]] and\r\n * adds handling for cases when backend needs to be synced with client\r\n * state.\r\n *\r\n * @internal\r\n */\r\nexport class RpcRequestsHandler {\r\n /** Timeout for how long the handler going to wait for RPC request to be fulfilled before throwing a timeout error. */\r\n public readonly timeout: number;\r\n\r\n /** ID that identifies this handler as a client */\r\n public readonly clientId: string;\r\n\r\n public constructor(props?: RpcRequestsHandlerProps) {\r\n this.clientId = props?.clientId ?? Guid.createValue();\r\n this.timeout = props?.timeout ?? DEFAULT_REQUEST_TIMEOUT;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private get rpcClient(): PresentationRpcInterface {\r\n return RpcManager.getClientForInterface(PresentationRpcInterface);\r\n }\r\n\r\n private async requestWithTimeout<TResult>(func: () => PresentationRpcResponse<TResult>, diagnosticsHandler?: ClientDiagnosticsHandler): Promise<TResult> {\r\n const start = BeTimePoint.now();\r\n const timeout = BeDuration.fromMilliseconds(this.timeout);\r\n let diagnostics: ClientDiagnostics | undefined;\r\n while (start.plus(timeout).isInFuture) {\r\n try {\r\n const response = await func();\r\n diagnostics = response.diagnostics;\r\n switch (response.statusCode) {\r\n case PresentationStatus.Success:\r\n return response.result!;\r\n case PresentationStatus.BackendTimeout:\r\n break;\r\n default:\r\n throw new PresentationError(response.statusCode, response.errorMessage);\r\n }\r\n } finally {\r\n diagnosticsHandler && diagnostics && diagnosticsHandler(diagnostics);\r\n }\r\n }\r\n throw new PresentationError(PresentationStatus.BackendTimeout);\r\n }\r\n\r\n /**\r\n * Send the request to backend.\r\n *\r\n * If the backend responds with [[PresentationStatus.BackendTimeout]], the request is repeated until we hit `timeout` or get\r\n * a response. If the response is other than [[PresentationStatus.BackendTimeout]] or [[PresentationStatus.Success]], a [[PresentationError]]\r\n * is thrown with the details from the response.\r\n */\r\n public async request<TResult, TOptions extends RequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute, TArg = any>(\r\n func: (token: IModelRpcProps, options: PresentationRpcRequestOptions<TOptions>, ...args: TArg[]) => PresentationRpcResponse<TResult>,\r\n options: TOptions,\r\n ...additionalOptions: TArg[]\r\n ): Promise<TResult> {\r\n const { imodel, diagnostics, ...optionsNoIModel } = options;\r\n const { handler: diagnosticsHandler, ...diagnosticsOptions } = diagnostics ?? {};\r\n if (isOptionsWithRuleset(optionsNoIModel)) {\r\n optionsNoIModel.rulesetOrId = cleanupRuleset(optionsNoIModel.rulesetOrId);\r\n }\r\n const rpcOptions: PresentationRpcRequestOptions<TOptions> = {\r\n ...optionsNoIModel,\r\n clientId: this.clientId,\r\n };\r\n if (diagnostics) {\r\n rpcOptions.diagnostics = diagnosticsOptions;\r\n }\r\n const doRequest = async () => func(imodel, rpcOptions, ...additionalOptions);\r\n return this.requestWithTimeout(doRequest, diagnosticsHandler);\r\n }\r\n\r\n public async getNodesCount(options: HierarchyRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<number> {\r\n return this.request<number, typeof options>(this.rpcClient.getNodesCount.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getPagedNodes(\r\n options: Paged<HierarchyRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON>> & ClientDiagnosticsAttribute,\r\n // eslint-disable-next-line deprecation/deprecation\r\n ): Promise<PagedResponse<NodeJSON>> {\r\n // eslint-disable-next-line deprecation/deprecation\r\n return this.request<PagedResponse<NodeJSON>, typeof options>(this.rpcClient.getPagedNodes.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getNodesDescriptor(\r\n options: HierarchyLevelDescriptorRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<DescriptorJSON | undefined> {\r\n const response = await this.request<string | DescriptorJSON | undefined, typeof options>(this.rpcClient.getNodesDescriptor.bind(this.rpcClient), options);\r\n if (typeof response === \"string\") {\r\n return JSON.parse(response);\r\n }\r\n return response;\r\n }\r\n\r\n public async getNodePaths(\r\n options: FilterByInstancePathsHierarchyRequestOptions<IModelRpcProps, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n // eslint-disable-next-line deprecation/deprecation\r\n ): Promise<NodePathElementJSON[]> {\r\n // eslint-disable-next-line deprecation/deprecation\r\n return this.request<NodePathElementJSON[], typeof options>(this.rpcClient.getNodePaths.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getFilteredNodePaths(\r\n options: FilterByTextHierarchyRequestOptions<IModelRpcProps, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n // eslint-disable-next-line deprecation/deprecation\r\n ): Promise<NodePathElementJSON[]> {\r\n // eslint-disable-next-line deprecation/deprecation\r\n return this.request<NodePathElementJSON[], typeof options>(this.rpcClient.getFilteredNodePaths.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getContentSources(options: ContentSourcesRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<ContentSourcesRpcResult> {\r\n 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 // eslint-disable-next-line deprecation/deprecation\r\n ): Promise<PagedResponse<DisplayValueGroupJSON>> {\r\n // eslint-disable-next-line deprecation/deprecation\r\n return this.request<PagedResponse<DisplayValueGroupJSON>, typeof options>(this.rpcClient.getPagedDistinctValues.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getElementProperties(\r\n options: SingleElementPropertiesRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute,\r\n ): Promise<ElementProperties | undefined> {\r\n return this.request<ElementProperties | undefined, typeof options>(this.rpcClient.getElementProperties.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 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>(\r\n // eslint-disable-next-line deprecation/deprecation\r\n this.rpcClient.computeSelection.bind(this.rpcClient),\r\n options,\r\n );\r\n }\r\n}\r\n\r\nfunction isOptionsWithRuleset(options: Object): options is { rulesetOrId: Ruleset } {\r\n return typeof (options as RequestOptionsWithRuleset<any, any>).rulesetOrId === \"object\";\r\n}\r\n\r\ntype RulesetWithRequiredProperties = {\r\n [key in keyof Ruleset]-?: true;\r\n};\r\n\r\nconst RULESET_SUPPORTED_PROPERTIES_OBJ: RulesetWithRequiredProperties = {\r\n id: true,\r\n rules: true,\r\n version: true,\r\n requiredSchemas: true,\r\n supplementationInfo: true,\r\n vars: true,\r\n};\r\n\r\nfunction cleanupRuleset(ruleset: Ruleset): Ruleset {\r\n const cleanedUpRuleset: Ruleset = { ...ruleset };\r\n\r\n for (const propertyKey of Object.keys(cleanedUpRuleset)) {\r\n if (!RULESET_SUPPORTED_PROPERTIES_OBJ.hasOwnProperty(propertyKey)) {\r\n if (propertyKey === \"$schema\") {\r\n delete (cleanedUpRuleset as any)[propertyKey];\r\n } else {\r\n Logger.logWarning(\r\n PresentationCommonLoggerCategory.Package,\r\n `Provided ruleset contains unrecognized attribute '${propertyKey}'. It either doesn't exist or may be no longer supported.`,\r\n );\r\n }\r\n }\r\n }\r\n\r\n return cleanedUpRuleset;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":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AAmB,GAAG,eAAe,CAQnE;CACF"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
6
  /** @packageDocumentation
7
7
  * @module Core
8
8
  */
@@ -37,16 +37,18 @@ var RulesetVariable;
37
37
  * Note: In case of [[Id64sRulesetVariable]], this method expects IDs are sorted. See [[OrderedId64Iterable.sortArray]].
38
38
  */
39
39
  function toJSON(variable) {
40
- if (variable.type === VariableValueTypes.Id64Array)
40
+ if (variable.type === VariableValueTypes.Id64Array) {
41
41
  return { ...variable, value: core_bentley_1.CompressedId64Set.compressArray(variable.value) };
42
+ }
42
43
  return variable;
43
44
  }
44
45
  RulesetVariable.toJSON = toJSON;
45
46
  /** Deserialize [[RulesetVariable]] from JSON. */
46
47
  function fromJSON(json) {
47
48
  if (json.type === VariableValueTypes.Id64Array) {
48
- if (typeof json.value === "string")
49
+ if (typeof json.value === "string") {
49
50
  return { ...json, value: core_bentley_1.CompressedId64Set.decompressArray(json.value) };
51
+ }
50
52
  return json; // for some reason TS doesn't understand that `json.value` is always an array here
51
53
  }
52
54
  return json;
@@ -1 +1 @@
1
- {"version":3,"file":"RulesetVariables.js","sourceRoot":"","sources":["../../../src/presentation-common/RulesetVariables.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;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,GAAlB,0BAAkB,KAAlB,0BAAkB,QAkB7B;AAkJD,cAAc;AACd,2DAA2D;AAC3D,IAAiB,eAAe,CAoB/B;AApBD,WAAiB,eAAe;IAC9B;;;OAGG;IACH,SAAgB,MAAM,CAAC,QAAyB;QAC9C,IAAI,QAAQ,CAAC,IAAI,KAAK,kBAAkB,CAAC,SAAS;YAChD,OAAO,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,gCAAiB,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACjF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAJe,sBAAM,SAIrB,CAAA;IAED,iDAAiD;IACjD,SAAgB,QAAQ,CAAC,IAAyB;QAChD,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAkB,CAAC,SAAS,EAAE;YAC9C,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;gBAChC,OAAO,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,gCAAiB,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3E,OAAO,IAAW,CAAC,CAAC,kFAAkF;SACvG;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAPe,wBAAQ,WAOvB,CAAA;AACH,CAAC,EApBgB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAoB/B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { CompressedId64Set, Id64String } from \"@itwin/core-bentley\";\r\n\r\n/**\r\n * Possible variable value types\r\n * @public\r\n */\r\nexport enum VariableValueTypes {\r\n /** Integer value */\r\n Int = \"int\",\r\n\r\n /** Array of integer values */\r\n IntArray = \"int[]\",\r\n\r\n /** Boolean value */\r\n Bool = \"bool\",\r\n\r\n /** String value */\r\n String = \"string\",\r\n\r\n /** Id64String value */\r\n Id64 = \"id64\",\r\n\r\n /** Array of Id64String values */\r\n Id64Array = \"id64[]\",\r\n}\r\n\r\n/**\r\n * Union of all supported variable value types\r\n * @public\r\n */\r\nexport type VariableValue = boolean | string | number | number[] | Id64String | Id64String[];\r\n\r\n/**\r\n * JSON representation of [[VariableValue]]\r\n * @public\r\n */\r\nexport type VariableValueJSON = boolean | string | number | number[] | Id64String | Id64String[] | CompressedId64Set;\r\n\r\n/**\r\n * Base data structure for representing ruleset variables.\r\n * @public\r\n */\r\nexport interface RulesetVariableBase {\r\n id: string;\r\n type: VariableValueTypes;\r\n value: VariableValue;\r\n}\r\n/**\r\n * Data structure for representing boolean ruleset variables.\r\n * @public\r\n */\r\nexport interface BooleanRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.Bool;\r\n value: boolean;\r\n}\r\n/**\r\n * Data structure for representing string ruleset variables.\r\n * @public\r\n */\r\nexport interface StringRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.String;\r\n value: string;\r\n}\r\n/**\r\n * Data structure for representing int ruleset variables.\r\n * @public\r\n */\r\nexport interface IntRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.Int;\r\n value: number;\r\n}\r\n/**\r\n * Data structure for representing int array ruleset variables.\r\n * @public\r\n */\r\nexport interface IntsRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.IntArray;\r\n value: number[];\r\n}\r\n/**\r\n * Data structure for representing ID ruleset variables.\r\n * @public\r\n */\r\nexport interface Id64RulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.Id64;\r\n value: Id64String;\r\n}\r\n/**\r\n * Data structure for representing ID array ruleset variables.\r\n * @public\r\n */\r\nexport interface Id64sRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.Id64Array;\r\n value: Id64String[];\r\n}\r\n/**\r\n * Data structure for representing ruleset variables.\r\n * @public\r\n */\r\nexport type RulesetVariable = BooleanRulesetVariable | StringRulesetVariable | IntRulesetVariable | IntsRulesetVariable | Id64RulesetVariable | Id64sRulesetVariable;\r\n\r\n/**\r\n * JSON representation of [[RulesetVariableBase]].\r\n * @public\r\n */\r\nexport interface RulesetVariableBaseJSON {\r\n id: string;\r\n type: VariableValueTypes;\r\n value: VariableValueJSON;\r\n}\r\n/**\r\n * JSON representation of [[BooleanRulesetVariable]].\r\n * @public\r\n * @deprecated in 3.x. Use [[BooleanRulesetVariable]]\r\n */\r\nexport interface BooleanRulesetVariableJSON extends RulesetVariableBaseJSON {\r\n type: VariableValueTypes.Bool;\r\n value: boolean;\r\n}\r\n/**\r\n * JSON representation of [[StringRulesetVariable]].\r\n * @public\r\n * @deprecated in 3.x. Use [[StringRulesetVariable]]\r\n */\r\nexport interface StringRulesetVariableJSON extends RulesetVariableBaseJSON {\r\n type: VariableValueTypes.String;\r\n value: string;\r\n}\r\n/**\r\n * JSON representation of [[IntRulesetVariable]].\r\n * @public\r\n * @deprecated in 3.x. Use [[IntRulesetVariable]]\r\n */\r\nexport interface IntRulesetVariableJSON extends RulesetVariableBaseJSON {\r\n type: VariableValueTypes.Int;\r\n value: number;\r\n}\r\n/**\r\n * JSON representation of [[IntsRulesetVariable]].\r\n * @public\r\n * @deprecated in 3.x. Use [[IntsRulesetVariable]]\r\n */\r\nexport interface IntsRulesetVariableJSON extends RulesetVariableBaseJSON {\r\n type: VariableValueTypes.IntArray;\r\n value: number[];\r\n}\r\n/**\r\n * JSON representation of [[Id64RulesetVariable]].\r\n * @public\r\n * @deprecated in 3.x. Use [[Id64RulesetVariable]]\r\n */\r\nexport interface Id64RulesetVariableJSON extends RulesetVariableBaseJSON {\r\n type: VariableValueTypes.Id64;\r\n value: Id64String;\r\n}\r\n/**\r\n * JSON representation of [[Id64sRulesetVariable]].\r\n * @public\r\n */\r\nexport interface Id64sRulesetVariableJSON extends RulesetVariableBaseJSON {\r\n type: VariableValueTypes.Id64Array;\r\n value: Id64String[] | CompressedId64Set;\r\n}\r\n/**\r\n * JSON representation of [[RulesetVariable]].\r\n * @public\r\n */\r\n// eslint-disable-next-line deprecation/deprecation\r\nexport type RulesetVariableJSON = BooleanRulesetVariableJSON | StringRulesetVariableJSON | IntRulesetVariableJSON | IntsRulesetVariableJSON | Id64RulesetVariableJSON | Id64sRulesetVariableJSON;\r\n\r\n/** @public */\r\n// eslint-disable-next-line @typescript-eslint/no-redeclare\r\nexport namespace RulesetVariable {\r\n /**\r\n * Serialize given RulesetVariable to JSON.\r\n * Note: In case of [[Id64sRulesetVariable]], this method expects IDs are sorted. See [[OrderedId64Iterable.sortArray]].\r\n */\r\n export function toJSON(variable: RulesetVariable): RulesetVariableJSON {\r\n if (variable.type === VariableValueTypes.Id64Array)\r\n return { ...variable, value: CompressedId64Set.compressArray(variable.value) };\r\n return variable;\r\n }\r\n\r\n /** Deserialize [[RulesetVariable]] from JSON. */\r\n export function fromJSON(json: RulesetVariableJSON): RulesetVariable {\r\n if (json.type === VariableValueTypes.Id64Array) {\r\n if (typeof json.value === \"string\")\r\n return { ...json, value: CompressedId64Set.decompressArray(json.value) };\r\n return json as any; // for some reason TS doesn't understand that `json.value` is always an array here\r\n }\r\n return json;\r\n }\r\n}\r\n"]}
1
+ {"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,GAAlB,0BAAkB,KAAlB,0BAAkB,QAkB7B;AA8JD,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;YAClD,OAAO,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,gCAAiB,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;SAChF;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;YAC9C,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE;gBAClC,OAAO,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,gCAAiB,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;aAC1E;YACD,OAAO,IAAW,CAAC,CAAC,kFAAkF;SACvG;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IARe,wBAAQ,WAQvB,CAAA;AACH,CAAC,EAtBgB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAsB/B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { CompressedId64Set, Id64String } from \"@itwin/core-bentley\";\r\n\r\n/**\r\n * Possible variable value types\r\n * @public\r\n */\r\nexport enum VariableValueTypes {\r\n /** Integer value */\r\n Int = \"int\",\r\n\r\n /** Array of integer values */\r\n IntArray = \"int[]\",\r\n\r\n /** Boolean value */\r\n Bool = \"bool\",\r\n\r\n /** String value */\r\n String = \"string\",\r\n\r\n /** Id64String value */\r\n Id64 = \"id64\",\r\n\r\n /** Array of Id64String values */\r\n Id64Array = \"id64[]\",\r\n}\r\n\r\n/**\r\n * Union of all supported variable value types\r\n * @public\r\n */\r\nexport type VariableValue = boolean | string | number | number[] | Id64String | Id64String[];\r\n\r\n/**\r\n * JSON representation of [[VariableValue]]\r\n * @public\r\n */\r\nexport type VariableValueJSON = boolean | string | number | number[] | Id64String | Id64String[] | CompressedId64Set;\r\n\r\n/**\r\n * Base data structure for representing ruleset variables.\r\n * @public\r\n */\r\nexport interface RulesetVariableBase {\r\n id: string;\r\n type: VariableValueTypes;\r\n value: VariableValue;\r\n}\r\n/**\r\n * Data structure for representing boolean ruleset variables.\r\n * @public\r\n */\r\nexport interface BooleanRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.Bool;\r\n value: boolean;\r\n}\r\n/**\r\n * Data structure for representing string ruleset variables.\r\n * @public\r\n */\r\nexport interface StringRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.String;\r\n value: string;\r\n}\r\n/**\r\n * Data structure for representing int ruleset variables.\r\n * @public\r\n */\r\nexport interface IntRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.Int;\r\n value: number;\r\n}\r\n/**\r\n * Data structure for representing int array ruleset variables.\r\n * @public\r\n */\r\nexport interface IntsRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.IntArray;\r\n value: number[];\r\n}\r\n/**\r\n * Data structure for representing ID ruleset variables.\r\n * @public\r\n */\r\nexport interface Id64RulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.Id64;\r\n value: Id64String;\r\n}\r\n/**\r\n * Data structure for representing ID array ruleset variables.\r\n * @public\r\n */\r\nexport interface Id64sRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.Id64Array;\r\n value: Id64String[];\r\n}\r\n/**\r\n * Data structure for representing ruleset variables.\r\n * @public\r\n */\r\nexport type RulesetVariable =\r\n | BooleanRulesetVariable\r\n | StringRulesetVariable\r\n | IntRulesetVariable\r\n | IntsRulesetVariable\r\n | Id64RulesetVariable\r\n | Id64sRulesetVariable;\r\n\r\n/**\r\n * JSON representation of [[RulesetVariableBase]].\r\n * @public\r\n */\r\nexport interface RulesetVariableBaseJSON {\r\n id: string;\r\n type: VariableValueTypes;\r\n value: VariableValueJSON;\r\n}\r\n/**\r\n * JSON representation of [[BooleanRulesetVariable]].\r\n * @public\r\n * @deprecated in 3.x. Use [[BooleanRulesetVariable]]\r\n */\r\nexport interface BooleanRulesetVariableJSON extends RulesetVariableBaseJSON {\r\n type: VariableValueTypes.Bool;\r\n value: boolean;\r\n}\r\n/**\r\n * JSON representation of [[StringRulesetVariable]].\r\n * @public\r\n * @deprecated in 3.x. Use [[StringRulesetVariable]]\r\n */\r\nexport interface StringRulesetVariableJSON extends RulesetVariableBaseJSON {\r\n type: VariableValueTypes.String;\r\n value: string;\r\n}\r\n/**\r\n * JSON representation of [[IntRulesetVariable]].\r\n * @public\r\n * @deprecated in 3.x. Use [[IntRulesetVariable]]\r\n */\r\nexport interface IntRulesetVariableJSON extends RulesetVariableBaseJSON {\r\n type: VariableValueTypes.Int;\r\n value: number;\r\n}\r\n/**\r\n * JSON representation of [[IntsRulesetVariable]].\r\n * @public\r\n * @deprecated in 3.x. Use [[IntsRulesetVariable]]\r\n */\r\nexport interface IntsRulesetVariableJSON extends RulesetVariableBaseJSON {\r\n type: VariableValueTypes.IntArray;\r\n value: number[];\r\n}\r\n/**\r\n * JSON representation of [[Id64RulesetVariable]].\r\n * @public\r\n * @deprecated in 3.x. Use [[Id64RulesetVariable]]\r\n */\r\nexport interface Id64RulesetVariableJSON extends RulesetVariableBaseJSON {\r\n type: VariableValueTypes.Id64;\r\n value: Id64String;\r\n}\r\n/**\r\n * JSON representation of [[Id64sRulesetVariable]].\r\n * @public\r\n */\r\nexport interface Id64sRulesetVariableJSON extends RulesetVariableBaseJSON {\r\n type: VariableValueTypes.Id64Array;\r\n value: Id64String[] | CompressedId64Set;\r\n}\r\n/**\r\n * JSON representation of [[RulesetVariable]].\r\n * @public\r\n */\r\n\r\nexport type RulesetVariableJSON =\r\n | BooleanRulesetVariableJSON // eslint-disable-line deprecation/deprecation\r\n | StringRulesetVariableJSON // eslint-disable-line deprecation/deprecation\r\n | IntRulesetVariableJSON // eslint-disable-line deprecation/deprecation\r\n | IntsRulesetVariableJSON // eslint-disable-line deprecation/deprecation\r\n | Id64RulesetVariableJSON // eslint-disable-line deprecation/deprecation\r\n | Id64sRulesetVariableJSON;\r\n\r\n/** @public */\r\n// eslint-disable-next-line @typescript-eslint/no-redeclare\r\nexport namespace RulesetVariable {\r\n /**\r\n * Serialize given RulesetVariable to JSON.\r\n * Note: In case of [[Id64sRulesetVariable]], this method expects IDs are sorted. See [[OrderedId64Iterable.sortArray]].\r\n */\r\n export function toJSON(variable: RulesetVariable): RulesetVariableJSON {\r\n if (variable.type === VariableValueTypes.Id64Array) {\r\n return { ...variable, value: CompressedId64Set.compressArray(variable.value) };\r\n }\r\n return variable;\r\n }\r\n\r\n /** Deserialize [[RulesetVariable]] from JSON. */\r\n export function fromJSON(json: RulesetVariableJSON): RulesetVariable {\r\n if (json.type === VariableValueTypes.Id64Array) {\r\n if (typeof json.value === \"string\") {\r\n return { ...json, value: CompressedId64Set.decompressArray(json.value) };\r\n }\r\n return json as any; // for some reason TS doesn't understand that `json.value` is always an array here\r\n }\r\n return json;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RulesetsFactory.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/RulesetsFactory.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,KAAK,EAAmB,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC,OAAO,EAAa,WAAW,EAAoB,MAAM,M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AE,2BAA2B,GAChD,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CAKtD;AAED;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAOjI;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,WAAW,GAAG,SAAS,CAAC;AAGjG,KAAK,KAAK,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
6
  /** @packageDocumentation
7
7
  * @module Core
8
8
  */
@@ -23,16 +23,21 @@ const Rule_1 = require("./rules/Rule");
23
23
  */
24
24
  class RulesetsFactory {
25
25
  createSimilarInstancesRulesetInfo(field, record) {
26
- if (!field.isPropertiesField())
26
+ if (!field.isPropertiesField()) {
27
27
  throw new Error("Can only create 'similar instances' ruleset for properties-based records");
28
- if (field.type.valueFormat !== TypeDescription_1.PropertyValueFormat.Primitive)
28
+ }
29
+ if (field.type.valueFormat !== TypeDescription_1.PropertyValueFormat.Primitive) {
29
30
  throw new Error("Can only create 'similar instances' ruleset for primitive properties");
30
- if (field.properties.length === 0)
31
+ }
32
+ if (field.properties.length === 0) {
31
33
  throw new Error("Invalid properties' field with no properties");
32
- if (record.isFieldMerged(field.name))
34
+ }
35
+ if (record.isFieldMerged(field.name)) {
33
36
  throw new Error("Can't create 'similar instances' ruleset for merged values");
34
- if (!record.classInfo)
37
+ }
38
+ if (!record.classInfo) {
35
39
  throw new Error("Can't create 'similar instances' for records based on multiple different ECClass instances");
40
+ }
36
41
  const propertyName = getPropertyName(field);
37
42
  const propertyValue = getPropertyValue(record, field);
38
43
  const relatedInstanceInfo = createRelatedInstanceSpecInfo(field);
@@ -43,12 +48,14 @@ class RulesetsFactory {
43
48
  };
44
49
  ruleset.rules.push({
45
50
  ruleType: Rule_1.RuleTypes.Content,
46
- specifications: [{
51
+ specifications: [
52
+ {
47
53
  specType: ContentSpecification_1.ContentSpecificationTypes.ContentInstancesOfSpecificClasses,
48
54
  classes: createMultiClassSpecification(record.classInfo),
49
55
  relatedInstances: relatedInstanceInfo ? [relatedInstanceInfo.spec] : [],
50
56
  instanceFilter: createInstanceFilter(relatedInstanceInfo?.spec, field.type, propertyName, propertyValue.raw),
51
- }],
57
+ },
58
+ ],
52
59
  });
53
60
  return { ruleset, relatedClass, propertyName, propertyValue };
54
61
  }
@@ -68,8 +75,9 @@ class RulesetsFactory {
68
75
  }
69
76
  exports.RulesetsFactory = RulesetsFactory;
70
77
  const toString = (displayValue) => {
71
- if (!displayValue)
78
+ if (!displayValue) {
72
79
  return "NULL";
80
+ }
73
81
  return displayValue.toString();
74
82
  };
75
83
  const createDescription = (record, relatedClass, field, value) => {
@@ -82,8 +90,9 @@ const createDescriptionAsync = async (record, relatedClass, field, value, comput
82
90
  };
83
91
  const getPropertyName = (field) => {
84
92
  let name = field.properties[0].property.name;
85
- if (field.type.typeName === "navigation")
93
+ if (field.type.typeName === "navigation") {
86
94
  name += ".Id";
95
+ }
87
96
  return name;
88
97
  };
89
98
  const isPrimitivePropertyValue = (value) => {
@@ -91,9 +100,7 @@ const isPrimitivePropertyValue = (value) => {
91
100
  return true;
92
101
  }
93
102
  if (Value_1.Value.isMap(value)) {
94
- if (typeof value.x === "number"
95
- && typeof value.y === "number"
96
- && (value.z === undefined || typeof value.z === "number")) {
103
+ if (typeof value.x === "number" && typeof value.y === "number" && (value.z === undefined || typeof value.z === "number")) {
97
104
  return true;
98
105
  }
99
106
  if (typeof value.className === "string" && typeof value.id === "string") {
@@ -114,18 +121,22 @@ const getPropertyValue = (record, field) => {
114
121
  let value = record.values[currFieldName];
115
122
  currFieldName = fieldNamesStack.pop();
116
123
  while (currFieldName) {
117
- if (!Value_1.Value.isNestedContent(value) || value.length === 0)
124
+ if (!Value_1.Value.isNestedContent(value) || value.length === 0) {
118
125
  throw new Error("Invalid record value");
119
- if (value.length > 1)
126
+ }
127
+ if (value.length > 1) {
120
128
  throw new Error("Can't create 'similar instances' for records related through many part of *-to-many relationship");
121
- if (value[0].mergedFieldNames.indexOf(currFieldName) !== -1)
129
+ }
130
+ if (value[0].mergedFieldNames.indexOf(currFieldName) !== -1) {
122
131
  throw new Error("Can't create 'similar instances' ruleset for merged values");
132
+ }
123
133
  displayValue = value[0].displayValues[currFieldName];
124
134
  value = value[0].values[currFieldName];
125
135
  currFieldName = fieldNamesStack.pop();
126
136
  }
127
- if (!isPrimitivePropertyValue(value))
137
+ if (!isPrimitivePropertyValue(value)) {
128
138
  throw new Error("Can only create 'similar instances' ruleset for primitive values");
139
+ }
129
140
  return { raw: value, display: toString(displayValue) };
130
141
  };
131
142
  const createInstanceFilter = (relatedInstanceSpec, propertyType, propertyName, propertyValue) => {
@@ -148,12 +159,14 @@ const createComparison = (type, name, operator, value) => {
148
159
  compareValue = value.toString();
149
160
  break;
150
161
  }
151
- if (type.typeName === "navigation" && typeof value === "object" && core_bentley_1.Id64.isId64(value.id))
162
+ if (type.typeName === "navigation" && typeof value === "object" && core_bentley_1.Id64.isId64(value.id)) {
152
163
  // note: this is temporary until we support hex ids in instance filters
153
164
  compareValue = hexToDec(value.id);
165
+ }
154
166
  if (type.typeName === "point2d" || type.typeName === "point3d") {
155
- if (typeof value !== "object")
167
+ if (typeof value !== "object") {
156
168
  throw new Error("Expecting point values to be supplied as objects");
169
+ }
157
170
  const dimensionType = {
158
171
  valueFormat: TypeDescription_1.PropertyValueFormat.Primitive,
159
172
  typeName: "double",
@@ -161,14 +174,17 @@ const createComparison = (type, name, operator, value) => {
161
174
  const pointValue = value;
162
175
  let comparison = `${createComparison(dimensionType, `${name}.x`, operator, pointValue.x)}`;
163
176
  comparison += ` AND ${createComparison(dimensionType, `${name}.y`, operator, pointValue.y)}`;
164
- if (type.typeName === "point3d" && pointValue.z !== undefined)
177
+ if (type.typeName === "point3d" && pointValue.z !== undefined) {
165
178
  comparison += ` AND ${createComparison(dimensionType, `${name}.z`, operator, pointValue.z)}`;
179
+ }
166
180
  return comparison;
167
181
  }
168
- if (type.typeName === "double")
182
+ if (type.typeName === "double") {
169
183
  return `CompareDoubles(${name}, ${compareValue}) ${operator} 0`;
170
- if (type.typeName === "dateTime")
184
+ }
185
+ if (type.typeName === "dateTime") {
171
186
  return `CompareDateTimes(${name}, ${compareValue}) ${operator} 0`;
187
+ }
172
188
  return `${name} ${operator} ${compareValue}`;
173
189
  };
174
190
  const createMultiClassSpecification = (classInfo) => {
@@ -210,12 +226,12 @@ const hexToDec = (id) => {
210
226
  let carry = parseInt(id.charAt(i), 16);
211
227
  for (let j = 0; j < digits.length; ++j) {
212
228
  digits[j] = digits[j] * 16 + carry;
213
- carry = digits[j] / 10 | 0;
229
+ carry = (digits[j] / 10) | 0;
214
230
  digits[j] %= 10;
215
231
  }
216
232
  while (carry > 0) {
217
233
  digits.push(carry % 10);
218
- carry = carry / 10 | 0;
234
+ carry = (carry / 10) | 0;
219
235
  }
220
236
  }
221
237
  return digits.reverse().join("");
@@ -1 +1 @@
1
- {"version":3,"file":"RulesetsFactory.js","sourceRoot":"","sources":["../../../src/presentation-common/RulesetsFactory.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6D;AAG7D,+DAA0F;AAC1F,2C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F,MAAM,6BAA6B,GAAG,CAAC,KAAsB,EAAwE,EAAE;IACrI,MAAM,IAAI,GAAG,mCAAmC,CAAC,KAAK,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,yBAAyB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACtE,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,EAAc,EAAE,EAAE;IAClC,MAAM,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;QAClC,IAAI,KAAK,GAAG,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;YACtC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;YACnC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YAC3B,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACjB;QACD,OAAO,KAAK,GAAG,CAAC,EAAE;YAChB,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;YACxB,KAAK,GAAG,KAAK,GAAG,EAAE,GAAG,CAAC,CAAC;SACxB;KACF;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\";\r\nimport { Item } from \"./content/Item\";\r\nimport { PrimitiveTypeDescription, PropertyValueFormat } from \"./content/TypeDescription\";\r\nimport { DisplayValue, Value } from \"./content/Value\";\r\nimport { ClassInfo, InstanceKey, RelationshipPath } from \"./EC\";\r\nimport { MultiSchemaClassesSpecification, SingleSchemaClassSpecification } from \"./rules/ClassSpecifications\";\r\nimport { ContentSpecificationTypes } from \"./rules/content/ContentSpecification\";\r\nimport { RelatedInstanceSpecification } from \"./rules/RelatedInstanceSpecification\";\r\nimport { RelationshipDirection } from \"./rules/RelationshipDirection\";\r\nimport { RuleTypes } from \"./rules/Rule\";\r\nimport { Ruleset } from \"./rules/Ruleset\";\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 if (field.type.valueFormat !== PropertyValueFormat.Primitive)\r\n throw new Error(\"Can only create 'similar instances' ruleset for primitive properties\");\r\n if (field.properties.length === 0)\r\n throw new Error(\"Invalid properties' field with no properties\");\r\n if (record.isFieldMerged(field.name))\r\n throw new Error(\"Can't create 'similar instances' ruleset for merged values\");\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 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 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 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(field: Field, record: Item, computeDisplayValue?: ComputeDisplayValueCallback): 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: Value | DisplayValue): string => {\r\n if (!displayValue)\r\n return \"NULL\";\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 (record: Item, relatedClass: ClassInfo | undefined, field: Field, value: PrimitiveValueDef, computeDisplayValue?: ComputeDisplayValueCallback): 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 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\"\r\n && typeof value.y === \"number\"\r\n && (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 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 if (value[0].mergedFieldNames.indexOf(currFieldName) !== -1)\r\n throw new Error(\"Can't create 'similar instances' ruleset for merged values\");\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))\r\n throw new Error(\"Can only create 'similar instances' ruleset for primitive values\");\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 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 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 return comparison;\r\n }\r\n\r\n if (type.typeName === \"double\")\r\n return `CompareDoubles(${name}, ${compareValue}) ${operator} 0`;\r\n\r\n if (type.typeName === \"dateTime\")\r\n return `CompareDateTimes(${name}, ${compareValue}) ${operator} 0`;\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 = (pathFromSelectToPropertyClass: RelationshipPath, index: number): { 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;AAG7D,+DAA0F;AAC1F,2CAAsD;AACtD,6BAAgE;AAEhE,+EAAiF;AAEjF,yEAAsE;AACtE,uCAAyC;AAGzC;;;;;GAKG;AACH,MAAa,eAAe;IAClB,iCAAiC,CAAC,KAAY,EAAE,MAAY;QAClE,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,EAAE;YAC9B,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;SAC7F;QACD,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,KAAK,qCAAmB,CAAC,SAAS,EAAE;YAC5D,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;SACzF;QACD,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YACjC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;SACjE;QACD,IAAI,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;YACpC,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;SAC/E;QACD,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,4FAA4F,CAAC,CAAC;SAC/G;QACD,MAAM,YAAY,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,aAAa,GAAG,gBAAgB,CAAC,MA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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;SACjB;QACD,OAAO,KAAK,GAAG,CAAC,EAAE;YAChB,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;YACxB,KAAK,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;SAC1B;KACF;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\";\r\nimport { Item } from \"./content/Item\";\r\nimport { PrimitiveTypeDescription, PropertyValueFormat } from \"./content/TypeDescription\";\r\nimport { DisplayValue, Value } from \"./content/Value\";\r\nimport { ClassInfo, InstanceKey, RelationshipPath } from \"./EC\";\r\nimport { MultiSchemaClassesSpecification, SingleSchemaClassSpecification } from \"./rules/ClassSpecifications\";\r\nimport { ContentSpecificationTypes } from \"./rules/content/ContentSpecification\";\r\nimport { RelatedInstanceSpecification } from \"./rules/RelatedInstanceSpecification\";\r\nimport { RelationshipDirection } from \"./rules/RelationshipDirection\";\r\nimport { RuleTypes } from \"./rules/Rule\";\r\nimport { Ruleset } from \"./rules/Ruleset\";\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: Value | DisplayValue): 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)) {\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 +1 @@
1
- {"version":3,"file":"Update.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/Update.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACv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AM,CAAC;QAC1B,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH;AAED,cAAc;AACd,yBAAiB,oBAAoB,CAAC;IACpC;;;OAGG;IAEH,SAAgB,MAAM,CAAC,GAAG,EAAE,oBAAoB,GAAG,wBAAwB,CAM1E;IAED;;;OAGG;IAEH,SAAgB,QAAQ,CAAC,IAAI,EAAE,wBAAwB,GAAG,oBAAoB,CAM7E;CACF"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
6
  /** @packageDocumentation
7
7
  * @module Core
8
8
  */
@@ -13,6 +13,7 @@ const Node_1 = require("./hierarchy/Node");
13
13
  /** @alpha */
14
14
  exports.UPDATE_FULL = "FULL";
15
15
  /** @public */
16
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
16
17
  var PartialHierarchyModification;
17
18
  (function (PartialHierarchyModification) {
18
19
  /**