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

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 (338) hide show
  1. package/CHANGELOG.md +61 -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/XmlParser.d.ts.map +1 -1
  27. package/lib/cjs/Deserialization/XmlParser.js +60 -52
  28. package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
  29. package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts +0 -5
  30. package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
  31. package/lib/cjs/Deserialization/XmlSerializationUtils.js +8 -17
  32. package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
  33. package/lib/cjs/ECName.d.ts +2 -2
  34. package/lib/cjs/ECName.js +5 -4
  35. package/lib/cjs/ECName.js.map +1 -1
  36. package/lib/cjs/ECObjects.d.ts +41 -9
  37. package/lib/cjs/ECObjects.d.ts.map +1 -1
  38. package/lib/cjs/ECObjects.js +78 -24
  39. package/lib/cjs/ECObjects.js.map +1 -1
  40. package/lib/cjs/Exception.d.ts +4 -4
  41. package/lib/cjs/Exception.d.ts.map +1 -1
  42. package/lib/cjs/Exception.js +61 -60
  43. package/lib/cjs/Exception.js.map +1 -1
  44. package/lib/cjs/Interfaces.d.ts +35 -32
  45. package/lib/cjs/Interfaces.d.ts.map +1 -1
  46. package/lib/cjs/Interfaces.js.map +1 -1
  47. package/lib/cjs/Metadata/Class.d.ts +179 -32
  48. package/lib/cjs/Metadata/Class.d.ts.map +1 -1
  49. package/lib/cjs/Metadata/Class.js +290 -88
  50. package/lib/cjs/Metadata/Class.js.map +1 -1
  51. package/lib/cjs/Metadata/Constant.d.ts +26 -10
  52. package/lib/cjs/Metadata/Constant.d.ts.map +1 -1
  53. package/lib/cjs/Metadata/Constant.js +38 -10
  54. package/lib/cjs/Metadata/Constant.js.map +1 -1
  55. package/lib/cjs/Metadata/CustomAttribute.d.ts +2 -2
  56. package/lib/cjs/Metadata/CustomAttribute.d.ts.map +1 -1
  57. package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
  58. package/lib/cjs/Metadata/CustomAttributeClass.d.ts +21 -7
  59. package/lib/cjs/Metadata/CustomAttributeClass.d.ts.map +1 -1
  60. package/lib/cjs/Metadata/CustomAttributeClass.js +28 -8
  61. package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
  62. package/lib/cjs/Metadata/EntityClass.d.ts +40 -11
  63. package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
  64. package/lib/cjs/Metadata/EntityClass.js +72 -34
  65. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  66. package/lib/cjs/Metadata/Enumeration.d.ts +30 -10
  67. package/lib/cjs/Metadata/Enumeration.d.ts.map +1 -1
  68. package/lib/cjs/Metadata/Enumeration.js +41 -13
  69. package/lib/cjs/Metadata/Enumeration.js.map +1 -1
  70. package/lib/cjs/Metadata/Format.d.ts +65 -17
  71. package/lib/cjs/Metadata/Format.d.ts.map +1 -1
  72. package/lib/cjs/Metadata/Format.js +107 -22
  73. package/lib/cjs/Metadata/Format.js.map +1 -1
  74. package/lib/cjs/Metadata/InvertedUnit.d.ts +19 -10
  75. package/lib/cjs/Metadata/InvertedUnit.d.ts.map +1 -1
  76. package/lib/cjs/Metadata/InvertedUnit.js +32 -15
  77. package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
  78. package/lib/cjs/Metadata/KindOfQuantity.d.ts +38 -18
  79. package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
  80. package/lib/cjs/Metadata/KindOfQuantity.js +90 -40
  81. package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
  82. package/lib/cjs/Metadata/Mixin.d.ts +31 -4
  83. package/lib/cjs/Metadata/Mixin.d.ts.map +1 -1
  84. package/lib/cjs/Metadata/Mixin.js +42 -8
  85. package/lib/cjs/Metadata/Mixin.js.map +1 -1
  86. package/lib/cjs/Metadata/OverrideFormat.d.ts +12 -12
  87. package/lib/cjs/Metadata/OverrideFormat.d.ts.map +1 -1
  88. package/lib/cjs/Metadata/OverrideFormat.js +36 -19
  89. package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
  90. package/lib/cjs/Metadata/Phenomenon.d.ts +24 -3
  91. package/lib/cjs/Metadata/Phenomenon.d.ts.map +1 -1
  92. package/lib/cjs/Metadata/Phenomenon.js +32 -3
  93. package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
  94. package/lib/cjs/Metadata/Property.d.ts +47 -25
  95. package/lib/cjs/Metadata/Property.d.ts.map +1 -1
  96. package/lib/cjs/Metadata/Property.js +128 -49
  97. package/lib/cjs/Metadata/Property.js.map +1 -1
  98. package/lib/cjs/Metadata/PropertyCategory.d.ts +20 -4
  99. package/lib/cjs/Metadata/PropertyCategory.d.ts.map +1 -1
  100. package/lib/cjs/Metadata/PropertyCategory.js +31 -4
  101. package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
  102. package/lib/cjs/Metadata/RelationshipClass.d.ts +63 -27
  103. package/lib/cjs/Metadata/RelationshipClass.d.ts.map +1 -1
  104. package/lib/cjs/Metadata/RelationshipClass.js +100 -43
  105. package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
  106. package/lib/cjs/Metadata/Schema.d.ts +167 -41
  107. package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
  108. package/lib/cjs/Metadata/Schema.js +211 -111
  109. package/lib/cjs/Metadata/Schema.js.map +1 -1
  110. package/lib/cjs/Metadata/SchemaItem.d.ts +19 -19
  111. package/lib/cjs/Metadata/SchemaItem.d.ts.map +1 -1
  112. package/lib/cjs/Metadata/SchemaItem.js +23 -21
  113. package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
  114. package/lib/cjs/Metadata/Unit.d.ts +24 -21
  115. package/lib/cjs/Metadata/Unit.d.ts.map +1 -1
  116. package/lib/cjs/Metadata/Unit.js +40 -24
  117. package/lib/cjs/Metadata/Unit.js.map +1 -1
  118. package/lib/cjs/Metadata/UnitSystem.d.ts +17 -4
  119. package/lib/cjs/Metadata/UnitSystem.d.ts.map +1 -1
  120. package/lib/cjs/Metadata/UnitSystem.js +24 -4
  121. package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
  122. package/lib/cjs/PropertyTypes.d.ts +11 -11
  123. package/lib/cjs/PropertyTypes.d.ts.map +1 -1
  124. package/lib/cjs/PropertyTypes.js +28 -20
  125. package/lib/cjs/PropertyTypes.js.map +1 -1
  126. package/lib/cjs/SchemaFormatsProvider.d.ts +39 -0
  127. package/lib/cjs/SchemaFormatsProvider.d.ts.map +1 -0
  128. package/lib/cjs/SchemaFormatsProvider.js +146 -0
  129. package/lib/cjs/SchemaFormatsProvider.js.map +1 -0
  130. package/lib/cjs/SchemaJsonLocater.d.ts +8 -8
  131. package/lib/cjs/SchemaJsonLocater.d.ts.map +1 -1
  132. package/lib/cjs/SchemaJsonLocater.js +7 -7
  133. package/lib/cjs/SchemaJsonLocater.js.map +1 -1
  134. package/lib/cjs/SchemaKey.d.ts +13 -7
  135. package/lib/cjs/SchemaKey.d.ts.map +1 -1
  136. package/lib/cjs/SchemaKey.js +22 -12
  137. package/lib/cjs/SchemaKey.js.map +1 -1
  138. package/lib/cjs/SchemaLoader.d.ts +5 -5
  139. package/lib/cjs/SchemaLoader.d.ts.map +1 -1
  140. package/lib/cjs/SchemaLoader.js +5 -4
  141. package/lib/cjs/SchemaLoader.js.map +1 -1
  142. package/lib/cjs/SchemaPartVisitorDelegate.d.ts +2 -2
  143. package/lib/cjs/SchemaPartVisitorDelegate.js +2 -1
  144. package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
  145. package/lib/cjs/UnitConversion/Graph.js +69 -65
  146. package/lib/cjs/UnitConversion/Graph.js.map +1 -1
  147. package/lib/cjs/UnitConversion/UnitConversion.d.ts +1 -1
  148. package/lib/cjs/UnitConversion/UnitConversion.d.ts.map +1 -1
  149. package/lib/cjs/UnitConversion/UnitConversion.js +9 -7
  150. package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
  151. package/lib/cjs/UnitConversion/UnitConverter.js +2 -0
  152. package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
  153. package/lib/cjs/UnitConversion/UnitTree.d.ts +2 -0
  154. package/lib/cjs/UnitConversion/UnitTree.d.ts.map +1 -1
  155. package/lib/cjs/UnitConversion/UnitTree.js +11 -1
  156. package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
  157. package/lib/cjs/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
  158. package/lib/cjs/UnitProvider/SchemaUnitProvider.js +8 -9
  159. package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
  160. package/lib/cjs/Validation/SchemaWalker.d.ts +1 -1
  161. package/lib/cjs/Validation/SchemaWalker.d.ts.map +1 -1
  162. package/lib/cjs/Validation/SchemaWalker.js +6 -4
  163. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  164. package/lib/cjs/ecschema-metadata.d.ts +1 -0
  165. package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
  166. package/lib/cjs/ecschema-metadata.js +1 -0
  167. package/lib/cjs/ecschema-metadata.js.map +1 -1
  168. package/lib/cjs/utils/SchemaGraph.js +5 -6
  169. package/lib/cjs/utils/SchemaGraph.js.map +1 -1
  170. package/lib/esm/Constants.d.ts +8 -0
  171. package/lib/esm/Constants.d.ts.map +1 -1
  172. package/lib/esm/Constants.js +29 -20
  173. package/lib/esm/Constants.js.map +1 -1
  174. package/lib/esm/Context.d.ts +85 -36
  175. package/lib/esm/Context.d.ts.map +1 -1
  176. package/lib/esm/Context.js +78 -28
  177. package/lib/esm/Context.js.map +1 -1
  178. package/lib/esm/DelayedPromise.d.ts +9 -8
  179. package/lib/esm/DelayedPromise.d.ts.map +1 -1
  180. package/lib/esm/DelayedPromise.js +8 -6
  181. package/lib/esm/DelayedPromise.js.map +1 -1
  182. package/lib/esm/Deserialization/AbstractParser.js +1 -0
  183. package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
  184. package/lib/esm/Deserialization/Helper.d.ts +3 -3
  185. package/lib/esm/Deserialization/Helper.d.ts.map +1 -1
  186. package/lib/esm/Deserialization/Helper.js +36 -27
  187. package/lib/esm/Deserialization/Helper.js.map +1 -1
  188. package/lib/esm/Deserialization/JsonParser.js +154 -151
  189. package/lib/esm/Deserialization/JsonParser.js.map +1 -1
  190. package/lib/esm/Deserialization/JsonProps.d.ts +47 -33
  191. package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
  192. package/lib/esm/Deserialization/JsonProps.js +3 -3
  193. package/lib/esm/Deserialization/JsonProps.js.map +1 -1
  194. package/lib/esm/Deserialization/XmlParser.d.ts.map +1 -1
  195. package/lib/esm/Deserialization/XmlParser.js +61 -53
  196. package/lib/esm/Deserialization/XmlParser.js.map +1 -1
  197. package/lib/esm/Deserialization/XmlSerializationUtils.d.ts +0 -5
  198. package/lib/esm/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
  199. package/lib/esm/Deserialization/XmlSerializationUtils.js +9 -18
  200. package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
  201. package/lib/esm/ECName.d.ts +2 -2
  202. package/lib/esm/ECName.js +6 -5
  203. package/lib/esm/ECName.js.map +1 -1
  204. package/lib/esm/ECObjects.d.ts +41 -9
  205. package/lib/esm/ECObjects.d.ts.map +1 -1
  206. package/lib/esm/ECObjects.js +77 -24
  207. package/lib/esm/ECObjects.js.map +1 -1
  208. package/lib/esm/Exception.d.ts +4 -4
  209. package/lib/esm/Exception.d.ts.map +1 -1
  210. package/lib/esm/Exception.js +59 -58
  211. package/lib/esm/Exception.js.map +1 -1
  212. package/lib/esm/Interfaces.d.ts +35 -32
  213. package/lib/esm/Interfaces.d.ts.map +1 -1
  214. package/lib/esm/Interfaces.js.map +1 -1
  215. package/lib/esm/Metadata/Class.d.ts +179 -32
  216. package/lib/esm/Metadata/Class.d.ts.map +1 -1
  217. package/lib/esm/Metadata/Class.js +292 -90
  218. package/lib/esm/Metadata/Class.js.map +1 -1
  219. package/lib/esm/Metadata/Constant.d.ts +26 -10
  220. package/lib/esm/Metadata/Constant.d.ts.map +1 -1
  221. package/lib/esm/Metadata/Constant.js +39 -11
  222. package/lib/esm/Metadata/Constant.js.map +1 -1
  223. package/lib/esm/Metadata/CustomAttribute.d.ts +2 -2
  224. package/lib/esm/Metadata/CustomAttribute.d.ts.map +1 -1
  225. package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
  226. package/lib/esm/Metadata/CustomAttributeClass.d.ts +21 -7
  227. package/lib/esm/Metadata/CustomAttributeClass.d.ts.map +1 -1
  228. package/lib/esm/Metadata/CustomAttributeClass.js +29 -9
  229. package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
  230. package/lib/esm/Metadata/EntityClass.d.ts +40 -11
  231. package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
  232. package/lib/esm/Metadata/EntityClass.js +73 -35
  233. package/lib/esm/Metadata/EntityClass.js.map +1 -1
  234. package/lib/esm/Metadata/Enumeration.d.ts +30 -10
  235. package/lib/esm/Metadata/Enumeration.d.ts.map +1 -1
  236. package/lib/esm/Metadata/Enumeration.js +42 -14
  237. package/lib/esm/Metadata/Enumeration.js.map +1 -1
  238. package/lib/esm/Metadata/Format.d.ts +65 -17
  239. package/lib/esm/Metadata/Format.d.ts.map +1 -1
  240. package/lib/esm/Metadata/Format.js +108 -23
  241. package/lib/esm/Metadata/Format.js.map +1 -1
  242. package/lib/esm/Metadata/InvertedUnit.d.ts +19 -10
  243. package/lib/esm/Metadata/InvertedUnit.d.ts.map +1 -1
  244. package/lib/esm/Metadata/InvertedUnit.js +33 -16
  245. package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
  246. package/lib/esm/Metadata/KindOfQuantity.d.ts +38 -18
  247. package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
  248. package/lib/esm/Metadata/KindOfQuantity.js +91 -41
  249. package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
  250. package/lib/esm/Metadata/Mixin.d.ts +31 -4
  251. package/lib/esm/Metadata/Mixin.d.ts.map +1 -1
  252. package/lib/esm/Metadata/Mixin.js +44 -10
  253. package/lib/esm/Metadata/Mixin.js.map +1 -1
  254. package/lib/esm/Metadata/OverrideFormat.d.ts +12 -12
  255. package/lib/esm/Metadata/OverrideFormat.d.ts.map +1 -1
  256. package/lib/esm/Metadata/OverrideFormat.js +37 -20
  257. package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
  258. package/lib/esm/Metadata/Phenomenon.d.ts +24 -3
  259. package/lib/esm/Metadata/Phenomenon.d.ts.map +1 -1
  260. package/lib/esm/Metadata/Phenomenon.js +33 -4
  261. package/lib/esm/Metadata/Phenomenon.js.map +1 -1
  262. package/lib/esm/Metadata/Property.d.ts +47 -25
  263. package/lib/esm/Metadata/Property.d.ts.map +1 -1
  264. package/lib/esm/Metadata/Property.js +130 -51
  265. package/lib/esm/Metadata/Property.js.map +1 -1
  266. package/lib/esm/Metadata/PropertyCategory.d.ts +20 -4
  267. package/lib/esm/Metadata/PropertyCategory.d.ts.map +1 -1
  268. package/lib/esm/Metadata/PropertyCategory.js +31 -4
  269. package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
  270. package/lib/esm/Metadata/RelationshipClass.d.ts +63 -27
  271. package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -1
  272. package/lib/esm/Metadata/RelationshipClass.js +102 -45
  273. package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
  274. package/lib/esm/Metadata/Schema.d.ts +167 -41
  275. package/lib/esm/Metadata/Schema.d.ts.map +1 -1
  276. package/lib/esm/Metadata/Schema.js +212 -112
  277. package/lib/esm/Metadata/Schema.js.map +1 -1
  278. package/lib/esm/Metadata/SchemaItem.d.ts +19 -19
  279. package/lib/esm/Metadata/SchemaItem.d.ts.map +1 -1
  280. package/lib/esm/Metadata/SchemaItem.js +25 -23
  281. package/lib/esm/Metadata/SchemaItem.js.map +1 -1
  282. package/lib/esm/Metadata/Unit.d.ts +24 -21
  283. package/lib/esm/Metadata/Unit.d.ts.map +1 -1
  284. package/lib/esm/Metadata/Unit.js +41 -25
  285. package/lib/esm/Metadata/Unit.js.map +1 -1
  286. package/lib/esm/Metadata/UnitSystem.d.ts +17 -4
  287. package/lib/esm/Metadata/UnitSystem.d.ts.map +1 -1
  288. package/lib/esm/Metadata/UnitSystem.js +24 -4
  289. package/lib/esm/Metadata/UnitSystem.js.map +1 -1
  290. package/lib/esm/PropertyTypes.d.ts +11 -11
  291. package/lib/esm/PropertyTypes.d.ts.map +1 -1
  292. package/lib/esm/PropertyTypes.js +29 -21
  293. package/lib/esm/PropertyTypes.js.map +1 -1
  294. package/lib/esm/SchemaFormatsProvider.d.ts +39 -0
  295. package/lib/esm/SchemaFormatsProvider.d.ts.map +1 -0
  296. package/lib/esm/SchemaFormatsProvider.js +142 -0
  297. package/lib/esm/SchemaFormatsProvider.js.map +1 -0
  298. package/lib/esm/SchemaJsonLocater.d.ts +8 -8
  299. package/lib/esm/SchemaJsonLocater.d.ts.map +1 -1
  300. package/lib/esm/SchemaJsonLocater.js +7 -7
  301. package/lib/esm/SchemaJsonLocater.js.map +1 -1
  302. package/lib/esm/SchemaKey.d.ts +13 -7
  303. package/lib/esm/SchemaKey.d.ts.map +1 -1
  304. package/lib/esm/SchemaKey.js +23 -13
  305. package/lib/esm/SchemaKey.js.map +1 -1
  306. package/lib/esm/SchemaLoader.d.ts +5 -5
  307. package/lib/esm/SchemaLoader.d.ts.map +1 -1
  308. package/lib/esm/SchemaLoader.js +6 -5
  309. package/lib/esm/SchemaLoader.js.map +1 -1
  310. package/lib/esm/SchemaPartVisitorDelegate.d.ts +2 -2
  311. package/lib/esm/SchemaPartVisitorDelegate.js +2 -1
  312. package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
  313. package/lib/esm/UnitConversion/Graph.js +69 -65
  314. package/lib/esm/UnitConversion/Graph.js.map +1 -1
  315. package/lib/esm/UnitConversion/UnitConversion.d.ts +1 -1
  316. package/lib/esm/UnitConversion/UnitConversion.d.ts.map +1 -1
  317. package/lib/esm/UnitConversion/UnitConversion.js +9 -7
  318. package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
  319. package/lib/esm/UnitConversion/UnitConverter.js +2 -0
  320. package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
  321. package/lib/esm/UnitConversion/UnitTree.d.ts +2 -0
  322. package/lib/esm/UnitConversion/UnitTree.d.ts.map +1 -1
  323. package/lib/esm/UnitConversion/UnitTree.js +11 -1
  324. package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
  325. package/lib/esm/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
  326. package/lib/esm/UnitProvider/SchemaUnitProvider.js +8 -9
  327. package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
  328. package/lib/esm/Validation/SchemaWalker.d.ts +1 -1
  329. package/lib/esm/Validation/SchemaWalker.d.ts.map +1 -1
  330. package/lib/esm/Validation/SchemaWalker.js +6 -4
  331. package/lib/esm/Validation/SchemaWalker.js.map +1 -1
  332. package/lib/esm/ecschema-metadata.d.ts +1 -0
  333. package/lib/esm/ecschema-metadata.d.ts.map +1 -1
  334. package/lib/esm/ecschema-metadata.js +1 -0
  335. package/lib/esm/ecschema-metadata.js.map +1 -1
  336. package/lib/esm/utils/SchemaGraph.js +6 -7
  337. package/lib/esm/utils/SchemaGraph.js.map +1 -1
  338. package/package.json +16 -14
@@ -3,7 +3,7 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import { PrimitiveType, primitiveTypeToString } from "../ECObjects";
6
- import { ECObjectsError, ECObjectsStatus } from "../Exception";
6
+ import { ECSchemaError, ECSchemaStatus } from "../Exception";
7
7
  /**
8
8
  * Namespace holding utility functions for serializing EC types to the EC XML format.
9
9
  * @internal
@@ -16,19 +16,16 @@ export var XmlSerializationUtils;
16
16
  * @param customAttribute The CustomAttribute instance to serialize.
17
17
  * @param schemaDoc The Xml Document object holding the serialized EC Schema.
18
18
  * @param schema The Schema object being serialized.
19
- * @beta
20
19
  */
21
20
  async function writeCustomAttribute(fullName, customAttribute, schemaDoc, schema) {
22
21
  const caClass = await schema.lookupItem(fullName);
23
22
  if (!caClass)
24
- throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `The class '${fullName}' could not be found in the current schema context.`);
23
+ throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `The class '${fullName}' could not be found in the current schema context.`);
25
24
  const nameAndNamespace = await resolveCustomAttributeNamespace(fullName, schema);
26
25
  const caElement = schemaDoc.createElement(nameAndNamespace[0]);
27
26
  if (nameAndNamespace[1])
28
27
  caElement.setAttribute("xmlns", nameAndNamespace[1]);
29
- if (!caClass.properties)
30
- return caElement;
31
- for (const property of caClass.properties)
28
+ for (const property of await caClass.getProperties())
32
29
  await writeInstanceProperty(property, customAttribute, caElement, schemaDoc);
33
30
  return caElement;
34
31
  }
@@ -39,7 +36,6 @@ export var XmlSerializationUtils;
39
36
  * @param instance The Property instance.
40
37
  * @param instanceElement The XML Element that will contain the serialized property instance.
41
38
  * @param schemaDoc The Xml Document object holding the serialized EC Schema.
42
- * @beta
43
39
  */
44
40
  async function writeInstanceProperty(propertyClass, instance, instanceElement, schemaDoc) {
45
41
  const propertyValue = instance[propertyClass.name];
@@ -64,7 +60,6 @@ export var XmlSerializationUtils;
64
60
  * @param propertyValue An array holding the property values.
65
61
  * @param arrayElement The XML Element that will contain the serialized property instance.
66
62
  * @param schemaDoc The Xml Document object holding the serialized EC Schema.
67
- * @beta
68
63
  */
69
64
  async function writeArrayProperty(propertyClass, propertyValue, arrayElement, schemaDoc) {
70
65
  if (propertyClass.isPrimitive()) {
@@ -90,13 +85,10 @@ export var XmlSerializationUtils;
90
85
  * @param propertyValue The struct object holding the property values.
91
86
  * @param structElement The XML Element that will contain the serialized property instance.
92
87
  * @param schemaDoc The Xml Document object holding the serialized EC Schema.
93
- * @beta
94
88
  */
95
89
  async function writeStructProperty(propertyClass, propertyValue, structElement, schemaDoc) {
96
90
  const structClass = propertyClass.structClass;
97
- if (!structClass.properties)
98
- return;
99
- for (const propertyMetadata of structClass.properties)
91
+ for (const propertyMetadata of structClass.getPropertiesSync(true))
100
92
  await writeInstanceProperty(propertyMetadata, propertyValue, structElement, schemaDoc);
101
93
  }
102
94
  XmlSerializationUtils.writeStructProperty = writeStructProperty;
@@ -105,16 +97,15 @@ export var XmlSerializationUtils;
105
97
  * @param propertyClass The Property metadata object.
106
98
  * @param propertyValue The struct object holding the property values.
107
99
  * @param propertyElement The XML Element that will contain the serialized property instance.
108
- * @beta
109
100
  */
110
101
  async function writePrimitiveProperty(propertyClass, propertyValue, propertyElement) {
111
102
  let primitiveType;
112
103
  if (propertyClass.isEnumeration()) {
113
104
  const enumeration = await propertyClass.enumeration;
114
105
  if (!enumeration)
115
- throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `The enumeration on property class '${propertyClass.fullName}' could not be found in the current schema context.`);
106
+ throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `The enumeration on property class '${propertyClass.fullName}' could not be found in the current schema context.`);
116
107
  if (enumeration.type === undefined)
117
- throw new ECObjectsError(ECObjectsStatus.InvalidType, `The enumeration on property class '${propertyClass.fullName}' has an invalid primitive type.`);
108
+ throw new ECSchemaError(ECSchemaStatus.InvalidType, `The enumeration on property class '${propertyClass.fullName}' has an invalid primitive type.`);
118
109
  primitiveType = enumeration.type;
119
110
  }
120
111
  else
@@ -145,7 +136,7 @@ export var XmlSerializationUtils;
145
136
  propertyElement.textContent = propertyValue;
146
137
  return;
147
138
  default:
148
- throw new ECObjectsError(ECObjectsStatus.InvalidPrimitiveType, `The property '${propertyClass.fullName}' has an invalid primitive type.`);
139
+ throw new ECSchemaError(ECSchemaStatus.InvalidPrimitiveType, `The property '${propertyClass.fullName}' has an invalid primitive type.`);
149
140
  }
150
141
  }
151
142
  XmlSerializationUtils.writePrimitiveProperty = writePrimitiveProperty;
@@ -155,7 +146,7 @@ export var XmlSerializationUtils;
155
146
  // Alias is required in Spec. It could be undefined (technically), so
156
147
  // throw until fixed.
157
148
  if (typeSchema.alias === undefined)
158
- throw new ECObjectsError(ECObjectsStatus.InvalidSchemaAlias, `The schema '${typeSchema.name}' has an invalid alias.`);
149
+ throw new ECSchemaError(ECSchemaStatus.InvalidSchemaAlias, `The schema '${typeSchema.name}' has an invalid alias.`);
159
150
  return `${typeSchema.alias}:${typeName}`;
160
151
  }
161
152
  XmlSerializationUtils.createXmlTypedName = createXmlTypedName;
@@ -165,7 +156,7 @@ export var XmlSerializationUtils;
165
156
  return [caName, undefined];
166
157
  const attributeSchema = nameParts[0].toUpperCase() === schema.name.toUpperCase() ? schema : await schema.getReference(nameParts[0]);
167
158
  if (!attributeSchema)
168
- throw new ECObjectsError(ECObjectsStatus.UnableToLocateSchema, `Unable to resolve the namespace for CustomAttribute '${caName}' because the referenced schema '${nameParts[0]}' could not be located.`);
159
+ throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Unable to resolve the namespace for CustomAttribute '${caName}' because the referenced schema '${nameParts[0]}' could not be located.`);
169
160
  return [nameParts[1], `${nameParts[0]}.${attributeSchema.schemaKey.version.toString()}`];
170
161
  }
171
162
  })(XmlSerializationUtils || (XmlSerializationUtils = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"XmlSerializationUtils.js","sourceRoot":"","sources":["../../../src/Deserialization/XmlSerializationUtils.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAM/D;;;GAGG;AACH,MAAM,KAAW,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,cAAc,CAAC,eAAe,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,g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AAM,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACpI,IAAI,CAAC,eAAe;YAClB,MAAM,IAAI,cAAc,CAAC,eAAe,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,KAArB,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,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAM7D;;;GAGG;AACH,MAAM,KAAW,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,aAAa,CAAC,cAAc,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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AAC,EAjKgB,qBAAqB,KAArB,qBAAqB,QAiKrC","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 { ECSchemaError, ECSchemaStatus } 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 */\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 ECSchemaError(ECSchemaStatus.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 for (const property of await caClass.getProperties())\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 */\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 */\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 */\r\n export async function writeStructProperty(propertyClass: StructProperty, propertyValue: any, structElement: Element, schemaDoc: Document): Promise<void> {\r\n const structClass = propertyClass.structClass;\r\n for (const propertyMetadata of structClass.getPropertiesSync(true))\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 */\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 ECSchemaError(ECSchemaStatus.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 ECSchemaError(ECSchemaStatus.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 ECSchemaError(ECSchemaStatus.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 ECSchemaError(ECSchemaStatus.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 ECSchemaError(ECSchemaStatus.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"]}
@@ -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/esm/ECName.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * @module Metadata
7
7
  */
8
8
  import { assert } from "@itwin/core-bentley";
9
- import { ECObjectsError, ECObjectsStatus } from "./Exception";
9
+ import { ECSchemaError, ECSchemaStatus } from "./Exception";
10
10
  const validECNameRegex = /^([a-zA-Z_]+[a-zA-Z0-9_]*)$/i;
11
11
  const ecNameReplacerRegex = /__x([0-9a-fA-F]{4})__/g;
12
12
  const leadingDigits = ["0000", "000", "00", "0", ""];
@@ -29,12 +29,13 @@ function isValidAlphaNumericCharacter(c) {
29
29
  * @public
30
30
  */
31
31
  export class ECName {
32
+ _name;
32
33
  /** Construct a new ECName from a valid EC name.
33
- * throws ECObjectsError if `name` does not meet the criteria for a valid EC name.
34
+ * throws ECSchemaError if `name` does not meet the criteria for a valid EC name.
34
35
  */
35
36
  constructor(name) {
36
37
  if (!ECName.validate(name))
37
- throw new ECObjectsError(ECObjectsStatus.InvalidECName);
38
+ throw new ECSchemaError(ECSchemaStatus.InvalidECName);
38
39
  this._name = name;
39
40
  }
40
41
  /** Returns true if a string meets the criteria of a valid EC name. */
@@ -46,11 +47,11 @@ export class ECName {
46
47
  return this._name;
47
48
  }
48
49
  /** Create an ECName from an arbitrary string, encoding any special characters as "__x####__" where "####" is the UTF-16 character code.
49
- * @throws ECObjectsError if `input` is an empty string.
50
+ * @throws ECSchemaError if `input` is an empty string.
50
51
  */
51
52
  static encode(input) {
52
53
  if (0 === input.length)
53
- throw new ECObjectsError(ECObjectsStatus.InvalidECName);
54
+ throw new ECSchemaError(ECSchemaStatus.InvalidECName);
54
55
  if (ECName.validate(input)) {
55
56
  // It's already a valid EC name.
56
57
  return new ECName(input);
@@ -1 +1 @@
1
- {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AAI,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","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;;;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C,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","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 { ECSchemaError, ECSchemaStatus } 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 ECSchemaError 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 ECSchemaError(ECSchemaStatus.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 ECSchemaError 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 ECSchemaError(ECSchemaStatus.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"]}
@@ -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,MAAM,iBAAiB,CAAC;AAO/C,YAAY;AACZ,oBAAY,eAAe;IACzB,IAAI,IAAA;IACJ,QAAQ,IAAA;IACR,MAAM,IAAA;CACP;AAED;;WAEW;AACX,oBAAY,cAAc;IACxB,WAAW,gBAAgB;IAC3B,KAAK,UAAU;IACf,WAAW,gBAAgB;IAC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BAAgB,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,27 +1,37 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  /** @packageDocumentation
6
6
  * @module Metadata
7
7
  */
8
8
  import { ECStringConstants } from "./Constants";
9
- import { ECObjectsError, ECObjectsStatus } from "./Exception";
9
+ import { ECSchemaError, ECSchemaStatus } from "./Exception";
10
10
  export { PropertyType } from "./PropertyTypes";
11
11
  // NEEDSWORK: This shim is currently required to use async iterators. See https://github.com/Microsoft/TypeScript/issues/14151
12
12
  if (!Symbol.asyncIterator) {
13
13
  Symbol.asyncIterator = Symbol.for("Symbol.asyncIterator");
14
14
  }
15
- /** @beta */
15
+ /**
16
+ * Identifies a class as abstract or sealed
17
+ *
18
+ * @public @preview
19
+ */
16
20
  export var ECClassModifier;
17
21
  (function (ECClassModifier) {
22
+ /* normal, instantiable class, can be subclassed */
18
23
  ECClassModifier[ECClassModifier["None"] = 0] = "None";
24
+ /* abstract class, cannot be instantiated, can be subclassed */
19
25
  ECClassModifier[ECClassModifier["Abstract"] = 1] = "Abstract";
26
+ /* sealed class, instantiable class, cannot be subclassed */
20
27
  ECClassModifier[ECClassModifier["Sealed"] = 2] = "Sealed";
21
28
  })(ECClassModifier || (ECClassModifier = {}));
22
29
  /**
23
30
  * An enumeration that has all the schema item type names as values
24
- * @beta */
31
+ *
32
+ * @enum {string}
33
+ * @public @preview
34
+ */
25
35
  export var SchemaItemType;
26
36
  (function (SchemaItemType) {
27
37
  SchemaItemType["EntityClass"] = "EntityClass";
@@ -39,9 +49,20 @@ export var SchemaItemType;
39
49
  SchemaItemType["UnitSystem"] = "UnitSystem";
40
50
  SchemaItemType["Format"] = "Format";
41
51
  })(SchemaItemType || (SchemaItemType = {}));
52
+ /**
53
+ * Additional Schema Item Types which define classes of item types
54
+ * @public @preview
55
+ */
56
+ export var AbstractSchemaItemType;
57
+ (function (AbstractSchemaItemType) {
58
+ /* Item is EntityClass, Mixin, StructClass, CustomAttributeClass, or RelationshipClass */
59
+ AbstractSchemaItemType["Class"] = "Class";
60
+ /* Any item type including the Class types */
61
+ AbstractSchemaItemType["SchemaItem"] = "SchemaItem";
62
+ })(AbstractSchemaItemType || (AbstractSchemaItemType = {}));
42
63
  /**
43
64
  * Primitive data types for ECProperties.
44
- * @beta
65
+ * @public @preview
45
66
  */
46
67
  export var PrimitiveType;
47
68
  (function (PrimitiveType) {
@@ -59,7 +80,7 @@ export var PrimitiveType;
59
80
  })(PrimitiveType || (PrimitiveType = {}));
60
81
  /**
61
82
  * Defines the valid CustomAttribute container types.
62
- * @beta
83
+ * @public @preview
63
84
  */
64
85
  export var CustomAttributeContainerType;
65
86
  (function (CustomAttributeContainerType) {
@@ -82,14 +103,14 @@ export var CustomAttributeContainerType;
82
103
  })(CustomAttributeContainerType || (CustomAttributeContainerType = {}));
83
104
  /**
84
105
  * Defines what sort of match should be used when locating a schema.
85
- * @beta
106
+ * @public @preview
86
107
  */
87
108
  export var SchemaMatchType;
88
109
  (function (SchemaMatchType) {
89
110
  /*
90
- * Find exact VersionRead, VersionWrite, VersionMinor match as well as Data. NOTE data is not yet matched
91
- * @deprecated in 4.10 Use Exact instead.
92
- */
111
+ * Find exact VersionRead, VersionWrite, VersionMinor match as well as Data. NOTE data is not yet matched
112
+ * @deprecated in 4.10 Use Exact instead.
113
+ */
93
114
  SchemaMatchType[SchemaMatchType["Identical"] = 0] = "Identical";
94
115
  /* Find exact VersionRead, VersionWrite, VersionMinor match. */
95
116
  SchemaMatchType[SchemaMatchType["Exact"] = 1] = "Exact";
@@ -102,24 +123,32 @@ export var SchemaMatchType;
102
123
  })(SchemaMatchType || (SchemaMatchType = {}));
103
124
  /**
104
125
  * Identifer for an ECRelationshipConstraint. Used to determine the side of the relationship the constraint is representing.
105
- * @beta
126
+ * @public @preview
106
127
  */
107
128
  export var RelationshipEnd;
108
129
  (function (RelationshipEnd) {
109
130
  RelationshipEnd[RelationshipEnd["Source"] = 0] = "Source";
110
131
  RelationshipEnd[RelationshipEnd["Target"] = 1] = "Target";
111
132
  })(RelationshipEnd || (RelationshipEnd = {}));
112
- /** @beta */
133
+ /**
134
+ * Defines the how the lifetime of the source and target are related.
135
+ *
136
+ * @public @preview */
113
137
  export var StrengthType;
114
138
  (function (StrengthType) {
115
139
  StrengthType[StrengthType["Referencing"] = 0] = "Referencing";
116
140
  StrengthType[StrengthType["Holding"] = 1] = "Holding";
117
141
  StrengthType[StrengthType["Embedding"] = 2] = "Embedding";
118
142
  })(StrengthType || (StrengthType = {}));
119
- /** @beta */
143
+ /**
144
+ * Defines the which side of the relationship is the starting point of the relationship. This impacts how relationship strength is applied.
145
+ *
146
+ * @public @preview */
120
147
  export var StrengthDirection;
121
148
  (function (StrengthDirection) {
149
+ /** The source is the starting point of the relationship. */
122
150
  StrengthDirection[StrengthDirection["Forward"] = 1] = "Forward";
151
+ /** The target is the starting point of the relationship. */
123
152
  StrengthDirection[StrengthDirection["Backward"] = 2] = "Backward";
124
153
  })(StrengthDirection || (StrengthDirection = {}));
125
154
  // Helper methods for going to/from string for the above Enumerations.
@@ -146,7 +175,8 @@ export function classModifierToString(modifier) {
146
175
  case ECClassModifier.Abstract: return "Abstract";
147
176
  case ECClassModifier.None: return "None";
148
177
  case ECClassModifier.Sealed: return "Sealed";
149
- default: throw new ECObjectsError(ECObjectsStatus.InvalidModifier, "An invalid ECClassModifier has been provided.");
178
+ default:
179
+ throw new ECSchemaError(ECSchemaStatus.InvalidModifier, "An invalid ECClassModifier has been provided.");
150
180
  }
151
181
  }
152
182
  /**
@@ -201,7 +231,8 @@ export function schemaItemTypeToXmlString(value) {
201
231
  case SchemaItemType.Phenomenon: return "Phenomenon";
202
232
  case SchemaItemType.UnitSystem: return "UnitSystem";
203
233
  case SchemaItemType.Format: return "Format";
204
- default: throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, "An invalid SchemaItemType has been provided.");
234
+ default:
235
+ throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, "An invalid SchemaItemType has been provided.");
205
236
  }
206
237
  }
207
238
  /**
@@ -239,7 +270,8 @@ export function primitiveTypeToString(type) {
239
270
  case PrimitiveType.Point2d: return "point2d";
240
271
  case PrimitiveType.Point3d: return "point3d";
241
272
  case PrimitiveType.String: return "string";
242
- default: throw new ECObjectsError(ECObjectsStatus.InvalidPrimitiveType, "An invalid PrimitiveType has been provided.");
273
+ default:
274
+ throw new ECSchemaError(ECSchemaStatus.InvalidPrimitiveType, "An invalid PrimitiveType has been provided.");
243
275
  }
244
276
  }
245
277
  /**
@@ -305,7 +337,7 @@ export function parseCustomAttributeContainerType(type) {
305
337
  containerType = containerType | CustomAttributeContainerType.Any;
306
338
  break;
307
339
  default:
308
- throw new ECObjectsError(ECObjectsStatus.InvalidContainerType, `${typeToken} is not a valid CustomAttributeContainerType value.`);
340
+ throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `${typeToken} is not a valid CustomAttributeContainerType value.`);
309
341
  }
310
342
  });
311
343
  return containerType;
@@ -318,7 +350,7 @@ export function parseCustomAttributeContainerType(type) {
318
350
  */
319
351
  export function containerTypeToString(type) {
320
352
  const testContainerTypeValue = (compareType, otherType) => {
321
- return (compareType === (compareType & otherType));
353
+ return compareType === (compareType & otherType);
322
354
  };
323
355
  if (testContainerTypeValue(CustomAttributeContainerType.Any, type))
324
356
  return ECStringConstants.CONTAINERTYPE_ANY;
@@ -380,12 +412,13 @@ export function relationshipEndToString(end) {
380
412
  switch (end) {
381
413
  case RelationshipEnd.Source: return ECStringConstants.RELATIONSHIP_END_SOURCE;
382
414
  case RelationshipEnd.Target: return ECStringConstants.RELATIONSHIP_END_TARGET;
383
- default: throw new ECObjectsError(ECObjectsStatus.InvalidRelationshipEnd, `An invalid RelationshipEnd has been provided.`);
415
+ default:
416
+ throw new ECSchemaError(ECSchemaStatus.InvalidRelationshipEnd, `An invalid RelationshipEnd has been provided.`);
384
417
  }
385
418
  }
386
419
  /**
387
420
  * Takes a string representing a StrengthType, will parse it and return the corresponding StrengthType.
388
- * @throws ECObjectsStatus.InvalidStrength if the provided string that is not valid
421
+ * @throws ECSchemaStatus.InvalidStrength if the provided string that is not valid
389
422
  * @param strength
390
423
  * @beta
391
424
  */
@@ -403,7 +436,8 @@ export function strengthToString(strength) {
403
436
  case StrengthType.Embedding: return "Embedding";
404
437
  case StrengthType.Holding: return "Holding";
405
438
  case StrengthType.Referencing: return "Referencing";
406
- default: throw new ECObjectsError(ECObjectsStatus.InvalidStrength, `An invalid Strength has been provided.`);
439
+ default:
440
+ throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `An invalid Strength has been provided.`);
407
441
  }
408
442
  }
409
443
  /** @beta */
@@ -419,7 +453,26 @@ export function strengthDirectionToString(direction) {
419
453
  switch (direction) {
420
454
  case StrengthDirection.Forward: return "Forward";
421
455
  case StrengthDirection.Backward: return "Backward";
422
- default: throw new ECObjectsError(ECObjectsStatus.InvalidStrengthDirection, `An invalid StrengthDirection has been provided.`);
456
+ default:
457
+ throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `An invalid StrengthDirection has been provided.`);
458
+ }
459
+ }
460
+ /** Compares a SchemaItemType against supported type.
461
+ * @beta
462
+ */
463
+ export function isSupportedSchemaItemType(value, supported) {
464
+ if (value === supported)
465
+ return true;
466
+ if (supported === AbstractSchemaItemType.Class && (value === SchemaItemType.EntityClass ||
467
+ value === SchemaItemType.Mixin ||
468
+ value === SchemaItemType.StructClass ||
469
+ value === SchemaItemType.CustomAttributeClass ||
470
+ value === SchemaItemType.RelationshipClass)) {
471
+ return true;
472
+ }
473
+ if (supported === AbstractSchemaItemType.SchemaItem) {
474
+ return true;
423
475
  }
476
+ return false;
424
477
  }
425
478
  //# sourceMappingURL=ECObjects.js.map