@itwin/ecschema-metadata 5.0.0-dev.11 → 5.0.0-dev.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +73 -1
- package/lib/cjs/Constants.d.ts +8 -0
- package/lib/cjs/Constants.d.ts.map +1 -1
- package/lib/cjs/Constants.js +30 -21
- package/lib/cjs/Constants.js.map +1 -1
- package/lib/cjs/Context.d.ts +85 -36
- package/lib/cjs/Context.d.ts.map +1 -1
- package/lib/cjs/Context.js +79 -29
- package/lib/cjs/Context.js.map +1 -1
- package/lib/cjs/DelayedPromise.d.ts +9 -8
- package/lib/cjs/DelayedPromise.d.ts.map +1 -1
- package/lib/cjs/DelayedPromise.js +8 -6
- package/lib/cjs/DelayedPromise.js.map +1 -1
- package/lib/cjs/Deserialization/AbstractParser.js +1 -0
- package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
- package/lib/cjs/Deserialization/Helper.d.ts +3 -3
- package/lib/cjs/Deserialization/Helper.d.ts.map +1 -1
- package/lib/cjs/Deserialization/Helper.js +35 -26
- package/lib/cjs/Deserialization/Helper.js.map +1 -1
- package/lib/cjs/Deserialization/JsonParser.js +153 -150
- package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.d.ts +47 -33
- package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.js +3 -3
- package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
- package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.d.ts.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.js +60 -52
- package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts +0 -5
- package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.js +8 -17
- package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/cjs/ECName.d.ts +2 -2
- package/lib/cjs/ECName.js +5 -4
- package/lib/cjs/ECName.js.map +1 -1
- package/lib/cjs/ECObjects.d.ts +41 -9
- package/lib/cjs/ECObjects.d.ts.map +1 -1
- package/lib/cjs/ECObjects.js +78 -24
- package/lib/cjs/ECObjects.js.map +1 -1
- package/lib/cjs/Exception.d.ts +4 -4
- package/lib/cjs/Exception.d.ts.map +1 -1
- package/lib/cjs/Exception.js +61 -60
- package/lib/cjs/Exception.js.map +1 -1
- package/lib/cjs/Interfaces.d.ts +35 -32
- package/lib/cjs/Interfaces.d.ts.map +1 -1
- package/lib/cjs/Interfaces.js.map +1 -1
- package/lib/cjs/Metadata/Class.d.ts +179 -32
- package/lib/cjs/Metadata/Class.d.ts.map +1 -1
- package/lib/cjs/Metadata/Class.js +290 -88
- package/lib/cjs/Metadata/Class.js.map +1 -1
- package/lib/cjs/Metadata/Constant.d.ts +26 -10
- package/lib/cjs/Metadata/Constant.d.ts.map +1 -1
- package/lib/cjs/Metadata/Constant.js +38 -10
- package/lib/cjs/Metadata/Constant.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttribute.d.ts +2 -2
- package/lib/cjs/Metadata/CustomAttribute.d.ts.map +1 -1
- package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.d.ts +21 -7
- package/lib/cjs/Metadata/CustomAttributeClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.js +28 -8
- package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/cjs/Metadata/EntityClass.d.ts +40 -11
- package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js +72 -34
- package/lib/cjs/Metadata/EntityClass.js.map +1 -1
- package/lib/cjs/Metadata/Enumeration.d.ts +30 -10
- package/lib/cjs/Metadata/Enumeration.d.ts.map +1 -1
- package/lib/cjs/Metadata/Enumeration.js +41 -13
- package/lib/cjs/Metadata/Enumeration.js.map +1 -1
- package/lib/cjs/Metadata/Format.d.ts +65 -17
- package/lib/cjs/Metadata/Format.d.ts.map +1 -1
- package/lib/cjs/Metadata/Format.js +107 -22
- package/lib/cjs/Metadata/Format.js.map +1 -1
- package/lib/cjs/Metadata/InvertedUnit.d.ts +19 -10
- package/lib/cjs/Metadata/InvertedUnit.d.ts.map +1 -1
- package/lib/cjs/Metadata/InvertedUnit.js +32 -15
- package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.d.ts +38 -18
- package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.js +90 -40
- package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/cjs/Metadata/Mixin.d.ts +31 -4
- package/lib/cjs/Metadata/Mixin.d.ts.map +1 -1
- package/lib/cjs/Metadata/Mixin.js +42 -8
- package/lib/cjs/Metadata/Mixin.js.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.d.ts +12 -12
- package/lib/cjs/Metadata/OverrideFormat.d.ts.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.js +36 -19
- package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
- package/lib/cjs/Metadata/Phenomenon.d.ts +24 -3
- package/lib/cjs/Metadata/Phenomenon.d.ts.map +1 -1
- package/lib/cjs/Metadata/Phenomenon.js +32 -3
- package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
- package/lib/cjs/Metadata/Property.d.ts +47 -25
- package/lib/cjs/Metadata/Property.d.ts.map +1 -1
- package/lib/cjs/Metadata/Property.js +128 -49
- package/lib/cjs/Metadata/Property.js.map +1 -1
- package/lib/cjs/Metadata/PropertyCategory.d.ts +20 -4
- package/lib/cjs/Metadata/PropertyCategory.d.ts.map +1 -1
- package/lib/cjs/Metadata/PropertyCategory.js +31 -4
- package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.d.ts +63 -27
- package/lib/cjs/Metadata/RelationshipClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.js +100 -43
- package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
- package/lib/cjs/Metadata/Schema.d.ts +167 -41
- package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
- package/lib/cjs/Metadata/Schema.js +211 -111
- package/lib/cjs/Metadata/Schema.js.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.d.ts +19 -19
- package/lib/cjs/Metadata/SchemaItem.d.ts.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.js +23 -21
- package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
- package/lib/cjs/Metadata/Unit.d.ts +24 -21
- package/lib/cjs/Metadata/Unit.d.ts.map +1 -1
- package/lib/cjs/Metadata/Unit.js +40 -24
- package/lib/cjs/Metadata/Unit.js.map +1 -1
- package/lib/cjs/Metadata/UnitSystem.d.ts +17 -4
- package/lib/cjs/Metadata/UnitSystem.d.ts.map +1 -1
- package/lib/cjs/Metadata/UnitSystem.js +24 -4
- package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
- package/lib/cjs/PropertyTypes.d.ts +11 -11
- package/lib/cjs/PropertyTypes.d.ts.map +1 -1
- package/lib/cjs/PropertyTypes.js +28 -20
- package/lib/cjs/PropertyTypes.js.map +1 -1
- package/lib/cjs/SchemaFormatsProvider.d.ts +39 -0
- package/lib/cjs/SchemaFormatsProvider.d.ts.map +1 -0
- package/lib/cjs/SchemaFormatsProvider.js +146 -0
- package/lib/cjs/SchemaFormatsProvider.js.map +1 -0
- package/lib/cjs/SchemaJsonLocater.d.ts +8 -8
- package/lib/cjs/SchemaJsonLocater.d.ts.map +1 -1
- package/lib/cjs/SchemaJsonLocater.js +7 -7
- package/lib/cjs/SchemaJsonLocater.js.map +1 -1
- package/lib/cjs/SchemaKey.d.ts +13 -7
- package/lib/cjs/SchemaKey.d.ts.map +1 -1
- package/lib/cjs/SchemaKey.js +22 -12
- package/lib/cjs/SchemaKey.js.map +1 -1
- package/lib/cjs/SchemaLoader.d.ts +5 -5
- package/lib/cjs/SchemaLoader.d.ts.map +1 -1
- package/lib/cjs/SchemaLoader.js +5 -4
- package/lib/cjs/SchemaLoader.js.map +1 -1
- package/lib/cjs/SchemaPartVisitorDelegate.d.ts +2 -2
- package/lib/cjs/SchemaPartVisitorDelegate.js +2 -1
- package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/cjs/UnitConversion/Graph.js +69 -65
- package/lib/cjs/UnitConversion/Graph.js.map +1 -1
- package/lib/cjs/UnitConversion/Parser.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConversion.d.ts +1 -1
- package/lib/cjs/UnitConversion/UnitConversion.d.ts.map +1 -1
- package/lib/cjs/UnitConversion/UnitConversion.js +9 -7
- package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConverter.js +2 -0
- package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitTree.d.ts +2 -0
- package/lib/cjs/UnitConversion/UnitTree.d.ts.map +1 -1
- package/lib/cjs/UnitConversion/UnitTree.js +11 -1
- package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js +8 -9
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.d.ts +1 -1
- package/lib/cjs/Validation/SchemaWalker.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js +6 -4
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-metadata.d.ts +1 -0
- package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
- package/lib/cjs/ecschema-metadata.js +1 -0
- package/lib/cjs/ecschema-metadata.js.map +1 -1
- package/lib/cjs/utils/SchemaGraph.js +5 -6
- package/lib/cjs/utils/SchemaGraph.js.map +1 -1
- package/lib/esm/Constants.d.ts +8 -0
- package/lib/esm/Constants.d.ts.map +1 -1
- package/lib/esm/Constants.js +29 -20
- package/lib/esm/Constants.js.map +1 -1
- package/lib/esm/Context.d.ts +85 -36
- package/lib/esm/Context.d.ts.map +1 -1
- package/lib/esm/Context.js +78 -28
- package/lib/esm/Context.js.map +1 -1
- package/lib/esm/DelayedPromise.d.ts +9 -8
- package/lib/esm/DelayedPromise.d.ts.map +1 -1
- package/lib/esm/DelayedPromise.js +8 -6
- package/lib/esm/DelayedPromise.js.map +1 -1
- package/lib/esm/Deserialization/AbstractParser.js +1 -0
- package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
- package/lib/esm/Deserialization/Helper.d.ts +3 -3
- package/lib/esm/Deserialization/Helper.d.ts.map +1 -1
- package/lib/esm/Deserialization/Helper.js +36 -27
- package/lib/esm/Deserialization/Helper.js.map +1 -1
- package/lib/esm/Deserialization/JsonParser.js +154 -151
- package/lib/esm/Deserialization/JsonParser.js.map +1 -1
- package/lib/esm/Deserialization/JsonProps.d.ts +47 -33
- package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/esm/Deserialization/JsonProps.js +3 -3
- package/lib/esm/Deserialization/JsonProps.js.map +1 -1
- package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
- package/lib/esm/Deserialization/XmlParser.d.ts.map +1 -1
- package/lib/esm/Deserialization/XmlParser.js +61 -53
- package/lib/esm/Deserialization/XmlParser.js.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.d.ts +0 -5
- package/lib/esm/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.js +9 -18
- package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/esm/ECName.d.ts +2 -2
- package/lib/esm/ECName.js +6 -5
- package/lib/esm/ECName.js.map +1 -1
- package/lib/esm/ECObjects.d.ts +41 -9
- package/lib/esm/ECObjects.d.ts.map +1 -1
- package/lib/esm/ECObjects.js +77 -24
- package/lib/esm/ECObjects.js.map +1 -1
- package/lib/esm/Exception.d.ts +4 -4
- package/lib/esm/Exception.d.ts.map +1 -1
- package/lib/esm/Exception.js +59 -58
- package/lib/esm/Exception.js.map +1 -1
- package/lib/esm/Interfaces.d.ts +35 -32
- package/lib/esm/Interfaces.d.ts.map +1 -1
- package/lib/esm/Interfaces.js.map +1 -1
- package/lib/esm/Metadata/Class.d.ts +179 -32
- package/lib/esm/Metadata/Class.d.ts.map +1 -1
- package/lib/esm/Metadata/Class.js +292 -90
- package/lib/esm/Metadata/Class.js.map +1 -1
- package/lib/esm/Metadata/Constant.d.ts +26 -10
- package/lib/esm/Metadata/Constant.d.ts.map +1 -1
- package/lib/esm/Metadata/Constant.js +39 -11
- package/lib/esm/Metadata/Constant.js.map +1 -1
- package/lib/esm/Metadata/CustomAttribute.d.ts +2 -2
- package/lib/esm/Metadata/CustomAttribute.d.ts.map +1 -1
- package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.d.ts +21 -7
- package/lib/esm/Metadata/CustomAttributeClass.d.ts.map +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.js +29 -9
- package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/esm/Metadata/EntityClass.d.ts +40 -11
- package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/esm/Metadata/EntityClass.js +73 -35
- package/lib/esm/Metadata/EntityClass.js.map +1 -1
- package/lib/esm/Metadata/Enumeration.d.ts +30 -10
- package/lib/esm/Metadata/Enumeration.d.ts.map +1 -1
- package/lib/esm/Metadata/Enumeration.js +42 -14
- package/lib/esm/Metadata/Enumeration.js.map +1 -1
- package/lib/esm/Metadata/Format.d.ts +65 -17
- package/lib/esm/Metadata/Format.d.ts.map +1 -1
- package/lib/esm/Metadata/Format.js +108 -23
- package/lib/esm/Metadata/Format.js.map +1 -1
- package/lib/esm/Metadata/InvertedUnit.d.ts +19 -10
- package/lib/esm/Metadata/InvertedUnit.d.ts.map +1 -1
- package/lib/esm/Metadata/InvertedUnit.js +33 -16
- package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.d.ts +38 -18
- package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.js +91 -41
- package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/esm/Metadata/Mixin.d.ts +31 -4
- package/lib/esm/Metadata/Mixin.d.ts.map +1 -1
- package/lib/esm/Metadata/Mixin.js +44 -10
- package/lib/esm/Metadata/Mixin.js.map +1 -1
- package/lib/esm/Metadata/OverrideFormat.d.ts +12 -12
- package/lib/esm/Metadata/OverrideFormat.d.ts.map +1 -1
- package/lib/esm/Metadata/OverrideFormat.js +37 -20
- package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
- package/lib/esm/Metadata/Phenomenon.d.ts +24 -3
- package/lib/esm/Metadata/Phenomenon.d.ts.map +1 -1
- package/lib/esm/Metadata/Phenomenon.js +33 -4
- package/lib/esm/Metadata/Phenomenon.js.map +1 -1
- package/lib/esm/Metadata/Property.d.ts +47 -25
- package/lib/esm/Metadata/Property.d.ts.map +1 -1
- package/lib/esm/Metadata/Property.js +130 -51
- package/lib/esm/Metadata/Property.js.map +1 -1
- package/lib/esm/Metadata/PropertyCategory.d.ts +20 -4
- package/lib/esm/Metadata/PropertyCategory.d.ts.map +1 -1
- package/lib/esm/Metadata/PropertyCategory.js +31 -4
- package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.d.ts +63 -27
- package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.js +102 -45
- package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
- package/lib/esm/Metadata/Schema.d.ts +167 -41
- package/lib/esm/Metadata/Schema.d.ts.map +1 -1
- package/lib/esm/Metadata/Schema.js +212 -112
- package/lib/esm/Metadata/Schema.js.map +1 -1
- package/lib/esm/Metadata/SchemaItem.d.ts +19 -19
- package/lib/esm/Metadata/SchemaItem.d.ts.map +1 -1
- package/lib/esm/Metadata/SchemaItem.js +25 -23
- package/lib/esm/Metadata/SchemaItem.js.map +1 -1
- package/lib/esm/Metadata/Unit.d.ts +24 -21
- package/lib/esm/Metadata/Unit.d.ts.map +1 -1
- package/lib/esm/Metadata/Unit.js +41 -25
- package/lib/esm/Metadata/Unit.js.map +1 -1
- package/lib/esm/Metadata/UnitSystem.d.ts +17 -4
- package/lib/esm/Metadata/UnitSystem.d.ts.map +1 -1
- package/lib/esm/Metadata/UnitSystem.js +24 -4
- package/lib/esm/Metadata/UnitSystem.js.map +1 -1
- package/lib/esm/PropertyTypes.d.ts +11 -11
- package/lib/esm/PropertyTypes.d.ts.map +1 -1
- package/lib/esm/PropertyTypes.js +29 -21
- package/lib/esm/PropertyTypes.js.map +1 -1
- package/lib/esm/SchemaFormatsProvider.d.ts +39 -0
- package/lib/esm/SchemaFormatsProvider.d.ts.map +1 -0
- package/lib/esm/SchemaFormatsProvider.js +142 -0
- package/lib/esm/SchemaFormatsProvider.js.map +1 -0
- package/lib/esm/SchemaJsonLocater.d.ts +8 -8
- package/lib/esm/SchemaJsonLocater.d.ts.map +1 -1
- package/lib/esm/SchemaJsonLocater.js +7 -7
- package/lib/esm/SchemaJsonLocater.js.map +1 -1
- package/lib/esm/SchemaKey.d.ts +13 -7
- package/lib/esm/SchemaKey.d.ts.map +1 -1
- package/lib/esm/SchemaKey.js +23 -13
- package/lib/esm/SchemaKey.js.map +1 -1
- package/lib/esm/SchemaLoader.d.ts +5 -5
- package/lib/esm/SchemaLoader.d.ts.map +1 -1
- package/lib/esm/SchemaLoader.js +6 -5
- package/lib/esm/SchemaLoader.js.map +1 -1
- package/lib/esm/SchemaPartVisitorDelegate.d.ts +2 -2
- package/lib/esm/SchemaPartVisitorDelegate.js +2 -1
- package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/esm/UnitConversion/Graph.js +69 -65
- package/lib/esm/UnitConversion/Graph.js.map +1 -1
- package/lib/esm/UnitConversion/Parser.js.map +1 -1
- package/lib/esm/UnitConversion/UnitConversion.d.ts +1 -1
- package/lib/esm/UnitConversion/UnitConversion.d.ts.map +1 -1
- package/lib/esm/UnitConversion/UnitConversion.js +9 -7
- package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
- package/lib/esm/UnitConversion/UnitConverter.js +2 -0
- package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/esm/UnitConversion/UnitTree.d.ts +2 -0
- package/lib/esm/UnitConversion/UnitTree.d.ts.map +1 -1
- package/lib/esm/UnitConversion/UnitTree.js +11 -1
- package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.js +8 -9
- package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/esm/Validation/SchemaWalker.d.ts +1 -1
- package/lib/esm/Validation/SchemaWalker.d.ts.map +1 -1
- package/lib/esm/Validation/SchemaWalker.js +6 -4
- package/lib/esm/Validation/SchemaWalker.js.map +1 -1
- package/lib/esm/ecschema-metadata.d.ts +1 -0
- package/lib/esm/ecschema-metadata.d.ts.map +1 -1
- package/lib/esm/ecschema-metadata.js +1 -0
- package/lib/esm/ecschema-metadata.js.map +1 -1
- package/lib/esm/utils/SchemaGraph.js +6 -7
- package/lib/esm/utils/SchemaGraph.js.map +1 -1
- package/package.json +16 -14
|
@@ -8,6 +8,7 @@ exports.XmlParser = void 0;
|
|
|
8
8
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
9
9
|
const ECObjects_1 = require("../ECObjects");
|
|
10
10
|
const Exception_1 = require("../Exception");
|
|
11
|
+
const Enumeration_1 = require("../Metadata/Enumeration");
|
|
11
12
|
const ECName_1 = require("../ECName");
|
|
12
13
|
const AbstractParser_1 = require("./AbstractParser");
|
|
13
14
|
const Helper_1 = require("./Helper");
|
|
@@ -15,6 +16,15 @@ const NON_ITEM_SCHEMA_ELEMENTS = ["ECSchemaReference", "ECCustomAttributes"];
|
|
|
15
16
|
const ECXML_URI = "http://www\\.bentley\\.com/schemas/Bentley\\.ECXML";
|
|
16
17
|
/** @internal */
|
|
17
18
|
class XmlParser extends AbstractParser_1.AbstractParser {
|
|
19
|
+
_rawSchema;
|
|
20
|
+
_schemaName;
|
|
21
|
+
_schemaReferenceNames;
|
|
22
|
+
_schemaAlias;
|
|
23
|
+
_schemaVersion;
|
|
24
|
+
_xmlNamespace;
|
|
25
|
+
_currentItemFullName;
|
|
26
|
+
_schemaItems;
|
|
27
|
+
_mapIsPopulated;
|
|
18
28
|
constructor(rawSchema) {
|
|
19
29
|
super();
|
|
20
30
|
this._rawSchema = rawSchema;
|
|
@@ -42,18 +52,18 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
42
52
|
parseSchema() {
|
|
43
53
|
const schemaMetadata = this._rawSchema.documentElement;
|
|
44
54
|
if ("ECSchema" !== schemaMetadata.nodeName)
|
|
45
|
-
throw new Exception_1.
|
|
55
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, "An ECSchema is missing the required metadata.");
|
|
46
56
|
const schemaDefDuplicates = this.getElementChildrenByTagName(schemaMetadata, "ECSchema");
|
|
47
57
|
if (schemaDefDuplicates.length > 1)
|
|
48
|
-
throw new Exception_1.
|
|
58
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, "An ECSchema has more than one ECSchema definition. Only one is allowed.");
|
|
49
59
|
if (this._schemaName === undefined)
|
|
50
|
-
throw new Exception_1.
|
|
60
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `An ECSchema is missing a required 'schemaName' attribute`);
|
|
51
61
|
if (this._schemaVersion === undefined)
|
|
52
|
-
throw new Exception_1.
|
|
62
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} is missing a required 'version' attribute`);
|
|
53
63
|
if (this._xmlNamespace === undefined)
|
|
54
|
-
throw new Exception_1.
|
|
64
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} is missing a required 'xmlns' attribute`);
|
|
55
65
|
if (this._ecSpecVersion === undefined)
|
|
56
|
-
throw new Exception_1.
|
|
66
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} has an invalid 'xmlns' attribute`);
|
|
57
67
|
const alias = this.getRequiredAttribute(schemaMetadata, "alias", `The ECSchema ${this._schemaName} is missing a required 'alias' attribute`);
|
|
58
68
|
const description = this.getOptionalAttribute(schemaMetadata, "description");
|
|
59
69
|
const displayLabel = this.getOptionalAttribute(schemaMetadata, "displayLabel");
|
|
@@ -94,11 +104,11 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
94
104
|
if (itemType === undefined) {
|
|
95
105
|
if (Helper_1.SchemaReadHelper.isECSpecVersionNewer(this._ecSpecVersion))
|
|
96
106
|
continue;
|
|
97
|
-
throw new Exception_1.
|
|
107
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `A SchemaItem in ${this._schemaName} has an invalid type. '${rawItemType}' is not a valid SchemaItem type.`);
|
|
98
108
|
}
|
|
99
109
|
const itemName = this.getRequiredAttribute(item, "typeName", `A SchemaItem in ${this._schemaName} is missing the required 'typeName' attribute.`);
|
|
100
110
|
if (!ECName_1.ECName.validate(itemName))
|
|
101
|
-
throw new Exception_1.
|
|
111
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidECName, `A SchemaItem in ${this._schemaName} has an invalid 'typeName' attribute. '${itemName}' is not a valid ECName.`);
|
|
102
112
|
this._currentItemFullName = `${this._schemaName}.${itemName}`;
|
|
103
113
|
this._schemaItems.set(itemName, [itemType, item]);
|
|
104
114
|
yield [itemName, itemType, item];
|
|
@@ -157,22 +167,22 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
157
167
|
const baseClasses = this.getElementChildrenByTagName(xmlElement, "BaseClass");
|
|
158
168
|
// Mixins can only have one base class
|
|
159
169
|
if (baseClasses.length > 1)
|
|
160
|
-
throw new Exception_1.
|
|
170
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} has more than one base class which is not allowed.`);
|
|
161
171
|
const customAttributesResult = this.getElementChildrenByTagName(xmlElement, "ECCustomAttributes");
|
|
162
172
|
if (customAttributesResult.length < 1)
|
|
163
|
-
throw new Exception_1.
|
|
173
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'IsMixin' tag.`);
|
|
164
174
|
const customAttributes = customAttributesResult[0];
|
|
165
175
|
const isMixinResult = this.getElementChildrenByTagName(customAttributes, "IsMixin");
|
|
166
176
|
if (isMixinResult.length < 1)
|
|
167
|
-
throw new Exception_1.
|
|
177
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'IsMixin' tag.`);
|
|
168
178
|
const mixinAttributes = isMixinResult[0];
|
|
169
179
|
const appliesToResult = this.getElementChildrenByTagName(mixinAttributes, "AppliesToEntityClass");
|
|
170
180
|
if (appliesToResult.length < 1)
|
|
171
|
-
throw new Exception_1.
|
|
181
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'AppliesToEntityClass' tag.`);
|
|
172
182
|
const appliesToElement = appliesToResult[0];
|
|
173
183
|
let appliesTo = appliesToElement.textContent;
|
|
174
184
|
if (appliesTo === null || appliesTo.length === 0)
|
|
175
|
-
throw new Exception_1.
|
|
185
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'AppliesToEntityClass' tag.`);
|
|
176
186
|
appliesTo = this.getQualifiedTypeName(appliesTo);
|
|
177
187
|
const mixinProps = {
|
|
178
188
|
...classProps,
|
|
@@ -201,17 +211,17 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
201
211
|
const sourceResult = this.getElementChildrenByTagName(xmlElement, "Source");
|
|
202
212
|
if (sourceResult.length !== 1) {
|
|
203
213
|
if (sourceResult.length === 0)
|
|
204
|
-
throw new Exception_1.
|
|
214
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Source constraint tag.`);
|
|
205
215
|
else
|
|
206
|
-
throw new Exception_1.
|
|
216
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} has more than one Source constraint tag. Only one is allowed.`);
|
|
207
217
|
}
|
|
208
218
|
const source = this.getRelationshipConstraintProps(sourceResult[0], true);
|
|
209
219
|
const targetResult = this.getElementChildrenByTagName(xmlElement, "Target");
|
|
210
220
|
if (targetResult.length !== 1) {
|
|
211
221
|
if (targetResult.length === 0)
|
|
212
|
-
throw new Exception_1.
|
|
222
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Target constraint tag.`);
|
|
213
223
|
else
|
|
214
|
-
throw new Exception_1.
|
|
224
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} has more than one Target constraint tag. Only one is allowed.`);
|
|
215
225
|
}
|
|
216
226
|
const target = this.getRelationshipConstraintProps(targetResult[0], false);
|
|
217
227
|
return {
|
|
@@ -238,7 +248,7 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
238
248
|
if (Helper_1.SchemaReadHelper.isECSpecVersionNewer(this._ecSpecVersion))
|
|
239
249
|
tempBackingType = ECObjects_1.PrimitiveType.String;
|
|
240
250
|
else
|
|
241
|
-
throw new Exception_1.
|
|
251
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidECJson, `The Enumeration ${this._currentItemFullName} has an invalid 'backingTypeName' attribute. It should be either "int" or "string".`);
|
|
242
252
|
}
|
|
243
253
|
let isStrictString = this.getOptionalAttribute(xmlElement, "isStrict");
|
|
244
254
|
if (isStrictString === undefined)
|
|
@@ -253,7 +263,7 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
253
263
|
if (ECObjects_1.PrimitiveType.Integer === tempBackingType) {
|
|
254
264
|
const numericValue = parseInt(valueString, 10);
|
|
255
265
|
if (isNaN(numericValue))
|
|
256
|
-
throw new Exception_1.
|
|
266
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The Enumeration ${this._currentItemFullName} of type "int" has an enumerator with a non-integer value.`);
|
|
257
267
|
value = numericValue;
|
|
258
268
|
}
|
|
259
269
|
const label = this.getOptionalAttribute(element, "displayLabel");
|
|
@@ -279,7 +289,7 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
279
289
|
const relativeErrorString = this.getRequiredAttribute(xmlElement, "relativeError", `The KindOfQuantity ${this._currentItemFullName} is missing the required 'relativeError' attribute.`);
|
|
280
290
|
const relativeError = parseFloat(relativeErrorString);
|
|
281
291
|
if (isNaN(relativeError))
|
|
282
|
-
throw new Exception_1.
|
|
292
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The KindOfQuantity ${this._currentItemFullName} has an invalid 'relativeError' attribute. It should be a numeric value.`);
|
|
283
293
|
const presentationUnitsString = this.getOptionalAttribute(xmlElement, "presentationUnits");
|
|
284
294
|
let presentationUnits;
|
|
285
295
|
if (presentationUnitsString)
|
|
@@ -298,7 +308,7 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
298
308
|
const priorityString = this.getRequiredAttribute(xmlElement, "priority", `The PropertyCategory ${this._currentItemFullName} is missing the required 'priority' attribute.`);
|
|
299
309
|
const priority = parseInt(priorityString, 10);
|
|
300
310
|
if (isNaN(priority))
|
|
301
|
-
throw new Exception_1.
|
|
311
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The PropertyCategory ${this._currentItemFullName} has an invalid 'priority' attribute. It should be a numeric value.`);
|
|
302
312
|
return {
|
|
303
313
|
...itemProps,
|
|
304
314
|
priority,
|
|
@@ -387,11 +397,11 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
387
397
|
const units = new Array();
|
|
388
398
|
const unitsResult = this.getElementChildrenByTagName(compositeElement, "Unit");
|
|
389
399
|
if (unitsResult.length < 1)
|
|
390
|
-
throw new Exception_1.
|
|
400
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The Format ${this._currentItemFullName} has an invalid 'Composite' element. It should have 1-4 Unit elements.`);
|
|
391
401
|
for (const unit of unitsResult) {
|
|
392
402
|
let name = unit.textContent;
|
|
393
403
|
if (null === name || 0 === name.length)
|
|
394
|
-
throw new Exception_1.
|
|
404
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The Format ${this._currentItemFullName} has a Composite with an invalid Unit. One of the Units is missing the required 'name' attribute.`);
|
|
395
405
|
const label = this.getOptionalAttribute(unit, "label");
|
|
396
406
|
name = this.getQualifiedTypeName(name);
|
|
397
407
|
units.push({ name, label });
|
|
@@ -431,7 +441,7 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
431
441
|
const propertyType = this.getPropertyType(childType);
|
|
432
442
|
// This may not be needed, just a failsafe if the regex is faulty
|
|
433
443
|
if (propertyType === undefined)
|
|
434
|
-
throw new Exception_1.
|
|
444
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The ECProperty ${itemName}.${propertyName} has an invalid type. ${childType} is not a valid ECProperty type.`);
|
|
435
445
|
yield [propertyName, propertyType, child];
|
|
436
446
|
}
|
|
437
447
|
}
|
|
@@ -492,12 +502,12 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
492
502
|
getRelationshipConstraintCustomAttributeProviders(xmlElement) {
|
|
493
503
|
const sourceResult = this.getElementChildrenByTagName(xmlElement, "Source");
|
|
494
504
|
if (sourceResult.length < 1)
|
|
495
|
-
throw new Exception_1.
|
|
505
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Source constraint tag.`);
|
|
496
506
|
const sourceElement = sourceResult[0];
|
|
497
507
|
const sourceCustomAttributes = this.getCustomAttributeProviders(sourceElement, "Source Constraint of", this._currentItemFullName);
|
|
498
508
|
const targetResult = this.getElementChildrenByTagName(xmlElement, "Target");
|
|
499
509
|
if (targetResult.length < 1)
|
|
500
|
-
throw new Exception_1.
|
|
510
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Target constraint tag.`);
|
|
501
511
|
const targetElement = targetResult[0];
|
|
502
512
|
const targetCustomAttributes = this.getCustomAttributeProviders(targetElement, "Source Constraint of", this._currentItemFullName);
|
|
503
513
|
return [sourceCustomAttributes, targetCustomAttributes];
|
|
@@ -546,7 +556,7 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
546
556
|
if (resultString) {
|
|
547
557
|
result = parseFloat(resultString);
|
|
548
558
|
if (isNaN(result))
|
|
549
|
-
throw new Exception_1.
|
|
559
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, parseErrorMsg);
|
|
550
560
|
}
|
|
551
561
|
return result;
|
|
552
562
|
}
|
|
@@ -556,7 +566,7 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
556
566
|
if (resultString) {
|
|
557
567
|
result = parseInt(resultString, 10);
|
|
558
568
|
if (isNaN(result))
|
|
559
|
-
throw new Exception_1.
|
|
569
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, parseErrorMsg);
|
|
560
570
|
}
|
|
561
571
|
return result;
|
|
562
572
|
}
|
|
@@ -567,14 +577,14 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
567
577
|
else if ("false" === textString)
|
|
568
578
|
return false;
|
|
569
579
|
else
|
|
570
|
-
throw new Exception_1.
|
|
580
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, parseErrorMsg);
|
|
571
581
|
}
|
|
572
582
|
getRequiredAttribute(xmlElement, attributeName, errorMsg) {
|
|
573
583
|
if (!xmlElement.hasAttribute(attributeName))
|
|
574
|
-
throw new Exception_1.
|
|
584
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, errorMsg);
|
|
575
585
|
const result = xmlElement.getAttribute(attributeName);
|
|
576
586
|
if (result === null)
|
|
577
|
-
throw new Exception_1.
|
|
587
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, errorMsg);
|
|
578
588
|
return result;
|
|
579
589
|
}
|
|
580
590
|
getSchemaReference(xmlElement) {
|
|
@@ -650,11 +660,11 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
650
660
|
const constraintClasses = new Array();
|
|
651
661
|
const constraintClassesResult = this.getElementChildrenByTagName(xmlElement, "Class");
|
|
652
662
|
if (constraintClassesResult.length < 1)
|
|
653
|
-
throw new Exception_1.
|
|
663
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The ${constraintName} is missing the required Class tags.`);
|
|
654
664
|
for (const constraintClass of constraintClassesResult) {
|
|
655
665
|
let constraintClassId = constraintClass.getAttribute("class");
|
|
656
666
|
if (null === constraintClassId || 0 === constraintClassId.length)
|
|
657
|
-
throw new Exception_1.
|
|
667
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The ${constraintName} has a Class that is missing the required 'class' attribute.`);
|
|
658
668
|
constraintClassId = this.getQualifiedTypeName(constraintClassId);
|
|
659
669
|
constraintClasses.push(constraintClassId);
|
|
660
670
|
}
|
|
@@ -683,7 +693,7 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
683
693
|
const propName = this.getPropertyName(xmlElement);
|
|
684
694
|
const propType = this.getPropertyType(xmlElement.nodeName);
|
|
685
695
|
if (propType === undefined)
|
|
686
|
-
throw new Exception_1.
|
|
696
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The ECProperty ${this._currentItemFullName}.${propName} has an invalid type. ${propType} is not a valid ECProperty type.`);
|
|
687
697
|
const label = this.getOptionalAttribute(xmlElement, "displayLabel");
|
|
688
698
|
const description = this.getOptionalAttribute(xmlElement, "description");
|
|
689
699
|
const readOnlyString = this.getOptionalAttribute(xmlElement, "readOnly");
|
|
@@ -751,7 +761,7 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
751
761
|
else if (undefined !== maxOccursStr) {
|
|
752
762
|
maxOccurs = parseInt(maxOccursStr, 10);
|
|
753
763
|
if (isNaN(maxOccurs))
|
|
754
|
-
throw new Exception_1.
|
|
764
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'maxOccurs' attribute. It should be a numeric value.`);
|
|
755
765
|
}
|
|
756
766
|
return { minOccurs, maxOccurs };
|
|
757
767
|
}
|
|
@@ -775,7 +785,7 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
775
785
|
ns = `${this._schemaName}.${this._schemaVersion}`;
|
|
776
786
|
}
|
|
777
787
|
if (null === ns || !this.isSchemaFullNameValidForVersion(ns, this._ecSpecVersion))
|
|
778
|
-
throw new Exception_1.
|
|
788
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `Custom attribute namespaces must contain a valid 3.2 full schema name in the form <schemaName>.RR.ww.mm.`);
|
|
779
789
|
const schemaNameParts = ns.split(".");
|
|
780
790
|
const className = `${schemaNameParts[0]}.${xmlCustomAttribute.tagName}`;
|
|
781
791
|
const properties = this.getElementChildren(xmlCustomAttribute);
|
|
@@ -786,8 +796,6 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
786
796
|
}
|
|
787
797
|
addCAPropertyValues(caClass, propertyElements) {
|
|
788
798
|
const instance = { className: caClass.fullName };
|
|
789
|
-
if (!caClass.properties)
|
|
790
|
-
return instance;
|
|
791
799
|
for (const propertyElement of propertyElements) {
|
|
792
800
|
const value = this.readPropertyValue(propertyElement, caClass);
|
|
793
801
|
if (value !== undefined)
|
|
@@ -804,9 +812,9 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
804
812
|
let enumeration;
|
|
805
813
|
if (propertyClass.isPrimitive()) {
|
|
806
814
|
if (propertyClass.isEnumeration() && propertyClass.enumeration) {
|
|
807
|
-
enumeration = propertyClass.schema.lookupItemSync(propertyClass.enumeration.fullName);
|
|
815
|
+
enumeration = propertyClass.schema.lookupItemSync(propertyClass.enumeration.fullName, Enumeration_1.Enumeration);
|
|
808
816
|
if (!enumeration)
|
|
809
|
-
throw new Exception_1.
|
|
817
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.ClassNotFound, `The Enumeration class '${propertyClass.enumeration.fullName}' could not be found.`);
|
|
810
818
|
}
|
|
811
819
|
const primitiveType = enumeration && enumeration.type ? enumeration.type : (propertyClass).primitiveType;
|
|
812
820
|
return this.readPrimitivePropertyValue(propElement, primitiveType);
|
|
@@ -853,9 +861,9 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
853
861
|
}
|
|
854
862
|
readPrimitivePropertyValue(propElement, primitiveType) {
|
|
855
863
|
if (undefined === propElement.textContent || null === propElement.textContent)
|
|
856
|
-
throw new Exception_1.
|
|
864
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid property value.`);
|
|
857
865
|
if (propElement.textContent === "" && primitiveType !== ECObjects_1.PrimitiveType.String)
|
|
858
|
-
throw new Exception_1.
|
|
866
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid property value.`);
|
|
859
867
|
// TODO: Mapping all primitive types to string, number and boolean
|
|
860
868
|
// for now. Need to review with IModelJs.
|
|
861
869
|
switch (primitiveType) {
|
|
@@ -877,7 +885,7 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
877
885
|
case ECObjects_1.PrimitiveType.Double:
|
|
878
886
|
return this.getDoublePropertyValue(propElement.textContent, propElement.tagName);
|
|
879
887
|
default:
|
|
880
|
-
throw new Exception_1.
|
|
888
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid primitive type.`);
|
|
881
889
|
}
|
|
882
890
|
}
|
|
883
891
|
getBooleanPropertyValue(propValue, propName) {
|
|
@@ -889,47 +897,47 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
889
897
|
Number.parseInt(propValue, 10) === 0) {
|
|
890
898
|
return false;
|
|
891
899
|
}
|
|
892
|
-
throw new Exception_1.
|
|
900
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. An boolean value was expected.`);
|
|
893
901
|
}
|
|
894
902
|
getIntegerPropertyValue(propValue, propName) {
|
|
895
903
|
const result = Number.parseFloat(propValue);
|
|
896
904
|
if (isNaN(result) || result % 1 !== 0)
|
|
897
|
-
throw new Exception_1.
|
|
905
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. An integer value was expected.`);
|
|
898
906
|
return result;
|
|
899
907
|
}
|
|
900
908
|
getDatePropertyValue(propValue, propName) {
|
|
901
909
|
const result = Number.parseInt(propValue, 10);
|
|
902
910
|
if (isNaN(result))
|
|
903
|
-
throw new Exception_1.
|
|
911
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A date in milliseconds was expected.`);
|
|
904
912
|
return new Date(result);
|
|
905
913
|
}
|
|
906
914
|
getDoublePropertyValue(propValue, propName) {
|
|
907
915
|
const result = Number.parseFloat(propValue);
|
|
908
916
|
if (isNaN(result))
|
|
909
|
-
throw new Exception_1.
|
|
917
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A double value was expected.`);
|
|
910
918
|
return result;
|
|
911
919
|
}
|
|
912
920
|
getPoint2DPropertyValue(propValue, propName) {
|
|
913
921
|
const result = propValue.split(",");
|
|
914
922
|
if (result.length !== 2) {
|
|
915
|
-
throw new Exception_1.
|
|
923
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 2D value was expected.`);
|
|
916
924
|
}
|
|
917
925
|
const x = Number.parseFloat(result[0]);
|
|
918
926
|
const y = Number.parseFloat(result[1]);
|
|
919
927
|
if (isNaN(x) || isNaN(y))
|
|
920
|
-
throw new Exception_1.
|
|
928
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 2D value was expected.`);
|
|
921
929
|
return { x, y };
|
|
922
930
|
}
|
|
923
931
|
getPoint3DPropertyValue(propValue, propName) {
|
|
924
932
|
const result = propValue.split(",");
|
|
925
933
|
if (result.length !== 3) {
|
|
926
|
-
throw new Exception_1.
|
|
934
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 3D value was expected.`);
|
|
927
935
|
}
|
|
928
936
|
const x = Number.parseFloat(result[0]);
|
|
929
937
|
const y = Number.parseFloat(result[1]);
|
|
930
938
|
const z = Number.parseFloat(result[2]);
|
|
931
939
|
if (isNaN(x) || isNaN(y) || isNaN(z))
|
|
932
|
-
throw new Exception_1.
|
|
940
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 3D value was expected.`);
|
|
933
941
|
return { x, y, z };
|
|
934
942
|
}
|
|
935
943
|
isSchemaFullNameValidForVersion(schemaFullName, ecSpecVersion) {
|
|
@@ -961,7 +969,7 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
961
969
|
return `${this._schemaName}.${nameParts[1]}`;
|
|
962
970
|
if (this._schemaReferenceNames.has(nameParts[0].toLowerCase()))
|
|
963
971
|
return `${this._schemaReferenceNames.get(nameParts[0].toLowerCase())}.${nameParts[1]}`;
|
|
964
|
-
throw new Exception_1.
|
|
972
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidSchemaXML, `No valid schema found for alias ${nameParts[0]}`);
|
|
965
973
|
}
|
|
966
974
|
/** The rest of the API uses the full name format of `{SchemaName}.{SchemaItemName}`,
|
|
967
975
|
* meaning all of the references in the format string need to be changed.
|