@itwin/presentation-common 5.2.0-dev.8 → 5.3.0-dev.1

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 (203) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/Ruleset.schema.json +18 -0
  3. package/lib/cjs/presentation-common/KeySet.d.ts +22 -7
  4. package/lib/cjs/presentation-common/KeySet.d.ts.map +1 -1
  5. package/lib/cjs/presentation-common/KeySet.js +28 -37
  6. package/lib/cjs/presentation-common/KeySet.js.map +1 -1
  7. package/lib/cjs/presentation-common/KoqPropertyValueFormatter.d.ts +2 -0
  8. package/lib/cjs/presentation-common/KoqPropertyValueFormatter.d.ts.map +1 -1
  9. package/lib/cjs/presentation-common/KoqPropertyValueFormatter.js +2 -2
  10. package/lib/cjs/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
  11. package/lib/cjs/presentation-common/LocalizationHelper.d.ts +1 -1
  12. package/lib/cjs/presentation-common/LocalizationHelper.d.ts.map +1 -1
  13. package/lib/cjs/presentation-common/LocalizationHelper.js +9 -7
  14. package/lib/cjs/presentation-common/LocalizationHelper.js.map +1 -1
  15. package/lib/cjs/presentation-common/PresentationManagerOptions.d.ts +10 -0
  16. package/lib/cjs/presentation-common/PresentationManagerOptions.d.ts.map +1 -1
  17. package/lib/cjs/presentation-common/PresentationManagerOptions.js.map +1 -1
  18. package/lib/cjs/presentation-common/PresentationRpcInterface.d.ts +8 -0
  19. package/lib/cjs/presentation-common/PresentationRpcInterface.d.ts.map +1 -1
  20. package/lib/cjs/presentation-common/PresentationRpcInterface.js +1 -2
  21. package/lib/cjs/presentation-common/PresentationRpcInterface.js.map +1 -1
  22. package/lib/cjs/presentation-common/RpcRequestsHandler.d.ts.map +1 -1
  23. package/lib/cjs/presentation-common/RpcRequestsHandler.js +2 -16
  24. package/lib/cjs/presentation-common/RpcRequestsHandler.js.map +1 -1
  25. package/lib/cjs/presentation-common/Update.d.ts +16 -0
  26. package/lib/cjs/presentation-common/Update.d.ts.map +1 -1
  27. package/lib/cjs/presentation-common/Update.js +1 -0
  28. package/lib/cjs/presentation-common/Update.js.map +1 -1
  29. package/lib/cjs/presentation-common/Utils.d.ts.map +1 -1
  30. package/lib/cjs/presentation-common/Utils.js +2 -0
  31. package/lib/cjs/presentation-common/Utils.js.map +1 -1
  32. package/lib/cjs/presentation-common/content/ContentTraverser.d.ts.map +1 -1
  33. package/lib/cjs/presentation-common/content/ContentTraverser.js +14 -10
  34. package/lib/cjs/presentation-common/content/ContentTraverser.js.map +1 -1
  35. package/lib/cjs/presentation-common/content/PropertyValueFormatter.d.ts.map +1 -1
  36. package/lib/cjs/presentation-common/content/PropertyValueFormatter.js +6 -1
  37. package/lib/cjs/presentation-common/content/PropertyValueFormatter.js.map +1 -1
  38. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.d.ts +2 -0
  39. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.d.ts.map +1 -1
  40. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js +1 -0
  41. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
  42. package/lib/cjs/presentation-common/hierarchy/Key.d.ts +23 -1
  43. package/lib/cjs/presentation-common/hierarchy/Key.d.ts.map +1 -1
  44. package/lib/cjs/presentation-common/hierarchy/Key.js +8 -1
  45. package/lib/cjs/presentation-common/hierarchy/Key.js.map +1 -1
  46. package/lib/cjs/presentation-common/hierarchy/Node.d.ts +4 -0
  47. package/lib/cjs/presentation-common/hierarchy/Node.d.ts.map +1 -1
  48. package/lib/cjs/presentation-common/hierarchy/Node.js +1 -0
  49. package/lib/cjs/presentation-common/hierarchy/Node.js.map +1 -1
  50. package/lib/cjs/presentation-common/hierarchy/NodePathElement.d.ts +4 -0
  51. package/lib/cjs/presentation-common/hierarchy/NodePathElement.d.ts.map +1 -1
  52. package/lib/cjs/presentation-common/hierarchy/NodePathElement.js +1 -0
  53. package/lib/cjs/presentation-common/hierarchy/NodePathElement.js.map +1 -1
  54. package/lib/cjs/presentation-common/rules/Rule.d.ts.map +1 -1
  55. package/lib/cjs/presentation-common/rules/Rule.js +1 -0
  56. package/lib/cjs/presentation-common/rules/Rule.js.map +1 -1
  57. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.d.ts.map +1 -1
  58. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.js +1 -0
  59. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
  60. package/lib/cjs/presentation-common/rules/customization/GroupingRule.d.ts +18 -0
  61. package/lib/cjs/presentation-common/rules/customization/GroupingRule.d.ts.map +1 -1
  62. package/lib/cjs/presentation-common/rules/customization/GroupingRule.js +5 -0
  63. package/lib/cjs/presentation-common/rules/customization/GroupingRule.js.map +1 -1
  64. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.d.ts +2 -0
  65. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.d.ts.map +1 -1
  66. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.js +1 -0
  67. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
  68. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts +8 -0
  69. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts.map +1 -1
  70. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.js +3 -0
  71. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
  72. package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts +2 -0
  73. package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts.map +1 -1
  74. package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.js +1 -0
  75. package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
  76. package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.d.ts +12 -0
  77. package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.d.ts.map +1 -1
  78. package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js +3 -0
  79. package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
  80. package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts +2 -0
  81. package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts.map +1 -1
  82. package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js +1 -0
  83. package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
  84. package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.d.ts +4 -0
  85. package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.d.ts.map +1 -1
  86. package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.js +1 -0
  87. package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
  88. package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.d.ts +2 -0
  89. package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.d.ts.map +1 -1
  90. package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
  91. package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.d.ts +2 -0
  92. package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.d.ts.map +1 -1
  93. package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js +1 -0
  94. package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
  95. package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.d.ts +2 -0
  96. package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.d.ts.map +1 -1
  97. package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.js +1 -0
  98. package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
  99. package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.d.ts +2 -0
  100. package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.d.ts.map +1 -1
  101. package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.js +1 -0
  102. package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
  103. package/lib/esm/presentation-common/KeySet.d.ts +22 -7
  104. package/lib/esm/presentation-common/KeySet.d.ts.map +1 -1
  105. package/lib/esm/presentation-common/KeySet.js +29 -38
  106. package/lib/esm/presentation-common/KeySet.js.map +1 -1
  107. package/lib/esm/presentation-common/KoqPropertyValueFormatter.d.ts +2 -0
  108. package/lib/esm/presentation-common/KoqPropertyValueFormatter.d.ts.map +1 -1
  109. package/lib/esm/presentation-common/KoqPropertyValueFormatter.js +2 -2
  110. package/lib/esm/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
  111. package/lib/esm/presentation-common/LocalizationHelper.d.ts +1 -1
  112. package/lib/esm/presentation-common/LocalizationHelper.d.ts.map +1 -1
  113. package/lib/esm/presentation-common/LocalizationHelper.js +9 -7
  114. package/lib/esm/presentation-common/LocalizationHelper.js.map +1 -1
  115. package/lib/esm/presentation-common/PresentationManagerOptions.d.ts +10 -0
  116. package/lib/esm/presentation-common/PresentationManagerOptions.d.ts.map +1 -1
  117. package/lib/esm/presentation-common/PresentationManagerOptions.js.map +1 -1
  118. package/lib/esm/presentation-common/PresentationRpcInterface.d.ts +8 -0
  119. package/lib/esm/presentation-common/PresentationRpcInterface.d.ts.map +1 -1
  120. package/lib/esm/presentation-common/PresentationRpcInterface.js +1 -2
  121. package/lib/esm/presentation-common/PresentationRpcInterface.js.map +1 -1
  122. package/lib/esm/presentation-common/RpcRequestsHandler.d.ts.map +1 -1
  123. package/lib/esm/presentation-common/RpcRequestsHandler.js +2 -16
  124. package/lib/esm/presentation-common/RpcRequestsHandler.js.map +1 -1
  125. package/lib/esm/presentation-common/Update.d.ts +16 -0
  126. package/lib/esm/presentation-common/Update.d.ts.map +1 -1
  127. package/lib/esm/presentation-common/Update.js +1 -0
  128. package/lib/esm/presentation-common/Update.js.map +1 -1
  129. package/lib/esm/presentation-common/Utils.d.ts.map +1 -1
  130. package/lib/esm/presentation-common/Utils.js +2 -0
  131. package/lib/esm/presentation-common/Utils.js.map +1 -1
  132. package/lib/esm/presentation-common/content/ContentTraverser.d.ts.map +1 -1
  133. package/lib/esm/presentation-common/content/ContentTraverser.js +14 -10
  134. package/lib/esm/presentation-common/content/ContentTraverser.js.map +1 -1
  135. package/lib/esm/presentation-common/content/PropertyValueFormatter.d.ts.map +1 -1
  136. package/lib/esm/presentation-common/content/PropertyValueFormatter.js +6 -1
  137. package/lib/esm/presentation-common/content/PropertyValueFormatter.js.map +1 -1
  138. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.d.ts +2 -0
  139. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.d.ts.map +1 -1
  140. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js +1 -0
  141. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
  142. package/lib/esm/presentation-common/hierarchy/Key.d.ts +23 -1
  143. package/lib/esm/presentation-common/hierarchy/Key.d.ts.map +1 -1
  144. package/lib/esm/presentation-common/hierarchy/Key.js +8 -1
  145. package/lib/esm/presentation-common/hierarchy/Key.js.map +1 -1
  146. package/lib/esm/presentation-common/hierarchy/Node.d.ts +4 -0
  147. package/lib/esm/presentation-common/hierarchy/Node.d.ts.map +1 -1
  148. package/lib/esm/presentation-common/hierarchy/Node.js +1 -0
  149. package/lib/esm/presentation-common/hierarchy/Node.js.map +1 -1
  150. package/lib/esm/presentation-common/hierarchy/NodePathElement.d.ts +4 -0
  151. package/lib/esm/presentation-common/hierarchy/NodePathElement.d.ts.map +1 -1
  152. package/lib/esm/presentation-common/hierarchy/NodePathElement.js +1 -0
  153. package/lib/esm/presentation-common/hierarchy/NodePathElement.js.map +1 -1
  154. package/lib/esm/presentation-common/rules/Rule.d.ts.map +1 -1
  155. package/lib/esm/presentation-common/rules/Rule.js +1 -0
  156. package/lib/esm/presentation-common/rules/Rule.js.map +1 -1
  157. package/lib/esm/presentation-common/rules/customization/CustomizationRule.d.ts.map +1 -1
  158. package/lib/esm/presentation-common/rules/customization/CustomizationRule.js +1 -0
  159. package/lib/esm/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
  160. package/lib/esm/presentation-common/rules/customization/GroupingRule.d.ts +18 -0
  161. package/lib/esm/presentation-common/rules/customization/GroupingRule.d.ts.map +1 -1
  162. package/lib/esm/presentation-common/rules/customization/GroupingRule.js +5 -0
  163. package/lib/esm/presentation-common/rules/customization/GroupingRule.js.map +1 -1
  164. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.d.ts +2 -0
  165. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.d.ts.map +1 -1
  166. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.js +1 -0
  167. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
  168. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts +8 -0
  169. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts.map +1 -1
  170. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.js +3 -0
  171. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
  172. package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts +2 -0
  173. package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts.map +1 -1
  174. package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.js +1 -0
  175. package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
  176. package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.d.ts +12 -0
  177. package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.d.ts.map +1 -1
  178. package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js +3 -0
  179. package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
  180. package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts +2 -0
  181. package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts.map +1 -1
  182. package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js +1 -0
  183. package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
  184. package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.d.ts +4 -0
  185. package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.d.ts.map +1 -1
  186. package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.js +1 -0
  187. package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
  188. package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.d.ts +2 -0
  189. package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.d.ts.map +1 -1
  190. package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
  191. package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.d.ts +2 -0
  192. package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.d.ts.map +1 -1
  193. package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js +1 -0
  194. package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
  195. package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.d.ts +2 -0
  196. package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.d.ts.map +1 -1
  197. package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.js +1 -0
  198. package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
  199. package/lib/esm/presentation-common/rules/hierarchy/SubCondition.d.ts +2 -0
  200. package/lib/esm/presentation-common/rules/hierarchy/SubCondition.d.ts.map +1 -1
  201. package/lib/esm/presentation-common/rules/hierarchy/SubCondition.js +1 -0
  202. package/lib/esm/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
  203. package/package.json +11 -11
package/CHANGELOG.md CHANGED
@@ -1,6 +1,38 @@
1
1
  # Change Log - @itwin/presentation-common
2
2
 
3
- This log was last generated on Thu, 14 Aug 2025 19:42:13 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 17 Sep 2025 17:22:51 GMT and should not be manually modified.
4
+
5
+ ## 5.1.8
6
+ Wed, 17 Sep 2025 17:17:16 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 5.1.7
11
+ Tue, 09 Sep 2025 19:28:04 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 5.1.6
16
+ Mon, 08 Sep 2025 13:53:47 GMT
17
+
18
+ _Version update only_
19
+
20
+ ## 5.1.5
21
+ Thu, 04 Sep 2025 13:51:09 GMT
22
+
23
+ ### Updates
24
+
25
+ - Fixed content formatting failure when struct property value has members with `undefined` value.
26
+
27
+ ## 5.1.4
28
+ Fri, 22 Aug 2025 14:22:33 GMT
29
+
30
+ _Version update only_
31
+
32
+ ## 5.1.3
33
+ Wed, 20 Aug 2025 13:57:10 GMT
34
+
35
+ _Version update only_
4
36
 
5
37
  ## 5.1.2
6
38
  Thu, 14 Aug 2025 19:38:08 GMT
@@ -74,6 +74,7 @@
74
74
  },
75
75
  "ChildNodeRule": {
76
76
  "additionalProperties": false,
77
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
77
78
  "description": "Child node rules are used to define child nodes in a hierarchy.",
78
79
  "properties": {
79
80
  "condition": {
@@ -148,10 +149,12 @@
148
149
  "$ref": "#/definitions/RelatedInstanceNodesSpecification"
149
150
  }
150
151
  ],
152
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
151
153
  "description": "Hierarchy rule specifications that define what nodes are going to be returned by the rule."
152
154
  },
153
155
  "ClassGroup": {
154
156
  "additionalProperties": false,
157
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
155
158
  "description": "Base class grouping allows grouping ECInstance nodes by their base class (as opposed to the hierarchy\nspecifications' `groupByClass` attribute, which always groups by direct class).",
156
159
  "properties": {
157
160
  "baseClass": {
@@ -472,6 +475,7 @@
472
475
  },
473
476
  "CustomNodeSpecification": {
474
477
  "additionalProperties": false,
478
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
475
479
  "description": "Returns a static custom-defined node that's not based on an ECInstance.",
476
480
  "properties": {
477
481
  "description": {
@@ -555,6 +559,7 @@
555
559
  },
556
560
  "CustomQueryInstanceNodesSpecification": {
557
561
  "additionalProperties": false,
562
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
558
563
  "description": "Returns nodes for instances returned by a provided ECSQL query.",
559
564
  "properties": {
560
565
  "doNotSort": {
@@ -752,6 +757,7 @@
752
757
  },
753
758
  "ECPropertyValueQuerySpecification": {
754
759
  "additionalProperties": false,
760
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
755
761
  "description": "The specification specifies the name of the parent node instance property whose value is the ECSQL\nused to query for instances.",
756
762
  "properties": {
757
763
  "class": {
@@ -823,6 +829,7 @@
823
829
  },
824
830
  "GroupingRule": {
825
831
  "additionalProperties": false,
832
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
826
833
  "description": "Grouping rules provide advanced ways to group instances when creating hierarchies.",
827
834
  "properties": {
828
835
  "class": {
@@ -882,6 +889,7 @@
882
889
  "$ref": "#/definitions/SameLabelInstanceGroup"
883
890
  }
884
891
  ],
892
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
885
893
  "description": "Grouping rule specifications."
886
894
  },
887
895
  "IdCategoryIdentifier": {
@@ -1179,6 +1187,7 @@
1179
1187
  },
1180
1188
  "InstanceNodesOfSpecificClassesSpecification": {
1181
1189
  "additionalProperties": false,
1190
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
1182
1191
  "description": "Returns nodes for instances of specific ECClasses.",
1183
1192
  "properties": {
1184
1193
  "classes": {
@@ -1328,6 +1337,7 @@
1328
1337
  },
1329
1338
  "NodeArtifactsRule": {
1330
1339
  "additionalProperties": false,
1340
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
1331
1341
  "description": "Node artifacts rules are used to create and assign artifacts to specific nodes. The artifacts can be\naccessed when evaluating parent node's `hideExpression` to decide whether it should be hidden or not.",
1332
1342
  "properties": {
1333
1343
  "condition": {
@@ -1589,6 +1599,7 @@
1589
1599
  },
1590
1600
  "PropertyGroup": {
1591
1601
  "additionalProperties": false,
1602
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
1592
1603
  "description": "Property grouping allows grouping by a property of the instance by value or by given ranges of values.",
1593
1604
  "properties": {
1594
1605
  "createGroupForSingleItem": {
@@ -1633,6 +1644,7 @@
1633
1644
  },
1634
1645
  "PropertyRangeGroupSpecification": {
1635
1646
  "additionalProperties": false,
1647
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
1636
1648
  "description": "Describes a grouping range.",
1637
1649
  "properties": {
1638
1650
  "fromValue": {
@@ -1795,6 +1807,7 @@
1795
1807
  "$ref": "#/definitions/ECPropertyValueQuerySpecification"
1796
1808
  }
1797
1809
  ],
1810
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
1798
1811
  "description": "Query specifications used in `CustomQueryInstanceNodesSpecification`."
1799
1812
  },
1800
1813
  "RelatedInstanceByPathSpecification": {
@@ -1865,6 +1878,7 @@
1865
1878
  },
1866
1879
  "RelatedInstanceNodesSpecification": {
1867
1880
  "additionalProperties": false,
1881
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
1868
1882
  "description": "Produces ECInstance nodes that are related to some source ECInstance. The source instance is determined\nby traversing the hierarchy upwards until an ECInstance node is encountered.",
1869
1883
  "properties": {
1870
1884
  "doNotSort": {
@@ -2196,6 +2210,7 @@
2196
2210
  },
2197
2211
  "RootNodeRule": {
2198
2212
  "additionalProperties": false,
2213
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
2199
2214
  "description": "Root node rules are used to define nodes that are displayed at the root hierarchy level.",
2200
2215
  "properties": {
2201
2216
  "autoExpand": {
@@ -2299,6 +2314,7 @@
2299
2314
  },
2300
2315
  "SameLabelInstanceGroup": {
2301
2316
  "additionalProperties": false,
2317
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
2302
2318
  "description": "Allows grouping multiple instances with the same label into one ECInstances type of node. Similar to display label grouping,\nbut instead of showing a grouping node with multiple grouped ECInstance nodes, it shows a single ECInstances node which represents\nmultiple ECInstances.",
2303
2319
  "properties": {
2304
2320
  "applicationStage": {
@@ -2443,6 +2459,7 @@
2443
2459
  },
2444
2460
  "StringQuerySpecification": {
2445
2461
  "additionalProperties": false,
2462
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
2446
2463
  "description": "The specification contains an ECSQL query which is used to query for instances.",
2447
2464
  "properties": {
2448
2465
  "class": {
@@ -2470,6 +2487,7 @@
2470
2487
  },
2471
2488
  "SubCondition": {
2472
2489
  "additionalProperties": false,
2490
+ "deprecated": "in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\npackage for creating hierarchies.",
2473
2491
  "description": "This is a sub-rule which shares *placement attributes* and\nnested customization rules\nof the hierarchy rule. This means the attributes of hierarchy rule are still in effect and the sub-rules\ncan add additional condition of their own.",
2474
2492
  "properties": {
2475
2493
  "condition": {
@@ -12,12 +12,17 @@ import { NodeKey } from "./hierarchy/Key.js";
12
12
  export type Key = Readonly<NodeKey> | Readonly<InstanceKey> | Readonly<EntityProps>;
13
13
  /** @public */
14
14
  export declare namespace Key {
15
- /** Check if the supplied key is a `NodeKey` */
16
- function isNodeKey(key: Key): key is NodeKey;
15
+ /**
16
+ * Check if the supplied key is a `NodeKey`
17
+ *
18
+ * @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
19
+ * package for creating hierarchies.
20
+ */
21
+ function isNodeKey(key: Key): key is Extract<Key, Readonly<NodeKey>>;
17
22
  /** Check if the supplied key is an `InstanceKey` */
18
- function isInstanceKey(key: Key): key is InstanceKey;
23
+ function isInstanceKey(key: Key): key is Extract<Key, Readonly<InstanceKey>>;
19
24
  /** Check if the supplied key is an `EntityProps` */
20
- function isEntityProps(key: Key): key is EntityProps;
25
+ function isEntityProps(key: Key): key is Extract<Key, Readonly<EntityProps>>;
21
26
  }
22
27
  /**
23
28
  * A type for multiple keys that identify something in iModel.js application
@@ -31,7 +36,12 @@ export type Keys = ReadonlyArray<Key> | Readonly<KeySet>;
31
36
  export interface KeySetJSON {
32
37
  /** JSON representation of a list of instance keys */
33
38
  instanceKeys: Array<[string, string]>;
34
- /** An array of serialized node keys */
39
+ /**
40
+ * An array of serialized node keys
41
+ *
42
+ * @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
43
+ * package for creating hierarchies.
44
+ */
35
45
  nodeKeys: NodeKey[];
36
46
  }
37
47
  /**
@@ -71,12 +81,17 @@ export declare class KeySet {
71
81
  /**
72
82
  * Get a set of node keys stored in this KeySet
73
83
  *
74
- * **Warning**: getting node keys might be expensive for
75
- * large KeySets.
84
+ * **Warning**: getting node keys might be expensive for large KeySets.
85
+ *
86
+ * @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
87
+ * package for creating hierarchies.
76
88
  */
77
89
  get nodeKeys(): Set<NodeKey>;
78
90
  /**
79
91
  * Get node keys count
92
+ *
93
+ * @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
94
+ * package for creating hierarchies.
80
95
  */
81
96
  get nodeKeysCount(): number;
82
97
  private isKeySet;
@@ -1 +1 @@
1
- {"version":3,"file":"KeySet.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/KeySet.ts"],"names":[],"mappings":"AAIA;;G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,EAAE,IAAI,GAAG,OAAO;IAQlC;;;OAGG;IACI,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;IAQlC;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAOxB;IAED;;OAEG;IACH,IAAW,OAAO,IAAI,OAAO,CAE5B;IAED,4CAA4C;IACrC,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO;IAU3C,4CAA4C;IAErC,OAAO,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI;IAW5E,sDAAsD;IAC/C,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI;IAqBvF;;;OAGG;IACI,MAAM,IAAI,UAAU;IAoB3B;;;OAGG;WACW,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM;CAKjD"}
@@ -9,13 +9,19 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.KeySet = exports.Key = void 0;
11
11
  const core_bentley_1 = require("@itwin/core-bentley");
12
- const Error_js_1 = require("./Error.js");
13
12
  /** @public */
14
13
  // eslint-disable-next-line @typescript-eslint/no-redeclare
15
14
  var Key;
16
15
  (function (Key) {
17
- /** Check if the supplied key is a `NodeKey` */
16
+ /**
17
+ * Check if the supplied key is a `NodeKey`
18
+ *
19
+ * @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
20
+ * package for creating hierarchies.
21
+ */
22
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
18
23
  function isNodeKey(key) {
24
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
19
25
  return !!key.type;
20
26
  }
21
27
  Key.isNodeKey = isNodeKey;
@@ -91,10 +97,13 @@ class KeySet {
91
97
  /**
92
98
  * Get a set of node keys stored in this KeySet
93
99
  *
94
- * **Warning**: getting node keys might be expensive for
95
- * large KeySets.
100
+ * **Warning**: getting node keys might be expensive for large KeySets.
101
+ *
102
+ * @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
103
+ * package for creating hierarchies.
96
104
  */
97
105
  get nodeKeys() {
106
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
98
107
  const set = new Set();
99
108
  for (const serialized of this._nodeKeys) {
100
109
  set.add(JSON.parse(serialized));
@@ -103,6 +112,9 @@ class KeySet {
103
112
  }
104
113
  /**
105
114
  * Get node keys count
115
+ *
116
+ * @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
117
+ * package for creating hierarchies.
106
118
  */
107
119
  get nodeKeysCount() {
108
120
  return this._nodeKeys.size;
@@ -149,6 +161,7 @@ class KeySet {
149
161
  }
150
162
  }
151
163
  addKeySetJSON(keyset) {
164
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
152
165
  for (const key of keyset.nodeKeys) {
153
166
  this._nodeKeys.add(JSON.stringify(key));
154
167
  }
@@ -168,9 +181,6 @@ class KeySet {
168
181
  * @returns itself
169
182
  */
170
183
  add(value, pred) {
171
- if (!value) {
172
- throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: value = ${value}`);
173
- }
174
184
  const sizeBefore = this.size;
175
185
  if (this.isKeySet(value)) {
176
186
  this.addKeySet(value, pred);
@@ -190,13 +200,11 @@ class KeySet {
190
200
  }
191
201
  this._lowerCaseMap.set(lcClassName, normalizedClassName);
192
202
  this._instanceKeys.get(lcClassName).add(value.id);
203
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
193
204
  }
194
205
  else if (Key.isNodeKey(value)) {
195
206
  this._nodeKeys.add(JSON.stringify(value));
196
207
  }
197
- else {
198
- throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: value = ${JSON.stringify(value)}`);
199
- }
200
208
  }
201
209
  if (this.size !== sizeBefore) {
202
210
  this.recalculateGuid();
@@ -222,9 +230,6 @@ class KeySet {
222
230
  * @returns itself
223
231
  */
224
232
  delete(value) {
225
- if (!value) {
226
- throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: value = ${value}`);
227
- }
228
233
  const sizeBefore = this.size;
229
234
  if (this.isKeySet(value)) {
230
235
  this.deleteKeySet(value);
@@ -243,13 +248,11 @@ class KeySet {
243
248
  if (set) {
244
249
  set.delete(value.id);
245
250
  }
251
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
246
252
  }
247
253
  else if (Key.isNodeKey(value)) {
248
254
  this._nodeKeys.delete(JSON.stringify(value));
249
255
  }
250
- else {
251
- throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: value = ${JSON.stringify(value)}`);
252
- }
253
256
  if (this.size !== sizeBefore) {
254
257
  this.recalculateGuid();
255
258
  }
@@ -260,9 +263,6 @@ class KeySet {
260
263
  * @param value The key to check.
261
264
  */
262
265
  has(value) {
263
- if (!value) {
264
- throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: value = ${value}`);
265
- }
266
266
  if (Key.isEntityProps(value)) {
267
267
  return this.has({ className: value.classFullName, id: value.id });
268
268
  }
@@ -271,10 +271,9 @@ class KeySet {
271
271
  const set = this._instanceKeys.get(normalizedClassName.toLowerCase());
272
272
  return !!(set && set.has(value.id));
273
273
  }
274
- if (Key.isNodeKey(value)) {
275
- return this._nodeKeys.has(JSON.stringify(value));
276
- }
277
- throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: value = ${JSON.stringify(value)}`);
274
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
275
+ (0, core_bentley_1.assert)(Key.isNodeKey(value));
276
+ return this._nodeKeys.has(JSON.stringify(value));
278
277
  }
279
278
  hasKeySet(readonlyKeys, checkType) {
280
279
  // note: cast-away read-onlyness to access private members...
@@ -334,32 +333,22 @@ class KeySet {
334
333
  * @param keys The keys to check.
335
334
  */
336
335
  hasAll(keys) {
337
- if (!keys) {
338
- throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: value = ${keys}`);
339
- }
340
336
  if (this.isKeySet(keys)) {
341
337
  return this.hasKeySet(keys, "all");
342
338
  }
343
- if (this.isKeysArray(keys)) {
344
- return this.hasKeysArray(keys, "all");
345
- }
346
- throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: keys = ${keys}`);
339
+ (0, core_bentley_1.assert)(this.isKeysArray(keys));
340
+ return this.hasKeysArray(keys, "all");
347
341
  }
348
342
  /**
349
343
  * Check if this KeySet contains any of the specified keys.
350
344
  * @param keys The keys to check.
351
345
  */
352
346
  hasAny(keys) {
353
- if (!keys) {
354
- throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: value = ${keys}`);
355
- }
356
347
  if (this.isKeySet(keys)) {
357
348
  return this.hasKeySet(keys, "any");
358
349
  }
359
- if (this.isKeysArray(keys)) {
360
- return this.hasKeysArray(keys, "any");
361
- }
362
- throw new Error_js_1.PresentationError(Error_js_1.PresentationStatus.InvalidArgument, `Invalid argument: keys = ${keys}`);
350
+ (0, core_bentley_1.assert)(this.isKeysArray(keys));
351
+ return this.hasKeysArray(keys, "any");
363
352
  }
364
353
  /**
365
354
  * Get the number of keys stored in this KeySet.
@@ -389,6 +378,7 @@ class KeySet {
389
378
  return some(this._nodeKeys, (serializedKey) => callback(JSON.parse(serializedKey)));
390
379
  }
391
380
  /** Iterate over all keys in this keyset. */
381
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
392
382
  forEach(callback) {
393
383
  let index = 0;
394
384
  this._instanceKeys.forEach((ids, className) => {
@@ -433,6 +423,7 @@ class KeySet {
433
423
  instanceKeys.push([className, compressedIds.length > 0 ? compressedIds : core_bentley_1.Id64.invalid]);
434
424
  }
435
425
  }
426
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
436
427
  const nodeKeys = [];
437
428
  for (const serializedKey of this._nodeKeys.values()) {
438
429
  nodeKeys.push(JSON.parse(serializedKey));
@@ -1 +1 @@
1
- {"version":3,"file":"KeySet.js","sourceRoot":"","sources":["../../../src/presentation-common/KeySet.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA4F;AAG5F,yCAAmE;AASnE,cAAc;AACd,2DAA2D;AAC3D,IAAiB,GAAG,CAenB;AAfD,WAAiB,GAAG;IAClB,+CAA+C;IAC/C,SAAgB,SAAS,CAAC,GAAQ;QAChC,OAAO,CAAC,CAAE,GAAe,CAAC,IAAI,CAAC;IACjC,CAAC;IAFe,aAAS,YAExB,CAAA;IAED,oDAAoD;IACpD,SAAgB,aAAa,CAAC,GAAQ;QACpC,OAAO,CAAC,CAAE,GAAmB,CAAC,SAAS,IAAI,CAAC,CAAE,GAAmB,CAAC,EAAE,CAAC;IACvE,CAAC;IAFe,iBAAa,gBAE5B,CAAA;IAED,oDAAoD;IACpD,SAAgB,aAAa,CAAC,GAAQ;QACpC,OAAO,CAAC,CAAE,GAAmB,CAAC,aAAa,IAAI,CAAC,CAAE,GAAmB,CAAC,EAAE,CAAC;IAC3E,CAAC;IAFe,iBAAa,gBAE5B,CAAA;AACH,CAAC,EAfgB,GAAG,mBAAH,GAAG,QAenB;AAmBD;;;;;GAKG;AACH,MAAa,MAAM;IACjB,qFAAqF;IAC7E,aAAa,CAA2B,CAAC,wCAAwC;IACjF,aAAa,CAAsB,CAAC,kDAAkD;IACtF,SAAS,CAAc;IACvB,KAAK,CAAc;IAE3B;;;OAGG;IACH,YAAY,MAAa;QACvB,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;QAC/B,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,C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IAAI,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YACb,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,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 { CompressedId64Set, Guid, GuidString, Id64, Id64String } from \"@itwin/core-bentley\";\nimport { EntityProps } from \"@itwin/core-common\";\nimport { InstanceId, InstanceKey } from \"./EC.js\";\nimport { PresentationError, PresentationStatus } from \"./Error.js\";\nimport { NodeKey } from \"./hierarchy/Key.js\";\n\n/**\n * A single key that identifies something in an iTwin.js application\n * @public\n */\nexport type Key = Readonly<NodeKey> | Readonly<InstanceKey> | Readonly<EntityProps>;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace Key {\n /** Check if the supplied key is a `NodeKey` */\n export function isNodeKey(key: Key): key is NodeKey {\n return !!(key as NodeKey).type;\n }\n\n /** Check if the supplied key is an `InstanceKey` */\n export function isInstanceKey(key: Key): key is InstanceKey {\n return !!(key as InstanceKey).className && !!(key as InstanceKey).id;\n }\n\n /** Check if the supplied key is an `EntityProps` */\n export function isEntityProps(key: Key): key is EntityProps {\n return !!(key as EntityProps).classFullName && !!(key as EntityProps).id;\n }\n}\n\n/**\n * A type for multiple keys that identify something in iModel.js application\n * @public\n */\nexport type Keys = ReadonlyArray<Key> | Readonly<KeySet>;\n\n/**\n * A data structure of serialized [[KeySet]]\n * @public\n */\nexport interface KeySetJSON {\n /** JSON representation of a list of instance keys */\n instanceKeys: Array<[string, string]>;\n /** An array of serialized node keys */\n nodeKeys: NodeKey[];\n}\n\n/**\n * A class that holds multiple [[Key]] objects. It's basically\n * used as a container that holds multiple keys of different types.\n *\n * @public\n */\nexport class KeySet {\n // note: all keys are stored as strings because we need ability to find them by value\n private _instanceKeys: Map<string, Set<string>>; // lower case class name => instance ids\n private _lowerCaseMap: Map<string, string>; // lower case class name => most recent class name\n private _nodeKeys: Set<string>;\n private _guid!: GuidString;\n\n /**\n * Creates an instance of KeySet.\n * @param source Optional source to initialize from.\n */\n constructor(source?: Keys) {\n this._instanceKeys = new Map();\n this._lowerCaseMap = new Map();\n this._nodeKeys = new Set();\n this.recalculateGuid();\n if (source) {\n this.add(source);\n }\n }\n\n private recalculateGuid() {\n // empty keyset should have empty guid, otherwise use a random guid value\n this._guid = this.isEmpty ? Guid.empty : Guid.createValue();\n }\n\n /**\n * Get a GUID that identifies changes in this keyset. The value\n * does not uniquely identify contents of the keyset, but it can be\n * used to check whether keyset has changed.\n */\n public get guid(): GuidString {\n return this._guid;\n }\n\n /**\n * Get a map of instance keys stored in this KeySet\n *\n * **Warning**: getting instance keys might be expensive for\n * large KeySets.\n */\n public get instanceKeys(): Map<string, Set<InstanceId>> {\n const map = new Map<string, Set<InstanceId>>();\n for (const entry of this._instanceKeys) {\n map.set(this._lowerCaseMap.get(entry[\"0\"])!, new Set([...entry[\"1\"]].map((key: string) => Id64.fromJSON(key))));\n }\n return map;\n }\n\n /**\n * Get instance keys count\n */\n public get instanceKeysCount(): number {\n let count = 0;\n this._instanceKeys.forEach((set: Set<string>) => (count += set.size));\n return count;\n }\n\n /**\n * Get a set of node keys stored in this KeySet\n *\n * **Warning**: getting node keys might be expensive for\n * large KeySets.\n */\n public get nodeKeys(): Set<NodeKey> {\n const set = new Set<NodeKey>();\n for (const serialized of this._nodeKeys) {\n set.add(JSON.parse(serialized));\n }\n return set;\n }\n\n /**\n * Get node keys count\n */\n public get nodeKeysCount(): number {\n return this._nodeKeys.size;\n }\n\n private isKeySet(set: Keys | Key): set is Readonly<KeySet> {\n return !!(set as KeySet)._nodeKeys && !!(set as KeySet)._instanceKeys;\n }\n\n private isKeysArray(keys: Keys | Key): keys is ReadonlyArray<Key> {\n return Array.isArray(keys);\n }\n\n /**\n * Clear this KeySet.\n * @returns itself\n */\n public clear(): KeySet {\n if (this.isEmpty) {\n return this;\n }\n\n this._instanceKeys = new Map();\n this._lowerCaseMap = new Map();\n this._nodeKeys = new Set();\n this.recalculateGuid();\n return this;\n }\n\n private addKeySet(keyset: Readonly<KeySet>, pred?: (key: Key) => boolean): void {\n for (const key of (keyset as any)._nodeKeys) {\n if (!pred || pred(JSON.parse(key))) {\n this._nodeKeys.add(key);\n }\n }\n for (const entry of (keyset as any)._instanceKeys) {\n let set = this._instanceKeys.get(entry[\"0\"]);\n const className = (keyset as KeySet)._lowerCaseMap.get(entry[\"0\"])!;\n if (!set) {\n set = new Set();\n this._instanceKeys.set(entry[\"0\"], set);\n this._lowerCaseMap.set(entry[\"0\"], className);\n }\n entry[\"1\"].forEach((id: Id64String) => {\n if (!pred || pred({ className, id })) {\n set.add(id);\n }\n });\n }\n }\n\n private addKeySetJSON(keyset: Readonly<KeySetJSON>): void {\n for (const key of keyset.nodeKeys) {\n this._nodeKeys.add(JSON.stringify(key));\n }\n for (const entry of keyset.instanceKeys) {\n const normalizedClassName = normalizeClassName(entry[\"0\"]);\n const lcClassName = normalizedClassName.toLowerCase();\n const idsJson: string | Id64String[] = entry[\"1\"];\n const ids: Set<Id64String> =\n typeof idsJson === \"string\" ? (idsJson === Id64.invalid ? new Set([Id64.invalid]) : CompressedId64Set.decompressSet(idsJson)) : new Set(idsJson);\n this._instanceKeys.set(lcClassName, ids);\n this._lowerCaseMap.set(lcClassName, normalizedClassName);\n }\n }\n\n /**\n * Add a key or keys to this KeySet.\n * @param value A key or keys to add.\n * @param pred An optional predicate function that indicates whether a key should be added\n * @returns itself\n */\n public add(value: Keys | Key, pred?: (key: Key) => boolean): KeySet {\n if (!value) {\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: value = ${value}`);\n }\n const sizeBefore = this.size;\n if (this.isKeySet(value)) {\n this.addKeySet(value, pred);\n } else if (this.isKeysArray(value)) {\n value.forEach((key) => this.add(key, pred));\n } else if (!pred || pred(value)) {\n if (Key.isEntityProps(value)) {\n this.add({ className: value.classFullName, id: Id64.fromJSON(value.id) } as InstanceKey);\n } else if (Key.isInstanceKey(value)) {\n const normalizedClassName = normalizeClassName(value.className);\n const lcClassName = normalizedClassName.toLowerCase();\n if (!this._instanceKeys.has(lcClassName)) {\n this._instanceKeys.set(lcClassName, new Set());\n }\n this._lowerCaseMap.set(lcClassName, normalizedClassName);\n this._instanceKeys.get(lcClassName)!.add(value.id);\n } else if (Key.isNodeKey(value)) {\n this._nodeKeys.add(JSON.stringify(value));\n } else {\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: value = ${JSON.stringify(value)}`);\n }\n }\n if (this.size !== sizeBefore) {\n this.recalculateGuid();\n }\n return this;\n }\n\n private deleteKeySet(keyset: Readonly<KeySet>): void {\n for (const key of (keyset as any)._nodeKeys) {\n this._nodeKeys.delete(key);\n }\n for (const entry of (keyset as any)._instanceKeys) {\n const set = this._instanceKeys.get(entry[\"0\"]);\n if (set) {\n entry[\"1\"].forEach((key: string) => {\n set.delete(key);\n });\n }\n }\n }\n\n /**\n * Deletes a key or keys from this KeySet.\n * @param value A key or keys to delete.\n * @returns itself\n */\n public delete(value: Keys | Key): KeySet {\n if (!value) {\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: value = ${value}`);\n }\n const sizeBefore = this.size;\n if (this.isKeySet(value)) {\n this.deleteKeySet(value);\n } else if (this.isKeysArray(value)) {\n for (const key of value) {\n this.delete(key);\n }\n } else if (Key.isEntityProps(value)) {\n this.delete({ className: value.classFullName, id: value.id! } as InstanceKey);\n } else if (Key.isInstanceKey(value)) {\n const normalizedClassName = normalizeClassName(value.className);\n const set = this._instanceKeys.get(normalizedClassName.toLowerCase());\n if (set) {\n set.delete(value.id);\n }\n } else if (Key.isNodeKey(value)) {\n this._nodeKeys.delete(JSON.stringify(value));\n } else {\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: value = ${JSON.stringify(value)}`);\n }\n if (this.size !== sizeBefore) {\n this.recalculateGuid();\n }\n return this;\n }\n\n /**\n * Check if this KeySet contains the specified key.\n * @param value The key to check.\n */\n public has(value: Key): boolean {\n if (!value) {\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: value = ${value}`);\n }\n if (Key.isEntityProps(value)) {\n return this.has({ className: value.classFullName, id: value.id! } as InstanceKey);\n }\n if (Key.isInstanceKey(value)) {\n const normalizedClassName = normalizeClassName(value.className);\n const set = this._instanceKeys.get(normalizedClassName.toLowerCase());\n return !!(set && set.has(value.id));\n }\n if (Key.isNodeKey(value)) {\n return this._nodeKeys.has(JSON.stringify(value));\n }\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: value = ${JSON.stringify(value)}`);\n }\n\n private hasKeySet(readonlyKeys: Readonly<KeySet>, checkType: \"all\" | \"any\"): boolean {\n // note: cast-away read-onlyness to access private members...\n const keys = readonlyKeys as KeySet;\n\n if (checkType === \"all\") {\n if (this._nodeKeys.size < keys._nodeKeys.size || this._instanceKeys.size < keys._instanceKeys.size) {\n return false;\n }\n if ([...keys._nodeKeys].some((key) => !this._nodeKeys.has(key))) {\n return false;\n }\n for (const otherEntry of keys._instanceKeys) {\n const thisEntryKeys = this._instanceKeys.get(otherEntry[\"0\"]);\n if (!thisEntryKeys || thisEntryKeys.size < otherEntry[\"1\"].size) {\n return false;\n }\n if ([...otherEntry[\"1\"]].some((key) => !thisEntryKeys.has(key))) {\n return false;\n }\n }\n return true;\n }\n\n // \"any\" check type\n if ([...keys._nodeKeys].some((key) => this._nodeKeys.has(key))) {\n return true;\n }\n for (const otherEntry of keys._instanceKeys) {\n const thisEntryKeys = this._instanceKeys.get(otherEntry[\"0\"]);\n if (thisEntryKeys && [...otherEntry[\"1\"]].some((key) => thisEntryKeys.has(key))) {\n return true;\n }\n }\n return false;\n }\n\n private hasKeysArray(keys: ReadonlyArray<Key>, checkType: \"all\" | \"any\"): boolean {\n if (checkType === \"all\") {\n if (this.size < keys.length) {\n return false;\n }\n for (const key of keys) {\n if (!this.has(key)) {\n return false;\n }\n }\n return true;\n }\n\n // \"any\" check type\n for (const key of keys) {\n if (this.has(key)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Check if this KeySet contains all the specified keys.\n * @param keys The keys to check.\n */\n public hasAll(keys: Keys): boolean {\n if (!keys) {\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: value = ${keys}`);\n }\n if (this.isKeySet(keys)) {\n return this.hasKeySet(keys, \"all\");\n }\n if (this.isKeysArray(keys)) {\n return this.hasKeysArray(keys, \"all\");\n }\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: keys = ${keys}`);\n }\n\n /**\n * Check if this KeySet contains any of the specified keys.\n * @param keys The keys to check.\n */\n public hasAny(keys: Keys): boolean {\n if (!keys) {\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: value = ${keys}`);\n }\n if (this.isKeySet(keys)) {\n return this.hasKeySet(keys, \"any\");\n }\n if (this.isKeysArray(keys)) {\n return this.hasKeysArray(keys, \"any\");\n }\n throw new PresentationError(PresentationStatus.InvalidArgument, `Invalid argument: keys = ${keys}`);\n }\n\n /**\n * Get the number of keys stored in this KeySet.\n */\n public get size(): number {\n const nodeKeysCount = this._nodeKeys.size;\n let instanceIdsCount = 0;\n for (const set of this._instanceKeys.values()) {\n instanceIdsCount += set.size;\n }\n return nodeKeysCount + instanceIdsCount;\n }\n\n /**\n * Is this KeySet currently empty.\n */\n public get isEmpty(): boolean {\n return 0 === this.size;\n }\n\n /** Iterate over all keys in this keyset. */\n public some(callback: (key: Key) => boolean) {\n for (const entry of this._instanceKeys) {\n const className = this._lowerCaseMap.get(entry[\"0\"].toLowerCase())!;\n if (some(entry[1], (id: Id64String) => callback({ className, id }))) {\n return true;\n }\n }\n return some(this._nodeKeys, (serializedKey: string) => callback(JSON.parse(serializedKey)));\n }\n\n /** Iterate over all keys in this keyset. */\n public forEach(callback: (key: InstanceKey | NodeKey, index: number) => void) {\n let index = 0;\n this._instanceKeys.forEach((ids: Set<Id64String>, className: string) => {\n const recentClassName = this._lowerCaseMap.get(className.toLowerCase())!;\n ids.forEach((id: Id64String) => callback({ className: recentClassName, id }, index++));\n });\n this._nodeKeys.forEach((serializedKey: string) => {\n callback(JSON.parse(serializedKey), index++);\n });\n }\n\n /** Iterate over all keys in this keyset in batches */\n public forEachBatch(batchSize: number, callback: (batch: KeySet, index: number) => void) {\n const size = this.size;\n const count = Math.ceil(size / batchSize);\n if (1 === count) {\n callback(this, 0);\n return;\n }\n let batch = new KeySet();\n let batchIndex = 0;\n let currBatchSize = 0;\n this.forEach((key, index) => {\n batch.add(key);\n ++currBatchSize;\n if (currBatchSize === batchSize || index === size - 1) {\n callback(batch, batchIndex++);\n batch = new KeySet();\n currBatchSize = 0;\n }\n });\n }\n\n /**\n * Serializes this KeySet to JSON\n * @public\n */\n public toJSON(): KeySetJSON {\n const instanceKeys: [string, string][] = [];\n for (const entry of this._instanceKeys.entries()) {\n if (entry[\"1\"].size > 0) {\n const className = this._lowerCaseMap.get(entry[\"0\"].toLowerCase());\n const compressedIds = CompressedId64Set.sortAndCompress(entry[\"1\"]);\n instanceKeys.push([className!, compressedIds.length > 0 ? compressedIds : Id64.invalid]);\n }\n }\n const nodeKeys: NodeKey[] = [];\n for (const serializedKey of this._nodeKeys.values()) {\n nodeKeys.push(JSON.parse(serializedKey));\n }\n return {\n instanceKeys,\n nodeKeys,\n };\n }\n\n /**\n * Creates a KeySet from JSON\n * @public\n */\n public static fromJSON(json: KeySetJSON): KeySet {\n const keyset = new KeySet();\n keyset.addKeySetJSON(json);\n return keyset;\n }\n}\n\nfunction normalizeClassName(className: string) {\n return className.replace(\".\", \":\");\n}\n\nconst some = <TItem>(set: Set<TItem>, cb: (item: TItem) => boolean) => {\n for (const item of set) {\n if (cb(item)) {\n return true;\n }\n }\n return false;\n};\n"]}
1
+ {"version":3,"file":"KeySet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OAAO,KAAK,CAAC;AACf,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 { assert, CompressedId64Set, Guid, GuidString, Id64, Id64String } from \"@itwin/core-bentley\";\nimport { EntityProps } from \"@itwin/core-common\";\nimport { InstanceId, InstanceKey } from \"./EC.js\";\nimport { NodeKey } from \"./hierarchy/Key.js\";\n\n/**\n * A single key that identifies something in an iTwin.js application\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport type Key = Readonly<NodeKey> | Readonly<InstanceKey> | Readonly<EntityProps>;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace Key {\n /**\n * Check if the supplied key is a `NodeKey`\n *\n * @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n export function isNodeKey(key: Key): key is Extract<Key, Readonly<NodeKey>> {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return !!(key as NodeKey).type;\n }\n\n /** Check if the supplied key is an `InstanceKey` */\n export function isInstanceKey(key: Key): key is Extract<Key, Readonly<InstanceKey>> {\n return !!(key as InstanceKey).className && !!(key as InstanceKey).id;\n }\n\n /** Check if the supplied key is an `EntityProps` */\n export function isEntityProps(key: Key): key is Extract<Key, Readonly<EntityProps>> {\n return !!(key as EntityProps).classFullName && !!(key as EntityProps).id;\n }\n}\n\n/**\n * A type for multiple keys that identify something in iModel.js application\n * @public\n */\nexport type Keys = ReadonlyArray<Key> | Readonly<KeySet>;\n\n/**\n * A data structure of serialized [[KeySet]]\n * @public\n */\nexport interface KeySetJSON {\n /** JSON representation of a list of instance keys */\n instanceKeys: Array<[string, string]>;\n /**\n * An array of serialized node keys\n *\n * @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n nodeKeys: NodeKey[];\n}\n\n/**\n * A class that holds multiple [[Key]] objects. It's basically\n * used as a container that holds multiple keys of different types.\n *\n * @public\n */\nexport class KeySet {\n // note: all keys are stored as strings because we need ability to find them by value\n private _instanceKeys: Map<string, Set<string>>; // lower case class name => instance ids\n private _lowerCaseMap: Map<string, string>; // lower case class name => most recent class name\n private _nodeKeys: Set<string>;\n private _guid!: GuidString;\n\n /**\n * Creates an instance of KeySet.\n * @param source Optional source to initialize from.\n */\n constructor(source?: Keys) {\n this._instanceKeys = new Map();\n this._lowerCaseMap = new Map();\n this._nodeKeys = new Set();\n this.recalculateGuid();\n if (source) {\n this.add(source);\n }\n }\n\n private recalculateGuid() {\n // empty keyset should have empty guid, otherwise use a random guid value\n this._guid = this.isEmpty ? Guid.empty : Guid.createValue();\n }\n\n /**\n * Get a GUID that identifies changes in this keyset. The value\n * does not uniquely identify contents of the keyset, but it can be\n * used to check whether keyset has changed.\n */\n public get guid(): GuidString {\n return this._guid;\n }\n\n /**\n * Get a map of instance keys stored in this KeySet\n *\n * **Warning**: getting instance keys might be expensive for\n * large KeySets.\n */\n public get instanceKeys(): Map<string, Set<InstanceId>> {\n const map = new Map<string, Set<InstanceId>>();\n for (const entry of this._instanceKeys) {\n map.set(this._lowerCaseMap.get(entry[\"0\"])!, new Set([...entry[\"1\"]].map((key: string) => Id64.fromJSON(key))));\n }\n return map;\n }\n\n /**\n * Get instance keys count\n */\n public get instanceKeysCount(): number {\n let count = 0;\n this._instanceKeys.forEach((set: Set<string>) => (count += set.size));\n return count;\n }\n\n /**\n * Get a set of node keys stored in this KeySet\n *\n * **Warning**: getting node keys might be expensive for large KeySets.\n *\n * @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\n public get nodeKeys() {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const set = new Set<NodeKey>();\n for (const serialized of this._nodeKeys) {\n set.add(JSON.parse(serialized));\n }\n return set;\n }\n\n /**\n * Get node keys count\n *\n * @deprecated in 5.2. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\n public get nodeKeysCount(): number {\n return this._nodeKeys.size;\n }\n\n private isKeySet(set: Keys | Key): set is Readonly<KeySet> {\n return !!(set as KeySet)._nodeKeys && !!(set as KeySet)._instanceKeys;\n }\n\n private isKeysArray(keys: Keys | Key): keys is ReadonlyArray<Key> {\n return Array.isArray(keys);\n }\n\n /**\n * Clear this KeySet.\n * @returns itself\n */\n public clear(): KeySet {\n if (this.isEmpty) {\n return this;\n }\n\n this._instanceKeys = new Map();\n this._lowerCaseMap = new Map();\n this._nodeKeys = new Set();\n this.recalculateGuid();\n return this;\n }\n\n private addKeySet(keyset: Readonly<KeySet>, pred?: (key: Key) => boolean): void {\n for (const key of (keyset as any)._nodeKeys) {\n if (!pred || pred(JSON.parse(key))) {\n this._nodeKeys.add(key);\n }\n }\n for (const entry of (keyset as any)._instanceKeys) {\n let set = this._instanceKeys.get(entry[\"0\"]);\n const className = (keyset as KeySet)._lowerCaseMap.get(entry[\"0\"])!;\n if (!set) {\n set = new Set();\n this._instanceKeys.set(entry[\"0\"], set);\n this._lowerCaseMap.set(entry[\"0\"], className);\n }\n entry[\"1\"].forEach((id: Id64String) => {\n if (!pred || pred({ className, id })) {\n set.add(id);\n }\n });\n }\n }\n\n private addKeySetJSON(keyset: Readonly<KeySetJSON>): void {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n for (const key of keyset.nodeKeys) {\n this._nodeKeys.add(JSON.stringify(key));\n }\n for (const entry of keyset.instanceKeys) {\n const normalizedClassName = normalizeClassName(entry[\"0\"]);\n const lcClassName = normalizedClassName.toLowerCase();\n const idsJson: string | Id64String[] = entry[\"1\"];\n const ids: Set<Id64String> =\n typeof idsJson === \"string\" ? (idsJson === Id64.invalid ? new Set([Id64.invalid]) : CompressedId64Set.decompressSet(idsJson)) : new Set(idsJson);\n this._instanceKeys.set(lcClassName, ids);\n this._lowerCaseMap.set(lcClassName, normalizedClassName);\n }\n }\n\n /**\n * Add a key or keys to this KeySet.\n * @param value A key or keys to add.\n * @param pred An optional predicate function that indicates whether a key should be added\n * @returns itself\n */\n public add(value: Keys | Key, pred?: (key: Key) => boolean): KeySet {\n const sizeBefore = this.size;\n if (this.isKeySet(value)) {\n this.addKeySet(value, pred);\n } else if (this.isKeysArray(value)) {\n value.forEach((key) => this.add(key, pred));\n } else if (!pred || pred(value)) {\n if (Key.isEntityProps(value)) {\n this.add({ className: value.classFullName, id: Id64.fromJSON(value.id) } as InstanceKey);\n } else if (Key.isInstanceKey(value)) {\n const normalizedClassName = normalizeClassName(value.className);\n const lcClassName = normalizedClassName.toLowerCase();\n if (!this._instanceKeys.has(lcClassName)) {\n this._instanceKeys.set(lcClassName, new Set());\n }\n this._lowerCaseMap.set(lcClassName, normalizedClassName);\n this._instanceKeys.get(lcClassName)!.add(value.id);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n } else if (Key.isNodeKey(value)) {\n this._nodeKeys.add(JSON.stringify(value));\n }\n }\n if (this.size !== sizeBefore) {\n this.recalculateGuid();\n }\n return this;\n }\n\n private deleteKeySet(keyset: Readonly<KeySet>): void {\n for (const key of (keyset as any)._nodeKeys) {\n this._nodeKeys.delete(key);\n }\n for (const entry of (keyset as any)._instanceKeys) {\n const set = this._instanceKeys.get(entry[\"0\"]);\n if (set) {\n entry[\"1\"].forEach((key: string) => {\n set.delete(key);\n });\n }\n }\n }\n\n /**\n * Deletes a key or keys from this KeySet.\n * @param value A key or keys to delete.\n * @returns itself\n */\n public delete(value: Keys | Key): KeySet {\n const sizeBefore = this.size;\n if (this.isKeySet(value)) {\n this.deleteKeySet(value);\n } else if (this.isKeysArray(value)) {\n for (const key of value) {\n this.delete(key);\n }\n } else if (Key.isEntityProps(value)) {\n this.delete({ className: value.classFullName, id: value.id! } as InstanceKey);\n } else if (Key.isInstanceKey(value)) {\n const normalizedClassName = normalizeClassName(value.className);\n const set = this._instanceKeys.get(normalizedClassName.toLowerCase());\n if (set) {\n set.delete(value.id);\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n } else if (Key.isNodeKey(value)) {\n this._nodeKeys.delete(JSON.stringify(value));\n }\n if (this.size !== sizeBefore) {\n this.recalculateGuid();\n }\n return this;\n }\n\n /**\n * Check if this KeySet contains the specified key.\n * @param value The key to check.\n */\n public has(value: Key): boolean {\n if (Key.isEntityProps(value)) {\n return this.has({ className: value.classFullName, id: value.id! } as InstanceKey);\n }\n if (Key.isInstanceKey(value)) {\n const normalizedClassName = normalizeClassName(value.className);\n const set = this._instanceKeys.get(normalizedClassName.toLowerCase());\n return !!(set && set.has(value.id));\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n assert(Key.isNodeKey(value));\n return this._nodeKeys.has(JSON.stringify(value));\n }\n\n private hasKeySet(readonlyKeys: Readonly<KeySet>, checkType: \"all\" | \"any\"): boolean {\n // note: cast-away read-onlyness to access private members...\n const keys = readonlyKeys as KeySet;\n\n if (checkType === \"all\") {\n if (this._nodeKeys.size < keys._nodeKeys.size || this._instanceKeys.size < keys._instanceKeys.size) {\n return false;\n }\n if ([...keys._nodeKeys].some((key) => !this._nodeKeys.has(key))) {\n return false;\n }\n for (const otherEntry of keys._instanceKeys) {\n const thisEntryKeys = this._instanceKeys.get(otherEntry[\"0\"]);\n if (!thisEntryKeys || thisEntryKeys.size < otherEntry[\"1\"].size) {\n return false;\n }\n if ([...otherEntry[\"1\"]].some((key) => !thisEntryKeys.has(key))) {\n return false;\n }\n }\n return true;\n }\n\n // \"any\" check type\n if ([...keys._nodeKeys].some((key) => this._nodeKeys.has(key))) {\n return true;\n }\n for (const otherEntry of keys._instanceKeys) {\n const thisEntryKeys = this._instanceKeys.get(otherEntry[\"0\"]);\n if (thisEntryKeys && [...otherEntry[\"1\"]].some((key) => thisEntryKeys.has(key))) {\n return true;\n }\n }\n return false;\n }\n\n private hasKeysArray(keys: ReadonlyArray<Key>, checkType: \"all\" | \"any\"): boolean {\n if (checkType === \"all\") {\n if (this.size < keys.length) {\n return false;\n }\n for (const key of keys) {\n if (!this.has(key)) {\n return false;\n }\n }\n return true;\n }\n\n // \"any\" check type\n for (const key of keys) {\n if (this.has(key)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Check if this KeySet contains all the specified keys.\n * @param keys The keys to check.\n */\n public hasAll(keys: Keys): boolean {\n if (this.isKeySet(keys)) {\n return this.hasKeySet(keys, \"all\");\n }\n assert(this.isKeysArray(keys));\n return this.hasKeysArray(keys, \"all\");\n }\n\n /**\n * Check if this KeySet contains any of the specified keys.\n * @param keys The keys to check.\n */\n public hasAny(keys: Keys): boolean {\n if (this.isKeySet(keys)) {\n return this.hasKeySet(keys, \"any\");\n }\n assert(this.isKeysArray(keys));\n return this.hasKeysArray(keys, \"any\");\n }\n\n /**\n * Get the number of keys stored in this KeySet.\n */\n public get size(): number {\n const nodeKeysCount = this._nodeKeys.size;\n let instanceIdsCount = 0;\n for (const set of this._instanceKeys.values()) {\n instanceIdsCount += set.size;\n }\n return nodeKeysCount + instanceIdsCount;\n }\n\n /**\n * Is this KeySet currently empty.\n */\n public get isEmpty(): boolean {\n return 0 === this.size;\n }\n\n /** Iterate over all keys in this keyset. */\n public some(callback: (key: Key) => boolean) {\n for (const entry of this._instanceKeys) {\n const className = this._lowerCaseMap.get(entry[\"0\"].toLowerCase())!;\n if (some(entry[1], (id: Id64String) => callback({ className, id }))) {\n return true;\n }\n }\n return some(this._nodeKeys, (serializedKey: string) => callback(JSON.parse(serializedKey)));\n }\n\n /** Iterate over all keys in this keyset. */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public forEach(callback: (key: InstanceKey | NodeKey, index: number) => void) {\n let index = 0;\n this._instanceKeys.forEach((ids: Set<Id64String>, className: string) => {\n const recentClassName = this._lowerCaseMap.get(className.toLowerCase())!;\n ids.forEach((id: Id64String) => callback({ className: recentClassName, id }, index++));\n });\n this._nodeKeys.forEach((serializedKey: string) => {\n callback(JSON.parse(serializedKey), index++);\n });\n }\n\n /** Iterate over all keys in this keyset in batches */\n public forEachBatch(batchSize: number, callback: (batch: KeySet, index: number) => void) {\n const size = this.size;\n const count = Math.ceil(size / batchSize);\n if (1 === count) {\n callback(this, 0);\n return;\n }\n let batch = new KeySet();\n let batchIndex = 0;\n let currBatchSize = 0;\n this.forEach((key, index) => {\n batch.add(key);\n ++currBatchSize;\n if (currBatchSize === batchSize || index === size - 1) {\n callback(batch, batchIndex++);\n batch = new KeySet();\n currBatchSize = 0;\n }\n });\n }\n\n /**\n * Serializes this KeySet to JSON\n * @public\n */\n public toJSON(): KeySetJSON {\n const instanceKeys: [string, string][] = [];\n for (const entry of this._instanceKeys.entries()) {\n if (entry[\"1\"].size > 0) {\n const className = this._lowerCaseMap.get(entry[\"0\"].toLowerCase());\n const compressedIds = CompressedId64Set.sortAndCompress(entry[\"1\"]);\n instanceKeys.push([className!, compressedIds.length > 0 ? compressedIds : Id64.invalid]);\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const nodeKeys: NodeKey[] = [];\n for (const serializedKey of this._nodeKeys.values()) {\n nodeKeys.push(JSON.parse(serializedKey));\n }\n return {\n instanceKeys,\n nodeKeys,\n };\n }\n\n /**\n * Creates a KeySet from JSON\n * @public\n */\n public static fromJSON(json: KeySetJSON): KeySet {\n const keyset = new KeySet();\n keyset.addKeySetJSON(json);\n return keyset;\n }\n}\n\nfunction normalizeClassName(className: string) {\n return className.replace(\".\", \":\");\n}\n\nconst some = <TItem>(set: Set<TItem>, cb: (item: TItem) => boolean) => {\n for (const item of set) {\n if (cb(item)) {\n return true;\n }\n }\n return false;\n};\n"]}
@@ -50,6 +50,8 @@ export interface FormatOptions {
50
50
  koqName: string;
51
51
  /** Unit system to use for formatting. */
52
52
  unitSystem?: UnitSystemKey;
53
+ /** Optional overrides for the format used to parse or format values. */
54
+ formatOverride?: Partial<Omit<FormatProps, "type">>;
53
55
  }
54
56
  /**
55
57
  * Props for creating [[KoqPropertyValueFormatter]].
@@ -1 +1 @@
1
- {"version":3,"file":"KoqPropertyValueFormatter.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/KoqPropertyValueFormatter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAU,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAiB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrI,OAAO,EAAgC,aAAa,EAAyE,MAAM,0BAA0B,CAAC;AAE9J;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,aAAa,EAAE,CAAC;IAC7B,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,UAAU;IAEzB,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,GAAG,gBAAgB,EAAE,CAAC;CAC7D;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,UAAU,CAAC,EAAE,aAAa,CAAC;CAC5B;AAED;;;GAGG;AACH,UAAU,8BAA8B;IACtC,mIAAmI;IACnI,aAAa,EAAE,aAAa,CAAC;IAC7B,uIAAuI;IACvI,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED;;;GAGG;AACH,qBAAa,yBAAyB;;IACpC,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,gBAAgB,CAAC,CAAkB;IAE3C,OAAO,CAAC,eAAe,CAAC,CAAa;IAErC,mHAAmH;gBAEvG,aAAa,EAAE,aAAa,EAAE,cAAc,CAAC,EAAE,UAAU,EAAE,eAAe,CAAC,EAAE,eAAe;gBAC5F,KAAK,EAAE,8BAA8B;IAejD,gBAAgB;IAEhB,IAAW,cAAc,IAAI,UAAU,GAAG,SAAS,CAElD;IAED,IAAW,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,EAItD;IAGY,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa;IAQ5C,gBAAgB,CAAC,OAAO,EAAE,aAAa;IAWvC,aAAa,CAAC,OAAO,EAAE,aAAa;CA+ClD"}
1
+ {"version":3,"file":"KoqPropertyValueFormatter.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/KoqPropertyValueFormatter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAU,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAiB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrI,OAAO,EAAgC,aAAa,EAAyE,MAAM,0BAA0B,CAAC;AAE9J;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,aAAa,EAAE,CAAC;IAC7B,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,UAAU;IAEzB,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,GAAG,gBAAgB,EAAE,CAAC;CAC7D;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,wEAAwE;IACxE,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;CACrD;AAED;;;GAGG;AACH,UAAU,8BAA8B;IACtC,mIAAmI;IACnI,aAAa,EAAE,aAAa,CAAC;IAC7B,uIAAuI;IACvI,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED;;;GAGG;AACH,qBAAa,yBAAyB;;IACpC,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,gBAAgB,CAAC,CAAkB;IAE3C,OAAO,CAAC,eAAe,CAAC,CAAa;IAErC,mHAAmH;gBAEvG,aAAa,EAAE,aAAa,EAAE,cAAc,CAAC,EAAE,UAAU,EAAE,eAAe,CAAC,EAAE,eAAe;gBAC5F,KAAK,EAAE,8BAA8B;IAejD,gBAAgB;IAEhB,IAAW,cAAc,IAAI,UAAU,GAAG,SAAS,CAElD;IAED,IAAW,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,EAItD;IAGY,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa;IAQ5C,gBAAgB,CAAC,OAAO,EAAE,aAAa;IAWvC,aAAa,CAAC,OAAO,EAAE,aAAa;CA+ClD"}
@@ -61,7 +61,7 @@ class KoqPropertyValueFormatter {
61
61
  }
62
62
  const { formatProps, persistenceUnitName } = formattingProps;
63
63
  const persistenceUnit = await this._unitsProvider.findUnitByName(persistenceUnitName);
64
- const format = await core_quantity_1.Format.createFromJSON("", this._unitsProvider, formatProps);
64
+ const format = await core_quantity_1.Format.createFromJSON("", this._unitsProvider, { ...formatProps, ...options.formatOverride });
65
65
  return core_quantity_1.FormatterSpec.create("", format, this._unitsProvider, persistenceUnit);
66
66
  }
67
67
  async getParserSpec(options) {
@@ -71,7 +71,7 @@ class KoqPropertyValueFormatter {
71
71
  }
72
72
  const { formatProps, persistenceUnitName } = formattingProps;
73
73
  const persistenceUnit = await this._unitsProvider.findUnitByName(persistenceUnitName);
74
- const format = await core_quantity_1.Format.createFromJSON("", this._unitsProvider, formatProps);
74
+ const format = await core_quantity_1.Format.createFromJSON("", this._unitsProvider, { ...formatProps, ...options.formatOverride });
75
75
  return core_quantity_1.ParserSpec.create(format, this._unitsProvider, persistenceUnit);
76
76
  }
77
77
  async #getFormattingProps(options) {