@itwin/ecschema-metadata 4.10.0-dev.9 → 4.10.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 (190) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/lib/cjs/Constants.js.map +1 -1
  3. package/lib/cjs/DelayedPromise.d.ts.map +1 -1
  4. package/lib/cjs/DelayedPromise.js.map +1 -1
  5. package/lib/cjs/Deserialization/AbstractParser.d.ts +3 -0
  6. package/lib/cjs/Deserialization/AbstractParser.d.ts.map +1 -1
  7. package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
  8. package/lib/cjs/Deserialization/Helper.d.ts +9 -0
  9. package/lib/cjs/Deserialization/Helper.d.ts.map +1 -1
  10. package/lib/cjs/Deserialization/Helper.js +24 -6
  11. package/lib/cjs/Deserialization/Helper.js.map +1 -1
  12. package/lib/cjs/Deserialization/JsonParser.d.ts +3 -0
  13. package/lib/cjs/Deserialization/JsonParser.d.ts.map +1 -1
  14. package/lib/cjs/Deserialization/JsonParser.js +55 -9
  15. package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
  16. package/lib/cjs/Deserialization/JsonProps.d.ts +4 -0
  17. package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
  18. package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
  19. package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
  20. package/lib/cjs/Deserialization/XmlParser.d.ts +3 -2
  21. package/lib/cjs/Deserialization/XmlParser.d.ts.map +1 -1
  22. package/lib/cjs/Deserialization/XmlParser.js +32 -13
  23. package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
  24. package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
  25. package/lib/cjs/ECName.js.map +1 -1
  26. package/lib/cjs/ECObjects.d.ts.map +1 -1
  27. package/lib/cjs/ECObjects.js +24 -21
  28. package/lib/cjs/ECObjects.js.map +1 -1
  29. package/lib/cjs/Exception.d.ts +2 -1
  30. package/lib/cjs/Exception.d.ts.map +1 -1
  31. package/lib/cjs/Exception.js +1 -0
  32. package/lib/cjs/Exception.js.map +1 -1
  33. package/lib/cjs/Interfaces.js.map +1 -1
  34. package/lib/cjs/Metadata/Class.d.ts.map +1 -1
  35. package/lib/cjs/Metadata/Class.js +10 -3
  36. package/lib/cjs/Metadata/Class.js.map +1 -1
  37. package/lib/cjs/Metadata/Constant.js.map +1 -1
  38. package/lib/cjs/Metadata/CustomAttribute.js +1 -2
  39. package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
  40. package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
  41. package/lib/cjs/Metadata/EntityClass.js +3 -3
  42. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  43. package/lib/cjs/Metadata/Enumeration.d.ts.map +1 -1
  44. package/lib/cjs/Metadata/Enumeration.js +11 -4
  45. package/lib/cjs/Metadata/Enumeration.js.map +1 -1
  46. package/lib/cjs/Metadata/Format.d.ts.map +1 -1
  47. package/lib/cjs/Metadata/Format.js +6 -6
  48. package/lib/cjs/Metadata/Format.js.map +1 -1
  49. package/lib/cjs/Metadata/InvertedUnit.d.ts +4 -0
  50. package/lib/cjs/Metadata/InvertedUnit.d.ts.map +1 -1
  51. package/lib/cjs/Metadata/InvertedUnit.js +6 -0
  52. package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
  53. package/lib/cjs/Metadata/KindOfQuantity.d.ts +0 -4
  54. package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
  55. package/lib/cjs/Metadata/KindOfQuantity.js +2 -54
  56. package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
  57. package/lib/cjs/Metadata/Mixin.js.map +1 -1
  58. package/lib/cjs/Metadata/OverrideFormat.d.ts +12 -0
  59. package/lib/cjs/Metadata/OverrideFormat.d.ts.map +1 -1
  60. package/lib/cjs/Metadata/OverrideFormat.js +55 -2
  61. package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
  62. package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
  63. package/lib/cjs/Metadata/Property.js.map +1 -1
  64. package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
  65. package/lib/cjs/Metadata/RelationshipClass.d.ts.map +1 -1
  66. package/lib/cjs/Metadata/RelationshipClass.js +8 -3
  67. package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
  68. package/lib/cjs/Metadata/Schema.d.ts +9 -0
  69. package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
  70. package/lib/cjs/Metadata/Schema.js +74 -7
  71. package/lib/cjs/Metadata/Schema.js.map +1 -1
  72. package/lib/cjs/Metadata/SchemaItem.d.ts.map +1 -1
  73. package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
  74. package/lib/cjs/Metadata/Unit.js.map +1 -1
  75. package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
  76. package/lib/cjs/PropertyTypes.js +2 -2
  77. package/lib/cjs/PropertyTypes.js.map +1 -1
  78. package/lib/cjs/SchemaJsonLocater.js.map +1 -1
  79. package/lib/cjs/SchemaKey.d.ts.map +1 -1
  80. package/lib/cjs/SchemaKey.js +1 -5
  81. package/lib/cjs/SchemaKey.js.map +1 -1
  82. package/lib/cjs/SchemaLoader.js.map +1 -1
  83. package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
  84. package/lib/cjs/UnitConversion/Graph.d.ts.map +1 -1
  85. package/lib/cjs/UnitConversion/Graph.js.map +1 -1
  86. package/lib/cjs/UnitConversion/Parser.js +1 -2
  87. package/lib/cjs/UnitConversion/Parser.js.map +1 -1
  88. package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
  89. package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
  90. package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
  91. package/lib/cjs/UnitProvider/SchemaUnitProvider.d.ts +1 -6
  92. package/lib/cjs/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
  93. package/lib/cjs/UnitProvider/SchemaUnitProvider.js +100 -58
  94. package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
  95. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  96. package/lib/cjs/ecschema-metadata.js.map +1 -1
  97. package/lib/cjs/utils/SchemaGraph.js.map +1 -1
  98. package/lib/esm/Constants.js.map +1 -1
  99. package/lib/esm/DelayedPromise.d.ts.map +1 -1
  100. package/lib/esm/DelayedPromise.js.map +1 -1
  101. package/lib/esm/Deserialization/AbstractParser.d.ts +3 -0
  102. package/lib/esm/Deserialization/AbstractParser.d.ts.map +1 -1
  103. package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
  104. package/lib/esm/Deserialization/Helper.d.ts +9 -0
  105. package/lib/esm/Deserialization/Helper.d.ts.map +1 -1
  106. package/lib/esm/Deserialization/Helper.js +24 -6
  107. package/lib/esm/Deserialization/Helper.js.map +1 -1
  108. package/lib/esm/Deserialization/JsonParser.d.ts +3 -0
  109. package/lib/esm/Deserialization/JsonParser.d.ts.map +1 -1
  110. package/lib/esm/Deserialization/JsonParser.js +55 -9
  111. package/lib/esm/Deserialization/JsonParser.js.map +1 -1
  112. package/lib/esm/Deserialization/JsonProps.d.ts +4 -0
  113. package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
  114. package/lib/esm/Deserialization/JsonProps.js.map +1 -1
  115. package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
  116. package/lib/esm/Deserialization/XmlParser.d.ts +3 -2
  117. package/lib/esm/Deserialization/XmlParser.d.ts.map +1 -1
  118. package/lib/esm/Deserialization/XmlParser.js +32 -13
  119. package/lib/esm/Deserialization/XmlParser.js.map +1 -1
  120. package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
  121. package/lib/esm/ECName.js.map +1 -1
  122. package/lib/esm/ECObjects.d.ts.map +1 -1
  123. package/lib/esm/ECObjects.js +8 -5
  124. package/lib/esm/ECObjects.js.map +1 -1
  125. package/lib/esm/Exception.d.ts +2 -1
  126. package/lib/esm/Exception.d.ts.map +1 -1
  127. package/lib/esm/Exception.js +1 -0
  128. package/lib/esm/Exception.js.map +1 -1
  129. package/lib/esm/Interfaces.js.map +1 -1
  130. package/lib/esm/Metadata/Class.d.ts.map +1 -1
  131. package/lib/esm/Metadata/Class.js +10 -3
  132. package/lib/esm/Metadata/Class.js.map +1 -1
  133. package/lib/esm/Metadata/Constant.js.map +1 -1
  134. package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
  135. package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
  136. package/lib/esm/Metadata/EntityClass.js.map +1 -1
  137. package/lib/esm/Metadata/Enumeration.d.ts.map +1 -1
  138. package/lib/esm/Metadata/Enumeration.js +11 -4
  139. package/lib/esm/Metadata/Enumeration.js.map +1 -1
  140. package/lib/esm/Metadata/Format.d.ts.map +1 -1
  141. package/lib/esm/Metadata/Format.js +7 -7
  142. package/lib/esm/Metadata/Format.js.map +1 -1
  143. package/lib/esm/Metadata/InvertedUnit.d.ts +4 -0
  144. package/lib/esm/Metadata/InvertedUnit.d.ts.map +1 -1
  145. package/lib/esm/Metadata/InvertedUnit.js +6 -0
  146. package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
  147. package/lib/esm/Metadata/KindOfQuantity.d.ts +0 -4
  148. package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
  149. package/lib/esm/Metadata/KindOfQuantity.js +2 -54
  150. package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
  151. package/lib/esm/Metadata/Mixin.js.map +1 -1
  152. package/lib/esm/Metadata/OverrideFormat.d.ts +12 -0
  153. package/lib/esm/Metadata/OverrideFormat.d.ts.map +1 -1
  154. package/lib/esm/Metadata/OverrideFormat.js +53 -0
  155. package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
  156. package/lib/esm/Metadata/Phenomenon.js.map +1 -1
  157. package/lib/esm/Metadata/Property.js.map +1 -1
  158. package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
  159. package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -1
  160. package/lib/esm/Metadata/RelationshipClass.js +8 -3
  161. package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
  162. package/lib/esm/Metadata/Schema.d.ts +9 -0
  163. package/lib/esm/Metadata/Schema.d.ts.map +1 -1
  164. package/lib/esm/Metadata/Schema.js +74 -7
  165. package/lib/esm/Metadata/Schema.js.map +1 -1
  166. package/lib/esm/Metadata/SchemaItem.d.ts.map +1 -1
  167. package/lib/esm/Metadata/SchemaItem.js.map +1 -1
  168. package/lib/esm/Metadata/Unit.js.map +1 -1
  169. package/lib/esm/Metadata/UnitSystem.js.map +1 -1
  170. package/lib/esm/PropertyTypes.js.map +1 -1
  171. package/lib/esm/SchemaJsonLocater.js.map +1 -1
  172. package/lib/esm/SchemaKey.d.ts.map +1 -1
  173. package/lib/esm/SchemaKey.js +1 -5
  174. package/lib/esm/SchemaKey.js.map +1 -1
  175. package/lib/esm/SchemaLoader.js.map +1 -1
  176. package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
  177. package/lib/esm/UnitConversion/Graph.d.ts.map +1 -1
  178. package/lib/esm/UnitConversion/Graph.js.map +1 -1
  179. package/lib/esm/UnitConversion/Parser.js.map +1 -1
  180. package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
  181. package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
  182. package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
  183. package/lib/esm/UnitProvider/SchemaUnitProvider.d.ts +1 -6
  184. package/lib/esm/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
  185. package/lib/esm/UnitProvider/SchemaUnitProvider.js +100 -58
  186. package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
  187. package/lib/esm/Validation/SchemaWalker.js.map +1 -1
  188. package/lib/esm/ecschema-metadata.js.map +1 -1
  189. package/lib/esm/utils/SchemaGraph.js.map +1 -1
  190. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"JsonProps.js","sourceRoot":"","sources":["../../../src/Deserialization/JsonProps.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG","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 { FormatProps } from \"@itwin/core-quantity\";\r\n\r\n/**\r\n * @beta\r\n */\r\nexport type AnyPropertyProps = PrimitivePropertyProps | StructPropertyProps | PrimitiveArrayPropertyProps | StructArrayPropertyProps | NavigationPropertyProps;\r\n/**\r\n * @beta\r\n */\r\nexport type AnyClassProps = EntityClassProps | MixinProps | CustomAttributeClassProps | RelationshipClassProps;\r\n/**\r\n * @beta\r\n */\r\nexport type AnySchemaItemProps = AnyClassProps | EnumerationProps | KindOfQuantityProps | PropertyCategoryProps | SchemaItemUnitProps | InvertedUnitProps | ConstantProps | PhenomenonProps | SchemaItemFormatProps | SchemaItemOverrideFormatProps;\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface SchemaProps {\r\n readonly $schema: string;\r\n readonly name: string;\r\n readonly version: string;\r\n readonly alias: string;\r\n readonly label?: string;\r\n readonly description?: string;\r\n readonly references?: SchemaReferenceProps[];\r\n readonly items?: { [name: string]: SchemaItemProps };\r\n readonly customAttributes?: Array<{ [value: string]: any }>;\r\n}\r\n\r\n/**\r\n * JSON Object interface used to deserialize into a [[SchemaKey]].\r\n * @beta\r\n */\r\nexport interface SchemaKeyProps {\r\n /** The schema name */\r\n readonly name: string;\r\n /** Read version of the schema */\r\n readonly read: number;\r\n /** Write version of the schema */\r\n readonly write: number;\r\n /** Minor version of the schema */\r\n readonly minor: number;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface SchemaReferenceProps {\r\n readonly name: string;\r\n readonly version: string;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface SchemaItemProps {\r\n // NEEDSWORK: Still need to clarify how single-item deserialization works...\r\n readonly $schema?: string;\r\n readonly schema?: string; // conditionally required\r\n readonly schemaVersion?: string;\r\n readonly name?: string;\r\n readonly schemaItemType?: string;\r\n readonly label?: string;\r\n readonly description?: string;\r\n readonly customAttributes?: Array<{ [value: string]: any }>;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface ClassProps extends SchemaItemProps {\r\n readonly modifier?: string;\r\n readonly baseClass?: string;\r\n readonly properties?: AnyPropertyProps[];\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface EntityClassProps extends ClassProps {\r\n readonly mixins?: string[];\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface MixinProps extends ClassProps {\r\n readonly appliesTo: string;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport type StructClassProps = ClassProps;\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface CustomAttributeClassProps extends ClassProps {\r\n /**\r\n * Can be any combination of the [CustomAttributeContainerType]$(docs/bis/ec/customattribute-container-types.md) string values\r\n * separated by commas.\r\n */\r\n readonly appliesTo: string;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface RelationshipClassProps extends ClassProps {\r\n readonly strength: string;\r\n readonly strengthDirection: string;\r\n readonly source: RelationshipConstraintProps;\r\n readonly target: RelationshipConstraintProps;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface RelationshipConstraintProps {\r\n readonly multiplicity: string;\r\n readonly roleLabel: string;\r\n readonly polymorphic: boolean;\r\n readonly abstractConstraint?: string;\r\n readonly constraintClasses: string[];\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface EnumerationProps extends SchemaItemProps {\r\n readonly type: string;\r\n readonly isStrict: boolean;\r\n readonly enumerators: EnumeratorProps[];\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface EnumeratorProps {\r\n readonly name: string;\r\n readonly value: string | number;\r\n readonly label?: string;\r\n readonly description?: string;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface KindOfQuantityProps extends SchemaItemProps {\r\n readonly persistenceUnit: string;\r\n readonly presentationUnits?: string | string[];\r\n readonly relativeError: number;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface PropertyCategoryProps extends SchemaItemProps {\r\n readonly priority: number;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface PropertyProps {\r\n readonly name: string;\r\n readonly type: string;\r\n readonly description?: string;\r\n readonly label?: string;\r\n readonly isReadOnly?: boolean;\r\n readonly category?: string;\r\n readonly priority?: number;\r\n readonly inherited?: boolean;\r\n readonly kindOfQuantity?: string;\r\n readonly customAttributes?: Array<{ [value: string]: any }>;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface PrimitiveOrEnumPropertyBaseProps extends PropertyProps {\r\n readonly extendedTypeName?: string;\r\n readonly minLength?: number;\r\n readonly maxLength?: number;\r\n readonly minValue?: number;\r\n readonly maxValue?: number;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface PrimitivePropertyProps extends PrimitiveOrEnumPropertyBaseProps {\r\n readonly typeName: string;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface StructPropertyProps extends PropertyProps {\r\n readonly typeName: string;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface EnumerationPropertyProps extends PrimitiveOrEnumPropertyBaseProps {\r\n readonly typeName: string;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface ArrayPropertyProps extends PrimitiveOrEnumPropertyBaseProps {\r\n readonly minOccurs?: number;\r\n readonly maxOccurs?: number;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface PrimitiveArrayPropertyProps extends ArrayPropertyProps {\r\n readonly typeName: string;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface StructArrayPropertyProps extends ArrayPropertyProps {\r\n readonly typeName: string;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface NavigationPropertyProps extends PropertyProps {\r\n readonly relationshipName: string;\r\n readonly direction: string;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface ConstantProps extends SchemaItemProps {\r\n readonly phenomenon: string;\r\n readonly definition: string;\r\n readonly numerator?: number;\r\n readonly denominator?: number;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport type SchemaItemFormatProps = SchemaItemProps & FormatProps;\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface SchemaItemOverrideFormatProps extends SchemaItemFormatProps {\r\n readonly parent: string;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface InvertedUnitProps extends SchemaItemProps {\r\n readonly invertsUnit: string;\r\n readonly unitSystem: string;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface PhenomenonProps extends SchemaItemProps {\r\n readonly definition: string;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport type UnitSystemProps = SchemaItemProps;\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface SchemaItemUnitProps extends SchemaItemProps {\r\n readonly phenomenon: string;\r\n readonly unitSystem: string;\r\n readonly definition: string;\r\n readonly numerator?: number;\r\n readonly denominator?: number;\r\n readonly offset?: number;\r\n}\r\n"]}
1
+ {"version":3,"file":"JsonProps.js","sourceRoot":"","sources":["../../../src/Deserialization/JsonProps.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG","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 { FormatProps } from \"@itwin/core-quantity\";\n\n/**\n * @beta\n */\nexport type AnyPropertyProps = PrimitivePropertyProps | StructPropertyProps | PrimitiveArrayPropertyProps | StructArrayPropertyProps | NavigationPropertyProps;\n/**\n * @beta\n */\nexport type AnyClassProps = EntityClassProps | MixinProps | CustomAttributeClassProps | RelationshipClassProps;\n/**\n * @beta\n */\nexport type AnySchemaItemProps = AnyClassProps | EnumerationProps | KindOfQuantityProps | PropertyCategoryProps | SchemaItemUnitProps | InvertedUnitProps | ConstantProps | PhenomenonProps | SchemaItemFormatProps | SchemaItemOverrideFormatProps;\n\n/**\n * @beta\n */\nexport interface SchemaProps {\n readonly $schema: string;\n readonly name: string;\n readonly version: string;\n readonly alias: string;\n readonly label?: string;\n readonly description?: string;\n readonly references?: SchemaReferenceProps[];\n readonly items?: { [name: string]: SchemaItemProps };\n readonly customAttributes?: Array<{ [value: string]: any }>;\n readonly ecSpecMajorVersion?: number;\n readonly ecSpecMinorVersion?: number;\n}\n\n/**\n * JSON Object interface used to deserialize into a [[SchemaKey]].\n * @beta\n */\nexport interface SchemaKeyProps {\n /** The schema name */\n readonly name: string;\n /** Read version of the schema */\n readonly read: number;\n /** Write version of the schema */\n readonly write: number;\n /** Minor version of the schema */\n readonly minor: number;\n}\n\n/**\n * @beta\n */\nexport interface SchemaReferenceProps {\n readonly name: string;\n readonly version: string;\n}\n\n/**\n * @beta\n */\nexport interface SchemaItemProps {\n // NEEDSWORK: Still need to clarify how single-item deserialization works...\n readonly $schema?: string;\n readonly schema?: string; // conditionally required\n readonly schemaVersion?: string;\n readonly name?: string;\n readonly schemaItemType?: string;\n readonly label?: string;\n readonly description?: string;\n readonly customAttributes?: Array<{ [value: string]: any }>;\n readonly originalECSpecMajorVersion?: number;\n readonly originalECSpecMinorVersion?: number;\n}\n\n/**\n * @beta\n */\nexport interface ClassProps extends SchemaItemProps {\n readonly modifier?: string;\n readonly baseClass?: string;\n readonly properties?: AnyPropertyProps[];\n}\n\n/**\n * @beta\n */\nexport interface EntityClassProps extends ClassProps {\n readonly mixins?: string[];\n}\n\n/**\n * @beta\n */\nexport interface MixinProps extends ClassProps {\n readonly appliesTo: string;\n}\n\n/**\n * @beta\n */\nexport type StructClassProps = ClassProps;\n\n/**\n * @beta\n */\nexport interface CustomAttributeClassProps extends ClassProps {\n /**\n * Can be any combination of the [CustomAttributeContainerType]$(docs/bis/ec/customattribute-container-types.md) string values\n * separated by commas.\n */\n readonly appliesTo: string;\n}\n\n/**\n * @beta\n */\nexport interface RelationshipClassProps extends ClassProps {\n readonly strength: string;\n readonly strengthDirection: string;\n readonly source: RelationshipConstraintProps;\n readonly target: RelationshipConstraintProps;\n}\n\n/**\n * @beta\n */\nexport interface RelationshipConstraintProps {\n readonly multiplicity: string;\n readonly roleLabel: string;\n readonly polymorphic: boolean;\n readonly abstractConstraint?: string;\n readonly constraintClasses: string[];\n}\n\n/**\n * @beta\n */\nexport interface EnumerationProps extends SchemaItemProps {\n readonly type: string;\n readonly isStrict: boolean;\n readonly enumerators: EnumeratorProps[];\n}\n\n/**\n * @beta\n */\nexport interface EnumeratorProps {\n readonly name: string;\n readonly value: string | number;\n readonly label?: string;\n readonly description?: string;\n}\n\n/**\n * @beta\n */\nexport interface KindOfQuantityProps extends SchemaItemProps {\n readonly persistenceUnit: string;\n readonly presentationUnits?: string | string[];\n readonly relativeError: number;\n}\n\n/**\n * @beta\n */\nexport interface PropertyCategoryProps extends SchemaItemProps {\n readonly priority: number;\n}\n\n/**\n * @beta\n */\nexport interface PropertyProps {\n readonly name: string;\n readonly type: string;\n readonly description?: string;\n readonly label?: string;\n readonly isReadOnly?: boolean;\n readonly category?: string;\n readonly priority?: number;\n readonly inherited?: boolean;\n readonly kindOfQuantity?: string;\n readonly customAttributes?: Array<{ [value: string]: any }>;\n}\n\n/**\n * @beta\n */\nexport interface PrimitiveOrEnumPropertyBaseProps extends PropertyProps {\n readonly extendedTypeName?: string;\n readonly minLength?: number;\n readonly maxLength?: number;\n readonly minValue?: number;\n readonly maxValue?: number;\n}\n\n/**\n * @beta\n */\nexport interface PrimitivePropertyProps extends PrimitiveOrEnumPropertyBaseProps {\n readonly typeName: string;\n}\n\n/**\n * @beta\n */\nexport interface StructPropertyProps extends PropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @beta\n */\nexport interface EnumerationPropertyProps extends PrimitiveOrEnumPropertyBaseProps {\n readonly typeName: string;\n}\n\n/**\n * @beta\n */\nexport interface ArrayPropertyProps extends PrimitiveOrEnumPropertyBaseProps {\n readonly minOccurs?: number;\n readonly maxOccurs?: number;\n}\n\n/**\n * @beta\n */\nexport interface PrimitiveArrayPropertyProps extends ArrayPropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @beta\n */\nexport interface StructArrayPropertyProps extends ArrayPropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @beta\n */\nexport interface NavigationPropertyProps extends PropertyProps {\n readonly relationshipName: string;\n readonly direction: string;\n}\n\n/**\n * @beta\n */\nexport interface ConstantProps extends SchemaItemProps {\n readonly phenomenon: string;\n readonly definition: string;\n readonly numerator?: number;\n readonly denominator?: number;\n}\n\n/**\n * @beta\n */\nexport type SchemaItemFormatProps = SchemaItemProps & FormatProps;\n\n/**\n * @beta\n */\nexport interface SchemaItemOverrideFormatProps extends SchemaItemFormatProps {\n readonly parent: string;\n}\n\n/**\n * @beta\n */\nexport interface InvertedUnitProps extends SchemaItemProps {\n readonly invertsUnit: string;\n readonly unitSystem: string;\n}\n\n/**\n * @beta\n */\nexport interface PhenomenonProps extends SchemaItemProps {\n readonly definition: string;\n}\n\n/**\n * @beta\n */\nexport type UnitSystemProps = SchemaItemProps;\n\n/**\n * @beta\n */\nexport interface SchemaItemUnitProps extends SchemaItemProps {\n readonly phenomenon: string;\n readonly unitSystem: string;\n readonly definition: string;\n readonly numerator?: number;\n readonly denominator?: number;\n readonly offset?: number;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaGraphUtil.js","sourceRoot":"","sources":["../../../src/Deserialization/SchemaGraphUtil.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAI/F;;;GAGG;AACH,MAAM,OAAO,eAAe;IAC1B;;;;;;OAMG;IACI,MAAM,CAAC,gCAAgC,CAAC,Y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C,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC;gBACzC,uDAAuD;gBACvD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBACtC,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC;gBAC3C,OAAO;YACT,CAAC;QACH,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC;IACrC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { Schema } from \"../Metadata/Schema\";\r\n\r\n/**\r\n * Utility class for working with Schema graphs.\r\n * @internal\r\n */\r\nexport class SchemaGraphUtil {\r\n /**\r\n * Creates a flattened list of schemas in topological order, typically used before schema import\r\n * so that dependent schemas are processed after their references.\r\n * @param insertSchema The schema to be imported.\r\n * @param schemas The schema collection that will hold the ordered schemas. If null, the collection\r\n * will be created internally and passed along during recursive calls.\r\n */\r\n public static buildDependencyOrderedSchemaList(insertSchema: Schema, schemas?: Schema[]): Schema[] {\r\n if (!schemas)\r\n schemas = [];\r\n\r\n this.insertSchemaInDependencyOrderedList(schemas, insertSchema);\r\n for (const reference of insertSchema.references) {\r\n this.buildDependencyOrderedSchemaList(reference, schemas);\r\n }\r\n return schemas;\r\n }\r\n\r\n /**\r\n * Indicates if the given Schema references the possibleDependency Schema.\r\n * @param schema The possible dependent schema.\r\n * @param possibleDependency The possible Schema dependency.\r\n */\r\n private static dependsOn(schema: Schema, possibleDependency: Schema): boolean {\r\n if (this.directlyReferences(schema, possibleDependency))\r\n return true;\r\n\r\n // search for dependencies in indirect references\r\n for (const reference of schema.references) {\r\n if (this.dependsOn(reference, possibleDependency))\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Indicates if the given Schema directly references the possiblyReferencedSchema Schema.\r\n * @param schema The possible parent schema.\r\n * @param possibleDependency The Schema that may be referenced.\r\n */\r\n private static directlyReferences(schema: Schema, possiblyReferencedSchema: Schema): boolean {\r\n for (const reference of schema.references) {\r\n if (reference === possiblyReferencedSchema)\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Helper method that manages the insertion of a Schema into the schemas collection\r\n * based on the topological ordering algorithm.\r\n * @param schemas The ordered Schema collection.\r\n * @param insertSchema The Schema to insert.\r\n */\r\n private static insertSchemaInDependencyOrderedList(schemas: Schema[], insertSchema: Schema) {\r\n if (schemas.includes(insertSchema))\r\n return;\r\n\r\n for (let i = schemas.length - 1; i >= 0; --i) {\r\n const schema = schemas[i];\r\n if (this.dependsOn(insertSchema, schema)) {\r\n // insert right after the referenced schema in the list\r\n const index = schemas.indexOf(schema);\r\n schemas.splice(index + 1, 0, insertSchema);\r\n return;\r\n }\r\n }\r\n\r\n schemas.splice(0, 0, insertSchema);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SchemaGraphUtil.js","sourceRoot":"","sources":["../../../src/Deserialization/SchemaGraphUtil.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAI/F;;;GAGG;AACH,MAAM,OAAO,eAAe;IAC1B;;;;;;OAMG;IACI,MAAM,CAAC,gCAAgC,CAAC,YAAoB,EAAE,OAAkB;QACrF,IAAI,CAAC,OAAO;YACV,OAAO,GAAG,EAAE,CAAC;QAEf,IAAI,CAAC,mCAAmC,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAChE,KAAK,MAAM,SAAS,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;YAChD,IAAI,CAAC,gCAAgC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACK,MAAM,CAAC,SAAS,CAAC,MAAc,EAAE,kBAA0B;QACjE,IAAI,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,CAAC;YACrD,OAAO,IAAI,CAAC;QAEd,iDAAiD;QACjD,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YAC1C,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,kBAAkB,CAAC;gBAC/C,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;OAIG;IACK,MAAM,CAAC,kBAAkB,CAAC,MAAc,EAAE,wBAAgC;QAChF,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YAC1C,IAAI,SAAS,KAAK,wBAAwB;gBACxC,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACK,MAAM,CAAC,mCAAmC,CAAC,OAAiB,EAAE,YAAoB;QACxF,IAAI,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;YAChC,OAAO;QAET,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;YAC7C,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAC1B,IAAI,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC;gBACzC,uDAAuD;gBACvD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBACtC,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC;gBAC3C,OAAO;YACT,CAAC;QACH,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC;IACrC,CAAC;CACF","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\nimport { Schema } from \"../Metadata/Schema\";\n\n/**\n * Utility class for working with Schema graphs.\n * @internal\n */\nexport class SchemaGraphUtil {\n /**\n * Creates a flattened list of schemas in topological order, typically used before schema import\n * so that dependent schemas are processed after their references.\n * @param insertSchema The schema to be imported.\n * @param schemas The schema collection that will hold the ordered schemas. If null, the collection\n * will be created internally and passed along during recursive calls.\n */\n public static buildDependencyOrderedSchemaList(insertSchema: Schema, schemas?: Schema[]): Schema[] {\n if (!schemas)\n schemas = [];\n\n this.insertSchemaInDependencyOrderedList(schemas, insertSchema);\n for (const reference of insertSchema.references) {\n this.buildDependencyOrderedSchemaList(reference, schemas);\n }\n return schemas;\n }\n\n /**\n * Indicates if the given Schema references the possibleDependency Schema.\n * @param schema The possible dependent schema.\n * @param possibleDependency The possible Schema dependency.\n */\n private static dependsOn(schema: Schema, possibleDependency: Schema): boolean {\n if (this.directlyReferences(schema, possibleDependency))\n return true;\n\n // search for dependencies in indirect references\n for (const reference of schema.references) {\n if (this.dependsOn(reference, possibleDependency))\n return true;\n }\n\n return false;\n }\n\n /**\n * Indicates if the given Schema directly references the possiblyReferencedSchema Schema.\n * @param schema The possible parent schema.\n * @param possibleDependency The Schema that may be referenced.\n */\n private static directlyReferences(schema: Schema, possiblyReferencedSchema: Schema): boolean {\n for (const reference of schema.references) {\n if (reference === possiblyReferencedSchema)\n return true;\n }\n\n return false;\n }\n\n /**\n * Helper method that manages the insertion of a Schema into the schemas collection\n * based on the topological ordering algorithm.\n * @param schemas The ordered Schema collection.\n * @param insertSchema The Schema to insert.\n */\n private static insertSchemaInDependencyOrderedList(schemas: Schema[], insertSchema: Schema) {\n if (schemas.includes(insertSchema))\n return;\n\n for (let i = schemas.length - 1; i >= 0; --i) {\n const schema = schemas[i];\n if (this.dependsOn(insertSchema, schema)) {\n // insert right after the referenced schema in the list\n const index = schemas.indexOf(schema);\n schemas.splice(index + 1, 0, insertSchema);\n return;\n }\n }\n\n schemas.splice(0, 0, insertSchema);\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { AbstractParser, CAProviderTuple } from "./AbstractParser";
2
2
  import { ConstantProps, CustomAttributeClassProps, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps, MixinProps, NavigationPropertyProps, PhenomenonProps, PrimitiveArrayPropertyProps, PrimitivePropertyProps, PropertyCategoryProps, RelationshipClassProps, SchemaItemFormatProps, SchemaItemUnitProps, SchemaProps, SchemaReferenceProps, StructArrayPropertyProps, StructClassProps, StructPropertyProps, UnitSystemProps } from "./JsonProps";
3
+ import { ECSpecVersion } from "./Helper";
3
4
  /** @internal */
4
5
  export declare class XmlParser extends AbstractParser<Element> {
5
6
  private _rawSchema;
@@ -8,11 +9,11 @@ export declare class XmlParser extends AbstractParser<Element> {
8
9
  private _schemaAlias;
9
10
  private _schemaVersion?;
10
11
  private _xmlNamespace?;
11
- private _ecXmlVersion?;
12
12
  private _currentItemFullName?;
13
13
  private _schemaItems;
14
14
  private _mapIsPopulated;
15
15
  constructor(rawSchema: Readonly<Document>);
16
+ get getECSpecVersion(): ECSpecVersion | undefined;
16
17
  parseSchema(): SchemaProps;
17
18
  getReferences(): Iterable<SchemaReferenceProps>;
18
19
  getItems(): Iterable<[string, string, Element]>;
@@ -76,7 +77,7 @@ export declare class XmlParser extends AbstractParser<Element> {
76
77
  private getPoint2DPropertyValue;
77
78
  private getPoint3DPropertyValue;
78
79
  private isSchemaFullNameValidForVersion;
79
- private parseXmlNamespace;
80
+ static parseXmlNamespace(xmlNamespace: string): ECSpecVersion | undefined;
80
81
  private getQualifiedTypeName;
81
82
  /** The rest of the API uses the full name format of `{SchemaName}.{SchemaItemName}`,
82
83
  * meaning all of the references in the format string need to be changed.
@@ -1 +1 @@
1
- {"version":3,"file":"XmlParser.d.ts","sourceRoot":"","sources":["../../../src/Deserialization/XmlParser.ts"],"names":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IAWhF,OAAO,CAAC,oBAAoB;IAa5B;;OAEG;IACH,OAAO,CAAC,6BAA6B;CAwBtC"}
@@ -7,6 +7,7 @@ import { parsePrimitiveType, PrimitiveType, primitiveTypeToString, StrengthDirec
7
7
  import { ECObjectsError, ECObjectsStatus } from "../Exception";
8
8
  import { ECName } from "../ECName";
9
9
  import { AbstractParser } from "./AbstractParser";
10
+ import { SchemaReadHelper } from "./Helper";
10
11
  const NON_ITEM_SCHEMA_ELEMENTS = ["ECSchemaReference", "ECCustomAttributes"];
11
12
  const ECXML_URI = "http://www\\.bentley\\.com/schemas/Bentley\\.ECXML";
12
13
  /** @internal */
@@ -29,11 +30,12 @@ export class XmlParser extends AbstractParser {
29
30
  const xmlNamespace = schemaInfo.getAttribute("xmlns");
30
31
  if (xmlNamespace) {
31
32
  this._xmlNamespace = xmlNamespace;
32
- this._ecXmlVersion = this.parseXmlNamespace(this._xmlNamespace);
33
+ this._ecSpecVersion = XmlParser.parseXmlNamespace(this._xmlNamespace);
33
34
  }
34
35
  this._schemaItems = new Map();
35
36
  this._mapIsPopulated = false;
36
37
  }
38
+ get getECSpecVersion() { return this._ecSpecVersion; }
37
39
  parseSchema() {
38
40
  const schemaMetadata = this._rawSchema.documentElement;
39
41
  if ("ECSchema" !== schemaMetadata.nodeName)
@@ -47,7 +49,7 @@ export class XmlParser extends AbstractParser {
47
49
  throw new ECObjectsError(ECObjectsStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} is missing a required 'version' attribute`);
48
50
  if (this._xmlNamespace === undefined)
49
51
  throw new ECObjectsError(ECObjectsStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} is missing a required 'xmlns' attribute`);
50
- if (this._ecXmlVersion === undefined)
52
+ if (this._ecSpecVersion === undefined)
51
53
  throw new ECObjectsError(ECObjectsStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} has an invalid 'xmlns' attribute`);
52
54
  const alias = this.getRequiredAttribute(schemaMetadata, "alias", `The ECSchema ${this._schemaName} is missing a required 'alias' attribute`);
53
55
  const description = this.getOptionalAttribute(schemaMetadata, "description");
@@ -59,6 +61,8 @@ export class XmlParser extends AbstractParser {
59
61
  alias,
60
62
  label: displayLabel,
61
63
  description,
64
+ ecSpecMajorVersion: this._ecSpecVersion.readVersion,
65
+ ecSpecMinorVersion: this._ecSpecVersion.writeVersion,
62
66
  };
63
67
  return schemaProps;
64
68
  }
@@ -84,8 +88,11 @@ export class XmlParser extends AbstractParser {
84
88
  rawItemType = "Mixin";
85
89
  }
86
90
  const itemType = this.getSchemaItemType(rawItemType);
87
- if (itemType === undefined)
91
+ if (itemType === undefined) {
92
+ if (SchemaReadHelper.isECSpecVersionNewer(this._ecSpecVersion))
93
+ continue;
88
94
  throw new ECObjectsError(ECObjectsStatus.InvalidSchemaXML, `A SchemaItem in ${this._schemaName} has an invalid type. '${rawItemType}' is not a valid SchemaItem type.`);
95
+ }
89
96
  const itemName = this.getRequiredAttribute(item, "typeName", `A SchemaItem in ${this._schemaName} is missing the required 'typeName' attribute.`);
90
97
  if (!ECName.validate(itemName))
91
98
  throw new ECObjectsError(ECObjectsStatus.InvalidECName, `A SchemaItem in ${this._schemaName} has an invalid 'typeName' attribute. '${itemName}' is not a valid ECName.`);
@@ -218,12 +225,18 @@ export class XmlParser extends AbstractParser {
218
225
  // TODO: This shouldn't be verified here. It's for the deserialize method to handle. The only reason it's currently done here so that the xml
219
226
  // value can be put in the correct type, number or string.
220
227
  let tempBackingType;
221
- if (/int/i.test(enumType))
228
+ if (/int/i.test(enumType)) {
222
229
  tempBackingType = PrimitiveType.Integer;
223
- else if (/string/i.test(enumType))
230
+ }
231
+ else if (/string/i.test(enumType)) {
224
232
  tempBackingType = PrimitiveType.String;
225
- else
226
- throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Enumeration ${this._currentItemFullName} has an invalid 'backingTypeName' attribute. It should be either "int" or "string".`);
233
+ }
234
+ else {
235
+ if (SchemaReadHelper.isECSpecVersionNewer(this._ecSpecVersion))
236
+ tempBackingType = PrimitiveType.String;
237
+ else
238
+ throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Enumeration ${this._currentItemFullName} has an invalid 'backingTypeName' attribute. It should be either "int" or "string".`);
239
+ }
227
240
  let isStrictString = this.getOptionalAttribute(xmlElement, "isStrict");
228
241
  if (isStrictString === undefined)
229
242
  isStrictString = "true";
@@ -254,6 +267,8 @@ export class XmlParser extends AbstractParser {
254
267
  type: enumType,
255
268
  isStrict,
256
269
  enumerators,
270
+ originalECSpecMajorVersion: this._ecSpecVersion?.readVersion,
271
+ originalECSpecMinorVersion: this._ecSpecVersion?.writeVersion,
257
272
  };
258
273
  }
259
274
  parseKindOfQuantity(xmlElement) {
@@ -616,6 +631,8 @@ export class XmlParser extends AbstractParser {
616
631
  ...itemProps,
617
632
  modifier,
618
633
  baseClass,
634
+ originalECSpecMajorVersion: this._ecSpecVersion?.readVersion,
635
+ originalECSpecMinorVersion: this._ecSpecVersion?.writeVersion,
619
636
  };
620
637
  }
621
638
  getRelationshipConstraintProps(xmlElement, isSource) {
@@ -747,14 +764,14 @@ export class XmlParser extends AbstractParser {
747
764
  }
748
765
  }
749
766
  getCustomAttributeProvider(xmlCustomAttribute) {
750
- assert(this._ecXmlVersion !== undefined);
767
+ assert(this._ecSpecVersion !== undefined);
751
768
  let ns = xmlCustomAttribute.getAttribute("xmlns");
752
769
  if (!ns) {
753
770
  assert(this._schemaName !== undefined);
754
771
  assert(this._schemaVersion !== undefined);
755
772
  ns = `${this._schemaName}.${this._schemaVersion}`;
756
773
  }
757
- if (null === ns || !this.isSchemaFullNameValidForVersion(ns, this._ecXmlVersion))
774
+ if (null === ns || !this.isSchemaFullNameValidForVersion(ns, this._ecSpecVersion))
758
775
  throw new ECObjectsError(ECObjectsStatus.InvalidSchemaXML, `Custom attribute namespaces must contain a valid 3.2 full schema name in the form <schemaName>.RR.ww.mm.`);
759
776
  const schemaNameParts = ns.split(".");
760
777
  const className = `${schemaNameParts[0]}.${xmlCustomAttribute.tagName}`;
@@ -832,7 +849,9 @@ export class XmlParser extends AbstractParser {
832
849
  return structObj;
833
850
  }
834
851
  readPrimitivePropertyValue(propElement, primitiveType) {
835
- if (!propElement.textContent)
852
+ if (undefined === propElement.textContent || null === propElement.textContent)
853
+ throw new ECObjectsError(ECObjectsStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid property value.`);
854
+ if (propElement.textContent === "" && primitiveType !== PrimitiveType.String)
836
855
  throw new ECObjectsError(ECObjectsStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid property value.`);
837
856
  // TODO: Mapping all primitive types to string, number and boolean
838
857
  // for now. Need to review with IModelJs.
@@ -910,9 +929,9 @@ export class XmlParser extends AbstractParser {
910
929
  throw new ECObjectsError(ECObjectsStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 3D value was expected.`);
911
930
  return { x, y, z };
912
931
  }
913
- isSchemaFullNameValidForVersion(schemaFullName, ecXmlVersion) {
932
+ isSchemaFullNameValidForVersion(schemaFullName, ecSpecVersion) {
914
933
  const schemaNameParts = schemaFullName.split(".");
915
- if ((ecXmlVersion.readVersion >= 3 && ecXmlVersion.writeVersion >= 2) || ecXmlVersion.readVersion > 3) {
934
+ if ((ecSpecVersion.readVersion >= 3 && ecSpecVersion.writeVersion >= 2) || ecSpecVersion.readVersion > 3) {
916
935
  if (schemaNameParts.length < 4)
917
936
  return false;
918
937
  }
@@ -922,7 +941,7 @@ export class XmlParser extends AbstractParser {
922
941
  }
923
942
  return true;
924
943
  }
925
- parseXmlNamespace(xmlNamespace) {
944
+ static parseXmlNamespace(xmlNamespace) {
926
945
  const regEx = new RegExp(`^${ECXML_URI}\\.([0-9]+)\\.([0-9]+)$`);
927
946
  const match = xmlNamespace.match(regEx);
928
947
  if (!match)