@itwin/presentation-common 5.0.0-dev.7 → 5.0.0-dev.70

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 (369) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/Ruleset.schema.json +3 -258
  3. package/lib/cjs/assets/locales/en/Presentation.json +19 -19
  4. package/lib/cjs/presentation-common/AsyncTasks.d.ts +4 -4
  5. package/lib/cjs/presentation-common/AsyncTasks.d.ts.map +1 -1
  6. package/lib/cjs/presentation-common/AsyncTasks.js +5 -6
  7. package/lib/cjs/presentation-common/AsyncTasks.js.map +1 -1
  8. package/lib/cjs/presentation-common/CommonLoggerCategory.js.map +1 -1
  9. package/lib/cjs/presentation-common/Diagnostics.js.map +1 -1
  10. package/lib/cjs/presentation-common/EC.d.ts +36 -80
  11. package/lib/cjs/presentation-common/EC.d.ts.map +1 -1
  12. package/lib/cjs/presentation-common/EC.js +1 -97
  13. package/lib/cjs/presentation-common/EC.js.map +1 -1
  14. package/lib/cjs/presentation-common/ElementProperties.js +16 -9
  15. package/lib/cjs/presentation-common/ElementProperties.js.map +1 -1
  16. package/lib/cjs/presentation-common/Error.d.ts +2 -0
  17. package/lib/cjs/presentation-common/Error.d.ts.map +1 -1
  18. package/lib/cjs/presentation-common/Error.js +2 -0
  19. package/lib/cjs/presentation-common/Error.js.map +1 -1
  20. package/lib/cjs/presentation-common/InstanceFilterDefinition.js.map +1 -1
  21. package/lib/cjs/presentation-common/KeySet.d.ts +2 -2
  22. package/lib/cjs/presentation-common/KeySet.d.ts.map +1 -1
  23. package/lib/cjs/presentation-common/KeySet.js +9 -11
  24. package/lib/cjs/presentation-common/KeySet.js.map +1 -1
  25. package/lib/cjs/presentation-common/KoqPropertyValueFormatter.js +4 -1
  26. package/lib/cjs/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
  27. package/lib/cjs/presentation-common/LabelDefinition.d.ts +0 -48
  28. package/lib/cjs/presentation-common/LabelDefinition.d.ts.map +1 -1
  29. package/lib/cjs/presentation-common/LabelDefinition.js +1 -44
  30. package/lib/cjs/presentation-common/LabelDefinition.js.map +1 -1
  31. package/lib/cjs/presentation-common/LocalizationHelper.js +1 -0
  32. package/lib/cjs/presentation-common/LocalizationHelper.js.map +1 -1
  33. package/lib/cjs/presentation-common/PresentationIpcInterface.js.map +1 -1
  34. package/lib/cjs/presentation-common/PresentationManagerOptions.d.ts +31 -10
  35. package/lib/cjs/presentation-common/PresentationManagerOptions.d.ts.map +1 -1
  36. package/lib/cjs/presentation-common/PresentationManagerOptions.js +0 -5
  37. package/lib/cjs/presentation-common/PresentationManagerOptions.js.map +1 -1
  38. package/lib/cjs/presentation-common/PresentationRpcInterface.d.ts +9 -9
  39. package/lib/cjs/presentation-common/PresentationRpcInterface.d.ts.map +1 -1
  40. package/lib/cjs/presentation-common/PresentationRpcInterface.js +36 -21
  41. package/lib/cjs/presentation-common/PresentationRpcInterface.js.map +1 -1
  42. package/lib/cjs/presentation-common/RegisteredRuleset.d.ts +3 -2
  43. package/lib/cjs/presentation-common/RegisteredRuleset.d.ts.map +1 -1
  44. package/lib/cjs/presentation-common/RegisteredRuleset.js +9 -1
  45. package/lib/cjs/presentation-common/RegisteredRuleset.js.map +1 -1
  46. package/lib/cjs/presentation-common/RpcRequestsHandler.d.ts +9 -12
  47. package/lib/cjs/presentation-common/RpcRequestsHandler.d.ts.map +1 -1
  48. package/lib/cjs/presentation-common/RpcRequestsHandler.js +37 -30
  49. package/lib/cjs/presentation-common/RpcRequestsHandler.js.map +1 -1
  50. package/lib/cjs/presentation-common/RulesetVariables.d.ts +1 -46
  51. package/lib/cjs/presentation-common/RulesetVariables.d.ts.map +1 -1
  52. package/lib/cjs/presentation-common/RulesetVariables.js.map +1 -1
  53. package/lib/cjs/presentation-common/RulesetsFactory.js.map +1 -1
  54. package/lib/cjs/presentation-common/Update.d.ts +2 -79
  55. package/lib/cjs/presentation-common/Update.d.ts.map +1 -1
  56. package/lib/cjs/presentation-common/Update.js +1 -104
  57. package/lib/cjs/presentation-common/Update.js.map +1 -1
  58. package/lib/cjs/presentation-common/Utils.d.ts +21 -0
  59. package/lib/cjs/presentation-common/Utils.d.ts.map +1 -1
  60. package/lib/cjs/presentation-common/Utils.js +57 -0
  61. package/lib/cjs/presentation-common/Utils.js.map +1 -1
  62. package/lib/cjs/presentation-common/content/Category.js.map +1 -1
  63. package/lib/cjs/presentation-common/content/Content.d.ts +0 -7
  64. package/lib/cjs/presentation-common/content/Content.d.ts.map +1 -1
  65. package/lib/cjs/presentation-common/content/Content.js +5 -10
  66. package/lib/cjs/presentation-common/content/Content.js.map +1 -1
  67. package/lib/cjs/presentation-common/content/ContentTraverser.d.ts +1 -1
  68. package/lib/cjs/presentation-common/content/ContentTraverser.d.ts.map +1 -1
  69. package/lib/cjs/presentation-common/content/ContentTraverser.js +116 -28
  70. package/lib/cjs/presentation-common/content/ContentTraverser.js.map +1 -1
  71. package/lib/cjs/presentation-common/content/Descriptor.d.ts +2 -31
  72. package/lib/cjs/presentation-common/content/Descriptor.d.ts.map +1 -1
  73. package/lib/cjs/presentation-common/content/Descriptor.js +68 -22
  74. package/lib/cjs/presentation-common/content/Descriptor.js.map +1 -1
  75. package/lib/cjs/presentation-common/content/DisplayTypes.js.map +1 -1
  76. package/lib/cjs/presentation-common/content/Editor.js.map +1 -1
  77. package/lib/cjs/presentation-common/content/Fields.d.ts +151 -27
  78. package/lib/cjs/presentation-common/content/Fields.d.ts.map +1 -1
  79. package/lib/cjs/presentation-common/content/Fields.js +264 -140
  80. package/lib/cjs/presentation-common/content/Fields.js.map +1 -1
  81. package/lib/cjs/presentation-common/content/Item.d.ts +26 -31
  82. package/lib/cjs/presentation-common/content/Item.d.ts.map +1 -1
  83. package/lib/cjs/presentation-common/content/Item.js +52 -67
  84. package/lib/cjs/presentation-common/content/Item.js.map +1 -1
  85. package/lib/cjs/presentation-common/content/Property.d.ts +2 -12
  86. package/lib/cjs/presentation-common/content/Property.d.ts.map +1 -1
  87. package/lib/cjs/presentation-common/content/Property.js +0 -18
  88. package/lib/cjs/presentation-common/content/Property.js.map +1 -1
  89. package/lib/cjs/presentation-common/content/PropertyValueFormatter.js +3 -0
  90. package/lib/cjs/presentation-common/content/PropertyValueFormatter.js.map +1 -1
  91. package/lib/cjs/presentation-common/content/Renderer.js.map +1 -1
  92. package/lib/cjs/presentation-common/content/TypeDescription.js.map +1 -1
  93. package/lib/cjs/presentation-common/content/Value.d.ts +5 -107
  94. package/lib/cjs/presentation-common/content/Value.d.ts.map +1 -1
  95. package/lib/cjs/presentation-common/content/Value.js +1 -215
  96. package/lib/cjs/presentation-common/content/Value.js.map +1 -1
  97. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.d.ts +1 -22
  98. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.d.ts.map +1 -1
  99. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js +0 -23
  100. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
  101. package/lib/cjs/presentation-common/hierarchy/Key.d.ts +0 -83
  102. package/lib/cjs/presentation-common/hierarchy/Key.d.ts.map +1 -1
  103. package/lib/cjs/presentation-common/hierarchy/Key.js +6 -24
  104. package/lib/cjs/presentation-common/hierarchy/Key.js.map +1 -1
  105. package/lib/cjs/presentation-common/hierarchy/Node.d.ts +4 -107
  106. package/lib/cjs/presentation-common/hierarchy/Node.d.ts.map +1 -1
  107. package/lib/cjs/presentation-common/hierarchy/Node.js +0 -99
  108. package/lib/cjs/presentation-common/hierarchy/Node.js.map +1 -1
  109. package/lib/cjs/presentation-common/hierarchy/NodePathElement.d.ts +1 -67
  110. package/lib/cjs/presentation-common/hierarchy/NodePathElement.d.ts.map +1 -1
  111. package/lib/cjs/presentation-common/hierarchy/NodePathElement.js +0 -117
  112. package/lib/cjs/presentation-common/hierarchy/NodePathElement.js.map +1 -1
  113. package/lib/cjs/presentation-common/rules/ClassSpecifications.js.map +1 -1
  114. package/lib/cjs/presentation-common/rules/RelatedInstanceSpecification.js.map +1 -1
  115. package/lib/cjs/presentation-common/rules/RelationshipDirection.js.map +1 -1
  116. package/lib/cjs/presentation-common/rules/RelationshipPathSpecification.js.map +1 -1
  117. package/lib/cjs/presentation-common/rules/Rule.d.ts +0 -14
  118. package/lib/cjs/presentation-common/rules/Rule.d.ts.map +1 -1
  119. package/lib/cjs/presentation-common/rules/Rule.js.map +1 -1
  120. package/lib/cjs/presentation-common/rules/Ruleset.js.map +1 -1
  121. package/lib/cjs/presentation-common/rules/SchemasSpecification.js.map +1 -1
  122. package/lib/cjs/presentation-common/rules/Variables.js.map +1 -1
  123. package/lib/cjs/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js.map +1 -1
  124. package/lib/cjs/presentation-common/rules/content/ContentRelatedInstancesSpecification.js.map +1 -1
  125. package/lib/cjs/presentation-common/rules/content/ContentRule.js.map +1 -1
  126. package/lib/cjs/presentation-common/rules/content/ContentSpecification.d.ts +0 -7
  127. package/lib/cjs/presentation-common/rules/content/ContentSpecification.d.ts.map +1 -1
  128. package/lib/cjs/presentation-common/rules/content/ContentSpecification.js.map +1 -1
  129. package/lib/cjs/presentation-common/rules/content/DefaultPropertyCategoryOverride.js.map +1 -1
  130. package/lib/cjs/presentation-common/rules/content/PropertySpecification.js.map +1 -1
  131. package/lib/cjs/presentation-common/rules/content/SelectedNodeInstancesSpecification.js.map +1 -1
  132. package/lib/cjs/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js.map +1 -1
  133. package/lib/cjs/presentation-common/rules/content/modifiers/ContentModifier.js.map +1 -1
  134. package/lib/cjs/presentation-common/rules/content/modifiers/CustomRendererSpecification.js.map +1 -1
  135. package/lib/cjs/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js.map +1 -1
  136. package/lib/cjs/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.js.map +1 -1
  137. package/lib/cjs/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js.map +1 -1
  138. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.d.ts +1 -5
  139. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.d.ts.map +1 -1
  140. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
  141. package/lib/cjs/presentation-common/rules/customization/ExtendedDataRule.js.map +1 -1
  142. package/lib/cjs/presentation-common/rules/customization/GroupingRule.d.ts +2 -28
  143. package/lib/cjs/presentation-common/rules/customization/GroupingRule.d.ts.map +1 -1
  144. package/lib/cjs/presentation-common/rules/customization/GroupingRule.js +1 -15
  145. package/lib/cjs/presentation-common/rules/customization/GroupingRule.js.map +1 -1
  146. package/lib/cjs/presentation-common/rules/customization/InstanceLabelOverride.js.map +1 -1
  147. package/lib/cjs/presentation-common/rules/customization/SortingRule.js.map +1 -1
  148. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
  149. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
  150. package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts +2 -0
  151. package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts.map +1 -1
  152. package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
  153. package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
  154. package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts +0 -9
  155. package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts.map +1 -1
  156. package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
  157. package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
  158. package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
  159. package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
  160. package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
  161. package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
  162. package/lib/cjs/presentation-common/selection/SelectionScope.d.ts +3 -0
  163. package/lib/cjs/presentation-common/selection/SelectionScope.d.ts.map +1 -1
  164. package/lib/cjs/presentation-common/selection/SelectionScope.js +1 -0
  165. package/lib/cjs/presentation-common/selection/SelectionScope.js.map +1 -1
  166. package/lib/cjs/presentation-common.d.ts +1 -5
  167. package/lib/cjs/presentation-common.d.ts.map +1 -1
  168. package/lib/cjs/presentation-common.js +6 -5
  169. package/lib/cjs/presentation-common.js.map +1 -1
  170. package/lib/esm/presentation-common/AsyncTasks.d.ts +4 -4
  171. package/lib/esm/presentation-common/AsyncTasks.d.ts.map +1 -1
  172. package/lib/esm/presentation-common/AsyncTasks.js +5 -6
  173. package/lib/esm/presentation-common/AsyncTasks.js.map +1 -1
  174. package/lib/esm/presentation-common/CommonLoggerCategory.js.map +1 -1
  175. package/lib/esm/presentation-common/Diagnostics.js.map +1 -1
  176. package/lib/esm/presentation-common/EC.d.ts +36 -80
  177. package/lib/esm/presentation-common/EC.d.ts.map +1 -1
  178. package/lib/esm/presentation-common/EC.js +0 -96
  179. package/lib/esm/presentation-common/EC.js.map +1 -1
  180. package/lib/esm/presentation-common/ElementProperties.js +16 -9
  181. package/lib/esm/presentation-common/ElementProperties.js.map +1 -1
  182. package/lib/esm/presentation-common/Error.d.ts +2 -0
  183. package/lib/esm/presentation-common/Error.d.ts.map +1 -1
  184. package/lib/esm/presentation-common/Error.js +2 -0
  185. package/lib/esm/presentation-common/Error.js.map +1 -1
  186. package/lib/esm/presentation-common/InstanceFilterDefinition.js.map +1 -1
  187. package/lib/esm/presentation-common/KeySet.d.ts +2 -2
  188. package/lib/esm/presentation-common/KeySet.d.ts.map +1 -1
  189. package/lib/esm/presentation-common/KeySet.js +9 -11
  190. package/lib/esm/presentation-common/KeySet.js.map +1 -1
  191. package/lib/esm/presentation-common/KoqPropertyValueFormatter.js +5 -2
  192. package/lib/esm/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
  193. package/lib/esm/presentation-common/LabelDefinition.d.ts +0 -48
  194. package/lib/esm/presentation-common/LabelDefinition.d.ts.map +1 -1
  195. package/lib/esm/presentation-common/LabelDefinition.js +0 -43
  196. package/lib/esm/presentation-common/LabelDefinition.js.map +1 -1
  197. package/lib/esm/presentation-common/LocalizationHelper.js +1 -0
  198. package/lib/esm/presentation-common/LocalizationHelper.js.map +1 -1
  199. package/lib/esm/presentation-common/PresentationIpcInterface.js.map +1 -1
  200. package/lib/esm/presentation-common/PresentationManagerOptions.d.ts +31 -10
  201. package/lib/esm/presentation-common/PresentationManagerOptions.d.ts.map +1 -1
  202. package/lib/esm/presentation-common/PresentationManagerOptions.js +0 -4
  203. package/lib/esm/presentation-common/PresentationManagerOptions.js.map +1 -1
  204. package/lib/esm/presentation-common/PresentationRpcInterface.d.ts +9 -9
  205. package/lib/esm/presentation-common/PresentationRpcInterface.d.ts.map +1 -1
  206. package/lib/esm/presentation-common/PresentationRpcInterface.js +38 -22
  207. package/lib/esm/presentation-common/PresentationRpcInterface.js.map +1 -1
  208. package/lib/esm/presentation-common/RegisteredRuleset.d.ts +3 -2
  209. package/lib/esm/presentation-common/RegisteredRuleset.d.ts.map +1 -1
  210. package/lib/esm/presentation-common/RegisteredRuleset.js +9 -1
  211. package/lib/esm/presentation-common/RegisteredRuleset.js.map +1 -1
  212. package/lib/esm/presentation-common/RpcRequestsHandler.d.ts +9 -12
  213. package/lib/esm/presentation-common/RpcRequestsHandler.d.ts.map +1 -1
  214. package/lib/esm/presentation-common/RpcRequestsHandler.js +39 -32
  215. package/lib/esm/presentation-common/RpcRequestsHandler.js.map +1 -1
  216. package/lib/esm/presentation-common/RulesetVariables.d.ts +1 -46
  217. package/lib/esm/presentation-common/RulesetVariables.d.ts.map +1 -1
  218. package/lib/esm/presentation-common/RulesetVariables.js.map +1 -1
  219. package/lib/esm/presentation-common/RulesetsFactory.js.map +1 -1
  220. package/lib/esm/presentation-common/Update.d.ts +2 -79
  221. package/lib/esm/presentation-common/Update.d.ts.map +1 -1
  222. package/lib/esm/presentation-common/Update.js +0 -103
  223. package/lib/esm/presentation-common/Update.js.map +1 -1
  224. package/lib/esm/presentation-common/Utils.d.ts +21 -0
  225. package/lib/esm/presentation-common/Utils.d.ts.map +1 -1
  226. package/lib/esm/presentation-common/Utils.js +54 -0
  227. package/lib/esm/presentation-common/Utils.js.map +1 -1
  228. package/lib/esm/presentation-common/content/Category.js.map +1 -1
  229. package/lib/esm/presentation-common/content/Content.d.ts +0 -7
  230. package/lib/esm/presentation-common/content/Content.d.ts.map +1 -1
  231. package/lib/esm/presentation-common/content/Content.js +5 -10
  232. package/lib/esm/presentation-common/content/Content.js.map +1 -1
  233. package/lib/esm/presentation-common/content/ContentTraverser.d.ts +1 -1
  234. package/lib/esm/presentation-common/content/ContentTraverser.d.ts.map +1 -1
  235. package/lib/esm/presentation-common/content/ContentTraverser.js +117 -29
  236. package/lib/esm/presentation-common/content/ContentTraverser.js.map +1 -1
  237. package/lib/esm/presentation-common/content/Descriptor.d.ts +2 -31
  238. package/lib/esm/presentation-common/content/Descriptor.d.ts.map +1 -1
  239. package/lib/esm/presentation-common/content/Descriptor.js +68 -22
  240. package/lib/esm/presentation-common/content/Descriptor.js.map +1 -1
  241. package/lib/esm/presentation-common/content/DisplayTypes.js.map +1 -1
  242. package/lib/esm/presentation-common/content/Editor.js.map +1 -1
  243. package/lib/esm/presentation-common/content/Fields.d.ts +151 -27
  244. package/lib/esm/presentation-common/content/Fields.d.ts.map +1 -1
  245. package/lib/esm/presentation-common/content/Fields.js +264 -140
  246. package/lib/esm/presentation-common/content/Fields.js.map +1 -1
  247. package/lib/esm/presentation-common/content/Item.d.ts +26 -31
  248. package/lib/esm/presentation-common/content/Item.d.ts.map +1 -1
  249. package/lib/esm/presentation-common/content/Item.js +52 -67
  250. package/lib/esm/presentation-common/content/Item.js.map +1 -1
  251. package/lib/esm/presentation-common/content/Property.d.ts +2 -12
  252. package/lib/esm/presentation-common/content/Property.d.ts.map +1 -1
  253. package/lib/esm/presentation-common/content/Property.js +0 -18
  254. package/lib/esm/presentation-common/content/Property.js.map +1 -1
  255. package/lib/esm/presentation-common/content/PropertyValueFormatter.js +3 -0
  256. package/lib/esm/presentation-common/content/PropertyValueFormatter.js.map +1 -1
  257. package/lib/esm/presentation-common/content/Renderer.js.map +1 -1
  258. package/lib/esm/presentation-common/content/TypeDescription.js.map +1 -1
  259. package/lib/esm/presentation-common/content/Value.d.ts +5 -107
  260. package/lib/esm/presentation-common/content/Value.d.ts.map +1 -1
  261. package/lib/esm/presentation-common/content/Value.js +0 -214
  262. package/lib/esm/presentation-common/content/Value.js.map +1 -1
  263. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.d.ts +1 -22
  264. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.d.ts.map +1 -1
  265. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js +1 -22
  266. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
  267. package/lib/esm/presentation-common/hierarchy/Key.d.ts +0 -83
  268. package/lib/esm/presentation-common/hierarchy/Key.d.ts.map +1 -1
  269. package/lib/esm/presentation-common/hierarchy/Key.js +6 -24
  270. package/lib/esm/presentation-common/hierarchy/Key.js.map +1 -1
  271. package/lib/esm/presentation-common/hierarchy/Node.d.ts +4 -107
  272. package/lib/esm/presentation-common/hierarchy/Node.d.ts.map +1 -1
  273. package/lib/esm/presentation-common/hierarchy/Node.js +1 -98
  274. package/lib/esm/presentation-common/hierarchy/Node.js.map +1 -1
  275. package/lib/esm/presentation-common/hierarchy/NodePathElement.d.ts +1 -67
  276. package/lib/esm/presentation-common/hierarchy/NodePathElement.d.ts.map +1 -1
  277. package/lib/esm/presentation-common/hierarchy/NodePathElement.js +1 -116
  278. package/lib/esm/presentation-common/hierarchy/NodePathElement.js.map +1 -1
  279. package/lib/esm/presentation-common/rules/ClassSpecifications.js.map +1 -1
  280. package/lib/esm/presentation-common/rules/RelatedInstanceSpecification.js.map +1 -1
  281. package/lib/esm/presentation-common/rules/RelationshipDirection.js.map +1 -1
  282. package/lib/esm/presentation-common/rules/RelationshipPathSpecification.js.map +1 -1
  283. package/lib/esm/presentation-common/rules/Rule.d.ts +0 -14
  284. package/lib/esm/presentation-common/rules/Rule.d.ts.map +1 -1
  285. package/lib/esm/presentation-common/rules/Rule.js.map +1 -1
  286. package/lib/esm/presentation-common/rules/Ruleset.js.map +1 -1
  287. package/lib/esm/presentation-common/rules/SchemasSpecification.js.map +1 -1
  288. package/lib/esm/presentation-common/rules/Variables.js.map +1 -1
  289. package/lib/esm/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js.map +1 -1
  290. package/lib/esm/presentation-common/rules/content/ContentRelatedInstancesSpecification.js.map +1 -1
  291. package/lib/esm/presentation-common/rules/content/ContentRule.js.map +1 -1
  292. package/lib/esm/presentation-common/rules/content/ContentSpecification.d.ts +0 -7
  293. package/lib/esm/presentation-common/rules/content/ContentSpecification.d.ts.map +1 -1
  294. package/lib/esm/presentation-common/rules/content/ContentSpecification.js.map +1 -1
  295. package/lib/esm/presentation-common/rules/content/DefaultPropertyCategoryOverride.js.map +1 -1
  296. package/lib/esm/presentation-common/rules/content/PropertySpecification.js.map +1 -1
  297. package/lib/esm/presentation-common/rules/content/SelectedNodeInstancesSpecification.js.map +1 -1
  298. package/lib/esm/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js.map +1 -1
  299. package/lib/esm/presentation-common/rules/content/modifiers/ContentModifier.js.map +1 -1
  300. package/lib/esm/presentation-common/rules/content/modifiers/CustomRendererSpecification.js.map +1 -1
  301. package/lib/esm/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js.map +1 -1
  302. package/lib/esm/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.js.map +1 -1
  303. package/lib/esm/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js.map +1 -1
  304. package/lib/esm/presentation-common/rules/customization/CustomizationRule.d.ts +1 -5
  305. package/lib/esm/presentation-common/rules/customization/CustomizationRule.d.ts.map +1 -1
  306. package/lib/esm/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
  307. package/lib/esm/presentation-common/rules/customization/ExtendedDataRule.js.map +1 -1
  308. package/lib/esm/presentation-common/rules/customization/GroupingRule.d.ts +2 -28
  309. package/lib/esm/presentation-common/rules/customization/GroupingRule.d.ts.map +1 -1
  310. package/lib/esm/presentation-common/rules/customization/GroupingRule.js +0 -14
  311. package/lib/esm/presentation-common/rules/customization/GroupingRule.js.map +1 -1
  312. package/lib/esm/presentation-common/rules/customization/InstanceLabelOverride.js.map +1 -1
  313. package/lib/esm/presentation-common/rules/customization/SortingRule.js.map +1 -1
  314. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
  315. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
  316. package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts +2 -0
  317. package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts.map +1 -1
  318. package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
  319. package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
  320. package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts +0 -9
  321. package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts.map +1 -1
  322. package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
  323. package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
  324. package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
  325. package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
  326. package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
  327. package/lib/esm/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
  328. package/lib/esm/presentation-common/selection/SelectionScope.d.ts +3 -0
  329. package/lib/esm/presentation-common/selection/SelectionScope.d.ts.map +1 -1
  330. package/lib/esm/presentation-common/selection/SelectionScope.js +1 -0
  331. package/lib/esm/presentation-common/selection/SelectionScope.js.map +1 -1
  332. package/lib/esm/presentation-common.d.ts +1 -5
  333. package/lib/esm/presentation-common.d.ts.map +1 -1
  334. package/lib/esm/presentation-common.js +1 -5
  335. package/lib/esm/presentation-common.js.map +1 -1
  336. package/lib/public/locales/en/Presentation.json +19 -19
  337. package/package.json +12 -12
  338. package/lib/cjs/presentation-common/rules/customization/CheckBoxRule.d.ts +0 -45
  339. package/lib/cjs/presentation-common/rules/customization/CheckBoxRule.d.ts.map +0 -1
  340. package/lib/cjs/presentation-common/rules/customization/CheckBoxRule.js +0 -10
  341. package/lib/cjs/presentation-common/rules/customization/CheckBoxRule.js.map +0 -1
  342. package/lib/cjs/presentation-common/rules/customization/ImageIdOverride.d.ts +0 -30
  343. package/lib/cjs/presentation-common/rules/customization/ImageIdOverride.d.ts.map +0 -1
  344. package/lib/cjs/presentation-common/rules/customization/ImageIdOverride.js +0 -10
  345. package/lib/cjs/presentation-common/rules/customization/ImageIdOverride.js.map +0 -1
  346. package/lib/cjs/presentation-common/rules/customization/LabelOverride.d.ts +0 -41
  347. package/lib/cjs/presentation-common/rules/customization/LabelOverride.d.ts.map +0 -1
  348. package/lib/cjs/presentation-common/rules/customization/LabelOverride.js +0 -10
  349. package/lib/cjs/presentation-common/rules/customization/LabelOverride.js.map +0 -1
  350. package/lib/cjs/presentation-common/rules/customization/StyleOverride.d.ts +0 -49
  351. package/lib/cjs/presentation-common/rules/customization/StyleOverride.d.ts.map +0 -1
  352. package/lib/cjs/presentation-common/rules/customization/StyleOverride.js +0 -10
  353. package/lib/cjs/presentation-common/rules/customization/StyleOverride.js.map +0 -1
  354. package/lib/esm/presentation-common/rules/customization/CheckBoxRule.d.ts +0 -45
  355. package/lib/esm/presentation-common/rules/customization/CheckBoxRule.d.ts.map +0 -1
  356. package/lib/esm/presentation-common/rules/customization/CheckBoxRule.js +0 -9
  357. package/lib/esm/presentation-common/rules/customization/CheckBoxRule.js.map +0 -1
  358. package/lib/esm/presentation-common/rules/customization/ImageIdOverride.d.ts +0 -30
  359. package/lib/esm/presentation-common/rules/customization/ImageIdOverride.d.ts.map +0 -1
  360. package/lib/esm/presentation-common/rules/customization/ImageIdOverride.js +0 -9
  361. package/lib/esm/presentation-common/rules/customization/ImageIdOverride.js.map +0 -1
  362. package/lib/esm/presentation-common/rules/customization/LabelOverride.d.ts +0 -41
  363. package/lib/esm/presentation-common/rules/customization/LabelOverride.d.ts.map +0 -1
  364. package/lib/esm/presentation-common/rules/customization/LabelOverride.js +0 -9
  365. package/lib/esm/presentation-common/rules/customization/LabelOverride.js.map +0 -1
  366. package/lib/esm/presentation-common/rules/customization/StyleOverride.d.ts +0 -49
  367. package/lib/esm/presentation-common/rules/customization/StyleOverride.d.ts.map +0 -1
  368. package/lib/esm/presentation-common/rules/customization/StyleOverride.js +0 -9
  369. package/lib/esm/presentation-common/rules/customization/StyleOverride.js.map +0 -1
@@ -1 +1 @@
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,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;QAC9F,CAAC;QACD,IAAI,KAAK,CAAC,IAAI,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AC;YACxB,KAAK,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { Guid, Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { Field, PropertiesField } from \"./content/Fields\";\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: string | undefined): string => {\r\n if (!displayValue) {\r\n return \"NULL\";\r\n }\r\n return displayValue.toString();\r\n};\r\n\r\nconst createDescription = (record: Item, relatedClass: ClassInfo | undefined, field: Field, value: string): string => {\r\n const classInfo = relatedClass ?? record.classInfo!;\r\n return `[${classInfo.label}].[${field.label}] = ${value}`;\r\n};\r\n\r\nconst createDescriptionAsync = async (\r\n record: Item,\r\n relatedClass: ClassInfo | undefined,\r\n field: Field,\r\n value: PrimitiveValueDef,\r\n computeDisplayValue?: ComputeDisplayValueCallback,\r\n): Promise<string> => {\r\n const displayValue = computeDisplayValue ? await computeDisplayValue(field.type.typeName, value.raw, value.display) : toString(value.display);\r\n return createDescription(record, relatedClass, field, displayValue);\r\n};\r\n\r\nconst getPropertyName = (field: PropertiesField) => {\r\n let name = field.properties[0].property.name;\r\n if (field.type.typeName === \"navigation\") {\r\n name += \".Id\";\r\n }\r\n return name;\r\n};\r\n\r\nconst isPrimitivePropertyValue = (value: Value): value is PrimitivePropertyValue => {\r\n if (Value.isPrimitive(value)) {\r\n return true;\r\n }\r\n\r\n if (Value.isMap(value)) {\r\n if (typeof value.x === \"number\" && typeof value.y === \"number\" && (value.z === undefined || typeof value.z === \"number\")) {\r\n return true;\r\n }\r\n\r\n if (typeof value.className === \"string\" && typeof value.id === \"string\") {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n};\r\n\r\nconst getPropertyValue = (record: Item, field: Field): PrimitiveValueDef => {\r\n const fieldNamesStack = [];\r\n let currField: Field | undefined = field;\r\n while (currField) {\r\n fieldNamesStack.push(currField.name);\r\n currField = currField.parent;\r\n }\r\n let currFieldName = fieldNamesStack.pop();\r\n let displayValue: DisplayValue = record.displayValues[currFieldName!];\r\n let value: Value = record.values[currFieldName!];\r\n currFieldName = fieldNamesStack.pop();\r\n while (currFieldName) {\r\n if (!Value.isNestedContent(value) || value.length === 0) {\r\n throw new Error(\"Invalid record value\");\r\n }\r\n if (value.length > 1) {\r\n throw new Error(\"Can't create 'similar instances' for records related through many part of *-to-many relationship\");\r\n }\r\n if (value[0].mergedFieldNames.indexOf(currFieldName) !== -1) {\r\n throw new Error(\"Can't create 'similar instances' ruleset for merged values\");\r\n }\r\n displayValue = value[0].displayValues[currFieldName];\r\n value = value[0].values[currFieldName];\r\n currFieldName = fieldNamesStack.pop();\r\n }\r\n if (!isPrimitivePropertyValue(value) || !(typeof displayValue === \"undefined\" || typeof displayValue === \"string\")) {\r\n throw new Error(\"Can only create 'similar instances' ruleset for primitive values\");\r\n }\r\n return { raw: value, display: toString(displayValue) };\r\n};\r\n\r\nconst createInstanceFilter = (\r\n relatedInstanceSpec: Readonly<RelatedInstanceSpecification> | undefined,\r\n propertyType: PrimitiveTypeDescription,\r\n propertyName: string,\r\n propertyValue: PrimitivePropertyValue,\r\n): string => {\r\n const alias = relatedInstanceSpec ? relatedInstanceSpec.alias : \"this\";\r\n return createComparison(propertyType, `${alias}.${propertyName}`, \"=\", propertyValue);\r\n};\r\n\r\ntype Operator = \"=\" | \"!=\" | \">\" | \">=\" | \"<\" | \"<=\";\r\nconst createComparison = (type: PrimitiveTypeDescription, name: string, operator: Operator, value: PrimitivePropertyValue): string => {\r\n let compareValue = \"\";\r\n switch (typeof value) {\r\n case \"undefined\":\r\n compareValue = \"NULL\";\r\n break;\r\n case \"string\":\r\n compareValue = `\"${value.replace(/\"/g, `\"\"`)}\"`;\r\n break;\r\n case \"boolean\":\r\n compareValue = value ? \"TRUE\" : \"FALSE\";\r\n break;\r\n case \"number\":\r\n compareValue = value.toString();\r\n break;\r\n }\r\n\r\n if (type.typeName === \"navigation\" && typeof value === \"object\" && Id64.isId64((value as InstanceKey).id)) {\r\n // note: this is temporary until we support hex ids in instance filters\r\n compareValue = hexToDec((value as InstanceKey).id);\r\n }\r\n\r\n if (type.typeName === \"point2d\" || type.typeName === \"point3d\") {\r\n if (typeof value !== \"object\") {\r\n throw new Error(\"Expecting point values to be supplied as objects\");\r\n }\r\n\r\n const dimensionType: PrimitiveTypeDescription = {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n typeName: \"double\",\r\n };\r\n\r\n const pointValue = value as Point;\r\n let comparison = `${createComparison(dimensionType, `${name}.x`, operator, pointValue.x)}`;\r\n comparison += ` AND ${createComparison(dimensionType, `${name}.y`, operator, pointValue.y)}`;\r\n if (type.typeName === \"point3d\" && pointValue.z !== undefined) {\r\n comparison += ` AND ${createComparison(dimensionType, `${name}.z`, operator, pointValue.z)}`;\r\n }\r\n\r\n return comparison;\r\n }\r\n\r\n if (type.typeName === \"double\") {\r\n return `CompareDoubles(${name}, ${compareValue}) ${operator} 0`;\r\n }\r\n\r\n if (type.typeName === \"dateTime\") {\r\n return `CompareDateTimes(${name}, ${compareValue}) ${operator} 0`;\r\n }\r\n\r\n return `${name} ${operator} ${compareValue}`;\r\n};\r\n\r\nconst createMultiClassSpecification = (classInfo: Readonly<ClassInfo>): MultiSchemaClassesSpecification => {\r\n const [schemaName, className] = classInfo.name.split(\":\");\r\n return { schemaName, classNames: [className], arePolymorphic: true };\r\n};\r\n\r\nconst createSingleClassSpecification = (classInfo: Readonly<ClassInfo>): SingleSchemaClassSpecification => {\r\n const [schemaName, className] = classInfo.name.split(\":\");\r\n return { schemaName, className };\r\n};\r\n\r\nconst createRelatedInstanceSpec = (\r\n pathFromSelectToPropertyClass: RelationshipPath,\r\n index: number,\r\n): { spec: RelatedInstanceSpecification; class: ClassInfo } => ({\r\n spec: {\r\n relationshipPath: pathFromSelectToPropertyClass.map((step) => ({\r\n relationship: createSingleClassSpecification(step.relationshipInfo),\r\n direction: step.isForwardRelationship ? RelationshipDirection.Forward : RelationshipDirection.Backward,\r\n targetClass: createSingleClassSpecification(step.targetClassInfo),\r\n })),\r\n isRequired: true,\r\n alias: `related_${index}`,\r\n },\r\n class: pathFromSelectToPropertyClass[pathFromSelectToPropertyClass.length - 1].targetClassInfo,\r\n});\r\n\r\nconst createPathFromSelectToPropertyClass = (field: PropertiesField): RelationshipPath => {\r\n let currField: Field = field;\r\n const pathFromPropertyToSelectClass: RelationshipPath = [];\r\n while (currField.parent) {\r\n pathFromPropertyToSelectClass.push(...currField.parent.pathToPrimaryClass);\r\n currField = currField.parent;\r\n }\r\n return RelationshipPath.reverse(pathFromPropertyToSelectClass);\r\n};\r\n\r\nconst createRelatedInstanceSpecInfo = (field: PropertiesField): { spec: RelatedInstanceSpecification; class: ClassInfo } | undefined => {\r\n const path = createPathFromSelectToPropertyClass(field);\r\n return path.length ? createRelatedInstanceSpec(path, 0) : undefined;\r\n};\r\n\r\nconst hexToDec = (id: Id64String) => {\r\n const digits = [0];\r\n for (let i = 2; i < id.length; ++i) {\r\n let carry = parseInt(id.charAt(i), 16);\r\n for (let j = 0; j < digits.length; ++j) {\r\n digits[j] = digits[j] * 16 + carry;\r\n carry = (digits[j] / 10) | 0;\r\n digits[j] %= 10;\r\n }\r\n while (carry > 0) {\r\n digits.push(carry % 10);\r\n carry = (carry / 10) | 0;\r\n }\r\n }\r\n return digits.reverse().join(\"\");\r\n};\r\n"]}
1
+ {"version":3,"file":"RulesetsFactory.js","sourceRoot":"","sources":["../../../src/presentation-common/RulesetsFactory.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA6D;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,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;QAC9F,CAAC;QACD,I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K,GAAG,EAAE,CAAC,CAAC;YACxB,KAAK,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { Guid, Id64, Id64String } from \"@itwin/core-bentley\";\nimport { Field, PropertiesField } from \"./content/Fields\";\nimport { Item } from \"./content/Item\";\nimport { PrimitiveTypeDescription, PropertyValueFormat } from \"./content/TypeDescription\";\nimport { DisplayValue, Value } from \"./content/Value\";\nimport { ClassInfo, InstanceKey, RelationshipPath } from \"./EC\";\nimport { MultiSchemaClassesSpecification, SingleSchemaClassSpecification } from \"./rules/ClassSpecifications\";\nimport { ContentSpecificationTypes } from \"./rules/content/ContentSpecification\";\nimport { RelatedInstanceSpecification } from \"./rules/RelatedInstanceSpecification\";\nimport { RelationshipDirection } from \"./rules/RelationshipDirection\";\nimport { RuleTypes } from \"./rules/Rule\";\nimport { Ruleset } from \"./rules/Ruleset\";\n\n/**\n * A factory class that can be used to create presentation rulesets targeted towards\n * specific use cases.\n *\n * @public\n */\nexport class RulesetsFactory {\n private createSimilarInstancesRulesetInfo(field: Field, record: Item) {\n if (!field.isPropertiesField()) {\n throw new Error(\"Can only create 'similar instances' ruleset for properties-based records\");\n }\n if (field.type.valueFormat !== PropertyValueFormat.Primitive) {\n throw new Error(\"Can only create 'similar instances' ruleset for primitive properties\");\n }\n if (field.properties.length === 0) {\n throw new Error(\"Invalid properties' field with no properties\");\n }\n if (record.isFieldMerged(field.name)) {\n throw new Error(\"Can't create 'similar instances' ruleset for merged values\");\n }\n if (!record.classInfo) {\n throw new Error(\"Can't create 'similar instances' for records based on multiple different ECClass instances\");\n }\n const propertyName = getPropertyName(field);\n const propertyValue = getPropertyValue(record, field);\n const relatedInstanceInfo = createRelatedInstanceSpecInfo(field);\n const relatedClass = relatedInstanceInfo?.class;\n const ruleset: Ruleset = {\n id: `SimilarInstances/${propertyName}/${Guid.createValue()}`,\n rules: [],\n };\n ruleset.rules.push({\n ruleType: RuleTypes.Content,\n specifications: [\n {\n specType: ContentSpecificationTypes.ContentInstancesOfSpecificClasses,\n classes: createMultiClassSpecification(record.classInfo),\n relatedInstances: relatedInstanceInfo ? [relatedInstanceInfo.spec] : [],\n instanceFilter: createInstanceFilter(relatedInstanceInfo?.spec, field.type, propertyName, propertyValue.raw),\n },\n ],\n });\n return { ruleset, relatedClass, propertyName, propertyValue };\n }\n\n /**\n * Create a ruleset with content rules for getting instances are of the\n * same ECClass and have the same property value as the provided `record`.\n * @param field A field identifying which property of the record we should use\n * @param record A record whose similar instances should be found\n * @param computeDisplayValue Optional callback function to calculate display value that's\n * used in ruleset's description. If not provided, display value from record is used instead.\n */\n public async createSimilarInstancesRuleset(\n field: Field,\n record: Item,\n computeDisplayValue?: ComputeDisplayValueCallback,\n ): Promise<{ ruleset: Ruleset; description: string }> {\n const info = this.createSimilarInstancesRulesetInfo(field, record);\n const description = await createDescriptionAsync(record, info.relatedClass, field, info.propertyValue, computeDisplayValue);\n return { ruleset: info.ruleset, description };\n }\n}\n\n/**\n * Definition of a function for calculating a display value.\n * @public\n */\nexport type ComputeDisplayValueCallback = (type: string, value: PrimitivePropertyValue, displayValue: string) => Promise<string>;\n\ninterface PrimitiveValueDef {\n raw: PrimitivePropertyValue;\n display: string;\n}\n\n/**\n * Value of a primitive property.\n * @public\n */\nexport type PrimitivePropertyValue = string | number | boolean | Point | InstanceKey | undefined;\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\ntype Point = { x: number; y: number; z?: number };\n\nconst toString = (displayValue: string | undefined): string => {\n if (!displayValue) {\n return \"NULL\";\n }\n return displayValue.toString();\n};\n\nconst createDescription = (record: Item, relatedClass: ClassInfo | undefined, field: Field, value: string): string => {\n const classInfo = relatedClass ?? record.classInfo!;\n return `[${classInfo.label}].[${field.label}] = ${value}`;\n};\n\nconst createDescriptionAsync = async (\n record: Item,\n relatedClass: ClassInfo | undefined,\n field: Field,\n value: PrimitiveValueDef,\n computeDisplayValue?: ComputeDisplayValueCallback,\n): Promise<string> => {\n const displayValue = computeDisplayValue ? await computeDisplayValue(field.type.typeName, value.raw, value.display) : toString(value.display);\n return createDescription(record, relatedClass, field, displayValue);\n};\n\nconst getPropertyName = (field: PropertiesField) => {\n let name = field.properties[0].property.name;\n if (field.type.typeName === \"navigation\") {\n name += \".Id\";\n }\n return name;\n};\n\nconst isPrimitivePropertyValue = (value: Value): value is PrimitivePropertyValue => {\n if (Value.isPrimitive(value)) {\n return true;\n }\n\n if (Value.isMap(value)) {\n if (typeof value.x === \"number\" && typeof value.y === \"number\" && (value.z === undefined || typeof value.z === \"number\")) {\n return true;\n }\n\n if (typeof value.className === \"string\" && typeof value.id === \"string\") {\n return true;\n }\n }\n\n return false;\n};\n\nconst getPropertyValue = (record: Item, field: Field): PrimitiveValueDef => {\n const fieldNamesStack = [];\n let currField: Field | undefined = field;\n while (currField) {\n fieldNamesStack.push(currField.name);\n currField = currField.parent;\n }\n let currFieldName = fieldNamesStack.pop();\n let displayValue: DisplayValue = record.displayValues[currFieldName!];\n let value: Value = record.values[currFieldName!];\n currFieldName = fieldNamesStack.pop();\n while (currFieldName) {\n if (!Value.isNestedContent(value) || value.length === 0) {\n throw new Error(\"Invalid record value\");\n }\n if (value.length > 1) {\n throw new Error(\"Can't create 'similar instances' for records related through many part of *-to-many relationship\");\n }\n if (value[0].mergedFieldNames.indexOf(currFieldName) !== -1) {\n throw new Error(\"Can't create 'similar instances' ruleset for merged values\");\n }\n displayValue = value[0].displayValues[currFieldName];\n value = value[0].values[currFieldName];\n currFieldName = fieldNamesStack.pop();\n }\n if (!isPrimitivePropertyValue(value) || !(typeof displayValue === \"undefined\" || typeof displayValue === \"string\")) {\n throw new Error(\"Can only create 'similar instances' ruleset for primitive values\");\n }\n return { raw: value, display: toString(displayValue) };\n};\n\nconst createInstanceFilter = (\n relatedInstanceSpec: Readonly<RelatedInstanceSpecification> | undefined,\n propertyType: PrimitiveTypeDescription,\n propertyName: string,\n propertyValue: PrimitivePropertyValue,\n): string => {\n const alias = relatedInstanceSpec ? relatedInstanceSpec.alias : \"this\";\n return createComparison(propertyType, `${alias}.${propertyName}`, \"=\", propertyValue);\n};\n\ntype Operator = \"=\" | \"!=\" | \">\" | \">=\" | \"<\" | \"<=\";\nconst createComparison = (type: PrimitiveTypeDescription, name: string, operator: Operator, value: PrimitivePropertyValue): string => {\n let compareValue = \"\";\n switch (typeof value) {\n case \"undefined\":\n compareValue = \"NULL\";\n break;\n case \"string\":\n compareValue = `\"${value.replace(/\"/g, `\"\"`)}\"`;\n break;\n case \"boolean\":\n compareValue = value ? \"TRUE\" : \"FALSE\";\n break;\n case \"number\":\n compareValue = value.toString();\n break;\n }\n\n if (type.typeName === \"navigation\" && typeof value === \"object\" && Id64.isId64((value as InstanceKey).id)) {\n // note: this is temporary until we support hex ids in instance filters\n compareValue = hexToDec((value as InstanceKey).id);\n }\n\n if (type.typeName === \"point2d\" || type.typeName === \"point3d\") {\n if (typeof value !== \"object\") {\n throw new Error(\"Expecting point values to be supplied as objects\");\n }\n\n const dimensionType: PrimitiveTypeDescription = {\n valueFormat: PropertyValueFormat.Primitive,\n typeName: \"double\",\n };\n\n const pointValue = value as Point;\n let comparison = `${createComparison(dimensionType, `${name}.x`, operator, pointValue.x)}`;\n comparison += ` AND ${createComparison(dimensionType, `${name}.y`, operator, pointValue.y)}`;\n if (type.typeName === \"point3d\" && pointValue.z !== undefined) {\n comparison += ` AND ${createComparison(dimensionType, `${name}.z`, operator, pointValue.z)}`;\n }\n\n return comparison;\n }\n\n if (type.typeName === \"double\") {\n return `CompareDoubles(${name}, ${compareValue}) ${operator} 0`;\n }\n\n if (type.typeName === \"dateTime\") {\n return `CompareDateTimes(${name}, ${compareValue}) ${operator} 0`;\n }\n\n return `${name} ${operator} ${compareValue}`;\n};\n\nconst createMultiClassSpecification = (classInfo: Readonly<ClassInfo>): MultiSchemaClassesSpecification => {\n const [schemaName, className] = classInfo.name.split(\":\");\n return { schemaName, classNames: [className], arePolymorphic: true };\n};\n\nconst createSingleClassSpecification = (classInfo: Readonly<ClassInfo>): SingleSchemaClassSpecification => {\n const [schemaName, className] = classInfo.name.split(\":\");\n return { schemaName, className };\n};\n\nconst createRelatedInstanceSpec = (\n pathFromSelectToPropertyClass: RelationshipPath,\n index: number,\n): { spec: RelatedInstanceSpecification; class: ClassInfo } => ({\n spec: {\n relationshipPath: pathFromSelectToPropertyClass.map((step) => ({\n relationship: createSingleClassSpecification(step.relationshipInfo),\n direction: step.isForwardRelationship ? RelationshipDirection.Forward : RelationshipDirection.Backward,\n targetClass: createSingleClassSpecification(step.targetClassInfo),\n })),\n isRequired: true,\n alias: `related_${index}`,\n },\n class: pathFromSelectToPropertyClass[pathFromSelectToPropertyClass.length - 1].targetClassInfo,\n});\n\nconst createPathFromSelectToPropertyClass = (field: PropertiesField): RelationshipPath => {\n let currField: Field = field;\n const pathFromPropertyToSelectClass: RelationshipPath = [];\n while (currField.parent) {\n pathFromPropertyToSelectClass.push(...currField.parent.pathToPrimaryClass);\n currField = currField.parent;\n }\n return RelationshipPath.reverse(pathFromPropertyToSelectClass);\n};\n\nconst createRelatedInstanceSpecInfo = (field: PropertiesField): { spec: RelatedInstanceSpecification; class: ClassInfo } | undefined => {\n const path = createPathFromSelectToPropertyClass(field);\n return path.length ? createRelatedInstanceSpec(path, 0) : undefined;\n};\n\nconst hexToDec = (id: Id64String) => {\n const digits = [0];\n for (let i = 2; i < id.length; ++i) {\n let carry = parseInt(id.charAt(i), 16);\n for (let j = 0; j < digits.length; ++j) {\n digits[j] = digits[j] * 16 + carry;\n carry = (digits[j] / 10) | 0;\n digits[j] %= 10;\n }\n while (carry > 0) {\n digits.push(carry % 10);\n carry = (carry / 10) | 0;\n }\n }\n return digits.reverse().join(\"\");\n};\n"]}
@@ -1,8 +1,8 @@
1
1
  /** @packageDocumentation
2
2
  * @module Core
3
3
  */
4
- import { NodeKey, NodeKeyJSON } from "./hierarchy/Key";
5
- import { Node, NodeJSON, PartialNode, PartialNodeJSON } from "./hierarchy/Node";
4
+ import { NodeKey } from "./hierarchy/Key";
5
+ import { Node, PartialNode } from "./hierarchy/Node";
6
6
  /**
7
7
  * A constant for indicating that a full update is required.
8
8
  * @public
@@ -32,30 +32,11 @@ export type HierarchyUpdateInfo = typeof UPDATE_FULL;
32
32
  * @public
33
33
  */
34
34
  export type ContentUpdateInfo = typeof UPDATE_FULL;
35
- /**
36
- * JSON representation of [[PartialHierarchyModification]].
37
- * @public
38
- * @deprecated in 3.x. Use [[PartialHierarchyModification]]
39
- */
40
- export type PartialHierarchyModificationJSON = NodeInsertionInfoJSON | NodeDeletionInfoJSON | NodeUpdateInfoJSON;
41
35
  /**
42
36
  * Information about a hierarchy change: insertion, deletion or node update.
43
37
  * @public
44
38
  */
45
39
  export type PartialHierarchyModification = NodeInsertionInfo | NodeDeletionInfo | NodeUpdateInfo;
46
- /** @public */
47
- export declare namespace PartialHierarchyModification {
48
- /**
49
- * Serialize given object to JSON.
50
- * @deprecated in 3.x. Use [[PartialHierarchyModification]]
51
- */
52
- function toJSON(obj: PartialHierarchyModification): PartialHierarchyModificationJSON;
53
- /**
54
- * Deserialize given object from JSON
55
- * @deprecated in 3.x. Use [[PartialHierarchyModification]]
56
- */
57
- function fromJSON(json: PartialHierarchyModificationJSON): PartialHierarchyModification;
58
- }
59
40
  /**
60
41
  * Information about node insertion.
61
42
  * @public
@@ -69,17 +50,6 @@ export interface NodeInsertionInfo {
69
50
  /** Inserted node */
70
51
  node: Node;
71
52
  }
72
- /**
73
- * JSON representation of [[NodeInsertionInfo]].
74
- * @public
75
- * @deprecated in 3.x. Use [[NodeInsertionInfo]]
76
- */
77
- export interface NodeInsertionInfoJSON {
78
- type: "Insert";
79
- parent?: NodeKeyJSON;
80
- position: number;
81
- node: NodeJSON;
82
- }
83
53
  /**
84
54
  * Information about node deletion.
85
55
  * @public
@@ -91,18 +61,6 @@ export interface NodeDeletionInfo {
91
61
  /** Position of the deleted node among its siblings in the initial, not updated tree */
92
62
  position: number;
93
63
  }
94
- /**
95
- * JSON representation of [[NodeDeletionInfo]].
96
- * @public
97
- * @deprecated in 3.x. Use [[NodeDeletionInfo]]
98
- */
99
- export interface NodeDeletionInfoJSON {
100
- type: "Delete";
101
- /** Parent of the deleted node */
102
- parent?: NodeKeyJSON;
103
- /** Position of the deleted node among its siblings in the initial, not updated tree */
104
- position: number;
105
- }
106
64
  /**
107
65
  * Information about node update.
108
66
  * @public
@@ -114,28 +72,6 @@ export interface NodeUpdateInfo {
114
72
  /** Updated node attributes */
115
73
  changes: PartialNode;
116
74
  }
117
- /**
118
- * JSON representation of [[NodeUpdateInfo]].
119
- * @public
120
- * @deprecated in 3.x. Use [[NodeUpdateInfo]]
121
- */
122
- export interface NodeUpdateInfoJSON {
123
- type: "Update";
124
- target: NodeKeyJSON;
125
- changes: PartialNodeJSON;
126
- }
127
- /**
128
- * JSON representation of [[HierarchyCompareInfo]].
129
- * @public
130
- * @deprecated in 3.x. Use [[HierarchyCompareInfo]].
131
- */
132
- export interface HierarchyCompareInfoJSON {
133
- changes: PartialHierarchyModificationJSON[];
134
- continuationToken?: {
135
- prevHierarchyNode: string;
136
- currHierarchyNode: string;
137
- };
138
- }
139
75
  /**
140
76
  * Information about hierarchy modification / differences.
141
77
  * @public
@@ -149,17 +85,4 @@ export interface HierarchyCompareInfo {
149
85
  currHierarchyNode: string;
150
86
  };
151
87
  }
152
- /** @public */
153
- export declare namespace HierarchyCompareInfo {
154
- /**
155
- * Serialize given object to JSON.
156
- * @deprecated in 3.x. Use [[HierarchyCompareInfo]]
157
- */
158
- function toJSON(obj: HierarchyCompareInfo): HierarchyCompareInfoJSON;
159
- /**
160
- * Deserialize given object from JSON
161
- * @deprecated in 3.x. Use [[HierarchyCompareInfo]]
162
- */
163
- function fromJSON(json: HierarchyCompareInfoJSON): HierarchyCompareInfo;
164
- }
165
88
  //# sourceMappingURL=Update.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Update.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/Update.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEhF;;;GAGG;AACH,eAAO,MAAM,WAAW,SAAS,CAAC;AAElC;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,CAAC,SAAS,EAAE,MAAM,GAAG;YACnB,SAAS,CAAC,EAAE,mBAAmB,CAAC;YAChC,OAAO,CAAC,EAAE,iBAAiB,CAAC;SAC7B,CAAC;KACH,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,WAAW,CAAC;AAErD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,WAAW,CAAC;AAEnD;;;;GAIG;AAEH,MAAM,MAAM,gCAAgC,GAAG,qBAAqB,GAAG,oBAAoB,GAAG,kBAAkB,CAAC;AAEjH;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,cAAc,CAAC;AAEjG,cAAc;AAEd,yBAAiB,4BAA4B,CAAC;IAC5C;;;OAGG;IAEH,SAAgB,MAAM,CAAC,GAAG,EAAE,4BAA4B,GAAG,gCAAgC,CA4B1F;IAED;;;OAGG;IAEH,SAAgB,QAAQ,CAAC,IAAI,EAAE,gCAAgC,GAAG,4BAA4B,CA4B7F;CACF;AAED;;;GAGG;AACH,MAAM,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,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB;IACpB,IAAI,EAAE,IAAI,CAAC;CACZ;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,iCAAiC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,uFAAuF;IACvF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,8BAA8B;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,8BAA8B;IAC9B,OAAO,EAAE,WAAW,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,kCAAkC;IAClC,OAAO,EAAE,4BAA4B,EAAE,CAAC;IACxC,sDAAsD;IACtD,iBAAiB,CAAC,EAAE;QAClB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH"}
@@ -7,113 +7,10 @@
7
7
  * @module Core
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.HierarchyCompareInfo = exports.PartialHierarchyModification = exports.UPDATE_FULL = void 0;
11
- const Key_1 = require("./hierarchy/Key");
12
- const Node_1 = require("./hierarchy/Node");
10
+ exports.UPDATE_FULL = void 0;
13
11
  /**
14
12
  * A constant for indicating that a full update is required.
15
13
  * @public
16
14
  */
17
15
  exports.UPDATE_FULL = "FULL";
18
- /** @public */
19
- // eslint-disable-next-line @typescript-eslint/no-redeclare
20
- var PartialHierarchyModification;
21
- (function (PartialHierarchyModification) {
22
- /**
23
- * Serialize given object to JSON.
24
- * @deprecated in 3.x. Use [[PartialHierarchyModification]]
25
- */
26
- // eslint-disable-next-line @typescript-eslint/no-deprecated
27
- function toJSON(obj) {
28
- switch (obj.type) {
29
- case "Insert":
30
- return {
31
- type: "Insert",
32
- // eslint-disable-next-line @typescript-eslint/no-deprecated
33
- parent: obj.parent === undefined ? undefined : Key_1.NodeKey.toJSON(obj.parent),
34
- position: obj.position,
35
- // eslint-disable-next-line @typescript-eslint/no-deprecated
36
- node: Node_1.Node.toJSON(obj.node),
37
- };
38
- case "Update":
39
- return {
40
- type: "Update",
41
- // eslint-disable-next-line @typescript-eslint/no-deprecated
42
- target: Key_1.NodeKey.toJSON(obj.target),
43
- changes: Node_1.Node.toPartialJSON(obj.changes),
44
- };
45
- case "Delete":
46
- return {
47
- type: "Delete",
48
- // eslint-disable-next-line @typescript-eslint/no-deprecated
49
- parent: obj.parent === undefined ? undefined : Key_1.NodeKey.toJSON(obj.parent),
50
- position: obj.position,
51
- };
52
- }
53
- }
54
- PartialHierarchyModification.toJSON = toJSON;
55
- /**
56
- * Deserialize given object from JSON
57
- * @deprecated in 3.x. Use [[PartialHierarchyModification]]
58
- */
59
- // eslint-disable-next-line @typescript-eslint/no-deprecated
60
- function fromJSON(json) {
61
- switch (json.type) {
62
- case "Insert":
63
- return {
64
- type: "Insert",
65
- // eslint-disable-next-line @typescript-eslint/no-deprecated
66
- parent: json.parent === undefined ? undefined : Key_1.NodeKey.fromJSON(json.parent),
67
- position: json.position,
68
- // eslint-disable-next-line @typescript-eslint/no-deprecated
69
- node: Node_1.Node.fromJSON(json.node),
70
- };
71
- case "Update":
72
- return {
73
- type: "Update",
74
- // eslint-disable-next-line @typescript-eslint/no-deprecated
75
- target: Key_1.NodeKey.fromJSON(json.target),
76
- changes: Node_1.Node.fromPartialJSON(json.changes),
77
- };
78
- case "Delete":
79
- return {
80
- type: "Delete",
81
- // eslint-disable-next-line @typescript-eslint/no-deprecated
82
- parent: json.parent === undefined ? undefined : Key_1.NodeKey.fromJSON(json.parent),
83
- position: json.position,
84
- };
85
- }
86
- }
87
- PartialHierarchyModification.fromJSON = fromJSON;
88
- })(PartialHierarchyModification || (exports.PartialHierarchyModification = PartialHierarchyModification = {}));
89
- /** @public */
90
- var HierarchyCompareInfo;
91
- (function (HierarchyCompareInfo) {
92
- /**
93
- * Serialize given object to JSON.
94
- * @deprecated in 3.x. Use [[HierarchyCompareInfo]]
95
- */
96
- // eslint-disable-next-line @typescript-eslint/no-deprecated
97
- function toJSON(obj) {
98
- return {
99
- ...obj,
100
- // eslint-disable-next-line @typescript-eslint/no-deprecated
101
- changes: obj.changes.map((change) => PartialHierarchyModification.toJSON(change)),
102
- };
103
- }
104
- HierarchyCompareInfo.toJSON = toJSON;
105
- /**
106
- * Deserialize given object from JSON
107
- * @deprecated in 3.x. Use [[HierarchyCompareInfo]]
108
- */
109
- // eslint-disable-next-line @typescript-eslint/no-deprecated
110
- function fromJSON(json) {
111
- return {
112
- ...json,
113
- // eslint-disable-next-line @typescript-eslint/no-deprecated
114
- changes: json.changes.map((change) => PartialHierarchyModification.fromJSON(change)),
115
- };
116
- }
117
- HierarchyCompareInfo.fromJSON = fromJSON;
118
- })(HierarchyCompareInfo || (exports.HierarchyCompareInfo = HierarchyCompareInfo = {}));
119
16
  //# sourceMappingURL=Update.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Update.js","sourceRoot":"","sources":["../../../src/presentation-common/Update.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,yCAAuD;AACvD,2CAAgF;AAEhF;;;GAGG;AACU,QAAA,WAAW,GAAG,MAAM,CAAC;AA2ClC,cAAc;AACd,2DAA2D;AAC3D,IAAiB,4BAA4B,CAsE5C;AAtED,WAAiB,4BAA4B;IAC3C;;;OAGG;IACH,4DAA4D;IAC5D,SAAgB,MAAM,CAAC,GAAiC;QACtD,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;YACjB,KAAK,QAAQ;gBACX,OAAO;oBACL,IAAI,EAAE,QAAQ;oBACd,4DAA4D;oBAC5D,MAAM,EAAE,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAO,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;oBACzE,QAAQ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Q,CAAC,IAAI,CAAC,MAAM,CAAC;oBACrC,OAAO,EAAE,WAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC;iBAC5C,CAAC;YAEJ,KAAK,QAAQ;gBACX,OAAO;oBACL,IAAI,EAAE,QAAQ;oBACd,4DAA4D;oBAC5D,MAAM,EAAE,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;oBAC7E,QAAQ,EAAE,IAAI,CAAC,QAAQ;iBACxB,CAAC;QACN,CAAC;IACH,CAAC;IA5Be,qCAAQ,WA4BvB,CAAA;AACH,CAAC,EAtEgB,4BAA4B,4CAA5B,4BAA4B,QAsE5C;AA6GD,cAAc;AACd,IAAiB,oBAAoB,CA0BpC;AA1BD,WAAiB,oBAAoB;IACnC;;;OAGG;IACH,4DAA4D;IAC5D,SAAgB,MAAM,CAAC,GAAyB;QAC9C,OAAO;YACL,GAAG,GAAG;YACN,4DAA4D;YAC5D,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,4BAA4B,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SAClF,CAAC;IACJ,CAAC;IANe,2BAAM,SAMrB,CAAA;IAED;;;OAGG;IACH,4DAA4D;IAC5D,SAAgB,QAAQ,CAAC,IAA8B;QACrD,OAAO;YACL,GAAG,IAAI;YACP,4DAA4D;YAC5D,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,4BAA4B,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;SACrF,CAAC;IACJ,CAAC;IANe,6BAAQ,WAMvB,CAAA;AACH,CAAC,EA1BgB,oBAAoB,oCAApB,oBAAoB,QA0BpC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { NodeKey, NodeKeyJSON } from \"./hierarchy/Key\";\r\nimport { Node, NodeJSON, PartialNode, PartialNodeJSON } from \"./hierarchy/Node\";\r\n\r\n/**\r\n * A constant for indicating that a full update is required.\r\n * @public\r\n */\r\nexport const UPDATE_FULL = \"FULL\";\r\n\r\n/**\r\n * A data structure that describes changes that need to be applied to the hierarchy and\r\n * content components due to some changes on the backend.\r\n *\r\n * @public\r\n */\r\nexport interface UpdateInfo {\r\n [imodel: string]: {\r\n [rulesetId: string]: {\r\n hierarchy?: HierarchyUpdateInfo;\r\n content?: ContentUpdateInfo;\r\n };\r\n };\r\n}\r\n\r\n/**\r\n * Information about a required hierarchy update.\r\n * @public\r\n */\r\nexport type HierarchyUpdateInfo = typeof UPDATE_FULL;\r\n\r\n/**\r\n * Information about a required content update.\r\n * @public\r\n */\r\nexport type ContentUpdateInfo = typeof UPDATE_FULL;\r\n\r\n/**\r\n * JSON representation of [[PartialHierarchyModification]].\r\n * @public\r\n * @deprecated in 3.x. Use [[PartialHierarchyModification]]\r\n */\r\n// eslint-disable-next-line @typescript-eslint/no-deprecated\r\nexport type PartialHierarchyModificationJSON = NodeInsertionInfoJSON | NodeDeletionInfoJSON | NodeUpdateInfoJSON;\r\n\r\n/**\r\n * Information about a hierarchy change: insertion, deletion or node update.\r\n * @public\r\n */\r\nexport type PartialHierarchyModification = NodeInsertionInfo | NodeDeletionInfo | NodeUpdateInfo;\r\n\r\n/** @public */\r\n// eslint-disable-next-line @typescript-eslint/no-redeclare\r\nexport namespace PartialHierarchyModification {\r\n /**\r\n * Serialize given object to JSON.\r\n * @deprecated in 3.x. Use [[PartialHierarchyModification]]\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function toJSON(obj: PartialHierarchyModification): PartialHierarchyModificationJSON {\r\n switch (obj.type) {\r\n case \"Insert\":\r\n return {\r\n type: \"Insert\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent: obj.parent === undefined ? undefined : NodeKey.toJSON(obj.parent),\r\n position: obj.position,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n node: Node.toJSON(obj.node),\r\n };\r\n\r\n case \"Update\":\r\n return {\r\n type: \"Update\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n target: NodeKey.toJSON(obj.target),\r\n changes: Node.toPartialJSON(obj.changes),\r\n };\r\n\r\n case \"Delete\":\r\n return {\r\n type: \"Delete\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent: obj.parent === undefined ? undefined : NodeKey.toJSON(obj.parent),\r\n position: obj.position,\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Deserialize given object from JSON\r\n * @deprecated in 3.x. Use [[PartialHierarchyModification]]\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function fromJSON(json: PartialHierarchyModificationJSON): PartialHierarchyModification {\r\n switch (json.type) {\r\n case \"Insert\":\r\n return {\r\n type: \"Insert\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent: json.parent === undefined ? undefined : NodeKey.fromJSON(json.parent),\r\n position: json.position,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n node: Node.fromJSON(json.node),\r\n };\r\n\r\n case \"Update\":\r\n return {\r\n type: \"Update\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n target: NodeKey.fromJSON(json.target),\r\n changes: Node.fromPartialJSON(json.changes),\r\n };\r\n\r\n case \"Delete\":\r\n return {\r\n type: \"Delete\",\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent: json.parent === undefined ? undefined : NodeKey.fromJSON(json.parent),\r\n position: json.position,\r\n };\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Information about node insertion.\r\n * @public\r\n */\r\nexport interface NodeInsertionInfo {\r\n type: \"Insert\";\r\n /** Parent node key */\r\n parent?: NodeKey;\r\n /** Index of the new node under its parent */\r\n position: number;\r\n /** Inserted node */\r\n node: Node;\r\n}\r\n\r\n/**\r\n * JSON representation of [[NodeInsertionInfo]].\r\n * @public\r\n * @deprecated in 3.x. Use [[NodeInsertionInfo]]\r\n */\r\nexport interface NodeInsertionInfoJSON {\r\n type: \"Insert\";\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent?: NodeKeyJSON;\r\n position: number;\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n node: NodeJSON;\r\n}\r\n\r\n/**\r\n * Information about node deletion.\r\n * @public\r\n */\r\nexport interface NodeDeletionInfo {\r\n type: \"Delete\";\r\n /** Parent of the deleted node */\r\n parent?: NodeKey;\r\n /** Position of the deleted node among its siblings in the initial, not updated tree */\r\n position: number;\r\n}\r\n\r\n/**\r\n * JSON representation of [[NodeDeletionInfo]].\r\n * @public\r\n * @deprecated in 3.x. Use [[NodeDeletionInfo]]\r\n */\r\nexport interface NodeDeletionInfoJSON {\r\n type: \"Delete\";\r\n /** Parent of the deleted node */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n parent?: NodeKeyJSON;\r\n /** Position of the deleted node among its siblings in the initial, not updated tree */\r\n position: number;\r\n}\r\n\r\n/**\r\n * Information about node update.\r\n * @public\r\n */\r\nexport interface NodeUpdateInfo {\r\n type: \"Update\";\r\n /** Key of the updated node */\r\n target: NodeKey;\r\n /** Updated node attributes */\r\n changes: PartialNode;\r\n}\r\n\r\n/**\r\n * JSON representation of [[NodeUpdateInfo]].\r\n * @public\r\n * @deprecated in 3.x. Use [[NodeUpdateInfo]]\r\n */\r\nexport interface NodeUpdateInfoJSON {\r\n type: \"Update\";\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n target: NodeKeyJSON;\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n changes: PartialNodeJSON;\r\n}\r\n\r\n/**\r\n * JSON representation of [[HierarchyCompareInfo]].\r\n * @public\r\n * @deprecated in 3.x. Use [[HierarchyCompareInfo]].\r\n */\r\nexport interface HierarchyCompareInfoJSON {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n changes: PartialHierarchyModificationJSON[];\r\n continuationToken?: {\r\n prevHierarchyNode: string;\r\n currHierarchyNode: string;\r\n };\r\n}\r\n\r\n/**\r\n * Information about hierarchy modification / differences.\r\n * @public\r\n */\r\nexport interface HierarchyCompareInfo {\r\n /** A list of hierarchy changes */\r\n changes: PartialHierarchyModification[];\r\n /** Continuation token for requesting more changes. */\r\n continuationToken?: {\r\n prevHierarchyNode: string;\r\n currHierarchyNode: string;\r\n };\r\n}\r\n\r\n/** @public */\r\nexport namespace HierarchyCompareInfo {\r\n /**\r\n * Serialize given object to JSON.\r\n * @deprecated in 3.x. Use [[HierarchyCompareInfo]]\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function toJSON(obj: HierarchyCompareInfo): HierarchyCompareInfoJSON {\r\n return {\r\n ...obj,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n changes: obj.changes.map((change) => PartialHierarchyModification.toJSON(change)),\r\n };\r\n }\r\n\r\n /**\r\n * Deserialize given object from JSON\r\n * @deprecated in 3.x. Use [[HierarchyCompareInfo]]\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function fromJSON(json: HierarchyCompareInfoJSON): HierarchyCompareInfo {\r\n return {\r\n ...json,\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n changes: json.changes.map((change) => PartialHierarchyModification.fromJSON(change)),\r\n };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Update.js","sourceRoot":"","sources":["../../../src/presentation-common/Update.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAKH;;;GAGG;AACU,QAAA,WAAW,GAAG,MAAM,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { NodeKey } from \"./hierarchy/Key\";\nimport { Node, PartialNode } from \"./hierarchy/Node\";\n\n/**\n * A constant for indicating that a full update is required.\n * @public\n */\nexport const UPDATE_FULL = \"FULL\";\n\n/**\n * A data structure that describes changes that need to be applied to the hierarchy and\n * content components due to some changes on the backend.\n *\n * @public\n */\nexport interface UpdateInfo {\n [imodel: string]: {\n [rulesetId: string]: {\n hierarchy?: HierarchyUpdateInfo;\n content?: ContentUpdateInfo;\n };\n };\n}\n\n/**\n * Information about a required hierarchy update.\n * @public\n */\nexport type HierarchyUpdateInfo = typeof UPDATE_FULL;\n\n/**\n * Information about a required content update.\n * @public\n */\nexport type ContentUpdateInfo = typeof UPDATE_FULL;\n\n/**\n * Information about a hierarchy change: insertion, deletion or node update.\n * @public\n */\nexport type PartialHierarchyModification = NodeInsertionInfo | NodeDeletionInfo | NodeUpdateInfo;\n\n/**\n * Information about node insertion.\n * @public\n */\nexport interface NodeInsertionInfo {\n type: \"Insert\";\n /** Parent node key */\n parent?: NodeKey;\n /** Index of the new node under its parent */\n position: number;\n /** Inserted node */\n node: Node;\n}\n\n/**\n * Information about node deletion.\n * @public\n */\nexport interface NodeDeletionInfo {\n type: \"Delete\";\n /** Parent of the deleted node */\n parent?: NodeKey;\n /** Position of the deleted node among its siblings in the initial, not updated tree */\n position: number;\n}\n\n/**\n * Information about node update.\n * @public\n */\nexport interface NodeUpdateInfo {\n type: \"Update\";\n /** Key of the updated node */\n target: NodeKey;\n /** Updated node attributes */\n changes: PartialNode;\n}\n\n/**\n * Information about hierarchy modification / differences.\n * @public\n */\nexport interface HierarchyCompareInfo {\n /** A list of hierarchy changes */\n changes: PartialHierarchyModification[];\n /** Continuation token for requesting more changes. */\n continuationToken?: {\n prevHierarchyNode: string;\n currHierarchyNode: string;\n };\n}\n"]}
@@ -60,4 +60,25 @@ export declare const getInstancesCount: (keys: Readonly<KeySet>) => number;
60
60
  * @public
61
61
  */
62
62
  export declare const DEFAULT_KEYS_BATCH_SIZE = 5000;
63
+ /**
64
+ * Removes all `undefined` properties from given `obj` object and returns
65
+ * the same (mutated) object.
66
+ *
67
+ * Example: `omitUndefined({ a: 1, b: undefined })` will return `{ a: 1 }`
68
+ *
69
+ * @internal
70
+ */
71
+ export declare function omitUndefined<T extends object>(obj: T): T;
72
+ /** @internal */
73
+ type NullToUndefined<T> = T extends null ? undefined : T extends Array<infer U> ? Array<NullToUndefined<U>> : T extends object ? {
74
+ [K in keyof T]: NullToUndefined<T[K]>;
75
+ } : T;
76
+ /** @internal */
77
+ export declare function deepReplaceNullsToUndefined<T>(obj: T): NullToUndefined<T>;
78
+ /** @internal */
79
+ export declare function createCancellableTimeoutPromise(timeoutMs: number): {
80
+ promise: Promise<void>;
81
+ cancel: () => void;
82
+ };
83
+ export {};
63
84
  //# sourceMappingURL=Utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/Utils.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAE9C;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,C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;IACpC,KAAK,EAAE,CAAC,EAAE,CAAC;CACZ;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,SAAU,QAAQ,CAAC,MAAM,CAAC,KAAG,MAU1D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAOzD;AAED,gBAAgB;AAChB,KAAK,eAAe,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,GACpC,SAAS,GACT,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GACtB,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,GACzB,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACzC,CAAC,CAAC;AAEV,gBAAgB;AAChB,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAoBzE;AAED,gBAAgB;AAChB,wBAAgB,+BAA+B,CAAC,SAAS,EAAE,MAAM;;;EAchE"}
@@ -8,6 +8,9 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.DEFAULT_KEYS_BATCH_SIZE = exports.getInstancesCount = void 0;
11
+ exports.omitUndefined = omitUndefined;
12
+ exports.deepReplaceNullsToUndefined = deepReplaceNullsToUndefined;
13
+ exports.createCancellableTimeoutPromise = createCancellableTimeoutPromise;
11
14
  const Key_1 = require("./hierarchy/Key");
12
15
  /**
13
16
  * Get total number of instances included in the supplied key set. The
@@ -41,4 +44,58 @@ exports.getInstancesCount = getInstancesCount;
41
44
  * @public
42
45
  */
43
46
  exports.DEFAULT_KEYS_BATCH_SIZE = 5000;
47
+ /**
48
+ * Removes all `undefined` properties from given `obj` object and returns
49
+ * the same (mutated) object.
50
+ *
51
+ * Example: `omitUndefined({ a: 1, b: undefined })` will return `{ a: 1 }`
52
+ *
53
+ * @internal
54
+ */
55
+ function omitUndefined(obj) {
56
+ Object.entries(obj).forEach(([key, value]) => {
57
+ if (value === undefined) {
58
+ delete obj[key];
59
+ }
60
+ });
61
+ return obj;
62
+ }
63
+ /** @internal */
64
+ function deepReplaceNullsToUndefined(obj) {
65
+ /* istanbul ignore next */
66
+ if (obj === null) {
67
+ return undefined;
68
+ }
69
+ /* istanbul ignore next */
70
+ if (Array.isArray(obj)) {
71
+ return obj.map(deepReplaceNullsToUndefined);
72
+ }
73
+ if (typeof obj === "object") {
74
+ return Object.keys(obj).reduce((acc, key) => {
75
+ const value = obj[key];
76
+ /* istanbul ignore else */
77
+ if (value !== null && value !== undefined) {
78
+ acc[key] = deepReplaceNullsToUndefined(value);
79
+ }
80
+ return acc;
81
+ }, {});
82
+ }
83
+ return obj;
84
+ }
85
+ /** @internal */
86
+ function createCancellableTimeoutPromise(timeoutMs) {
87
+ let timeout;
88
+ let rejectPromise;
89
+ const promise = new Promise((resolve, reject) => {
90
+ rejectPromise = reject;
91
+ timeout = setTimeout(resolve, timeoutMs);
92
+ });
93
+ return {
94
+ promise,
95
+ cancel: () => {
96
+ clearTimeout(timeout);
97
+ rejectPromise();
98
+ },
99
+ };
100
+ }
44
101
  //# sourceMappingURL=Utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/presentation-common/Utils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,yCAA0C;AA8C1C;;;;;;;;;;;GAWG;AACI,MAAM,iBAAiB,GAAG,CAAC,IAAsB,EAAU,EAAE;IAClE,IAAI,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC;IACnC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAY,EAAE,EAAE;QACrC,IAAI,aAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,KAAK,IAAI,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC;QACnC,CAAC;aAAM,IAAI,aAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1C,KAAK,IAAI,GAAG,CAAC,qBAAqB,CAAC;QACrC,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAVW,QAAA,iBAAiB,qBAU5B;AAEF;;;;;GAKG;AACU,QAAA,uBAAuB,GAAG,IAAI,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { NodeKey } from \"./hierarchy/Key\";\r\nimport { KeySet } from \"./KeySet\";\r\n\r\n/**\r\n * Create a type with `T` properties excluding properties listed in `K`.\r\n *\r\n * Usage example: `Omit<SomeType, \"exclude_prop1\" | \"exclude_prop2\">`\r\n *\r\n * @public\r\n */\r\nexport type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;\r\n\r\n/**\r\n * Create a type with `T` properties excluding all properties in type `K`.\r\n *\r\n * Usage example: `Subtract<SomeType, ExcludePropertiesInThisType>`\r\n *\r\n * @public\r\n */\r\nexport type Subtract<T, K> = Omit<T, keyof K>;\r\n\r\n/**\r\n * Create a type from given type `T` and make specified properties optional.\r\n * @public\r\n */\r\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\r\n\r\n/**\r\n * A dictionary data structure.\r\n * @public\r\n */\r\nexport interface ValuesDictionary<T> {\r\n [key: string]: T;\r\n}\r\n\r\n/**\r\n * A structure for paged responses\r\n * @public\r\n */\r\nexport interface PagedResponse<T> {\r\n /** Total number of items */\r\n total: number;\r\n /** Items for the requested page */\r\n items: T[];\r\n}\r\n\r\n/**\r\n * Get total number of instances included in the supplied key set. The\r\n * count is calculated by adding all of the following:\r\n * - `keys.instanceKeysCount`\r\n * - number of `keys.nodeKeys` which are *ECInstance* keys\r\n * - for every grouping node key in `keys.nodeKeys`, number of grouped instances\r\n *\r\n * E.g. if `keys` contains one instance key, one *ECInstance* node key\r\n * and one grouping node key which groups 3 instances, the result is 5.\r\n *\r\n * @public\r\n */\r\nexport const getInstancesCount = (keys: Readonly<KeySet>): number => {\r\n let count = keys.instanceKeysCount;\r\n keys.nodeKeys.forEach((key: NodeKey) => {\r\n if (NodeKey.isInstancesNodeKey(key)) {\r\n count += key.instanceKeys.length;\r\n } else if (NodeKey.isGroupingNodeKey(key)) {\r\n count += key.groupedInstancesCount;\r\n }\r\n });\r\n return count;\r\n};\r\n\r\n/**\r\n * Default (recommended) keyset batch size for cases when it needs to be sent\r\n * over HTTP. Sending keys in batches helps avoid HTTP413 error.\r\n *\r\n * @public\r\n */\r\nexport const DEFAULT_KEYS_BATCH_SIZE = 5000;\r\n"]}
1
+ {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/presentation-common/Utils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAwFH,sCAOC;AAYD,kEAoBC;AAGD,0EAcC;AA9ID,yCAA0C;AA8C1C;;;;;;;;;;;GAWG;AACI,MAAM,iBAAiB,GAAG,CAAC,IAAsB,EAAU,EAAE;IAClE,IAAI,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC;IACnC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAY,EAAE,EAAE;QACrC,IAAI,aAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,KAAK,IAAI,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC;QACnC,CAAC;aAAM,IAAI,aAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1C,KAAK,IAAI,GAAG,CAAC,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,GAAU,CAAC;AACpB,CAAC;AAED,gBAAgB;AAChB,SAAgB,+BAA+B,CAAC,SAAiB;IAC/D,IAAI,OAAsC,CAAC;IAC3C,IAAI,aAAyB,CAAC;IAC9B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACpD,aAAa,GAAG,MAAM,CAAC;QACvB,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IACH,OAAO;QACL,OAAO;QACP,MAAM,EAAE,GAAG,EAAE;YACX,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,aAAa,EAAE,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { NodeKey } from \"./hierarchy/Key\";\nimport { KeySet } from \"./KeySet\";\n\n/**\n * Create a type with `T` properties excluding properties listed in `K`.\n *\n * Usage example: `Omit<SomeType, \"exclude_prop1\" | \"exclude_prop2\">`\n *\n * @public\n */\nexport type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;\n\n/**\n * Create a type with `T` properties excluding all properties in type `K`.\n *\n * Usage example: `Subtract<SomeType, ExcludePropertiesInThisType>`\n *\n * @public\n */\nexport type Subtract<T, K> = Omit<T, keyof K>;\n\n/**\n * Create a type from given type `T` and make specified properties optional.\n * @public\n */\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\n/**\n * A dictionary data structure.\n * @public\n */\nexport interface ValuesDictionary<T> {\n [key: string]: T;\n}\n\n/**\n * A structure for paged responses\n * @public\n */\nexport interface PagedResponse<T> {\n /** Total number of items */\n total: number;\n /** Items for the requested page */\n items: T[];\n}\n\n/**\n * Get total number of instances included in the supplied key set. The\n * count is calculated by adding all of the following:\n * - `keys.instanceKeysCount`\n * - number of `keys.nodeKeys` which are *ECInstance* keys\n * - for every grouping node key in `keys.nodeKeys`, number of grouped instances\n *\n * E.g. if `keys` contains one instance key, one *ECInstance* node key\n * and one grouping node key which groups 3 instances, the result is 5.\n *\n * @public\n */\nexport const getInstancesCount = (keys: Readonly<KeySet>): number => {\n let count = keys.instanceKeysCount;\n keys.nodeKeys.forEach((key: NodeKey) => {\n if (NodeKey.isInstancesNodeKey(key)) {\n count += key.instanceKeys.length;\n } else if (NodeKey.isGroupingNodeKey(key)) {\n count += key.groupedInstancesCount;\n }\n });\n return count;\n};\n\n/**\n * Default (recommended) keyset batch size for cases when it needs to be sent\n * over HTTP. Sending keys in batches helps avoid HTTP413 error.\n *\n * @public\n */\nexport const DEFAULT_KEYS_BATCH_SIZE = 5000;\n\n/**\n * Removes all `undefined` properties from given `obj` object and returns\n * the same (mutated) object.\n *\n * Example: `omitUndefined({ a: 1, b: undefined })` will return `{ a: 1 }`\n *\n * @internal\n */\nexport function omitUndefined<T extends object>(obj: T): T {\n Object.entries(obj).forEach(([key, value]) => {\n if (value === undefined) {\n delete obj[key as keyof T];\n }\n });\n return obj;\n}\n\n/** @internal */\ntype NullToUndefined<T> = T extends null\n ? undefined\n : T extends Array<infer U>\n ? Array<NullToUndefined<U>>\n : T extends object\n ? { [K in keyof T]: NullToUndefined<T[K]> }\n : T;\n\n/** @internal */\nexport function deepReplaceNullsToUndefined<T>(obj: T): NullToUndefined<T> {\n /* istanbul ignore next */\n if (obj === null) {\n return undefined as any;\n }\n /* istanbul ignore next */\n if (Array.isArray(obj)) {\n return obj.map(deepReplaceNullsToUndefined) as NullToUndefined<T>;\n }\n if (typeof obj === \"object\") {\n return Object.keys(obj).reduce((acc, key) => {\n const value = obj[key as keyof T];\n /* istanbul ignore else */\n if (value !== null && value !== undefined) {\n acc[key as keyof NullToUndefined<T>] = deepReplaceNullsToUndefined(value) as any;\n }\n return acc;\n }, {} as NullToUndefined<T>);\n }\n return obj as any;\n}\n\n/** @internal */\nexport function createCancellableTimeoutPromise(timeoutMs: number) {\n let timeout: ReturnType<typeof setTimeout>;\n let rejectPromise: () => void;\n const promise = new Promise<void>((resolve, reject) => {\n rejectPromise = reject;\n timeout = setTimeout(resolve, timeoutMs);\n });\n return {\n promise,\n cancel: () => {\n clearTimeout(timeout);\n rejectPromise();\n },\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Category.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/Category.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAwBH,cAAc;AACd,IAAiB,mBAAmB,CAmCnC;AAnCD,WAAiB,mBAAmB;IAClC,uCAAuC;IACvC,SAAgB,MAAM,CAAC,QAA6B;QAClD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC;QACrC,OAAO;YACL,GAAG,IAAI;YACP,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SAClD,CAAC;IACJ,CAAC;IANe,0BAAM,SAMrB,CAAA;IAED;;;OAGG;IACH,SAAgB,QAAQ,CAAC,IAA6B;QACpD,6DAA6D;QAC7D,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAJe,4BAAQ,WAIvB,CAAA;IAED,SAAS,yBAAyB,CAAC,IAA6B,EAAE,aAA+C;QAC/G,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC;QAC/C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,mDAAmD;YACnD,QAAQ,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,+DAA+D;IAC/D,SAAgB,YAAY,CAAC,IAA+B;QAC1D,MAAM,aAAa,GAAG,IAAI,GAAG,EAA+B,CAAC;QAC7D,IAAI,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,mBAAmB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACjH,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,yBAAyB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC;IAC5F,CAAC;IAJe,gCAAY,eAI3B,CAAA;AACH,CAAC,EAnCgB,mBAAmB,mCAAnB,mBAAmB,QAmCnC","sourcesContent":["/*---------------------------------------------------------------------------------------------\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 Content\r\n */\r\n\r\nimport { RendererDescription } from \"./Renderer\";\r\n\r\n/**\r\n * A data structure that describes a [[Field]] category.\r\n * @public\r\n */\r\nexport interface CategoryDescription {\r\n /** Unique name */\r\n name: string;\r\n /** Display label */\r\n label: string;\r\n /** Extensive description */\r\n description: string;\r\n /** Priority. Categories with higher priority should appear higher in the UI */\r\n priority: number;\r\n /** Should this category be auto-expanded when it's displayed in the UI */\r\n expand: boolean;\r\n /** Parent category description */\r\n parent?: CategoryDescription;\r\n /** Custom renderer description */\r\n renderer?: RendererDescription;\r\n}\r\n/** @public */\r\nexport namespace CategoryDescription {\r\n /** Serialize given category to JSON */\r\n export function toJSON(category: CategoryDescription): CategoryDescriptionJSON {\r\n const { parent, ...rest } = category;\r\n return {\r\n ...rest,\r\n ...(parent ? { parent: parent.name } : undefined),\r\n };\r\n }\r\n\r\n /**\r\n * Deserialize [[CategoryDescription]] from JSON. The `parent` is not assigned - use [[CategoryDescription.listFromJSON]]\r\n * to deserialize the whole categories list and set parents.\r\n */\r\n export function fromJSON(json: CategoryDescriptionJSON): CategoryDescription {\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n const { parent, ...rest } = json;\r\n return rest;\r\n }\r\n\r\n function createCategoriesHierarchy(json: CategoryDescriptionJSON, categoriesMap: Map<string, CategoryDescription>): CategoryDescription {\r\n const category = categoriesMap.get(json.name)!;\r\n if (json.parent) {\r\n // note: mutating categories in the `categoriesMap`\r\n category.parent = categoriesMap.get(json.parent);\r\n }\r\n return category;\r\n }\r\n\r\n /** Deserialize a list of [[CategoryDescription]] from JSON. */\r\n export function listFromJSON(json: CategoryDescriptionJSON[]): CategoryDescription[] {\r\n const categoriesMap = new Map<string, CategoryDescription>();\r\n json.forEach((categoryJson) => categoriesMap.set(categoryJson.name, CategoryDescription.fromJSON(categoryJson)));\r\n return json.map((categoryJson) => createCategoriesHierarchy(categoryJson, categoriesMap));\r\n }\r\n}\r\n\r\n/**\r\n * Serialized [[CategoryDescription]] JSON representation.\r\n * @public\r\n */\r\nexport interface CategoryDescriptionJSON {\r\n name: string;\r\n label: string;\r\n description: string;\r\n priority: number;\r\n expand: boolean;\r\n parent?: string;\r\n renderer?: RendererDescription;\r\n}\r\n"]}
1
+ {"version":3,"file":"Category.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/Category.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAwBH,cAAc;AACd,IAAiB,mBAAmB,CAmCnC;AAnCD,WAAiB,mBAAmB;IAClC,uCAAuC;IACvC,SAAgB,MAAM,CAAC,QAA6B;QAClD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC;QACrC,OAAO;YACL,GAAG,IAAI;YACP,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SAClD,CAAC;IACJ,CAAC;IANe,0BAAM,SAMrB,CAAA;IAED;;;OAGG;IACH,SAAgB,QAAQ,CAAC,IAA6B;QACpD,6DAA6D;QAC7D,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAJe,4BAAQ,WAIvB,CAAA;IAED,SAAS,yBAAyB,CAAC,IAA6B,EAAE,aAA+C;QAC/G,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC;QAC/C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,mDAAmD;YACnD,QAAQ,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,+DAA+D;IAC/D,SAAgB,YAAY,CAAC,IAA+B;QAC1D,MAAM,aAAa,GAAG,IAAI,GAAG,EAA+B,CAAC;QAC7D,IAAI,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,mBAAmB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACjH,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,yBAAyB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC;IAC5F,CAAC;IAJe,gCAAY,eAI3B,CAAA;AACH,CAAC,EAnCgB,mBAAmB,mCAAnB,mBAAmB,QAmCnC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Content\n */\n\nimport { RendererDescription } from \"./Renderer\";\n\n/**\n * A data structure that describes a [[Field]] category.\n * @public\n */\nexport interface CategoryDescription {\n /** Unique name */\n name: string;\n /** Display label */\n label: string;\n /** Extensive description */\n description: string;\n /** Priority. Categories with higher priority should appear higher in the UI */\n priority: number;\n /** Should this category be auto-expanded when it's displayed in the UI */\n expand: boolean;\n /** Parent category description */\n parent?: CategoryDescription;\n /** Custom renderer description */\n renderer?: RendererDescription;\n}\n/** @public */\nexport namespace CategoryDescription {\n /** Serialize given category to JSON */\n export function toJSON(category: CategoryDescription): CategoryDescriptionJSON {\n const { parent, ...rest } = category;\n return {\n ...rest,\n ...(parent ? { parent: parent.name } : undefined),\n };\n }\n\n /**\n * Deserialize [[CategoryDescription]] from JSON. The `parent` is not assigned - use [[CategoryDescription.listFromJSON]]\n * to deserialize the whole categories list and set parents.\n */\n export function fromJSON(json: CategoryDescriptionJSON): CategoryDescription {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { parent, ...rest } = json;\n return rest;\n }\n\n function createCategoriesHierarchy(json: CategoryDescriptionJSON, categoriesMap: Map<string, CategoryDescription>): CategoryDescription {\n const category = categoriesMap.get(json.name)!;\n if (json.parent) {\n // note: mutating categories in the `categoriesMap`\n category.parent = categoriesMap.get(json.parent);\n }\n return category;\n }\n\n /** Deserialize a list of [[CategoryDescription]] from JSON. */\n export function listFromJSON(json: CategoryDescriptionJSON[]): CategoryDescription[] {\n const categoriesMap = new Map<string, CategoryDescription>();\n json.forEach((categoryJson) => categoriesMap.set(categoryJson.name, CategoryDescription.fromJSON(categoryJson)));\n return json.map((categoryJson) => createCategoriesHierarchy(categoryJson, categoriesMap));\n }\n}\n\n/**\n * Serialized [[CategoryDescription]] JSON representation.\n * @public\n */\nexport interface CategoryDescriptionJSON {\n name: string;\n label: string;\n description: string;\n priority: number;\n expand: boolean;\n parent?: string;\n renderer?: RendererDescription;\n}\n"]}
@@ -28,12 +28,5 @@ export declare class Content {
28
28
  toJSON(): ContentJSON;
29
29
  /** Deserialize [[Content]] from JSON */
30
30
  static fromJSON(json: ContentJSON | string | undefined): Content | undefined;
31
- /**
32
- * Reviver function that can be used as a second argument for
33
- * `JSON.parse` method when parsing Content objects.
34
- *
35
- * @internal
36
- */
37
- static reviver(key: string, value: any): any;
38
31
  }
39
32
  //# sourceMappingURL=Content.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../../../src/presentation-common/content/Content.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAExC;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,cAAc,CAAC;IAC3B,UAAU,EAAE,QAAQ,EAAE,CAAC;CACxB;AAED;;;;;GAKG;AACH,qBAAa,OAAO;IAClB,4CAA4C;IAC5C,SAAgB,UAAU,EAAE,UAAU,CAAC;IACvC,oBAAoB;IACpB,SAAgB,UAAU,EAAE,IAAI,EAAE,CAAC;IAEnC,wCAAwC;gBACrB,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE;IAKxD,oCAAoC;IAC7B,MAAM,IAAI,WAAW;IAO5B,wCAAwC;WAC1B,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS;IAkBnF;;;;;OAKG;WACW,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,GAAG;CAGpD"}
1
+ {"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../../../src/presentation-common/content/Content.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAExC;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,cAAc,CAAC;IAC3B,UAAU,EAAE,QAAQ,EAAE,CAAC;CACxB;AAED;;;;;GAKG;AACH,qBAAa,OAAO;IAClB,4CAA4C;IAC5C,SAAgB,UAAU,EAAE,UAAU,CAAC;IACvC,oBAAoB;IACpB,SAAgB,UAAU,EAAE,IAAI,EAAE,CAAC;IAEnC,wCAAwC;gBACrB,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE;IAKxD,oCAAoC;IAC7B,MAAM,IAAI,WAAW;IAO5B,wCAAwC;WAC1B,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS;CAiBpF"}
@@ -17,6 +17,10 @@ const Item_1 = require("./Item");
17
17
  * @public
18
18
  */
19
19
  class Content {
20
+ /** Descriptor used to create the content */
21
+ descriptor;
22
+ /** Content items */
23
+ contentSet;
20
24
  /** Create a new [[Content]] instance */
21
25
  constructor(descriptor, items) {
22
26
  this.descriptor = descriptor;
@@ -35,7 +39,7 @@ class Content {
35
39
  return undefined;
36
40
  }
37
41
  if (typeof json === "string") {
38
- return JSON.parse(json, (key, value) => Content.reviver(key, value));
42
+ return Content.fromJSON(JSON.parse(json));
39
43
  }
40
44
  const descriptor = Descriptor_1.Descriptor.fromJSON(json.descriptor);
41
45
  if (!descriptor) {
@@ -44,15 +48,6 @@ class Content {
44
48
  const contentSet = json.contentSet.map((itemJson) => Item_1.Item.fromJSON(itemJson)).filter((item) => item !== undefined);
45
49
  return new Content(descriptor, contentSet);
46
50
  }
47
- /**
48
- * Reviver function that can be used as a second argument for
49
- * `JSON.parse` method when parsing Content objects.
50
- *
51
- * @internal
52
- */
53
- static reviver(key, value) {
54
- return key === "" ? Content.fromJSON(value) : value;
55
- }
56
51
  }
57
52
  exports.Content = Content;
58
53
  //# sourceMappingURL=Content.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Content.js","sourceRoot":"","sources":["../../../../src/pres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AAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,OAAO,CAAC,GAAW,EAAE,KAAU;QAC3C,OAAO,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACtD,CAAC;CACF;AAhDD,0BAgDC","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 Content\r\n */\r\n\r\nimport { Descriptor, DescriptorJSON } from \"./Descriptor\";\r\nimport { Item, ItemJSON } from \"./Item\";\r\n\r\n/**\r\n * Serialized [[Content]] JSON representation.\r\n * @public\r\n */\r\nexport interface ContentJSON {\r\n descriptor: DescriptorJSON;\r\n contentSet: ItemJSON[];\r\n}\r\n\r\n/**\r\n * A data structure that contains the [[Descriptor]] and a list of [[Item]]\r\n * objects which are based on that descriptor.\r\n *\r\n * @public\r\n */\r\nexport class Content {\r\n /** Descriptor used to create the content */\r\n public readonly descriptor: Descriptor;\r\n /** Content items */\r\n public readonly contentSet: Item[];\r\n\r\n /** Create a new [[Content]] instance */\r\n public constructor(descriptor: Descriptor, items: Item[]) {\r\n this.descriptor = descriptor;\r\n this.contentSet = items;\r\n }\r\n\r\n /** Serialize this object to JSON */\r\n public toJSON(): ContentJSON {\r\n return {\r\n descriptor: this.descriptor.toJSON(),\r\n contentSet: this.contentSet.map((item: Item) => item.toJSON()),\r\n };\r\n }\r\n\r\n /** Deserialize [[Content]] from JSON */\r\n public static fromJSON(json: ContentJSON | string | undefined): Content | undefined {\r\n if (!json) {\r\n return undefined;\r\n }\r\n\r\n if (typeof json === \"string\") {\r\n return JSON.parse(json, (key, value) => Content.reviver(key, value));\r\n }\r\n\r\n const descriptor = Descriptor.fromJSON(json.descriptor);\r\n if (!descriptor) {\r\n return undefined;\r\n }\r\n\r\n const contentSet = json.contentSet.map((itemJson: ItemJSON) => Item.fromJSON(itemJson)).filter<Item>((item): item is Item => item !== undefined);\r\n return new Content(descriptor, contentSet);\r\n }\r\n\r\n /**\r\n * Reviver function that can be used as a second argument for\r\n * `JSON.parse` method when parsing Content objects.\r\n *\r\n * @internal\r\n */\r\n public static reviver(key: string, value: any): any {\r\n return key === \"\" ? Content.fromJSON(value) : value;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Content.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/Content.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,6CAA0D;AAC1D,iCAAwC;AAWxC;;;;;GAKG;AACH,MAAa,OAAO;IAClB,4CAA4C;IAC5B,UAAU,CAAa;IACvC,oBAAoB;IACJ,UAAU,CAAS;IAEnC,wCAAwC;IACxC,YAAmB,UAAsB,EAAE,KAAa;QACtD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED,oCAAoC;IAC7B,MAAM;QACX,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;YACpC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAU,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;SAC/D,CAAC;IACJ,CAAC;IAED,wCAAwC;IACjC,MAAM,CAAC,QAAQ,CAAC,IAAsC;QAC3D,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5C,CAAC;QAED,MAAM,UAAU,GAAG,uBAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,WAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAO,CAAC,IAAI,EAAgB,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;QACvI,OAAO,IAAI,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC7C,CAAC;CACF;AAtCD,0BAsCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Content\n */\n\nimport { Descriptor, DescriptorJSON } from \"./Descriptor\";\nimport { Item, ItemJSON } from \"./Item\";\n\n/**\n * Serialized [[Content]] JSON representation.\n * @public\n */\nexport interface ContentJSON {\n descriptor: DescriptorJSON;\n contentSet: ItemJSON[];\n}\n\n/**\n * A data structure that contains the [[Descriptor]] and a list of [[Item]]\n * objects which are based on that descriptor.\n *\n * @public\n */\nexport class Content {\n /** Descriptor used to create the content */\n public readonly descriptor: Descriptor;\n /** Content items */\n public readonly contentSet: Item[];\n\n /** Create a new [[Content]] instance */\n public constructor(descriptor: Descriptor, items: Item[]) {\n this.descriptor = descriptor;\n this.contentSet = items;\n }\n\n /** Serialize this object to JSON */\n public toJSON(): ContentJSON {\n return {\n descriptor: this.descriptor.toJSON(),\n contentSet: this.contentSet.map((item: Item) => item.toJSON()),\n };\n }\n\n /** Deserialize [[Content]] from JSON */\n public static fromJSON(json: ContentJSON | string | undefined): Content | undefined {\n if (!json) {\n return undefined;\n }\n\n if (typeof json === \"string\") {\n return Content.fromJSON(JSON.parse(json));\n }\n\n const descriptor = Descriptor.fromJSON(json.descriptor);\n if (!descriptor) {\n return undefined;\n }\n\n const contentSet = json.contentSet.map((itemJson) => Item.fromJSON(itemJson)).filter<Item>((item): item is Item => item !== undefined);\n return new Content(descriptor, contentSet);\n }\n}\n"]}