@itwin/ecschema-metadata 5.0.0-dev.11 → 5.0.0-dev.111

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 (342) hide show
  1. package/CHANGELOG.md +73 -1
  2. package/lib/cjs/Constants.d.ts +8 -0
  3. package/lib/cjs/Constants.d.ts.map +1 -1
  4. package/lib/cjs/Constants.js +30 -21
  5. package/lib/cjs/Constants.js.map +1 -1
  6. package/lib/cjs/Context.d.ts +85 -36
  7. package/lib/cjs/Context.d.ts.map +1 -1
  8. package/lib/cjs/Context.js +79 -29
  9. package/lib/cjs/Context.js.map +1 -1
  10. package/lib/cjs/DelayedPromise.d.ts +9 -8
  11. package/lib/cjs/DelayedPromise.d.ts.map +1 -1
  12. package/lib/cjs/DelayedPromise.js +8 -6
  13. package/lib/cjs/DelayedPromise.js.map +1 -1
  14. package/lib/cjs/Deserialization/AbstractParser.js +1 -0
  15. package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
  16. package/lib/cjs/Deserialization/Helper.d.ts +3 -3
  17. package/lib/cjs/Deserialization/Helper.d.ts.map +1 -1
  18. package/lib/cjs/Deserialization/Helper.js +35 -26
  19. package/lib/cjs/Deserialization/Helper.js.map +1 -1
  20. package/lib/cjs/Deserialization/JsonParser.js +153 -150
  21. package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
  22. package/lib/cjs/Deserialization/JsonProps.d.ts +47 -33
  23. package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
  24. package/lib/cjs/Deserialization/JsonProps.js +3 -3
  25. package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
  26. package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
  27. package/lib/cjs/Deserialization/XmlParser.d.ts.map +1 -1
  28. package/lib/cjs/Deserialization/XmlParser.js +60 -52
  29. package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
  30. package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts +0 -5
  31. package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
  32. package/lib/cjs/Deserialization/XmlSerializationUtils.js +8 -17
  33. package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
  34. package/lib/cjs/ECName.d.ts +2 -2
  35. package/lib/cjs/ECName.js +5 -4
  36. package/lib/cjs/ECName.js.map +1 -1
  37. package/lib/cjs/ECObjects.d.ts +41 -9
  38. package/lib/cjs/ECObjects.d.ts.map +1 -1
  39. package/lib/cjs/ECObjects.js +78 -24
  40. package/lib/cjs/ECObjects.js.map +1 -1
  41. package/lib/cjs/Exception.d.ts +4 -4
  42. package/lib/cjs/Exception.d.ts.map +1 -1
  43. package/lib/cjs/Exception.js +61 -60
  44. package/lib/cjs/Exception.js.map +1 -1
  45. package/lib/cjs/Interfaces.d.ts +35 -32
  46. package/lib/cjs/Interfaces.d.ts.map +1 -1
  47. package/lib/cjs/Interfaces.js.map +1 -1
  48. package/lib/cjs/Metadata/Class.d.ts +179 -32
  49. package/lib/cjs/Metadata/Class.d.ts.map +1 -1
  50. package/lib/cjs/Metadata/Class.js +290 -88
  51. package/lib/cjs/Metadata/Class.js.map +1 -1
  52. package/lib/cjs/Metadata/Constant.d.ts +26 -10
  53. package/lib/cjs/Metadata/Constant.d.ts.map +1 -1
  54. package/lib/cjs/Metadata/Constant.js +38 -10
  55. package/lib/cjs/Metadata/Constant.js.map +1 -1
  56. package/lib/cjs/Metadata/CustomAttribute.d.ts +2 -2
  57. package/lib/cjs/Metadata/CustomAttribute.d.ts.map +1 -1
  58. package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
  59. package/lib/cjs/Metadata/CustomAttributeClass.d.ts +21 -7
  60. package/lib/cjs/Metadata/CustomAttributeClass.d.ts.map +1 -1
  61. package/lib/cjs/Metadata/CustomAttributeClass.js +28 -8
  62. package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
  63. package/lib/cjs/Metadata/EntityClass.d.ts +40 -11
  64. package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
  65. package/lib/cjs/Metadata/EntityClass.js +72 -34
  66. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  67. package/lib/cjs/Metadata/Enumeration.d.ts +30 -10
  68. package/lib/cjs/Metadata/Enumeration.d.ts.map +1 -1
  69. package/lib/cjs/Metadata/Enumeration.js +41 -13
  70. package/lib/cjs/Metadata/Enumeration.js.map +1 -1
  71. package/lib/cjs/Metadata/Format.d.ts +65 -17
  72. package/lib/cjs/Metadata/Format.d.ts.map +1 -1
  73. package/lib/cjs/Metadata/Format.js +107 -22
  74. package/lib/cjs/Metadata/Format.js.map +1 -1
  75. package/lib/cjs/Metadata/InvertedUnit.d.ts +19 -10
  76. package/lib/cjs/Metadata/InvertedUnit.d.ts.map +1 -1
  77. package/lib/cjs/Metadata/InvertedUnit.js +32 -15
  78. package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
  79. package/lib/cjs/Metadata/KindOfQuantity.d.ts +38 -18
  80. package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
  81. package/lib/cjs/Metadata/KindOfQuantity.js +90 -40
  82. package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
  83. package/lib/cjs/Metadata/Mixin.d.ts +31 -4
  84. package/lib/cjs/Metadata/Mixin.d.ts.map +1 -1
  85. package/lib/cjs/Metadata/Mixin.js +42 -8
  86. package/lib/cjs/Metadata/Mixin.js.map +1 -1
  87. package/lib/cjs/Metadata/OverrideFormat.d.ts +12 -12
  88. package/lib/cjs/Metadata/OverrideFormat.d.ts.map +1 -1
  89. package/lib/cjs/Metadata/OverrideFormat.js +36 -19
  90. package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
  91. package/lib/cjs/Metadata/Phenomenon.d.ts +24 -3
  92. package/lib/cjs/Metadata/Phenomenon.d.ts.map +1 -1
  93. package/lib/cjs/Metadata/Phenomenon.js +32 -3
  94. package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
  95. package/lib/cjs/Metadata/Property.d.ts +47 -25
  96. package/lib/cjs/Metadata/Property.d.ts.map +1 -1
  97. package/lib/cjs/Metadata/Property.js +128 -49
  98. package/lib/cjs/Metadata/Property.js.map +1 -1
  99. package/lib/cjs/Metadata/PropertyCategory.d.ts +20 -4
  100. package/lib/cjs/Metadata/PropertyCategory.d.ts.map +1 -1
  101. package/lib/cjs/Metadata/PropertyCategory.js +31 -4
  102. package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
  103. package/lib/cjs/Metadata/RelationshipClass.d.ts +63 -27
  104. package/lib/cjs/Metadata/RelationshipClass.d.ts.map +1 -1
  105. package/lib/cjs/Metadata/RelationshipClass.js +100 -43
  106. package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
  107. package/lib/cjs/Metadata/Schema.d.ts +167 -41
  108. package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
  109. package/lib/cjs/Metadata/Schema.js +211 -111
  110. package/lib/cjs/Metadata/Schema.js.map +1 -1
  111. package/lib/cjs/Metadata/SchemaItem.d.ts +19 -19
  112. package/lib/cjs/Metadata/SchemaItem.d.ts.map +1 -1
  113. package/lib/cjs/Metadata/SchemaItem.js +23 -21
  114. package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
  115. package/lib/cjs/Metadata/Unit.d.ts +24 -21
  116. package/lib/cjs/Metadata/Unit.d.ts.map +1 -1
  117. package/lib/cjs/Metadata/Unit.js +40 -24
  118. package/lib/cjs/Metadata/Unit.js.map +1 -1
  119. package/lib/cjs/Metadata/UnitSystem.d.ts +17 -4
  120. package/lib/cjs/Metadata/UnitSystem.d.ts.map +1 -1
  121. package/lib/cjs/Metadata/UnitSystem.js +24 -4
  122. package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
  123. package/lib/cjs/PropertyTypes.d.ts +11 -11
  124. package/lib/cjs/PropertyTypes.d.ts.map +1 -1
  125. package/lib/cjs/PropertyTypes.js +28 -20
  126. package/lib/cjs/PropertyTypes.js.map +1 -1
  127. package/lib/cjs/SchemaFormatsProvider.d.ts +39 -0
  128. package/lib/cjs/SchemaFormatsProvider.d.ts.map +1 -0
  129. package/lib/cjs/SchemaFormatsProvider.js +146 -0
  130. package/lib/cjs/SchemaFormatsProvider.js.map +1 -0
  131. package/lib/cjs/SchemaJsonLocater.d.ts +8 -8
  132. package/lib/cjs/SchemaJsonLocater.d.ts.map +1 -1
  133. package/lib/cjs/SchemaJsonLocater.js +7 -7
  134. package/lib/cjs/SchemaJsonLocater.js.map +1 -1
  135. package/lib/cjs/SchemaKey.d.ts +13 -7
  136. package/lib/cjs/SchemaKey.d.ts.map +1 -1
  137. package/lib/cjs/SchemaKey.js +22 -12
  138. package/lib/cjs/SchemaKey.js.map +1 -1
  139. package/lib/cjs/SchemaLoader.d.ts +5 -5
  140. package/lib/cjs/SchemaLoader.d.ts.map +1 -1
  141. package/lib/cjs/SchemaLoader.js +5 -4
  142. package/lib/cjs/SchemaLoader.js.map +1 -1
  143. package/lib/cjs/SchemaPartVisitorDelegate.d.ts +2 -2
  144. package/lib/cjs/SchemaPartVisitorDelegate.js +2 -1
  145. package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
  146. package/lib/cjs/UnitConversion/Graph.js +69 -65
  147. package/lib/cjs/UnitConversion/Graph.js.map +1 -1
  148. package/lib/cjs/UnitConversion/Parser.js.map +1 -1
  149. package/lib/cjs/UnitConversion/UnitConversion.d.ts +1 -1
  150. package/lib/cjs/UnitConversion/UnitConversion.d.ts.map +1 -1
  151. package/lib/cjs/UnitConversion/UnitConversion.js +9 -7
  152. package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
  153. package/lib/cjs/UnitConversion/UnitConverter.js +2 -0
  154. package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
  155. package/lib/cjs/UnitConversion/UnitTree.d.ts +2 -0
  156. package/lib/cjs/UnitConversion/UnitTree.d.ts.map +1 -1
  157. package/lib/cjs/UnitConversion/UnitTree.js +11 -1
  158. package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
  159. package/lib/cjs/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
  160. package/lib/cjs/UnitProvider/SchemaUnitProvider.js +8 -9
  161. package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
  162. package/lib/cjs/Validation/SchemaWalker.d.ts +1 -1
  163. package/lib/cjs/Validation/SchemaWalker.d.ts.map +1 -1
  164. package/lib/cjs/Validation/SchemaWalker.js +6 -4
  165. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  166. package/lib/cjs/ecschema-metadata.d.ts +1 -0
  167. package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
  168. package/lib/cjs/ecschema-metadata.js +1 -0
  169. package/lib/cjs/ecschema-metadata.js.map +1 -1
  170. package/lib/cjs/utils/SchemaGraph.js +5 -6
  171. package/lib/cjs/utils/SchemaGraph.js.map +1 -1
  172. package/lib/esm/Constants.d.ts +8 -0
  173. package/lib/esm/Constants.d.ts.map +1 -1
  174. package/lib/esm/Constants.js +29 -20
  175. package/lib/esm/Constants.js.map +1 -1
  176. package/lib/esm/Context.d.ts +85 -36
  177. package/lib/esm/Context.d.ts.map +1 -1
  178. package/lib/esm/Context.js +78 -28
  179. package/lib/esm/Context.js.map +1 -1
  180. package/lib/esm/DelayedPromise.d.ts +9 -8
  181. package/lib/esm/DelayedPromise.d.ts.map +1 -1
  182. package/lib/esm/DelayedPromise.js +8 -6
  183. package/lib/esm/DelayedPromise.js.map +1 -1
  184. package/lib/esm/Deserialization/AbstractParser.js +1 -0
  185. package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
  186. package/lib/esm/Deserialization/Helper.d.ts +3 -3
  187. package/lib/esm/Deserialization/Helper.d.ts.map +1 -1
  188. package/lib/esm/Deserialization/Helper.js +36 -27
  189. package/lib/esm/Deserialization/Helper.js.map +1 -1
  190. package/lib/esm/Deserialization/JsonParser.js +154 -151
  191. package/lib/esm/Deserialization/JsonParser.js.map +1 -1
  192. package/lib/esm/Deserialization/JsonProps.d.ts +47 -33
  193. package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
  194. package/lib/esm/Deserialization/JsonProps.js +3 -3
  195. package/lib/esm/Deserialization/JsonProps.js.map +1 -1
  196. package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
  197. package/lib/esm/Deserialization/XmlParser.d.ts.map +1 -1
  198. package/lib/esm/Deserialization/XmlParser.js +61 -53
  199. package/lib/esm/Deserialization/XmlParser.js.map +1 -1
  200. package/lib/esm/Deserialization/XmlSerializationUtils.d.ts +0 -5
  201. package/lib/esm/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
  202. package/lib/esm/Deserialization/XmlSerializationUtils.js +9 -18
  203. package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
  204. package/lib/esm/ECName.d.ts +2 -2
  205. package/lib/esm/ECName.js +6 -5
  206. package/lib/esm/ECName.js.map +1 -1
  207. package/lib/esm/ECObjects.d.ts +41 -9
  208. package/lib/esm/ECObjects.d.ts.map +1 -1
  209. package/lib/esm/ECObjects.js +77 -24
  210. package/lib/esm/ECObjects.js.map +1 -1
  211. package/lib/esm/Exception.d.ts +4 -4
  212. package/lib/esm/Exception.d.ts.map +1 -1
  213. package/lib/esm/Exception.js +59 -58
  214. package/lib/esm/Exception.js.map +1 -1
  215. package/lib/esm/Interfaces.d.ts +35 -32
  216. package/lib/esm/Interfaces.d.ts.map +1 -1
  217. package/lib/esm/Interfaces.js.map +1 -1
  218. package/lib/esm/Metadata/Class.d.ts +179 -32
  219. package/lib/esm/Metadata/Class.d.ts.map +1 -1
  220. package/lib/esm/Metadata/Class.js +292 -90
  221. package/lib/esm/Metadata/Class.js.map +1 -1
  222. package/lib/esm/Metadata/Constant.d.ts +26 -10
  223. package/lib/esm/Metadata/Constant.d.ts.map +1 -1
  224. package/lib/esm/Metadata/Constant.js +39 -11
  225. package/lib/esm/Metadata/Constant.js.map +1 -1
  226. package/lib/esm/Metadata/CustomAttribute.d.ts +2 -2
  227. package/lib/esm/Metadata/CustomAttribute.d.ts.map +1 -1
  228. package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
  229. package/lib/esm/Metadata/CustomAttributeClass.d.ts +21 -7
  230. package/lib/esm/Metadata/CustomAttributeClass.d.ts.map +1 -1
  231. package/lib/esm/Metadata/CustomAttributeClass.js +29 -9
  232. package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
  233. package/lib/esm/Metadata/EntityClass.d.ts +40 -11
  234. package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
  235. package/lib/esm/Metadata/EntityClass.js +73 -35
  236. package/lib/esm/Metadata/EntityClass.js.map +1 -1
  237. package/lib/esm/Metadata/Enumeration.d.ts +30 -10
  238. package/lib/esm/Metadata/Enumeration.d.ts.map +1 -1
  239. package/lib/esm/Metadata/Enumeration.js +42 -14
  240. package/lib/esm/Metadata/Enumeration.js.map +1 -1
  241. package/lib/esm/Metadata/Format.d.ts +65 -17
  242. package/lib/esm/Metadata/Format.d.ts.map +1 -1
  243. package/lib/esm/Metadata/Format.js +108 -23
  244. package/lib/esm/Metadata/Format.js.map +1 -1
  245. package/lib/esm/Metadata/InvertedUnit.d.ts +19 -10
  246. package/lib/esm/Metadata/InvertedUnit.d.ts.map +1 -1
  247. package/lib/esm/Metadata/InvertedUnit.js +33 -16
  248. package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
  249. package/lib/esm/Metadata/KindOfQuantity.d.ts +38 -18
  250. package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
  251. package/lib/esm/Metadata/KindOfQuantity.js +91 -41
  252. package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
  253. package/lib/esm/Metadata/Mixin.d.ts +31 -4
  254. package/lib/esm/Metadata/Mixin.d.ts.map +1 -1
  255. package/lib/esm/Metadata/Mixin.js +44 -10
  256. package/lib/esm/Metadata/Mixin.js.map +1 -1
  257. package/lib/esm/Metadata/OverrideFormat.d.ts +12 -12
  258. package/lib/esm/Metadata/OverrideFormat.d.ts.map +1 -1
  259. package/lib/esm/Metadata/OverrideFormat.js +37 -20
  260. package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
  261. package/lib/esm/Metadata/Phenomenon.d.ts +24 -3
  262. package/lib/esm/Metadata/Phenomenon.d.ts.map +1 -1
  263. package/lib/esm/Metadata/Phenomenon.js +33 -4
  264. package/lib/esm/Metadata/Phenomenon.js.map +1 -1
  265. package/lib/esm/Metadata/Property.d.ts +47 -25
  266. package/lib/esm/Metadata/Property.d.ts.map +1 -1
  267. package/lib/esm/Metadata/Property.js +130 -51
  268. package/lib/esm/Metadata/Property.js.map +1 -1
  269. package/lib/esm/Metadata/PropertyCategory.d.ts +20 -4
  270. package/lib/esm/Metadata/PropertyCategory.d.ts.map +1 -1
  271. package/lib/esm/Metadata/PropertyCategory.js +31 -4
  272. package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
  273. package/lib/esm/Metadata/RelationshipClass.d.ts +63 -27
  274. package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -1
  275. package/lib/esm/Metadata/RelationshipClass.js +102 -45
  276. package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
  277. package/lib/esm/Metadata/Schema.d.ts +167 -41
  278. package/lib/esm/Metadata/Schema.d.ts.map +1 -1
  279. package/lib/esm/Metadata/Schema.js +212 -112
  280. package/lib/esm/Metadata/Schema.js.map +1 -1
  281. package/lib/esm/Metadata/SchemaItem.d.ts +19 -19
  282. package/lib/esm/Metadata/SchemaItem.d.ts.map +1 -1
  283. package/lib/esm/Metadata/SchemaItem.js +25 -23
  284. package/lib/esm/Metadata/SchemaItem.js.map +1 -1
  285. package/lib/esm/Metadata/Unit.d.ts +24 -21
  286. package/lib/esm/Metadata/Unit.d.ts.map +1 -1
  287. package/lib/esm/Metadata/Unit.js +41 -25
  288. package/lib/esm/Metadata/Unit.js.map +1 -1
  289. package/lib/esm/Metadata/UnitSystem.d.ts +17 -4
  290. package/lib/esm/Metadata/UnitSystem.d.ts.map +1 -1
  291. package/lib/esm/Metadata/UnitSystem.js +24 -4
  292. package/lib/esm/Metadata/UnitSystem.js.map +1 -1
  293. package/lib/esm/PropertyTypes.d.ts +11 -11
  294. package/lib/esm/PropertyTypes.d.ts.map +1 -1
  295. package/lib/esm/PropertyTypes.js +29 -21
  296. package/lib/esm/PropertyTypes.js.map +1 -1
  297. package/lib/esm/SchemaFormatsProvider.d.ts +39 -0
  298. package/lib/esm/SchemaFormatsProvider.d.ts.map +1 -0
  299. package/lib/esm/SchemaFormatsProvider.js +142 -0
  300. package/lib/esm/SchemaFormatsProvider.js.map +1 -0
  301. package/lib/esm/SchemaJsonLocater.d.ts +8 -8
  302. package/lib/esm/SchemaJsonLocater.d.ts.map +1 -1
  303. package/lib/esm/SchemaJsonLocater.js +7 -7
  304. package/lib/esm/SchemaJsonLocater.js.map +1 -1
  305. package/lib/esm/SchemaKey.d.ts +13 -7
  306. package/lib/esm/SchemaKey.d.ts.map +1 -1
  307. package/lib/esm/SchemaKey.js +23 -13
  308. package/lib/esm/SchemaKey.js.map +1 -1
  309. package/lib/esm/SchemaLoader.d.ts +5 -5
  310. package/lib/esm/SchemaLoader.d.ts.map +1 -1
  311. package/lib/esm/SchemaLoader.js +6 -5
  312. package/lib/esm/SchemaLoader.js.map +1 -1
  313. package/lib/esm/SchemaPartVisitorDelegate.d.ts +2 -2
  314. package/lib/esm/SchemaPartVisitorDelegate.js +2 -1
  315. package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
  316. package/lib/esm/UnitConversion/Graph.js +69 -65
  317. package/lib/esm/UnitConversion/Graph.js.map +1 -1
  318. package/lib/esm/UnitConversion/Parser.js.map +1 -1
  319. package/lib/esm/UnitConversion/UnitConversion.d.ts +1 -1
  320. package/lib/esm/UnitConversion/UnitConversion.d.ts.map +1 -1
  321. package/lib/esm/UnitConversion/UnitConversion.js +9 -7
  322. package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
  323. package/lib/esm/UnitConversion/UnitConverter.js +2 -0
  324. package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
  325. package/lib/esm/UnitConversion/UnitTree.d.ts +2 -0
  326. package/lib/esm/UnitConversion/UnitTree.d.ts.map +1 -1
  327. package/lib/esm/UnitConversion/UnitTree.js +11 -1
  328. package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
  329. package/lib/esm/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
  330. package/lib/esm/UnitProvider/SchemaUnitProvider.js +8 -9
  331. package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
  332. package/lib/esm/Validation/SchemaWalker.d.ts +1 -1
  333. package/lib/esm/Validation/SchemaWalker.d.ts.map +1 -1
  334. package/lib/esm/Validation/SchemaWalker.js +6 -4
  335. package/lib/esm/Validation/SchemaWalker.js.map +1 -1
  336. package/lib/esm/ecschema-metadata.d.ts +1 -0
  337. package/lib/esm/ecschema-metadata.d.ts.map +1 -1
  338. package/lib/esm/ecschema-metadata.js +1 -0
  339. package/lib/esm/ecschema-metadata.js.map +1 -1
  340. package/lib/esm/utils/SchemaGraph.js +6 -7
  341. package/lib/esm/utils/SchemaGraph.js.map +1 -1
  342. package/package.json +16 -14
@@ -19,19 +19,16 @@ var XmlSerializationUtils;
19
19
  * @param customAttribute The CustomAttribute instance to serialize.
20
20
  * @param schemaDoc The Xml Document object holding the serialized EC Schema.
21
21
  * @param schema The Schema object being serialized.
22
- * @beta
23
22
  */
24
23
  async function writeCustomAttribute(fullName, customAttribute, schemaDoc, schema) {
25
24
  const caClass = await schema.lookupItem(fullName);
26
25
  if (!caClass)
27
- throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.ClassNotFound, `The class '${fullName}' could not be found in the current schema context.`);
26
+ throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.ClassNotFound, `The class '${fullName}' could not be found in the current schema context.`);
28
27
  const nameAndNamespace = await resolveCustomAttributeNamespace(fullName, schema);
29
28
  const caElement = schemaDoc.createElement(nameAndNamespace[0]);
30
29
  if (nameAndNamespace[1])
31
30
  caElement.setAttribute("xmlns", nameAndNamespace[1]);
32
- if (!caClass.properties)
33
- return caElement;
34
- for (const property of caClass.properties)
31
+ for (const property of await caClass.getProperties())
35
32
  await writeInstanceProperty(property, customAttribute, caElement, schemaDoc);
36
33
  return caElement;
37
34
  }
@@ -42,7 +39,6 @@ var XmlSerializationUtils;
42
39
  * @param instance The Property instance.
43
40
  * @param instanceElement The XML Element that will contain the serialized property instance.
44
41
  * @param schemaDoc The Xml Document object holding the serialized EC Schema.
45
- * @beta
46
42
  */
47
43
  async function writeInstanceProperty(propertyClass, instance, instanceElement, schemaDoc) {
48
44
  const propertyValue = instance[propertyClass.name];
@@ -67,7 +63,6 @@ var XmlSerializationUtils;
67
63
  * @param propertyValue An array holding the property values.
68
64
  * @param arrayElement The XML Element that will contain the serialized property instance.
69
65
  * @param schemaDoc The Xml Document object holding the serialized EC Schema.
70
- * @beta
71
66
  */
72
67
  async function writeArrayProperty(propertyClass, propertyValue, arrayElement, schemaDoc) {
73
68
  if (propertyClass.isPrimitive()) {
@@ -93,13 +88,10 @@ var XmlSerializationUtils;
93
88
  * @param propertyValue The struct object holding the property values.
94
89
  * @param structElement The XML Element that will contain the serialized property instance.
95
90
  * @param schemaDoc The Xml Document object holding the serialized EC Schema.
96
- * @beta
97
91
  */
98
92
  async function writeStructProperty(propertyClass, propertyValue, structElement, schemaDoc) {
99
93
  const structClass = propertyClass.structClass;
100
- if (!structClass.properties)
101
- return;
102
- for (const propertyMetadata of structClass.properties)
94
+ for (const propertyMetadata of structClass.getPropertiesSync(true))
103
95
  await writeInstanceProperty(propertyMetadata, propertyValue, structElement, schemaDoc);
104
96
  }
105
97
  XmlSerializationUtils.writeStructProperty = writeStructProperty;
@@ -108,16 +100,15 @@ var XmlSerializationUtils;
108
100
  * @param propertyClass The Property metadata object.
109
101
  * @param propertyValue The struct object holding the property values.
110
102
  * @param propertyElement The XML Element that will contain the serialized property instance.
111
- * @beta
112
103
  */
113
104
  async function writePrimitiveProperty(propertyClass, propertyValue, propertyElement) {
114
105
  let primitiveType;
115
106
  if (propertyClass.isEnumeration()) {
116
107
  const enumeration = await propertyClass.enumeration;
117
108
  if (!enumeration)
118
- throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.ClassNotFound, `The enumeration on property class '${propertyClass.fullName}' could not be found in the current schema context.`);
109
+ throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.ClassNotFound, `The enumeration on property class '${propertyClass.fullName}' could not be found in the current schema context.`);
119
110
  if (enumeration.type === undefined)
120
- throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidType, `The enumeration on property class '${propertyClass.fullName}' has an invalid primitive type.`);
111
+ throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidType, `The enumeration on property class '${propertyClass.fullName}' has an invalid primitive type.`);
121
112
  primitiveType = enumeration.type;
122
113
  }
123
114
  else
@@ -148,7 +139,7 @@ var XmlSerializationUtils;
148
139
  propertyElement.textContent = propertyValue;
149
140
  return;
150
141
  default:
151
- throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidPrimitiveType, `The property '${propertyClass.fullName}' has an invalid primitive type.`);
142
+ throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidPrimitiveType, `The property '${propertyClass.fullName}' has an invalid primitive type.`);
152
143
  }
153
144
  }
154
145
  XmlSerializationUtils.writePrimitiveProperty = writePrimitiveProperty;
@@ -158,7 +149,7 @@ var XmlSerializationUtils;
158
149
  // Alias is required in Spec. It could be undefined (technically), so
159
150
  // throw until fixed.
160
151
  if (typeSchema.alias === undefined)
161
- throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidSchemaAlias, `The schema '${typeSchema.name}' has an invalid alias.`);
152
+ throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaAlias, `The schema '${typeSchema.name}' has an invalid alias.`);
162
153
  return `${typeSchema.alias}:${typeName}`;
163
154
  }
164
155
  XmlSerializationUtils.createXmlTypedName = createXmlTypedName;
@@ -168,7 +159,7 @@ var XmlSerializationUtils;
168
159
  return [caName, undefined];
169
160
  const attributeSchema = nameParts[0].toUpperCase() === schema.name.toUpperCase() ? schema : await schema.getReference(nameParts[0]);
170
161
  if (!attributeSchema)
171
- throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.UnableToLocateSchema, `Unable to resolve the namespace for CustomAttribute '${caName}' because the referenced schema '${nameParts[0]}' could not be located.`);
162
+ throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.UnableToLocateSchema, `Unable to resolve the namespace for CustomAttribute '${caName}' because the referenced schema '${nameParts[0]}' could not be located.`);
172
163
  return [nameParts[1], `${nameParts[0]}.${attributeSchema.schemaKey.version.toString()}`];
173
164
  }
174
165
  })(XmlSerializationUtils || (exports.XmlSerializationUtils = XmlSerializationUtils = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"XmlSerializationUtils.js","sourceRoot":"","sources":["../../../src/Deserialization/XmlSerializationUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,4CAAoE;AACpE,4CAA+D;AAM/D;;;GAGG;AACH,IAAiB,qBAAqB,CA4KrC;AA5KD,WAAiB,qBAAqB;IACpC;;;;;;;OAOG;IACI,KAAK,UAAU,oBAAoB,CAAC,QAAgB,EAAE,eAAgC,EAAE,SAAmB,EAAE,MAAc;QAChI,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAyB,CAAC;QAC1E,IAAI,CAAC,OAAO;YACV,MAAM,IAAI,0BAAc,CAAC,2BAAe,CAAC,aAAa,EAAE,cAAc,QAAQ,qDAAqD,CAAC,CAAC;QAEvI,MAAM,gBAAgB,GAAG,MAAM,+BAA+B,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjF,MAAM,SAAS,GAAG,SAAS,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QAE/D,IAAI,gBAAgB,CAAC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C,CAAC,CAAC,MAAM,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACpI,IAAI,CAAC,eAAe;YAClB,MAAM,IAAI,0BAAc,CAAC,2BAAe,CAAC,oBAAoB,EAAE,wDAAwD,MAAM,oCAAoC,SAAS,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC;QAE1M,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC3F,CAAC;AACH,CAAC,EA5KgB,qBAAqB,qCAArB,qBAAqB,QA4KrC","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\r\nimport { PrimitiveType, primitiveTypeToString } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { CustomAttribute } from \"../Metadata/CustomAttribute\";\r\nimport { CustomAttributeClass } from \"../Metadata/CustomAttributeClass\";\r\nimport { ArrayProperty, EnumerationProperty, PrimitiveOrEnumPropertyBase, PrimitiveProperty, Property, StructProperty } from \"../Metadata/Property\";\r\nimport { Schema } from \"../Metadata/Schema\";\r\n\r\n/**\r\n * Namespace holding utility functions for serializing EC types to the EC XML format.\r\n * @internal\r\n */\r\nexport namespace XmlSerializationUtils {\r\n /**\r\n * Serializes a CustomAttribute instance to the EC XML format.\r\n * @param fullName The full name of the CustomAttribute (qualified by schema name).\r\n * @param customAttribute The CustomAttribute instance to serialize.\r\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\r\n * @param schema The Schema object being serialized.\r\n * @beta\r\n */\r\n export async function writeCustomAttribute(fullName: string, customAttribute: CustomAttribute, schemaDoc: Document, schema: Schema): Promise<Element> {\r\n const caClass = await schema.lookupItem(fullName) as CustomAttributeClass;\r\n if (!caClass)\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `The class '${fullName}' could not be found in the current schema context.`);\r\n\r\n const nameAndNamespace = await resolveCustomAttributeNamespace(fullName, schema);\r\n const caElement = schemaDoc.createElement(nameAndNamespace[0]);\r\n\r\n if (nameAndNamespace[1])\r\n caElement.setAttribute(\"xmlns\", nameAndNamespace[1]);\r\n\r\n if (!caClass.properties)\r\n return caElement;\r\n\r\n for (const property of caClass.properties)\r\n await writeInstanceProperty(property, customAttribute, caElement, schemaDoc);\r\n\r\n return caElement;\r\n }\r\n\r\n /**\r\n * Serializes an EC Property instance to the EC XML format.\r\n * @param propertyClass The Property metadata object.\r\n * @param instance The Property instance.\r\n * @param instanceElement The XML Element that will contain the serialized property instance.\r\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\r\n * @beta\r\n */\r\n export async function writeInstanceProperty(propertyClass: Property, instance: any, instanceElement: Element, schemaDoc: Document): Promise<void> {\r\n const propertyValue = instance[propertyClass.name];\r\n if (propertyValue === undefined)\r\n return;\r\n\r\n const propertyElement = schemaDoc.createElement(propertyClass.name);\r\n instanceElement.appendChild(propertyElement);\r\n\r\n if (propertyClass.isArray()) {\r\n await writeArrayProperty(propertyClass, propertyValue, propertyElement, schemaDoc);\r\n } else if (propertyClass.isPrimitive()) {\r\n await writePrimitiveProperty(propertyClass, propertyValue, propertyElement);\r\n } else if (propertyClass.isStruct()) {\r\n await writeStructProperty(propertyClass, propertyValue, propertyElement, schemaDoc);\r\n }\r\n }\r\n\r\n /**\r\n * Serializes an EC ArrayProperty instance to the EC XML format.\r\n * @param propertyClass The Property metadata object.\r\n * @param propertyValue An array holding the property values.\r\n * @param arrayElement The XML Element that will contain the serialized property instance.\r\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\r\n * @beta\r\n */\r\n export async function writeArrayProperty(propertyClass: ArrayProperty, propertyValue: any[], arrayElement: Element, schemaDoc: Document): Promise<void> {\r\n if (propertyClass.isPrimitive()) {\r\n const typeString = primitiveTypeToString(propertyClass.primitiveType);\r\n for (const value of propertyValue) {\r\n const entryElement = schemaDoc.createElement(typeString);\r\n await writePrimitiveProperty(propertyClass, value, entryElement);\r\n arrayElement.appendChild(entryElement);\r\n }\r\n }\r\n\r\n if (propertyClass.isStruct()) {\r\n for (const value of propertyValue) {\r\n const structElement = schemaDoc.createElement(propertyClass.structClass.name);\r\n arrayElement.appendChild(structElement);\r\n await writeStructProperty(propertyClass, value, structElement, schemaDoc);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Serializes an EC StructProperty instance to the EC XML format.\r\n * @param propertyClass The Property metadata object.\r\n * @param propertyValue The struct object holding the property values.\r\n * @param structElement The XML Element that will contain the serialized property instance.\r\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\r\n * @beta\r\n */\r\n export async function writeStructProperty(propertyClass: StructProperty, propertyValue: any, structElement: Element, schemaDoc: Document): Promise<void> {\r\n const structClass = propertyClass.structClass;\r\n if (!structClass.properties)\r\n return;\r\n\r\n for (const propertyMetadata of structClass.properties)\r\n await writeInstanceProperty(propertyMetadata, propertyValue, structElement, schemaDoc);\r\n }\r\n\r\n /**\r\n * Serializes an EC PrimitiveProperty instance to the EC XML format.\r\n * @param propertyClass The Property metadata object.\r\n * @param propertyValue The struct object holding the property values.\r\n * @param propertyElement The XML Element that will contain the serialized property instance.\r\n * @beta\r\n */\r\n export async function writePrimitiveProperty(propertyClass: PrimitiveOrEnumPropertyBase, propertyValue: any, propertyElement: Element): Promise<void> {\r\n let primitiveType: PrimitiveType;\r\n if (propertyClass.isEnumeration()) {\r\n const enumeration = await (propertyClass as EnumerationProperty).enumeration;\r\n if (!enumeration)\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `The enumeration on property class '${propertyClass.fullName}' could not be found in the current schema context.`);\r\n\r\n if (enumeration.type === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidType, `The enumeration on property class '${propertyClass.fullName}' has an invalid primitive type.`);\r\n\r\n primitiveType = enumeration.type;\r\n } else\r\n primitiveType = (propertyClass as PrimitiveProperty).primitiveType;\r\n\r\n switch (primitiveType) {\r\n case PrimitiveType.String:\r\n propertyElement.textContent = propertyValue;\r\n return;\r\n case PrimitiveType.Boolean:\r\n propertyElement.textContent = (propertyValue as boolean) ? \"True\" : \"False\";\r\n return;\r\n case PrimitiveType.Integer:\r\n case PrimitiveType.Double:\r\n case PrimitiveType.Long:\r\n propertyElement.textContent = propertyValue.toString();\r\n return;\r\n case PrimitiveType.DateTime:\r\n propertyElement.textContent = new Date(propertyValue).getTime().toString();\r\n return;\r\n case PrimitiveType.Point2d:\r\n propertyElement.textContent = `${propertyValue.x},${propertyValue.y}`;\r\n return;\r\n case PrimitiveType.Point3d:\r\n propertyElement.textContent = `${propertyValue.x},${propertyValue.y},${propertyValue.z}`;\r\n return;\r\n case PrimitiveType.IGeometry:\r\n case PrimitiveType.Binary:\r\n propertyElement.textContent = propertyValue;\r\n return;\r\n default:\r\n throw new ECObjectsError(ECObjectsStatus.InvalidPrimitiveType, `The property '${propertyClass.fullName}' has an invalid primitive type.`);\r\n }\r\n }\r\n\r\n export function createXmlTypedName(currentSchema: Schema, typeSchema: Schema, typeName: string) {\r\n if (currentSchema.schemaKey.matches(typeSchema.schemaKey))\r\n return typeName;\r\n\r\n // Alias is required in Spec. It could be undefined (technically), so\r\n // throw until fixed.\r\n if (typeSchema.alias === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaAlias, `The schema '${typeSchema.name}' has an invalid alias.`);\r\n\r\n return `${typeSchema.alias}:${typeName}`;\r\n }\r\n\r\n async function resolveCustomAttributeNamespace(caName: string, schema: Schema): Promise<[string, string | undefined]> {\r\n const nameParts = caName.split(\".\");\r\n if (nameParts.length === 1)\r\n return [caName, undefined];\r\n\r\n const attributeSchema = nameParts[0].toUpperCase() === schema.name.toUpperCase() ? schema : await schema.getReference(nameParts[0]);\r\n if (!attributeSchema)\r\n throw new ECObjectsError(ECObjectsStatus.UnableToLocateSchema, `Unable to resolve the namespace for CustomAttribute '${caName}' because the referenced schema '${nameParts[0]}' could not be located.`);\r\n\r\n return [nameParts[1], `${nameParts[0]}.${attributeSchema.schemaKey.version.toString()}`];\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"XmlSerializationUtils.js","sourceRoot":"","sources":["../../../src/Deserialization/XmlSerializationUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,4CAAoE;AACpE,4CAA6D;AAM7D;;;GAGG;AACH,IAAiB,qBAAqB,CAiKrC;AAjKD,WAAiB,qBAAqB;IACpC;;;;;;OAMG;IACI,KAAK,UAAU,oBAAoB,CAAC,QAAgB,EAAE,eAAgC,EAAE,SAAmB,EAAE,MAAc;QAChI,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAyB,CAAC;QAC1E,IAAI,CAAC,OAAO;YACV,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,aAAa,EAAE,cAAc,QAAQ,qDAAqD,CAAC,CAAC;QAErI,MAAM,gBAAgB,GAAG,MAAM,+BAA+B,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjF,MAAM,SAAS,GAAG,SAAS,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QAE/D,IAAI,gBAAgB,CAAC,CAAC,CAAC;YACrB,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QAEvD,KAAK,MAAM,QAAQ,IAAI,MAAM,OAAO,CAAC,aAAa,EAAE;YAClD,MAAM,qBAAqB,CAAC,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QAE/E,OAAO,SAAS,CAAC;IACnB,CAAC;IAfqB,0CAAoB,uBAezC,CAAA;IAED;;;;;;OAMG;IACI,KAAK,UAAU,qBAAqB,CAAC,aAAuB,EAAE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","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\nimport { PrimitiveType, primitiveTypeToString } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { CustomAttribute } from \"../Metadata/CustomAttribute\";\nimport { CustomAttributeClass } from \"../Metadata/CustomAttributeClass\";\nimport { ArrayProperty, EnumerationProperty, PrimitiveOrEnumPropertyBase, PrimitiveProperty, Property, StructProperty } from \"../Metadata/Property\";\nimport { Schema } from \"../Metadata/Schema\";\n\n/**\n * Namespace holding utility functions for serializing EC types to the EC XML format.\n * @internal\n */\nexport namespace XmlSerializationUtils {\n /**\n * Serializes a CustomAttribute instance to the EC XML format.\n * @param fullName The full name of the CustomAttribute (qualified by schema name).\n * @param customAttribute The CustomAttribute instance to serialize.\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\n * @param schema The Schema object being serialized.\n */\n export async function writeCustomAttribute(fullName: string, customAttribute: CustomAttribute, schemaDoc: Document, schema: Schema): Promise<Element> {\n const caClass = await schema.lookupItem(fullName) as CustomAttributeClass;\n if (!caClass)\n throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `The class '${fullName}' could not be found in the current schema context.`);\n\n const nameAndNamespace = await resolveCustomAttributeNamespace(fullName, schema);\n const caElement = schemaDoc.createElement(nameAndNamespace[0]);\n\n if (nameAndNamespace[1])\n caElement.setAttribute(\"xmlns\", nameAndNamespace[1]);\n\n for (const property of await caClass.getProperties())\n await writeInstanceProperty(property, customAttribute, caElement, schemaDoc);\n\n return caElement;\n }\n\n /**\n * Serializes an EC Property instance to the EC XML format.\n * @param propertyClass The Property metadata object.\n * @param instance The Property instance.\n * @param instanceElement The XML Element that will contain the serialized property instance.\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\n */\n export async function writeInstanceProperty(propertyClass: Property, instance: any, instanceElement: Element, schemaDoc: Document): Promise<void> {\n const propertyValue = instance[propertyClass.name];\n if (propertyValue === undefined)\n return;\n\n const propertyElement = schemaDoc.createElement(propertyClass.name);\n instanceElement.appendChild(propertyElement);\n\n if (propertyClass.isArray()) {\n await writeArrayProperty(propertyClass, propertyValue, propertyElement, schemaDoc);\n } else if (propertyClass.isPrimitive()) {\n await writePrimitiveProperty(propertyClass, propertyValue, propertyElement);\n } else if (propertyClass.isStruct()) {\n await writeStructProperty(propertyClass, propertyValue, propertyElement, schemaDoc);\n }\n }\n\n /**\n * Serializes an EC ArrayProperty instance to the EC XML format.\n * @param propertyClass The Property metadata object.\n * @param propertyValue An array holding the property values.\n * @param arrayElement The XML Element that will contain the serialized property instance.\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\n */\n export async function writeArrayProperty(propertyClass: ArrayProperty, propertyValue: any[], arrayElement: Element, schemaDoc: Document): Promise<void> {\n if (propertyClass.isPrimitive()) {\n const typeString = primitiveTypeToString(propertyClass.primitiveType);\n for (const value of propertyValue) {\n const entryElement = schemaDoc.createElement(typeString);\n await writePrimitiveProperty(propertyClass, value, entryElement);\n arrayElement.appendChild(entryElement);\n }\n }\n\n if (propertyClass.isStruct()) {\n for (const value of propertyValue) {\n const structElement = schemaDoc.createElement(propertyClass.structClass.name);\n arrayElement.appendChild(structElement);\n await writeStructProperty(propertyClass, value, structElement, schemaDoc);\n }\n }\n }\n\n /**\n * Serializes an EC StructProperty instance to the EC XML format.\n * @param propertyClass The Property metadata object.\n * @param propertyValue The struct object holding the property values.\n * @param structElement The XML Element that will contain the serialized property instance.\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\n */\n export async function writeStructProperty(propertyClass: StructProperty, propertyValue: any, structElement: Element, schemaDoc: Document): Promise<void> {\n const structClass = propertyClass.structClass;\n for (const propertyMetadata of structClass.getPropertiesSync(true))\n await writeInstanceProperty(propertyMetadata, propertyValue, structElement, schemaDoc);\n }\n\n /**\n * Serializes an EC PrimitiveProperty instance to the EC XML format.\n * @param propertyClass The Property metadata object.\n * @param propertyValue The struct object holding the property values.\n * @param propertyElement The XML Element that will contain the serialized property instance.\n */\n export async function writePrimitiveProperty(propertyClass: PrimitiveOrEnumPropertyBase, propertyValue: any, propertyElement: Element): Promise<void> {\n let primitiveType: PrimitiveType;\n if (propertyClass.isEnumeration()) {\n const enumeration = await (propertyClass as EnumerationProperty).enumeration;\n if (!enumeration)\n throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `The enumeration on property class '${propertyClass.fullName}' could not be found in the current schema context.`);\n\n if (enumeration.type === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The enumeration on property class '${propertyClass.fullName}' has an invalid primitive type.`);\n\n primitiveType = enumeration.type;\n } else\n primitiveType = (propertyClass as PrimitiveProperty).primitiveType;\n\n switch (primitiveType) {\n case PrimitiveType.String:\n propertyElement.textContent = propertyValue;\n return;\n case PrimitiveType.Boolean:\n propertyElement.textContent = (propertyValue as boolean) ? \"True\" : \"False\";\n return;\n case PrimitiveType.Integer:\n case PrimitiveType.Double:\n case PrimitiveType.Long:\n propertyElement.textContent = propertyValue.toString();\n return;\n case PrimitiveType.DateTime:\n propertyElement.textContent = new Date(propertyValue).getTime().toString();\n return;\n case PrimitiveType.Point2d:\n propertyElement.textContent = `${propertyValue.x},${propertyValue.y}`;\n return;\n case PrimitiveType.Point3d:\n propertyElement.textContent = `${propertyValue.x},${propertyValue.y},${propertyValue.z}`;\n return;\n case PrimitiveType.IGeometry:\n case PrimitiveType.Binary:\n propertyElement.textContent = propertyValue;\n return;\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidPrimitiveType, `The property '${propertyClass.fullName}' has an invalid primitive type.`);\n }\n }\n\n export function createXmlTypedName(currentSchema: Schema, typeSchema: Schema, typeName: string) {\n if (currentSchema.schemaKey.matches(typeSchema.schemaKey))\n return typeName;\n\n // Alias is required in Spec. It could be undefined (technically), so\n // throw until fixed.\n if (typeSchema.alias === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaAlias, `The schema '${typeSchema.name}' has an invalid alias.`);\n\n return `${typeSchema.alias}:${typeName}`;\n }\n\n async function resolveCustomAttributeNamespace(caName: string, schema: Schema): Promise<[string, string | undefined]> {\n const nameParts = caName.split(\".\");\n if (nameParts.length === 1)\n return [caName, undefined];\n\n const attributeSchema = nameParts[0].toUpperCase() === schema.name.toUpperCase() ? schema : await schema.getReference(nameParts[0]);\n if (!attributeSchema)\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Unable to resolve the namespace for CustomAttribute '${caName}' because the referenced schema '${nameParts[0]}' could not be located.`);\n\n return [nameParts[1], `${nameParts[0]}.${attributeSchema.schemaKey.version.toString()}`];\n }\n}\n"]}
@@ -14,7 +14,7 @@
14
14
  export declare class ECName {
15
15
  private _name;
16
16
  /** Construct a new ECName from a valid EC name.
17
- * throws ECObjectsError if `name` does not meet the criteria for a valid EC name.
17
+ * throws ECSchemaError if `name` does not meet the criteria for a valid EC name.
18
18
  */
19
19
  constructor(name: string);
20
20
  /** Returns true if a string meets the criteria of a valid EC name. */
@@ -22,7 +22,7 @@ export declare class ECName {
22
22
  /** The underlying name as a string. */
23
23
  get name(): string;
24
24
  /** Create an ECName from an arbitrary string, encoding any special characters as "__x####__" where "####" is the UTF-16 character code.
25
- * @throws ECObjectsError if `input` is an empty string.
25
+ * @throws ECSchemaError if `input` is an empty string.
26
26
  */
27
27
  static encode(input: string): ECName;
28
28
  /** Decode this ECName, replacing encoded special characters with the characters they encode. */
package/lib/cjs/ECName.js CHANGED
@@ -32,12 +32,13 @@ function isValidAlphaNumericCharacter(c) {
32
32
  * @public
33
33
  */
34
34
  class ECName {
35
+ _name;
35
36
  /** Construct a new ECName from a valid EC name.
36
- * throws ECObjectsError if `name` does not meet the criteria for a valid EC name.
37
+ * throws ECSchemaError if `name` does not meet the criteria for a valid EC name.
37
38
  */
38
39
  constructor(name) {
39
40
  if (!ECName.validate(name))
40
- throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidECName);
41
+ throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidECName);
41
42
  this._name = name;
42
43
  }
43
44
  /** Returns true if a string meets the criteria of a valid EC name. */
@@ -49,11 +50,11 @@ class ECName {
49
50
  return this._name;
50
51
  }
51
52
  /** Create an ECName from an arbitrary string, encoding any special characters as "__x####__" where "####" is the UTF-16 character code.
52
- * @throws ECObjectsError if `input` is an empty string.
53
+ * @throws ECSchemaError if `input` is an empty string.
53
54
  */
54
55
  static encode(input) {
55
56
  if (0 === input.length)
56
- throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidECName);
57
+ throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidECName);
57
58
  if (ECName.validate(input)) {
58
59
  // It's already a valid EC name.
59
60
  return new ECName(input);
@@ -1 +1 @@
1
- {"version":3,"file":"ECName.js","sourceRoot":"","sources":["../../src/ECName.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,2CAA8D;AAE9D,MAAM,gBAAgB,GAAG,8BAA8B,CAAC;AACxD,MAAM,mBAAmB,GAAG,wBAAwB,CAAC;AACrD,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;AAErD,SAAS,OAAO,CAAC,SAAiB;IAChC,IAAA,qBAAM,EAAC,CAAC,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,SAAS,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,CAAC;AAC9C,CAAC;AAED,SAAS,4BAA4B,CAAC,CAAS;IAC7C,IAAA,qBAAM,EAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;IACvB,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,G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tD,CAAC;QAED,qCAAqC;QACrC,MAAM,gBAAgB,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,IAAI,gBAAgB;YAClB,sBAAsB,CAAC,CAAC,CAAC,CAAC;QAE5B,KAAK,IAAI,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7D,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACtB,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC;gBACrC,sBAAsB,CAAC,CAAC,CAAC,CAAC;;gBAE1B,MAAM,IAAI,IAAI,CAAC;QACnB,CAAC;QAED,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,gGAAgG;IACzF,MAAM;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAChH,CAAC;CACF;AA/DD,wBA+DC","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 Metadata\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"./Exception\";\r\n\r\nconst validECNameRegex = /^([a-zA-Z_]+[a-zA-Z0-9_]*)$/i;\r\nconst ecNameReplacerRegex = /__x([0-9a-fA-F]{4})__/g;\r\nconst leadingDigits = [\"0000\", \"000\", \"00\", \"0\", \"\"];\r\n\r\nfunction isDigit(character: string): boolean {\r\n assert(1 === character.length);\r\n return character >= \"0\" && character <= \"9\";\r\n}\r\n\r\nfunction isValidAlphaNumericCharacter(c: string): boolean {\r\n assert(1 === c.length);\r\n return (((c >= \"0\" && c <= \"9\") || (c >= \"A\" && c <= \"Z\") || (c >= \"a\" && c <= \"z\") || c === \"_\"));\r\n}\r\n\r\n/** The name of an item in a [[Schema]], encoded to meet restrictions on the characters usable in such names.\r\n * An ECName meets the following criteria:\r\n * - Contains at least one character.\r\n * - Does not begin with a digit.\r\n * - Consists entirely of characters in the ASCII ranges A-Z, a-z, and 0-9; and the underscore (\"_\") character.\r\n *\r\n * All characters not meeting the above criteria are encoded as \"__x####__\" where \"####\" is the UTF-16 character code.\r\n * Such names are often automatically generated from the item's display label, which is unrestricted in the characters it may contain.\r\n * @public\r\n */\r\nexport class ECName {\r\n private _name: string;\r\n\r\n /** Construct a new ECName from a valid EC name.\r\n * throws ECObjectsError if `name` does not meet the criteria for a valid EC name.\r\n */\r\n constructor(name: string) {\r\n if (!ECName.validate(name))\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECName);\r\n\r\n this._name = name;\r\n }\r\n\r\n /** Returns true if a string meets the criteria of a valid EC name. */\r\n public static validate(name: string): boolean {\r\n return validECNameRegex.test(name);\r\n }\r\n\r\n /** The underlying name as a string. */\r\n public get name(): string {\r\n return this._name;\r\n }\r\n\r\n /** Create an ECName from an arbitrary string, encoding any special characters as \"__x####__\" where \"####\" is the UTF-16 character code.\r\n * @throws ECObjectsError if `input` is an empty string.\r\n */\r\n public static encode(input: string): ECName {\r\n if (0 === input.length)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECName);\r\n\r\n if (ECName.validate(input)) {\r\n // It's already a valid EC name.\r\n return new ECName(input);\r\n }\r\n\r\n let output = \"\";\r\n\r\n function appendEncodedCharacter(index: number): void {\r\n const hex = input.charCodeAt(index).toString(16).toUpperCase();\r\n assert(hex.length > 0 && hex.length < 5);\r\n output += `__x${leadingDigits[hex.length]}${hex}__`;\r\n }\r\n\r\n // First character cannot be a digit.\r\n const firstCharIsDigit = isDigit(input[0]);\r\n if (firstCharIsDigit)\r\n appendEncodedCharacter(0);\r\n\r\n for (let i = firstCharIsDigit ? 1 : 0; i < input.length; i++) {\r\n const char = input[i];\r\n if (!isValidAlphaNumericCharacter(char))\r\n appendEncodedCharacter(i);\r\n else\r\n output += char;\r\n }\r\n\r\n return new ECName(output);\r\n }\r\n\r\n /** Decode this ECName, replacing encoded special characters with the characters they encode. */\r\n public decode(): string {\r\n return this.name.replace(ecNameReplacerRegex, (_match, hex) => String.fromCharCode(Number.parseInt(hex, 16)));\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ECName.js","sourceRoot":"","sources":["../../src/ECName.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,2CAA4D;AAE5D,MAAM,gBAAgB,GAAG,8BAA8B,CAAC;AACxD,MAAM,mBAAmB,GAAG,wBAAwB,CAAC;AACrD,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;AAErD,SAAS,OAAO,CAAC,SAAiB;IAChC,IAAA,qBAAM,EAAC,CAAC,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,SAAS,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,CAAC;AAC9C,CAAC;AAED,SAAS,4BAA4B,CAAC,CAAS;IAC7C,IAAA,qBAAM,EAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;IACvB,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;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AC3C,IAAI,gBAAgB;YAClB,sBAAsB,CAAC,CAAC,CAAC,CAAC;QAE5B,KAAK,IAAI,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7D,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACtB,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC;gBACrC,sBAAsB,CAAC,CAAC,CAAC,CAAC;;gBAE1B,MAAM,IAAI,IAAI,CAAC;QACnB,CAAC;QAED,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,gGAAgG;IACzF,MAAM;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAChH,CAAC;CACF;AA/DD,wBA+DC","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 Metadata\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { ECSchemaError, ECSchemaStatus } from \"./Exception\";\n\nconst validECNameRegex = /^([a-zA-Z_]+[a-zA-Z0-9_]*)$/i;\nconst ecNameReplacerRegex = /__x([0-9a-fA-F]{4})__/g;\nconst leadingDigits = [\"0000\", \"000\", \"00\", \"0\", \"\"];\n\nfunction isDigit(character: string): boolean {\n assert(1 === character.length);\n return character >= \"0\" && character <= \"9\";\n}\n\nfunction isValidAlphaNumericCharacter(c: string): boolean {\n assert(1 === c.length);\n return (((c >= \"0\" && c <= \"9\") || (c >= \"A\" && c <= \"Z\") || (c >= \"a\" && c <= \"z\") || c === \"_\"));\n}\n\n/** The name of an item in a [[Schema]], encoded to meet restrictions on the characters usable in such names.\n * An ECName meets the following criteria:\n * - Contains at least one character.\n * - Does not begin with a digit.\n * - Consists entirely of characters in the ASCII ranges A-Z, a-z, and 0-9; and the underscore (\"_\") character.\n *\n * All characters not meeting the above criteria are encoded as \"__x####__\" where \"####\" is the UTF-16 character code.\n * Such names are often automatically generated from the item's display label, which is unrestricted in the characters it may contain.\n * @public\n */\nexport class ECName {\n private _name: string;\n\n /** Construct a new ECName from a valid EC name.\n * throws ECSchemaError if `name` does not meet the criteria for a valid EC name.\n */\n constructor(name: string) {\n if (!ECName.validate(name))\n throw new ECSchemaError(ECSchemaStatus.InvalidECName);\n\n this._name = name;\n }\n\n /** Returns true if a string meets the criteria of a valid EC name. */\n public static validate(name: string): boolean {\n return validECNameRegex.test(name);\n }\n\n /** The underlying name as a string. */\n public get name(): string {\n return this._name;\n }\n\n /** Create an ECName from an arbitrary string, encoding any special characters as \"__x####__\" where \"####\" is the UTF-16 character code.\n * @throws ECSchemaError if `input` is an empty string.\n */\n public static encode(input: string): ECName {\n if (0 === input.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECName);\n\n if (ECName.validate(input)) {\n // It's already a valid EC name.\n return new ECName(input);\n }\n\n let output = \"\";\n\n function appendEncodedCharacter(index: number): void {\n const hex = input.charCodeAt(index).toString(16).toUpperCase();\n assert(hex.length > 0 && hex.length < 5);\n output += `__x${leadingDigits[hex.length]}${hex}__`;\n }\n\n // First character cannot be a digit.\n const firstCharIsDigit = isDigit(input[0]);\n if (firstCharIsDigit)\n appendEncodedCharacter(0);\n\n for (let i = firstCharIsDigit ? 1 : 0; i < input.length; i++) {\n const char = input[i];\n if (!isValidAlphaNumericCharacter(char))\n appendEncodedCharacter(i);\n else\n output += char;\n }\n\n return new ECName(output);\n }\n\n /** Decode this ECName, replacing encoded special characters with the characters they encode. */\n public decode(): string {\n return this.name.replace(ecNameReplacerRegex, (_match, hex) => String.fromCharCode(Number.parseInt(hex, 16)));\n }\n}\n"]}
@@ -2,7 +2,11 @@
2
2
  * @module Metadata
3
3
  */
4
4
  export { PropertyType } from "./PropertyTypes";
5
- /** @beta */
5
+ /**
6
+ * Identifies a class as abstract or sealed
7
+ *
8
+ * @public @preview
9
+ */
6
10
  export declare enum ECClassModifier {
7
11
  None = 0,
8
12
  Abstract = 1,
@@ -10,7 +14,10 @@ export declare enum ECClassModifier {
10
14
  }
11
15
  /**
12
16
  * An enumeration that has all the schema item type names as values
13
- * @beta */
17
+ *
18
+ * @enum {string}
19
+ * @public @preview
20
+ */
14
21
  export declare enum SchemaItemType {
15
22
  EntityClass = "EntityClass",
16
23
  Mixin = "Mixin",
@@ -27,9 +34,22 @@ export declare enum SchemaItemType {
27
34
  UnitSystem = "UnitSystem",
28
35
  Format = "Format"
29
36
  }
37
+ /**
38
+ * Additional Schema Item Types which define classes of item types
39
+ * @public @preview
40
+ */
41
+ export declare enum AbstractSchemaItemType {
42
+ Class = "Class",
43
+ SchemaItem = "SchemaItem"
44
+ }
45
+ /**
46
+ * Defines types of items that may be provided to identify supported items
47
+ * @public @preview
48
+ */
49
+ export type SupportedSchemaItemType = SchemaItemType | AbstractSchemaItemType;
30
50
  /**
31
51
  * Primitive data types for ECProperties.
32
- * @beta
52
+ * @public @preview
33
53
  */
34
54
  export declare enum PrimitiveType {
35
55
  Uninitialized = 0,
@@ -46,7 +66,7 @@ export declare enum PrimitiveType {
46
66
  }
47
67
  /**
48
68
  * Defines the valid CustomAttribute container types.
49
- * @beta
69
+ * @public @preview
50
70
  */
51
71
  export declare enum CustomAttributeContainerType {
52
72
  Schema = 1,
@@ -68,7 +88,7 @@ export declare enum CustomAttributeContainerType {
68
88
  }
69
89
  /**
70
90
  * Defines what sort of match should be used when locating a schema.
71
- * @beta
91
+ * @public @preview
72
92
  */
73
93
  export declare enum SchemaMatchType {
74
94
  Identical = 0,
@@ -79,21 +99,29 @@ export declare enum SchemaMatchType {
79
99
  }
80
100
  /**
81
101
  * Identifer for an ECRelationshipConstraint. Used to determine the side of the relationship the constraint is representing.
82
- * @beta
102
+ * @public @preview
83
103
  */
84
104
  export declare enum RelationshipEnd {
85
105
  Source = 0,
86
106
  Target = 1
87
107
  }
88
- /** @beta */
108
+ /**
109
+ * Defines the how the lifetime of the source and target are related.
110
+ *
111
+ * @public @preview */
89
112
  export declare enum StrengthType {
90
113
  Referencing = 0,
91
114
  Holding = 1,
92
115
  Embedding = 2
93
116
  }
94
- /** @beta */
117
+ /**
118
+ * Defines the which side of the relationship is the starting point of the relationship. This impacts how relationship strength is applied.
119
+ *
120
+ * @public @preview */
95
121
  export declare enum StrengthDirection {
122
+ /** The source is the starting point of the relationship. */
96
123
  Forward = 1,
124
+ /** The target is the starting point of the relationship. */
97
125
  Backward = 2
98
126
  }
99
127
  /**
@@ -152,7 +180,7 @@ export declare function parseRelationshipEnd(end: string): RelationshipEnd | und
152
180
  export declare function relationshipEndToString(end: RelationshipEnd): string;
153
181
  /**
154
182
  * Takes a string representing a StrengthType, will parse it and return the corresponding StrengthType.
155
- * @throws ECObjectsStatus.InvalidStrength if the provided string that is not valid
183
+ * @throws ECSchemaStatus.InvalidStrength if the provided string that is not valid
156
184
  * @param strength
157
185
  * @beta
158
186
  */
@@ -163,4 +191,8 @@ export declare function strengthToString(strength: StrengthType): string;
163
191
  export declare function parseStrengthDirection(direction: string): StrengthDirection | undefined;
164
192
  /** @beta */
165
193
  export declare function strengthDirectionToString(direction: StrengthDirection): string;
194
+ /** Compares a SchemaItemType against supported type.
195
+ * @beta
196
+ */
197
+ export declare function isSupportedSchemaItemType(value: SchemaItemType, supported: SupportedSchemaItemType): boolean;
166
198
  //# sourceMappingURL=ECObjects.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ECObjects.d.ts","sourceRoot":"","sources":["../../src/ECObjects.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAE,YAAY,EAAE,MA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AS,CAe1E;AAED,YAAY;AACZ,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAejE;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,MAAM,GAAG,4BAA4B,GAAG,SAAS,CAiExG;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,4BAA4B,GAAG,MAAM,CAuDhF;AAED,YAAY;AACZ,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAM7E;AAED,YAAY;AACZ,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAOpE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAOxE;AAED,YAAY;AACZ,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAQ/D;AAED,YAAY;AACZ,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAMvF;AAED,YAAY;AACZ,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,iBAAiB,GAAG,MAAM,CAO9E;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,uBAAuB,GAAG,OAAO,CAiB5G"}
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
6
  /** @packageDocumentation
7
7
  * @module Metadata
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.StrengthDirection = exports.StrengthType = exports.RelationshipEnd = exports.SchemaMatchType = exports.CustomAttributeContainerType = exports.PrimitiveType = exports.SchemaItemType = exports.ECClassModifier = exports.PropertyType = void 0;
10
+ exports.StrengthDirection = exports.StrengthType = exports.RelationshipEnd = exports.SchemaMatchType = exports.CustomAttributeContainerType = exports.PrimitiveType = exports.AbstractSchemaItemType = exports.SchemaItemType = exports.ECClassModifier = exports.PropertyType = void 0;
11
11
  exports.parseClassModifier = parseClassModifier;
12
12
  exports.classModifierToString = classModifierToString;
13
13
  exports.parseSchemaItemType = parseSchemaItemType;
@@ -23,6 +23,7 @@ exports.parseStrength = parseStrength;
23
23
  exports.strengthToString = strengthToString;
24
24
  exports.parseStrengthDirection = parseStrengthDirection;
25
25
  exports.strengthDirectionToString = strengthDirectionToString;
26
+ exports.isSupportedSchemaItemType = isSupportedSchemaItemType;
26
27
  const Constants_1 = require("./Constants");
27
28
  const Exception_1 = require("./Exception");
28
29
  var PropertyTypes_1 = require("./PropertyTypes");
@@ -31,16 +32,26 @@ Object.defineProperty(exports, "PropertyType", { enumerable: true, get: function
31
32
  if (!Symbol.asyncIterator) {
32
33
  Symbol.asyncIterator = Symbol.for("Symbol.asyncIterator");
33
34
  }
34
- /** @beta */
35
+ /**
36
+ * Identifies a class as abstract or sealed
37
+ *
38
+ * @public @preview
39
+ */
35
40
  var ECClassModifier;
36
41
  (function (ECClassModifier) {
42
+ /* normal, instantiable class, can be subclassed */
37
43
  ECClassModifier[ECClassModifier["None"] = 0] = "None";
44
+ /* abstract class, cannot be instantiated, can be subclassed */
38
45
  ECClassModifier[ECClassModifier["Abstract"] = 1] = "Abstract";
46
+ /* sealed class, instantiable class, cannot be subclassed */
39
47
  ECClassModifier[ECClassModifier["Sealed"] = 2] = "Sealed";
40
48
  })(ECClassModifier || (exports.ECClassModifier = ECClassModifier = {}));
41
49
  /**
42
50
  * An enumeration that has all the schema item type names as values
43
- * @beta */
51
+ *
52
+ * @enum {string}
53
+ * @public @preview
54
+ */
44
55
  var SchemaItemType;
45
56
  (function (SchemaItemType) {
46
57
  SchemaItemType["EntityClass"] = "EntityClass";
@@ -58,9 +69,20 @@ var SchemaItemType;
58
69
  SchemaItemType["UnitSystem"] = "UnitSystem";
59
70
  SchemaItemType["Format"] = "Format";
60
71
  })(SchemaItemType || (exports.SchemaItemType = SchemaItemType = {}));
72
+ /**
73
+ * Additional Schema Item Types which define classes of item types
74
+ * @public @preview
75
+ */
76
+ var AbstractSchemaItemType;
77
+ (function (AbstractSchemaItemType) {
78
+ /* Item is EntityClass, Mixin, StructClass, CustomAttributeClass, or RelationshipClass */
79
+ AbstractSchemaItemType["Class"] = "Class";
80
+ /* Any item type including the Class types */
81
+ AbstractSchemaItemType["SchemaItem"] = "SchemaItem";
82
+ })(AbstractSchemaItemType || (exports.AbstractSchemaItemType = AbstractSchemaItemType = {}));
61
83
  /**
62
84
  * Primitive data types for ECProperties.
63
- * @beta
85
+ * @public @preview
64
86
  */
65
87
  var PrimitiveType;
66
88
  (function (PrimitiveType) {
@@ -78,7 +100,7 @@ var PrimitiveType;
78
100
  })(PrimitiveType || (exports.PrimitiveType = PrimitiveType = {}));
79
101
  /**
80
102
  * Defines the valid CustomAttribute container types.
81
- * @beta
103
+ * @public @preview
82
104
  */
83
105
  var CustomAttributeContainerType;
84
106
  (function (CustomAttributeContainerType) {
@@ -101,14 +123,14 @@ var CustomAttributeContainerType;
101
123
  })(CustomAttributeContainerType || (exports.CustomAttributeContainerType = CustomAttributeContainerType = {}));
102
124
  /**
103
125
  * Defines what sort of match should be used when locating a schema.
104
- * @beta
126
+ * @public @preview
105
127
  */
106
128
  var SchemaMatchType;
107
129
  (function (SchemaMatchType) {
108
130
  /*
109
- * Find exact VersionRead, VersionWrite, VersionMinor match as well as Data. NOTE data is not yet matched
110
- * @deprecated in 4.10 Use Exact instead.
111
- */
131
+ * Find exact VersionRead, VersionWrite, VersionMinor match as well as Data. NOTE data is not yet matched
132
+ * @deprecated in 4.10 Use Exact instead.
133
+ */
112
134
  SchemaMatchType[SchemaMatchType["Identical"] = 0] = "Identical";
113
135
  /* Find exact VersionRead, VersionWrite, VersionMinor match. */
114
136
  SchemaMatchType[SchemaMatchType["Exact"] = 1] = "Exact";
@@ -121,24 +143,32 @@ var SchemaMatchType;
121
143
  })(SchemaMatchType || (exports.SchemaMatchType = SchemaMatchType = {}));
122
144
  /**
123
145
  * Identifer for an ECRelationshipConstraint. Used to determine the side of the relationship the constraint is representing.
124
- * @beta
146
+ * @public @preview
125
147
  */
126
148
  var RelationshipEnd;
127
149
  (function (RelationshipEnd) {
128
150
  RelationshipEnd[RelationshipEnd["Source"] = 0] = "Source";
129
151
  RelationshipEnd[RelationshipEnd["Target"] = 1] = "Target";
130
152
  })(RelationshipEnd || (exports.RelationshipEnd = RelationshipEnd = {}));
131
- /** @beta */
153
+ /**
154
+ * Defines the how the lifetime of the source and target are related.
155
+ *
156
+ * @public @preview */
132
157
  var StrengthType;
133
158
  (function (StrengthType) {
134
159
  StrengthType[StrengthType["Referencing"] = 0] = "Referencing";
135
160
  StrengthType[StrengthType["Holding"] = 1] = "Holding";
136
161
  StrengthType[StrengthType["Embedding"] = 2] = "Embedding";
137
162
  })(StrengthType || (exports.StrengthType = StrengthType = {}));
138
- /** @beta */
163
+ /**
164
+ * Defines the which side of the relationship is the starting point of the relationship. This impacts how relationship strength is applied.
165
+ *
166
+ * @public @preview */
139
167
  var StrengthDirection;
140
168
  (function (StrengthDirection) {
169
+ /** The source is the starting point of the relationship. */
141
170
  StrengthDirection[StrengthDirection["Forward"] = 1] = "Forward";
171
+ /** The target is the starting point of the relationship. */
142
172
  StrengthDirection[StrengthDirection["Backward"] = 2] = "Backward";
143
173
  })(StrengthDirection || (exports.StrengthDirection = StrengthDirection = {}));
144
174
  // Helper methods for going to/from string for the above Enumerations.
@@ -165,7 +195,8 @@ function classModifierToString(modifier) {
165
195
  case ECClassModifier.Abstract: return "Abstract";
166
196
  case ECClassModifier.None: return "None";
167
197
  case ECClassModifier.Sealed: return "Sealed";
168
- default: throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidModifier, "An invalid ECClassModifier has been provided.");
198
+ default:
199
+ throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidModifier, "An invalid ECClassModifier has been provided.");
169
200
  }
170
201
  }
171
202
  /**
@@ -220,7 +251,8 @@ function schemaItemTypeToXmlString(value) {
220
251
  case SchemaItemType.Phenomenon: return "Phenomenon";
221
252
  case SchemaItemType.UnitSystem: return "UnitSystem";
222
253
  case SchemaItemType.Format: return "Format";
223
- default: throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidSchemaItemType, "An invalid SchemaItemType has been provided.");
254
+ default:
255
+ throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaItemType, "An invalid SchemaItemType has been provided.");
224
256
  }
225
257
  }
226
258
  /**
@@ -258,7 +290,8 @@ function primitiveTypeToString(type) {
258
290
  case PrimitiveType.Point2d: return "point2d";
259
291
  case PrimitiveType.Point3d: return "point3d";
260
292
  case PrimitiveType.String: return "string";
261
- default: throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidPrimitiveType, "An invalid PrimitiveType has been provided.");
293
+ default:
294
+ throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidPrimitiveType, "An invalid PrimitiveType has been provided.");
262
295
  }
263
296
  }
264
297
  /**
@@ -324,7 +357,7 @@ function parseCustomAttributeContainerType(type) {
324
357
  containerType = containerType | CustomAttributeContainerType.Any;
325
358
  break;
326
359
  default:
327
- throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidContainerType, `${typeToken} is not a valid CustomAttributeContainerType value.`);
360
+ throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidContainerType, `${typeToken} is not a valid CustomAttributeContainerType value.`);
328
361
  }
329
362
  });
330
363
  return containerType;
@@ -337,7 +370,7 @@ function parseCustomAttributeContainerType(type) {
337
370
  */
338
371
  function containerTypeToString(type) {
339
372
  const testContainerTypeValue = (compareType, otherType) => {
340
- return (compareType === (compareType & otherType));
373
+ return compareType === (compareType & otherType);
341
374
  };
342
375
  if (testContainerTypeValue(CustomAttributeContainerType.Any, type))
343
376
  return Constants_1.ECStringConstants.CONTAINERTYPE_ANY;
@@ -399,12 +432,13 @@ function relationshipEndToString(end) {
399
432
  switch (end) {
400
433
  case RelationshipEnd.Source: return Constants_1.ECStringConstants.RELATIONSHIP_END_SOURCE;
401
434
  case RelationshipEnd.Target: return Constants_1.ECStringConstants.RELATIONSHIP_END_TARGET;
402
- default: throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidRelationshipEnd, `An invalid RelationshipEnd has been provided.`);
435
+ default:
436
+ throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidRelationshipEnd, `An invalid RelationshipEnd has been provided.`);
403
437
  }
404
438
  }
405
439
  /**
406
440
  * Takes a string representing a StrengthType, will parse it and return the corresponding StrengthType.
407
- * @throws ECObjectsStatus.InvalidStrength if the provided string that is not valid
441
+ * @throws ECSchemaStatus.InvalidStrength if the provided string that is not valid
408
442
  * @param strength
409
443
  * @beta
410
444
  */
@@ -422,7 +456,8 @@ function strengthToString(strength) {
422
456
  case StrengthType.Embedding: return "Embedding";
423
457
  case StrengthType.Holding: return "Holding";
424
458
  case StrengthType.Referencing: return "Referencing";
425
- default: throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidStrength, `An invalid Strength has been provided.`);
459
+ default:
460
+ throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidStrength, `An invalid Strength has been provided.`);
426
461
  }
427
462
  }
428
463
  /** @beta */
@@ -438,7 +473,26 @@ function strengthDirectionToString(direction) {
438
473
  switch (direction) {
439
474
  case StrengthDirection.Forward: return "Forward";
440
475
  case StrengthDirection.Backward: return "Backward";
441
- default: throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidStrengthDirection, `An invalid StrengthDirection has been provided.`);
476
+ default:
477
+ throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidStrengthDirection, `An invalid StrengthDirection has been provided.`);
478
+ }
479
+ }
480
+ /** Compares a SchemaItemType against supported type.
481
+ * @beta
482
+ */
483
+ function isSupportedSchemaItemType(value, supported) {
484
+ if (value === supported)
485
+ return true;
486
+ if (supported === AbstractSchemaItemType.Class && (value === SchemaItemType.EntityClass ||
487
+ value === SchemaItemType.Mixin ||
488
+ value === SchemaItemType.StructClass ||
489
+ value === SchemaItemType.CustomAttributeClass ||
490
+ value === SchemaItemType.RelationshipClass)) {
491
+ return true;
492
+ }
493
+ if (supported === AbstractSchemaItemType.SchemaItem) {
494
+ return true;
442
495
  }
496
+ return false;
443
497
  }
444
498
  //# sourceMappingURL=ECObjects.js.map