@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
@@ -9,19 +9,31 @@ import { DelayedPromiseWithProps } from "../DelayedPromise";
9
9
  import { SchemaReadHelper } from "../Deserialization/Helper";
10
10
  import { XmlSerializationUtils } from "../Deserialization/XmlSerializationUtils";
11
11
  import { parseStrength, parseStrengthDirection, RelationshipEnd, SchemaItemType, StrengthDirection, strengthDirectionToString, strengthToString, StrengthType, } from "../ECObjects";
12
- import { ECObjectsError, ECObjectsStatus } from "../Exception";
12
+ import { ECSchemaError, ECSchemaStatus } from "../Exception";
13
13
  import { ECClass } from "./Class";
14
14
  import { serializeCustomAttributes } from "./CustomAttribute";
15
- import { createNavigationProperty, createNavigationPropertySync } from "./EntityClass";
15
+ import { createNavigationProperty, createNavigationPropertySync, EntityClass } from "./EntityClass";
16
+ import { Mixin } from "./Mixin";
16
17
  import { SchemaItem } from "./SchemaItem";
17
18
  /**
18
19
  * A Typescript class representation of a ECRelationshipClass.
19
- * @beta
20
+ * @public @preview
20
21
  */
21
22
  export class RelationshipClass extends ECClass {
23
+ schemaItemType = RelationshipClass.schemaItemType;
24
+ /** @internal */
25
+ static get schemaItemType() { return SchemaItemType.RelationshipClass; }
26
+ /** @internal */
27
+ _strength;
28
+ /** @internal */
29
+ _strengthDirection;
30
+ /** @internal */
31
+ _source;
32
+ /** @internal */
33
+ _target;
34
+ /** @internal */
22
35
  constructor(schema, name, modifier) {
23
36
  super(schema, name, modifier);
24
- this.schemaItemType = SchemaItemType.RelationshipClass;
25
37
  this._strengthDirection = StrengthDirection.Forward;
26
38
  this._strength = StrengthType.Referencing;
27
39
  this._source = new RelationshipConstraint(this, RelationshipEnd.Source);
@@ -36,33 +48,35 @@ export class RelationshipClass extends ECClass {
36
48
  * @param name
37
49
  * @param relationship
38
50
  * @param direction
51
+ * @internal
39
52
  */
40
53
  async createNavigationProperty(name, relationship, direction) {
41
54
  return this.addProperty(await createNavigationProperty(this, name, relationship, direction));
42
55
  }
56
+ /** @internal */
43
57
  createNavigationPropertySync(name, relationship, direction) {
44
58
  return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));
45
59
  }
46
60
  /**
47
- * @alpha Used for schema editing.
61
+ * @internal Used for schema editing.
48
62
  */
49
63
  setStrength(strength) {
50
64
  this._strength = strength;
51
65
  }
52
66
  /**
53
- * @alpha Used for schema editing.
67
+ * @internal Used for schema editing.
54
68
  */
55
69
  setStrengthDirection(direction) {
56
70
  this._strengthDirection = direction;
57
71
  }
58
72
  /**
59
- * @alpha Used for schema editing.
73
+ * @internal Used for schema editing.
60
74
  */
61
75
  setSourceConstraint(source) {
62
76
  this._source = source;
63
77
  }
64
78
  /**
65
- * @alpha Used for schema editing.
79
+ * @internal Used for schema editing.
66
80
  */
67
81
  setTargetConstraint(target) {
68
82
  this._target = target;
@@ -96,23 +110,52 @@ export class RelationshipClass extends ECClass {
96
110
  if (SchemaReadHelper.isECSpecVersionNewer({ readVersion: relationshipClassProps.originalECSpecMajorVersion, writeVersion: relationshipClassProps.originalECSpecMinorVersion }))
97
111
  strength = StrengthType.Referencing;
98
112
  else
99
- throw new ECObjectsError(ECObjectsStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strength' attribute. '${relationshipClassProps.strength}' is not a valid StrengthType.`);
113
+ throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strength' attribute. '${relationshipClassProps.strength}' is not a valid StrengthType.`);
100
114
  }
101
115
  const strengthDirection = parseStrengthDirection(relationshipClassProps.strengthDirection);
102
116
  if (undefined === strengthDirection)
103
- throw new ECObjectsError(ECObjectsStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strengthDirection' attribute. '${relationshipClassProps.strengthDirection}' is not a valid StrengthDirection.`);
117
+ throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strengthDirection' attribute. '${relationshipClassProps.strengthDirection}' is not a valid StrengthDirection.`);
104
118
  this._strength = strength;
105
119
  this._strengthDirection = strengthDirection;
106
120
  }
107
121
  async fromJSON(relationshipClassProps) {
108
122
  this.fromJSONSync(relationshipClassProps);
109
123
  }
124
+ /**
125
+ * Type guard to check if the SchemaItem is of type RelationshipClass.
126
+ * @param item The SchemaItem to check.
127
+ * @returns True if the item is a RelationshipClass, false otherwise.
128
+ */
129
+ static isRelationshipClass(item) {
130
+ if (item && item.schemaItemType === SchemaItemType.RelationshipClass)
131
+ return true;
132
+ return false;
133
+ }
134
+ /**
135
+ * Type assertion to check if the SchemaItem is of type RelationshipClass.
136
+ * @param item The SchemaItem to check.
137
+ * @returns The item cast to RelationshipClass if it is a RelationshipClass, undefined otherwise.
138
+ * @internal
139
+ */
140
+ static assertIsRelationshipClass(item) {
141
+ if (!this.isRelationshipClass(item))
142
+ throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.RelationshipClass}' (RelationshipClass)`);
143
+ }
110
144
  }
111
145
  /**
112
146
  * A Typescript class representation of a ECRelationshipConstraint.
113
- * @beta
147
+ * @public @preview
114
148
  */
115
149
  export class RelationshipConstraint {
150
+ _abstractConstraint;
151
+ _relationshipClass;
152
+ _relationshipEnd;
153
+ _multiplicity;
154
+ _polymorphic;
155
+ _roleLabel;
156
+ _constraintClasses;
157
+ _customAttributes;
158
+ /** @internal */
116
159
  constructor(relClass, relEnd, roleLabel, polymorphic) {
117
160
  this._relationshipEnd = relEnd;
118
161
  if (polymorphic)
@@ -124,23 +167,11 @@ export class RelationshipConstraint {
124
167
  this._roleLabel = roleLabel;
125
168
  }
126
169
  get multiplicity() { return this._multiplicity ?? RelationshipMultiplicity.zeroOne; }
127
- set multiplicity(multiplicity) {
128
- this._multiplicity = multiplicity;
129
- }
130
170
  get polymorphic() { return this._polymorphic ?? false; }
131
- set polymorphic(polymorphic) {
132
- this._polymorphic = polymorphic;
133
- }
134
171
  get roleLabel() { return this._roleLabel; }
135
- set roleLabel(roleLabel) {
136
- this._roleLabel = roleLabel;
137
- }
138
172
  get constraintClasses() { return this._constraintClasses; }
139
173
  get relationshipClass() { return this._relationshipClass; }
140
174
  get relationshipEnd() { return this._relationshipEnd; }
141
- set relationshipEnd(relationshipEnd) {
142
- this._relationshipEnd = relationshipEnd;
143
- }
144
175
  get customAttributes() { return this._customAttributes; }
145
176
  /** Returns the constraint name, ie. 'RelationshipName.Source/Target' */
146
177
  get fullName() { return `${this._relationshipClass.name}:${this.isSource ? "Source" : "Target"}`; }
@@ -153,9 +184,6 @@ export class RelationshipConstraint {
153
184
  return this.constraintClasses[0];
154
185
  return this._abstractConstraint;
155
186
  }
156
- set abstractConstraint(abstractConstraint) {
157
- this._abstractConstraint = abstractConstraint;
158
- }
159
187
  /**
160
188
  * True if this RelationshipConstraint is the Source relationship end.
161
189
  */
@@ -163,18 +191,21 @@ export class RelationshipConstraint {
163
191
  /**
164
192
  * Adds the provided class as a constraint class to this constraint.
165
193
  * @param constraint The class to add as a constraint class.
166
- */
194
+ * @internal
195
+ */
167
196
  addClass(constraint) {
168
197
  // TODO: Ensure we don't start mixing constraint class types
169
198
  // TODO: Check that this class is or subclasses abstract constraint?
170
199
  if (!this._constraintClasses)
171
200
  this._constraintClasses = [];
172
201
  // TODO: Handle relationship constraints
173
- this._constraintClasses.push(new DelayedPromiseWithProps(constraint.key, async () => constraint));
202
+ this._constraintClasses.push(constraint);
174
203
  }
175
204
  /**
176
205
  * Removes the provided class as a constraint class from this constraint.
177
206
  * @param constraint The class to add as a constraint class.
207
+ *
208
+ * @internal
178
209
  */
179
210
  removeClass(constraint) {
180
211
  if (undefined === this._constraintClasses)
@@ -242,29 +273,31 @@ export class RelationshipConstraint {
242
273
  this._polymorphic = relationshipConstraintProps.polymorphic;
243
274
  const parsedMultiplicity = RelationshipMultiplicity.fromString(relationshipConstraintProps.multiplicity);
244
275
  if (!parsedMultiplicity)
245
- throw new ECObjectsError(ECObjectsStatus.InvalidMultiplicity, ``);
276
+ throw new ECSchemaError(ECSchemaStatus.InvalidMultiplicity, ``);
246
277
  this._multiplicity = parsedMultiplicity;
247
278
  const relClassSchema = this.relationshipClass.schema;
248
279
  if (undefined !== relationshipConstraintProps.abstractConstraint) {
249
280
  const abstractConstraintSchemaItemKey = relClassSchema.getSchemaItemKey(relationshipConstraintProps.abstractConstraint);
250
281
  if (!abstractConstraintSchemaItemKey)
251
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);
252
- this.abstractConstraint = new DelayedPromiseWithProps(abstractConstraintSchemaItemKey, async () => {
282
+ throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);
283
+ this.setAbstractConstraint(new DelayedPromiseWithProps(abstractConstraintSchemaItemKey, async () => {
253
284
  const tempAbstractConstraint = await relClassSchema.lookupItem(relationshipConstraintProps.abstractConstraint);
254
- if (undefined === tempAbstractConstraint)
255
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);
285
+ if (undefined === tempAbstractConstraint ||
286
+ (!EntityClass.isEntityClass(tempAbstractConstraint) && !Mixin.isMixin(tempAbstractConstraint) && !RelationshipClass.isRelationshipClass(tempAbstractConstraint)))
287
+ throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);
256
288
  return tempAbstractConstraint;
257
- });
289
+ }));
258
290
  }
259
291
  const loadEachConstraint = (constraintClassName) => {
260
292
  const tempConstraintClass = relClassSchema.lookupItemSync(constraintClassName);
261
- if (!tempConstraintClass)
262
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);
293
+ if (!tempConstraintClass ||
294
+ (!EntityClass.isEntityClass(tempConstraintClass) && !Mixin.isMixin(tempConstraintClass) && !RelationshipClass.isRelationshipClass(tempConstraintClass)))
295
+ throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);
263
296
  return tempConstraintClass;
264
297
  };
265
298
  for (const constraintClassName of relationshipConstraintProps.constraintClasses) {
266
299
  const constraintClass = loadEachConstraint(constraintClassName);
267
- this.addClass(constraintClass);
300
+ this.addClass(new DelayedPromiseWithProps(constraintClass.key, async () => constraintClass));
268
301
  }
269
302
  }
270
303
  async fromJSON(relationshipConstraintProps) {
@@ -322,15 +355,36 @@ export class RelationshipConstraint {
322
355
  * @internal
323
356
  */
324
357
  static isRelationshipConstraint(object) {
325
- const relationshipConstrait = object;
326
- return relationshipConstrait !== undefined && relationshipConstrait.polymorphic !== undefined && relationshipConstrait.multiplicity !== undefined
327
- && relationshipConstrait.relationshipEnd !== undefined && relationshipConstrait._relationshipClass !== undefined;
358
+ const relationshipConstraint = object;
359
+ return relationshipConstraint !== undefined && relationshipConstraint.polymorphic !== undefined && relationshipConstraint.multiplicity !== undefined
360
+ && relationshipConstraint.relationshipEnd !== undefined && relationshipConstraint._relationshipClass !== undefined;
328
361
  }
362
+ /** @internal */
329
363
  addCustomAttribute(customAttribute) {
330
364
  if (!this._customAttributes)
331
365
  this._customAttributes = new Map();
332
366
  this._customAttributes.set(customAttribute.className, customAttribute);
333
367
  }
368
+ /** @internal */
369
+ setRoleLabel(roleLabel) {
370
+ this._roleLabel = roleLabel;
371
+ }
372
+ /** @internal */
373
+ setRelationshipEnd(relationshipEnd) {
374
+ this._relationshipEnd = relationshipEnd;
375
+ }
376
+ /** @internal */
377
+ setPolymorphic(polymorphic) {
378
+ this._polymorphic = polymorphic;
379
+ }
380
+ /** @internal */
381
+ setMultiplicity(multiplicity) {
382
+ this._multiplicity = multiplicity;
383
+ }
384
+ /** @internal */
385
+ setAbstractConstraint(abstractConstraint) {
386
+ this._abstractConstraint = abstractConstraint;
387
+ }
334
388
  }
335
389
  /**
336
390
  * Hackish approach that works like a "friend class" so we can access protected members without making them public.
@@ -340,9 +394,16 @@ export class MutableRelationshipConstraint extends RelationshipConstraint {
340
394
  }
341
395
  const INT32_MAX = 2147483647;
342
396
  /**
343
- * @beta
397
+ * @public @preview
344
398
  */
345
399
  export class RelationshipMultiplicity {
400
+ static zeroOne = new RelationshipMultiplicity(0, 1);
401
+ static zeroMany = new RelationshipMultiplicity(0, INT32_MAX);
402
+ static oneOne = new RelationshipMultiplicity(1, 1);
403
+ static oneMany = new RelationshipMultiplicity(1, INT32_MAX);
404
+ lowerLimit;
405
+ upperLimit;
406
+ /** @internal */
346
407
  constructor(lowerLimit, upperLimit) {
347
408
  this.lowerLimit = lowerLimit;
348
409
  this.upperLimit = upperLimit;
@@ -370,10 +431,6 @@ export class RelationshipMultiplicity {
370
431
  return `(${this.lowerLimit}..${this.upperLimit === INT32_MAX ? "*" : this.upperLimit})`;
371
432
  }
372
433
  }
373
- RelationshipMultiplicity.zeroOne = new RelationshipMultiplicity(0, 1);
374
- RelationshipMultiplicity.zeroMany = new RelationshipMultiplicity(0, INT32_MAX);
375
- RelationshipMultiplicity.oneOne = new RelationshipMultiplicity(1, 1);
376
- RelationshipMultiplicity.oneMany = new RelationshipMultiplicity(1, INT32_MAX);
377
434
  /**
378
435
  * @internal
379
436
  * An abstract class used for schema editing.
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipClass.js","sourceRoot":"","sources":["../../../src/Metadata/RelationshipClass.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAiB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EACY,aAAa,EAAE,sBAAsB,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,yBAAyB,EACrI,gBAAgB,EAAE,YAAY,GAC/B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAsE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAClI,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAe,MAAM,eAAe,CAAC;AAIpG,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,OAAO;IAQ5C,YAAY,MAAc,EAAE,IAAY,EAAE,QAA0B;QAClE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC,iBAAiB,CAAC;QACvD,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC,OAAO,CAAC;QACpD,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,WAAW,CAAC;QAC1C,IAAI,CAAC,OAAO,GAAG,IAAI,sBA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C;aACtC,IAAI,CAAC,KAAK,UAAU,IAAI,CAAC,KAAK,UAAU;YAC3C,OAAO,wBAAwB,CAAC,MAAM,CAAC;aACpC,IAAI,CAAC,KAAK,UAAU,IAAI,SAAS,KAAK,UAAU;YACnD,OAAO,wBAAwB,CAAC,OAAO,CAAC;QAE1C,OAAO,IAAI,wBAAwB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC9D,CAAC;IAEM,MAAM,CAAC,GAA6B;QACzC,OAAO,IAAI,CAAC,UAAU,KAAK,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,KAAK,GAAG,CAAC,UAAU,CAAC;IAClF,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC;IAC1F,CAAC;;AAtCsB,gCAAO,GAAG,IAAI,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC7C,iCAAQ,GAAG,IAAI,wBAAwB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;AACtD,+BAAM,GAAG,IAAI,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,gCAAO,GAAG,IAAI,wBAAwB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;AAsC9E;;;GAGG;AACH,MAAM,OAAgB,wBAAyB,SAAQ,iBAAiB;IACtE,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;IACtF,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;CAMvF","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 { DelayedPromiseWithProps } from \"../DelayedPromise\";\r\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\r\nimport { RelationshipClassProps, RelationshipConstraintProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport {\r\n ECClassModifier, parseStrength, parseStrengthDirection, RelationshipEnd, SchemaItemType, StrengthDirection, strengthDirectionToString,\r\n strengthToString, StrengthType,\r\n} from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { LazyLoadedRelationshipConstraintClass } from \"../Interfaces\";\r\nimport { SchemaItemKey } from \"../SchemaKey\";\r\nimport { ECClass } from \"./Class\";\r\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\r\nimport { createNavigationProperty, createNavigationPropertySync, EntityClass } from \"./EntityClass\";\r\nimport { Mixin } from \"./Mixin\";\r\nimport { NavigationProperty } from \"./Property\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\n\r\ntype AnyConstraintClass = EntityClass | Mixin | RelationshipClass;\r\n\r\n/**\r\n * A Typescript class representation of a ECRelationshipClass.\r\n * @beta\r\n */\r\nexport class RelationshipClass extends ECClass {\r\n public override readonly schema!: Schema;\r\n public override readonly schemaItemType!: SchemaItemType.RelationshipClass;\r\n protected _strength: StrengthType;\r\n protected _strengthDirection: StrengthDirection;\r\n protected _source: RelationshipConstraint;\r\n protected _target: RelationshipConstraint;\r\n\r\n constructor(schema: Schema, name: string, modifier?: ECClassModifier) {\r\n super(schema, name, modifier);\r\n this.schemaItemType = SchemaItemType.RelationshipClass;\r\n this._strengthDirection = StrengthDirection.Forward;\r\n this._strength = StrengthType.Referencing;\r\n this._source = new RelationshipConstraint(this, RelationshipEnd.Source);\r\n this._target = new RelationshipConstraint(this, RelationshipEnd.Target);\r\n }\r\n\r\n public get strength() { return this._strength; }\r\n public get strengthDirection() { return this._strengthDirection; }\r\n public get source() { return this._source; }\r\n public get target() { return this._target; }\r\n\r\n /**\r\n *\r\n * @param name\r\n * @param relationship\r\n * @param direction\r\n */\r\n protected async createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\r\n return this.addProperty(await createNavigationProperty(this, name, relationship, direction));\r\n }\r\n\r\n protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\r\n return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));\r\n }\r\n\r\n /**\r\n * @alpha Used for schema editing.\r\n */\r\n protected setStrength(strength: StrengthType) {\r\n this._strength = strength;\r\n }\r\n\r\n /**\r\n * @alpha Used for schema editing.\r\n */\r\n protected setStrengthDirection(direction: StrengthDirection) {\r\n this._strengthDirection = direction;\r\n }\r\n\r\n /**\r\n * @alpha Used for schema editing.\r\n */\r\n protected setSourceConstraint(source: RelationshipConstraint) {\r\n this._source = source;\r\n }\r\n\r\n /**\r\n * @alpha Used for schema editing.\r\n */\r\n protected setTargetConstraint(target: RelationshipConstraint) {\r\n this._target = target;\r\n }\r\n /**\r\n * Save this RelationshipClass's properties to an object for serializing to JSON.\r\n * @param standalone Serialization includes only this object (as opposed to the full schema).\r\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\r\n */\r\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): RelationshipClassProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n schemaJson.strength = strengthToString(this.strength);\r\n schemaJson.strengthDirection = strengthDirectionToString(this.strengthDirection);\r\n schemaJson.source = this.source.toJSON();\r\n schemaJson.target = this.target.toJSON();\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n itemElement.setAttribute(\"strength\", strengthToString(this.strength));\r\n itemElement.setAttribute(\"strengthDirection\", strengthDirectionToString(this.strengthDirection));\r\n itemElement.appendChild(await this.source.toXml(schemaXml));\r\n itemElement.appendChild(await this.target.toXml(schemaXml));\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(relationshipClassProps: RelationshipClassProps) {\r\n super.fromJSONSync(relationshipClassProps);\r\n\r\n let strength = parseStrength(relationshipClassProps.strength);\r\n if (undefined === strength) {\r\n if (SchemaReadHelper.isECSpecVersionNewer({readVersion: relationshipClassProps.originalECSpecMajorVersion, writeVersion: relationshipClassProps.originalECSpecMinorVersion} as ECSpecVersion))\r\n strength = StrengthType.Referencing;\r\n else\r\n throw new ECObjectsError(ECObjectsStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strength' attribute. '${relationshipClassProps.strength}' is not a valid StrengthType.`);\r\n }\r\n\r\n const strengthDirection = parseStrengthDirection(relationshipClassProps.strengthDirection);\r\n if (undefined === strengthDirection)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strengthDirection' attribute. '${relationshipClassProps.strengthDirection}' is not a valid StrengthDirection.`);\r\n\r\n this._strength = strength;\r\n this._strengthDirection = strengthDirection;\r\n }\r\n\r\n public override async fromJSON(relationshipClassProps: RelationshipClassProps) {\r\n this.fromJSONSync(relationshipClassProps);\r\n }\r\n}\r\n\r\n/**\r\n * A Typescript class representation of a ECRelationshipConstraint.\r\n * @beta\r\n */\r\nexport class RelationshipConstraint implements CustomAttributeContainerProps {\r\n protected _abstractConstraint?: LazyLoadedRelationshipConstraintClass;\r\n protected _relationshipClass: RelationshipClass;\r\n protected _relationshipEnd: RelationshipEnd;\r\n protected _multiplicity?: RelationshipMultiplicity;\r\n protected _polymorphic?: boolean;\r\n protected _roleLabel?: string;\r\n protected _constraintClasses?: LazyLoadedRelationshipConstraintClass[];\r\n private _customAttributes?: Map<string, CustomAttribute>;\r\n\r\n constructor(relClass: RelationshipClass, relEnd: RelationshipEnd, roleLabel?: string, polymorphic?: boolean) {\r\n this._relationshipEnd = relEnd;\r\n if (polymorphic)\r\n this._polymorphic = polymorphic;\r\n else\r\n this._polymorphic = false;\r\n\r\n this._multiplicity = RelationshipMultiplicity.zeroOne;\r\n this._relationshipClass = relClass;\r\n this._roleLabel = roleLabel;\r\n }\r\n\r\n public get multiplicity() { return this._multiplicity ?? RelationshipMultiplicity.zeroOne; }\r\n protected set multiplicity(multiplicity: RelationshipMultiplicity) {\r\n this._multiplicity = multiplicity;\r\n }\r\n\r\n public get polymorphic() { return this._polymorphic ?? false; }\r\n protected set polymorphic(polymorphic: boolean) {\r\n this._polymorphic = polymorphic;\r\n }\r\n\r\n public get roleLabel() { return this._roleLabel; }\r\n protected set roleLabel(roleLabel: string | undefined) {\r\n this._roleLabel = roleLabel;\r\n }\r\n\r\n public get constraintClasses(): LazyLoadedRelationshipConstraintClass[] | undefined { return this._constraintClasses; }\r\n\r\n public get relationshipClass() { return this._relationshipClass; }\r\n\r\n public get relationshipEnd() { return this._relationshipEnd; }\r\n protected set relationshipEnd(relationshipEnd: RelationshipEnd) {\r\n this._relationshipEnd = relationshipEnd;\r\n }\r\n\r\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\r\n\r\n /** Returns the constraint name, ie. 'RelationshipName.Source/Target' */\r\n public get fullName() { return `${this._relationshipClass.name}:${this.isSource ? \"Source\" : \"Target\"}`; }\r\n\r\n /** Returns the schema of the RelationshipClass. */\r\n public get schema(): Schema { return this._relationshipClass.schema; }\r\n\r\n public get abstractConstraint(): LazyLoadedRelationshipConstraintClass | undefined {\r\n if (this._abstractConstraint)\r\n return this._abstractConstraint;\r\n\r\n if (this.constraintClasses && this.constraintClasses.length === 1)\r\n return this.constraintClasses[0];\r\n\r\n return this._abstractConstraint;\r\n }\r\n\r\n public set abstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined) {\r\n this._abstractConstraint = abstractConstraint;\r\n }\r\n\r\n /**\r\n * True if this RelationshipConstraint is the Source relationship end.\r\n */\r\n public get isSource(): boolean { return this.relationshipEnd === RelationshipEnd.Source; }\r\n\r\n /**\r\n * Adds the provided class as a constraint class to this constraint.\r\n * @param constraint The class to add as a constraint class.\r\n */\r\n public addClass(constraint: EntityClass | Mixin | RelationshipClass): void {\r\n // TODO: Ensure we don't start mixing constraint class types\r\n // TODO: Check that this class is or subclasses abstract constraint?\r\n\r\n if (!this._constraintClasses)\r\n this._constraintClasses = [];\r\n\r\n // TODO: Handle relationship constraints\r\n this._constraintClasses.push(new DelayedPromiseWithProps(constraint.key, async () => constraint));\r\n }\r\n\r\n /**\r\n * Removes the provided class as a constraint class from this constraint.\r\n * @param constraint The class to add as a constraint class.\r\n */\r\n protected removeClass(constraint: EntityClass | Mixin | RelationshipClass): void {\r\n if (undefined === this._constraintClasses)\r\n return;\r\n\r\n this._constraintClasses.forEach( (item, index) => {\r\n const constraintName = item.fullName;\r\n if(constraintName === constraint.fullName)\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._constraintClasses?.splice(index,1);\r\n });\r\n }\r\n\r\n /**\r\n * Save this RelationshipConstraint's properties to an object for serializing to JSON.\r\n */\r\n public toJSON(): RelationshipConstraintProps {\r\n const schemaJson: { [value: string]: any } = {};\r\n schemaJson.multiplicity = this.multiplicity.toString();\r\n schemaJson.roleLabel = this.roleLabel;\r\n schemaJson.polymorphic = this.polymorphic;\r\n if (undefined !== this._abstractConstraint)\r\n schemaJson.abstractConstraint = this._abstractConstraint.fullName;\r\n if (undefined !== this.constraintClasses && this.constraintClasses.length > 0)\r\n schemaJson.constraintClasses = this.constraintClasses.map((constraintClass) => constraintClass.fullName);\r\n\r\n const customAttributes = serializeCustomAttributes(this.customAttributes);\r\n if (undefined !== customAttributes)\r\n schemaJson.customAttributes = customAttributes;\r\n return schemaJson as RelationshipConstraintProps;\r\n }\r\n\r\n /** @internal */\r\n public async toXml(schemaXml: Document): Promise<Element> {\r\n const elementName = this.isSource ? \"Source\" : \"Target\";\r\n const itemElement = schemaXml.createElement(elementName);\r\n if (undefined !== this.polymorphic)\r\n itemElement.setAttribute(\"polymorphic\", this.polymorphic.toString());\r\n if (undefined !== this.roleLabel)\r\n itemElement.setAttribute(\"roleLabel\", this.roleLabel);\r\n if (undefined !== this.multiplicity)\r\n itemElement.setAttribute(\"multiplicity\", this.multiplicity.toString());\r\n\r\n const abstractConstraint = await this.abstractConstraint;\r\n if (undefined !== abstractConstraint) {\r\n const abstractConstraintName = XmlSerializationUtils.createXmlTypedName(this.schema, abstractConstraint.schema, abstractConstraint.name);\r\n itemElement.setAttribute(\"abstractConstraint\", abstractConstraintName);\r\n }\r\n\r\n if (undefined !== this.constraintClasses) {\r\n for (const item of this.constraintClasses) {\r\n const constraintClass = await item;\r\n const classElement = schemaXml.createElement(\"Class\");\r\n const constraintClassName = XmlSerializationUtils.createXmlTypedName(this.schema, constraintClass.schema, constraintClass.name);\r\n classElement.setAttribute(\"class\", constraintClassName);\r\n itemElement.appendChild(classElement);\r\n }\r\n }\r\n\r\n if (this._customAttributes) {\r\n const caContainerElement = schemaXml.createElement(\"ECCustomAttributes\");\r\n for (const [name, attribute] of this._customAttributes) {\r\n const caElement = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this.schema);\r\n caContainerElement.appendChild(caElement);\r\n }\r\n itemElement.appendChild(caContainerElement);\r\n }\r\n\r\n return itemElement;\r\n }\r\n\r\n public fromJSONSync(relationshipConstraintProps: RelationshipConstraintProps) {\r\n\r\n this._roleLabel = relationshipConstraintProps.roleLabel;\r\n this._polymorphic = relationshipConstraintProps.polymorphic;\r\n\r\n const parsedMultiplicity = RelationshipMultiplicity.fromString(relationshipConstraintProps.multiplicity);\r\n if (!parsedMultiplicity)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidMultiplicity, ``);\r\n this._multiplicity = parsedMultiplicity;\r\n\r\n const relClassSchema = this.relationshipClass.schema;\r\n\r\n if (undefined !== relationshipConstraintProps.abstractConstraint) {\r\n const abstractConstraintSchemaItemKey = relClassSchema.getSchemaItemKey(relationshipConstraintProps.abstractConstraint);\r\n if (!abstractConstraintSchemaItemKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);\r\n this.abstractConstraint = new DelayedPromiseWithProps<SchemaItemKey, AnyConstraintClass>(abstractConstraintSchemaItemKey,\r\n async () => {\r\n const tempAbstractConstraint = await relClassSchema.lookupItem<AnyConstraintClass>(relationshipConstraintProps.abstractConstraint!);\r\n if (undefined === tempAbstractConstraint)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);\r\n\r\n return tempAbstractConstraint;\r\n });\r\n }\r\n\r\n const loadEachConstraint = (constraintClassName: any) => {\r\n const tempConstraintClass = relClassSchema.lookupItemSync<AnyConstraintClass>(constraintClassName);\r\n if (!tempConstraintClass)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\r\n return tempConstraintClass;\r\n };\r\n\r\n for (const constraintClassName of relationshipConstraintProps.constraintClasses) {\r\n const constraintClass = loadEachConstraint(constraintClassName);\r\n this.addClass(constraintClass);\r\n }\r\n }\r\n\r\n public async fromJSON(relationshipConstraintProps: RelationshipConstraintProps) {\r\n this.fromJSONSync(relationshipConstraintProps);\r\n }\r\n\r\n /**\r\n * Indicates if the provided [[ECClass]] is supported by this [[RelationshipConstraint]].\r\n * @param ecClass The class to check.\r\n */\r\n public async supportsClass(ecClass: ECClass): Promise<boolean> {\r\n if (!this.constraintClasses) {\r\n if (this.relationshipClass.baseClass) {\r\n const baseRelationship = await this.relationshipClass.baseClass as RelationshipClass;\r\n const baseConstraint = this.isSource ? baseRelationship.source : baseRelationship.target;\r\n return baseConstraint.supportsClass(ecClass);\r\n }\r\n return false;\r\n }\r\n\r\n if (ecClass.schemaItemType !== SchemaItemType.EntityClass && ecClass.schemaItemType !== SchemaItemType.RelationshipClass &&\r\n ecClass.schemaItemType !== SchemaItemType.Mixin) {\r\n return false;\r\n }\r\n\r\n const abstractConstraint = await this.abstractConstraint;\r\n\r\n if (abstractConstraint && await RelationshipConstraint.classCompatibleWithConstraint(abstractConstraint, ecClass, this.polymorphic || false))\r\n return true;\r\n\r\n for (const constraint of this.constraintClasses) {\r\n if (await RelationshipConstraint.classCompatibleWithConstraint(await constraint, ecClass, this.polymorphic || false))\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Indicates if an ECClass is of the type or applies to the type (if a mixin) of the ECClass specified by the constraintClass parameter.\r\n * @param constraintClass The ECClass that is a constraint class of a relationship.\r\n * @param testClass The ECClass to check against the constraint class.\r\n * @param isPolymorphic Indicates if the testClass should be checked polymorphically.\r\n */\r\n public static async classCompatibleWithConstraint(constraintClass: ECClass, testClass: ECClass, isPolymorphic: boolean): Promise<boolean> {\r\n if (SchemaItem.equalByKey(constraintClass, testClass))\r\n return true;\r\n\r\n if (isPolymorphic) {\r\n if (testClass.schemaItemType === SchemaItemType.EntityClass || testClass.schemaItemType === SchemaItemType.RelationshipClass) {\r\n return testClass.is(constraintClass);\r\n }\r\n\r\n if (testClass.schemaItemType === SchemaItemType.Mixin) {\r\n if (constraintClass.schemaItemType === SchemaItemType.EntityClass)\r\n return (testClass as Mixin).applicableTo(constraintClass as EntityClass);\r\n else\r\n return testClass.is(constraintClass);\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static isRelationshipConstraint(object: any): object is RelationshipConstraint {\r\n const relationshipConstrait = object as RelationshipConstraint;\r\n\r\n return relationshipConstrait !== undefined && relationshipConstrait.polymorphic !== undefined && relationshipConstrait.multiplicity !== undefined\r\n && relationshipConstrait.relationshipEnd !== undefined && relationshipConstrait._relationshipClass !== undefined;\r\n }\r\n\r\n protected addCustomAttribute(customAttribute: CustomAttribute) {\r\n if (!this._customAttributes)\r\n this._customAttributes = new Map<string, CustomAttribute>();\r\n\r\n this._customAttributes.set(customAttribute.className, customAttribute);\r\n }\r\n\r\n}\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\n * @internal\r\n */\r\nexport abstract class MutableRelationshipConstraint extends RelationshipConstraint {\r\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\r\n\r\n}\r\n\r\nconst INT32_MAX = 2147483647;\r\n\r\n/**\r\n * @beta\r\n */\r\nexport class RelationshipMultiplicity {\r\n public static readonly zeroOne = new RelationshipMultiplicity(0, 1);\r\n public static readonly zeroMany = new RelationshipMultiplicity(0, INT32_MAX);\r\n public static readonly oneOne = new RelationshipMultiplicity(1, 1);\r\n public static readonly oneMany = new RelationshipMultiplicity(1, INT32_MAX);\r\n\r\n public readonly lowerLimit: number;\r\n public readonly upperLimit: number;\r\n\r\n constructor(lowerLimit: number, upperLimit: number) {\r\n this.lowerLimit = lowerLimit;\r\n this.upperLimit = upperLimit;\r\n }\r\n\r\n public static fromString(str: string): RelationshipMultiplicity | undefined {\r\n const matches = /^\\(([0-9]*)\\.\\.([0-9]*|\\*)\\)$/.exec(str);\r\n if (matches === null || matches.length !== 3)\r\n return undefined;\r\n\r\n const lowerLimit = parseInt(matches[1], 10);\r\n const upperLimit = matches[2] === \"*\" ? INT32_MAX : parseInt(matches[2], 10);\r\n if (0 === lowerLimit && 1 === upperLimit)\r\n return RelationshipMultiplicity.zeroOne;\r\n else if (0 === lowerLimit && INT32_MAX === upperLimit)\r\n return RelationshipMultiplicity.zeroMany;\r\n else if (1 === lowerLimit && 1 === upperLimit)\r\n return RelationshipMultiplicity.oneOne;\r\n else if (1 === lowerLimit && INT32_MAX === upperLimit)\r\n return RelationshipMultiplicity.oneMany;\r\n\r\n return new RelationshipMultiplicity(lowerLimit, upperLimit);\r\n }\r\n\r\n public equals(rhs: RelationshipMultiplicity): boolean {\r\n return this.lowerLimit === rhs.lowerLimit && this.upperLimit === rhs.upperLimit;\r\n }\r\n\r\n public toString(): string {\r\n return `(${this.lowerLimit}..${this.upperLimit === INT32_MAX ? \"*\" : this.upperLimit})`;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableRelationshipClass extends RelationshipClass {\r\n public override get source() { return this._source as MutableRelationshipConstraint; }\r\n public override get target() { return this._target as MutableRelationshipConstraint; }\r\n public abstract override setStrength(strength: StrengthType): void;\r\n public abstract override setStrengthDirection(direction: StrengthDirection): void;\r\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\r\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"RelationshipClass.js","sourceRoot":"","sources":["../../../src/Metadata/RelationshipClass.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAiB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EACY,aAAa,EAAE,sBAAsB,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,yBAAyB,EACrI,gBAAgB,EAAE,YAAY,GAC/B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG7D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAsE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAClI,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA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AK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC;IAC1F,CAAC;;AAGH;;;GAGG;AACH,MAAM,OAAgB,wBAAyB,SAAQ,iBAAiB;IACtE,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;IACtF,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;CAMvF","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 { DelayedPromiseWithProps } from \"../DelayedPromise\";\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\nimport { RelationshipClassProps, RelationshipConstraintProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport {\n ECClassModifier, parseStrength, parseStrengthDirection, RelationshipEnd, SchemaItemType, StrengthDirection, strengthDirectionToString,\n strengthToString, StrengthType,\n} from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { LazyLoadedRelationshipConstraintClass } from \"../Interfaces\";\nimport { SchemaItemKey } from \"../SchemaKey\";\nimport { ECClass } from \"./Class\";\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\nimport { createNavigationProperty, createNavigationPropertySync, EntityClass } from \"./EntityClass\";\nimport { Mixin } from \"./Mixin\";\nimport { NavigationProperty } from \"./Property\";\nimport { Schema } from \"./Schema\";\nimport { SchemaItem } from \"./SchemaItem\";\n\ntype AnyConstraintClass = EntityClass | Mixin | RelationshipClass;\n\n/**\n * A Typescript class representation of a ECRelationshipClass.\n * @public @preview\n */\nexport class RelationshipClass extends ECClass {\n public override readonly schemaItemType = RelationshipClass.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.RelationshipClass; }\n /** @internal */\n protected _strength: StrengthType;\n /** @internal */\n protected _strengthDirection: StrengthDirection;\n /** @internal */\n protected _source: RelationshipConstraint;\n /** @internal */\n protected _target: RelationshipConstraint;\n\n /** @internal */\n constructor(schema: Schema, name: string, modifier?: ECClassModifier) {\n super(schema, name, modifier);\n this._strengthDirection = StrengthDirection.Forward;\n this._strength = StrengthType.Referencing;\n this._source = new RelationshipConstraint(this, RelationshipEnd.Source);\n this._target = new RelationshipConstraint(this, RelationshipEnd.Target);\n }\n\n public get strength() { return this._strength; }\n public get strengthDirection() { return this._strengthDirection; }\n public get source() { return this._source; }\n public get target() { return this._target; }\n\n /**\n *\n * @param name\n * @param relationship\n * @param direction\n * @internal\n */\n protected async createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\n return this.addProperty(await createNavigationProperty(this, name, relationship, direction));\n }\n\n /** @internal */\n protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\n return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));\n }\n\n /**\n * @internal Used for schema editing.\n */\n protected setStrength(strength: StrengthType) {\n this._strength = strength;\n }\n\n /**\n * @internal Used for schema editing.\n */\n protected setStrengthDirection(direction: StrengthDirection) {\n this._strengthDirection = direction;\n }\n\n /**\n * @internal Used for schema editing.\n */\n protected setSourceConstraint(source: RelationshipConstraint) {\n this._source = source;\n }\n\n /**\n * @internal Used for schema editing.\n */\n protected setTargetConstraint(target: RelationshipConstraint) {\n this._target = target;\n }\n /**\n * Save this RelationshipClass's properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): RelationshipClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.strength = strengthToString(this.strength);\n schemaJson.strengthDirection = strengthDirectionToString(this.strengthDirection);\n schemaJson.source = this.source.toJSON();\n schemaJson.target = this.target.toJSON();\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n itemElement.setAttribute(\"strength\", strengthToString(this.strength));\n itemElement.setAttribute(\"strengthDirection\", strengthDirectionToString(this.strengthDirection));\n itemElement.appendChild(await this.source.toXml(schemaXml));\n itemElement.appendChild(await this.target.toXml(schemaXml));\n return itemElement;\n }\n\n public override fromJSONSync(relationshipClassProps: RelationshipClassProps) {\n super.fromJSONSync(relationshipClassProps);\n\n let strength = parseStrength(relationshipClassProps.strength);\n if (undefined === strength) {\n if (SchemaReadHelper.isECSpecVersionNewer({ readVersion: relationshipClassProps.originalECSpecMajorVersion, writeVersion: relationshipClassProps.originalECSpecMinorVersion } as ECSpecVersion))\n strength = StrengthType.Referencing;\n else\n throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strength' attribute. '${relationshipClassProps.strength}' is not a valid StrengthType.`);\n }\n\n const strengthDirection = parseStrengthDirection(relationshipClassProps.strengthDirection);\n if (undefined === strengthDirection)\n throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strengthDirection' attribute. '${relationshipClassProps.strengthDirection}' is not a valid StrengthDirection.`);\n\n this._strength = strength;\n this._strengthDirection = strengthDirection;\n }\n\n public override async fromJSON(relationshipClassProps: RelationshipClassProps) {\n this.fromJSONSync(relationshipClassProps);\n }\n\n /**\n * Type guard to check if the SchemaItem is of type RelationshipClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is a RelationshipClass, false otherwise.\n */\n public static isRelationshipClass(item?: SchemaItem): item is RelationshipClass {\n if (item && item.schemaItemType === SchemaItemType.RelationshipClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type RelationshipClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to RelationshipClass if it is a RelationshipClass, undefined otherwise.\n * @internal\n */\n public static assertIsRelationshipClass(item?: SchemaItem): asserts item is RelationshipClass {\n if (!this.isRelationshipClass(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.RelationshipClass}' (RelationshipClass)`);\n }\n}\n\n/**\n * A Typescript class representation of a ECRelationshipConstraint.\n * @public @preview\n */\nexport class RelationshipConstraint implements CustomAttributeContainerProps {\n private _abstractConstraint?: LazyLoadedRelationshipConstraintClass;\n private _relationshipClass: RelationshipClass;\n private _relationshipEnd: RelationshipEnd;\n private _multiplicity?: RelationshipMultiplicity;\n private _polymorphic?: boolean;\n private _roleLabel?: string;\n private _constraintClasses?: LazyLoadedRelationshipConstraintClass[];\n private _customAttributes?: Map<string, CustomAttribute>;\n\n /** @internal */\n constructor(relClass: RelationshipClass, relEnd: RelationshipEnd, roleLabel?: string, polymorphic?: boolean) {\n this._relationshipEnd = relEnd;\n if (polymorphic)\n this._polymorphic = polymorphic;\n else\n this._polymorphic = false;\n\n this._multiplicity = RelationshipMultiplicity.zeroOne;\n this._relationshipClass = relClass;\n this._roleLabel = roleLabel;\n }\n\n public get multiplicity() { return this._multiplicity ?? RelationshipMultiplicity.zeroOne; }\n\n public get polymorphic() { return this._polymorphic ?? false; }\n\n public get roleLabel() { return this._roleLabel; }\n\n public get constraintClasses(): ReadonlyArray<LazyLoadedRelationshipConstraintClass> | undefined { return this._constraintClasses; }\n\n public get relationshipClass() { return this._relationshipClass; }\n\n public get relationshipEnd() { return this._relationshipEnd; }\n\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\n\n /** Returns the constraint name, ie. 'RelationshipName.Source/Target' */\n public get fullName() { return `${this._relationshipClass.name}:${this.isSource ? \"Source\" : \"Target\"}`; }\n\n /** Returns the schema of the RelationshipClass. */\n public get schema(): Schema { return this._relationshipClass.schema; }\n\n public get abstractConstraint(): LazyLoadedRelationshipConstraintClass | undefined {\n if (this._abstractConstraint)\n return this._abstractConstraint;\n\n if (this.constraintClasses && this.constraintClasses.length === 1)\n return this.constraintClasses[0];\n\n return this._abstractConstraint;\n }\n\n /**\n * True if this RelationshipConstraint is the Source relationship end.\n */\n public get isSource(): boolean { return this.relationshipEnd === RelationshipEnd.Source; }\n\n /**\n * Adds the provided class as a constraint class to this constraint.\n * @param constraint The class to add as a constraint class.\n * @internal\n */\n public addClass(constraint: LazyLoadedRelationshipConstraintClass): void {\n // TODO: Ensure we don't start mixing constraint class types\n // TODO: Check that this class is or subclasses abstract constraint?\n\n if (!this._constraintClasses)\n this._constraintClasses = [];\n\n // TODO: Handle relationship constraints\n this._constraintClasses.push(constraint);\n }\n\n /**\n * Removes the provided class as a constraint class from this constraint.\n * @param constraint The class to add as a constraint class.\n *\n * @internal\n */\n protected removeClass(constraint: LazyLoadedRelationshipConstraintClass): void {\n if (undefined === this._constraintClasses)\n return;\n\n this._constraintClasses.forEach((item, index) => {\n const constraintName = item.fullName;\n if (constraintName === constraint.fullName)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._constraintClasses?.splice(index, 1);\n });\n }\n\n /**\n * Save this RelationshipConstraint's properties to an object for serializing to JSON.\n */\n public toJSON(): RelationshipConstraintProps {\n const schemaJson: { [value: string]: any } = {};\n schemaJson.multiplicity = this.multiplicity.toString();\n schemaJson.roleLabel = this.roleLabel;\n schemaJson.polymorphic = this.polymorphic;\n if (undefined !== this._abstractConstraint)\n schemaJson.abstractConstraint = this._abstractConstraint.fullName;\n if (undefined !== this.constraintClasses && this.constraintClasses.length > 0)\n schemaJson.constraintClasses = this.constraintClasses.map((constraintClass) => constraintClass.fullName);\n\n const customAttributes = serializeCustomAttributes(this.customAttributes);\n if (undefined !== customAttributes)\n schemaJson.customAttributes = customAttributes;\n return schemaJson as RelationshipConstraintProps;\n }\n\n /** @internal */\n public async toXml(schemaXml: Document): Promise<Element> {\n const elementName = this.isSource ? \"Source\" : \"Target\";\n const itemElement = schemaXml.createElement(elementName);\n if (undefined !== this.polymorphic)\n itemElement.setAttribute(\"polymorphic\", this.polymorphic.toString());\n if (undefined !== this.roleLabel)\n itemElement.setAttribute(\"roleLabel\", this.roleLabel);\n if (undefined !== this.multiplicity)\n itemElement.setAttribute(\"multiplicity\", this.multiplicity.toString());\n\n const abstractConstraint = await this.abstractConstraint;\n if (undefined !== abstractConstraint) {\n const abstractConstraintName = XmlSerializationUtils.createXmlTypedName(this.schema, abstractConstraint.schema, abstractConstraint.name);\n itemElement.setAttribute(\"abstractConstraint\", abstractConstraintName);\n }\n\n if (undefined !== this.constraintClasses) {\n for (const item of this.constraintClasses) {\n const constraintClass = await item;\n const classElement = schemaXml.createElement(\"Class\");\n const constraintClassName = XmlSerializationUtils.createXmlTypedName(this.schema, constraintClass.schema, constraintClass.name);\n classElement.setAttribute(\"class\", constraintClassName);\n itemElement.appendChild(classElement);\n }\n }\n\n if (this._customAttributes) {\n const caContainerElement = schemaXml.createElement(\"ECCustomAttributes\");\n for (const [name, attribute] of this._customAttributes) {\n const caElement = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this.schema);\n caContainerElement.appendChild(caElement);\n }\n itemElement.appendChild(caContainerElement);\n }\n\n return itemElement;\n }\n\n public fromJSONSync(relationshipConstraintProps: RelationshipConstraintProps) {\n\n this._roleLabel = relationshipConstraintProps.roleLabel;\n this._polymorphic = relationshipConstraintProps.polymorphic;\n\n const parsedMultiplicity = RelationshipMultiplicity.fromString(relationshipConstraintProps.multiplicity);\n if (!parsedMultiplicity)\n throw new ECSchemaError(ECSchemaStatus.InvalidMultiplicity, ``);\n this._multiplicity = parsedMultiplicity;\n\n const relClassSchema = this.relationshipClass.schema;\n\n if (undefined !== relationshipConstraintProps.abstractConstraint) {\n const abstractConstraintSchemaItemKey = relClassSchema.getSchemaItemKey(relationshipConstraintProps.abstractConstraint);\n if (!abstractConstraintSchemaItemKey)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);\n this.setAbstractConstraint(new DelayedPromiseWithProps<SchemaItemKey, AnyConstraintClass>(abstractConstraintSchemaItemKey,\n async () => {\n const tempAbstractConstraint = await relClassSchema.lookupItem(relationshipConstraintProps.abstractConstraint!);\n if (undefined === tempAbstractConstraint ||\n (!EntityClass.isEntityClass(tempAbstractConstraint) && !Mixin.isMixin(tempAbstractConstraint) && !RelationshipClass.isRelationshipClass(tempAbstractConstraint)))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);\n\n return tempAbstractConstraint;\n }));\n }\n\n const loadEachConstraint = (constraintClassName: any) => {\n const tempConstraintClass = relClassSchema.lookupItemSync(constraintClassName);\n if (!tempConstraintClass ||\n (!EntityClass.isEntityClass(tempConstraintClass) && !Mixin.isMixin(tempConstraintClass) && !RelationshipClass.isRelationshipClass(tempConstraintClass)))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n return tempConstraintClass;\n };\n\n for (const constraintClassName of relationshipConstraintProps.constraintClasses) {\n const constraintClass = loadEachConstraint(constraintClassName);\n this.addClass(new DelayedPromiseWithProps(constraintClass.key, async () => constraintClass));\n }\n }\n\n public async fromJSON(relationshipConstraintProps: RelationshipConstraintProps) {\n this.fromJSONSync(relationshipConstraintProps);\n }\n\n /**\n * Indicates if the provided [[ECClass]] is supported by this [[RelationshipConstraint]].\n * @param ecClass The class to check.\n */\n public async supportsClass(ecClass: ECClass): Promise<boolean> {\n if (!this.constraintClasses) {\n if (this.relationshipClass.baseClass) {\n const baseRelationship = await this.relationshipClass.baseClass as RelationshipClass;\n const baseConstraint = this.isSource ? baseRelationship.source : baseRelationship.target;\n return baseConstraint.supportsClass(ecClass);\n }\n return false;\n }\n\n if (ecClass.schemaItemType !== SchemaItemType.EntityClass && ecClass.schemaItemType !== SchemaItemType.RelationshipClass &&\n ecClass.schemaItemType !== SchemaItemType.Mixin) {\n return false;\n }\n\n const abstractConstraint = await this.abstractConstraint;\n\n if (abstractConstraint && await RelationshipConstraint.classCompatibleWithConstraint(abstractConstraint, ecClass, this.polymorphic || false))\n return true;\n\n for (const constraint of this.constraintClasses) {\n if (await RelationshipConstraint.classCompatibleWithConstraint(await constraint, ecClass, this.polymorphic || false))\n return true;\n }\n\n return false;\n }\n\n /**\n * Indicates if an ECClass is of the type or applies to the type (if a mixin) of the ECClass specified by the constraintClass parameter.\n * @param constraintClass The ECClass that is a constraint class of a relationship.\n * @param testClass The ECClass to check against the constraint class.\n * @param isPolymorphic Indicates if the testClass should be checked polymorphically.\n */\n public static async classCompatibleWithConstraint(constraintClass: ECClass, testClass: ECClass, isPolymorphic: boolean): Promise<boolean> {\n if (SchemaItem.equalByKey(constraintClass, testClass))\n return true;\n\n if (isPolymorphic) {\n if (testClass.schemaItemType === SchemaItemType.EntityClass || testClass.schemaItemType === SchemaItemType.RelationshipClass) {\n return testClass.is(constraintClass);\n }\n\n if (testClass.schemaItemType === SchemaItemType.Mixin) {\n if (constraintClass.schemaItemType === SchemaItemType.EntityClass)\n return (testClass as Mixin).applicableTo(constraintClass as EntityClass);\n else\n return testClass.is(constraintClass);\n }\n }\n return false;\n }\n\n /**\n * @internal\n */\n public static isRelationshipConstraint(object: any): object is RelationshipConstraint {\n const relationshipConstraint = object as RelationshipConstraint;\n\n return relationshipConstraint !== undefined && relationshipConstraint.polymorphic !== undefined && relationshipConstraint.multiplicity !== undefined\n && relationshipConstraint.relationshipEnd !== undefined && relationshipConstraint._relationshipClass !== undefined;\n }\n\n /** @internal */\n protected addCustomAttribute(customAttribute: CustomAttribute) {\n if (!this._customAttributes)\n this._customAttributes = new Map<string, CustomAttribute>();\n\n this._customAttributes.set(customAttribute.className, customAttribute);\n }\n\n /** @internal */\n protected setRoleLabel(roleLabel: string | undefined) {\n this._roleLabel = roleLabel;\n }\n\n /** @internal */\n protected setRelationshipEnd(relationshipEnd: RelationshipEnd) {\n this._relationshipEnd = relationshipEnd;\n }\n\n /** @internal */\n protected setPolymorphic(polymorphic: boolean) {\n this._polymorphic = polymorphic;\n }\n\n /** @internal */\n protected setMultiplicity(multiplicity: RelationshipMultiplicity) {\n this._multiplicity = multiplicity;\n }\n\n /** @internal */\n protected setAbstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined) {\n this._abstractConstraint = abstractConstraint;\n }\n}\n\n/**\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\n * @internal\n */\nexport abstract class MutableRelationshipConstraint extends RelationshipConstraint {\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\n public abstract override setRoleLabel(roleLabel: string | undefined): void;\n public abstract override setRelationshipEnd(relationshipEnd: RelationshipEnd): void;\n public abstract override setPolymorphic(polymorphic: boolean): void;\n public abstract override setMultiplicity(multiplicity: RelationshipMultiplicity): void;\n public abstract override setAbstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined): void;\n}\n\nconst INT32_MAX = 2147483647;\n\n/**\n * @public @preview\n */\nexport class RelationshipMultiplicity {\n public static readonly zeroOne = new RelationshipMultiplicity(0, 1);\n public static readonly zeroMany = new RelationshipMultiplicity(0, INT32_MAX);\n public static readonly oneOne = new RelationshipMultiplicity(1, 1);\n public static readonly oneMany = new RelationshipMultiplicity(1, INT32_MAX);\n\n public readonly lowerLimit: number;\n public readonly upperLimit: number;\n\n /** @internal */\n constructor(lowerLimit: number, upperLimit: number) {\n this.lowerLimit = lowerLimit;\n this.upperLimit = upperLimit;\n }\n\n public static fromString(str: string): RelationshipMultiplicity | undefined {\n const matches = /^\\(([0-9]*)\\.\\.([0-9]*|\\*)\\)$/.exec(str);\n if (matches === null || matches.length !== 3)\n return undefined;\n\n const lowerLimit = parseInt(matches[1], 10);\n const upperLimit = matches[2] === \"*\" ? INT32_MAX : parseInt(matches[2], 10);\n if (0 === lowerLimit && 1 === upperLimit)\n return RelationshipMultiplicity.zeroOne;\n else if (0 === lowerLimit && INT32_MAX === upperLimit)\n return RelationshipMultiplicity.zeroMany;\n else if (1 === lowerLimit && 1 === upperLimit)\n return RelationshipMultiplicity.oneOne;\n else if (1 === lowerLimit && INT32_MAX === upperLimit)\n return RelationshipMultiplicity.oneMany;\n\n return new RelationshipMultiplicity(lowerLimit, upperLimit);\n }\n\n public equals(rhs: RelationshipMultiplicity): boolean {\n return this.lowerLimit === rhs.lowerLimit && this.upperLimit === rhs.upperLimit;\n }\n\n public toString(): string {\n return `(${this.lowerLimit}..${this.upperLimit === INT32_MAX ? \"*\" : this.upperLimit})`;\n }\n}\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableRelationshipClass extends RelationshipClass {\n public override get source() { return this._source as MutableRelationshipConstraint; }\n public override get target() { return this._target as MutableRelationshipConstraint; }\n public abstract override setStrength(strength: StrengthType): void;\n public abstract override setStrengthDirection(direction: StrengthDirection): void;\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}