@itwin/ecschema-metadata 5.0.0-dev.99 → 5.1.0-dev.0

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 (300) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/Constants.js.map +1 -1
  3. package/lib/cjs/Context.d.ts +3 -3
  4. package/lib/cjs/Context.d.ts.map +1 -1
  5. package/lib/cjs/Context.js +6 -6
  6. package/lib/cjs/Context.js.map +1 -1
  7. package/lib/cjs/DelayedPromise.d.ts +9 -8
  8. package/lib/cjs/DelayedPromise.d.ts.map +1 -1
  9. package/lib/cjs/DelayedPromise.js +2 -2
  10. package/lib/cjs/DelayedPromise.js.map +1 -1
  11. package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
  12. package/lib/cjs/Deserialization/Helper.d.ts.map +1 -1
  13. package/lib/cjs/Deserialization/Helper.js +27 -26
  14. package/lib/cjs/Deserialization/Helper.js.map +1 -1
  15. package/lib/cjs/Deserialization/JsonParser.js +150 -150
  16. package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
  17. package/lib/cjs/Deserialization/JsonProps.d.ts +34 -34
  18. package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
  19. package/lib/cjs/Deserialization/JsonProps.js +3 -3
  20. package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
  21. package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
  22. package/lib/cjs/Deserialization/XmlParser.js +49 -49
  23. package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
  24. package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts +0 -5
  25. package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
  26. package/lib/cjs/Deserialization/XmlSerializationUtils.js +6 -11
  27. package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
  28. package/lib/cjs/ECName.d.ts +2 -2
  29. package/lib/cjs/ECName.js +4 -4
  30. package/lib/cjs/ECName.js.map +1 -1
  31. package/lib/cjs/ECObjects.d.ts +23 -11
  32. package/lib/cjs/ECObjects.d.ts.map +1 -1
  33. package/lib/cjs/ECObjects.js +47 -24
  34. package/lib/cjs/ECObjects.js.map +1 -1
  35. package/lib/cjs/Exception.d.ts +4 -4
  36. package/lib/cjs/Exception.d.ts.map +1 -1
  37. package/lib/cjs/Exception.js +60 -60
  38. package/lib/cjs/Exception.js.map +1 -1
  39. package/lib/cjs/Interfaces.d.ts +30 -34
  40. package/lib/cjs/Interfaces.d.ts.map +1 -1
  41. package/lib/cjs/Interfaces.js.map +1 -1
  42. package/lib/cjs/Metadata/Class.d.ts +107 -19
  43. package/lib/cjs/Metadata/Class.d.ts.map +1 -1
  44. package/lib/cjs/Metadata/Class.js +127 -47
  45. package/lib/cjs/Metadata/Class.js.map +1 -1
  46. package/lib/cjs/Metadata/Constant.d.ts +12 -9
  47. package/lib/cjs/Metadata/Constant.d.ts.map +1 -1
  48. package/lib/cjs/Metadata/Constant.js +12 -9
  49. package/lib/cjs/Metadata/Constant.js.map +1 -1
  50. package/lib/cjs/Metadata/CustomAttribute.d.ts +2 -2
  51. package/lib/cjs/Metadata/CustomAttribute.d.ts.map +1 -1
  52. package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
  53. package/lib/cjs/Metadata/CustomAttributeClass.d.ts +5 -3
  54. package/lib/cjs/Metadata/CustomAttributeClass.d.ts.map +1 -1
  55. package/lib/cjs/Metadata/CustomAttributeClass.js +7 -5
  56. package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
  57. package/lib/cjs/Metadata/EntityClass.d.ts +20 -3
  58. package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
  59. package/lib/cjs/Metadata/EntityClass.js +32 -14
  60. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  61. package/lib/cjs/Metadata/Enumeration.d.ts +16 -9
  62. package/lib/cjs/Metadata/Enumeration.d.ts.map +1 -1
  63. package/lib/cjs/Metadata/Enumeration.js +20 -13
  64. package/lib/cjs/Metadata/Enumeration.js.map +1 -1
  65. package/lib/cjs/Metadata/Format.d.ts +32 -24
  66. package/lib/cjs/Metadata/Format.d.ts.map +1 -1
  67. package/lib/cjs/Metadata/Format.js +47 -27
  68. package/lib/cjs/Metadata/Format.js.map +1 -1
  69. package/lib/cjs/Metadata/InvertedUnit.d.ts +11 -7
  70. package/lib/cjs/Metadata/InvertedUnit.d.ts.map +1 -1
  71. package/lib/cjs/Metadata/InvertedUnit.js +16 -10
  72. package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
  73. package/lib/cjs/Metadata/KindOfQuantity.d.ts +24 -15
  74. package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
  75. package/lib/cjs/Metadata/KindOfQuantity.js +54 -29
  76. package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
  77. package/lib/cjs/Metadata/Mixin.d.ts +16 -3
  78. package/lib/cjs/Metadata/Mixin.d.ts.map +1 -1
  79. package/lib/cjs/Metadata/Mixin.js +20 -7
  80. package/lib/cjs/Metadata/Mixin.js.map +1 -1
  81. package/lib/cjs/Metadata/OverrideFormat.d.ts +12 -12
  82. package/lib/cjs/Metadata/OverrideFormat.d.ts.map +1 -1
  83. package/lib/cjs/Metadata/OverrideFormat.js +27 -19
  84. package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
  85. package/lib/cjs/Metadata/Phenomenon.d.ts +10 -2
  86. package/lib/cjs/Metadata/Phenomenon.d.ts.map +1 -1
  87. package/lib/cjs/Metadata/Phenomenon.js +11 -3
  88. package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
  89. package/lib/cjs/Metadata/Property.d.ts +46 -28
  90. package/lib/cjs/Metadata/Property.d.ts.map +1 -1
  91. package/lib/cjs/Metadata/Property.js +46 -22
  92. package/lib/cjs/Metadata/Property.js.map +1 -1
  93. package/lib/cjs/Metadata/PropertyCategory.d.ts +6 -3
  94. package/lib/cjs/Metadata/PropertyCategory.d.ts.map +1 -1
  95. package/lib/cjs/Metadata/PropertyCategory.js +12 -5
  96. package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
  97. package/lib/cjs/Metadata/RelationshipClass.d.ts +48 -25
  98. package/lib/cjs/Metadata/RelationshipClass.d.ts.map +1 -1
  99. package/lib/cjs/Metadata/RelationshipClass.js +54 -34
  100. package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
  101. package/lib/cjs/Metadata/Schema.d.ts +50 -28
  102. package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
  103. package/lib/cjs/Metadata/Schema.js +64 -42
  104. package/lib/cjs/Metadata/Schema.js.map +1 -1
  105. package/lib/cjs/Metadata/SchemaItem.d.ts +10 -19
  106. package/lib/cjs/Metadata/SchemaItem.d.ts.map +1 -1
  107. package/lib/cjs/Metadata/SchemaItem.js +12 -20
  108. package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
  109. package/lib/cjs/Metadata/Unit.d.ts +17 -21
  110. package/lib/cjs/Metadata/Unit.d.ts.map +1 -1
  111. package/lib/cjs/Metadata/Unit.js +20 -22
  112. package/lib/cjs/Metadata/Unit.js.map +1 -1
  113. package/lib/cjs/Metadata/UnitSystem.d.ts +3 -1
  114. package/lib/cjs/Metadata/UnitSystem.d.ts.map +1 -1
  115. package/lib/cjs/Metadata/UnitSystem.js +4 -2
  116. package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
  117. package/lib/cjs/PropertyTypes.d.ts +11 -11
  118. package/lib/cjs/PropertyTypes.d.ts.map +1 -1
  119. package/lib/cjs/PropertyTypes.js +28 -20
  120. package/lib/cjs/PropertyTypes.js.map +1 -1
  121. package/lib/cjs/SchemaFormatsProvider.d.ts +39 -0
  122. package/lib/cjs/SchemaFormatsProvider.d.ts.map +1 -0
  123. package/lib/cjs/SchemaFormatsProvider.js +146 -0
  124. package/lib/cjs/SchemaFormatsProvider.js.map +1 -0
  125. package/lib/cjs/SchemaJsonLocater.d.ts +5 -5
  126. package/lib/cjs/SchemaJsonLocater.js +4 -4
  127. package/lib/cjs/SchemaJsonLocater.js.map +1 -1
  128. package/lib/cjs/SchemaKey.d.ts +6 -6
  129. package/lib/cjs/SchemaKey.d.ts.map +1 -1
  130. package/lib/cjs/SchemaKey.js +9 -9
  131. package/lib/cjs/SchemaKey.js.map +1 -1
  132. package/lib/cjs/SchemaLoader.d.ts +3 -3
  133. package/lib/cjs/SchemaLoader.js +4 -4
  134. package/lib/cjs/SchemaLoader.js.map +1 -1
  135. package/lib/cjs/SchemaPartVisitorDelegate.d.ts +2 -2
  136. package/lib/cjs/SchemaPartVisitorDelegate.js +1 -1
  137. package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
  138. package/lib/cjs/UnitConversion/Graph.js.map +1 -1
  139. package/lib/cjs/UnitConversion/Parser.js.map +1 -1
  140. package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
  141. package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
  142. package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
  143. package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
  144. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  145. package/lib/cjs/ecschema-metadata.d.ts +2 -1
  146. package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
  147. package/lib/cjs/ecschema-metadata.js +1 -0
  148. package/lib/cjs/ecschema-metadata.js.map +1 -1
  149. package/lib/cjs/utils/SchemaGraph.js +3 -3
  150. package/lib/cjs/utils/SchemaGraph.js.map +1 -1
  151. package/lib/esm/Constants.js.map +1 -1
  152. package/lib/esm/Context.d.ts +3 -3
  153. package/lib/esm/Context.d.ts.map +1 -1
  154. package/lib/esm/Context.js +7 -7
  155. package/lib/esm/Context.js.map +1 -1
  156. package/lib/esm/DelayedPromise.d.ts +9 -8
  157. package/lib/esm/DelayedPromise.d.ts.map +1 -1
  158. package/lib/esm/DelayedPromise.js +2 -2
  159. package/lib/esm/DelayedPromise.js.map +1 -1
  160. package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
  161. package/lib/esm/Deserialization/Helper.d.ts.map +1 -1
  162. package/lib/esm/Deserialization/Helper.js +28 -27
  163. package/lib/esm/Deserialization/Helper.js.map +1 -1
  164. package/lib/esm/Deserialization/JsonParser.js +151 -151
  165. package/lib/esm/Deserialization/JsonParser.js.map +1 -1
  166. package/lib/esm/Deserialization/JsonProps.d.ts +34 -34
  167. package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
  168. package/lib/esm/Deserialization/JsonProps.js +3 -3
  169. package/lib/esm/Deserialization/JsonProps.js.map +1 -1
  170. package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
  171. package/lib/esm/Deserialization/XmlParser.js +50 -50
  172. package/lib/esm/Deserialization/XmlParser.js.map +1 -1
  173. package/lib/esm/Deserialization/XmlSerializationUtils.d.ts +0 -5
  174. package/lib/esm/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
  175. package/lib/esm/Deserialization/XmlSerializationUtils.js +7 -12
  176. package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
  177. package/lib/esm/ECName.d.ts +2 -2
  178. package/lib/esm/ECName.js +5 -5
  179. package/lib/esm/ECName.js.map +1 -1
  180. package/lib/esm/ECObjects.d.ts +23 -11
  181. package/lib/esm/ECObjects.d.ts.map +1 -1
  182. package/lib/esm/ECObjects.js +48 -25
  183. package/lib/esm/ECObjects.js.map +1 -1
  184. package/lib/esm/Exception.d.ts +4 -4
  185. package/lib/esm/Exception.d.ts.map +1 -1
  186. package/lib/esm/Exception.js +58 -58
  187. package/lib/esm/Exception.js.map +1 -1
  188. package/lib/esm/Interfaces.d.ts +30 -34
  189. package/lib/esm/Interfaces.d.ts.map +1 -1
  190. package/lib/esm/Interfaces.js.map +1 -1
  191. package/lib/esm/Metadata/Class.d.ts +107 -19
  192. package/lib/esm/Metadata/Class.d.ts.map +1 -1
  193. package/lib/esm/Metadata/Class.js +128 -48
  194. package/lib/esm/Metadata/Class.js.map +1 -1
  195. package/lib/esm/Metadata/Constant.d.ts +12 -9
  196. package/lib/esm/Metadata/Constant.d.ts.map +1 -1
  197. package/lib/esm/Metadata/Constant.js +13 -10
  198. package/lib/esm/Metadata/Constant.js.map +1 -1
  199. package/lib/esm/Metadata/CustomAttribute.d.ts +2 -2
  200. package/lib/esm/Metadata/CustomAttribute.d.ts.map +1 -1
  201. package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
  202. package/lib/esm/Metadata/CustomAttributeClass.d.ts +5 -3
  203. package/lib/esm/Metadata/CustomAttributeClass.d.ts.map +1 -1
  204. package/lib/esm/Metadata/CustomAttributeClass.js +8 -6
  205. package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
  206. package/lib/esm/Metadata/EntityClass.d.ts +20 -3
  207. package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
  208. package/lib/esm/Metadata/EntityClass.js +33 -15
  209. package/lib/esm/Metadata/EntityClass.js.map +1 -1
  210. package/lib/esm/Metadata/Enumeration.d.ts +16 -9
  211. package/lib/esm/Metadata/Enumeration.d.ts.map +1 -1
  212. package/lib/esm/Metadata/Enumeration.js +21 -14
  213. package/lib/esm/Metadata/Enumeration.js.map +1 -1
  214. package/lib/esm/Metadata/Format.d.ts +32 -24
  215. package/lib/esm/Metadata/Format.d.ts.map +1 -1
  216. package/lib/esm/Metadata/Format.js +48 -28
  217. package/lib/esm/Metadata/Format.js.map +1 -1
  218. package/lib/esm/Metadata/InvertedUnit.d.ts +11 -7
  219. package/lib/esm/Metadata/InvertedUnit.d.ts.map +1 -1
  220. package/lib/esm/Metadata/InvertedUnit.js +17 -11
  221. package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
  222. package/lib/esm/Metadata/KindOfQuantity.d.ts +24 -15
  223. package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
  224. package/lib/esm/Metadata/KindOfQuantity.js +55 -30
  225. package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
  226. package/lib/esm/Metadata/Mixin.d.ts +16 -3
  227. package/lib/esm/Metadata/Mixin.d.ts.map +1 -1
  228. package/lib/esm/Metadata/Mixin.js +21 -8
  229. package/lib/esm/Metadata/Mixin.js.map +1 -1
  230. package/lib/esm/Metadata/OverrideFormat.d.ts +12 -12
  231. package/lib/esm/Metadata/OverrideFormat.d.ts.map +1 -1
  232. package/lib/esm/Metadata/OverrideFormat.js +28 -20
  233. package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
  234. package/lib/esm/Metadata/Phenomenon.d.ts +10 -2
  235. package/lib/esm/Metadata/Phenomenon.d.ts.map +1 -1
  236. package/lib/esm/Metadata/Phenomenon.js +12 -4
  237. package/lib/esm/Metadata/Phenomenon.js.map +1 -1
  238. package/lib/esm/Metadata/Property.d.ts +46 -28
  239. package/lib/esm/Metadata/Property.d.ts.map +1 -1
  240. package/lib/esm/Metadata/Property.js +47 -23
  241. package/lib/esm/Metadata/Property.js.map +1 -1
  242. package/lib/esm/Metadata/PropertyCategory.d.ts +6 -3
  243. package/lib/esm/Metadata/PropertyCategory.d.ts.map +1 -1
  244. package/lib/esm/Metadata/PropertyCategory.js +13 -6
  245. package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
  246. package/lib/esm/Metadata/RelationshipClass.d.ts +48 -25
  247. package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -1
  248. package/lib/esm/Metadata/RelationshipClass.js +55 -35
  249. package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
  250. package/lib/esm/Metadata/Schema.d.ts +50 -28
  251. package/lib/esm/Metadata/Schema.d.ts.map +1 -1
  252. package/lib/esm/Metadata/Schema.js +65 -43
  253. package/lib/esm/Metadata/Schema.js.map +1 -1
  254. package/lib/esm/Metadata/SchemaItem.d.ts +10 -19
  255. package/lib/esm/Metadata/SchemaItem.d.ts.map +1 -1
  256. package/lib/esm/Metadata/SchemaItem.js +13 -21
  257. package/lib/esm/Metadata/SchemaItem.js.map +1 -1
  258. package/lib/esm/Metadata/Unit.d.ts +17 -21
  259. package/lib/esm/Metadata/Unit.d.ts.map +1 -1
  260. package/lib/esm/Metadata/Unit.js +21 -23
  261. package/lib/esm/Metadata/Unit.js.map +1 -1
  262. package/lib/esm/Metadata/UnitSystem.d.ts +3 -1
  263. package/lib/esm/Metadata/UnitSystem.d.ts.map +1 -1
  264. package/lib/esm/Metadata/UnitSystem.js +5 -3
  265. package/lib/esm/Metadata/UnitSystem.js.map +1 -1
  266. package/lib/esm/PropertyTypes.d.ts +11 -11
  267. package/lib/esm/PropertyTypes.d.ts.map +1 -1
  268. package/lib/esm/PropertyTypes.js +29 -21
  269. package/lib/esm/PropertyTypes.js.map +1 -1
  270. package/lib/esm/SchemaFormatsProvider.d.ts +39 -0
  271. package/lib/esm/SchemaFormatsProvider.d.ts.map +1 -0
  272. package/lib/esm/SchemaFormatsProvider.js +142 -0
  273. package/lib/esm/SchemaFormatsProvider.js.map +1 -0
  274. package/lib/esm/SchemaJsonLocater.d.ts +5 -5
  275. package/lib/esm/SchemaJsonLocater.js +4 -4
  276. package/lib/esm/SchemaJsonLocater.js.map +1 -1
  277. package/lib/esm/SchemaKey.d.ts +6 -6
  278. package/lib/esm/SchemaKey.d.ts.map +1 -1
  279. package/lib/esm/SchemaKey.js +10 -10
  280. package/lib/esm/SchemaKey.js.map +1 -1
  281. package/lib/esm/SchemaLoader.d.ts +3 -3
  282. package/lib/esm/SchemaLoader.js +5 -5
  283. package/lib/esm/SchemaLoader.js.map +1 -1
  284. package/lib/esm/SchemaPartVisitorDelegate.d.ts +2 -2
  285. package/lib/esm/SchemaPartVisitorDelegate.js +1 -1
  286. package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
  287. package/lib/esm/UnitConversion/Graph.js.map +1 -1
  288. package/lib/esm/UnitConversion/Parser.js.map +1 -1
  289. package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
  290. package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
  291. package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
  292. package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
  293. package/lib/esm/Validation/SchemaWalker.js.map +1 -1
  294. package/lib/esm/ecschema-metadata.d.ts +2 -1
  295. package/lib/esm/ecschema-metadata.d.ts.map +1 -1
  296. package/lib/esm/ecschema-metadata.js +1 -0
  297. package/lib/esm/ecschema-metadata.js.map +1 -1
  298. package/lib/esm/utils/SchemaGraph.js +4 -4
  299. package/lib/esm/utils/SchemaGraph.js.map +1 -1
  300. package/package.json +8 -6
@@ -6,14 +6,15 @@
6
6
  * @module Metadata
7
7
  */
8
8
  import { containerTypeToString, parseCustomAttributeContainerType, SchemaItemType, } from "../ECObjects";
9
- import { ECObjectsError, ECObjectsStatus } from "../Exception";
9
+ import { ECSchemaError, ECSchemaStatus } from "../Exception";
10
10
  import { ECClass } from "./Class";
11
11
  /**
12
12
  * A Typescript class representation of an ECCustomAttributeClass.
13
- * @beta
13
+ * @public @preview
14
14
  */
15
15
  export class CustomAttributeClass extends ECClass {
16
16
  schemaItemType = CustomAttributeClass.schemaItemType;
17
+ /** @internal */
17
18
  static get schemaItemType() { return SchemaItemType.CustomAttributeClass; }
18
19
  _appliesTo;
19
20
  /**
@@ -24,7 +25,7 @@ export class CustomAttributeClass extends ECClass {
24
25
  }
25
26
  get appliesTo() {
26
27
  if (undefined === this._appliesTo)
27
- throw new ECObjectsError(ECObjectsStatus.InvalidContainerType, `The CustomAttributeClass ${this.name} does not have a CustomAttributeContainerType.`);
28
+ throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `The CustomAttributeClass ${this.name} does not have a CustomAttributeContainerType.`);
28
29
  return this._appliesTo;
29
30
  }
30
31
  /**
@@ -47,14 +48,14 @@ export class CustomAttributeClass extends ECClass {
47
48
  super.fromJSONSync(customAttributeProps);
48
49
  const appliesTo = parseCustomAttributeContainerType(customAttributeProps.appliesTo);
49
50
  if (undefined === appliesTo)
50
- throw new ECObjectsError(ECObjectsStatus.InvalidContainerType, `${appliesTo} is not a valid CustomAttributeContainerType.`);
51
+ throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `${appliesTo} is not a valid CustomAttributeContainerType.`);
51
52
  this._appliesTo = appliesTo;
52
53
  }
53
54
  async fromJSON(customAttributeProps) {
54
55
  this.fromJSONSync(customAttributeProps);
55
56
  }
56
57
  /**
57
- * @alpha Used in schema editing.
58
+ * @internal
58
59
  */
59
60
  setAppliesTo(containerType) {
60
61
  this._appliesTo = containerType;
@@ -73,10 +74,11 @@ export class CustomAttributeClass extends ECClass {
73
74
  * Type assertion to check if the SchemaItem is of type CustomAttributeClass.
74
75
  * @param item The SchemaItem to check.
75
76
  * @returns The item cast to CustomAttributeClass if it is a CustomAttributeClass, undefined otherwise.
77
+ * @internal
76
78
  */
77
79
  static assertIsCustomAttributeClass(item) {
78
80
  if (!this.isCustomAttributeClass(item))
79
- throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.CustomAttributeClass}' (CustomAttributeClass)`);
81
+ throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.CustomAttributeClass}' (CustomAttributeClass)`);
80
82
  }
81
83
  }
82
84
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"CustomAttributeClass.js","sourceRoot":"","sources":["../../../src/Metadata/CustomAttributeClass.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EACL,qBAAqB,EAAgC,iCAAiC,EAAE,cAAc,GACvG,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,OAAO;IACtB,cAAc,GAAG,oBAAoB,CAAC,cAAc,CAAC;IACvE,MAAM,KAAc,cAAc,KAAK,OAAO,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC;IACjF,UAAU,CAAgC;IAEpD;;SAEK;IACL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,YAAY,CAAC,aAA2C;QAChE,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,sBAAsB,CAAC,IAAiB;QACpD,IAAI,IAAI,IAAI,IAAI,CAAC,cAAc,KAAK,cAAc,CAAC,oBAAoB;YACrE,OAAO,IAAI,CAAC;QAEd,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,4BAA4B,CAAC,IAAiB;QAC1D,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC;YACpC,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,qBAAqB,EAAE,aAAa,cAAc,CAAC,oBAAoB,0BAA0B,CAAC,CAAC;IAChJ,CAAC;CACF;AACD;;;GAGG;AACH,MAAM,OAAgB,cAAe,SAAQ,oBAAoB;CAGhE","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 { CustomAttributeClassProps } from \"../Deserialization/JsonProps\";\nimport {\n containerTypeToString, CustomAttributeContainerType, parseCustomAttributeContainerType, SchemaItemType,\n} from \"../ECObjects\";\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\nimport { ECClass } from \"./Class\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/**\n * A Typescript class representation of an ECCustomAttributeClass.\n * @beta\n */\nexport class CustomAttributeClass extends ECClass {\n public override readonly schemaItemType = CustomAttributeClass.schemaItemType;\n public static override get schemaItemType() { return SchemaItemType.CustomAttributeClass; }\n protected _appliesTo?: CustomAttributeContainerType;\n\n /**\n * @deprecated in 4.8 use [[appliesTo]]\n * */\n public get containerType(): CustomAttributeContainerType {\n return this.appliesTo;\n }\n\n public get appliesTo(): CustomAttributeContainerType {\n if (undefined === this._appliesTo)\n throw new ECObjectsError(ECObjectsStatus.InvalidContainerType, `The CustomAttributeClass ${this.name} does not have a CustomAttributeContainerType.`);\n return this._appliesTo;\n }\n\n /**\n * Save this CustomAttributeClasses 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): CustomAttributeClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.appliesTo = containerTypeToString(this.appliesTo);\n return schemaJson as CustomAttributeClassProps;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n itemElement.setAttribute(\"appliesTo\", containerTypeToString(this.appliesTo));\n return itemElement;\n }\n\n public override fromJSONSync(customAttributeProps: CustomAttributeClassProps) {\n super.fromJSONSync(customAttributeProps);\n const appliesTo = parseCustomAttributeContainerType(customAttributeProps.appliesTo);\n if (undefined === appliesTo)\n throw new ECObjectsError(ECObjectsStatus.InvalidContainerType, `${appliesTo} is not a valid CustomAttributeContainerType.`);\n this._appliesTo = appliesTo;\n }\n\n public override async fromJSON(customAttributeProps: CustomAttributeClassProps) {\n this.fromJSONSync(customAttributeProps);\n }\n\n /**\n * @alpha Used in schema editing.\n */\n protected setAppliesTo(containerType: CustomAttributeContainerType) {\n this._appliesTo = containerType;\n }\n\n /**\n * Type guard to check if the SchemaItem is of type CustomAttributeClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is a CustomAttributeClass, false otherwise.\n */\n public static isCustomAttributeClass(item?: SchemaItem): item is CustomAttributeClass {\n if (item && item.schemaItemType === SchemaItemType.CustomAttributeClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type CustomAttributeClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to CustomAttributeClass if it is a CustomAttributeClass, undefined otherwise.\n */\n public static assertIsCustomAttributeClass(item?: SchemaItem): asserts item is CustomAttributeClass {\n if (!this.isCustomAttributeClass(item))\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.CustomAttributeClass}' (CustomAttributeClass)`);\n }\n}\n/**\n * @internal\n * An abstract class used for Schema editing.\n */\nexport abstract class MutableCAClass extends CustomAttributeClass {\n public abstract override setAppliesTo(containerType: CustomAttributeContainerType): void;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
1
+ {"version":3,"file":"CustomAttributeClass.js","sourceRoot":"","sources":["../../../src/Metadata/CustomAttributeClass.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EACL,qBAAqB,EAAgC,iCAAiC,EAAE,cAAc,GACvG,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,OAAO;IACtB,cAAc,GAAG,oBAAoB,CAAC,cAAc,CAAC;IAC9E,gBAAgB;IACT,MAAM,KAAc,cAAc,KAAK,OAAO,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC;IACnF,UAAU,CAAgC;IAElD;;SAEK;IACL,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAW,SAAS;QAClB,IAAI,SAAS,KAAK,IAAI,CAAC,UAAU;YAC/B,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,oBAAoB,EAAE,4BAA4B,IAAI,CAAC,IAAI,gDAAgD,CAAC,CAAC;QACtJ,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACa,MAAM,CAAC,aAAsB,KAAK,EAAE,uBAAgC,KAAK;QACvF,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,oBAAoB,CAAQ,CAAC;QACz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AAa,cAAc,CAAC,oBAAoB,0BAA0B,CAAC,CAAC;IAC9I,CAAC;CACF;AACD;;;GAGG;AACH,MAAM,OAAgB,cAAe,SAAQ,oBAAoB;CAGhE","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 { CustomAttributeClassProps } from \"../Deserialization/JsonProps\";\r\nimport {\r\n containerTypeToString, CustomAttributeContainerType, parseCustomAttributeContainerType, SchemaItemType,\r\n} from \"../ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\r\nimport { ECClass } from \"./Class\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\n\r\n/**\r\n * A Typescript class representation of an ECCustomAttributeClass.\r\n * @public @preview\r\n */\r\nexport class CustomAttributeClass extends ECClass {\r\n public override readonly schemaItemType = CustomAttributeClass.schemaItemType;\r\n /** @internal */\r\n public static override get schemaItemType() { return SchemaItemType.CustomAttributeClass; }\r\n private _appliesTo?: CustomAttributeContainerType;\r\n\r\n /**\r\n * @deprecated in 4.8 use [[appliesTo]]\r\n * */\r\n public get containerType(): CustomAttributeContainerType {\r\n return this.appliesTo;\r\n }\r\n\r\n public get appliesTo(): CustomAttributeContainerType {\r\n if (undefined === this._appliesTo)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `The CustomAttributeClass ${this.name} does not have a CustomAttributeContainerType.`);\r\n return this._appliesTo;\r\n }\r\n\r\n /**\r\n * Save this CustomAttributeClasses 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): CustomAttributeClassProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n schemaJson.appliesTo = containerTypeToString(this.appliesTo);\r\n return schemaJson as CustomAttributeClassProps;\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(\"appliesTo\", containerTypeToString(this.appliesTo));\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(customAttributeProps: CustomAttributeClassProps) {\r\n super.fromJSONSync(customAttributeProps);\r\n const appliesTo = parseCustomAttributeContainerType(customAttributeProps.appliesTo);\r\n if (undefined === appliesTo)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `${appliesTo} is not a valid CustomAttributeContainerType.`);\r\n this._appliesTo = appliesTo;\r\n }\r\n\r\n public override async fromJSON(customAttributeProps: CustomAttributeClassProps) {\r\n this.fromJSONSync(customAttributeProps);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected setAppliesTo(containerType: CustomAttributeContainerType) {\r\n this._appliesTo = containerType;\r\n }\r\n\r\n /**\r\n * Type guard to check if the SchemaItem is of type CustomAttributeClass.\r\n * @param item The SchemaItem to check.\r\n * @returns True if the item is a CustomAttributeClass, false otherwise.\r\n */\r\n public static isCustomAttributeClass(item?: SchemaItem): item is CustomAttributeClass {\r\n if (item && item.schemaItemType === SchemaItemType.CustomAttributeClass)\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Type assertion to check if the SchemaItem is of type CustomAttributeClass.\r\n * @param item The SchemaItem to check.\r\n * @returns The item cast to CustomAttributeClass if it is a CustomAttributeClass, undefined otherwise.\r\n * @internal\r\n */\r\n public static assertIsCustomAttributeClass(item?: SchemaItem): asserts item is CustomAttributeClass {\r\n if (!this.isCustomAttributeClass(item))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.CustomAttributeClass}' (CustomAttributeClass)`);\r\n }\r\n}\r\n/**\r\n * @internal\r\n * An abstract class used for Schema editing.\r\n */\r\nexport abstract class MutableCAClass extends CustomAttributeClass {\r\n public abstract override setAppliesTo(containerType: CustomAttributeContainerType): void;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
@@ -11,17 +11,19 @@ import { RelationshipClass } from "./RelationshipClass";
11
11
  import { SchemaItem } from "./SchemaItem";
12
12
  /**
13
13
  * A Typescript class representation of an ECEntityClass.
14
- * @beta
14
+ * @public @preview
15
15
  */
16
16
  export declare class EntityClass extends ECClass implements HasMixins {
17
17
  readonly schemaItemType: SchemaItemType;
18
+ /** @internal */
18
19
  static get schemaItemType(): SchemaItemType;
19
- protected _mixins?: LazyLoadedMixin[];
20
- get mixins(): LazyLoadedMixin[];
20
+ private _mixins?;
21
+ get mixins(): ReadonlyArray<LazyLoadedMixin>;
21
22
  getMixinsSync(): Iterable<Mixin>;
22
23
  /**
23
24
  *
24
25
  * @param mixin
26
+ * @internal
25
27
  */
26
28
  protected addMixin(mixin: Mixin): void;
27
29
  /**
@@ -34,13 +36,26 @@ export declare class EntityClass extends ECClass implements HasMixins {
34
36
  * @param name The name of the property to find.
35
37
  */
36
38
  getInheritedPropertySync(name: string): Property | undefined;
39
+ /**
40
+ *
41
+ * @param result
42
+ * @param existingValues
43
+ * @internal
44
+ */
37
45
  protected buildPropertyCache(result: Property[], existingValues?: Map<string, number>): Promise<void>;
46
+ /**
47
+ *
48
+ * @param result
49
+ * @param existingValues
50
+ * @internal
51
+ */
38
52
  protected buildPropertyCacheSync(result: Property[], existingValues?: Map<string, number>): void;
39
53
  /**
40
54
  *
41
55
  * @param name
42
56
  * @param relationship
43
57
  * @param direction
58
+ * @internal
44
59
  */
45
60
  protected createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;
46
61
  /**
@@ -48,6 +63,7 @@ export declare class EntityClass extends ECClass implements HasMixins {
48
63
  * @param name
49
64
  * @param relationship
50
65
  * @param direction
66
+ * @internal
51
67
  */
52
68
  protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;
53
69
  /**
@@ -70,6 +86,7 @@ export declare class EntityClass extends ECClass implements HasMixins {
70
86
  * Type assertion to check if the SchemaItem is of type EntityClass.
71
87
  * @param item The SchemaItem to check.
72
88
  * @returns The item cast to EntityClass if it is an EntityClass, undefined otherwise.
89
+ * @internal
73
90
  */
74
91
  static assertIsEntityClass(item?: SchemaItem): asserts item is EntityClass;
75
92
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EntityClass.d.ts","sourceRoot":"","sources":["../../../src/Metadata/EntityClass.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAA0B,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEzF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH,qBAAa,WAAY,SAAQ,OAAQ,YAAW,SAAS;IAC3D,SAAyB,cAAc,iBAA8B;IACrE,WAA2B,cAAc,mBAAyC;IAClF,SAAS,CAAC,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAEtC,IAAW,MAAM,IAAI,eAAe,EAAE,CAIrC;IAEO,aAAa,IAAI,QAAQ,CAAC,KAAK,CAAC;IAYxC;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK;IAQ/B;;;OAGG;IACmB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CA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
8
  import { DelayedPromiseWithProps } from "../DelayedPromise";
9
9
  import { XmlSerializationUtils } from "../Deserialization/XmlSerializationUtils";
10
10
  import { parseStrengthDirection, SchemaItemType } from "../ECObjects";
11
- import { ECObjectsError, ECObjectsStatus } from "../Exception";
11
+ import { ECSchemaError, ECSchemaStatus } from "../Exception";
12
12
  import { ECClass } from "./Class";
13
13
  import { Mixin } from "./Mixin";
14
14
  import { NavigationProperty } from "./Property";
15
15
  import { RelationshipClass } from "./RelationshipClass";
16
16
  /**
17
17
  * A Typescript class representation of an ECEntityClass.
18
- * @beta
18
+ * @public @preview
19
19
  */
20
20
  export class EntityClass extends ECClass {
21
21
  schemaItemType = EntityClass.schemaItemType;
22
+ /** @internal */
22
23
  static get schemaItemType() { return SchemaItemType.EntityClass; }
23
24
  _mixins;
24
25
  get mixins() {
@@ -28,7 +29,7 @@ export class EntityClass extends ECClass {
28
29
  }
29
30
  *getMixinsSync() {
30
31
  if (!this._mixins)
31
- return function* () { }(); // empty iterable
32
+ return;
32
33
  for (const mixin of this._mixins) {
33
34
  const mObj = this.schema.lookupItemSync(mixin, Mixin);
34
35
  if (mObj) {
@@ -39,6 +40,7 @@ export class EntityClass extends ECClass {
39
40
  /**
40
41
  *
41
42
  * @param mixin
43
+ * @internal
42
44
  */
43
45
  addMixin(mixin) {
44
46
  if (!this._mixins)
@@ -83,6 +85,12 @@ export class EntityClass extends ECClass {
83
85
  }
84
86
  return undefined;
85
87
  }
88
+ /**
89
+ *
90
+ * @param result
91
+ * @param existingValues
92
+ * @internal
93
+ */
86
94
  async buildPropertyCache(result, existingValues) {
87
95
  if (!existingValues) {
88
96
  existingValues = new Map();
@@ -95,9 +103,15 @@ export class EntityClass extends ECClass {
95
103
  const resolvedMixin = await mixin;
96
104
  ECClass.mergeProperties(result, existingValues, await resolvedMixin.getProperties(), false);
97
105
  }
98
- const localProps = await this.getProperties(true);
106
+ const localProps = await this.getProperties();
99
107
  ECClass.mergeProperties(result, existingValues, localProps, true);
100
108
  }
109
+ /**
110
+ *
111
+ * @param result
112
+ * @param existingValues
113
+ * @internal
114
+ */
101
115
  buildPropertyCacheSync(result, existingValues) {
102
116
  if (!existingValues) {
103
117
  existingValues = new Map();
@@ -117,6 +131,7 @@ export class EntityClass extends ECClass {
117
131
  * @param name
118
132
  * @param relationship
119
133
  * @param direction
134
+ * @internal
120
135
  */
121
136
  async createNavigationProperty(name, relationship, direction) {
122
137
  return this.addProperty(await createNavigationProperty(this, name, relationship, direction));
@@ -126,6 +141,7 @@ export class EntityClass extends ECClass {
126
141
  * @param name
127
142
  * @param relationship
128
143
  * @param direction
144
+ * @internal
129
145
  */
130
146
  createNavigationPropertySync(name, relationship, direction) {
131
147
  return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));
@@ -144,7 +160,8 @@ export class EntityClass extends ECClass {
144
160
  /** @internal */
145
161
  async toXml(schemaXml) {
146
162
  const itemElement = await super.toXml(schemaXml);
147
- for (const mixin of this.getMixinsSync()) {
163
+ for (const lazyMixin of this.mixins) {
164
+ const mixin = await lazyMixin;
148
165
  const mixinElement = schemaXml.createElement("BaseClass");
149
166
  const mixinName = XmlSerializationUtils.createXmlTypedName(this.schema, mixin.schema, mixin.name);
150
167
  mixinElement.textContent = mixinName;
@@ -163,11 +180,11 @@ export class EntityClass extends ECClass {
163
180
  for (const name of entityClassProps.mixins) {
164
181
  const mixinSchemaItemKey = this.schema.getSchemaItemKey(name);
165
182
  if (!mixinSchemaItemKey)
166
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin ("${name}") that cannot be found.`);
183
+ throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin ("${name}") that cannot be found.`);
167
184
  this._mixins.push(new DelayedPromiseWithProps(mixinSchemaItemKey, async () => {
168
185
  const mixin = await this.schema.lookupItem(mixinSchemaItemKey, Mixin);
169
186
  if (undefined === mixin)
170
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin ("${name}") that cannot be found.`);
187
+ throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin ("${name}") that cannot be found.`);
171
188
  return mixin;
172
189
  }));
173
190
  }
@@ -187,10 +204,11 @@ export class EntityClass extends ECClass {
187
204
  * Type assertion to check if the SchemaItem is of type EntityClass.
188
205
  * @param item The SchemaItem to check.
189
206
  * @returns The item cast to EntityClass if it is an EntityClass, undefined otherwise.
207
+ * @internal
190
208
  */
191
209
  static assertIsEntityClass(item) {
192
210
  if (!this.isEntityClass(item))
193
- throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.EntityClass}' (EntityClass)`);
211
+ throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.EntityClass}' (EntityClass)`);
194
212
  }
195
213
  }
196
214
  /**
@@ -201,8 +219,8 @@ export class MutableEntityClass extends EntityClass {
201
219
  }
202
220
  /** @internal */
203
221
  export async function createNavigationProperty(ecClass, name, relationship, direction) {
204
- if (await ecClass.getProperty(name))
205
- throw new ECObjectsError(ECObjectsStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);
222
+ if (await ecClass.getProperty(name, true))
223
+ throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);
206
224
  let resolvedRelationship;
207
225
  if (typeof (relationship) === "string") {
208
226
  resolvedRelationship = await ecClass.schema.lookupItem(relationship, RelationshipClass);
@@ -210,11 +228,11 @@ export async function createNavigationProperty(ecClass, name, relationship, dire
210
228
  else
211
229
  resolvedRelationship = relationship;
212
230
  if (!resolvedRelationship)
213
- throw new ECObjectsError(ECObjectsStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string
231
+ throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string
214
232
  if (typeof (direction) === "string") {
215
233
  const tmpDirection = parseStrengthDirection(direction);
216
234
  if (undefined === tmpDirection)
217
- throw new ECObjectsError(ECObjectsStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);
235
+ throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);
218
236
  direction = tmpDirection;
219
237
  }
220
238
  const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);
@@ -223,7 +241,7 @@ export async function createNavigationProperty(ecClass, name, relationship, dire
223
241
  /** @internal */
224
242
  export function createNavigationPropertySync(ecClass, name, relationship, direction) {
225
243
  if (ecClass.getPropertySync(name))
226
- throw new ECObjectsError(ECObjectsStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);
244
+ throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);
227
245
  let resolvedRelationship;
228
246
  if (typeof (relationship) === "string") {
229
247
  resolvedRelationship = ecClass.schema.lookupItemSync(relationship, RelationshipClass);
@@ -231,11 +249,11 @@ export function createNavigationPropertySync(ecClass, name, relationship, direct
231
249
  else
232
250
  resolvedRelationship = relationship;
233
251
  if (!resolvedRelationship)
234
- throw new ECObjectsError(ECObjectsStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string
252
+ throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string
235
253
  if (typeof (direction) === "string") {
236
254
  const tmpDirection = parseStrengthDirection(direction);
237
255
  if (undefined === tmpDirection)
238
- throw new ECObjectsError(ECObjectsStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);
256
+ throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);
239
257
  direction = tmpDirection;
240
258
  }
241
259
  const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);
@@ -1 +1 @@
1
- {"version":3,"file":"EntityClass.js","sourceRoot":"","sources":["../../../src/Metadata/EntityClass.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAqB,MAAM,cAAc,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAe,kBAAkB,EAAY,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAO;IACb,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC;IAC9D,MAAM,KAAc,cAAc,KAAK,OAAO,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;IACxE,OAAO,CAAqB;IAEtC,IAAW,MAAM;QACf,IAAI,CAAC,IAAI,CAAC,OAAO;YACf,OAAO,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEM,CAAC,aAAa;QACnB,IAAI,CAAC,IAAI,CAAC,OAAO;YACf,OAAO,QAAQ,CAAC,MAAuB,CAAC,EAAE,CAAC,CAAC,iBAAiB;QAE/D,KAAK,MAAM,KAA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xD,IAAI,OAAO,CAAC,YAAY,CAAC,KAAK,QAAQ,EAAE,CAAC;QACvC,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;IACxF,CAAC;;QACC,oBAAoB,GAAG,YAAY,CAAC;IAEtC,IAAI,CAAC,oBAAoB;QACvB,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,WAAW,EAAE,mCAAmC,YAAY,8CAA8C,CAAC,CAAC,CAAE,2DAA2D;IAEpN,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,YAAY,GAAG,sBAAsB,CAAC,SAAS,CAAC,CAAC;QACvD,IAAI,SAAS,KAAK,YAAY;YAC5B,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,wBAAwB,EAAE,mCAAmC,SAAS,qCAAqC,CAAC,CAAC;QACxJ,SAAS,GAAG,YAAY,CAAC;IAC3B,CAAC;IAED,MAAM,gBAAgB,GAAG,IAAI,uBAAuB,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,oBAAoB,CAAC,CAAC;IACjH,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\nimport { EntityClassProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { parseStrengthDirection, SchemaItemType, StrengthDirection } from \"../ECObjects\";\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\nimport { HasMixins, LazyLoadedMixin } from \"../Interfaces\";\nimport { SchemaItemKey } from \"../SchemaKey\";\nimport { ECClass } from \"./Class\";\nimport { Mixin } from \"./Mixin\";\nimport { AnyProperty, NavigationProperty, Property } from \"./Property\";\nimport { RelationshipClass } from \"./RelationshipClass\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/**\n * A Typescript class representation of an ECEntityClass.\n * @beta\n */\nexport class EntityClass extends ECClass implements HasMixins {\n public override readonly schemaItemType = EntityClass.schemaItemType;\n public static override get schemaItemType() { return SchemaItemType.EntityClass; }\n protected _mixins?: LazyLoadedMixin[];\n\n public get mixins(): LazyLoadedMixin[] {\n if (!this._mixins)\n return [];\n return this._mixins;\n }\n\n public *getMixinsSync(): Iterable<Mixin> {\n if (!this._mixins)\n return function* (): Iterable<Mixin> { }(); // empty iterable\n\n for (const mixin of this._mixins) {\n const mObj = this.schema.lookupItemSync(mixin, Mixin);\n if (mObj) {\n yield mObj;\n }\n }\n }\n\n /**\n *\n * @param mixin\n */\n protected addMixin(mixin: Mixin) {\n if (!this._mixins)\n this._mixins = [];\n\n this._mixins.push(new DelayedPromiseWithProps(mixin.key, async () => mixin));\n return;\n }\n\n /**\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\n * @param name The name of the property to find.\n */\n public override async getInheritedProperty(name: string): Promise<AnyProperty | undefined> {\n let inheritedProperty = await super.getInheritedProperty(name);\n\n if (!inheritedProperty && this._mixins) {\n const mixinProps = await Promise.all(this._mixins.map(async (mixin) => (await mixin).getProperty(name)));\n mixinProps.some((prop) => {\n inheritedProperty = prop as AnyProperty;\n return inheritedProperty !== undefined;\n });\n }\n\n return inheritedProperty as AnyProperty | undefined;\n }\n\n /**\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\n * @param name The name of the property to find.\n */\n public override getInheritedPropertySync(name: string): Property | undefined {\n const inheritedProperty = super.getInheritedPropertySync(name);\n if (inheritedProperty)\n return inheritedProperty;\n\n if (!this._mixins) {\n return undefined;\n }\n\n for (const mixin of this._mixins) {\n const mObj = this.schema.lookupItemSync(mixin);\n if (mObj && ECClass.isECClass(mObj)) {\n const result = mObj.getPropertySync(name, true);\n if (result) {\n return result;\n }\n }\n }\n\n return undefined;\n }\n\n protected override async buildPropertyCache(result: Property[], existingValues?: Map<string, number>): Promise<void> {\n if (!existingValues) {\n existingValues = new Map<string, number>();\n }\n\n const baseClass = await this.baseClass;\n if(baseClass) {\n ECClass.mergeProperties(result, existingValues, await baseClass.getProperties(), false);\n }\n\n for (const mixin of this.mixins) {\n const resolvedMixin = await mixin;\n ECClass.mergeProperties(result, existingValues, await resolvedMixin.getProperties(), false);\n }\n\n const localProps = await this.getProperties(true);\n ECClass.mergeProperties(result, existingValues, localProps, true);\n }\n\n protected override buildPropertyCacheSync(result: Property[], existingValues?: Map<string, number>): void {\n if (!existingValues) {\n existingValues = new Map<string, number>();\n }\n\n const baseClass = this.getBaseClassSync();\n if (baseClass) {\n ECClass.mergeProperties(result, existingValues, baseClass.getPropertiesSync(), false);\n }\n\n for (const mixin of this.getMixinsSync()) {\n ECClass.mergeProperties(result, existingValues, mixin.getPropertiesSync(), false);\n }\n\n const localProps = this.getPropertiesSync(true);\n ECClass.mergeProperties(result, existingValues, localProps, true);\n }\n\n /**\n *\n * @param name\n * @param relationship\n * @param direction\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 /**\n *\n * @param name\n * @param relationship\n * @param direction\n */\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 * Save this EntityClass' 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): EntityClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n if (this.mixins.length > 0)\n schemaJson.mixins = this.mixins.map((mixin) => mixin.fullName);\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n\n for (const mixin of this.getMixinsSync()) {\n const mixinElement = schemaXml.createElement(\"BaseClass\");\n const mixinName = XmlSerializationUtils.createXmlTypedName(this.schema, mixin.schema, mixin.name);\n mixinElement.textContent = mixinName;\n itemElement.appendChild(mixinElement);\n }\n return itemElement;\n }\n\n public override async fromJSON(entityClassProps: EntityClassProps) {\n this.fromJSONSync(entityClassProps);\n }\n\n public override fromJSONSync(entityClassProps: EntityClassProps) {\n super.fromJSONSync(entityClassProps);\n\n if (undefined !== entityClassProps.mixins) {\n if (!this._mixins)\n this._mixins = [];\n for (const name of entityClassProps.mixins) {\n const mixinSchemaItemKey = this.schema.getSchemaItemKey(name);\n if (!mixinSchemaItemKey)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\n this._mixins.push(new DelayedPromiseWithProps<SchemaItemKey, Mixin>(mixinSchemaItemKey,\n async () => {\n const mixin = await this.schema.lookupItem(mixinSchemaItemKey, Mixin);\n if (undefined === mixin)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\n return mixin;\n }));\n }\n }\n }\n\n /**\n * Type guard to check if the SchemaItem is of type EntityClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is an EntityClass, false otherwise.\n */\n public static isEntityClass(item?: SchemaItem): item is EntityClass {\n if (item && item.schemaItemType === SchemaItemType.EntityClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type EntityClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to EntityClass if it is an EntityClass, undefined otherwise.\n */\n public static assertIsEntityClass(item?: SchemaItem): asserts item is EntityClass {\n if(!this.isEntityClass(item))\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.EntityClass}' (EntityClass)`);\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 MutableEntityClass extends EntityClass {\n public abstract override addMixin(mixin: Mixin): any;\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\n/** @internal */\nexport async function createNavigationProperty(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\n if (await ecClass.getProperty(name))\n throw new ECObjectsError(ECObjectsStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\n\n let resolvedRelationship: RelationshipClass | undefined;\n if (typeof (relationship) === \"string\") {\n resolvedRelationship = await ecClass.schema.lookupItem(relationship, RelationshipClass);\n } else\n resolvedRelationship = relationship;\n\n if (!resolvedRelationship)\n throw new ECObjectsError(ECObjectsStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\n\n if (typeof (direction) === \"string\") {\n const tmpDirection = parseStrengthDirection(direction);\n if (undefined === tmpDirection)\n throw new ECObjectsError(ECObjectsStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\n direction = tmpDirection;\n }\n\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\n}\n\n/** @internal */\nexport function createNavigationPropertySync(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\n if (ecClass.getPropertySync(name))\n throw new ECObjectsError(ECObjectsStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\n\n let resolvedRelationship: RelationshipClass | undefined;\n if (typeof (relationship) === \"string\") {\n resolvedRelationship = ecClass.schema.lookupItemSync(relationship, RelationshipClass);\n } else\n resolvedRelationship = relationship;\n\n if (!resolvedRelationship)\n throw new ECObjectsError(ECObjectsStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\n\n if (typeof (direction) === \"string\") {\n const tmpDirection = parseStrengthDirection(direction);\n if (undefined === tmpDirection)\n throw new ECObjectsError(ECObjectsStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\n direction = tmpDirection;\n }\n\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\n}\n"]}
1
+ {"version":3,"file":"EntityClass.js","sourceRoot":"","sources":["../../../src/Metadata/EntityClass.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAqB,MAAM,cAAc,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG7D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAe,kBAAkB,EAAY,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAO;IACb,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC;IACrE,gBAAgB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------\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 { EntityClassProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { parseStrengthDirection, SchemaItemType, StrengthDirection } from \"../ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\r\nimport { HasMixins, LazyLoadedMixin } from \"../Interfaces\";\r\nimport { SchemaItemKey } from \"../SchemaKey\";\r\nimport { ECClass } from \"./Class\";\r\nimport { Mixin } from \"./Mixin\";\r\nimport { AnyProperty, NavigationProperty, Property } from \"./Property\";\r\nimport { RelationshipClass } from \"./RelationshipClass\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\n\r\n/**\r\n * A Typescript class representation of an ECEntityClass.\r\n * @public @preview\r\n */\r\nexport class EntityClass extends ECClass implements HasMixins {\r\n public override readonly schemaItemType = EntityClass.schemaItemType;\r\n /** @internal */\r\n public static override get schemaItemType() { return SchemaItemType.EntityClass; }\r\n private _mixins?: LazyLoadedMixin[];\r\n\r\n public get mixins(): ReadonlyArray<LazyLoadedMixin> {\r\n if (!this._mixins)\r\n return [];\r\n return this._mixins;\r\n }\r\n\r\n public *getMixinsSync(): Iterable<Mixin> {\r\n if (!this._mixins)\r\n return;\r\n\r\n for (const mixin of this._mixins) {\r\n const mObj = this.schema.lookupItemSync(mixin, Mixin);\r\n if (mObj) {\r\n yield mObj;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n *\r\n * @param mixin\r\n * @internal\r\n */\r\n protected addMixin(mixin: Mixin) {\r\n if (!this._mixins)\r\n this._mixins = [];\r\n\r\n this._mixins.push(new DelayedPromiseWithProps(mixin.key, async () => mixin));\r\n return;\r\n }\r\n\r\n /**\r\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\r\n * @param name The name of the property to find.\r\n */\r\n public override async getInheritedProperty(name: string): Promise<AnyProperty | undefined> {\r\n let inheritedProperty = await super.getInheritedProperty(name);\r\n\r\n if (!inheritedProperty && this._mixins) {\r\n const mixinProps = await Promise.all(this._mixins.map(async (mixin) => (await mixin).getProperty(name)));\r\n mixinProps.some((prop) => {\r\n inheritedProperty = prop as AnyProperty;\r\n return inheritedProperty !== undefined;\r\n });\r\n }\r\n\r\n return inheritedProperty as AnyProperty | undefined;\r\n }\r\n\r\n /**\r\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\r\n * @param name The name of the property to find.\r\n */\r\n public override getInheritedPropertySync(name: string): Property | undefined {\r\n const inheritedProperty = super.getInheritedPropertySync(name);\r\n if (inheritedProperty)\r\n return inheritedProperty;\r\n\r\n if (!this._mixins) {\r\n return undefined;\r\n }\r\n\r\n for (const mixin of this._mixins) {\r\n const mObj = this.schema.lookupItemSync(mixin);\r\n if (mObj && ECClass.isECClass(mObj)) {\r\n const result = mObj.getPropertySync(name, true);\r\n if (result) {\r\n return result;\r\n }\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n *\r\n * @param result\r\n * @param existingValues\r\n * @internal\r\n */\r\n protected override async buildPropertyCache(result: Property[], existingValues?: Map<string, number>): Promise<void> {\r\n if (!existingValues) {\r\n existingValues = new Map<string, number>();\r\n }\r\n\r\n const baseClass = await this.baseClass;\r\n if (baseClass) {\r\n ECClass.mergeProperties(result, existingValues, await baseClass.getProperties(), false);\r\n }\r\n\r\n for (const mixin of this.mixins) {\r\n const resolvedMixin = await mixin;\r\n ECClass.mergeProperties(result, existingValues, await resolvedMixin.getProperties(), false);\r\n }\r\n\r\n const localProps = await this.getProperties();\r\n ECClass.mergeProperties(result, existingValues, localProps, true);\r\n }\r\n\r\n /**\r\n *\r\n * @param result\r\n * @param existingValues\r\n * @internal\r\n */\r\n protected override buildPropertyCacheSync(result: Property[], existingValues?: Map<string, number>): void {\r\n if (!existingValues) {\r\n existingValues = new Map<string, number>();\r\n }\r\n\r\n const baseClass = this.getBaseClassSync();\r\n if (baseClass) {\r\n ECClass.mergeProperties(result, existingValues, baseClass.getPropertiesSync(), false);\r\n }\r\n\r\n for (const mixin of this.getMixinsSync()) {\r\n ECClass.mergeProperties(result, existingValues, mixin.getPropertiesSync(), false);\r\n }\r\n\r\n const localProps = this.getPropertiesSync(true);\r\n ECClass.mergeProperties(result, existingValues, localProps, true);\r\n }\r\n\r\n /**\r\n *\r\n * @param name\r\n * @param relationship\r\n * @param direction\r\n * @internal\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 /**\r\n *\r\n * @param name\r\n * @param relationship\r\n * @param direction\r\n * @internal\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 * Save this EntityClass' 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): EntityClassProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n if (this.mixins.length > 0)\r\n schemaJson.mixins = this.mixins.map((mixin) => mixin.fullName);\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\r\n for (const lazyMixin of this.mixins) {\r\n const mixin = await lazyMixin;\r\n const mixinElement = schemaXml.createElement(\"BaseClass\");\r\n const mixinName = XmlSerializationUtils.createXmlTypedName(this.schema, mixin.schema, mixin.name);\r\n mixinElement.textContent = mixinName;\r\n itemElement.appendChild(mixinElement);\r\n }\r\n return itemElement;\r\n }\r\n\r\n public override async fromJSON(entityClassProps: EntityClassProps) {\r\n this.fromJSONSync(entityClassProps);\r\n }\r\n\r\n public override fromJSONSync(entityClassProps: EntityClassProps) {\r\n super.fromJSONSync(entityClassProps);\r\n\r\n if (undefined !== entityClassProps.mixins) {\r\n if (!this._mixins)\r\n this._mixins = [];\r\n for (const name of entityClassProps.mixins) {\r\n const mixinSchemaItemKey = this.schema.getSchemaItemKey(name);\r\n if (!mixinSchemaItemKey)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\r\n this._mixins.push(new DelayedPromiseWithProps<SchemaItemKey, Mixin>(mixinSchemaItemKey,\r\n async () => {\r\n const mixin = await this.schema.lookupItem(mixinSchemaItemKey, Mixin);\r\n if (undefined === mixin)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\r\n return mixin;\r\n }));\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Type guard to check if the SchemaItem is of type EntityClass.\r\n * @param item The SchemaItem to check.\r\n * @returns True if the item is an EntityClass, false otherwise.\r\n */\r\n public static isEntityClass(item?: SchemaItem): item is EntityClass {\r\n if (item && item.schemaItemType === SchemaItemType.EntityClass)\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Type assertion to check if the SchemaItem is of type EntityClass.\r\n * @param item The SchemaItem to check.\r\n * @returns The item cast to EntityClass if it is an EntityClass, undefined otherwise.\r\n * @internal\r\n */\r\n public static assertIsEntityClass(item?: SchemaItem): asserts item is EntityClass {\r\n if (!this.isEntityClass(item))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.EntityClass}' (EntityClass)`);\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 MutableEntityClass extends EntityClass {\r\n public abstract override addMixin(mixin: Mixin): any;\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\r\n/** @internal */\r\nexport async function createNavigationProperty(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\r\n if (await ecClass.getProperty(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\r\n\r\n let resolvedRelationship: RelationshipClass | undefined;\r\n if (typeof (relationship) === \"string\") {\r\n resolvedRelationship = await ecClass.schema.lookupItem(relationship, RelationshipClass);\r\n } else\r\n resolvedRelationship = relationship;\r\n\r\n if (!resolvedRelationship)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\r\n\r\n if (typeof (direction) === \"string\") {\r\n const tmpDirection = parseStrengthDirection(direction);\r\n if (undefined === tmpDirection)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\r\n direction = tmpDirection;\r\n }\r\n\r\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\r\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\r\n}\r\n\r\n/** @internal */\r\nexport function createNavigationPropertySync(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\r\n if (ecClass.getPropertySync(name))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\r\n\r\n let resolvedRelationship: RelationshipClass | undefined;\r\n if (typeof (relationship) === \"string\") {\r\n resolvedRelationship = ecClass.schema.lookupItemSync(relationship, RelationshipClass);\r\n } else\r\n resolvedRelationship = relationship;\r\n\r\n if (!resolvedRelationship)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\r\n\r\n if (typeof (direction) === \"string\") {\r\n const tmpDirection = parseStrengthDirection(direction);\r\n if (undefined === tmpDirection)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\r\n direction = tmpDirection;\r\n }\r\n\r\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\r\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\r\n}\r\n"]}
@@ -5,28 +5,30 @@ import { EnumerationProps } from "../Deserialization/JsonProps";
5
5
  import { PrimitiveType, SchemaItemType } from "../ECObjects";
6
6
  import { Schema } from "./Schema";
7
7
  import { SchemaItem } from "./SchemaItem";
8
- /** @beta */
8
+ /** @public @preview */
9
9
  export interface Enumerator<T> {
10
10
  readonly name: string;
11
11
  readonly value: T;
12
12
  readonly label?: string;
13
13
  readonly description?: string;
14
14
  }
15
- /** @beta */
15
+ /** @public @preview */
16
16
  export type AnyEnumerator = Enumerator<string | number>;
17
17
  /**
18
18
  * A Typescript class representation of an ECEnumeration.
19
- * @beta
19
+ * @public @preview
20
20
  */
21
21
  export declare class Enumeration extends SchemaItem {
22
22
  readonly schemaItemType: SchemaItemType;
23
+ /** @internal */
23
24
  static get schemaItemType(): SchemaItemType;
24
- protected _type?: PrimitiveType.Integer | PrimitiveType.String;
25
- protected _isStrict: boolean;
26
- protected _enumerators: AnyEnumerator[];
27
- get enumerators(): AnyEnumerator[];
25
+ private _type?;
26
+ private _isStrict;
27
+ private _enumerators;
28
+ get enumerators(): ReadonlyArray<AnyEnumerator>;
28
29
  get type(): PrimitiveType.Integer | PrimitiveType.String | undefined;
29
30
  get isStrict(): boolean;
31
+ /** @internal */
30
32
  constructor(schema: Schema, name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String);
31
33
  get isInt(): boolean;
32
34
  get isString(): boolean;
@@ -55,11 +57,13 @@ export declare class Enumeration extends SchemaItem {
55
57
  * @param label A localized display label that is used instead of the name in a GUI.
56
58
  * @param description A localized description for the enumerator.
57
59
  * @return AnyEnumerator object
60
+ * @internal
58
61
  */
59
62
  createEnumerator(name: string, value: string | number, label?: string, description?: string): AnyEnumerator;
60
63
  /**
61
64
  * Adds enumerator to list of enumerators on this Enumeration
62
65
  * @param enumerator The enumerator to add
66
+ * @internal
63
67
  */
64
68
  protected addEnumerator(enumerator: AnyEnumerator): void;
65
69
  /**
@@ -73,7 +77,7 @@ export declare class Enumeration extends SchemaItem {
73
77
  fromJSONSync(enumerationProps: EnumerationProps): void;
74
78
  fromJSON(enumerationProps: EnumerationProps): Promise<void>;
75
79
  /**
76
- * @alpha Used in schema editing.
80
+ * @internal
77
81
  */
78
82
  protected setIsStrict(isStrict: boolean): void;
79
83
  /**
@@ -86,11 +90,14 @@ export declare class Enumeration extends SchemaItem {
86
90
  * Type assertion to check if the SchemaItem is of type Enumeration.
87
91
  * @param item The SchemaItem to check.
88
92
  * @returns The item cast to Enumeration if it is an Enumeration, undefined otherwise.
93
+ * @internal
89
94
  */
90
95
  static assertIsEnumeration(item?: SchemaItem): asserts item is Enumeration;
91
96
  }
92
- /** @internal
97
+ /**
93
98
  * An abstract class used for schema editing.
99
+ *
100
+ * @internal
94
101
  */
95
102
  export declare abstract class MutableEnumeration extends Enumeration {
96
103
  abstract addEnumerator(enumerator: AnyEnumerator): void;
@@ -1 +1 @@
1
- {"version":3,"file":"Enumeration.d.ts","sourceRoot":"","sources":["../../../src/Metadata/Enumeration.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH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