@itwin/ecschema-metadata 5.0.0-dev.98 → 5.0.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 (282) hide show
  1. package/CHANGELOG.md +61 -1
  2. package/lib/cjs/Context.d.ts +4 -4
  3. package/lib/cjs/Context.d.ts.map +1 -1
  4. package/lib/cjs/Context.js +7 -7
  5. package/lib/cjs/Context.js.map +1 -1
  6. package/lib/cjs/DelayedPromise.d.ts +9 -8
  7. package/lib/cjs/DelayedPromise.d.ts.map +1 -1
  8. package/lib/cjs/DelayedPromise.js +2 -2
  9. package/lib/cjs/DelayedPromise.js.map +1 -1
  10. package/lib/cjs/Deserialization/Helper.d.ts.map +1 -1
  11. package/lib/cjs/Deserialization/Helper.js +27 -26
  12. package/lib/cjs/Deserialization/Helper.js.map +1 -1
  13. package/lib/cjs/Deserialization/JsonParser.js +150 -150
  14. package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
  15. package/lib/cjs/Deserialization/JsonProps.d.ts +34 -34
  16. package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
  17. package/lib/cjs/Deserialization/JsonProps.js +3 -3
  18. package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
  19. package/lib/cjs/Deserialization/XmlParser.js +49 -49
  20. package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
  21. package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts +0 -5
  22. package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
  23. package/lib/cjs/Deserialization/XmlSerializationUtils.js +6 -11
  24. package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
  25. package/lib/cjs/ECName.d.ts +2 -2
  26. package/lib/cjs/ECName.js +4 -4
  27. package/lib/cjs/ECName.js.map +1 -1
  28. package/lib/cjs/ECObjects.d.ts +24 -12
  29. package/lib/cjs/ECObjects.d.ts.map +1 -1
  30. package/lib/cjs/ECObjects.js +48 -25
  31. package/lib/cjs/ECObjects.js.map +1 -1
  32. package/lib/cjs/Exception.d.ts +4 -4
  33. package/lib/cjs/Exception.d.ts.map +1 -1
  34. package/lib/cjs/Exception.js +60 -60
  35. package/lib/cjs/Exception.js.map +1 -1
  36. package/lib/cjs/Interfaces.d.ts +30 -34
  37. package/lib/cjs/Interfaces.d.ts.map +1 -1
  38. package/lib/cjs/Interfaces.js.map +1 -1
  39. package/lib/cjs/Metadata/Class.d.ts +107 -19
  40. package/lib/cjs/Metadata/Class.d.ts.map +1 -1
  41. package/lib/cjs/Metadata/Class.js +127 -47
  42. package/lib/cjs/Metadata/Class.js.map +1 -1
  43. package/lib/cjs/Metadata/Constant.d.ts +12 -9
  44. package/lib/cjs/Metadata/Constant.d.ts.map +1 -1
  45. package/lib/cjs/Metadata/Constant.js +12 -9
  46. package/lib/cjs/Metadata/Constant.js.map +1 -1
  47. package/lib/cjs/Metadata/CustomAttribute.d.ts +2 -2
  48. package/lib/cjs/Metadata/CustomAttribute.d.ts.map +1 -1
  49. package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
  50. package/lib/cjs/Metadata/CustomAttributeClass.d.ts +6 -4
  51. package/lib/cjs/Metadata/CustomAttributeClass.d.ts.map +1 -1
  52. package/lib/cjs/Metadata/CustomAttributeClass.js +8 -6
  53. package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
  54. package/lib/cjs/Metadata/EntityClass.d.ts +20 -3
  55. package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
  56. package/lib/cjs/Metadata/EntityClass.js +32 -14
  57. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  58. package/lib/cjs/Metadata/Enumeration.d.ts +16 -9
  59. package/lib/cjs/Metadata/Enumeration.d.ts.map +1 -1
  60. package/lib/cjs/Metadata/Enumeration.js +20 -13
  61. package/lib/cjs/Metadata/Enumeration.js.map +1 -1
  62. package/lib/cjs/Metadata/Format.d.ts +32 -24
  63. package/lib/cjs/Metadata/Format.d.ts.map +1 -1
  64. package/lib/cjs/Metadata/Format.js +47 -27
  65. package/lib/cjs/Metadata/Format.js.map +1 -1
  66. package/lib/cjs/Metadata/InvertedUnit.d.ts +11 -7
  67. package/lib/cjs/Metadata/InvertedUnit.d.ts.map +1 -1
  68. package/lib/cjs/Metadata/InvertedUnit.js +16 -10
  69. package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
  70. package/lib/cjs/Metadata/KindOfQuantity.d.ts +24 -15
  71. package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
  72. package/lib/cjs/Metadata/KindOfQuantity.js +54 -29
  73. package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
  74. package/lib/cjs/Metadata/Mixin.d.ts +16 -3
  75. package/lib/cjs/Metadata/Mixin.d.ts.map +1 -1
  76. package/lib/cjs/Metadata/Mixin.js +20 -7
  77. package/lib/cjs/Metadata/Mixin.js.map +1 -1
  78. package/lib/cjs/Metadata/OverrideFormat.d.ts +12 -12
  79. package/lib/cjs/Metadata/OverrideFormat.d.ts.map +1 -1
  80. package/lib/cjs/Metadata/OverrideFormat.js +27 -19
  81. package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
  82. package/lib/cjs/Metadata/Phenomenon.d.ts +10 -2
  83. package/lib/cjs/Metadata/Phenomenon.d.ts.map +1 -1
  84. package/lib/cjs/Metadata/Phenomenon.js +11 -3
  85. package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
  86. package/lib/cjs/Metadata/Property.d.ts +46 -28
  87. package/lib/cjs/Metadata/Property.d.ts.map +1 -1
  88. package/lib/cjs/Metadata/Property.js +46 -22
  89. package/lib/cjs/Metadata/Property.js.map +1 -1
  90. package/lib/cjs/Metadata/PropertyCategory.d.ts +6 -3
  91. package/lib/cjs/Metadata/PropertyCategory.d.ts.map +1 -1
  92. package/lib/cjs/Metadata/PropertyCategory.js +12 -5
  93. package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
  94. package/lib/cjs/Metadata/RelationshipClass.d.ts +48 -25
  95. package/lib/cjs/Metadata/RelationshipClass.d.ts.map +1 -1
  96. package/lib/cjs/Metadata/RelationshipClass.js +54 -34
  97. package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
  98. package/lib/cjs/Metadata/Schema.d.ts +50 -28
  99. package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
  100. package/lib/cjs/Metadata/Schema.js +64 -42
  101. package/lib/cjs/Metadata/Schema.js.map +1 -1
  102. package/lib/cjs/Metadata/SchemaItem.d.ts +10 -19
  103. package/lib/cjs/Metadata/SchemaItem.d.ts.map +1 -1
  104. package/lib/cjs/Metadata/SchemaItem.js +12 -20
  105. package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
  106. package/lib/cjs/Metadata/Unit.d.ts +17 -21
  107. package/lib/cjs/Metadata/Unit.d.ts.map +1 -1
  108. package/lib/cjs/Metadata/Unit.js +20 -22
  109. package/lib/cjs/Metadata/Unit.js.map +1 -1
  110. package/lib/cjs/Metadata/UnitSystem.d.ts +3 -1
  111. package/lib/cjs/Metadata/UnitSystem.d.ts.map +1 -1
  112. package/lib/cjs/Metadata/UnitSystem.js +4 -2
  113. package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
  114. package/lib/cjs/PropertyTypes.d.ts +11 -11
  115. package/lib/cjs/PropertyTypes.d.ts.map +1 -1
  116. package/lib/cjs/PropertyTypes.js +28 -20
  117. package/lib/cjs/PropertyTypes.js.map +1 -1
  118. package/lib/cjs/SchemaFormatsProvider.d.ts +39 -0
  119. package/lib/cjs/SchemaFormatsProvider.d.ts.map +1 -0
  120. package/lib/cjs/SchemaFormatsProvider.js +172 -0
  121. package/lib/cjs/SchemaFormatsProvider.js.map +1 -0
  122. package/lib/cjs/SchemaJsonLocater.d.ts +5 -5
  123. package/lib/cjs/SchemaJsonLocater.js +4 -4
  124. package/lib/cjs/SchemaJsonLocater.js.map +1 -1
  125. package/lib/cjs/SchemaKey.d.ts +6 -6
  126. package/lib/cjs/SchemaKey.d.ts.map +1 -1
  127. package/lib/cjs/SchemaKey.js +9 -9
  128. package/lib/cjs/SchemaKey.js.map +1 -1
  129. package/lib/cjs/SchemaLoader.d.ts +3 -3
  130. package/lib/cjs/SchemaLoader.js +4 -4
  131. package/lib/cjs/SchemaLoader.js.map +1 -1
  132. package/lib/cjs/SchemaPartVisitorDelegate.d.ts +2 -2
  133. package/lib/cjs/SchemaPartVisitorDelegate.js +1 -1
  134. package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
  135. package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
  136. package/lib/cjs/ecschema-metadata.d.ts +2 -1
  137. package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
  138. package/lib/cjs/ecschema-metadata.js +1 -0
  139. package/lib/cjs/ecschema-metadata.js.map +1 -1
  140. package/lib/cjs/utils/SchemaGraph.js +3 -3
  141. package/lib/cjs/utils/SchemaGraph.js.map +1 -1
  142. package/lib/esm/Context.d.ts +4 -4
  143. package/lib/esm/Context.d.ts.map +1 -1
  144. package/lib/esm/Context.js +8 -8
  145. package/lib/esm/Context.js.map +1 -1
  146. package/lib/esm/DelayedPromise.d.ts +9 -8
  147. package/lib/esm/DelayedPromise.d.ts.map +1 -1
  148. package/lib/esm/DelayedPromise.js +2 -2
  149. package/lib/esm/DelayedPromise.js.map +1 -1
  150. package/lib/esm/Deserialization/Helper.d.ts.map +1 -1
  151. package/lib/esm/Deserialization/Helper.js +28 -27
  152. package/lib/esm/Deserialization/Helper.js.map +1 -1
  153. package/lib/esm/Deserialization/JsonParser.js +151 -151
  154. package/lib/esm/Deserialization/JsonParser.js.map +1 -1
  155. package/lib/esm/Deserialization/JsonProps.d.ts +34 -34
  156. package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
  157. package/lib/esm/Deserialization/JsonProps.js +3 -3
  158. package/lib/esm/Deserialization/JsonProps.js.map +1 -1
  159. package/lib/esm/Deserialization/XmlParser.js +50 -50
  160. package/lib/esm/Deserialization/XmlParser.js.map +1 -1
  161. package/lib/esm/Deserialization/XmlSerializationUtils.d.ts +0 -5
  162. package/lib/esm/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
  163. package/lib/esm/Deserialization/XmlSerializationUtils.js +7 -12
  164. package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
  165. package/lib/esm/ECName.d.ts +2 -2
  166. package/lib/esm/ECName.js +5 -5
  167. package/lib/esm/ECName.js.map +1 -1
  168. package/lib/esm/ECObjects.d.ts +24 -12
  169. package/lib/esm/ECObjects.d.ts.map +1 -1
  170. package/lib/esm/ECObjects.js +49 -26
  171. package/lib/esm/ECObjects.js.map +1 -1
  172. package/lib/esm/Exception.d.ts +4 -4
  173. package/lib/esm/Exception.d.ts.map +1 -1
  174. package/lib/esm/Exception.js +58 -58
  175. package/lib/esm/Exception.js.map +1 -1
  176. package/lib/esm/Interfaces.d.ts +30 -34
  177. package/lib/esm/Interfaces.d.ts.map +1 -1
  178. package/lib/esm/Interfaces.js.map +1 -1
  179. package/lib/esm/Metadata/Class.d.ts +107 -19
  180. package/lib/esm/Metadata/Class.d.ts.map +1 -1
  181. package/lib/esm/Metadata/Class.js +128 -48
  182. package/lib/esm/Metadata/Class.js.map +1 -1
  183. package/lib/esm/Metadata/Constant.d.ts +12 -9
  184. package/lib/esm/Metadata/Constant.d.ts.map +1 -1
  185. package/lib/esm/Metadata/Constant.js +13 -10
  186. package/lib/esm/Metadata/Constant.js.map +1 -1
  187. package/lib/esm/Metadata/CustomAttribute.d.ts +2 -2
  188. package/lib/esm/Metadata/CustomAttribute.d.ts.map +1 -1
  189. package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
  190. package/lib/esm/Metadata/CustomAttributeClass.d.ts +6 -4
  191. package/lib/esm/Metadata/CustomAttributeClass.d.ts.map +1 -1
  192. package/lib/esm/Metadata/CustomAttributeClass.js +9 -7
  193. package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
  194. package/lib/esm/Metadata/EntityClass.d.ts +20 -3
  195. package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
  196. package/lib/esm/Metadata/EntityClass.js +33 -15
  197. package/lib/esm/Metadata/EntityClass.js.map +1 -1
  198. package/lib/esm/Metadata/Enumeration.d.ts +16 -9
  199. package/lib/esm/Metadata/Enumeration.d.ts.map +1 -1
  200. package/lib/esm/Metadata/Enumeration.js +21 -14
  201. package/lib/esm/Metadata/Enumeration.js.map +1 -1
  202. package/lib/esm/Metadata/Format.d.ts +32 -24
  203. package/lib/esm/Metadata/Format.d.ts.map +1 -1
  204. package/lib/esm/Metadata/Format.js +48 -28
  205. package/lib/esm/Metadata/Format.js.map +1 -1
  206. package/lib/esm/Metadata/InvertedUnit.d.ts +11 -7
  207. package/lib/esm/Metadata/InvertedUnit.d.ts.map +1 -1
  208. package/lib/esm/Metadata/InvertedUnit.js +17 -11
  209. package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
  210. package/lib/esm/Metadata/KindOfQuantity.d.ts +24 -15
  211. package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
  212. package/lib/esm/Metadata/KindOfQuantity.js +55 -30
  213. package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
  214. package/lib/esm/Metadata/Mixin.d.ts +16 -3
  215. package/lib/esm/Metadata/Mixin.d.ts.map +1 -1
  216. package/lib/esm/Metadata/Mixin.js +21 -8
  217. package/lib/esm/Metadata/Mixin.js.map +1 -1
  218. package/lib/esm/Metadata/OverrideFormat.d.ts +12 -12
  219. package/lib/esm/Metadata/OverrideFormat.d.ts.map +1 -1
  220. package/lib/esm/Metadata/OverrideFormat.js +28 -20
  221. package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
  222. package/lib/esm/Metadata/Phenomenon.d.ts +10 -2
  223. package/lib/esm/Metadata/Phenomenon.d.ts.map +1 -1
  224. package/lib/esm/Metadata/Phenomenon.js +12 -4
  225. package/lib/esm/Metadata/Phenomenon.js.map +1 -1
  226. package/lib/esm/Metadata/Property.d.ts +46 -28
  227. package/lib/esm/Metadata/Property.d.ts.map +1 -1
  228. package/lib/esm/Metadata/Property.js +47 -23
  229. package/lib/esm/Metadata/Property.js.map +1 -1
  230. package/lib/esm/Metadata/PropertyCategory.d.ts +6 -3
  231. package/lib/esm/Metadata/PropertyCategory.d.ts.map +1 -1
  232. package/lib/esm/Metadata/PropertyCategory.js +13 -6
  233. package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
  234. package/lib/esm/Metadata/RelationshipClass.d.ts +48 -25
  235. package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -1
  236. package/lib/esm/Metadata/RelationshipClass.js +55 -35
  237. package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
  238. package/lib/esm/Metadata/Schema.d.ts +50 -28
  239. package/lib/esm/Metadata/Schema.d.ts.map +1 -1
  240. package/lib/esm/Metadata/Schema.js +65 -43
  241. package/lib/esm/Metadata/Schema.js.map +1 -1
  242. package/lib/esm/Metadata/SchemaItem.d.ts +10 -19
  243. package/lib/esm/Metadata/SchemaItem.d.ts.map +1 -1
  244. package/lib/esm/Metadata/SchemaItem.js +13 -21
  245. package/lib/esm/Metadata/SchemaItem.js.map +1 -1
  246. package/lib/esm/Metadata/Unit.d.ts +17 -21
  247. package/lib/esm/Metadata/Unit.d.ts.map +1 -1
  248. package/lib/esm/Metadata/Unit.js +21 -23
  249. package/lib/esm/Metadata/Unit.js.map +1 -1
  250. package/lib/esm/Metadata/UnitSystem.d.ts +3 -1
  251. package/lib/esm/Metadata/UnitSystem.d.ts.map +1 -1
  252. package/lib/esm/Metadata/UnitSystem.js +5 -3
  253. package/lib/esm/Metadata/UnitSystem.js.map +1 -1
  254. package/lib/esm/PropertyTypes.d.ts +11 -11
  255. package/lib/esm/PropertyTypes.d.ts.map +1 -1
  256. package/lib/esm/PropertyTypes.js +29 -21
  257. package/lib/esm/PropertyTypes.js.map +1 -1
  258. package/lib/esm/SchemaFormatsProvider.d.ts +39 -0
  259. package/lib/esm/SchemaFormatsProvider.d.ts.map +1 -0
  260. package/lib/esm/SchemaFormatsProvider.js +168 -0
  261. package/lib/esm/SchemaFormatsProvider.js.map +1 -0
  262. package/lib/esm/SchemaJsonLocater.d.ts +5 -5
  263. package/lib/esm/SchemaJsonLocater.js +4 -4
  264. package/lib/esm/SchemaJsonLocater.js.map +1 -1
  265. package/lib/esm/SchemaKey.d.ts +6 -6
  266. package/lib/esm/SchemaKey.d.ts.map +1 -1
  267. package/lib/esm/SchemaKey.js +10 -10
  268. package/lib/esm/SchemaKey.js.map +1 -1
  269. package/lib/esm/SchemaLoader.d.ts +3 -3
  270. package/lib/esm/SchemaLoader.js +5 -5
  271. package/lib/esm/SchemaLoader.js.map +1 -1
  272. package/lib/esm/SchemaPartVisitorDelegate.d.ts +2 -2
  273. package/lib/esm/SchemaPartVisitorDelegate.js +1 -1
  274. package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
  275. package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
  276. package/lib/esm/ecschema-metadata.d.ts +2 -1
  277. package/lib/esm/ecschema-metadata.d.ts.map +1 -1
  278. package/lib/esm/ecschema-metadata.js +1 -0
  279. package/lib/esm/ecschema-metadata.js.map +1 -1
  280. package/lib/esm/utils/SchemaGraph.js +4 -4
  281. package/lib/esm/utils/SchemaGraph.js.map +1 -1
  282. package/package.json +12 -6
@@ -10,7 +10,7 @@ import { JsonParser } from "../Deserialization/JsonParser";
10
10
  import { XmlParser } from "../Deserialization/XmlParser";
11
11
  import { XmlSerializationUtils } from "../Deserialization/XmlSerializationUtils";
12
12
  import { isSupportedSchemaItemType } from "../ECObjects";
13
- import { ECObjectsError, ECObjectsStatus } from "../Exception";
13
+ import { ECSchemaError, ECSchemaStatus } from "../Exception";
14
14
  import { ECVersion, SchemaItemKey, SchemaKey } from "../SchemaKey";
15
15
  import { ECName } from "../ECName";
16
16
  import { ECClass, StructClass } from "./Class";
@@ -31,7 +31,7 @@ import { Unit } from "./Unit";
31
31
  import { UnitSystem } from "./UnitSystem";
32
32
  import { ECSchemaNamespaceUris } from "../Constants";
33
33
  /**
34
- * @beta
34
+ * @public @preview
35
35
  */
36
36
  export class Schema {
37
37
  static _currentECSpecVersion = "3.2";
@@ -55,34 +55,34 @@ export class Schema {
55
55
  this._alias = alias;
56
56
  }
57
57
  else if (nameOrKey !== undefined) {
58
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not have the required 'alias' attribute.`);
58
+ throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Schema ${this.name} does not have the required 'alias' attribute.`);
59
59
  }
60
60
  this._originalECSpecMajorVersion = Schema.currentECSpecMajorVersion;
61
61
  this._originalECSpecMinorVersion = Schema.currentECSpecMinorVersion;
62
62
  }
63
63
  get schemaKey() {
64
64
  if (undefined === this._schemaKey)
65
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);
65
+ throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);
66
66
  return this._schemaKey;
67
67
  }
68
68
  get name() {
69
69
  if (this._schemaKey === undefined)
70
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);
70
+ throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);
71
71
  return this.schemaKey.name;
72
72
  }
73
73
  get readVersion() {
74
74
  if (this._schemaKey === undefined)
75
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);
75
+ throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);
76
76
  return this.schemaKey.readVersion;
77
77
  }
78
78
  get writeVersion() {
79
79
  if (this._schemaKey === undefined)
80
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);
80
+ throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);
81
81
  return this.schemaKey.writeVersion;
82
82
  }
83
83
  get minorVersion() {
84
84
  if (this._schemaKey === undefined)
85
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);
85
+ throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);
86
86
  return this.schemaKey.minorVersion;
87
87
  }
88
88
  get originalECSpecMajorVersion() { return this._originalECSpecMajorVersion; }
@@ -95,7 +95,7 @@ export class Schema {
95
95
  }
96
96
  get alias() {
97
97
  if (this._alias === undefined || this._alias === null) {
98
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not have the required 'alias' attribute.`);
98
+ throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Schema ${this.name} does not have the required 'alias' attribute.`);
99
99
  }
100
100
  else {
101
101
  return this._alias;
@@ -120,18 +120,19 @@ export class Schema {
120
120
  if (this.name !== schemaName) {
121
121
  const newSchemaRef = this.getReferenceSync(schemaName);
122
122
  if (undefined === newSchemaRef)
123
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to find the referenced SchemaItem ${itemName}.`);
123
+ throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to find the referenced SchemaItem ${itemName}.`);
124
124
  schemaKey = newSchemaRef.schemaKey;
125
125
  }
126
126
  return new SchemaItemKey(itemName, schemaKey);
127
127
  }
128
+ /** @internal */
128
129
  addItem(item) {
129
130
  if (undefined !== this.getItemSync(item.name))
130
- throw new ECObjectsError(ECObjectsStatus.DuplicateItem, `The SchemaItem ${item.name} cannot be added to the schema ${this.name} because it already exists`);
131
+ throw new ECSchemaError(ECSchemaStatus.DuplicateItem, `The SchemaItem ${item.name} cannot be added to the schema ${this.name} because it already exists`);
131
132
  this._items.set(item.name.toUpperCase(), item);
132
133
  }
133
134
  /**
134
- * @alpha
135
+ * @internal
135
136
  */
136
137
  createClass(type, name, modifier) {
137
138
  const item = new type(this, name, modifier);
@@ -141,7 +142,7 @@ export class Schema {
141
142
  /**
142
143
  * Deletes a class from within this schema.
143
144
  * @param name the local (unqualified) class name, lookup is case-insensitive
144
- * @alpha
145
+ * @internal
145
146
  */
146
147
  async deleteClass(name) {
147
148
  const schemaItem = await this.getItem(name);
@@ -152,7 +153,7 @@ export class Schema {
152
153
  /**
153
154
  * Deletes a class from within this schema.
154
155
  * @param name the local (unqualified) class name, lookup is case-insensitive
155
- * @alpha
156
+ * @internal
156
157
  */
157
158
  deleteClassSync(name) {
158
159
  const schemaItem = this.getItemSync(name);
@@ -162,7 +163,7 @@ export class Schema {
162
163
  /**
163
164
  * Deletes a SchemaItem from within this schema.
164
165
  * @param name the local (unqualified) class name, lookup is case-insensitive
165
- * @alpha
166
+ * @internal
166
167
  */
167
168
  async deleteSchemaItem(name) {
168
169
  const schemaItem = await this.getItem(name);
@@ -173,21 +174,20 @@ export class Schema {
173
174
  /**
174
175
  * Deletes a SchemaItem from within this schema.
175
176
  * @param name the local (unqualified) class name, lookup is case-insensitive
176
- * @alpha
177
+ * @internal
177
178
  */
178
179
  deleteSchemaItemSync(name) {
179
180
  const schemaItem = this.getItemSync(name);
180
181
  if (SchemaItem.isSchemaItem(schemaItem))
181
182
  this._items.delete(name.toUpperCase());
182
183
  }
183
- /**
184
- * @alpha
185
- */
184
+ /** @internal */
186
185
  createItem(type, name) {
187
186
  const item = new type(this, name);
188
187
  this.addItem(item);
189
188
  return item;
190
189
  }
190
+ /** @internal */
191
191
  addCustomAttribute(customAttribute) {
192
192
  if (!this._customAttributes)
193
193
  this._customAttributes = new Map();
@@ -197,27 +197,33 @@ export class Schema {
197
197
  * Creates a EntityClass with the provided name in this schema.
198
198
  * @param name
199
199
  * @param modifier
200
+ * @internal
200
201
  */
201
202
  async createEntityClass(name, modifier) {
202
203
  return this.createClass(EntityClass, name, modifier);
203
204
  }
205
+ /** @internal */
204
206
  createEntityClassSync(name, modifier) {
205
207
  return this.createClass(EntityClass, name, modifier);
206
208
  }
207
209
  /**
208
210
  * Creates a Mixin with the provided name in this schema.
209
211
  * @param name
212
+ * @internal
210
213
  */
211
214
  async createMixinClass(name) { return this.createClass(Mixin, name); }
215
+ /** @internal */
212
216
  createMixinClassSync(name) { return this.createClass(Mixin, name); }
213
217
  /**
214
218
  * Creates a StructClass with the provided name in this schema.
215
219
  * @param name
216
220
  * @param modifier
221
+ * @internal
217
222
  */
218
223
  async createStructClass(name, modifier) {
219
224
  return this.createClass(StructClass, name, modifier);
220
225
  }
226
+ /** @internal */
221
227
  createStructClassSync(name, modifier) {
222
228
  return this.createClass(StructClass, name, modifier);
223
229
  }
@@ -225,10 +231,12 @@ export class Schema {
225
231
  * Creates a CustomAttributeClass with the provided name in this schema.
226
232
  * @param name
227
233
  * @param modifier
234
+ * @internal
228
235
  */
229
236
  async createCustomAttributeClass(name, modifier) {
230
237
  return this.createClass(CustomAttributeClass, name, modifier);
231
238
  }
239
+ /** @internal */
232
240
  createCustomAttributeClassSync(name, modifier) {
233
241
  return this.createClass(CustomAttributeClass, name, modifier);
234
242
  }
@@ -236,20 +244,26 @@ export class Schema {
236
244
  * Creates a RelationshipClass with the provided name in this schema.
237
245
  * @param name
238
246
  * @param modifier
247
+ * @internal
239
248
  */
240
249
  async createRelationshipClass(name, modifier) {
241
250
  return this.createRelationshipClassSync(name, modifier);
242
251
  }
252
+ /** @internal */
243
253
  createRelationshipClassSync(name, modifier) {
244
254
  return this.createClass(RelationshipClass, name, modifier);
245
255
  }
246
256
  /**
247
257
  * Creates an Enumeration with the provided name in this schema.
248
258
  * @param name
259
+ * @param primitiveType
260
+ *
261
+ * @internal
249
262
  */
250
263
  async createEnumeration(name, primitiveType) {
251
264
  return this.createEnumerationSync(name, primitiveType);
252
265
  }
266
+ /** @internal */
253
267
  createEnumerationSync(name, primitiveType) {
254
268
  const item = new Enumeration(this, name, primitiveType);
255
269
  this.addItem(item);
@@ -258,97 +272,113 @@ export class Schema {
258
272
  /**
259
273
  * Creates an KindOfQuantity with the provided name in this schema.
260
274
  * @param name
275
+ * @internal
261
276
  */
262
277
  async createKindOfQuantity(name) {
263
278
  return this.createKindOfQuantitySync(name);
264
279
  }
280
+ /** @internal */
265
281
  createKindOfQuantitySync(name) {
266
282
  return this.createItem(KindOfQuantity, name);
267
283
  }
268
284
  /**
269
285
  * Creates a Constant with the provided name in this schema.
270
286
  * @param name
287
+ * @internal
271
288
  */
272
289
  async createConstant(name) {
273
290
  return this.createItem(Constant, name);
274
291
  }
292
+ /** @internal */
275
293
  createConstantSync(name) {
276
294
  return this.createItem(Constant, name);
277
295
  }
278
296
  /**
279
297
  * Creates a Inverted Unit with the provided name in this schema.
280
298
  * @param name
299
+ * @internal
281
300
  */
282
301
  async createInvertedUnit(name) {
283
302
  return this.createItem(InvertedUnit, name);
284
303
  }
304
+ /** @internal */
285
305
  createInvertedUnitSync(name) {
286
306
  return this.createItem(InvertedUnit, name);
287
307
  }
288
308
  /**
289
309
  * Creates an Format with the provided name in this schema.
290
310
  * @param name
311
+ * @internal
291
312
  */
292
313
  async createFormat(name) {
293
314
  return this.createItem(Format, name);
294
315
  }
316
+ /** @internal */
295
317
  createFormatSync(name) {
296
318
  return this.createItem(Format, name);
297
319
  }
298
320
  /**
299
321
  * Creates a UnitSystem with the provided name in this schema.
300
322
  * @param name
323
+ * @internal
301
324
  */
302
325
  async createUnitSystem(name) {
303
326
  return this.createItem(UnitSystem, name);
304
327
  }
328
+ /** @internal */
305
329
  createUnitSystemSync(name) {
306
330
  return this.createItem(UnitSystem, name);
307
331
  }
308
332
  /**
309
333
  * Creates a Phenomenon with the provided name in this schema.
310
334
  * @param name
335
+ * @internal
311
336
  */
312
337
  async createPhenomenon(name) {
313
338
  return this.createItem(Phenomenon, name);
314
339
  }
340
+ /** @internal */
315
341
  createPhenomenonSync(name) {
316
342
  return this.createItem(Phenomenon, name);
317
343
  }
318
344
  /**
319
345
  * Creates a Unit with the provided name in this schema.
320
346
  * @param name
347
+ * @internal
321
348
  */
322
349
  async createUnit(name) {
323
350
  return this.createItem(Unit, name);
324
351
  }
352
+ /** @internal */
325
353
  createUnitSync(name) {
326
354
  return this.createItem(Unit, name);
327
355
  }
328
356
  /**
329
357
  * Creates an PropertyCategory with the provided name in this schema.
330
358
  * @param name
359
+ * @internal
331
360
  */
332
361
  async createPropertyCategory(name) {
333
362
  return this.createItem(PropertyCategory, name);
334
363
  }
364
+ /** @internal */
335
365
  createPropertyCategorySync(name) {
336
366
  return this.createItem(PropertyCategory, name);
337
367
  }
338
368
  /**
339
369
  *
340
370
  * @param refSchema
371
+ * @internal
341
372
  */
342
373
  async addReference(refSchema) {
343
374
  // TODO validation of reference schema. For now just adding
344
375
  this.addReferenceSync(refSchema);
345
376
  }
377
+ /** @internal */
346
378
  addReferenceSync(refSchema) {
347
379
  this.references.push(refSchema);
348
380
  }
349
- /**
350
- * @alpha Used for schema editing.
351
- */
381
+ /** @internal */
352
382
  setContext(context) {
353
383
  this._context = context;
354
384
  }
@@ -357,10 +387,11 @@ export class Schema {
357
387
  * @param readVersion The read version of the schema. If undefined, the value from the existing SchemaKey will be used.
358
388
  * @param writeVersion The write version of the schema. If undefined, the value from the existing SchemaKey will be used.
359
389
  * @param minorVersion The minor version of the schema. If undefined, the value from the existing SchemaKey will be used.
390
+ * @internal
360
391
  */
361
392
  setVersion(readVersion, writeVersion, minorVersion) {
362
393
  if (!this._schemaKey)
363
- throw new ECObjectsError(ECObjectsStatus.InvalidSchemaKey, `The schema '${this.name}' has an invalid SchemaKey.`);
394
+ throw new ECSchemaError(ECSchemaStatus.InvalidSchemaKey, `The schema '${this.name}' has an invalid SchemaKey.`);
364
395
  const newVersion = new ECVersion(readVersion ?? this._schemaKey.readVersion, writeVersion ?? this._schemaKey.writeVersion, minorVersion ?? this._schemaKey.minorVersion);
365
396
  this._schemaKey = new SchemaKey(this._schemaKey.name, newVersion);
366
397
  }
@@ -545,7 +576,7 @@ export class Schema {
545
576
  */
546
577
  toJSON() {
547
578
  if (this._isECSpecVersionUnsupported)
548
- throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECSpecVersion and cannot be serialized.`);
579
+ throw new ECSchemaError(ECSchemaStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECSpecVersion and cannot be serialized.`);
549
580
  const schemaJson = {};
550
581
  schemaJson.$schema = ECSchemaNamespaceUris.SCHEMAURL3_2_JSON; // $schema is required
551
582
  schemaJson.name = this.name; // name is required
@@ -574,7 +605,7 @@ export class Schema {
574
605
  */
575
606
  async toXml(schemaXml) {
576
607
  if (this._isECSpecVersionUnsupported)
577
- throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECSpecVersion and cannot be serialized.`);
608
+ throw new ECSchemaError(ECSchemaStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECSpecVersion and cannot be serialized.`);
578
609
  const schemaMetadata = schemaXml.createElement("ECSchema");
579
610
  schemaMetadata.setAttribute("xmlns", ECSchemaNamespaceUris.SCHEMAURL3_2_XML);
580
611
  schemaMetadata.setAttribute("version", this.schemaKey.version.toString());
@@ -620,12 +651,12 @@ export class Schema {
620
651
  }
621
652
  else {
622
653
  if (schemaProps.name.toLowerCase() !== this.name.toLowerCase())
623
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not match the provided name, '${schemaProps.name}'.`);
654
+ throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Schema ${this.name} does not match the provided name, '${schemaProps.name}'.`);
624
655
  if (this.schemaKey.version.compare(ECVersion.fromString(schemaProps.version)))
625
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} has the version '${this.schemaKey.version}' that does not match the provided version '${schemaProps.version}'.`);
656
+ throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Schema ${this.name} has the version '${this.schemaKey.version}' that does not match the provided version '${schemaProps.version}'.`);
626
657
  }
627
658
  if (schemaProps.$schema.match(`https://dev\\.bentley\\.com/json_schemas/ec/([0-9]+)/ecschema`) == null && schemaProps.$schema.match(`http://www\\.bentley\\.com/schemas/Bentley\\.ECXML\\.([0-9]+)`) == null)
628
- throw new ECObjectsError(ECObjectsStatus.MissingSchemaUrl, `The Schema '${this.name}' has an unsupported namespace '${schemaProps.$schema}'.`);
659
+ throw new ECSchemaError(ECSchemaStatus.MissingSchemaUrl, `The Schema '${this.name}' has an unsupported namespace '${schemaProps.$schema}'.`);
629
660
  // The schema props have not been parsed. Parse the ECXml version from the $schema attribute
630
661
  let ecVersion;
631
662
  if (schemaProps.ecSpecMajorVersion === undefined || schemaProps.ecSpecMinorVersion === undefined) {
@@ -637,12 +668,12 @@ export class Schema {
637
668
  this._originalECSpecMajorVersion = ecVersion.readVersion;
638
669
  this._originalECSpecMinorVersion = ecVersion.writeVersion;
639
670
  if (ecVersion.readVersion !== 3 || (ecVersion.readVersion === 3 && ecVersion.writeVersion < 2))
640
- throw new ECObjectsError(ECObjectsStatus.InvalidECVersion, `The Schema '${this.name}' has an unsupported ECVersion ${ecVersion.readVersion}.${ecVersion.writeVersion} and cannot be loaded.`);
671
+ throw new ECSchemaError(ECSchemaStatus.InvalidECVersion, `The Schema '${this.name}' has an unsupported ECVersion ${ecVersion.readVersion}.${ecVersion.writeVersion} and cannot be loaded.`);
641
672
  if (ECName.validate(schemaProps.alias)) {
642
673
  this._alias = schemaProps.alias;
643
674
  }
644
675
  else {
645
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${schemaProps.name} does not have the required 'alias' attribute.`);
676
+ throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Schema ${schemaProps.name} does not have the required 'alias' attribute.`);
646
677
  }
647
678
  if (undefined !== schemaProps.label)
648
679
  this._label = schemaProps.label;
@@ -689,27 +720,18 @@ export class Schema {
689
720
  const schema = object;
690
721
  return schema !== undefined && schema.schemaKey !== undefined && schema.context !== undefined;
691
722
  }
692
- /**
693
- * @alpha
694
- * Used for schema editing.
695
- */
723
+ /** @internal */
696
724
  setDisplayLabel(displayLabel) {
697
725
  this._label = displayLabel;
698
726
  }
699
- /**
700
- * @alpha
701
- * Used for schema editing.
702
- */
727
+ /** @internal */
703
728
  setDescription(description) {
704
729
  this._description = description;
705
730
  }
706
- /**
707
- * @alpha
708
- * Used for schema editing.
709
- */
731
+ /** @internal */
710
732
  setAlias(alias) {
711
733
  if (!ECName.validate(alias)) {
712
- throw new ECObjectsError(ECObjectsStatus.InvalidECName, "The specified schema alias is invalid.");
734
+ throw new ECSchemaError(ECSchemaStatus.InvalidECName, "The specified schema alias is invalid.");
713
735
  }
714
736
  this._alias = alias;
715
737
  }