@itwin/ecschema-metadata 5.5.0-dev.2 → 5.5.0-dev.5

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 (122) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/Constants.js.map +1 -1
  3. package/lib/cjs/DelayedPromise.js.map +1 -1
  4. package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
  5. package/lib/cjs/Deserialization/Helper.js.map +1 -1
  6. package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
  7. package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
  8. package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
  9. package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
  10. package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
  11. package/lib/cjs/ECName.js.map +1 -1
  12. package/lib/cjs/ECObjects.js.map +1 -1
  13. package/lib/cjs/Exception.js.map +1 -1
  14. package/lib/cjs/Formatting/FormatSetFormatsProvider.js.map +1 -1
  15. package/lib/cjs/Formatting/SchemaFormatsProvider.js.map +1 -1
  16. package/lib/cjs/IncrementalLoading/ClassParsers.js.map +1 -1
  17. package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
  18. package/lib/cjs/IncrementalLoading/FullSchemaQueries.js +466 -466
  19. package/lib/cjs/IncrementalLoading/FullSchemaQueries.js.map +1 -1
  20. package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
  21. package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
  22. package/lib/cjs/IncrementalLoading/SchemaItemParsers.js.map +1 -1
  23. package/lib/cjs/IncrementalLoading/SchemaItemQueries.js +235 -235
  24. package/lib/cjs/IncrementalLoading/SchemaItemQueries.js.map +1 -1
  25. package/lib/cjs/IncrementalLoading/SchemaParser.js.map +1 -1
  26. package/lib/cjs/IncrementalLoading/SchemaStubQueries.js +309 -309
  27. package/lib/cjs/IncrementalLoading/SchemaStubQueries.js.map +1 -1
  28. package/lib/cjs/Interfaces.js.map +1 -1
  29. package/lib/cjs/Metadata/Class.js.map +1 -1
  30. package/lib/cjs/Metadata/Constant.js.map +1 -1
  31. package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
  32. package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
  33. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  34. package/lib/cjs/Metadata/Enumeration.js.map +1 -1
  35. package/lib/cjs/Metadata/Format.js.map +1 -1
  36. package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
  37. package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
  38. package/lib/cjs/Metadata/Mixin.js.map +1 -1
  39. package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
  40. package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
  41. package/lib/cjs/Metadata/Property.js.map +1 -1
  42. package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
  43. package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
  44. package/lib/cjs/Metadata/Schema.js.map +1 -1
  45. package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
  46. package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
  47. package/lib/cjs/PropertyTypes.js.map +1 -1
  48. package/lib/cjs/SchemaJsonLocater.js.map +1 -1
  49. package/lib/cjs/SchemaKey.js.map +1 -1
  50. package/lib/cjs/SchemaLoader.js.map +1 -1
  51. package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
  52. package/lib/cjs/UnitConversion/Graph.js.map +1 -1
  53. package/lib/cjs/UnitConversion/Parser.js.map +1 -1
  54. package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
  55. package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
  56. package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
  57. package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
  58. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  59. package/lib/cjs/ecschema-metadata.js.map +1 -1
  60. package/lib/cjs/utils/SchemaGraph.js.map +1 -1
  61. package/lib/cjs/utils/SchemaLoadingController.js.map +1 -1
  62. package/lib/esm/Constants.js.map +1 -1
  63. package/lib/esm/DelayedPromise.js.map +1 -1
  64. package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
  65. package/lib/esm/Deserialization/Helper.js.map +1 -1
  66. package/lib/esm/Deserialization/JsonParser.js.map +1 -1
  67. package/lib/esm/Deserialization/JsonProps.js.map +1 -1
  68. package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
  69. package/lib/esm/Deserialization/XmlParser.js.map +1 -1
  70. package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
  71. package/lib/esm/ECName.js.map +1 -1
  72. package/lib/esm/ECObjects.js.map +1 -1
  73. package/lib/esm/Exception.js.map +1 -1
  74. package/lib/esm/Formatting/FormatSetFormatsProvider.js.map +1 -1
  75. package/lib/esm/Formatting/SchemaFormatsProvider.js.map +1 -1
  76. package/lib/esm/IncrementalLoading/ClassParsers.js.map +1 -1
  77. package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
  78. package/lib/esm/IncrementalLoading/FullSchemaQueries.js +466 -466
  79. package/lib/esm/IncrementalLoading/FullSchemaQueries.js.map +1 -1
  80. package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
  81. package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
  82. package/lib/esm/IncrementalLoading/SchemaItemParsers.js.map +1 -1
  83. package/lib/esm/IncrementalLoading/SchemaItemQueries.js +235 -235
  84. package/lib/esm/IncrementalLoading/SchemaItemQueries.js.map +1 -1
  85. package/lib/esm/IncrementalLoading/SchemaParser.js.map +1 -1
  86. package/lib/esm/IncrementalLoading/SchemaStubQueries.js +309 -309
  87. package/lib/esm/IncrementalLoading/SchemaStubQueries.js.map +1 -1
  88. package/lib/esm/Interfaces.js.map +1 -1
  89. package/lib/esm/Metadata/Class.js.map +1 -1
  90. package/lib/esm/Metadata/Constant.js.map +1 -1
  91. package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
  92. package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
  93. package/lib/esm/Metadata/EntityClass.js.map +1 -1
  94. package/lib/esm/Metadata/Enumeration.js.map +1 -1
  95. package/lib/esm/Metadata/Format.js.map +1 -1
  96. package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
  97. package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
  98. package/lib/esm/Metadata/Mixin.js.map +1 -1
  99. package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
  100. package/lib/esm/Metadata/Phenomenon.js.map +1 -1
  101. package/lib/esm/Metadata/Property.js.map +1 -1
  102. package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
  103. package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
  104. package/lib/esm/Metadata/Schema.js.map +1 -1
  105. package/lib/esm/Metadata/SchemaItem.js.map +1 -1
  106. package/lib/esm/Metadata/UnitSystem.js.map +1 -1
  107. package/lib/esm/PropertyTypes.js.map +1 -1
  108. package/lib/esm/SchemaJsonLocater.js.map +1 -1
  109. package/lib/esm/SchemaKey.js.map +1 -1
  110. package/lib/esm/SchemaLoader.js.map +1 -1
  111. package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
  112. package/lib/esm/UnitConversion/Graph.js.map +1 -1
  113. package/lib/esm/UnitConversion/Parser.js.map +1 -1
  114. package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
  115. package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
  116. package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
  117. package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
  118. package/lib/esm/Validation/SchemaWalker.js.map +1 -1
  119. package/lib/esm/ecschema-metadata.js.map +1 -1
  120. package/lib/esm/utils/SchemaGraph.js.map +1 -1
  121. package/lib/esm/utils/SchemaLoadingController.js.map +1 -1
  122. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"XmlParser.js","sourceRoot":"","sources":["../../../src/Deserialization/XmlParser.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACtI,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,cAAc,EAAmB,MAAM,kBAAkB,CAAC;AAOnE,OAAO,EAAiB,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE3D,MAAM,wBAAwB,GAAG,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;AAC7E,MAAM,SAAS,GAAG,oDAAoD,CAAC;AAKvE,gBAAgB;AAChB,MAAM,OAAO,SAAU,SAAQ,cAAuB;IAC5C,UAAU,CAAW;IACrB,WAAW,CAAU;IACrB,qBAAqB,CAAsB;IAC3C,YAAY,CAAS;IACrB,cAAc,CAAU;IACxB,aAAa,CAAU;IACvB,oBAAoB,CAAU;IAC9B,YAAY,CAAiC;IAC7C,eAAe,CAAU;IAEjC,YAAY,SAA6B;QACvC,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,MAAM,UAAU,GAAG,SAAS,CAAC,eAAe,CAAC;QAE7C,MAAM,UAAU,GAAG,UAAU,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QACzD,IAAI,UAAU;YACZ,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAEhC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACv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AAuB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,uBAAuB,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;oBACxD,IAAI,uBAAuB,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC;wBACzC,SAAS;oBACX,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;oBACjE,MAAM,cAAc,GAAG,IAAI,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC;oBACxG,MAAM,WAAW,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;oBACvE,qBAAqB,IAAI,IAAI,cAAc,GAAG,WAAW,GAAG,CAAC;gBAC/D,CAAC;YACH,CAAC;YAED,GAAG,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,GAAG,CAAC;IACb,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 { assert } from \"@itwin/core-bentley\";\nimport { parsePrimitiveType, PrimitiveType, primitiveTypeToString, StrengthDirection, strengthDirectionToString } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { ECClass, StructClass } from \"../Metadata/Class\";\nimport { CustomAttribute } from \"../Metadata/CustomAttribute\";\nimport { CustomAttributeClass } from \"../Metadata/CustomAttributeClass\";\nimport { Enumeration } from \"../Metadata/Enumeration\";\nimport { PrimitiveProperty, Property, StructArrayProperty } from \"../Metadata/Property\";\nimport { ECName } from \"../ECName\";\nimport { AbstractParser, CAProviderTuple } from \"./AbstractParser\";\nimport {\n ClassProps, ConstantProps, CustomAttributeClassProps, EntityClassProps, EnumerationProps, EnumeratorProps, InvertedUnitProps,\n KindOfQuantityProps, MixinProps, NavigationPropertyProps, PhenomenonProps, PrimitiveArrayPropertyProps, PrimitiveOrEnumPropertyBaseProps,\n PrimitivePropertyProps, PropertyCategoryProps, PropertyProps, RelationshipClassProps, RelationshipConstraintProps, SchemaItemFormatProps, SchemaItemProps,\n SchemaItemUnitProps, SchemaProps, SchemaReferenceProps, StructArrayPropertyProps, StructClassProps, StructPropertyProps, UnitSystemProps,\n} from \"./JsonProps\";\nimport { ECSpecVersion, SchemaReadHelper } from \"./Helper\";\n\nconst NON_ITEM_SCHEMA_ELEMENTS = [\"ECSchemaReference\", \"ECCustomAttributes\"];\nconst ECXML_URI = \"http://www\\\\.bentley\\\\.com/schemas/Bentley\\\\.ECXML\";\n\ntype PrimitiveArray = PrimitiveValue[];\ntype PrimitiveValue = string | number | boolean | Date;\n\n/** @internal */\nexport class XmlParser extends AbstractParser<Element> {\n private _rawSchema: Document;\n private _schemaName?: string;\n private _schemaReferenceNames: Map<string, string>;\n private _schemaAlias: string;\n private _schemaVersion?: string;\n private _xmlNamespace?: string;\n private _currentItemFullName?: string;\n private _schemaItems: Map<string, [string, Element]>;\n private _mapIsPopulated: boolean;\n\n constructor(rawSchema: Readonly<Document>) {\n super();\n\n this._rawSchema = rawSchema;\n const schemaInfo = rawSchema.documentElement;\n\n const schemaName = schemaInfo.getAttribute(\"schemaName\");\n if (schemaName)\n this._schemaName = schemaName;\n\n this._schemaAlias = \"\";\n const schemaAlias = schemaInfo.getAttribute(\"alias\");\n if (schemaAlias)\n this._schemaAlias = schemaAlias;\n\n this._schemaReferenceNames = new Map<string, string>();\n\n const schemaVersion = schemaInfo.getAttribute(\"version\");\n if (schemaVersion)\n this._schemaVersion = schemaVersion;\n\n const xmlNamespace = schemaInfo.getAttribute(\"xmlns\");\n if (xmlNamespace) {\n this._xmlNamespace = xmlNamespace;\n this._ecSpecVersion = XmlParser.parseXmlNamespace(this._xmlNamespace);\n }\n\n this._schemaItems = new Map<string, [string, Element]>();\n this._mapIsPopulated = false;\n }\n\n public get getECSpecVersion(): ECSpecVersion | undefined { return this._ecSpecVersion; }\n\n public parseSchema(): SchemaProps {\n const schemaMetadata = this._rawSchema.documentElement;\n if (\"ECSchema\" !== schemaMetadata.nodeName)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, \"An ECSchema is missing the required metadata.\");\n\n const schemaDefDuplicates = this.getElementChildrenByTagName(schemaMetadata, \"ECSchema\");\n if (schemaDefDuplicates.length > 1)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, \"An ECSchema has more than one ECSchema definition. Only one is allowed.\");\n\n if (this._schemaName === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `An ECSchema is missing a required 'schemaName' attribute`);\n\n if (this._schemaVersion === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} is missing a required 'version' attribute`);\n\n if (this._xmlNamespace === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} is missing a required 'xmlns' attribute`);\n\n if (this._ecSpecVersion === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} has an invalid 'xmlns' attribute`);\n\n const alias = this.getRequiredAttribute(schemaMetadata, \"alias\",\n `The ECSchema ${this._schemaName} is missing a required 'alias' attribute`);\n const description = this.getOptionalAttribute(schemaMetadata, \"description\");\n const displayLabel = this.getOptionalAttribute(schemaMetadata, \"displayLabel\");\n\n const schemaProps = {\n name: this._schemaName,\n $schema: this._xmlNamespace,\n version: this._schemaVersion,\n alias,\n label: displayLabel,\n description,\n ecSpecMajorVersion: this._ecSpecVersion.readVersion,\n ecSpecMinorVersion: this._ecSpecVersion.writeVersion,\n };\n\n return schemaProps;\n }\n\n public *getReferences(): Iterable<SchemaReferenceProps> {\n const schemaReferences = this.getElementChildrenByTagName(this._rawSchema.documentElement, \"ECSchemaReference\");\n for (const ref of schemaReferences) {\n yield this.getSchemaReference(ref);\n }\n }\n\n public *getItems(): Iterable<[string, string, Element]> {\n if (!this._mapIsPopulated) {\n const schemaItems = this.getSchemaChildren();\n for (const item of schemaItems) {\n let rawItemType = item.nodeName;\n if (NON_ITEM_SCHEMA_ELEMENTS.includes(rawItemType))\n continue;\n\n // Differentiate a Mixin from an EntityClass\n const customAttributesResult = this.getElementChildrenByTagName(item, \"ECCustomAttributes\");\n if (customAttributesResult.length > 0) {\n const customAttributes = customAttributesResult[0];\n const isMixinResult = this.getElementChildrenByTagName(customAttributes, \"IsMixin\");\n if (isMixinResult.length > 0)\n rawItemType = \"Mixin\";\n }\n\n const itemType = this.getSchemaItemType(rawItemType);\n if (itemType === undefined) {\n if (SchemaReadHelper.isECSpecVersionNewer(this._ecSpecVersion))\n continue;\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `A SchemaItem in ${this._schemaName} has an invalid type. '${rawItemType}' is not a valid SchemaItem type.`);\n }\n\n const itemName = this.getRequiredAttribute(item, \"typeName\", `A SchemaItem in ${this._schemaName} is missing the required 'typeName' attribute.`);\n\n if (!ECName.validate(itemName))\n throw new ECSchemaError(ECSchemaStatus.InvalidECName, `A SchemaItem in ${this._schemaName} has an invalid 'typeName' attribute. '${itemName}' is not a valid ECName.`);\n\n this._currentItemFullName = `${this._schemaName}.${itemName}`;\n this._schemaItems.set(itemName, [itemType, item]);\n yield [itemName, itemType, item];\n }\n this._mapIsPopulated = true;\n } else {\n for (const [itemName, [itemType, item]] of this._schemaItems) {\n this._currentItemFullName = `${this._schemaName}.${itemName}`;\n yield [itemName, itemType, item];\n }\n }\n }\n\n public findItem(itemName: string): [string, string, Element] | undefined {\n if (!this._mapIsPopulated) {\n for (const item of this.getItems()) {\n if (item[0] === itemName) {\n this._currentItemFullName = `${this._schemaName}.${itemName}`;\n return item;\n }\n }\n } else {\n const values = this._schemaItems.get(itemName);\n if (undefined !== values) {\n const [itemType, item] = values;\n this._currentItemFullName = `${this._schemaName}.${itemName}`;\n return [itemName, itemType, item];\n }\n }\n\n return undefined;\n }\n\n public parseEntityClass(xmlElement: Element): EntityClassProps {\n const classProps = this.getClassProps(xmlElement);\n const baseClasses = this.getElementChildrenByTagName(xmlElement, \"BaseClass\");\n let mixinElements: Element[];\n const mixins = new Array<string>();\n\n // if it has just one BaseClass we assume it is a 'true' base class not a mixin\n if (baseClasses.length > 1) {\n mixinElements = baseClasses.slice(1);\n for (const mixin of mixinElements) {\n if (mixin.textContent) {\n const typeName = this.getQualifiedTypeName(mixin.textContent);\n mixins.push(typeName);\n }\n }\n }\n\n const entityClassProps = {\n ...classProps,\n mixins,\n };\n\n return entityClassProps;\n }\n\n public parseMixin(xmlElement: Element): MixinProps {\n const classProps = this.getClassProps(xmlElement);\n\n const baseClasses = this.getElementChildrenByTagName(xmlElement, \"BaseClass\");\n\n // Mixins can only have one base class\n if (baseClasses.length > 1)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} has more than one base class which is not allowed.`);\n\n const customAttributesResult = this.getElementChildrenByTagName(xmlElement, \"ECCustomAttributes\");\n\n if (customAttributesResult.length < 1)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'IsMixin' tag.`);\n\n const customAttributes = customAttributesResult[0];\n const isMixinResult = this.getElementChildrenByTagName(customAttributes, \"IsMixin\");\n if (isMixinResult.length < 1)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'IsMixin' tag.`);\n\n const mixinAttributes = isMixinResult[0];\n const appliesToResult = this.getElementChildrenByTagName(mixinAttributes, \"AppliesToEntityClass\");\n\n if (appliesToResult.length < 1)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'AppliesToEntityClass' tag.`);\n\n const appliesToElement = appliesToResult[0];\n let appliesTo = appliesToElement.textContent;\n if (appliesTo === null || appliesTo.length === 0)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'AppliesToEntityClass' tag.`);\n\n appliesTo = this.getQualifiedTypeName(appliesTo);\n\n const mixinProps = {\n ...classProps,\n appliesTo,\n };\n\n return mixinProps;\n }\n\n public parseStructClass(xmlElement: Element): StructClassProps {\n return this.getClassProps(xmlElement);\n }\n\n public parseCustomAttributeClass(xmlElement: Element): CustomAttributeClassProps {\n const classProps = this.getClassProps(xmlElement);\n const appliesTo = this.getRequiredAttribute(xmlElement, \"appliesTo\",\n `The CustomAttributeClass ${this._currentItemFullName} is missing the required 'appliesTo' attribute.`);\n\n const customAttributeClassProps = {\n ...classProps,\n appliesTo,\n };\n\n return customAttributeClassProps;\n }\n\n public parseRelationshipClass(xmlElement: Element): RelationshipClassProps {\n const classProps = this.getClassProps(xmlElement);\n const strength = this.getRequiredAttribute(xmlElement, \"strength\",\n `The RelationshipClass ${this._currentItemFullName} is missing the required 'strength' attribute.`);\n let strengthDirection = this.getOptionalAttribute(xmlElement, \"strengthDirection\");\n if (!strengthDirection)\n strengthDirection = strengthDirectionToString(StrengthDirection.Forward);\n\n const sourceResult = this.getElementChildrenByTagName(xmlElement, \"Source\");\n if (sourceResult.length !== 1) {\n if (sourceResult.length === 0)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Source constraint tag.`);\n else\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} has more than one Source constraint tag. Only one is allowed.`);\n }\n const source = this.getRelationshipConstraintProps(sourceResult[0], true);\n\n const targetResult = this.getElementChildrenByTagName(xmlElement, \"Target\");\n if (targetResult.length !== 1) {\n if (targetResult.length === 0)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Target constraint tag.`);\n else\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} has more than one Target constraint tag. Only one is allowed.`);\n }\n const target = this.getRelationshipConstraintProps(targetResult[0], false);\n\n return {\n ...classProps,\n strength,\n strengthDirection,\n source,\n target,\n };\n }\n\n public parseEnumeration(xmlElement: Element): EnumerationProps {\n const itemProps = this.getSchemaItemProps(xmlElement);\n\n const enumType = this.getRequiredAttribute(xmlElement, \"backingTypeName\",\n `The Enumeration ${this._currentItemFullName} is missing the required 'backingTypeName' attribute.`);\n\n // 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\n // value can be put in the correct type, number or string.\n let tempBackingType: PrimitiveType;\n if (/int/i.test(enumType)) {\n tempBackingType = PrimitiveType.Integer;\n } else if (/string/i.test(enumType)) {\n tempBackingType = PrimitiveType.String;\n } else {\n if (SchemaReadHelper.isECSpecVersionNewer(this._ecSpecVersion))\n tempBackingType = PrimitiveType.String;\n else\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Enumeration ${this._currentItemFullName} has an invalid 'backingTypeName' attribute. It should be either \"int\" or \"string\".`);\n }\n\n let isStrictString: string | undefined = this.getOptionalAttribute(xmlElement, \"isStrict\");\n if (isStrictString === undefined)\n isStrictString = \"true\";\n\n const isStrict = this.parseBoolean(isStrictString,\n `The Enumeration ${this._currentItemFullName} has an invalid 'isStrict' attribute. It should either be \"true\" or \"false\".`);\n\n const enumeratorElements = this.getElementChildrenByTagName(xmlElement, \"ECEnumerator\");\n const enumerators = new Array<EnumeratorProps>();\n\n for (const element of enumeratorElements) {\n const name = this.getRequiredAttribute(element, \"name\",\n `The Enumeration ${this._currentItemFullName} has an enumerator that is missing the required attribute 'name'.`);\n\n const valueString = this.getRequiredAttribute(element, \"value\",\n `The Enumeration ${this._currentItemFullName} has an enumerator that is missing the required attribute 'value'.`);\n let value: string | number = valueString;\n\n if (PrimitiveType.Integer === tempBackingType) {\n const numericValue = parseInt(valueString, 10);\n if (isNaN(numericValue))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Enumeration ${this._currentItemFullName} of type \"int\" has an enumerator with a non-integer value.`);\n value = numericValue;\n }\n\n const label = this.getOptionalAttribute(element, \"displayLabel\");\n const description = this.getOptionalAttribute(element, \"description\");\n\n enumerators.push({\n name,\n value,\n label,\n description,\n });\n }\n\n return {\n ...itemProps,\n type: enumType,\n isStrict,\n enumerators,\n originalECSpecMajorVersion: this._ecSpecVersion?.readVersion,\n originalECSpecMinorVersion: this._ecSpecVersion?.writeVersion,\n };\n }\n\n public parseKindOfQuantity(xmlElement: Element): KindOfQuantityProps {\n const itemProps = this.getSchemaItemProps(xmlElement);\n\n const relativeErrorString = this.getRequiredAttribute(xmlElement, \"relativeError\",\n `The KindOfQuantity ${this._currentItemFullName} is missing the required 'relativeError' attribute.`);\n const relativeError = parseFloat(relativeErrorString);\n if (isNaN(relativeError))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The KindOfQuantity ${this._currentItemFullName} has an invalid 'relativeError' attribute. It should be a numeric value.`);\n\n const presentationUnitsString = this.getOptionalAttribute(xmlElement, \"presentationUnits\");\n let presentationUnits: string[] | undefined;\n if (presentationUnitsString)\n presentationUnits = this.getQualifiedPresentationUnits(presentationUnitsString.split(\";\"));\n\n let persistenceUnit = this.getRequiredAttribute(xmlElement, \"persistenceUnit\",\n `The KindOfQuantity ${this._currentItemFullName} is missing the required 'persistenceUnit' attribute.`);\n persistenceUnit = this.getQualifiedTypeName(persistenceUnit);\n\n return {\n ...itemProps,\n relativeError,\n presentationUnits,\n persistenceUnit,\n };\n }\n\n public parsePropertyCategory(xmlElement: Element): PropertyCategoryProps {\n const itemProps = this.getSchemaItemProps(xmlElement);\n\n const priorityString = this.getRequiredAttribute(xmlElement, \"priority\",\n `The PropertyCategory ${this._currentItemFullName} is missing the required 'priority' attribute.`);\n const priority = parseInt(priorityString, 10);\n if (isNaN(priority))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The PropertyCategory ${this._currentItemFullName} has an invalid 'priority' attribute. It should be a numeric value.`);\n\n return {\n ...itemProps,\n priority,\n };\n }\n\n public parseUnit(xmlElement: Element): SchemaItemUnitProps {\n const itemProps = this.getSchemaItemProps(xmlElement);\n\n let phenomenon = this.getRequiredAttribute(xmlElement, \"phenomenon\",\n `The Unit ${this._currentItemFullName} is missing the required 'phenomenon' attribute.`);\n let unitSystem = this.getRequiredAttribute(xmlElement, \"unitSystem\",\n `The Unit ${this._currentItemFullName} is missing the required 'unitSystem' attribute.`);\n const definition = this.getRequiredAttribute(xmlElement, \"definition\",\n `The Unit ${this._currentItemFullName} is missing the required 'definition' attribute.`);\n const numerator = this.getOptionalFloatAttribute(xmlElement, \"numerator\",\n `The Unit ${this._currentItemFullName} has an invalid 'numerator' attribute. It should be a numeric value.`);\n const denominator = this.getOptionalFloatAttribute(xmlElement, \"denominator\",\n `The Unit ${this._currentItemFullName} has an invalid 'denominator' attribute. It should be a numeric value.`);\n const offset = this.getOptionalFloatAttribute(xmlElement, \"offset\",\n `The Unit ${this._currentItemFullName} has an invalid 'offset' attribute. It should be a numeric value.`);\n\n phenomenon = this.getQualifiedTypeName(phenomenon);\n unitSystem = this.getQualifiedTypeName(unitSystem);\n\n return {\n ...itemProps,\n phenomenon,\n unitSystem,\n definition,\n numerator,\n denominator,\n offset,\n };\n }\n\n public parseInvertedUnit(xmlElement: Element): InvertedUnitProps {\n const itemProps = this.getSchemaItemProps(xmlElement);\n\n let invertsUnit = this.getRequiredAttribute(xmlElement, \"invertsUnit\",\n `The InvertedUnit ${this._currentItemFullName} is missing the required 'invertsUnit' attribute.`);\n let unitSystem = this.getRequiredAttribute(xmlElement, \"unitSystem\",\n `The InvertedUnit ${this._currentItemFullName} is missing the required 'unitSystem' attribute.`);\n\n invertsUnit = this.getQualifiedTypeName(invertsUnit);\n unitSystem = this.getQualifiedTypeName(unitSystem);\n\n return {\n ...itemProps,\n invertsUnit,\n unitSystem,\n };\n }\n\n public parseConstant(xmlElement: Element): ConstantProps {\n const itemProps = this.getSchemaItemProps(xmlElement);\n\n let phenomenon = this.getRequiredAttribute(xmlElement, \"phenomenon\",\n `The Constant ${this._currentItemFullName} is missing the required 'phenomenon' attribute.`);\n const definition = this.getRequiredAttribute(xmlElement, \"definition\",\n `The Constant ${this._currentItemFullName} is missing the required 'definition' attribute.`);\n const numerator = this.getOptionalFloatAttribute(xmlElement, \"numerator\",\n `The Constant ${this._currentItemFullName} has an invalid 'numerator' attribute. It should be a numeric value.`);\n const denominator = this.getOptionalFloatAttribute(xmlElement, \"denominator\",\n `The Constant ${this._currentItemFullName} has an invalid 'denominator' attribute. It should be a numeric value.`);\n\n phenomenon = this.getQualifiedTypeName(phenomenon);\n\n return {\n ...itemProps,\n phenomenon,\n definition,\n numerator,\n denominator,\n };\n }\n\n public parsePhenomenon(xmlElement: Element): PhenomenonProps {\n const itemProps = this.getSchemaItemProps(xmlElement);\n\n const definition = this.getRequiredAttribute(xmlElement, \"definition\",\n `The Phenomenon ${this._currentItemFullName} is missing the required 'definition' attribute.`);\n\n return {\n ...itemProps,\n definition,\n };\n }\n\n public parseFormat(xmlElement: Element): SchemaItemFormatProps {\n const itemProps = this.getSchemaItemProps(xmlElement);\n\n const formatType = this.getRequiredAttribute(xmlElement, \"type\",\n `The Format ${this._currentItemFullName} is missing the required 'type' attribute.`);\n const precision = this.getOptionalIntAttribute(xmlElement, \"precision\",\n `The Format ${this._currentItemFullName} has an invalid 'precision' attribute. It should be a numeric value.`);\n const roundFactor = this.getOptionalFloatAttribute(xmlElement, \"roundFactor\",\n `The Format ${this._currentItemFullName} has an invalid 'roundFactor' attribute. It should be a numeric value.`);\n const minWidth = this.getOptionalIntAttribute(xmlElement, \"minWidth\",\n `The Format ${this._currentItemFullName} has an invalid 'minWidth' attribute. It should be a numeric value.`);\n const showSignOption = this.getOptionalAttribute(xmlElement, \"showSignOption\");\n\n const formatTraitsString = this.getRequiredAttribute(xmlElement, \"formatTraits\",\n `The Format ${this._currentItemFullName} is missing the required 'formatTraits' attribute.`);\n const formatTraits = formatTraitsString.split(\"|\");\n\n const decimalSeparator = this.getOptionalAttribute(xmlElement, \"decimalSeparator\");\n const thousandSeparator = this.getOptionalAttribute(xmlElement, \"thousandSeparator\");\n const uomSeparator = this.getOptionalAttribute(xmlElement, \"uomSeparator\");\n const scientificType = this.getOptionalAttribute(xmlElement, \"scientificType\");\n\n const stationOffsetSize = this.getOptionalIntAttribute(xmlElement, \"stationOffsetSize\",\n `The Format ${this._currentItemFullName} has an invalid 'stationOffsetSize' attribute. It should be a numeric value.`);\n\n const stationSeparator = this.getOptionalAttribute(xmlElement, \"stationSeparator\");\n\n let composite: object | undefined;\n const compositeResult = this.getElementChildrenByTagName(xmlElement, \"Composite\");\n if (compositeResult.length > 0) {\n const compositeElement = compositeResult[0];\n\n const spacer = this.getOptionalAttribute(compositeElement, \"spacer\");\n\n const includeZeroString = this.getOptionalAttribute(compositeElement, \"includeZero\");\n let includeZero: boolean | undefined;\n if (includeZeroString) {\n includeZero = this.parseBoolean(includeZeroString,\n `The Format ${this._currentItemFullName} has a Composite with an invalid 'includeZero' attribute. It should be either \"true\" or \"false\".`);\n }\n\n const units = new Array<{ name: string, label?: string }>();\n const unitsResult = this.getElementChildrenByTagName(compositeElement, \"Unit\");\n if (unitsResult.length < 1)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Format ${this._currentItemFullName} has an invalid 'Composite' element. It should have 1-4 Unit elements.`);\n\n for (const unit of unitsResult) {\n let name = unit.textContent;\n if (null === name || 0 === name.length)\n 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.`);\n\n const label = this.getOptionalAttribute(unit, \"label\");\n name = this.getQualifiedTypeName(name);\n units.push({ name, label });\n }\n\n composite = {\n spacer,\n includeZero,\n units,\n };\n }\n\n return {\n ...itemProps,\n type: formatType,\n precision,\n roundFactor,\n minWidth,\n showSignOption,\n formatTraits,\n decimalSeparator,\n thousandSeparator,\n uomSeparator,\n scientificType,\n stationOffsetSize,\n stationSeparator,\n composite,\n } as SchemaItemFormatProps;\n }\n\n public parseUnitSystem(xmlElement: Element): UnitSystemProps {\n return this.getClassProps(xmlElement);\n }\n\n public *getProperties(xmlElement: Element, itemName: string): Iterable<[string, string, Element]> {\n const propertyTagRegex = /EC((Struct(Array)?)|Array|Navigation)?Property/;\n const children = this.getElementChildrenByTagName(xmlElement, propertyTagRegex);\n\n for (const child of children) {\n const childType = child.nodeName;\n const propertyName = this.getRequiredAttribute(child, \"propertyName\",\n `An ECProperty in ${itemName} is missing the required 'propertyName' attribute.`);\n\n const propertyType = this.getPropertyType(childType);\n // This may not be needed, just a failsafe if the regex is faulty\n if (propertyType === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECProperty ${itemName}.${propertyName} has an invalid type. ${childType} is not a valid ECProperty type.`);\n\n yield [propertyName, propertyType, child];\n }\n }\n\n public parsePrimitiveProperty(xmlElement: Element): PrimitivePropertyProps {\n const typeName = this.getPropertyTypeName(xmlElement);\n const propertyProps = this.getPrimitiveOrEnumPropertyBaseProps(xmlElement, typeName);\n const primitivePropertyProps = { ...propertyProps, typeName };\n return primitivePropertyProps;\n }\n\n public parseStructProperty(xmlElement: Element): StructPropertyProps {\n const propertyProps = this.getPropertyProps(xmlElement);\n const typeName = this.getPropertyTypeName(xmlElement);\n const structPropertyProps = { ...propertyProps, typeName };\n return structPropertyProps;\n }\n\n public parsePrimitiveArrayProperty(xmlElement: Element): PrimitiveArrayPropertyProps {\n const typeName = this.getPropertyTypeName(xmlElement);\n const propertyProps = this.getPrimitiveOrEnumPropertyBaseProps(xmlElement, typeName);\n const minAndMaxOccurs = this.getPropertyMinAndMaxOccurs(xmlElement);\n\n return {\n ...propertyProps,\n ...minAndMaxOccurs,\n typeName,\n };\n }\n\n public parseStructArrayProperty(xmlElement: Element): StructArrayPropertyProps {\n const propertyProps = this.getPropertyProps(xmlElement);\n const typeName = this.getPropertyTypeName(xmlElement);\n const minAndMaxOccurs = this.getPropertyMinAndMaxOccurs(xmlElement);\n return {\n ...propertyProps,\n ...minAndMaxOccurs,\n typeName,\n };\n }\n\n public parseNavigationProperty(xmlElement: Element): NavigationPropertyProps {\n const propName = this.getPropertyName(xmlElement);\n const propertyProps = this.getPropertyProps(xmlElement);\n let relationshipName = this.getRequiredAttribute(xmlElement, \"relationshipName\",\n `The ECNavigationProperty ${this._currentItemFullName}.${propName} is missing the required 'relationshipName' property.`);\n const direction = this.getRequiredAttribute(xmlElement, \"direction\",\n `The ECNavigationProperty ${this._currentItemFullName}.${propName} is missing the required 'direction' property.`);\n\n relationshipName = this.getQualifiedTypeName(relationshipName);\n\n return {\n ...propertyProps,\n relationshipName,\n direction,\n };\n }\n\n public getSchemaCustomAttributeProviders(): Iterable<CAProviderTuple> {\n return this.getCustomAttributeProviders(this._rawSchema.documentElement, \"Schema\", this._schemaName);\n }\n\n public getClassCustomAttributeProviders(xmlElement: Element): Iterable<CAProviderTuple> {\n return this.getCustomAttributeProviders(xmlElement, \"ECClass\", this._currentItemFullName);\n }\n\n public getPropertyCustomAttributeProviders(xmlElement: Element): Iterable<CAProviderTuple> {\n const propName = this.getPropertyName(xmlElement);\n return this.getCustomAttributeProviders(xmlElement, \"ECProperty\", `${this._currentItemFullName}.${propName}`);\n }\n\n public getRelationshipConstraintCustomAttributeProviders(xmlElement: Element): [Iterable<CAProviderTuple> /* source */, Iterable<CAProviderTuple> /* target */] {\n const sourceResult = this.getElementChildrenByTagName(xmlElement, \"Source\");\n if (sourceResult.length < 1)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Source constraint tag.`);\n const sourceElement = sourceResult[0];\n const sourceCustomAttributes = this.getCustomAttributeProviders(sourceElement, \"Source Constraint of\", this._currentItemFullName);\n\n const targetResult = this.getElementChildrenByTagName(xmlElement, \"Target\");\n if (targetResult.length < 1)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Target constraint tag.`);\n const targetElement = targetResult[0];\n const targetCustomAttributes = this.getCustomAttributeProviders(targetElement, \"Source Constraint of\", this._currentItemFullName);\n\n return [sourceCustomAttributes, targetCustomAttributes];\n }\n\n private getElementChildren(xmlElement: Element): Element[] {\n // NodeListOf<T> does not define [Symbol.iterator]\n const children = Array.from(xmlElement.childNodes).filter((child) => {\n // (node.nodeType === 1) implies instanceof Element\n // https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/children#Polyfill\n return child.nodeType === 1;\n });\n return children as Element[];\n }\n\n private getElementChildrenByTagName(xmlElement: Element, tagName: string | RegExp): Element[] {\n const children = this.getElementChildren(xmlElement);\n if (\"*\" === tagName)\n return children;\n\n let result: Element[];\n if (typeof tagName === \"string\") {\n result = children.filter((child) => {\n return tagName.toLowerCase() === child.nodeName.toLowerCase();\n });\n } else {\n result = children.filter((child) => {\n return tagName.test(child.nodeName);\n });\n }\n\n return result;\n }\n\n private getOptionalAttribute(xmlElement: Element, attributeName: string): string | undefined {\n if (!xmlElement.hasAttribute(attributeName))\n return undefined;\n const result = xmlElement.getAttribute(attributeName);\n\n // The typings for the return value of getAttribute do not match that of xmldom\n // xmldom returns an empty string instead of null\n // However Typescript will still treat result as a union type without this check\n // Hence this is needed for tsc to compile\n if (result === null)\n return undefined;\n return result;\n }\n\n private getOptionalFloatAttribute(xmlElement: Element, attributeName: string, parseErrorMsg: string): number | undefined {\n const resultString = this.getOptionalAttribute(xmlElement, attributeName);\n let result: number | undefined;\n if (resultString) {\n result = parseFloat(resultString);\n if (isNaN(result))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, parseErrorMsg);\n }\n return result;\n }\n\n private getOptionalIntAttribute(xmlElement: Element, attributeName: string, parseErrorMsg: string): number | undefined {\n const resultString = this.getOptionalAttribute(xmlElement, attributeName);\n let result: number | undefined;\n if (resultString) {\n result = parseInt(resultString, 10);\n if (isNaN(result))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, parseErrorMsg);\n }\n return result;\n }\n\n private parseBoolean(text: string, parseErrorMsg: string): boolean {\n const textString = text.toLowerCase();\n if (\"true\" === textString)\n return true;\n else if (\"false\" === textString)\n return false;\n else\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, parseErrorMsg);\n }\n\n private getRequiredAttribute(xmlElement: Element, attributeName: string, errorMsg: string): string {\n if (!xmlElement.hasAttribute(attributeName))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, errorMsg);\n const result = xmlElement.getAttribute(attributeName);\n if (result === null)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, errorMsg);\n return result;\n }\n\n private getSchemaReference(xmlElement: Element): SchemaReferenceProps {\n const alias = this.getRequiredAttribute(xmlElement, \"alias\",\n `The schema ${this._schemaName} has an invalid ECSchemaReference attribute. One of the references is missing the required 'alias' attribute.`);\n const name = this.getRequiredAttribute(xmlElement, \"name\",\n `The schema ${this._schemaName} has an invalid ECSchemaReference attribute. One of the references is missing the required 'name' attribute.`);\n const version = this.getRequiredAttribute(xmlElement, \"version\",\n `The schema ${this._schemaName} has an invalid ECSchemaReference attribute. One of the references is missing the required 'version' attribute.`);\n\n if (!this._schemaReferenceNames.has(alias.toLowerCase()))\n this._schemaReferenceNames.set(alias.toLowerCase(), name);\n\n return {\n name,\n version,\n };\n }\n\n private getSchemaItemType(rawType: string): string | undefined {\n switch (rawType.toLowerCase()) {\n case \"ecentityclass\": return \"EntityClass\";\n case \"mixin\": return \"Mixin\";\n case \"ecstructclass\": return \"StructClass\";\n case \"eccustomattributeclass\": return \"CustomAttributeClass\";\n case \"ecrelationshipclass\": return \"RelationshipClass\";\n case \"ecenumeration\": return \"Enumeration\";\n case \"kindofquantity\": return \"KindOfQuantity\";\n case \"propertycategory\": return \"PropertyCategory\";\n case \"unit\": return \"Unit\";\n case \"invertedunit\": return \"InvertedUnit\";\n case \"constant\": return \"Constant\";\n case \"phenomenon\": return \"Phenomenon\";\n case \"unitsystem\": return \"UnitSystem\";\n case \"format\": return \"Format\";\n }\n return undefined;\n }\n\n private getSchemaChildren(): Element[] {\n const schemaMetadata = this._rawSchema.documentElement;\n return this.getElementChildren(schemaMetadata);\n }\n\n private getSchemaItemProps(xmlElement: Element): SchemaItemProps {\n const displayLabel = this.getOptionalAttribute(xmlElement, \"displayLabel\");\n const description = this.getOptionalAttribute(xmlElement, \"description\");\n\n return {\n description,\n label: displayLabel,\n };\n }\n\n private getClassProps(xmlElement: Element): ClassProps {\n const itemProps = this.getSchemaItemProps(xmlElement);\n const modifier = this.getOptionalAttribute(xmlElement, \"modifier\");\n\n let baseClass: string | null | undefined = null;\n const baseClasses = this.getElementChildrenByTagName(xmlElement, \"BaseClass\");\n if (baseClasses.length > 0) {\n // We are assuming here that the first BaseClass is the 'real' one - the rest are mixins\n // This is not a finalized approach as this could lead to unsupported schemas\n baseClass = baseClasses[0].textContent;\n }\n\n baseClass = baseClass ? this.getQualifiedTypeName(baseClass) : undefined;\n\n return {\n ...itemProps,\n modifier,\n baseClass,\n originalECSpecMajorVersion: this._ecSpecVersion?.readVersion,\n originalECSpecMinorVersion: this._ecSpecVersion?.writeVersion,\n };\n }\n\n private getRelationshipConstraintProps(xmlElement: Element, isSource: boolean): RelationshipConstraintProps {\n const constraintName = `${(isSource) ? \"Source\" : \"Target\"} Constraint of ${this._currentItemFullName}`;\n\n const multiplicity = this.getRequiredAttribute(xmlElement, \"multiplicity\",\n `The ${constraintName} is missing the required 'multiplicity' attribute.`);\n const roleLabel = this.getRequiredAttribute(xmlElement, \"roleLabel\",\n `The ${constraintName} is missing the required 'roleLabel' attribute.`);\n\n const polymorphicString = this.getRequiredAttribute(xmlElement, \"polymorphic\",\n `The ${constraintName} is missing the required 'polymorphic' attribute.`);\n const polymorphic = this.parseBoolean(polymorphicString,\n `The ${constraintName} has an invalid 'polymorphic' attribute. It should either be \"true\" or \"false\".`);\n\n let abstractConstraint = this.getOptionalAttribute(xmlElement, \"abstractConstraint\");\n if (undefined !== abstractConstraint)\n abstractConstraint = this.getQualifiedTypeName(abstractConstraint);\n\n const constraintClasses = new Array<string>();\n const constraintClassesResult = this.getElementChildrenByTagName(xmlElement, \"Class\");\n if (constraintClassesResult.length < 1)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ${constraintName} is missing the required Class tags.`);\n\n for (const constraintClass of constraintClassesResult) {\n let constraintClassId = constraintClass.getAttribute(\"class\");\n if (null === constraintClassId || 0 === constraintClassId.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ${constraintName} has a Class that is missing the required 'class' attribute.`);\n\n constraintClassId = this.getQualifiedTypeName(constraintClassId);\n constraintClasses.push(constraintClassId);\n }\n\n return {\n multiplicity,\n roleLabel,\n polymorphic,\n abstractConstraint,\n constraintClasses,\n };\n }\n\n private getPropertyType(propType: string): string | undefined {\n switch (propType) {\n case \"ECNavigationProperty\": return \"navigationproperty\";\n case \"ECStructProperty\": return \"structproperty\";\n case \"ECArrayProperty\": return \"primitivearrayproperty\";\n case \"ECStructArrayProperty\": return \"structarrayproperty\";\n case \"ECProperty\": return \"primitiveproperty\";\n default: return undefined;\n }\n }\n\n private getPropertyName(xmlElement: Element): string {\n return this.getRequiredAttribute(xmlElement, \"propertyName\",\n `An ECProperty in ${this._currentItemFullName} is missing the required 'propertyName' attribute.`);\n }\n\n private getPropertyProps(xmlElement: Element): PropertyProps {\n const propName = this.getPropertyName(xmlElement);\n\n const propType = this.getPropertyType(xmlElement.nodeName);\n if (propType === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECProperty ${this._currentItemFullName}.${propName} has an invalid type. ${propType} is not a valid ECProperty type.`);\n\n const label = this.getOptionalAttribute(xmlElement, \"displayLabel\");\n const description = this.getOptionalAttribute(xmlElement, \"description\");\n\n const readOnlyString = this.getOptionalAttribute(xmlElement, \"readOnly\");\n let isReadOnly: boolean | undefined;\n if (readOnlyString) {\n isReadOnly = this.parseBoolean(readOnlyString,\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'readOnly' attribute. It should be either \"true\" or \"false\".`);\n }\n\n let category = this.getOptionalAttribute(xmlElement, \"category\");\n\n const priority = this.getOptionalIntAttribute(xmlElement, \"priority\",\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'priority' attribute. It should be a numeric value.`);\n\n const inheritedString = this.getOptionalAttribute(xmlElement, \"inherited\");\n let inherited: boolean | undefined;\n if (inheritedString) {\n inherited = this.parseBoolean(inheritedString,\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'inherited' attribute. It should be either \"true\" or \"false\".`);\n }\n\n let kindOfQuantity = this.getOptionalAttribute(xmlElement, \"kindOfQuantity\");\n\n if (kindOfQuantity)\n kindOfQuantity = this.getQualifiedTypeName(kindOfQuantity);\n if (category)\n category = this.getQualifiedTypeName(category);\n\n return {\n name: propName,\n type: propType,\n description,\n label,\n isReadOnly,\n category,\n priority,\n inherited,\n kindOfQuantity,\n };\n }\n\n private getPropertyTypeName(xmlElement: Element): string {\n const propName = this.getPropertyName(xmlElement);\n const rawTypeName = this.getRequiredAttribute(xmlElement, \"typeName\",\n `The ECProperty ${this._currentItemFullName}.${propName} is missing the required 'typeName' attribute.`);\n\n // If not a primitive type, we must prepend the schema name.\n const primitiveType = parsePrimitiveType(rawTypeName);\n if (primitiveType)\n return rawTypeName;\n\n return this.getQualifiedTypeName(rawTypeName);\n }\n\n private getPrimitiveOrEnumPropertyBaseProps(xmlElement: Element, typeName: string): PrimitiveOrEnumPropertyBaseProps {\n const primitiveType = parsePrimitiveType(typeName);\n const propertyProps = this.getPropertyProps(xmlElement);\n const propName = propertyProps.name;\n const extendedTypeName = this.getOptionalAttribute(xmlElement, \"extendedTypeName\");\n const minLength = this.getOptionalIntAttribute(xmlElement, \"minimumLength\",\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'minimumLength' attribute. It should be a numeric value.`);\n const maxLength = this.getOptionalIntAttribute(xmlElement, \"maximumLength\",\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'maximumLength' attribute. It should be a numeric value.`);\n\n let minValue: number | undefined;\n let maxValue: number | undefined;\n if (primitiveType === PrimitiveType.Double || primitiveType === PrimitiveType.Long) {\n minValue = this.getOptionalFloatAttribute(xmlElement, \"minimumValue\",\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'minimumValue' attribute. It should be a numeric value.`);\n maxValue = this.getOptionalFloatAttribute(xmlElement, \"maximumValue\",\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'maximumValue' attribute. It should be a numeric value.`);\n } else {\n minValue = this.getOptionalIntAttribute(xmlElement, \"minimumValue\",\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'minimumValue' attribute. It should be a numeric value.`);\n maxValue = this.getOptionalIntAttribute(xmlElement, \"maximumValue\",\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'maximumValue' attribute. It should be a numeric value.`);\n }\n\n return {\n ...propertyProps,\n extendedTypeName,\n minLength,\n maxLength,\n minValue,\n maxValue,\n };\n }\n\n private getPropertyMinAndMaxOccurs(xmlElement: Element): { minOccurs: number | undefined, maxOccurs: number | undefined } {\n const propName = this.getPropertyName(xmlElement);\n const minOccurs = this.getOptionalIntAttribute(xmlElement, \"minOccurs\",\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'minOccurs' attribute. It should be a numeric value.`);\n\n const maxOccursStr = this.getOptionalAttribute(xmlElement, \"maxOccurs\");\n let maxOccurs: number | undefined;\n if (\"unbounded\" === maxOccursStr)\n maxOccurs = 2147483647; // TODO: This should be using the INT32_MAX variable.\n else if (undefined !== maxOccursStr) {\n maxOccurs = parseInt(maxOccursStr, 10);\n if (isNaN(maxOccurs))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'maxOccurs' attribute. It should be a numeric value.`);\n }\n\n return { minOccurs, maxOccurs };\n }\n\n private *getCustomAttributeProviders(xmlElement: Element, type: string, _name?: string): Iterable<CAProviderTuple> {\n const customAttributesResult = this.getElementChildrenByTagName(xmlElement, \"ECCustomAttributes\");\n if (customAttributesResult.length < 1)\n return;\n\n const attributes = this.getElementChildren(customAttributesResult[0]);\n for (const attribute of attributes) {\n if (\"ECClass\" === type && \"IsMixin\" === attribute.tagName)\n continue;\n\n yield this.getCustomAttributeProvider(attribute);\n }\n }\n\n private getCustomAttributeProvider(xmlCustomAttribute: Element): CAProviderTuple {\n assert(this._ecSpecVersion !== undefined);\n\n let ns = xmlCustomAttribute.getAttribute(\"xmlns\");\n if (!ns) {\n assert(this._schemaName !== undefined);\n assert(this._schemaVersion !== undefined);\n ns = `${this._schemaName}.${this._schemaVersion}`;\n }\n\n if (null === ns || !this.isSchemaFullNameValidForVersion(ns, this._ecSpecVersion))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Custom attribute namespaces must contain a valid 3.2 full schema name in the form <schemaName>.RR.ww.mm.`);\n\n const schemaNameParts = ns.split(\".\");\n const className = `${schemaNameParts[0]}.${xmlCustomAttribute.tagName}`;\n const properties = this.getElementChildren(xmlCustomAttribute);\n\n const provider = (caClass: CustomAttributeClass) => {\n return this.addCAPropertyValues(caClass, properties);\n };\n\n return [className, provider];\n }\n\n private addCAPropertyValues(caClass: CustomAttributeClass, propertyElements: Element[]): CustomAttribute {\n const instance = { className: caClass.fullName } as CustomAttribute;\n for (const propertyElement of propertyElements) {\n const value = this.readPropertyValue(propertyElement, caClass);\n if (value !== undefined)\n instance[propertyElement.tagName] = value;\n }\n\n return instance;\n }\n\n private readPropertyValue(propElement: Element, parentClass: ECClass): any {\n const propertyClass = parentClass.getPropertySync(propElement.tagName);\n if (!propertyClass)\n return;\n\n if (propertyClass.isArray())\n return this.readArrayPropertyValue(propElement, propertyClass);\n\n let enumeration: Enumeration | undefined;\n if (propertyClass.isPrimitive()) {\n if (propertyClass.isEnumeration() && propertyClass.enumeration) {\n enumeration = propertyClass.schema.lookupItemSync(propertyClass.enumeration.fullName, Enumeration);\n if (!enumeration)\n throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `The Enumeration class '${propertyClass.enumeration.fullName}' could not be found.`);\n }\n const primitiveType = enumeration && enumeration.type ? enumeration.type : (propertyClass).primitiveType;\n return this.readPrimitivePropertyValue(propElement, primitiveType);\n }\n\n if (propertyClass.isStruct())\n return this.readStructPropertyValue(propElement, propertyClass.structClass);\n\n return undefined;\n }\n\n private readArrayPropertyValue(propElement: Element, propertyClass: Property): PrimitiveArray | undefined {\n if (propertyClass.isPrimitive())\n return this.readPrimitiveArrayValues(propElement, (propertyClass as PrimitiveProperty).primitiveType);\n\n if (propertyClass.isStruct())\n return this.readStructArrayValues(propElement, propertyClass as StructArrayProperty);\n\n return undefined;\n }\n\n private readPrimitiveArrayValues(propElement: Element, primitiveType: PrimitiveType): PrimitiveArray {\n const typeName = primitiveTypeToString(primitiveType);\n const children = this.getElementChildrenByTagName(propElement, typeName);\n const values: PrimitiveArray = [];\n for (const child of children) {\n const value = this.readPrimitivePropertyValue(child, primitiveType);\n values.push(value);\n }\n\n return values;\n }\n\n private readStructArrayValues(propElement: Element, propertyClass: StructArrayProperty): any {\n const children = this.getElementChildren(propElement);\n const values: any = [];\n for (const child of children) {\n const value = this.readStructPropertyValue(child, propertyClass.structClass);\n values.push(value);\n }\n\n return values;\n }\n\n private readStructPropertyValue(propElement: Element, structClass: StructClass): any {\n const structObj: any = {};\n const children = this.getElementChildren(propElement);\n for (const child of children) {\n const value = this.readPropertyValue(child, structClass);\n if (value !== undefined)\n structObj[child.tagName] = value;\n }\n return structObj;\n }\n\n private readPrimitivePropertyValue(propElement: Element, primitiveType: PrimitiveType): PrimitiveValue {\n if (undefined === propElement.textContent || null === propElement.textContent)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid property value.`);\n\n if (propElement.textContent === \"\" && primitiveType !== PrimitiveType.String)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid property value.`);\n\n // TODO: Mapping all primitive types to string, number and boolean\n // for now. Need to review with IModelJs.\n switch (primitiveType) {\n case PrimitiveType.String:\n case PrimitiveType.Binary: /** TODO - Currently treated as strings */\n case PrimitiveType.IGeometry: /** TODO - Currently treated as strings */\n return propElement.textContent;\n case PrimitiveType.DateTime:\n return this.getDatePropertyValue(propElement.textContent, propElement.tagName);\n case PrimitiveType.Point2d:\n return this.getPoint2DPropertyValue(propElement.textContent, propElement.tagName);\n case PrimitiveType.Point3d:\n return this.getPoint3DPropertyValue(propElement.textContent, propElement.tagName);\n case PrimitiveType.Boolean:\n return this.getBooleanPropertyValue(propElement.textContent, propElement.tagName);\n case PrimitiveType.Integer:\n case PrimitiveType.Long:\n return this.getIntegerPropertyValue(propElement.textContent, propElement.tagName);\n case PrimitiveType.Double:\n return this.getDoublePropertyValue(propElement.textContent, propElement.tagName);\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid primitive type.`);\n }\n }\n\n private getBooleanPropertyValue(propValue: string, propName: string): boolean {\n if (propValue.toLowerCase() === \"true\" ||\n Number.parseInt(propValue, 10) > 0) {\n return true;\n } else if (propValue.toLowerCase() === \"false\" ||\n Number.parseInt(propValue, 10) === 0) {\n return false;\n }\n\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. An boolean value was expected.`);\n }\n\n private getIntegerPropertyValue(propValue: string, propName: string): number {\n const result = Number.parseFloat(propValue);\n if (isNaN(result) || result % 1 !== 0)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. An integer value was expected.`);\n\n return result;\n }\n\n private getDatePropertyValue(propValue: string, propName: string): Date {\n const result = Number.parseInt(propValue, 10);\n if (isNaN(result))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A date in milliseconds was expected.`);\n\n return new Date(result);\n }\n\n private getDoublePropertyValue(propValue: string, propName: string): number {\n const result = Number.parseFloat(propValue);\n if (isNaN(result))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A double value was expected.`);\n\n return result;\n }\n\n private getPoint2DPropertyValue(propValue: string, propName: string): any {\n const result = propValue.split(\",\");\n if (result.length !== 2) {\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 2D value was expected.`);\n }\n\n const x = Number.parseFloat(result[0]);\n const y = Number.parseFloat(result[1]);\n\n if (isNaN(x) || isNaN(y))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 2D value was expected.`);\n\n return { x, y };\n }\n\n private getPoint3DPropertyValue(propValue: string, propName: string): any {\n const result = propValue.split(\",\");\n if (result.length !== 3) {\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 3D value was expected.`);\n }\n\n const x = Number.parseFloat(result[0]);\n const y = Number.parseFloat(result[1]);\n const z = Number.parseFloat(result[2]);\n\n if (isNaN(x) || isNaN(y) || isNaN(z))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 3D value was expected.`);\n\n return { x, y, z };\n }\n\n private isSchemaFullNameValidForVersion(schemaFullName: string, ecSpecVersion: ECSpecVersion) {\n const schemaNameParts = schemaFullName.split(\".\");\n\n if ((ecSpecVersion.readVersion >= 3 && ecSpecVersion.writeVersion >= 2) || ecSpecVersion.readVersion > 3) {\n if (schemaNameParts.length < 4)\n return false;\n } else {\n if (schemaNameParts.length < 3)\n return false;\n }\n return true;\n }\n\n public static parseXmlNamespace(xmlNamespace: string): ECSpecVersion | undefined {\n const regEx = new RegExp(`^${ECXML_URI}\\\\.([0-9]+)\\\\.([0-9]+)$`);\n const match = xmlNamespace.match(regEx);\n if (!match)\n return;\n\n const readVersion = parseInt(match[1], 10);\n const writeVersion = parseInt(match[2], 10);\n return { readVersion, writeVersion };\n }\n\n private getQualifiedTypeName(rawTypeName: string): string {\n const nameParts = rawTypeName.split(\":\");\n if (nameParts.length !== 2)\n return `${this._schemaName}.${rawTypeName}`;\n\n if (nameParts[0].toLowerCase() === this._schemaAlias.toLowerCase())\n return `${this._schemaName}.${nameParts[1]}`;\n if (this._schemaReferenceNames.has(nameParts[0].toLowerCase()))\n return `${this._schemaReferenceNames.get(nameParts[0].toLowerCase())}.${nameParts[1]}`;\n\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `No valid schema found for alias ${nameParts[0]}`);\n }\n\n /** The rest of the API uses the full name format of `{SchemaName}.{SchemaItemName}`,\n * meaning all of the references in the format string need to be changed.\n */\n private getQualifiedPresentationUnits(presentationUnits: string[]): string[] {\n const res: string[] = [];\n for (const presentationUnit of presentationUnits) {\n // we split the presentation unit by square parantheses [ ], f:DefaultReal(6)[u:FT|feet] will be splitted into f:DefaultReal(6) and u:FT|feet\n // we format the first one and the next one will be put into [ ] again\n const presentationUnitFormats = presentationUnit.split(/[\\[\\]]/g);\n let qualifiedPresentation: string = \"\";\n qualifiedPresentation = this.getQualifiedTypeName(presentationUnitFormats[0]);\n if (presentationUnitFormats.length > 1) {\n for (let i = 1; i < presentationUnitFormats.length; ++i) {\n if (presentationUnitFormats[i].length === 0)\n continue;\n const verticalSlashIdx = presentationUnitFormats[i].indexOf(\"|\");\n const overrideFormat = this.getQualifiedTypeName(presentationUnitFormats[i].slice(0, verticalSlashIdx));\n const formatLabel = presentationUnitFormats[i].slice(verticalSlashIdx);\n qualifiedPresentation += `[${overrideFormat}${formatLabel}]`;\n }\n }\n\n res.push(qualifiedPresentation);\n }\n\n return res;\n }\n}\n"]}
1
+ {"version":3,"file":"Xm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E,CAAC,GAAG,uBAAuB,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;oBACxD,IAAI,uBAAuB,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC;wBACzC,SAAS;oBACX,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;oBACjE,MAAM,cAAc,GAAG,IAAI,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC;oBACxG,MAAM,WAAW,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;oBACvE,qBAAqB,IAAI,IAAI,cAAc,GAAG,WAAW,GAAG,CAAC;gBAC/D,CAAC;YACH,CAAC;YAED,GAAG,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,GAAG,CAAC;IACb,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 { assert } from \"@itwin/core-bentley\";\r\nimport { parsePrimitiveType, PrimitiveType, primitiveTypeToString, StrengthDirection, strengthDirectionToString } from \"../ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\r\nimport { ECClass, StructClass } from \"../Metadata/Class\";\r\nimport { CustomAttribute } from \"../Metadata/CustomAttribute\";\r\nimport { CustomAttributeClass } from \"../Metadata/CustomAttributeClass\";\r\nimport { Enumeration } from \"../Metadata/Enumeration\";\r\nimport { PrimitiveProperty, Property, StructArrayProperty } from \"../Metadata/Property\";\r\nimport { ECName } from \"../ECName\";\r\nimport { AbstractParser, CAProviderTuple } from \"./AbstractParser\";\r\nimport {\r\n ClassProps, ConstantProps, CustomAttributeClassProps, EntityClassProps, EnumerationProps, EnumeratorProps, InvertedUnitProps,\r\n KindOfQuantityProps, MixinProps, NavigationPropertyProps, PhenomenonProps, PrimitiveArrayPropertyProps, PrimitiveOrEnumPropertyBaseProps,\r\n PrimitivePropertyProps, PropertyCategoryProps, PropertyProps, RelationshipClassProps, RelationshipConstraintProps, SchemaItemFormatProps, SchemaItemProps,\r\n SchemaItemUnitProps, SchemaProps, SchemaReferenceProps, StructArrayPropertyProps, StructClassProps, StructPropertyProps, UnitSystemProps,\r\n} from \"./JsonProps\";\r\nimport { ECSpecVersion, SchemaReadHelper } from \"./Helper\";\r\n\r\nconst NON_ITEM_SCHEMA_ELEMENTS = [\"ECSchemaReference\", \"ECCustomAttributes\"];\r\nconst ECXML_URI = \"http://www\\\\.bentley\\\\.com/schemas/Bentley\\\\.ECXML\";\r\n\r\ntype PrimitiveArray = PrimitiveValue[];\r\ntype PrimitiveValue = string | number | boolean | Date;\r\n\r\n/** @internal */\r\nexport class XmlParser extends AbstractParser<Element> {\r\n private _rawSchema: Document;\r\n private _schemaName?: string;\r\n private _schemaReferenceNames: Map<string, string>;\r\n private _schemaAlias: string;\r\n private _schemaVersion?: string;\r\n private _xmlNamespace?: string;\r\n private _currentItemFullName?: string;\r\n private _schemaItems: Map<string, [string, Element]>;\r\n private _mapIsPopulated: boolean;\r\n\r\n constructor(rawSchema: Readonly<Document>) {\r\n super();\r\n\r\n this._rawSchema = rawSchema;\r\n const schemaInfo = rawSchema.documentElement;\r\n\r\n const schemaName = schemaInfo.getAttribute(\"schemaName\");\r\n if (schemaName)\r\n this._schemaName = schemaName;\r\n\r\n this._schemaAlias = \"\";\r\n const schemaAlias = schemaInfo.getAttribute(\"alias\");\r\n if (schemaAlias)\r\n this._schemaAlias = schemaAlias;\r\n\r\n this._schemaReferenceNames = new Map<string, string>();\r\n\r\n const schemaVersion = schemaInfo.getAttribute(\"version\");\r\n if (schemaVersion)\r\n this._schemaVersion = schemaVersion;\r\n\r\n const xmlNamespace = schemaInfo.getAttribute(\"xmlns\");\r\n if (xmlNamespace) {\r\n this._xmlNamespace = xmlNamespace;\r\n this._ecSpecVersion = XmlParser.parseXmlNamespace(this._xmlNamespace);\r\n }\r\n\r\n this._schemaItems = new Map<string, [string, Element]>();\r\n this._mapIsPopulated = false;\r\n }\r\n\r\n public get getECSpecVersion(): ECSpecVersion | undefined { return this._ecSpecVersion; }\r\n\r\n public parseSchema(): SchemaProps {\r\n const schemaMetadata = this._rawSchema.documentElement;\r\n if (\"ECSchema\" !== schemaMetadata.nodeName)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, \"An ECSchema is missing the required metadata.\");\r\n\r\n const schemaDefDuplicates = this.getElementChildrenByTagName(schemaMetadata, \"ECSchema\");\r\n if (schemaDefDuplicates.length > 1)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, \"An ECSchema has more than one ECSchema definition. Only one is allowed.\");\r\n\r\n if (this._schemaName === undefined)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `An ECSchema is missing a required 'schemaName' attribute`);\r\n\r\n if (this._schemaVersion === undefined)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} is missing a required 'version' attribute`);\r\n\r\n if (this._xmlNamespace === undefined)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} is missing a required 'xmlns' attribute`);\r\n\r\n if (this._ecSpecVersion === undefined)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} has an invalid 'xmlns' attribute`);\r\n\r\n const alias = this.getRequiredAttribute(schemaMetadata, \"alias\",\r\n `The ECSchema ${this._schemaName} is missing a required 'alias' attribute`);\r\n const description = this.getOptionalAttribute(schemaMetadata, \"description\");\r\n const displayLabel = this.getOptionalAttribute(schemaMetadata, \"displayLabel\");\r\n\r\n const schemaProps = {\r\n name: this._schemaName,\r\n $schema: this._xmlNamespace,\r\n version: this._schemaVersion,\r\n alias,\r\n label: displayLabel,\r\n description,\r\n ecSpecMajorVersion: this._ecSpecVersion.readVersion,\r\n ecSpecMinorVersion: this._ecSpecVersion.writeVersion,\r\n };\r\n\r\n return schemaProps;\r\n }\r\n\r\n public *getReferences(): Iterable<SchemaReferenceProps> {\r\n const schemaReferences = this.getElementChildrenByTagName(this._rawSchema.documentElement, \"ECSchemaReference\");\r\n for (const ref of schemaReferences) {\r\n yield this.getSchemaReference(ref);\r\n }\r\n }\r\n\r\n public *getItems(): Iterable<[string, string, Element]> {\r\n if (!this._mapIsPopulated) {\r\n const schemaItems = this.getSchemaChildren();\r\n for (const item of schemaItems) {\r\n let rawItemType = item.nodeName;\r\n if (NON_ITEM_SCHEMA_ELEMENTS.includes(rawItemType))\r\n continue;\r\n\r\n // Differentiate a Mixin from an EntityClass\r\n const customAttributesResult = this.getElementChildrenByTagName(item, \"ECCustomAttributes\");\r\n if (customAttributesResult.length > 0) {\r\n const customAttributes = customAttributesResult[0];\r\n const isMixinResult = this.getElementChildrenByTagName(customAttributes, \"IsMixin\");\r\n if (isMixinResult.length > 0)\r\n rawItemType = \"Mixin\";\r\n }\r\n\r\n const itemType = this.getSchemaItemType(rawItemType);\r\n if (itemType === undefined) {\r\n if (SchemaReadHelper.isECSpecVersionNewer(this._ecSpecVersion))\r\n continue;\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `A SchemaItem in ${this._schemaName} has an invalid type. '${rawItemType}' is not a valid SchemaItem type.`);\r\n }\r\n\r\n const itemName = this.getRequiredAttribute(item, \"typeName\", `A SchemaItem in ${this._schemaName} is missing the required 'typeName' attribute.`);\r\n\r\n if (!ECName.validate(itemName))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECName, `A SchemaItem in ${this._schemaName} has an invalid 'typeName' attribute. '${itemName}' is not a valid ECName.`);\r\n\r\n this._currentItemFullName = `${this._schemaName}.${itemName}`;\r\n this._schemaItems.set(itemName, [itemType, item]);\r\n yield [itemName, itemType, item];\r\n }\r\n this._mapIsPopulated = true;\r\n } else {\r\n for (const [itemName, [itemType, item]] of this._schemaItems) {\r\n this._currentItemFullName = `${this._schemaName}.${itemName}`;\r\n yield [itemName, itemType, item];\r\n }\r\n }\r\n }\r\n\r\n public findItem(itemName: string): [string, string, Element] | undefined {\r\n if (!this._mapIsPopulated) {\r\n for (const item of this.getItems()) {\r\n if (item[0] === itemName) {\r\n this._currentItemFullName = `${this._schemaName}.${itemName}`;\r\n return item;\r\n }\r\n }\r\n } else {\r\n const values = this._schemaItems.get(itemName);\r\n if (undefined !== values) {\r\n const [itemType, item] = values;\r\n this._currentItemFullName = `${this._schemaName}.${itemName}`;\r\n return [itemName, itemType, item];\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n public parseEntityClass(xmlElement: Element): EntityClassProps {\r\n const classProps = this.getClassProps(xmlElement);\r\n const baseClasses = this.getElementChildrenByTagName(xmlElement, \"BaseClass\");\r\n let mixinElements: Element[];\r\n const mixins = new Array<string>();\r\n\r\n // if it has just one BaseClass we assume it is a 'true' base class not a mixin\r\n if (baseClasses.length > 1) {\r\n mixinElements = baseClasses.slice(1);\r\n for (const mixin of mixinElements) {\r\n if (mixin.textContent) {\r\n const typeName = this.getQualifiedTypeName(mixin.textContent);\r\n mixins.push(typeName);\r\n }\r\n }\r\n }\r\n\r\n const entityClassProps = {\r\n ...classProps,\r\n mixins,\r\n };\r\n\r\n return entityClassProps;\r\n }\r\n\r\n public parseMixin(xmlElement: Element): MixinProps {\r\n const classProps = this.getClassProps(xmlElement);\r\n\r\n const baseClasses = this.getElementChildrenByTagName(xmlElement, \"BaseClass\");\r\n\r\n // Mixins can only have one base class\r\n if (baseClasses.length > 1)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} has more than one base class which is not allowed.`);\r\n\r\n const customAttributesResult = this.getElementChildrenByTagName(xmlElement, \"ECCustomAttributes\");\r\n\r\n if (customAttributesResult.length < 1)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'IsMixin' tag.`);\r\n\r\n const customAttributes = customAttributesResult[0];\r\n const isMixinResult = this.getElementChildrenByTagName(customAttributes, \"IsMixin\");\r\n if (isMixinResult.length < 1)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'IsMixin' tag.`);\r\n\r\n const mixinAttributes = isMixinResult[0];\r\n const appliesToResult = this.getElementChildrenByTagName(mixinAttributes, \"AppliesToEntityClass\");\r\n\r\n if (appliesToResult.length < 1)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'AppliesToEntityClass' tag.`);\r\n\r\n const appliesToElement = appliesToResult[0];\r\n let appliesTo = appliesToElement.textContent;\r\n if (appliesTo === null || appliesTo.length === 0)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'AppliesToEntityClass' tag.`);\r\n\r\n appliesTo = this.getQualifiedTypeName(appliesTo);\r\n\r\n const mixinProps = {\r\n ...classProps,\r\n appliesTo,\r\n };\r\n\r\n return mixinProps;\r\n }\r\n\r\n public parseStructClass(xmlElement: Element): StructClassProps {\r\n return this.getClassProps(xmlElement);\r\n }\r\n\r\n public parseCustomAttributeClass(xmlElement: Element): CustomAttributeClassProps {\r\n const classProps = this.getClassProps(xmlElement);\r\n const appliesTo = this.getRequiredAttribute(xmlElement, \"appliesTo\",\r\n `The CustomAttributeClass ${this._currentItemFullName} is missing the required 'appliesTo' attribute.`);\r\n\r\n const customAttributeClassProps = {\r\n ...classProps,\r\n appliesTo,\r\n };\r\n\r\n return customAttributeClassProps;\r\n }\r\n\r\n public parseRelationshipClass(xmlElement: Element): RelationshipClassProps {\r\n const classProps = this.getClassProps(xmlElement);\r\n const strength = this.getRequiredAttribute(xmlElement, \"strength\",\r\n `The RelationshipClass ${this._currentItemFullName} is missing the required 'strength' attribute.`);\r\n let strengthDirection = this.getOptionalAttribute(xmlElement, \"strengthDirection\");\r\n if (!strengthDirection)\r\n strengthDirection = strengthDirectionToString(StrengthDirection.Forward);\r\n\r\n const sourceResult = this.getElementChildrenByTagName(xmlElement, \"Source\");\r\n if (sourceResult.length !== 1) {\r\n if (sourceResult.length === 0)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Source constraint tag.`);\r\n else\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} has more than one Source constraint tag. Only one is allowed.`);\r\n }\r\n const source = this.getRelationshipConstraintProps(sourceResult[0], true);\r\n\r\n const targetResult = this.getElementChildrenByTagName(xmlElement, \"Target\");\r\n if (targetResult.length !== 1) {\r\n if (targetResult.length === 0)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Target constraint tag.`);\r\n else\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} has more than one Target constraint tag. Only one is allowed.`);\r\n }\r\n const target = this.getRelationshipConstraintProps(targetResult[0], false);\r\n\r\n return {\r\n ...classProps,\r\n strength,\r\n strengthDirection,\r\n source,\r\n target,\r\n };\r\n }\r\n\r\n public parseEnumeration(xmlElement: Element): EnumerationProps {\r\n const itemProps = this.getSchemaItemProps(xmlElement);\r\n\r\n const enumType = this.getRequiredAttribute(xmlElement, \"backingTypeName\",\r\n `The Enumeration ${this._currentItemFullName} is missing the required 'backingTypeName' attribute.`);\r\n\r\n // 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\r\n // value can be put in the correct type, number or string.\r\n let tempBackingType: PrimitiveType;\r\n if (/int/i.test(enumType)) {\r\n tempBackingType = PrimitiveType.Integer;\r\n } else if (/string/i.test(enumType)) {\r\n tempBackingType = PrimitiveType.String;\r\n } else {\r\n if (SchemaReadHelper.isECSpecVersionNewer(this._ecSpecVersion))\r\n tempBackingType = PrimitiveType.String;\r\n else\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Enumeration ${this._currentItemFullName} has an invalid 'backingTypeName' attribute. It should be either \"int\" or \"string\".`);\r\n }\r\n\r\n let isStrictString: string | undefined = this.getOptionalAttribute(xmlElement, \"isStrict\");\r\n if (isStrictString === undefined)\r\n isStrictString = \"true\";\r\n\r\n const isStrict = this.parseBoolean(isStrictString,\r\n `The Enumeration ${this._currentItemFullName} has an invalid 'isStrict' attribute. It should either be \"true\" or \"false\".`);\r\n\r\n const enumeratorElements = this.getElementChildrenByTagName(xmlElement, \"ECEnumerator\");\r\n const enumerators = new Array<EnumeratorProps>();\r\n\r\n for (const element of enumeratorElements) {\r\n const name = this.getRequiredAttribute(element, \"name\",\r\n `The Enumeration ${this._currentItemFullName} has an enumerator that is missing the required attribute 'name'.`);\r\n\r\n const valueString = this.getRequiredAttribute(element, \"value\",\r\n `The Enumeration ${this._currentItemFullName} has an enumerator that is missing the required attribute 'value'.`);\r\n let value: string | number = valueString;\r\n\r\n if (PrimitiveType.Integer === tempBackingType) {\r\n const numericValue = parseInt(valueString, 10);\r\n if (isNaN(numericValue))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Enumeration ${this._currentItemFullName} of type \"int\" has an enumerator with a non-integer value.`);\r\n value = numericValue;\r\n }\r\n\r\n const label = this.getOptionalAttribute(element, \"displayLabel\");\r\n const description = this.getOptionalAttribute(element, \"description\");\r\n\r\n enumerators.push({\r\n name,\r\n value,\r\n label,\r\n description,\r\n });\r\n }\r\n\r\n return {\r\n ...itemProps,\r\n type: enumType,\r\n isStrict,\r\n enumerators,\r\n originalECSpecMajorVersion: this._ecSpecVersion?.readVersion,\r\n originalECSpecMinorVersion: this._ecSpecVersion?.writeVersion,\r\n };\r\n }\r\n\r\n public parseKindOfQuantity(xmlElement: Element): KindOfQuantityProps {\r\n const itemProps = this.getSchemaItemProps(xmlElement);\r\n\r\n const relativeErrorString = this.getRequiredAttribute(xmlElement, \"relativeError\",\r\n `The KindOfQuantity ${this._currentItemFullName} is missing the required 'relativeError' attribute.`);\r\n const relativeError = parseFloat(relativeErrorString);\r\n if (isNaN(relativeError))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The KindOfQuantity ${this._currentItemFullName} has an invalid 'relativeError' attribute. It should be a numeric value.`);\r\n\r\n const presentationUnitsString = this.getOptionalAttribute(xmlElement, \"presentationUnits\");\r\n let presentationUnits: string[] | undefined;\r\n if (presentationUnitsString)\r\n presentationUnits = this.getQualifiedPresentationUnits(presentationUnitsString.split(\";\"));\r\n\r\n let persistenceUnit = this.getRequiredAttribute(xmlElement, \"persistenceUnit\",\r\n `The KindOfQuantity ${this._currentItemFullName} is missing the required 'persistenceUnit' attribute.`);\r\n persistenceUnit = this.getQualifiedTypeName(persistenceUnit);\r\n\r\n return {\r\n ...itemProps,\r\n relativeError,\r\n presentationUnits,\r\n persistenceUnit,\r\n };\r\n }\r\n\r\n public parsePropertyCategory(xmlElement: Element): PropertyCategoryProps {\r\n const itemProps = this.getSchemaItemProps(xmlElement);\r\n\r\n const priorityString = this.getRequiredAttribute(xmlElement, \"priority\",\r\n `The PropertyCategory ${this._currentItemFullName} is missing the required 'priority' attribute.`);\r\n const priority = parseInt(priorityString, 10);\r\n if (isNaN(priority))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The PropertyCategory ${this._currentItemFullName} has an invalid 'priority' attribute. It should be a numeric value.`);\r\n\r\n return {\r\n ...itemProps,\r\n priority,\r\n };\r\n }\r\n\r\n public parseUnit(xmlElement: Element): SchemaItemUnitProps {\r\n const itemProps = this.getSchemaItemProps(xmlElement);\r\n\r\n let phenomenon = this.getRequiredAttribute(xmlElement, \"phenomenon\",\r\n `The Unit ${this._currentItemFullName} is missing the required 'phenomenon' attribute.`);\r\n let unitSystem = this.getRequiredAttribute(xmlElement, \"unitSystem\",\r\n `The Unit ${this._currentItemFullName} is missing the required 'unitSystem' attribute.`);\r\n const definition = this.getRequiredAttribute(xmlElement, \"definition\",\r\n `The Unit ${this._currentItemFullName} is missing the required 'definition' attribute.`);\r\n const numerator = this.getOptionalFloatAttribute(xmlElement, \"numerator\",\r\n `The Unit ${this._currentItemFullName} has an invalid 'numerator' attribute. It should be a numeric value.`);\r\n const denominator = this.getOptionalFloatAttribute(xmlElement, \"denominator\",\r\n `The Unit ${this._currentItemFullName} has an invalid 'denominator' attribute. It should be a numeric value.`);\r\n const offset = this.getOptionalFloatAttribute(xmlElement, \"offset\",\r\n `The Unit ${this._currentItemFullName} has an invalid 'offset' attribute. It should be a numeric value.`);\r\n\r\n phenomenon = this.getQualifiedTypeName(phenomenon);\r\n unitSystem = this.getQualifiedTypeName(unitSystem);\r\n\r\n return {\r\n ...itemProps,\r\n phenomenon,\r\n unitSystem,\r\n definition,\r\n numerator,\r\n denominator,\r\n offset,\r\n };\r\n }\r\n\r\n public parseInvertedUnit(xmlElement: Element): InvertedUnitProps {\r\n const itemProps = this.getSchemaItemProps(xmlElement);\r\n\r\n let invertsUnit = this.getRequiredAttribute(xmlElement, \"invertsUnit\",\r\n `The InvertedUnit ${this._currentItemFullName} is missing the required 'invertsUnit' attribute.`);\r\n let unitSystem = this.getRequiredAttribute(xmlElement, \"unitSystem\",\r\n `The InvertedUnit ${this._currentItemFullName} is missing the required 'unitSystem' attribute.`);\r\n\r\n invertsUnit = this.getQualifiedTypeName(invertsUnit);\r\n unitSystem = this.getQualifiedTypeName(unitSystem);\r\n\r\n return {\r\n ...itemProps,\r\n invertsUnit,\r\n unitSystem,\r\n };\r\n }\r\n\r\n public parseConstant(xmlElement: Element): ConstantProps {\r\n const itemProps = this.getSchemaItemProps(xmlElement);\r\n\r\n let phenomenon = this.getRequiredAttribute(xmlElement, \"phenomenon\",\r\n `The Constant ${this._currentItemFullName} is missing the required 'phenomenon' attribute.`);\r\n const definition = this.getRequiredAttribute(xmlElement, \"definition\",\r\n `The Constant ${this._currentItemFullName} is missing the required 'definition' attribute.`);\r\n const numerator = this.getOptionalFloatAttribute(xmlElement, \"numerator\",\r\n `The Constant ${this._currentItemFullName} has an invalid 'numerator' attribute. It should be a numeric value.`);\r\n const denominator = this.getOptionalFloatAttribute(xmlElement, \"denominator\",\r\n `The Constant ${this._currentItemFullName} has an invalid 'denominator' attribute. It should be a numeric value.`);\r\n\r\n phenomenon = this.getQualifiedTypeName(phenomenon);\r\n\r\n return {\r\n ...itemProps,\r\n phenomenon,\r\n definition,\r\n numerator,\r\n denominator,\r\n };\r\n }\r\n\r\n public parsePhenomenon(xmlElement: Element): PhenomenonProps {\r\n const itemProps = this.getSchemaItemProps(xmlElement);\r\n\r\n const definition = this.getRequiredAttribute(xmlElement, \"definition\",\r\n `The Phenomenon ${this._currentItemFullName} is missing the required 'definition' attribute.`);\r\n\r\n return {\r\n ...itemProps,\r\n definition,\r\n };\r\n }\r\n\r\n public parseFormat(xmlElement: Element): SchemaItemFormatProps {\r\n const itemProps = this.getSchemaItemProps(xmlElement);\r\n\r\n const formatType = this.getRequiredAttribute(xmlElement, \"type\",\r\n `The Format ${this._currentItemFullName} is missing the required 'type' attribute.`);\r\n const precision = this.getOptionalIntAttribute(xmlElement, \"precision\",\r\n `The Format ${this._currentItemFullName} has an invalid 'precision' attribute. It should be a numeric value.`);\r\n const roundFactor = this.getOptionalFloatAttribute(xmlElement, \"roundFactor\",\r\n `The Format ${this._currentItemFullName} has an invalid 'roundFactor' attribute. It should be a numeric value.`);\r\n const minWidth = this.getOptionalIntAttribute(xmlElement, \"minWidth\",\r\n `The Format ${this._currentItemFullName} has an invalid 'minWidth' attribute. It should be a numeric value.`);\r\n const showSignOption = this.getOptionalAttribute(xmlElement, \"showSignOption\");\r\n\r\n const formatTraitsString = this.getRequiredAttribute(xmlElement, \"formatTraits\",\r\n `The Format ${this._currentItemFullName} is missing the required 'formatTraits' attribute.`);\r\n const formatTraits = formatTraitsString.split(\"|\");\r\n\r\n const decimalSeparator = this.getOptionalAttribute(xmlElement, \"decimalSeparator\");\r\n const thousandSeparator = this.getOptionalAttribute(xmlElement, \"thousandSeparator\");\r\n const uomSeparator = this.getOptionalAttribute(xmlElement, \"uomSeparator\");\r\n const scientificType = this.getOptionalAttribute(xmlElement, \"scientificType\");\r\n\r\n const stationOffsetSize = this.getOptionalIntAttribute(xmlElement, \"stationOffsetSize\",\r\n `The Format ${this._currentItemFullName} has an invalid 'stationOffsetSize' attribute. It should be a numeric value.`);\r\n\r\n const stationSeparator = this.getOptionalAttribute(xmlElement, \"stationSeparator\");\r\n\r\n let composite: object | undefined;\r\n const compositeResult = this.getElementChildrenByTagName(xmlElement, \"Composite\");\r\n if (compositeResult.length > 0) {\r\n const compositeElement = compositeResult[0];\r\n\r\n const spacer = this.getOptionalAttribute(compositeElement, \"spacer\");\r\n\r\n const includeZeroString = this.getOptionalAttribute(compositeElement, \"includeZero\");\r\n let includeZero: boolean | undefined;\r\n if (includeZeroString) {\r\n includeZero = this.parseBoolean(includeZeroString,\r\n `The Format ${this._currentItemFullName} has a Composite with an invalid 'includeZero' attribute. It should be either \"true\" or \"false\".`);\r\n }\r\n\r\n const units = new Array<{ name: string, label?: string }>();\r\n const unitsResult = this.getElementChildrenByTagName(compositeElement, \"Unit\");\r\n if (unitsResult.length < 1)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Format ${this._currentItemFullName} has an invalid 'Composite' element. It should have 1-4 Unit elements.`);\r\n\r\n for (const unit of unitsResult) {\r\n let name = unit.textContent;\r\n if (null === name || 0 === name.length)\r\n 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.`);\r\n\r\n const label = this.getOptionalAttribute(unit, \"label\");\r\n name = this.getQualifiedTypeName(name);\r\n units.push({ name, label });\r\n }\r\n\r\n composite = {\r\n spacer,\r\n includeZero,\r\n units,\r\n };\r\n }\r\n\r\n return {\r\n ...itemProps,\r\n type: formatType,\r\n precision,\r\n roundFactor,\r\n minWidth,\r\n showSignOption,\r\n formatTraits,\r\n decimalSeparator,\r\n thousandSeparator,\r\n uomSeparator,\r\n scientificType,\r\n stationOffsetSize,\r\n stationSeparator,\r\n composite,\r\n } as SchemaItemFormatProps;\r\n }\r\n\r\n public parseUnitSystem(xmlElement: Element): UnitSystemProps {\r\n return this.getClassProps(xmlElement);\r\n }\r\n\r\n public *getProperties(xmlElement: Element, itemName: string): Iterable<[string, string, Element]> {\r\n const propertyTagRegex = /EC((Struct(Array)?)|Array|Navigation)?Property/;\r\n const children = this.getElementChildrenByTagName(xmlElement, propertyTagRegex);\r\n\r\n for (const child of children) {\r\n const childType = child.nodeName;\r\n const propertyName = this.getRequiredAttribute(child, \"propertyName\",\r\n `An ECProperty in ${itemName} is missing the required 'propertyName' attribute.`);\r\n\r\n const propertyType = this.getPropertyType(childType);\r\n // This may not be needed, just a failsafe if the regex is faulty\r\n if (propertyType === undefined)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECProperty ${itemName}.${propertyName} has an invalid type. ${childType} is not a valid ECProperty type.`);\r\n\r\n yield [propertyName, propertyType, child];\r\n }\r\n }\r\n\r\n public parsePrimitiveProperty(xmlElement: Element): PrimitivePropertyProps {\r\n const typeName = this.getPropertyTypeName(xmlElement);\r\n const propertyProps = this.getPrimitiveOrEnumPropertyBaseProps(xmlElement, typeName);\r\n const primitivePropertyProps = { ...propertyProps, typeName };\r\n return primitivePropertyProps;\r\n }\r\n\r\n public parseStructProperty(xmlElement: Element): StructPropertyProps {\r\n const propertyProps = this.getPropertyProps(xmlElement);\r\n const typeName = this.getPropertyTypeName(xmlElement);\r\n const structPropertyProps = { ...propertyProps, typeName };\r\n return structPropertyProps;\r\n }\r\n\r\n public parsePrimitiveArrayProperty(xmlElement: Element): PrimitiveArrayPropertyProps {\r\n const typeName = this.getPropertyTypeName(xmlElement);\r\n const propertyProps = this.getPrimitiveOrEnumPropertyBaseProps(xmlElement, typeName);\r\n const minAndMaxOccurs = this.getPropertyMinAndMaxOccurs(xmlElement);\r\n\r\n return {\r\n ...propertyProps,\r\n ...minAndMaxOccurs,\r\n typeName,\r\n };\r\n }\r\n\r\n public parseStructArrayProperty(xmlElement: Element): StructArrayPropertyProps {\r\n const propertyProps = this.getPropertyProps(xmlElement);\r\n const typeName = this.getPropertyTypeName(xmlElement);\r\n const minAndMaxOccurs = this.getPropertyMinAndMaxOccurs(xmlElement);\r\n return {\r\n ...propertyProps,\r\n ...minAndMaxOccurs,\r\n typeName,\r\n };\r\n }\r\n\r\n public parseNavigationProperty(xmlElement: Element): NavigationPropertyProps {\r\n const propName = this.getPropertyName(xmlElement);\r\n const propertyProps = this.getPropertyProps(xmlElement);\r\n let relationshipName = this.getRequiredAttribute(xmlElement, \"relationshipName\",\r\n `The ECNavigationProperty ${this._currentItemFullName}.${propName} is missing the required 'relationshipName' property.`);\r\n const direction = this.getRequiredAttribute(xmlElement, \"direction\",\r\n `The ECNavigationProperty ${this._currentItemFullName}.${propName} is missing the required 'direction' property.`);\r\n\r\n relationshipName = this.getQualifiedTypeName(relationshipName);\r\n\r\n return {\r\n ...propertyProps,\r\n relationshipName,\r\n direction,\r\n };\r\n }\r\n\r\n public getSchemaCustomAttributeProviders(): Iterable<CAProviderTuple> {\r\n return this.getCustomAttributeProviders(this._rawSchema.documentElement, \"Schema\", this._schemaName);\r\n }\r\n\r\n public getClassCustomAttributeProviders(xmlElement: Element): Iterable<CAProviderTuple> {\r\n return this.getCustomAttributeProviders(xmlElement, \"ECClass\", this._currentItemFullName);\r\n }\r\n\r\n public getPropertyCustomAttributeProviders(xmlElement: Element): Iterable<CAProviderTuple> {\r\n const propName = this.getPropertyName(xmlElement);\r\n return this.getCustomAttributeProviders(xmlElement, \"ECProperty\", `${this._currentItemFullName}.${propName}`);\r\n }\r\n\r\n public getRelationshipConstraintCustomAttributeProviders(xmlElement: Element): [Iterable<CAProviderTuple> /* source */, Iterable<CAProviderTuple> /* target */] {\r\n const sourceResult = this.getElementChildrenByTagName(xmlElement, \"Source\");\r\n if (sourceResult.length < 1)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Source constraint tag.`);\r\n const sourceElement = sourceResult[0];\r\n const sourceCustomAttributes = this.getCustomAttributeProviders(sourceElement, \"Source Constraint of\", this._currentItemFullName);\r\n\r\n const targetResult = this.getElementChildrenByTagName(xmlElement, \"Target\");\r\n if (targetResult.length < 1)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Target constraint tag.`);\r\n const targetElement = targetResult[0];\r\n const targetCustomAttributes = this.getCustomAttributeProviders(targetElement, \"Source Constraint of\", this._currentItemFullName);\r\n\r\n return [sourceCustomAttributes, targetCustomAttributes];\r\n }\r\n\r\n private getElementChildren(xmlElement: Element): Element[] {\r\n // NodeListOf<T> does not define [Symbol.iterator]\r\n const children = Array.from(xmlElement.childNodes).filter((child) => {\r\n // (node.nodeType === 1) implies instanceof Element\r\n // https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/children#Polyfill\r\n return child.nodeType === 1;\r\n });\r\n return children as Element[];\r\n }\r\n\r\n private getElementChildrenByTagName(xmlElement: Element, tagName: string | RegExp): Element[] {\r\n const children = this.getElementChildren(xmlElement);\r\n if (\"*\" === tagName)\r\n return children;\r\n\r\n let result: Element[];\r\n if (typeof tagName === \"string\") {\r\n result = children.filter((child) => {\r\n return tagName.toLowerCase() === child.nodeName.toLowerCase();\r\n });\r\n } else {\r\n result = children.filter((child) => {\r\n return tagName.test(child.nodeName);\r\n });\r\n }\r\n\r\n return result;\r\n }\r\n\r\n private getOptionalAttribute(xmlElement: Element, attributeName: string): string | undefined {\r\n if (!xmlElement.hasAttribute(attributeName))\r\n return undefined;\r\n const result = xmlElement.getAttribute(attributeName);\r\n\r\n // The typings for the return value of getAttribute do not match that of xmldom\r\n // xmldom returns an empty string instead of null\r\n // However Typescript will still treat result as a union type without this check\r\n // Hence this is needed for tsc to compile\r\n if (result === null)\r\n return undefined;\r\n return result;\r\n }\r\n\r\n private getOptionalFloatAttribute(xmlElement: Element, attributeName: string, parseErrorMsg: string): number | undefined {\r\n const resultString = this.getOptionalAttribute(xmlElement, attributeName);\r\n let result: number | undefined;\r\n if (resultString) {\r\n result = parseFloat(resultString);\r\n if (isNaN(result))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, parseErrorMsg);\r\n }\r\n return result;\r\n }\r\n\r\n private getOptionalIntAttribute(xmlElement: Element, attributeName: string, parseErrorMsg: string): number | undefined {\r\n const resultString = this.getOptionalAttribute(xmlElement, attributeName);\r\n let result: number | undefined;\r\n if (resultString) {\r\n result = parseInt(resultString, 10);\r\n if (isNaN(result))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, parseErrorMsg);\r\n }\r\n return result;\r\n }\r\n\r\n private parseBoolean(text: string, parseErrorMsg: string): boolean {\r\n const textString = text.toLowerCase();\r\n if (\"true\" === textString)\r\n return true;\r\n else if (\"false\" === textString)\r\n return false;\r\n else\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, parseErrorMsg);\r\n }\r\n\r\n private getRequiredAttribute(xmlElement: Element, attributeName: string, errorMsg: string): string {\r\n if (!xmlElement.hasAttribute(attributeName))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, errorMsg);\r\n const result = xmlElement.getAttribute(attributeName);\r\n if (result === null)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, errorMsg);\r\n return result;\r\n }\r\n\r\n private getSchemaReference(xmlElement: Element): SchemaReferenceProps {\r\n const alias = this.getRequiredAttribute(xmlElement, \"alias\",\r\n `The schema ${this._schemaName} has an invalid ECSchemaReference attribute. One of the references is missing the required 'alias' attribute.`);\r\n const name = this.getRequiredAttribute(xmlElement, \"name\",\r\n `The schema ${this._schemaName} has an invalid ECSchemaReference attribute. One of the references is missing the required 'name' attribute.`);\r\n const version = this.getRequiredAttribute(xmlElement, \"version\",\r\n `The schema ${this._schemaName} has an invalid ECSchemaReference attribute. One of the references is missing the required 'version' attribute.`);\r\n\r\n if (!this._schemaReferenceNames.has(alias.toLowerCase()))\r\n this._schemaReferenceNames.set(alias.toLowerCase(), name);\r\n\r\n return {\r\n name,\r\n version,\r\n };\r\n }\r\n\r\n private getSchemaItemType(rawType: string): string | undefined {\r\n switch (rawType.toLowerCase()) {\r\n case \"ecentityclass\": return \"EntityClass\";\r\n case \"mixin\": return \"Mixin\";\r\n case \"ecstructclass\": return \"StructClass\";\r\n case \"eccustomattributeclass\": return \"CustomAttributeClass\";\r\n case \"ecrelationshipclass\": return \"RelationshipClass\";\r\n case \"ecenumeration\": return \"Enumeration\";\r\n case \"kindofquantity\": return \"KindOfQuantity\";\r\n case \"propertycategory\": return \"PropertyCategory\";\r\n case \"unit\": return \"Unit\";\r\n case \"invertedunit\": return \"InvertedUnit\";\r\n case \"constant\": return \"Constant\";\r\n case \"phenomenon\": return \"Phenomenon\";\r\n case \"unitsystem\": return \"UnitSystem\";\r\n case \"format\": return \"Format\";\r\n }\r\n return undefined;\r\n }\r\n\r\n private getSchemaChildren(): Element[] {\r\n const schemaMetadata = this._rawSchema.documentElement;\r\n return this.getElementChildren(schemaMetadata);\r\n }\r\n\r\n private getSchemaItemProps(xmlElement: Element): SchemaItemProps {\r\n const displayLabel = this.getOptionalAttribute(xmlElement, \"displayLabel\");\r\n const description = this.getOptionalAttribute(xmlElement, \"description\");\r\n\r\n return {\r\n description,\r\n label: displayLabel,\r\n };\r\n }\r\n\r\n private getClassProps(xmlElement: Element): ClassProps {\r\n const itemProps = this.getSchemaItemProps(xmlElement);\r\n const modifier = this.getOptionalAttribute(xmlElement, \"modifier\");\r\n\r\n let baseClass: string | null | undefined = null;\r\n const baseClasses = this.getElementChildrenByTagName(xmlElement, \"BaseClass\");\r\n if (baseClasses.length > 0) {\r\n // We are assuming here that the first BaseClass is the 'real' one - the rest are mixins\r\n // This is not a finalized approach as this could lead to unsupported schemas\r\n baseClass = baseClasses[0].textContent;\r\n }\r\n\r\n baseClass = baseClass ? this.getQualifiedTypeName(baseClass) : undefined;\r\n\r\n return {\r\n ...itemProps,\r\n modifier,\r\n baseClass,\r\n originalECSpecMajorVersion: this._ecSpecVersion?.readVersion,\r\n originalECSpecMinorVersion: this._ecSpecVersion?.writeVersion,\r\n };\r\n }\r\n\r\n private getRelationshipConstraintProps(xmlElement: Element, isSource: boolean): RelationshipConstraintProps {\r\n const constraintName = `${(isSource) ? \"Source\" : \"Target\"} Constraint of ${this._currentItemFullName}`;\r\n\r\n const multiplicity = this.getRequiredAttribute(xmlElement, \"multiplicity\",\r\n `The ${constraintName} is missing the required 'multiplicity' attribute.`);\r\n const roleLabel = this.getRequiredAttribute(xmlElement, \"roleLabel\",\r\n `The ${constraintName} is missing the required 'roleLabel' attribute.`);\r\n\r\n const polymorphicString = this.getRequiredAttribute(xmlElement, \"polymorphic\",\r\n `The ${constraintName} is missing the required 'polymorphic' attribute.`);\r\n const polymorphic = this.parseBoolean(polymorphicString,\r\n `The ${constraintName} has an invalid 'polymorphic' attribute. It should either be \"true\" or \"false\".`);\r\n\r\n let abstractConstraint = this.getOptionalAttribute(xmlElement, \"abstractConstraint\");\r\n if (undefined !== abstractConstraint)\r\n abstractConstraint = this.getQualifiedTypeName(abstractConstraint);\r\n\r\n const constraintClasses = new Array<string>();\r\n const constraintClassesResult = this.getElementChildrenByTagName(xmlElement, \"Class\");\r\n if (constraintClassesResult.length < 1)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ${constraintName} is missing the required Class tags.`);\r\n\r\n for (const constraintClass of constraintClassesResult) {\r\n let constraintClassId = constraintClass.getAttribute(\"class\");\r\n if (null === constraintClassId || 0 === constraintClassId.length)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ${constraintName} has a Class that is missing the required 'class' attribute.`);\r\n\r\n constraintClassId = this.getQualifiedTypeName(constraintClassId);\r\n constraintClasses.push(constraintClassId);\r\n }\r\n\r\n return {\r\n multiplicity,\r\n roleLabel,\r\n polymorphic,\r\n abstractConstraint,\r\n constraintClasses,\r\n };\r\n }\r\n\r\n private getPropertyType(propType: string): string | undefined {\r\n switch (propType) {\r\n case \"ECNavigationProperty\": return \"navigationproperty\";\r\n case \"ECStructProperty\": return \"structproperty\";\r\n case \"ECArrayProperty\": return \"primitivearrayproperty\";\r\n case \"ECStructArrayProperty\": return \"structarrayproperty\";\r\n case \"ECProperty\": return \"primitiveproperty\";\r\n default: return undefined;\r\n }\r\n }\r\n\r\n private getPropertyName(xmlElement: Element): string {\r\n return this.getRequiredAttribute(xmlElement, \"propertyName\",\r\n `An ECProperty in ${this._currentItemFullName} is missing the required 'propertyName' attribute.`);\r\n }\r\n\r\n private getPropertyProps(xmlElement: Element): PropertyProps {\r\n const propName = this.getPropertyName(xmlElement);\r\n\r\n const propType = this.getPropertyType(xmlElement.nodeName);\r\n if (propType === undefined)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECProperty ${this._currentItemFullName}.${propName} has an invalid type. ${propType} is not a valid ECProperty type.`);\r\n\r\n const label = this.getOptionalAttribute(xmlElement, \"displayLabel\");\r\n const description = this.getOptionalAttribute(xmlElement, \"description\");\r\n\r\n const readOnlyString = this.getOptionalAttribute(xmlElement, \"readOnly\");\r\n let isReadOnly: boolean | undefined;\r\n if (readOnlyString) {\r\n isReadOnly = this.parseBoolean(readOnlyString,\r\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'readOnly' attribute. It should be either \"true\" or \"false\".`);\r\n }\r\n\r\n let category = this.getOptionalAttribute(xmlElement, \"category\");\r\n\r\n const priority = this.getOptionalIntAttribute(xmlElement, \"priority\",\r\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'priority' attribute. It should be a numeric value.`);\r\n\r\n const inheritedString = this.getOptionalAttribute(xmlElement, \"inherited\");\r\n let inherited: boolean | undefined;\r\n if (inheritedString) {\r\n inherited = this.parseBoolean(inheritedString,\r\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'inherited' attribute. It should be either \"true\" or \"false\".`);\r\n }\r\n\r\n let kindOfQuantity = this.getOptionalAttribute(xmlElement, \"kindOfQuantity\");\r\n\r\n if (kindOfQuantity)\r\n kindOfQuantity = this.getQualifiedTypeName(kindOfQuantity);\r\n if (category)\r\n category = this.getQualifiedTypeName(category);\r\n\r\n return {\r\n name: propName,\r\n type: propType,\r\n description,\r\n label,\r\n isReadOnly,\r\n category,\r\n priority,\r\n inherited,\r\n kindOfQuantity,\r\n };\r\n }\r\n\r\n private getPropertyTypeName(xmlElement: Element): string {\r\n const propName = this.getPropertyName(xmlElement);\r\n const rawTypeName = this.getRequiredAttribute(xmlElement, \"typeName\",\r\n `The ECProperty ${this._currentItemFullName}.${propName} is missing the required 'typeName' attribute.`);\r\n\r\n // If not a primitive type, we must prepend the schema name.\r\n const primitiveType = parsePrimitiveType(rawTypeName);\r\n if (primitiveType)\r\n return rawTypeName;\r\n\r\n return this.getQualifiedTypeName(rawTypeName);\r\n }\r\n\r\n private getPrimitiveOrEnumPropertyBaseProps(xmlElement: Element, typeName: string): PrimitiveOrEnumPropertyBaseProps {\r\n const primitiveType = parsePrimitiveType(typeName);\r\n const propertyProps = this.getPropertyProps(xmlElement);\r\n const propName = propertyProps.name;\r\n const extendedTypeName = this.getOptionalAttribute(xmlElement, \"extendedTypeName\");\r\n const minLength = this.getOptionalIntAttribute(xmlElement, \"minimumLength\",\r\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'minimumLength' attribute. It should be a numeric value.`);\r\n const maxLength = this.getOptionalIntAttribute(xmlElement, \"maximumLength\",\r\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'maximumLength' attribute. It should be a numeric value.`);\r\n\r\n let minValue: number | undefined;\r\n let maxValue: number | undefined;\r\n if (primitiveType === PrimitiveType.Double || primitiveType === PrimitiveType.Long) {\r\n minValue = this.getOptionalFloatAttribute(xmlElement, \"minimumValue\",\r\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'minimumValue' attribute. It should be a numeric value.`);\r\n maxValue = this.getOptionalFloatAttribute(xmlElement, \"maximumValue\",\r\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'maximumValue' attribute. It should be a numeric value.`);\r\n } else {\r\n minValue = this.getOptionalIntAttribute(xmlElement, \"minimumValue\",\r\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'minimumValue' attribute. It should be a numeric value.`);\r\n maxValue = this.getOptionalIntAttribute(xmlElement, \"maximumValue\",\r\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'maximumValue' attribute. It should be a numeric value.`);\r\n }\r\n\r\n return {\r\n ...propertyProps,\r\n extendedTypeName,\r\n minLength,\r\n maxLength,\r\n minValue,\r\n maxValue,\r\n };\r\n }\r\n\r\n private getPropertyMinAndMaxOccurs(xmlElement: Element): { minOccurs: number | undefined, maxOccurs: number | undefined } {\r\n const propName = this.getPropertyName(xmlElement);\r\n const minOccurs = this.getOptionalIntAttribute(xmlElement, \"minOccurs\",\r\n `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'minOccurs' attribute. It should be a numeric value.`);\r\n\r\n const maxOccursStr = this.getOptionalAttribute(xmlElement, \"maxOccurs\");\r\n let maxOccurs: number | undefined;\r\n if (\"unbounded\" === maxOccursStr)\r\n maxOccurs = 2147483647; // TODO: This should be using the INT32_MAX variable.\r\n else if (undefined !== maxOccursStr) {\r\n maxOccurs = parseInt(maxOccursStr, 10);\r\n if (isNaN(maxOccurs))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'maxOccurs' attribute. It should be a numeric value.`);\r\n }\r\n\r\n return { minOccurs, maxOccurs };\r\n }\r\n\r\n private *getCustomAttributeProviders(xmlElement: Element, type: string, _name?: string): Iterable<CAProviderTuple> {\r\n const customAttributesResult = this.getElementChildrenByTagName(xmlElement, \"ECCustomAttributes\");\r\n if (customAttributesResult.length < 1)\r\n return;\r\n\r\n const attributes = this.getElementChildren(customAttributesResult[0]);\r\n for (const attribute of attributes) {\r\n if (\"ECClass\" === type && \"IsMixin\" === attribute.tagName)\r\n continue;\r\n\r\n yield this.getCustomAttributeProvider(attribute);\r\n }\r\n }\r\n\r\n private getCustomAttributeProvider(xmlCustomAttribute: Element): CAProviderTuple {\r\n assert(this._ecSpecVersion !== undefined);\r\n\r\n let ns = xmlCustomAttribute.getAttribute(\"xmlns\");\r\n if (!ns) {\r\n assert(this._schemaName !== undefined);\r\n assert(this._schemaVersion !== undefined);\r\n ns = `${this._schemaName}.${this._schemaVersion}`;\r\n }\r\n\r\n if (null === ns || !this.isSchemaFullNameValidForVersion(ns, this._ecSpecVersion))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Custom attribute namespaces must contain a valid 3.2 full schema name in the form <schemaName>.RR.ww.mm.`);\r\n\r\n const schemaNameParts = ns.split(\".\");\r\n const className = `${schemaNameParts[0]}.${xmlCustomAttribute.tagName}`;\r\n const properties = this.getElementChildren(xmlCustomAttribute);\r\n\r\n const provider = (caClass: CustomAttributeClass) => {\r\n return this.addCAPropertyValues(caClass, properties);\r\n };\r\n\r\n return [className, provider];\r\n }\r\n\r\n private addCAPropertyValues(caClass: CustomAttributeClass, propertyElements: Element[]): CustomAttribute {\r\n const instance = { className: caClass.fullName } as CustomAttribute;\r\n for (const propertyElement of propertyElements) {\r\n const value = this.readPropertyValue(propertyElement, caClass);\r\n if (value !== undefined)\r\n instance[propertyElement.tagName] = value;\r\n }\r\n\r\n return instance;\r\n }\r\n\r\n private readPropertyValue(propElement: Element, parentClass: ECClass): any {\r\n const propertyClass = parentClass.getPropertySync(propElement.tagName);\r\n if (!propertyClass)\r\n return;\r\n\r\n if (propertyClass.isArray())\r\n return this.readArrayPropertyValue(propElement, propertyClass);\r\n\r\n let enumeration: Enumeration | undefined;\r\n if (propertyClass.isPrimitive()) {\r\n if (propertyClass.isEnumeration() && propertyClass.enumeration) {\r\n enumeration = propertyClass.schema.lookupItemSync(propertyClass.enumeration.fullName, Enumeration);\r\n if (!enumeration)\r\n throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `The Enumeration class '${propertyClass.enumeration.fullName}' could not be found.`);\r\n }\r\n const primitiveType = enumeration && enumeration.type ? enumeration.type : (propertyClass).primitiveType;\r\n return this.readPrimitivePropertyValue(propElement, primitiveType);\r\n }\r\n\r\n if (propertyClass.isStruct())\r\n return this.readStructPropertyValue(propElement, propertyClass.structClass);\r\n\r\n return undefined;\r\n }\r\n\r\n private readArrayPropertyValue(propElement: Element, propertyClass: Property): PrimitiveArray | undefined {\r\n if (propertyClass.isPrimitive())\r\n return this.readPrimitiveArrayValues(propElement, (propertyClass as PrimitiveProperty).primitiveType);\r\n\r\n if (propertyClass.isStruct())\r\n return this.readStructArrayValues(propElement, propertyClass as StructArrayProperty);\r\n\r\n return undefined;\r\n }\r\n\r\n private readPrimitiveArrayValues(propElement: Element, primitiveType: PrimitiveType): PrimitiveArray {\r\n const typeName = primitiveTypeToString(primitiveType);\r\n const children = this.getElementChildrenByTagName(propElement, typeName);\r\n const values: PrimitiveArray = [];\r\n for (const child of children) {\r\n const value = this.readPrimitivePropertyValue(child, primitiveType);\r\n values.push(value);\r\n }\r\n\r\n return values;\r\n }\r\n\r\n private readStructArrayValues(propElement: Element, propertyClass: StructArrayProperty): any {\r\n const children = this.getElementChildren(propElement);\r\n const values: any = [];\r\n for (const child of children) {\r\n const value = this.readStructPropertyValue(child, propertyClass.structClass);\r\n values.push(value);\r\n }\r\n\r\n return values;\r\n }\r\n\r\n private readStructPropertyValue(propElement: Element, structClass: StructClass): any {\r\n const structObj: any = {};\r\n const children = this.getElementChildren(propElement);\r\n for (const child of children) {\r\n const value = this.readPropertyValue(child, structClass);\r\n if (value !== undefined)\r\n structObj[child.tagName] = value;\r\n }\r\n return structObj;\r\n }\r\n\r\n private readPrimitivePropertyValue(propElement: Element, primitiveType: PrimitiveType): PrimitiveValue {\r\n if (undefined === propElement.textContent || null === propElement.textContent)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid property value.`);\r\n\r\n if (propElement.textContent === \"\" && primitiveType !== PrimitiveType.String)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid property value.`);\r\n\r\n // TODO: Mapping all primitive types to string, number and boolean\r\n // for now. Need to review with IModelJs.\r\n switch (primitiveType) {\r\n case PrimitiveType.String:\r\n case PrimitiveType.Binary: /** TODO - Currently treated as strings */\r\n case PrimitiveType.IGeometry: /** TODO - Currently treated as strings */\r\n return propElement.textContent;\r\n case PrimitiveType.DateTime:\r\n return this.getDatePropertyValue(propElement.textContent, propElement.tagName);\r\n case PrimitiveType.Point2d:\r\n return this.getPoint2DPropertyValue(propElement.textContent, propElement.tagName);\r\n case PrimitiveType.Point3d:\r\n return this.getPoint3DPropertyValue(propElement.textContent, propElement.tagName);\r\n case PrimitiveType.Boolean:\r\n return this.getBooleanPropertyValue(propElement.textContent, propElement.tagName);\r\n case PrimitiveType.Integer:\r\n case PrimitiveType.Long:\r\n return this.getIntegerPropertyValue(propElement.textContent, propElement.tagName);\r\n case PrimitiveType.Double:\r\n return this.getDoublePropertyValue(propElement.textContent, propElement.tagName);\r\n default:\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid primitive type.`);\r\n }\r\n }\r\n\r\n private getBooleanPropertyValue(propValue: string, propName: string): boolean {\r\n if (propValue.toLowerCase() === \"true\" ||\r\n Number.parseInt(propValue, 10) > 0) {\r\n return true;\r\n } else if (propValue.toLowerCase() === \"false\" ||\r\n Number.parseInt(propValue, 10) === 0) {\r\n return false;\r\n }\r\n\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. An boolean value was expected.`);\r\n }\r\n\r\n private getIntegerPropertyValue(propValue: string, propName: string): number {\r\n const result = Number.parseFloat(propValue);\r\n if (isNaN(result) || result % 1 !== 0)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. An integer value was expected.`);\r\n\r\n return result;\r\n }\r\n\r\n private getDatePropertyValue(propValue: string, propName: string): Date {\r\n const result = Number.parseInt(propValue, 10);\r\n if (isNaN(result))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A date in milliseconds was expected.`);\r\n\r\n return new Date(result);\r\n }\r\n\r\n private getDoublePropertyValue(propValue: string, propName: string): number {\r\n const result = Number.parseFloat(propValue);\r\n if (isNaN(result))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A double value was expected.`);\r\n\r\n return result;\r\n }\r\n\r\n private getPoint2DPropertyValue(propValue: string, propName: string): any {\r\n const result = propValue.split(\",\");\r\n if (result.length !== 2) {\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 2D value was expected.`);\r\n }\r\n\r\n const x = Number.parseFloat(result[0]);\r\n const y = Number.parseFloat(result[1]);\r\n\r\n if (isNaN(x) || isNaN(y))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 2D value was expected.`);\r\n\r\n return { x, y };\r\n }\r\n\r\n private getPoint3DPropertyValue(propValue: string, propName: string): any {\r\n const result = propValue.split(\",\");\r\n if (result.length !== 3) {\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 3D value was expected.`);\r\n }\r\n\r\n const x = Number.parseFloat(result[0]);\r\n const y = Number.parseFloat(result[1]);\r\n const z = Number.parseFloat(result[2]);\r\n\r\n if (isNaN(x) || isNaN(y) || isNaN(z))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 3D value was expected.`);\r\n\r\n return { x, y, z };\r\n }\r\n\r\n private isSchemaFullNameValidForVersion(schemaFullName: string, ecSpecVersion: ECSpecVersion) {\r\n const schemaNameParts = schemaFullName.split(\".\");\r\n\r\n if ((ecSpecVersion.readVersion >= 3 && ecSpecVersion.writeVersion >= 2) || ecSpecVersion.readVersion > 3) {\r\n if (schemaNameParts.length < 4)\r\n return false;\r\n } else {\r\n if (schemaNameParts.length < 3)\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n public static parseXmlNamespace(xmlNamespace: string): ECSpecVersion | undefined {\r\n const regEx = new RegExp(`^${ECXML_URI}\\\\.([0-9]+)\\\\.([0-9]+)$`);\r\n const match = xmlNamespace.match(regEx);\r\n if (!match)\r\n return;\r\n\r\n const readVersion = parseInt(match[1], 10);\r\n const writeVersion = parseInt(match[2], 10);\r\n return { readVersion, writeVersion };\r\n }\r\n\r\n private getQualifiedTypeName(rawTypeName: string): string {\r\n const nameParts = rawTypeName.split(\":\");\r\n if (nameParts.length !== 2)\r\n return `${this._schemaName}.${rawTypeName}`;\r\n\r\n if (nameParts[0].toLowerCase() === this._schemaAlias.toLowerCase())\r\n return `${this._schemaName}.${nameParts[1]}`;\r\n if (this._schemaReferenceNames.has(nameParts[0].toLowerCase()))\r\n return `${this._schemaReferenceNames.get(nameParts[0].toLowerCase())}.${nameParts[1]}`;\r\n\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `No valid schema found for alias ${nameParts[0]}`);\r\n }\r\n\r\n /** The rest of the API uses the full name format of `{SchemaName}.{SchemaItemName}`,\r\n * meaning all of the references in the format string need to be changed.\r\n */\r\n private getQualifiedPresentationUnits(presentationUnits: string[]): string[] {\r\n const res: string[] = [];\r\n for (const presentationUnit of presentationUnits) {\r\n // we split the presentation unit by square parantheses [ ], f:DefaultReal(6)[u:FT|feet] will be splitted into f:DefaultReal(6) and u:FT|feet\r\n // we format the first one and the next one will be put into [ ] again\r\n const presentationUnitFormats = presentationUnit.split(/[\\[\\]]/g);\r\n let qualifiedPresentation: string = \"\";\r\n qualifiedPresentation = this.getQualifiedTypeName(presentationUnitFormats[0]);\r\n if (presentationUnitFormats.length > 1) {\r\n for (let i = 1; i < presentationUnitFormats.length; ++i) {\r\n if (presentationUnitFormats[i].length === 0)\r\n continue;\r\n const verticalSlashIdx = presentationUnitFormats[i].indexOf(\"|\");\r\n const overrideFormat = this.getQualifiedTypeName(presentationUnitFormats[i].slice(0, verticalSlashIdx));\r\n const formatLabel = presentationUnitFormats[i].slice(verticalSlashIdx);\r\n qualifiedPresentation += `[${overrideFormat}${formatLabel}]`;\r\n }\r\n }\r\n\r\n res.push(qualifiedPresentation);\r\n }\r\n\r\n return res;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"XmlSerializationUtils.js","sourceRoot":"","sources":["../../../src/Deserialization/XmlSerializationUtils.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAM7D;;;GAGG;AACH,MAAM,KAAW,qBAAqB,CAiKrC;AAjKD,WAAiB,qBAAqB;IACpC;;;;;;OAMG;IACI,KAAK,UAAU,oBAAoB,CAAC,QAAgB,EAAE,eAAgC,EAAE,SAAmB,EAAE,MAAc;QAChI,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAyB,CAAC;QAC1E,IAAI,CAAC,OAAO;YACV,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,aAAa,EAAE,cAAc,QAAQ,qDAAqD,CAAC,CAAC;QAErI,MAAM,gBAAgB,GAAG,MAAM,+BAA+B,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjF,MAAM,SAAS,GAAG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C,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACpI,IAAI,CAAC,eAAe;YAClB,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,oBAAoB,EAAE,wDAAwD,MAAM,oCAAoC,SAAS,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC;QAExM,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC3F,CAAC;AACH,CAAC,EAjKgB,qBAAqB,KAArB,qBAAqB,QAiKrC","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 { PrimitiveType, primitiveTypeToString } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { CustomAttribute } from \"../Metadata/CustomAttribute\";\nimport { CustomAttributeClass } from \"../Metadata/CustomAttributeClass\";\nimport { ArrayProperty, EnumerationProperty, PrimitiveOrEnumPropertyBase, PrimitiveProperty, Property, StructProperty } from \"../Metadata/Property\";\nimport { Schema } from \"../Metadata/Schema\";\n\n/**\n * Namespace holding utility functions for serializing EC types to the EC XML format.\n * @internal\n */\nexport namespace XmlSerializationUtils {\n /**\n * Serializes a CustomAttribute instance to the EC XML format.\n * @param fullName The full name of the CustomAttribute (qualified by schema name).\n * @param customAttribute The CustomAttribute instance to serialize.\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\n * @param schema The Schema object being serialized.\n */\n export async function writeCustomAttribute(fullName: string, customAttribute: CustomAttribute, schemaDoc: Document, schema: Schema): Promise<Element> {\n const caClass = await schema.lookupItem(fullName) as CustomAttributeClass;\n if (!caClass)\n throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `The class '${fullName}' could not be found in the current schema context.`);\n\n const nameAndNamespace = await resolveCustomAttributeNamespace(fullName, schema);\n const caElement = schemaDoc.createElement(nameAndNamespace[0]);\n\n if (nameAndNamespace[1])\n caElement.setAttribute(\"xmlns\", nameAndNamespace[1]);\n\n for (const property of await caClass.getProperties())\n await writeInstanceProperty(property, customAttribute, caElement, schemaDoc);\n\n return caElement;\n }\n\n /**\n * Serializes an EC Property instance to the EC XML format.\n * @param propertyClass The Property metadata object.\n * @param instance The Property instance.\n * @param instanceElement The XML Element that will contain the serialized property instance.\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\n */\n export async function writeInstanceProperty(propertyClass: Property, instance: any, instanceElement: Element, schemaDoc: Document): Promise<void> {\n const propertyValue = instance[propertyClass.name];\n if (propertyValue === undefined)\n return;\n\n const propertyElement = schemaDoc.createElement(propertyClass.name);\n instanceElement.appendChild(propertyElement);\n\n if (propertyClass.isArray()) {\n await writeArrayProperty(propertyClass, propertyValue, propertyElement, schemaDoc);\n } else if (propertyClass.isPrimitive()) {\n await writePrimitiveProperty(propertyClass, propertyValue, propertyElement);\n } else if (propertyClass.isStruct()) {\n await writeStructProperty(propertyClass, propertyValue, propertyElement, schemaDoc);\n }\n }\n\n /**\n * Serializes an EC ArrayProperty instance to the EC XML format.\n * @param propertyClass The Property metadata object.\n * @param propertyValue An array holding the property values.\n * @param arrayElement The XML Element that will contain the serialized property instance.\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\n */\n export async function writeArrayProperty(propertyClass: ArrayProperty, propertyValue: any[], arrayElement: Element, schemaDoc: Document): Promise<void> {\n if (propertyClass.isPrimitive()) {\n const typeString = primitiveTypeToString(propertyClass.primitiveType);\n for (const value of propertyValue) {\n const entryElement = schemaDoc.createElement(typeString);\n await writePrimitiveProperty(propertyClass, value, entryElement);\n arrayElement.appendChild(entryElement);\n }\n }\n\n if (propertyClass.isStruct()) {\n for (const value of propertyValue) {\n const structElement = schemaDoc.createElement(propertyClass.structClass.name);\n arrayElement.appendChild(structElement);\n await writeStructProperty(propertyClass, value, structElement, schemaDoc);\n }\n }\n }\n\n /**\n * Serializes an EC StructProperty instance to the EC XML format.\n * @param propertyClass The Property metadata object.\n * @param propertyValue The struct object holding the property values.\n * @param structElement The XML Element that will contain the serialized property instance.\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\n */\n export async function writeStructProperty(propertyClass: StructProperty, propertyValue: any, structElement: Element, schemaDoc: Document): Promise<void> {\n const structClass = propertyClass.structClass;\n for (const propertyMetadata of structClass.getPropertiesSync())\n await writeInstanceProperty(propertyMetadata, propertyValue, structElement, schemaDoc);\n }\n\n /**\n * Serializes an EC PrimitiveProperty instance to the EC XML format.\n * @param propertyClass The Property metadata object.\n * @param propertyValue The struct object holding the property values.\n * @param propertyElement The XML Element that will contain the serialized property instance.\n */\n export async function writePrimitiveProperty(propertyClass: PrimitiveOrEnumPropertyBase, propertyValue: any, propertyElement: Element): Promise<void> {\n let primitiveType: PrimitiveType;\n if (propertyClass.isEnumeration()) {\n const enumeration = await (propertyClass as EnumerationProperty).enumeration;\n if (!enumeration)\n throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `The enumeration on property class '${propertyClass.fullName}' could not be found in the current schema context.`);\n\n if (enumeration.type === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The enumeration on property class '${propertyClass.fullName}' has an invalid primitive type.`);\n\n primitiveType = enumeration.type;\n } else\n primitiveType = (propertyClass as PrimitiveProperty).primitiveType;\n\n switch (primitiveType) {\n case PrimitiveType.String:\n propertyElement.textContent = propertyValue;\n return;\n case PrimitiveType.Boolean:\n propertyElement.textContent = (propertyValue as boolean) ? \"True\" : \"False\";\n return;\n case PrimitiveType.Integer:\n case PrimitiveType.Double:\n case PrimitiveType.Long:\n propertyElement.textContent = propertyValue.toString();\n return;\n case PrimitiveType.DateTime:\n propertyElement.textContent = new Date(propertyValue).getTime().toString();\n return;\n case PrimitiveType.Point2d:\n propertyElement.textContent = `${propertyValue.x},${propertyValue.y}`;\n return;\n case PrimitiveType.Point3d:\n propertyElement.textContent = `${propertyValue.x},${propertyValue.y},${propertyValue.z}`;\n return;\n case PrimitiveType.IGeometry:\n case PrimitiveType.Binary:\n propertyElement.textContent = propertyValue;\n return;\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidPrimitiveType, `The property '${propertyClass.fullName}' has an invalid primitive type.`);\n }\n }\n\n export function createXmlTypedName(currentSchema: Schema, typeSchema: Schema, typeName: string) {\n if (currentSchema.schemaKey.matches(typeSchema.schemaKey))\n return typeName;\n\n // Alias is required in Spec. It could be undefined (technically), so\n // throw until fixed.\n if (typeSchema.alias === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaAlias, `The schema '${typeSchema.name}' has an invalid alias.`);\n\n return `${typeSchema.alias}:${typeName}`;\n }\n\n async function resolveCustomAttributeNamespace(caName: string, schema: Schema): Promise<[string, string | undefined]> {\n const nameParts = caName.split(\".\");\n if (nameParts.length === 1)\n return [caName, undefined];\n\n const attributeSchema = nameParts[0].toUpperCase() === schema.name.toUpperCase() ? schema : await schema.getReference(nameParts[0]);\n if (!attributeSchema)\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Unable to resolve the namespace for CustomAttribute '${caName}' because the referenced schema '${nameParts[0]}' could not be located.`);\n\n return [nameParts[1], `${nameParts[0]}.${attributeSchema.schemaKey.version.toString()}`];\n }\n}\n"]}
1
+ {"version":3,"file":"XmlSerializationUtils.js","sourceRoot":"","sources":["../../../src/Deserialization/XmlSerializationUtils.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAM7D;;;GAGG;AACH,MAAM,KAAW,qBAAqB,CAiKrC;AAjKD,WAAiB,qBAAqB;IACpC;;;;;;OAMG;IACI,KAAK,UAAU,oBAAoB,CAAC,QAAgB,EAAE,eAAgC,EAA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AS,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;YACxB,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAE7B,MAAM,eAAe,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACpI,IAAI,CAAC,eAAe;YAClB,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,oBAAoB,EAAE,wDAAwD,MAAM,oCAAoC,SAAS,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC;QAExM,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC3F,CAAC;AACH,CAAC,EAjKgB,qBAAqB,KAArB,qBAAqB,QAiKrC","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 { PrimitiveType, primitiveTypeToString } from \"../ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\r\nimport { CustomAttribute } from \"../Metadata/CustomAttribute\";\r\nimport { CustomAttributeClass } from \"../Metadata/CustomAttributeClass\";\r\nimport { ArrayProperty, EnumerationProperty, PrimitiveOrEnumPropertyBase, PrimitiveProperty, Property, StructProperty } from \"../Metadata/Property\";\r\nimport { Schema } from \"../Metadata/Schema\";\r\n\r\n/**\r\n * Namespace holding utility functions for serializing EC types to the EC XML format.\r\n * @internal\r\n */\r\nexport namespace XmlSerializationUtils {\r\n /**\r\n * Serializes a CustomAttribute instance to the EC XML format.\r\n * @param fullName The full name of the CustomAttribute (qualified by schema name).\r\n * @param customAttribute The CustomAttribute instance to serialize.\r\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\r\n * @param schema The Schema object being serialized.\r\n */\r\n export async function writeCustomAttribute(fullName: string, customAttribute: CustomAttribute, schemaDoc: Document, schema: Schema): Promise<Element> {\r\n const caClass = await schema.lookupItem(fullName) as CustomAttributeClass;\r\n if (!caClass)\r\n throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `The class '${fullName}' could not be found in the current schema context.`);\r\n\r\n const nameAndNamespace = await resolveCustomAttributeNamespace(fullName, schema);\r\n const caElement = schemaDoc.createElement(nameAndNamespace[0]);\r\n\r\n if (nameAndNamespace[1])\r\n caElement.setAttribute(\"xmlns\", nameAndNamespace[1]);\r\n\r\n for (const property of await caClass.getProperties())\r\n await writeInstanceProperty(property, customAttribute, caElement, schemaDoc);\r\n\r\n return caElement;\r\n }\r\n\r\n /**\r\n * Serializes an EC Property instance to the EC XML format.\r\n * @param propertyClass The Property metadata object.\r\n * @param instance The Property instance.\r\n * @param instanceElement The XML Element that will contain the serialized property instance.\r\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\r\n */\r\n export async function writeInstanceProperty(propertyClass: Property, instance: any, instanceElement: Element, schemaDoc: Document): Promise<void> {\r\n const propertyValue = instance[propertyClass.name];\r\n if (propertyValue === undefined)\r\n return;\r\n\r\n const propertyElement = schemaDoc.createElement(propertyClass.name);\r\n instanceElement.appendChild(propertyElement);\r\n\r\n if (propertyClass.isArray()) {\r\n await writeArrayProperty(propertyClass, propertyValue, propertyElement, schemaDoc);\r\n } else if (propertyClass.isPrimitive()) {\r\n await writePrimitiveProperty(propertyClass, propertyValue, propertyElement);\r\n } else if (propertyClass.isStruct()) {\r\n await writeStructProperty(propertyClass, propertyValue, propertyElement, schemaDoc);\r\n }\r\n }\r\n\r\n /**\r\n * Serializes an EC ArrayProperty instance to the EC XML format.\r\n * @param propertyClass The Property metadata object.\r\n * @param propertyValue An array holding the property values.\r\n * @param arrayElement The XML Element that will contain the serialized property instance.\r\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\r\n */\r\n export async function writeArrayProperty(propertyClass: ArrayProperty, propertyValue: any[], arrayElement: Element, schemaDoc: Document): Promise<void> {\r\n if (propertyClass.isPrimitive()) {\r\n const typeString = primitiveTypeToString(propertyClass.primitiveType);\r\n for (const value of propertyValue) {\r\n const entryElement = schemaDoc.createElement(typeString);\r\n await writePrimitiveProperty(propertyClass, value, entryElement);\r\n arrayElement.appendChild(entryElement);\r\n }\r\n }\r\n\r\n if (propertyClass.isStruct()) {\r\n for (const value of propertyValue) {\r\n const structElement = schemaDoc.createElement(propertyClass.structClass.name);\r\n arrayElement.appendChild(structElement);\r\n await writeStructProperty(propertyClass, value, structElement, schemaDoc);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Serializes an EC StructProperty instance to the EC XML format.\r\n * @param propertyClass The Property metadata object.\r\n * @param propertyValue The struct object holding the property values.\r\n * @param structElement The XML Element that will contain the serialized property instance.\r\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\r\n */\r\n export async function writeStructProperty(propertyClass: StructProperty, propertyValue: any, structElement: Element, schemaDoc: Document): Promise<void> {\r\n const structClass = propertyClass.structClass;\r\n for (const propertyMetadata of structClass.getPropertiesSync())\r\n await writeInstanceProperty(propertyMetadata, propertyValue, structElement, schemaDoc);\r\n }\r\n\r\n /**\r\n * Serializes an EC PrimitiveProperty instance to the EC XML format.\r\n * @param propertyClass The Property metadata object.\r\n * @param propertyValue The struct object holding the property values.\r\n * @param propertyElement The XML Element that will contain the serialized property instance.\r\n */\r\n export async function writePrimitiveProperty(propertyClass: PrimitiveOrEnumPropertyBase, propertyValue: any, propertyElement: Element): Promise<void> {\r\n let primitiveType: PrimitiveType;\r\n if (propertyClass.isEnumeration()) {\r\n const enumeration = await (propertyClass as EnumerationProperty).enumeration;\r\n if (!enumeration)\r\n throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `The enumeration on property class '${propertyClass.fullName}' could not be found in the current schema context.`);\r\n\r\n if (enumeration.type === undefined)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The enumeration on property class '${propertyClass.fullName}' has an invalid primitive type.`);\r\n\r\n primitiveType = enumeration.type;\r\n } else\r\n primitiveType = (propertyClass as PrimitiveProperty).primitiveType;\r\n\r\n switch (primitiveType) {\r\n case PrimitiveType.String:\r\n propertyElement.textContent = propertyValue;\r\n return;\r\n case PrimitiveType.Boolean:\r\n propertyElement.textContent = (propertyValue as boolean) ? \"True\" : \"False\";\r\n return;\r\n case PrimitiveType.Integer:\r\n case PrimitiveType.Double:\r\n case PrimitiveType.Long:\r\n propertyElement.textContent = propertyValue.toString();\r\n return;\r\n case PrimitiveType.DateTime:\r\n propertyElement.textContent = new Date(propertyValue).getTime().toString();\r\n return;\r\n case PrimitiveType.Point2d:\r\n propertyElement.textContent = `${propertyValue.x},${propertyValue.y}`;\r\n return;\r\n case PrimitiveType.Point3d:\r\n propertyElement.textContent = `${propertyValue.x},${propertyValue.y},${propertyValue.z}`;\r\n return;\r\n case PrimitiveType.IGeometry:\r\n case PrimitiveType.Binary:\r\n propertyElement.textContent = propertyValue;\r\n return;\r\n default:\r\n throw new ECSchemaError(ECSchemaStatus.InvalidPrimitiveType, `The property '${propertyClass.fullName}' has an invalid primitive type.`);\r\n }\r\n }\r\n\r\n export function createXmlTypedName(currentSchema: Schema, typeSchema: Schema, typeName: string) {\r\n if (currentSchema.schemaKey.matches(typeSchema.schemaKey))\r\n return typeName;\r\n\r\n // Alias is required in Spec. It could be undefined (technically), so\r\n // throw until fixed.\r\n if (typeSchema.alias === undefined)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaAlias, `The schema '${typeSchema.name}' has an invalid alias.`);\r\n\r\n return `${typeSchema.alias}:${typeName}`;\r\n }\r\n\r\n async function resolveCustomAttributeNamespace(caName: string, schema: Schema): Promise<[string, string | undefined]> {\r\n const nameParts = caName.split(\".\");\r\n if (nameParts.length === 1)\r\n return [caName, undefined];\r\n\r\n const attributeSchema = nameParts[0].toUpperCase() === schema.name.toUpperCase() ? schema : await schema.getReference(nameParts[0]);\r\n if (!attributeSchema)\r\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Unable to resolve the namespace for CustomAttribute '${caName}' because the referenced schema '${nameParts[0]}' could not be located.`);\r\n\r\n return [nameParts[1], `${nameParts[0]}.${attributeSchema.schemaKey.version.toString()}`];\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ECName.js","sourceRoot":"","sources":["../../src/ECName.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE5D,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAC3C,MAAM,mBAAmB,GAAG,wBAAwB,CAAC;AACrD,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;AAErD,SAAS,OAAO,CAAC,SAAiB;IAChC,MAAM,CAAC,CAAC,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,SAAS,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,CAAC;AAC9C,CAAC;AAED,SAAS,4BAA4B,CAAC,CAAS;IAC7C,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;IACvB,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,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AAC,CAAC,CAAC,CAAC;QAC3C,IAAI,gBAAgB;YAClB,sBAAsB,CAAC,CAAC,CAAC,CAAC;QAE5B,KAAK,IAAI,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7D,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACtB,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC;gBACrC,sBAAsB,CAAC,CAAC,CAAC,CAAC;;gBAE1B,MAAM,IAAI,IAAI,CAAC;QACnB,CAAC;QAED,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,gGAAgG;IACzF,MAAM;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAChH,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/** @packageDocumentation\n * @module Metadata\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { ECSchemaError, ECSchemaStatus } from \"./Exception\";\n\nconst validECNameRegex = /^[a-zA-Z_]\\w*$/i;\nconst ecNameReplacerRegex = /__x([0-9a-fA-F]{4})__/g;\nconst leadingDigits = [\"0000\", \"000\", \"00\", \"0\", \"\"];\n\nfunction isDigit(character: string): boolean {\n assert(1 === character.length);\n return character >= \"0\" && character <= \"9\";\n}\n\nfunction isValidAlphaNumericCharacter(c: string): boolean {\n assert(1 === c.length);\n return (((c >= \"0\" && c <= \"9\") || (c >= \"A\" && c <= \"Z\") || (c >= \"a\" && c <= \"z\") || c === \"_\"));\n}\n\n/** The name of an item in a [[Schema]], encoded to meet restrictions on the characters usable in such names.\n * An ECName meets the following criteria:\n * - Contains at least one character.\n * - Does not begin with a digit.\n * - Consists entirely of characters in the ASCII ranges A-Z, a-z, and 0-9; and the underscore (\"_\") character.\n *\n * All characters not meeting the above criteria are encoded as \"__x####__\" where \"####\" is the UTF-16 character code.\n * Such names are often automatically generated from the item's display label, which is unrestricted in the characters it may contain.\n * @public\n */\nexport class ECName {\n private _name: string;\n\n /** Construct a new ECName from a valid EC name.\n * throws ECSchemaError if `name` does not meet the criteria for a valid EC name.\n */\n constructor(name: string) {\n if (!ECName.validate(name))\n throw new ECSchemaError(ECSchemaStatus.InvalidECName);\n\n this._name = name;\n }\n\n /** Returns true if a string meets the criteria of a valid EC name. */\n public static validate(name: string): boolean {\n return validECNameRegex.test(name);\n }\n\n /** The underlying name as a string. */\n public get name(): string {\n return this._name;\n }\n\n /** Create an ECName from an arbitrary string, encoding any special characters as \"__x####__\" where \"####\" is the UTF-16 character code.\n * @throws ECSchemaError if `input` is an empty string.\n */\n public static encode(input: string): ECName {\n if (0 === input.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECName);\n\n if (ECName.validate(input)) {\n // It's already a valid EC name.\n return new ECName(input);\n }\n\n let output = \"\";\n\n function appendEncodedCharacter(index: number): void {\n const hex = input.charCodeAt(index).toString(16).toUpperCase();\n assert(hex.length > 0 && hex.length < 5);\n output += `__x${leadingDigits[hex.length]}${hex}__`;\n }\n\n // First character cannot be a digit.\n const firstCharIsDigit = isDigit(input[0]);\n if (firstCharIsDigit)\n appendEncodedCharacter(0);\n\n for (let i = firstCharIsDigit ? 1 : 0; i < input.length; i++) {\n const char = input[i];\n if (!isValidAlphaNumericCharacter(char))\n appendEncodedCharacter(i);\n else\n output += char;\n }\n\n return new ECName(output);\n }\n\n /** Decode this ECName, replacing encoded special characters with the characters they encode. */\n public decode(): string {\n return this.name.replace(ecNameReplacerRegex, (_match, hex) => String.fromCharCode(Number.parseInt(hex, 16)));\n }\n}\n"]}
1
+ {"version":3,"file":"ECName.js","sourceRoot":"","sources":["../../src/ECName.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE5D,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAC3C,MAAM,mBAAmB,GAAG,wBAAwB,CAAC;AACrD,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;AAErD,SAAS,OAAO,CAAC,SAAiB;IAChC,MAAM,CAAC,CAAC,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,SAAS,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,CAAC;AAC9C,CAAC;AAED,SAAS,4BAA4B,CAAC,CAAS;IAC7C,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;IACvB,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACrG,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,MAAM;IACT,KAAK,CAAS;IAEtB;;OAEG;IACH,YAAY,IAAY;QACtB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;YACxB,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;QAExD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,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AC,4BAA4B,CAAC,IAAI,CAAC;gBACrC,sBAAsB,CAAC,CAAC,CAAC,CAAC;;gBAE1B,MAAM,IAAI,IAAI,CAAC;QACnB,CAAC;QAED,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,gGAAgG;IACzF,MAAM;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAChH,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/** @packageDocumentation\r\n * @module Metadata\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"./Exception\";\r\n\r\nconst validECNameRegex = /^[a-zA-Z_]\\w*$/i;\r\nconst ecNameReplacerRegex = /__x([0-9a-fA-F]{4})__/g;\r\nconst leadingDigits = [\"0000\", \"000\", \"00\", \"0\", \"\"];\r\n\r\nfunction isDigit(character: string): boolean {\r\n assert(1 === character.length);\r\n return character >= \"0\" && character <= \"9\";\r\n}\r\n\r\nfunction isValidAlphaNumericCharacter(c: string): boolean {\r\n assert(1 === c.length);\r\n return (((c >= \"0\" && c <= \"9\") || (c >= \"A\" && c <= \"Z\") || (c >= \"a\" && c <= \"z\") || c === \"_\"));\r\n}\r\n\r\n/** The name of an item in a [[Schema]], encoded to meet restrictions on the characters usable in such names.\r\n * An ECName meets the following criteria:\r\n * - Contains at least one character.\r\n * - Does not begin with a digit.\r\n * - Consists entirely of characters in the ASCII ranges A-Z, a-z, and 0-9; and the underscore (\"_\") character.\r\n *\r\n * All characters not meeting the above criteria are encoded as \"__x####__\" where \"####\" is the UTF-16 character code.\r\n * Such names are often automatically generated from the item's display label, which is unrestricted in the characters it may contain.\r\n * @public\r\n */\r\nexport class ECName {\r\n private _name: string;\r\n\r\n /** Construct a new ECName from a valid EC name.\r\n * throws ECSchemaError if `name` does not meet the criteria for a valid EC name.\r\n */\r\n constructor(name: string) {\r\n if (!ECName.validate(name))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECName);\r\n\r\n this._name = name;\r\n }\r\n\r\n /** Returns true if a string meets the criteria of a valid EC name. */\r\n public static validate(name: string): boolean {\r\n return validECNameRegex.test(name);\r\n }\r\n\r\n /** The underlying name as a string. */\r\n public get name(): string {\r\n return this._name;\r\n }\r\n\r\n /** Create an ECName from an arbitrary string, encoding any special characters as \"__x####__\" where \"####\" is the UTF-16 character code.\r\n * @throws ECSchemaError if `input` is an empty string.\r\n */\r\n public static encode(input: string): ECName {\r\n if (0 === input.length)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECName);\r\n\r\n if (ECName.validate(input)) {\r\n // It's already a valid EC name.\r\n return new ECName(input);\r\n }\r\n\r\n let output = \"\";\r\n\r\n function appendEncodedCharacter(index: number): void {\r\n const hex = input.charCodeAt(index).toString(16).toUpperCase();\r\n assert(hex.length > 0 && hex.length < 5);\r\n output += `__x${leadingDigits[hex.length]}${hex}__`;\r\n }\r\n\r\n // First character cannot be a digit.\r\n const firstCharIsDigit = isDigit(input[0]);\r\n if (firstCharIsDigit)\r\n appendEncodedCharacter(0);\r\n\r\n for (let i = firstCharIsDigit ? 1 : 0; i < input.length; i++) {\r\n const char = input[i];\r\n if (!isValidAlphaNumericCharacter(char))\r\n appendEncodedCharacter(i);\r\n else\r\n output += char;\r\n }\r\n\r\n return new ECName(output);\r\n }\r\n\r\n /** Decode this ECName, replacing encoded special characters with the characters they encode. */\r\n public decode(): string {\r\n return this.name.replace(ecNameReplacerRegex, (_match, hex) => String.fromCharCode(Number.parseInt(hex, 16)));\r\n }\r\n}\r\n"]}