@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
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { assert } from "@itwin/core-bentley";
|
|
6
6
|
import { parsePrimitiveType, PrimitiveType, primitiveTypeToString, StrengthDirection, strengthDirectionToString } from "../ECObjects";
|
|
7
|
-
import {
|
|
7
|
+
import { ECSchemaError, ECSchemaStatus } from "../Exception";
|
|
8
|
+
import { Enumeration } from "../Metadata/Enumeration";
|
|
8
9
|
import { ECName } from "../ECName";
|
|
9
10
|
import { AbstractParser } from "./AbstractParser";
|
|
10
11
|
import { SchemaReadHelper } from "./Helper";
|
|
@@ -12,6 +13,15 @@ const NON_ITEM_SCHEMA_ELEMENTS = ["ECSchemaReference", "ECCustomAttributes"];
|
|
|
12
13
|
const ECXML_URI = "http://www\\.bentley\\.com/schemas/Bentley\\.ECXML";
|
|
13
14
|
/** @internal */
|
|
14
15
|
export class XmlParser extends AbstractParser {
|
|
16
|
+
_rawSchema;
|
|
17
|
+
_schemaName;
|
|
18
|
+
_schemaReferenceNames;
|
|
19
|
+
_schemaAlias;
|
|
20
|
+
_schemaVersion;
|
|
21
|
+
_xmlNamespace;
|
|
22
|
+
_currentItemFullName;
|
|
23
|
+
_schemaItems;
|
|
24
|
+
_mapIsPopulated;
|
|
15
25
|
constructor(rawSchema) {
|
|
16
26
|
super();
|
|
17
27
|
this._rawSchema = rawSchema;
|
|
@@ -39,18 +49,18 @@ export class XmlParser extends AbstractParser {
|
|
|
39
49
|
parseSchema() {
|
|
40
50
|
const schemaMetadata = this._rawSchema.documentElement;
|
|
41
51
|
if ("ECSchema" !== schemaMetadata.nodeName)
|
|
42
|
-
throw new
|
|
52
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, "An ECSchema is missing the required metadata.");
|
|
43
53
|
const schemaDefDuplicates = this.getElementChildrenByTagName(schemaMetadata, "ECSchema");
|
|
44
54
|
if (schemaDefDuplicates.length > 1)
|
|
45
|
-
throw new
|
|
55
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, "An ECSchema has more than one ECSchema definition. Only one is allowed.");
|
|
46
56
|
if (this._schemaName === undefined)
|
|
47
|
-
throw new
|
|
57
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `An ECSchema is missing a required 'schemaName' attribute`);
|
|
48
58
|
if (this._schemaVersion === undefined)
|
|
49
|
-
throw new
|
|
59
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} is missing a required 'version' attribute`);
|
|
50
60
|
if (this._xmlNamespace === undefined)
|
|
51
|
-
throw new
|
|
61
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} is missing a required 'xmlns' attribute`);
|
|
52
62
|
if (this._ecSpecVersion === undefined)
|
|
53
|
-
throw new
|
|
63
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} has an invalid 'xmlns' attribute`);
|
|
54
64
|
const alias = this.getRequiredAttribute(schemaMetadata, "alias", `The ECSchema ${this._schemaName} is missing a required 'alias' attribute`);
|
|
55
65
|
const description = this.getOptionalAttribute(schemaMetadata, "description");
|
|
56
66
|
const displayLabel = this.getOptionalAttribute(schemaMetadata, "displayLabel");
|
|
@@ -91,11 +101,11 @@ export class XmlParser extends AbstractParser {
|
|
|
91
101
|
if (itemType === undefined) {
|
|
92
102
|
if (SchemaReadHelper.isECSpecVersionNewer(this._ecSpecVersion))
|
|
93
103
|
continue;
|
|
94
|
-
throw new
|
|
104
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `A SchemaItem in ${this._schemaName} has an invalid type. '${rawItemType}' is not a valid SchemaItem type.`);
|
|
95
105
|
}
|
|
96
106
|
const itemName = this.getRequiredAttribute(item, "typeName", `A SchemaItem in ${this._schemaName} is missing the required 'typeName' attribute.`);
|
|
97
107
|
if (!ECName.validate(itemName))
|
|
98
|
-
throw new
|
|
108
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECName, `A SchemaItem in ${this._schemaName} has an invalid 'typeName' attribute. '${itemName}' is not a valid ECName.`);
|
|
99
109
|
this._currentItemFullName = `${this._schemaName}.${itemName}`;
|
|
100
110
|
this._schemaItems.set(itemName, [itemType, item]);
|
|
101
111
|
yield [itemName, itemType, item];
|
|
@@ -154,22 +164,22 @@ export class XmlParser extends AbstractParser {
|
|
|
154
164
|
const baseClasses = this.getElementChildrenByTagName(xmlElement, "BaseClass");
|
|
155
165
|
// Mixins can only have one base class
|
|
156
166
|
if (baseClasses.length > 1)
|
|
157
|
-
throw new
|
|
167
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} has more than one base class which is not allowed.`);
|
|
158
168
|
const customAttributesResult = this.getElementChildrenByTagName(xmlElement, "ECCustomAttributes");
|
|
159
169
|
if (customAttributesResult.length < 1)
|
|
160
|
-
throw new
|
|
170
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'IsMixin' tag.`);
|
|
161
171
|
const customAttributes = customAttributesResult[0];
|
|
162
172
|
const isMixinResult = this.getElementChildrenByTagName(customAttributes, "IsMixin");
|
|
163
173
|
if (isMixinResult.length < 1)
|
|
164
|
-
throw new
|
|
174
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'IsMixin' tag.`);
|
|
165
175
|
const mixinAttributes = isMixinResult[0];
|
|
166
176
|
const appliesToResult = this.getElementChildrenByTagName(mixinAttributes, "AppliesToEntityClass");
|
|
167
177
|
if (appliesToResult.length < 1)
|
|
168
|
-
throw new
|
|
178
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'AppliesToEntityClass' tag.`);
|
|
169
179
|
const appliesToElement = appliesToResult[0];
|
|
170
180
|
let appliesTo = appliesToElement.textContent;
|
|
171
181
|
if (appliesTo === null || appliesTo.length === 0)
|
|
172
|
-
throw new
|
|
182
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'AppliesToEntityClass' tag.`);
|
|
173
183
|
appliesTo = this.getQualifiedTypeName(appliesTo);
|
|
174
184
|
const mixinProps = {
|
|
175
185
|
...classProps,
|
|
@@ -198,17 +208,17 @@ export class XmlParser extends AbstractParser {
|
|
|
198
208
|
const sourceResult = this.getElementChildrenByTagName(xmlElement, "Source");
|
|
199
209
|
if (sourceResult.length !== 1) {
|
|
200
210
|
if (sourceResult.length === 0)
|
|
201
|
-
throw new
|
|
211
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Source constraint tag.`);
|
|
202
212
|
else
|
|
203
|
-
throw new
|
|
213
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} has more than one Source constraint tag. Only one is allowed.`);
|
|
204
214
|
}
|
|
205
215
|
const source = this.getRelationshipConstraintProps(sourceResult[0], true);
|
|
206
216
|
const targetResult = this.getElementChildrenByTagName(xmlElement, "Target");
|
|
207
217
|
if (targetResult.length !== 1) {
|
|
208
218
|
if (targetResult.length === 0)
|
|
209
|
-
throw new
|
|
219
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Target constraint tag.`);
|
|
210
220
|
else
|
|
211
|
-
throw new
|
|
221
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} has more than one Target constraint tag. Only one is allowed.`);
|
|
212
222
|
}
|
|
213
223
|
const target = this.getRelationshipConstraintProps(targetResult[0], false);
|
|
214
224
|
return {
|
|
@@ -235,7 +245,7 @@ export class XmlParser extends AbstractParser {
|
|
|
235
245
|
if (SchemaReadHelper.isECSpecVersionNewer(this._ecSpecVersion))
|
|
236
246
|
tempBackingType = PrimitiveType.String;
|
|
237
247
|
else
|
|
238
|
-
throw new
|
|
248
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Enumeration ${this._currentItemFullName} has an invalid 'backingTypeName' attribute. It should be either "int" or "string".`);
|
|
239
249
|
}
|
|
240
250
|
let isStrictString = this.getOptionalAttribute(xmlElement, "isStrict");
|
|
241
251
|
if (isStrictString === undefined)
|
|
@@ -250,7 +260,7 @@ export class XmlParser extends AbstractParser {
|
|
|
250
260
|
if (PrimitiveType.Integer === tempBackingType) {
|
|
251
261
|
const numericValue = parseInt(valueString, 10);
|
|
252
262
|
if (isNaN(numericValue))
|
|
253
|
-
throw new
|
|
263
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Enumeration ${this._currentItemFullName} of type "int" has an enumerator with a non-integer value.`);
|
|
254
264
|
value = numericValue;
|
|
255
265
|
}
|
|
256
266
|
const label = this.getOptionalAttribute(element, "displayLabel");
|
|
@@ -276,7 +286,7 @@ export class XmlParser extends AbstractParser {
|
|
|
276
286
|
const relativeErrorString = this.getRequiredAttribute(xmlElement, "relativeError", `The KindOfQuantity ${this._currentItemFullName} is missing the required 'relativeError' attribute.`);
|
|
277
287
|
const relativeError = parseFloat(relativeErrorString);
|
|
278
288
|
if (isNaN(relativeError))
|
|
279
|
-
throw new
|
|
289
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The KindOfQuantity ${this._currentItemFullName} has an invalid 'relativeError' attribute. It should be a numeric value.`);
|
|
280
290
|
const presentationUnitsString = this.getOptionalAttribute(xmlElement, "presentationUnits");
|
|
281
291
|
let presentationUnits;
|
|
282
292
|
if (presentationUnitsString)
|
|
@@ -295,7 +305,7 @@ export class XmlParser extends AbstractParser {
|
|
|
295
305
|
const priorityString = this.getRequiredAttribute(xmlElement, "priority", `The PropertyCategory ${this._currentItemFullName} is missing the required 'priority' attribute.`);
|
|
296
306
|
const priority = parseInt(priorityString, 10);
|
|
297
307
|
if (isNaN(priority))
|
|
298
|
-
throw new
|
|
308
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The PropertyCategory ${this._currentItemFullName} has an invalid 'priority' attribute. It should be a numeric value.`);
|
|
299
309
|
return {
|
|
300
310
|
...itemProps,
|
|
301
311
|
priority,
|
|
@@ -384,11 +394,11 @@ export class XmlParser extends AbstractParser {
|
|
|
384
394
|
const units = new Array();
|
|
385
395
|
const unitsResult = this.getElementChildrenByTagName(compositeElement, "Unit");
|
|
386
396
|
if (unitsResult.length < 1)
|
|
387
|
-
throw new
|
|
397
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Format ${this._currentItemFullName} has an invalid 'Composite' element. It should have 1-4 Unit elements.`);
|
|
388
398
|
for (const unit of unitsResult) {
|
|
389
399
|
let name = unit.textContent;
|
|
390
400
|
if (null === name || 0 === name.length)
|
|
391
|
-
throw new
|
|
401
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Format ${this._currentItemFullName} has a Composite with an invalid Unit. One of the Units is missing the required 'name' attribute.`);
|
|
392
402
|
const label = this.getOptionalAttribute(unit, "label");
|
|
393
403
|
name = this.getQualifiedTypeName(name);
|
|
394
404
|
units.push({ name, label });
|
|
@@ -428,7 +438,7 @@ export class XmlParser extends AbstractParser {
|
|
|
428
438
|
const propertyType = this.getPropertyType(childType);
|
|
429
439
|
// This may not be needed, just a failsafe if the regex is faulty
|
|
430
440
|
if (propertyType === undefined)
|
|
431
|
-
throw new
|
|
441
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECProperty ${itemName}.${propertyName} has an invalid type. ${childType} is not a valid ECProperty type.`);
|
|
432
442
|
yield [propertyName, propertyType, child];
|
|
433
443
|
}
|
|
434
444
|
}
|
|
@@ -489,12 +499,12 @@ export class XmlParser extends AbstractParser {
|
|
|
489
499
|
getRelationshipConstraintCustomAttributeProviders(xmlElement) {
|
|
490
500
|
const sourceResult = this.getElementChildrenByTagName(xmlElement, "Source");
|
|
491
501
|
if (sourceResult.length < 1)
|
|
492
|
-
throw new
|
|
502
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Source constraint tag.`);
|
|
493
503
|
const sourceElement = sourceResult[0];
|
|
494
504
|
const sourceCustomAttributes = this.getCustomAttributeProviders(sourceElement, "Source Constraint of", this._currentItemFullName);
|
|
495
505
|
const targetResult = this.getElementChildrenByTagName(xmlElement, "Target");
|
|
496
506
|
if (targetResult.length < 1)
|
|
497
|
-
throw new
|
|
507
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Target constraint tag.`);
|
|
498
508
|
const targetElement = targetResult[0];
|
|
499
509
|
const targetCustomAttributes = this.getCustomAttributeProviders(targetElement, "Source Constraint of", this._currentItemFullName);
|
|
500
510
|
return [sourceCustomAttributes, targetCustomAttributes];
|
|
@@ -543,7 +553,7 @@ export class XmlParser extends AbstractParser {
|
|
|
543
553
|
if (resultString) {
|
|
544
554
|
result = parseFloat(resultString);
|
|
545
555
|
if (isNaN(result))
|
|
546
|
-
throw new
|
|
556
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, parseErrorMsg);
|
|
547
557
|
}
|
|
548
558
|
return result;
|
|
549
559
|
}
|
|
@@ -553,7 +563,7 @@ export class XmlParser extends AbstractParser {
|
|
|
553
563
|
if (resultString) {
|
|
554
564
|
result = parseInt(resultString, 10);
|
|
555
565
|
if (isNaN(result))
|
|
556
|
-
throw new
|
|
566
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, parseErrorMsg);
|
|
557
567
|
}
|
|
558
568
|
return result;
|
|
559
569
|
}
|
|
@@ -564,14 +574,14 @@ export class XmlParser extends AbstractParser {
|
|
|
564
574
|
else if ("false" === textString)
|
|
565
575
|
return false;
|
|
566
576
|
else
|
|
567
|
-
throw new
|
|
577
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, parseErrorMsg);
|
|
568
578
|
}
|
|
569
579
|
getRequiredAttribute(xmlElement, attributeName, errorMsg) {
|
|
570
580
|
if (!xmlElement.hasAttribute(attributeName))
|
|
571
|
-
throw new
|
|
581
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, errorMsg);
|
|
572
582
|
const result = xmlElement.getAttribute(attributeName);
|
|
573
583
|
if (result === null)
|
|
574
|
-
throw new
|
|
584
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, errorMsg);
|
|
575
585
|
return result;
|
|
576
586
|
}
|
|
577
587
|
getSchemaReference(xmlElement) {
|
|
@@ -647,11 +657,11 @@ export class XmlParser extends AbstractParser {
|
|
|
647
657
|
const constraintClasses = new Array();
|
|
648
658
|
const constraintClassesResult = this.getElementChildrenByTagName(xmlElement, "Class");
|
|
649
659
|
if (constraintClassesResult.length < 1)
|
|
650
|
-
throw new
|
|
660
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ${constraintName} is missing the required Class tags.`);
|
|
651
661
|
for (const constraintClass of constraintClassesResult) {
|
|
652
662
|
let constraintClassId = constraintClass.getAttribute("class");
|
|
653
663
|
if (null === constraintClassId || 0 === constraintClassId.length)
|
|
654
|
-
throw new
|
|
664
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ${constraintName} has a Class that is missing the required 'class' attribute.`);
|
|
655
665
|
constraintClassId = this.getQualifiedTypeName(constraintClassId);
|
|
656
666
|
constraintClasses.push(constraintClassId);
|
|
657
667
|
}
|
|
@@ -680,7 +690,7 @@ export class XmlParser extends AbstractParser {
|
|
|
680
690
|
const propName = this.getPropertyName(xmlElement);
|
|
681
691
|
const propType = this.getPropertyType(xmlElement.nodeName);
|
|
682
692
|
if (propType === undefined)
|
|
683
|
-
throw new
|
|
693
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECProperty ${this._currentItemFullName}.${propName} has an invalid type. ${propType} is not a valid ECProperty type.`);
|
|
684
694
|
const label = this.getOptionalAttribute(xmlElement, "displayLabel");
|
|
685
695
|
const description = this.getOptionalAttribute(xmlElement, "description");
|
|
686
696
|
const readOnlyString = this.getOptionalAttribute(xmlElement, "readOnly");
|
|
@@ -748,7 +758,7 @@ export class XmlParser extends AbstractParser {
|
|
|
748
758
|
else if (undefined !== maxOccursStr) {
|
|
749
759
|
maxOccurs = parseInt(maxOccursStr, 10);
|
|
750
760
|
if (isNaN(maxOccurs))
|
|
751
|
-
throw new
|
|
761
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'maxOccurs' attribute. It should be a numeric value.`);
|
|
752
762
|
}
|
|
753
763
|
return { minOccurs, maxOccurs };
|
|
754
764
|
}
|
|
@@ -772,7 +782,7 @@ export class XmlParser extends AbstractParser {
|
|
|
772
782
|
ns = `${this._schemaName}.${this._schemaVersion}`;
|
|
773
783
|
}
|
|
774
784
|
if (null === ns || !this.isSchemaFullNameValidForVersion(ns, this._ecSpecVersion))
|
|
775
|
-
throw new
|
|
785
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Custom attribute namespaces must contain a valid 3.2 full schema name in the form <schemaName>.RR.ww.mm.`);
|
|
776
786
|
const schemaNameParts = ns.split(".");
|
|
777
787
|
const className = `${schemaNameParts[0]}.${xmlCustomAttribute.tagName}`;
|
|
778
788
|
const properties = this.getElementChildren(xmlCustomAttribute);
|
|
@@ -783,8 +793,6 @@ export class XmlParser extends AbstractParser {
|
|
|
783
793
|
}
|
|
784
794
|
addCAPropertyValues(caClass, propertyElements) {
|
|
785
795
|
const instance = { className: caClass.fullName };
|
|
786
|
-
if (!caClass.properties)
|
|
787
|
-
return instance;
|
|
788
796
|
for (const propertyElement of propertyElements) {
|
|
789
797
|
const value = this.readPropertyValue(propertyElement, caClass);
|
|
790
798
|
if (value !== undefined)
|
|
@@ -801,9 +809,9 @@ export class XmlParser extends AbstractParser {
|
|
|
801
809
|
let enumeration;
|
|
802
810
|
if (propertyClass.isPrimitive()) {
|
|
803
811
|
if (propertyClass.isEnumeration() && propertyClass.enumeration) {
|
|
804
|
-
enumeration = propertyClass.schema.lookupItemSync(propertyClass.enumeration.fullName);
|
|
812
|
+
enumeration = propertyClass.schema.lookupItemSync(propertyClass.enumeration.fullName, Enumeration);
|
|
805
813
|
if (!enumeration)
|
|
806
|
-
throw new
|
|
814
|
+
throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `The Enumeration class '${propertyClass.enumeration.fullName}' could not be found.`);
|
|
807
815
|
}
|
|
808
816
|
const primitiveType = enumeration && enumeration.type ? enumeration.type : (propertyClass).primitiveType;
|
|
809
817
|
return this.readPrimitivePropertyValue(propElement, primitiveType);
|
|
@@ -850,9 +858,9 @@ export class XmlParser extends AbstractParser {
|
|
|
850
858
|
}
|
|
851
859
|
readPrimitivePropertyValue(propElement, primitiveType) {
|
|
852
860
|
if (undefined === propElement.textContent || null === propElement.textContent)
|
|
853
|
-
throw new
|
|
861
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid property value.`);
|
|
854
862
|
if (propElement.textContent === "" && primitiveType !== PrimitiveType.String)
|
|
855
|
-
throw new
|
|
863
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid property value.`);
|
|
856
864
|
// TODO: Mapping all primitive types to string, number and boolean
|
|
857
865
|
// for now. Need to review with IModelJs.
|
|
858
866
|
switch (primitiveType) {
|
|
@@ -874,7 +882,7 @@ export class XmlParser extends AbstractParser {
|
|
|
874
882
|
case PrimitiveType.Double:
|
|
875
883
|
return this.getDoublePropertyValue(propElement.textContent, propElement.tagName);
|
|
876
884
|
default:
|
|
877
|
-
throw new
|
|
885
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid primitive type.`);
|
|
878
886
|
}
|
|
879
887
|
}
|
|
880
888
|
getBooleanPropertyValue(propValue, propName) {
|
|
@@ -886,47 +894,47 @@ export class XmlParser extends AbstractParser {
|
|
|
886
894
|
Number.parseInt(propValue, 10) === 0) {
|
|
887
895
|
return false;
|
|
888
896
|
}
|
|
889
|
-
throw new
|
|
897
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. An boolean value was expected.`);
|
|
890
898
|
}
|
|
891
899
|
getIntegerPropertyValue(propValue, propName) {
|
|
892
900
|
const result = Number.parseFloat(propValue);
|
|
893
901
|
if (isNaN(result) || result % 1 !== 0)
|
|
894
|
-
throw new
|
|
902
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. An integer value was expected.`);
|
|
895
903
|
return result;
|
|
896
904
|
}
|
|
897
905
|
getDatePropertyValue(propValue, propName) {
|
|
898
906
|
const result = Number.parseInt(propValue, 10);
|
|
899
907
|
if (isNaN(result))
|
|
900
|
-
throw new
|
|
908
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A date in milliseconds was expected.`);
|
|
901
909
|
return new Date(result);
|
|
902
910
|
}
|
|
903
911
|
getDoublePropertyValue(propValue, propName) {
|
|
904
912
|
const result = Number.parseFloat(propValue);
|
|
905
913
|
if (isNaN(result))
|
|
906
|
-
throw new
|
|
914
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A double value was expected.`);
|
|
907
915
|
return result;
|
|
908
916
|
}
|
|
909
917
|
getPoint2DPropertyValue(propValue, propName) {
|
|
910
918
|
const result = propValue.split(",");
|
|
911
919
|
if (result.length !== 2) {
|
|
912
|
-
throw new
|
|
920
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 2D value was expected.`);
|
|
913
921
|
}
|
|
914
922
|
const x = Number.parseFloat(result[0]);
|
|
915
923
|
const y = Number.parseFloat(result[1]);
|
|
916
924
|
if (isNaN(x) || isNaN(y))
|
|
917
|
-
throw new
|
|
925
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 2D value was expected.`);
|
|
918
926
|
return { x, y };
|
|
919
927
|
}
|
|
920
928
|
getPoint3DPropertyValue(propValue, propName) {
|
|
921
929
|
const result = propValue.split(",");
|
|
922
930
|
if (result.length !== 3) {
|
|
923
|
-
throw new
|
|
931
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 3D value was expected.`);
|
|
924
932
|
}
|
|
925
933
|
const x = Number.parseFloat(result[0]);
|
|
926
934
|
const y = Number.parseFloat(result[1]);
|
|
927
935
|
const z = Number.parseFloat(result[2]);
|
|
928
936
|
if (isNaN(x) || isNaN(y) || isNaN(z))
|
|
929
|
-
throw new
|
|
937
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 3D value was expected.`);
|
|
930
938
|
return { x, y, z };
|
|
931
939
|
}
|
|
932
940
|
isSchemaFullNameValidForVersion(schemaFullName, ecSpecVersion) {
|
|
@@ -958,7 +966,7 @@ export class XmlParser extends AbstractParser {
|
|
|
958
966
|
return `${this._schemaName}.${nameParts[1]}`;
|
|
959
967
|
if (this._schemaReferenceNames.has(nameParts[0].toLowerCase()))
|
|
960
968
|
return `${this._schemaReferenceNames.get(nameParts[0].toLowerCase())}.${nameParts[1]}`;
|
|
961
|
-
throw new
|
|
969
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `No valid schema found for alias ${nameParts[0]}`);
|
|
962
970
|
}
|
|
963
971
|
/** The rest of the API uses the full name format of `{SchemaName}.{SchemaItemName}`,
|
|
964
972
|
* meaning all of the references in the format string need to be changed.
|