@itwin/ecschema-metadata 5.0.0-dev.9 → 5.0.0-dev.92

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 (302) hide show
  1. package/CHANGELOG.md +51 -1
  2. package/lib/cjs/Constants.d.ts +8 -0
  3. package/lib/cjs/Constants.d.ts.map +1 -1
  4. package/lib/cjs/Constants.js +30 -21
  5. package/lib/cjs/Constants.js.map +1 -1
  6. package/lib/cjs/Context.d.ts +83 -34
  7. package/lib/cjs/Context.d.ts.map +1 -1
  8. package/lib/cjs/Context.js +73 -23
  9. package/lib/cjs/Context.js.map +1 -1
  10. package/lib/cjs/DelayedPromise.js +6 -4
  11. package/lib/cjs/DelayedPromise.js.map +1 -1
  12. package/lib/cjs/Deserialization/AbstractParser.js +1 -0
  13. package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
  14. package/lib/cjs/Deserialization/Helper.d.ts +3 -3
  15. package/lib/cjs/Deserialization/Helper.d.ts.map +1 -1
  16. package/lib/cjs/Deserialization/Helper.js +8 -0
  17. package/lib/cjs/Deserialization/Helper.js.map +1 -1
  18. package/lib/cjs/Deserialization/JsonParser.js +3 -0
  19. package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
  20. package/lib/cjs/Deserialization/JsonProps.d.ts +14 -0
  21. package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
  22. package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
  23. package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
  24. package/lib/cjs/Deserialization/XmlParser.d.ts.map +1 -1
  25. package/lib/cjs/Deserialization/XmlParser.js +11 -3
  26. package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
  27. package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
  28. package/lib/cjs/Deserialization/XmlSerializationUtils.js +2 -6
  29. package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
  30. package/lib/cjs/ECName.js +1 -0
  31. package/lib/cjs/ECName.js.map +1 -1
  32. package/lib/cjs/ECObjects.d.ts +21 -1
  33. package/lib/cjs/ECObjects.d.ts.map +1 -1
  34. package/lib/cjs/ECObjects.js +33 -2
  35. package/lib/cjs/ECObjects.js.map +1 -1
  36. package/lib/cjs/Exception.js +1 -0
  37. package/lib/cjs/Exception.js.map +1 -1
  38. package/lib/cjs/Interfaces.d.ts +10 -3
  39. package/lib/cjs/Interfaces.d.ts.map +1 -1
  40. package/lib/cjs/Interfaces.js.map +1 -1
  41. package/lib/cjs/Metadata/Class.d.ts +75 -16
  42. package/lib/cjs/Metadata/Class.d.ts.map +1 -1
  43. package/lib/cjs/Metadata/Class.js +168 -46
  44. package/lib/cjs/Metadata/Class.js.map +1 -1
  45. package/lib/cjs/Metadata/Constant.d.ts +14 -1
  46. package/lib/cjs/Metadata/Constant.d.ts.map +1 -1
  47. package/lib/cjs/Metadata/Constant.js +27 -2
  48. package/lib/cjs/Metadata/Constant.js.map +1 -1
  49. package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
  50. package/lib/cjs/Metadata/CustomAttributeClass.d.ts +16 -4
  51. package/lib/cjs/Metadata/CustomAttributeClass.d.ts.map +1 -1
  52. package/lib/cjs/Metadata/CustomAttributeClass.js +22 -4
  53. package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
  54. package/lib/cjs/Metadata/EntityClass.d.ts +20 -8
  55. package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
  56. package/lib/cjs/Metadata/EntityClass.js +42 -22
  57. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  58. package/lib/cjs/Metadata/Enumeration.d.ts +14 -1
  59. package/lib/cjs/Metadata/Enumeration.d.ts.map +1 -1
  60. package/lib/cjs/Metadata/Enumeration.js +22 -1
  61. package/lib/cjs/Metadata/Enumeration.js.map +1 -1
  62. package/lib/cjs/Metadata/Format.d.ts +41 -1
  63. package/lib/cjs/Metadata/Format.d.ts.map +1 -1
  64. package/lib/cjs/Metadata/Format.js +68 -3
  65. package/lib/cjs/Metadata/Format.js.map +1 -1
  66. package/lib/cjs/Metadata/InvertedUnit.d.ts +8 -3
  67. package/lib/cjs/Metadata/InvertedUnit.d.ts.map +1 -1
  68. package/lib/cjs/Metadata/InvertedUnit.js +17 -6
  69. package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
  70. package/lib/cjs/Metadata/KindOfQuantity.d.ts +14 -3
  71. package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
  72. package/lib/cjs/Metadata/KindOfQuantity.js +43 -18
  73. package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
  74. package/lib/cjs/Metadata/Mixin.d.ts +15 -1
  75. package/lib/cjs/Metadata/Mixin.d.ts.map +1 -1
  76. package/lib/cjs/Metadata/Mixin.js +23 -2
  77. package/lib/cjs/Metadata/Mixin.js.map +1 -1
  78. package/lib/cjs/Metadata/OverrideFormat.js +9 -0
  79. package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
  80. package/lib/cjs/Metadata/Phenomenon.d.ts +14 -1
  81. package/lib/cjs/Metadata/Phenomenon.d.ts.map +1 -1
  82. package/lib/cjs/Metadata/Phenomenon.js +22 -1
  83. package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
  84. package/lib/cjs/Metadata/Property.d.ts +5 -1
  85. package/lib/cjs/Metadata/Property.d.ts.map +1 -1
  86. package/lib/cjs/Metadata/Property.js +83 -28
  87. package/lib/cjs/Metadata/Property.js.map +1 -1
  88. package/lib/cjs/Metadata/PropertyCategory.d.ts +14 -1
  89. package/lib/cjs/Metadata/PropertyCategory.d.ts.map +1 -1
  90. package/lib/cjs/Metadata/PropertyCategory.js +21 -1
  91. package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
  92. package/lib/cjs/Metadata/RelationshipClass.d.ts +15 -2
  93. package/lib/cjs/Metadata/RelationshipClass.d.ts.map +1 -1
  94. package/lib/cjs/Metadata/RelationshipClass.js +47 -10
  95. package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
  96. package/lib/cjs/Metadata/Schema.d.ts +117 -13
  97. package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
  98. package/lib/cjs/Metadata/Schema.js +148 -70
  99. package/lib/cjs/Metadata/Schema.js.map +1 -1
  100. package/lib/cjs/Metadata/SchemaItem.d.ts +11 -2
  101. package/lib/cjs/Metadata/SchemaItem.d.ts.map +1 -1
  102. package/lib/cjs/Metadata/SchemaItem.js +12 -2
  103. package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
  104. package/lib/cjs/Metadata/Unit.d.ts +8 -1
  105. package/lib/cjs/Metadata/Unit.d.ts.map +1 -1
  106. package/lib/cjs/Metadata/Unit.js +21 -3
  107. package/lib/cjs/Metadata/Unit.js.map +1 -1
  108. package/lib/cjs/Metadata/UnitSystem.d.ts +14 -3
  109. package/lib/cjs/Metadata/UnitSystem.d.ts.map +1 -1
  110. package/lib/cjs/Metadata/UnitSystem.js +21 -3
  111. package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
  112. package/lib/cjs/PropertyTypes.js.map +1 -1
  113. package/lib/cjs/SchemaJsonLocater.d.ts +3 -3
  114. package/lib/cjs/SchemaJsonLocater.d.ts.map +1 -1
  115. package/lib/cjs/SchemaJsonLocater.js +3 -3
  116. package/lib/cjs/SchemaJsonLocater.js.map +1 -1
  117. package/lib/cjs/SchemaKey.d.ts +7 -1
  118. package/lib/cjs/SchemaKey.d.ts.map +1 -1
  119. package/lib/cjs/SchemaKey.js +13 -3
  120. package/lib/cjs/SchemaKey.js.map +1 -1
  121. package/lib/cjs/SchemaLoader.d.ts +2 -2
  122. package/lib/cjs/SchemaLoader.d.ts.map +1 -1
  123. package/lib/cjs/SchemaLoader.js +1 -0
  124. package/lib/cjs/SchemaLoader.js.map +1 -1
  125. package/lib/cjs/SchemaPartVisitorDelegate.js +1 -0
  126. package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
  127. package/lib/cjs/UnitConversion/Graph.js +69 -65
  128. package/lib/cjs/UnitConversion/Graph.js.map +1 -1
  129. package/lib/cjs/UnitConversion/Parser.js.map +1 -1
  130. package/lib/cjs/UnitConversion/UnitConversion.d.ts +1 -1
  131. package/lib/cjs/UnitConversion/UnitConversion.d.ts.map +1 -1
  132. package/lib/cjs/UnitConversion/UnitConversion.js +9 -7
  133. package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
  134. package/lib/cjs/UnitConversion/UnitConverter.js +2 -0
  135. package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
  136. package/lib/cjs/UnitConversion/UnitTree.d.ts +2 -0
  137. package/lib/cjs/UnitConversion/UnitTree.d.ts.map +1 -1
  138. package/lib/cjs/UnitConversion/UnitTree.js +11 -1
  139. package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
  140. package/lib/cjs/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
  141. package/lib/cjs/UnitProvider/SchemaUnitProvider.js +8 -9
  142. package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
  143. package/lib/cjs/Validation/SchemaWalker.d.ts +1 -1
  144. package/lib/cjs/Validation/SchemaWalker.d.ts.map +1 -1
  145. package/lib/cjs/Validation/SchemaWalker.js +6 -4
  146. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  147. package/lib/cjs/ecschema-metadata.d.ts +1 -1
  148. package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
  149. package/lib/cjs/ecschema-metadata.js.map +1 -1
  150. package/lib/cjs/utils/SchemaGraph.js +2 -3
  151. package/lib/cjs/utils/SchemaGraph.js.map +1 -1
  152. package/lib/esm/Constants.d.ts +8 -0
  153. package/lib/esm/Constants.d.ts.map +1 -1
  154. package/lib/esm/Constants.js +29 -20
  155. package/lib/esm/Constants.js.map +1 -1
  156. package/lib/esm/Context.d.ts +83 -34
  157. package/lib/esm/Context.d.ts.map +1 -1
  158. package/lib/esm/Context.js +71 -21
  159. package/lib/esm/Context.js.map +1 -1
  160. package/lib/esm/DelayedPromise.js +6 -4
  161. package/lib/esm/DelayedPromise.js.map +1 -1
  162. package/lib/esm/Deserialization/AbstractParser.js +1 -0
  163. package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
  164. package/lib/esm/Deserialization/Helper.d.ts +3 -3
  165. package/lib/esm/Deserialization/Helper.d.ts.map +1 -1
  166. package/lib/esm/Deserialization/Helper.js +8 -0
  167. package/lib/esm/Deserialization/Helper.js.map +1 -1
  168. package/lib/esm/Deserialization/JsonParser.js +3 -0
  169. package/lib/esm/Deserialization/JsonParser.js.map +1 -1
  170. package/lib/esm/Deserialization/JsonProps.d.ts +14 -0
  171. package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
  172. package/lib/esm/Deserialization/JsonProps.js.map +1 -1
  173. package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
  174. package/lib/esm/Deserialization/XmlParser.d.ts.map +1 -1
  175. package/lib/esm/Deserialization/XmlParser.js +11 -3
  176. package/lib/esm/Deserialization/XmlParser.js.map +1 -1
  177. package/lib/esm/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
  178. package/lib/esm/Deserialization/XmlSerializationUtils.js +2 -6
  179. package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
  180. package/lib/esm/ECName.js +1 -0
  181. package/lib/esm/ECName.js.map +1 -1
  182. package/lib/esm/ECObjects.d.ts +21 -1
  183. package/lib/esm/ECObjects.d.ts.map +1 -1
  184. package/lib/esm/ECObjects.js +31 -1
  185. package/lib/esm/ECObjects.js.map +1 -1
  186. package/lib/esm/Exception.js +1 -0
  187. package/lib/esm/Exception.js.map +1 -1
  188. package/lib/esm/Interfaces.d.ts +10 -3
  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 +75 -16
  192. package/lib/esm/Metadata/Class.d.ts.map +1 -1
  193. package/lib/esm/Metadata/Class.js +169 -47
  194. package/lib/esm/Metadata/Class.js.map +1 -1
  195. package/lib/esm/Metadata/Constant.d.ts +14 -1
  196. package/lib/esm/Metadata/Constant.d.ts.map +1 -1
  197. package/lib/esm/Metadata/Constant.js +27 -2
  198. package/lib/esm/Metadata/Constant.js.map +1 -1
  199. package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
  200. package/lib/esm/Metadata/CustomAttributeClass.d.ts +16 -4
  201. package/lib/esm/Metadata/CustomAttributeClass.d.ts.map +1 -1
  202. package/lib/esm/Metadata/CustomAttributeClass.js +22 -4
  203. package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
  204. package/lib/esm/Metadata/EntityClass.d.ts +20 -8
  205. package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
  206. package/lib/esm/Metadata/EntityClass.js +42 -22
  207. package/lib/esm/Metadata/EntityClass.js.map +1 -1
  208. package/lib/esm/Metadata/Enumeration.d.ts +14 -1
  209. package/lib/esm/Metadata/Enumeration.d.ts.map +1 -1
  210. package/lib/esm/Metadata/Enumeration.js +22 -1
  211. package/lib/esm/Metadata/Enumeration.js.map +1 -1
  212. package/lib/esm/Metadata/Format.d.ts +41 -1
  213. package/lib/esm/Metadata/Format.d.ts.map +1 -1
  214. package/lib/esm/Metadata/Format.js +68 -3
  215. package/lib/esm/Metadata/Format.js.map +1 -1
  216. package/lib/esm/Metadata/InvertedUnit.d.ts +8 -3
  217. package/lib/esm/Metadata/InvertedUnit.d.ts.map +1 -1
  218. package/lib/esm/Metadata/InvertedUnit.js +17 -6
  219. package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
  220. package/lib/esm/Metadata/KindOfQuantity.d.ts +14 -3
  221. package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
  222. package/lib/esm/Metadata/KindOfQuantity.js +43 -18
  223. package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
  224. package/lib/esm/Metadata/Mixin.d.ts +15 -1
  225. package/lib/esm/Metadata/Mixin.d.ts.map +1 -1
  226. package/lib/esm/Metadata/Mixin.js +24 -3
  227. package/lib/esm/Metadata/Mixin.js.map +1 -1
  228. package/lib/esm/Metadata/OverrideFormat.js +9 -0
  229. package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
  230. package/lib/esm/Metadata/Phenomenon.d.ts +14 -1
  231. package/lib/esm/Metadata/Phenomenon.d.ts.map +1 -1
  232. package/lib/esm/Metadata/Phenomenon.js +22 -1
  233. package/lib/esm/Metadata/Phenomenon.js.map +1 -1
  234. package/lib/esm/Metadata/Property.d.ts +5 -1
  235. package/lib/esm/Metadata/Property.d.ts.map +1 -1
  236. package/lib/esm/Metadata/Property.js +84 -29
  237. package/lib/esm/Metadata/Property.js.map +1 -1
  238. package/lib/esm/Metadata/PropertyCategory.d.ts +14 -1
  239. package/lib/esm/Metadata/PropertyCategory.d.ts.map +1 -1
  240. package/lib/esm/Metadata/PropertyCategory.js +21 -1
  241. package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
  242. package/lib/esm/Metadata/RelationshipClass.d.ts +15 -2
  243. package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -1
  244. package/lib/esm/Metadata/RelationshipClass.js +48 -11
  245. package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
  246. package/lib/esm/Metadata/Schema.d.ts +117 -13
  247. package/lib/esm/Metadata/Schema.d.ts.map +1 -1
  248. package/lib/esm/Metadata/Schema.js +148 -70
  249. package/lib/esm/Metadata/Schema.js.map +1 -1
  250. package/lib/esm/Metadata/SchemaItem.d.ts +11 -2
  251. package/lib/esm/Metadata/SchemaItem.d.ts.map +1 -1
  252. package/lib/esm/Metadata/SchemaItem.js +13 -3
  253. package/lib/esm/Metadata/SchemaItem.js.map +1 -1
  254. package/lib/esm/Metadata/Unit.d.ts +8 -1
  255. package/lib/esm/Metadata/Unit.d.ts.map +1 -1
  256. package/lib/esm/Metadata/Unit.js +21 -3
  257. package/lib/esm/Metadata/Unit.js.map +1 -1
  258. package/lib/esm/Metadata/UnitSystem.d.ts +14 -3
  259. package/lib/esm/Metadata/UnitSystem.d.ts.map +1 -1
  260. package/lib/esm/Metadata/UnitSystem.js +21 -3
  261. package/lib/esm/Metadata/UnitSystem.js.map +1 -1
  262. package/lib/esm/PropertyTypes.js.map +1 -1
  263. package/lib/esm/SchemaJsonLocater.d.ts +3 -3
  264. package/lib/esm/SchemaJsonLocater.d.ts.map +1 -1
  265. package/lib/esm/SchemaJsonLocater.js +3 -3
  266. package/lib/esm/SchemaJsonLocater.js.map +1 -1
  267. package/lib/esm/SchemaKey.d.ts +7 -1
  268. package/lib/esm/SchemaKey.d.ts.map +1 -1
  269. package/lib/esm/SchemaKey.js +13 -3
  270. package/lib/esm/SchemaKey.js.map +1 -1
  271. package/lib/esm/SchemaLoader.d.ts +2 -2
  272. package/lib/esm/SchemaLoader.d.ts.map +1 -1
  273. package/lib/esm/SchemaLoader.js +1 -0
  274. package/lib/esm/SchemaLoader.js.map +1 -1
  275. package/lib/esm/SchemaPartVisitorDelegate.js +1 -0
  276. package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
  277. package/lib/esm/UnitConversion/Graph.js +69 -65
  278. package/lib/esm/UnitConversion/Graph.js.map +1 -1
  279. package/lib/esm/UnitConversion/Parser.js.map +1 -1
  280. package/lib/esm/UnitConversion/UnitConversion.d.ts +1 -1
  281. package/lib/esm/UnitConversion/UnitConversion.d.ts.map +1 -1
  282. package/lib/esm/UnitConversion/UnitConversion.js +9 -7
  283. package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
  284. package/lib/esm/UnitConversion/UnitConverter.js +2 -0
  285. package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
  286. package/lib/esm/UnitConversion/UnitTree.d.ts +2 -0
  287. package/lib/esm/UnitConversion/UnitTree.d.ts.map +1 -1
  288. package/lib/esm/UnitConversion/UnitTree.js +11 -1
  289. package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
  290. package/lib/esm/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
  291. package/lib/esm/UnitProvider/SchemaUnitProvider.js +8 -9
  292. package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
  293. package/lib/esm/Validation/SchemaWalker.d.ts +1 -1
  294. package/lib/esm/Validation/SchemaWalker.d.ts.map +1 -1
  295. package/lib/esm/Validation/SchemaWalker.js +6 -4
  296. package/lib/esm/Validation/SchemaWalker.js.map +1 -1
  297. package/lib/esm/ecschema-metadata.d.ts +1 -1
  298. package/lib/esm/ecschema-metadata.d.ts.map +1 -1
  299. package/lib/esm/ecschema-metadata.js.map +1 -1
  300. package/lib/esm/utils/SchemaGraph.js +2 -3
  301. package/lib/esm/utils/SchemaGraph.js.map +1 -1
  302. package/package.json +14 -14
@@ -6,25 +6,34 @@
6
6
  * @internal
7
7
  */
8
8
  export class ECStringConstants {
9
+ // Relationship End
10
+ static RELATIONSHIP_END_SOURCE = "Source";
11
+ static RELATIONSHIP_END_TARGET = "Target";
12
+ // Container Type
13
+ static CONTAINERTYPE_SCHEMA = "Schema";
14
+ static CONTAINERTYPE_ENTITYCLASS = "EntityClass";
15
+ static CONTAINERTYPE_CUSTOMATTRIBUTECLASS = "CustomAttributeClass";
16
+ static CONTAINERTYPE_STRUCTCLASS = "StructClass";
17
+ static CONTAINERTYPE_RELATIONSHIPCLASS = "RelationshipClass";
18
+ static CONTAINERTYPE_ANYCLASS = "AnyClass";
19
+ static CONTAINERTYPE_PRIMITIVEPROPERTY = "PrimitiveProperty";
20
+ static CONTAINERTYPE_STRUCTPROPERTY = "StructProperty";
21
+ static CONTAINERTYPE_PRIMITIVEARRAYPROPERTY = "ArrayProperty";
22
+ static CONTAINERTYPE_STRUCTARRAYPROPERTY = "StructArrayProperty";
23
+ static CONTAINERTYPE_NAVIGATIONPROPERTY = "NavigationProperty";
24
+ static CONTAINERTYPE_ANYPROPERTY = "AnyProperty";
25
+ static CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT = "SourceRelationshipConstraint";
26
+ static CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT = "TargetRelationshipConstraint";
27
+ static CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT = "AnyRelationshipConstraint";
28
+ static CONTAINERTYPE_ANY = "Any";
9
29
  }
10
- // Relationship End
11
- ECStringConstants.RELATIONSHIP_END_SOURCE = "Source";
12
- ECStringConstants.RELATIONSHIP_END_TARGET = "Target";
13
- // Container Type
14
- ECStringConstants.CONTAINERTYPE_SCHEMA = "Schema";
15
- ECStringConstants.CONTAINERTYPE_ENTITYCLASS = "EntityClass";
16
- ECStringConstants.CONTAINERTYPE_CUSTOMATTRIBUTECLASS = "CustomAttributeClass";
17
- ECStringConstants.CONTAINERTYPE_STRUCTCLASS = "StructClass";
18
- ECStringConstants.CONTAINERTYPE_RELATIONSHIPCLASS = "RelationshipClass";
19
- ECStringConstants.CONTAINERTYPE_ANYCLASS = "AnyClass";
20
- ECStringConstants.CONTAINERTYPE_PRIMITIVEPROPERTY = "PrimitiveProperty";
21
- ECStringConstants.CONTAINERTYPE_STRUCTPROPERTY = "StructProperty";
22
- ECStringConstants.CONTAINERTYPE_PRIMITIVEARRAYPROPERTY = "ArrayProperty";
23
- ECStringConstants.CONTAINERTYPE_STRUCTARRAYPROPERTY = "StructArrayProperty";
24
- ECStringConstants.CONTAINERTYPE_NAVIGATIONPROPERTY = "NavigationProperty";
25
- ECStringConstants.CONTAINERTYPE_ANYPROPERTY = "AnyProperty";
26
- ECStringConstants.CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT = "SourceRelationshipConstraint";
27
- ECStringConstants.CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT = "TargetRelationshipConstraint";
28
- ECStringConstants.CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT = "AnyRelationshipConstraint";
29
- ECStringConstants.CONTAINERTYPE_ANY = "Any";
30
+ /**
31
+ * @internal
32
+ */
33
+ export var ECSchemaNamespaceUris;
34
+ (function (ECSchemaNamespaceUris) {
35
+ ECSchemaNamespaceUris.SCHEMAURL3_2_JSON = "https://dev.bentley.com/json_schemas/ec/32/ecschema";
36
+ ECSchemaNamespaceUris.SCHEMAITEMURL3_2 = "https://dev.bentley.com/json_schemas/ec/32/schemaitem";
37
+ ECSchemaNamespaceUris.SCHEMAURL3_2_XML = "http://www.bentley.com/schemas/Bentley.ECXML.3.2";
38
+ })(ECSchemaNamespaceUris || (ECSchemaNamespaceUris = {}));
30
39
  //# sourceMappingURL=Constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/Constants.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,MAAM,OAAO,iBAAiB;;AAC5B,mBAAmB;AACI,yCAAuB,GAAW,QAAQ,CAAC;AAC3C,yCAAuB,GAAW,QAAQ,CAAC;AAElE,iBAAiB;AACM,sCAAoB,GAAW,QAAQ,CAAC;AACxC,2CAAyB,GAAW,aAAa,CAAC;AAClD,oDAAkC,GAAW,sBAAsB,CAAC;AACpE,2CAAyB,GAAW,aAAa,CAAC;AAClD,iDAA+B,GAAW,mBAAmB,CAAC;AAC9D,wCAAsB,GAAW,UAAU,CAAC;AAE5C,iDAA+B,GAAW,mBAAmB,CAAC;AAC9D,8CAA4B,GAAW,gBAAgB,CAAC;AACxD,sDAAoC,GAAW,eAAe,CAAC;AAC/D,mDAAiC,GAAW,qBAAqB,CAAC;AAClE,kDAAgC,GAAW,oBAAoB,CAAC;AAChE,2CAAyB,GAAW,aAAa,CAAC;AAElD,4DAA0C,GAAW,8BAA8B,CAAC;AACpF,4DAA0C,GAAW,8BAA8B,CAAC;AACpF,yDAAuC,GAAW,2BAA2B,CAAC;AAE9E,mCAAiB,GAAW,KAAK,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class ECStringConstants {\r\n // Relationship End\r\n public static readonly RELATIONSHIP_END_SOURCE: string = \"Source\";\r\n public static readonly RELATIONSHIP_END_TARGET: string = \"Target\";\r\n\r\n // Container Type\r\n public static readonly CONTAINERTYPE_SCHEMA: string = \"Schema\";\r\n public static readonly CONTAINERTYPE_ENTITYCLASS: string = \"EntityClass\";\r\n public static readonly CONTAINERTYPE_CUSTOMATTRIBUTECLASS: string = \"CustomAttributeClass\";\r\n public static readonly CONTAINERTYPE_STRUCTCLASS: string = \"StructClass\";\r\n public static readonly CONTAINERTYPE_RELATIONSHIPCLASS: string = \"RelationshipClass\";\r\n public static readonly CONTAINERTYPE_ANYCLASS: string = \"AnyClass\";\r\n\r\n public static readonly CONTAINERTYPE_PRIMITIVEPROPERTY: string = \"PrimitiveProperty\";\r\n public static readonly CONTAINERTYPE_STRUCTPROPERTY: string = \"StructProperty\";\r\n public static readonly CONTAINERTYPE_PRIMITIVEARRAYPROPERTY: string = \"ArrayProperty\";\r\n public static readonly CONTAINERTYPE_STRUCTARRAYPROPERTY: string = \"StructArrayProperty\";\r\n public static readonly CONTAINERTYPE_NAVIGATIONPROPERTY: string = \"NavigationProperty\";\r\n public static readonly CONTAINERTYPE_ANYPROPERTY: string = \"AnyProperty\";\r\n\r\n public static readonly CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT: string = \"SourceRelationshipConstraint\";\r\n public static readonly CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT: string = \"TargetRelationshipConstraint\";\r\n public static readonly CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT: string = \"AnyRelationshipConstraint\";\r\n\r\n public static readonly CONTAINERTYPE_ANY: string = \"Any\";\r\n}\r\n"]}
1
+ {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/Constants.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAC5B,mBAAmB;IACZ,MAAM,CAAU,uBAAuB,GAAW,QAAQ,CAAC;IAC3D,MAAM,CAAU,uBAAuB,GAAW,QAAQ,CAAC;IAElE,iBAAiB;IACV,MAAM,CAAU,oBAAoB,GAAW,QAAQ,CAAC;IACxD,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAClE,MAAM,CAAU,kCAAkC,GAAW,sBAAsB,CAAC;IACpF,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAClE,MAAM,CAAU,+BAA+B,GAAW,mBAAmB,CAAC;IAC9E,MAAM,CAAU,sBAAsB,GAAW,UAAU,CAAC;IAE5D,MAAM,CAAU,+BAA+B,GAAW,mBAAmB,CAAC;IAC9E,MAAM,CAAU,4BAA4B,GAAW,gBAAgB,CAAC;IACxE,MAAM,CAAU,oCAAoC,GAAW,eAAe,CAAC;IAC/E,MAAM,CAAU,iCAAiC,GAAW,qBAAqB,CAAC;IAClF,MAAM,CAAU,gCAAgC,GAAW,oBAAoB,CAAC;IAChF,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAElE,MAAM,CAAU,0CAA0C,GAAW,8BAA8B,CAAC;IACpG,MAAM,CAAU,0CAA0C,GAAW,8BAA8B,CAAC;IACpG,MAAM,CAAU,uCAAuC,GAAW,2BAA2B,CAAC;IAE9F,MAAM,CAAU,iBAAiB,GAAW,KAAK,CAAC;;AAG3D;;GAEG;AACH,MAAM,KAAW,qBAAqB,CAKrC;AALD,WAAiB,qBAAqB;IACvB,uCAAiB,GAAG,qDAAqD,CAAC;IAC1E,sCAAgB,GAAG,uDAAuD,CAAC;IAE3E,sCAAgB,GAAG,kDAAkD,CAAC;AACrF,CAAC,EALgB,qBAAqB,KAArB,qBAAqB,QAKrC","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\n/**\n * @internal\n */\nexport class ECStringConstants {\n // Relationship End\n public static readonly RELATIONSHIP_END_SOURCE: string = \"Source\";\n public static readonly RELATIONSHIP_END_TARGET: string = \"Target\";\n\n // Container Type\n public static readonly CONTAINERTYPE_SCHEMA: string = \"Schema\";\n public static readonly CONTAINERTYPE_ENTITYCLASS: string = \"EntityClass\";\n public static readonly CONTAINERTYPE_CUSTOMATTRIBUTECLASS: string = \"CustomAttributeClass\";\n public static readonly CONTAINERTYPE_STRUCTCLASS: string = \"StructClass\";\n public static readonly CONTAINERTYPE_RELATIONSHIPCLASS: string = \"RelationshipClass\";\n public static readonly CONTAINERTYPE_ANYCLASS: string = \"AnyClass\";\n\n public static readonly CONTAINERTYPE_PRIMITIVEPROPERTY: string = \"PrimitiveProperty\";\n public static readonly CONTAINERTYPE_STRUCTPROPERTY: string = \"StructProperty\";\n public static readonly CONTAINERTYPE_PRIMITIVEARRAYPROPERTY: string = \"ArrayProperty\";\n public static readonly CONTAINERTYPE_STRUCTARRAYPROPERTY: string = \"StructArrayProperty\";\n public static readonly CONTAINERTYPE_NAVIGATIONPROPERTY: string = \"NavigationProperty\";\n public static readonly CONTAINERTYPE_ANYPROPERTY: string = \"AnyProperty\";\n\n public static readonly CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT: string = \"SourceRelationshipConstraint\";\n public static readonly CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT: string = \"TargetRelationshipConstraint\";\n public static readonly CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT: string = \"AnyRelationshipConstraint\";\n\n public static readonly CONTAINERTYPE_ANY: string = \"Any\";\n}\n\n/**\n * @internal\n */\nexport namespace ECSchemaNamespaceUris {\n export const SCHEMAURL3_2_JSON = \"https://dev.bentley.com/json_schemas/ec/32/ecschema\";\n export const SCHEMAITEMURL3_2 = \"https://dev.bentley.com/json_schemas/ec/32/schemaitem\";\n\n export const SCHEMAURL3_2_XML = \"http://www.bentley.com/schemas/Bentley.ECXML.3.2\";\n}\n"]}
@@ -19,14 +19,14 @@ export interface ISchemaLocater {
19
19
  * @param matchType how to match key against candidate schemas
20
20
  * @param context context for loading schema references
21
21
  */
22
- getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<T | undefined>;
22
+ getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<Schema | undefined>;
23
23
  /**
24
24
  * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.
25
25
  * May return the entire Schema so long as it is completely loaded as it satisfies the SchemaInfo interface.
26
26
  * @param schemaKey The SchemaKey describing the schema to get from the cache.
27
27
  * @param matchType The match type to use when locating the schema
28
28
  */
29
- getSchemaInfo(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined>;
29
+ getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined>;
30
30
  /**
31
31
  * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.
32
32
  * For schemas that may have references, construct and call through a SchemaContext instead.
@@ -34,13 +34,7 @@ export interface ISchemaLocater {
34
34
  * @param matchType how to match key against candidate schemas
35
35
  * @param context context for loading schema references
36
36
  */
37
- getSchemaSync<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): T | undefined;
38
- }
39
- /**
40
- * @beta
41
- */
42
- export interface ISchemaItemLocater {
43
- getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey): Promise<T | undefined>;
37
+ getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Schema | undefined;
44
38
  }
45
39
  /**
46
40
  * @internal
@@ -58,7 +52,7 @@ export declare class SchemaCache implements ISchemaLocater {
58
52
  * Returns true if the schema exists in either the schema cache or the promise cache. SchemaMatchType.Latest used.
59
53
  * @param schemaKey The key to search for.
60
54
  */
61
- schemaExists(schemaKey: Readonly<SchemaKey>): boolean;
55
+ schemaExists(schemaKey: SchemaKey): boolean;
62
56
  /**
63
57
  * Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.
64
58
  * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache
@@ -71,41 +65,41 @@ export declare class SchemaCache implements ISchemaLocater {
71
65
  * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.
72
66
  * @param schema The schema to add to the cache.
73
67
  */
74
- addSchema<T extends Schema>(schema: T): Promise<void>;
68
+ addSchema(schema: Schema): Promise<void>;
75
69
  /**
76
70
  * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.
77
71
  * @param schema The schema to add to the cache.
78
72
  */
79
- addSchemaSync<T extends Schema>(schema: T): void;
73
+ addSchemaSync(schema: Schema): void;
80
74
  /**
81
75
  * Gets the schema which matches the provided SchemaKey.
82
76
  * @param schemaKey The SchemaKey describing the schema to get from the cache.
83
77
  * @param matchType The match type to use when locating the schema
84
78
  */
85
- getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType?: SchemaMatchType): Promise<T | undefined>;
79
+ getSchema(schemaKey: SchemaKey, matchType?: SchemaMatchType): Promise<Schema | undefined>;
86
80
  /**
87
81
  * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.
88
82
  * @param schemaKey The SchemaKey describing the schema to get from the cache.
89
83
  * @param matchType The match type to use when locating the schema
90
84
  */
91
- getSchemaInfo(schemaKey: Readonly<SchemaKey>, matchType?: SchemaMatchType): Promise<SchemaInfo | undefined>;
85
+ getSchemaInfo(schemaKey: SchemaKey, matchType?: SchemaMatchType): Promise<SchemaInfo | undefined>;
92
86
  /**
93
87
  * Gets the schema which matches the provided SchemaKey. If the schema is partially loaded an exception will be thrown.
94
88
  * @param schemaKey The SchemaKey describing the schema to get from the cache.
95
89
  * @param matchType The match type to use when locating the schema
96
90
  */
97
- getSchemaSync<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType?: SchemaMatchType): T | undefined;
91
+ getSchemaSync(schemaKey: SchemaKey, matchType?: SchemaMatchType): Schema | undefined;
98
92
  /**
99
93
  * Generator function that can iterate through each schema in _schema SchemaMap and items for each Schema.
100
94
  * Does not include schema items from schemas that are not completely loaded yet.
101
95
  */
102
- getSchemaItems(): IterableIterator<SchemaItem>;
96
+ getSchemaItems(): Iterable<SchemaItem>;
103
97
  /**
104
98
  * Gets all the schemas from the schema cache.
105
99
  * Does not include schemas from schemas that are not completely loaded yet.
106
100
  * @returns An array of Schema objects.
107
101
  */
108
- getAllSchemas(): Schema[];
102
+ getAllSchemas(): Iterable<Schema>;
109
103
  }
110
104
  /**
111
105
  * The SchemaContext, context object is used to facilitate schema and schema item location.
@@ -115,11 +109,30 @@ export declare class SchemaCache implements ISchemaLocater {
115
109
  * The context is made up of a group of Schema Locators.
116
110
  * @beta
117
111
  */
118
- export declare class SchemaContext implements ISchemaItemLocater {
112
+ export declare class SchemaContext {
119
113
  private _locaters;
120
114
  private _knownSchemas;
115
+ private _fallbackLocaterDefined;
121
116
  constructor();
117
+ get locaters(): ISchemaLocater[];
118
+ /**
119
+ * Adds a locater to the context.
120
+ *
121
+ * If no locaters are defined or a fallback locater is not defined, the new locater is added at the end of the locaters array.
122
+ * If a fallback locater is already defined, the new locater is inserted before the fallback locater.
123
+ *
124
+ * @param locater - The locater to be added.
125
+ */
122
126
  addLocater(locater: ISchemaLocater): void;
127
+ /**
128
+ * Adds a fallback locater to the context.
129
+ *
130
+ * If a fallback locater is already defined, it replaces the existing one.
131
+ * Otherwise, it adds the new locater to the end of the locaters array and marks the fallback locater as defined.
132
+ *
133
+ * @param locater - The locater to be added as a fallback.
134
+ */
135
+ addFallbackLocater(locater: ISchemaLocater): void;
123
136
  /**
124
137
  * Adds the schema to this context. Use addSchemaPromise instead when asynchronously loading schemas.
125
138
  * @param schema The schema to add to this context
@@ -140,7 +153,7 @@ export declare class SchemaContext implements ISchemaItemLocater {
140
153
  * Returns true if the schema is already in the context. SchemaMatchType.Latest is used to find a match.
141
154
  * @param schemaKey
142
155
  */
143
- schemaExists(schemaKey: Readonly<SchemaKey>): boolean;
156
+ schemaExists(schemaKey: SchemaKey): boolean;
144
157
  /**
145
158
  * Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.
146
159
  * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache.
@@ -155,21 +168,21 @@ export declare class SchemaContext implements ISchemaItemLocater {
155
168
  * @param matchType Criteria by which to identify potentially matching schemas.
156
169
  * @returns the schema matching the input criteria, or `undefined` if no such schema could be located.
157
170
  */
158
- getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType?: SchemaMatchType): Promise<T | undefined>;
171
+ getSchema(schemaKey: SchemaKey, matchType?: SchemaMatchType): Promise<Schema | undefined>;
159
172
  /**
160
173
  * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.
161
174
  * The fully loaded schema can be gotten later from the context using [[getSchema]].
162
175
  * @param schemaKey The SchemaKey describing the schema to get from the cache.
163
176
  * @param matchType The match type to use when locating the schema
164
177
  */
165
- getSchemaInfo(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType): Promise<SchemaInfo | undefined>;
178
+ getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType): Promise<SchemaInfo | undefined>;
166
179
  /** Attempts to obtain a schema from this context that matches the specified criteria.
167
180
  * Will return undefined if the schema is partially loaded. Use [[getSchema]] to await until the schema is completely loaded.
168
181
  * @param schemaKey Identifies the schema to obtain.
169
182
  * @param matchType Criteria by which to identify potentially matching schemas.
170
183
  * @returns the schema matching the input criteria, or `undefined` if no such schema could be located.
171
184
  */
172
- getSchemaSync<T extends Schema>(schemaKey: SchemaKey, matchType?: SchemaMatchType): T | undefined;
185
+ getSchemaSync(schemaKey: SchemaKey, matchType?: SchemaMatchType): Schema | undefined;
173
186
  /**
174
187
  * Attempts to get a Schema from the context's cache.
175
188
  * Will await a partially loaded schema then return when it is completely loaded.
@@ -177,7 +190,7 @@ export declare class SchemaContext implements ISchemaItemLocater {
177
190
  * @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.
178
191
  * @internal
179
192
  */
180
- getCachedSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType?: SchemaMatchType): Promise<T | undefined>;
193
+ getCachedSchema(schemaKey: SchemaKey, matchType?: SchemaMatchType): Promise<Schema | undefined>;
181
194
  /**
182
195
  * Attempts to get a Schema from the context's cache.
183
196
  * Will return undefined if the cached schema is partially loaded. Use [[getCachedSchema]] to await until the schema is completely loaded.
@@ -185,28 +198,64 @@ export declare class SchemaContext implements ISchemaItemLocater {
185
198
  * @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.
186
199
  * @internal
187
200
  */
188
- getCachedSchemaSync<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType?: SchemaMatchType): T | undefined;
201
+ getCachedSchemaSync(schemaKey: SchemaKey, matchType?: SchemaMatchType): Schema | undefined;
189
202
  /**
190
203
  * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].
191
- * Will await a partially loaded schema then look in it for the requested item
192
- * @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.
193
- * @returns The requested schema item
204
+ * Will await a partially loaded schema then look in it for the requested item.
205
+ *
206
+ * @param schemaNameOrKey - The SchemaItemKey identifying the item to return or the name of the schema or the schema item full name.
207
+ * @param itemNameOrCtor - The name of the item to return or the constructor of the item to return.
208
+ * @param itemConstructor - The constructor of the item to return.
209
+ * @returns The requested schema item, or `undefined` if the item could not be found.
210
+ *
211
+ * @examples
212
+ * ```typescript
213
+ * const schemaItem = await schemaContext.getSchemaItem(new SchemaItemKey("TestElement", new SchemaKey("TestSchema")));
214
+ * const schemaItemWithCtor = await schemaContext.getSchemaItem(new SchemaItemKey("TestElement", new SchemaKey("TestSchema")), EntityClass);
215
+ * const schemaItemByName = await schemaContext.getSchemaItem("TestSchema", "TestElement");
216
+ * const schemaItemByNameWithCtor = await schemaContext.getSchemaItem("TestSchema", "TestElement", EntityClass);
217
+ * const schemaItemFullName = await schemaContext.getSchemaItem("TestSchema:TestElement", EntityClass);
218
+ * const schemaItemFullNameWithCtor = await schemaContext.getSchemaItem("TestSchema:TestElement", EntityClass);
219
+ * const schemaItemFullNameSep = await schemaContext.getSchemaItem("TestSchema.TestElement", EntityClass);
220
+ * const schemaItemFullNameSepWithCtor = await schemaContext.getSchemaItem("TestSchema.TestElement", EntityClass);
221
+ * ```
194
222
  */
195
- getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey): Promise<T | undefined>;
223
+ getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): Promise<InstanceType<T> | undefined>;
224
+ getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): Promise<SchemaItem | undefined>;
225
+ getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): Promise<InstanceType<T> | undefined>;
226
+ getSchemaItem<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): Promise<SchemaItem | undefined>;
196
227
  /**
197
228
  * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].
198
- * Will skip a partially loaded schema and return undefined if the item belongs to that schema. Use the async method to await partially loaded schemas.
199
- * @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.
200
- * @returns The requested schema item
229
+ * Will return undefined if the cached schema is partially loaded. Use [[getSchemaItem]] to await until the schema is completely loaded.
230
+ *
231
+ * @param nameOrKey - The SchemaItemKey identifying the item to return or the name of the schema or the schema item full name.
232
+ * @param nameOrCtor - The name of the item to return or the constructor of the item to return.
233
+ * @param ctor - The constructor of the item to return.
234
+ * @returns The requested schema item, or `undefined` if the item could not be found.
235
+ *
236
+ * @example
237
+ * ```typescript
238
+ * const schemaItem = schemaContext.getSchemaItemSync(new SchemaItemKey("TestElement", new SchemaKey("TestSchema")));
239
+ * const schemaItemWithCtor = schemaContext.getSchemaItemSync(new SchemaItemKey("TestElement", new SchemaKey("TestSchema")), EntityClass);
240
+ * const schemaItemByName = schemaContext.getSchemaItemSync("TestSchema", "TestElement");
241
+ * const schemaItemByNameWithCtor = schemaContext.getSchemaItemSync("TestSchema", "TestElement", EntityClass);
242
+ * const schemaItemFullName = schemaContext.getSchemaItemSync("TestSchema:TestElement", EntityClass);
243
+ * const schemaItemFullNameWithCtor = schemaContext.getSchemaItemSync("TestSchema:TestElement", EntityClass);
244
+ * const schemaItemFullNameSep = schemaContext.getSchemaItemSync("TestSchema.TestElement", EntityClass);
245
+ * const schemaItemFullNameSepWithCtor = schemaContext.getSchemaItemSync("TestSchema.TestElement", EntityClass);
246
+ * ```
201
247
  */
202
- getSchemaItemSync<T extends SchemaItem>(schemaItemKey: SchemaItemKey): T | undefined;
248
+ getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): InstanceType<T> | undefined;
249
+ getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: SchemaItemKey | string, itemNameOrCtor?: T): SchemaItem | undefined;
250
+ getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): InstanceType<T> | undefined;
251
+ getSchemaItemSync<T extends typeof SchemaItem>(schemaNameOrKey: string, itemNameOrCtor: string, itemConstructor?: T): SchemaItem | undefined;
203
252
  /**
204
253
  * Iterates through the items of each schema known to the context. This includes schemas added to the
205
254
  * context using [[SchemaContext.addSchema]]. This does not include schemas that
206
255
  * can be located by an ISchemaLocater instance added to the context.
207
256
  * Does not include schema items from schemas that are not completely loaded yet.
208
257
  */
209
- getSchemaItems(): IterableIterator<SchemaItem>;
258
+ getSchemaItems(): Iterable<SchemaItem>;
210
259
  /**
211
260
  * Gets all the Schemas known by the context. This includes schemas added to the
212
261
  * context using [[SchemaContext.addSchema]]. This does not include schemas that
@@ -214,6 +263,6 @@ export declare class SchemaContext implements ISchemaItemLocater {
214
263
  * include schemas that are partially loaded.
215
264
  * @returns An array of Schema objects.
216
265
  */
217
- getKnownSchemas(): Schema[];
266
+ getKnownSchemas(): Iterable<Schema>;
218
267
  }
219
268
  //# sourceMappingURL=Context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/Context.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAiB,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAgBvD;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAE7B;;;;;;OAMG;IACH,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAExI;;;;;MAKE;IACF,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IAEnI;;;;;;OAMG;IACH,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,CAAC,GAAG,SAAS,CAAC;CACpI;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,CAAC,SAAS,UAAU,EAAE,aAAa,EAAE,aAAa,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,SAAS,OAAO,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IACtJ,aAAa,CAAC,CAAC,SAAS,OAAO,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAyB9J;;;;;;;;;;;;;;;;;;;;OAoBG;IACI,iBAAiB,CAAC,CAAC,SAAS,OAAO,UAAU,EAAE,eAAe,EAAE,aAAa,GAAG,MAAM,EAAE,cAAc,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS;IACxI,iBAAiB,CAAC,CAAC,SAAS,OAAO,UAAU,EAAE,eAAe,EAAE,aAAa,GAAG,MAAM,EAAE,cAAc,CAAC,EAAE,CAAC,GAAG,UAAU,GAAG,SAAS;IACnI,iBAAiB,CAAC,CAAC,SAAS,OAAO,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS;IACjJ,iBAAiB,CAAC,CAAC,SAAS,OAAO,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,CAAC,GAAG,UAAU,GAAG,SAAS;IA0BnJ;;;;;OAKG;IACI,cAAc,IAAI,QAAQ,CAAC,UAAU,CAAC;IAI7C;;;;;;OAMG;IACI,eAAe,IAAI,QAAQ,CAAC,MAAM,CAAC;CAG3C"}
@@ -4,6 +4,8 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import { SchemaMatchType } from "./ECObjects";
6
6
  import { ECObjectsError, ECObjectsStatus } from "./Exception";
7
+ import { SchemaItem } from "./Metadata/SchemaItem";
8
+ import { SchemaKey } from "./SchemaKey";
7
9
  /**
8
10
  * @internal
9
11
  */
@@ -13,6 +15,7 @@ class SchemaMap extends Array {
13
15
  * @internal
14
16
  */
15
17
  export class SchemaCache {
18
+ _schema;
16
19
  constructor() {
17
20
  this._schema = new SchemaMap();
18
21
  }
@@ -160,13 +163,44 @@ export class SchemaCache {
160
163
  * @beta
161
164
  */
162
165
  export class SchemaContext {
166
+ _locaters;
167
+ _knownSchemas;
168
+ _fallbackLocaterDefined;
163
169
  constructor() {
164
170
  this._locaters = [];
165
171
  this._knownSchemas = new SchemaCache();
166
172
  this._locaters.push(this._knownSchemas);
173
+ this._fallbackLocaterDefined = false;
167
174
  }
175
+ get locaters() { return this._locaters; }
176
+ /**
177
+ * Adds a locater to the context.
178
+ *
179
+ * If no locaters are defined or a fallback locater is not defined, the new locater is added at the end of the locaters array.
180
+ * If a fallback locater is already defined, the new locater is inserted before the fallback locater.
181
+ *
182
+ * @param locater - The locater to be added.
183
+ */
168
184
  addLocater(locater) {
169
- this._locaters.push(locater);
185
+ const insertIndex = (this._locaters.length === 0 || !this._fallbackLocaterDefined) ? this._locaters.length : this._locaters.length - 1;
186
+ this._locaters.splice(insertIndex, 0, locater);
187
+ }
188
+ /**
189
+ * Adds a fallback locater to the context.
190
+ *
191
+ * If a fallback locater is already defined, it replaces the existing one.
192
+ * Otherwise, it adds the new locater to the end of the locaters array and marks the fallback locater as defined.
193
+ *
194
+ * @param locater - The locater to be added as a fallback.
195
+ */
196
+ addFallbackLocater(locater) {
197
+ if (this._fallbackLocaterDefined) {
198
+ this._locaters[this._locaters.length - 1] = locater;
199
+ }
200
+ else {
201
+ this._locaters.push(locater);
202
+ this._fallbackLocaterDefined = true;
203
+ }
170
204
  }
171
205
  /**
172
206
  * Adds the schema to this context. Use addSchemaPromise instead when asynchronously loading schemas.
@@ -274,29 +308,45 @@ export class SchemaContext {
274
308
  getCachedSchemaSync(schemaKey, matchType = SchemaMatchType.Latest) {
275
309
  return this._knownSchemas.getSchemaSync(schemaKey, matchType);
276
310
  }
277
- /**
278
- * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].
279
- * Will await a partially loaded schema then look in it for the requested item
280
- * @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.
281
- * @returns The requested schema item
282
- */
283
- async getSchemaItem(schemaItemKey) {
284
- const schema = await this.getSchema(schemaItemKey.schemaKey, SchemaMatchType.Latest);
285
- if (undefined === schema)
311
+ async getSchemaItem(schemaNameOrKey, itemNameOrCtor, itemConstructor) {
312
+ let schemaKey;
313
+ if (typeof schemaNameOrKey === "string") {
314
+ const [schemaName, itemName] = SchemaItem.parseFullName(schemaNameOrKey);
315
+ schemaKey = (!schemaName) ? new SchemaKey(itemName) : new SchemaKey(schemaName);
316
+ }
317
+ else {
318
+ schemaKey = schemaNameOrKey.schemaKey;
319
+ }
320
+ const schema = await this.getSchema(schemaKey, SchemaMatchType.Latest);
321
+ if (!schema)
286
322
  return undefined;
287
- return schema.getItem(schemaItemKey.name);
323
+ if (typeof itemNameOrCtor === "string") // Separate schema and item name arguments with/without an itemConstructor
324
+ return itemConstructor ? schema.getItem(itemNameOrCtor, itemConstructor) : schema.getItem(itemNameOrCtor);
325
+ if (typeof schemaNameOrKey === "string") // Single schema item full name argument with/without an itemConstructor
326
+ return itemNameOrCtor ? schema.lookupItem(schemaNameOrKey, itemNameOrCtor) : schema.lookupItem(schemaNameOrKey);
327
+ // Schema Item Key with/without an itemConstructor
328
+ return itemNameOrCtor ? schema.getItem(schemaNameOrKey.name, itemNameOrCtor) : schema.getItem(schemaNameOrKey.name);
288
329
  }
289
- /**
290
- * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].
291
- * Will skip a partially loaded schema and return undefined if the item belongs to that schema. Use the async method to await partially loaded schemas.
292
- * @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.
293
- * @returns The requested schema item
294
- */
295
- getSchemaItemSync(schemaItemKey) {
296
- const schema = this.getSchemaSync(schemaItemKey.schemaKey, SchemaMatchType.Latest);
297
- if (undefined === schema)
330
+ getSchemaItemSync(schemaNameOrKey, itemNameOrCtor, itemConstructor) {
331
+ let schemaKey;
332
+ if (typeof schemaNameOrKey === "string") {
333
+ const [schemaName, itemName] = SchemaItem.parseFullName(schemaNameOrKey);
334
+ schemaKey = (!schemaName) ? new SchemaKey(itemName) : new SchemaKey(schemaName);
335
+ }
336
+ else {
337
+ schemaKey = schemaNameOrKey.schemaKey;
338
+ }
339
+ const schema = this.getSchemaSync(schemaKey, SchemaMatchType.Latest);
340
+ if (!schema)
298
341
  return undefined;
299
- return schema.getItemSync(schemaItemKey.name);
342
+ // Separate schema and item name arguments with/without an itemConstructor
343
+ if (typeof itemNameOrCtor === "string") {
344
+ return itemConstructor ? schema.getItemSync(itemNameOrCtor, itemConstructor) : schema.getItemSync(itemNameOrCtor);
345
+ }
346
+ if (typeof schemaNameOrKey === "string") // Single schema item full name argument with/without an itemConstructor
347
+ return itemNameOrCtor ? schema.lookupItemSync(schemaNameOrKey, itemNameOrCtor) : schema.lookupItemSync(schemaNameOrKey);
348
+ // Schema Item Key with/without an itemConstructor
349
+ return itemNameOrCtor ? schema.getItemSync(schemaNameOrKey.name, itemNameOrCtor) : schema.getItemSync(schemaNameOrKey.name);
300
350
  }
301
351
  /**
302
352
  * Iterates through the items of each schema known to the context. This includes schemas added to the