@itwin/ecschema-metadata 5.0.0-dev.4 → 5.0.0-dev.41

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 (188) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/lib/cjs/Constants.js +20 -20
  3. package/lib/cjs/Constants.js.map +1 -1
  4. package/lib/cjs/Context.d.ts +19 -0
  5. package/lib/cjs/Context.d.ts.map +1 -1
  6. package/lib/cjs/Context.js +29 -1
  7. package/lib/cjs/Context.js.map +1 -1
  8. package/lib/cjs/DelayedPromise.js +1 -1
  9. package/lib/cjs/DelayedPromise.js.map +1 -1
  10. package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
  11. package/lib/cjs/Deserialization/Helper.js.map +1 -1
  12. package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
  13. package/lib/cjs/Deserialization/JsonProps.d.ts +3 -0
  14. package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
  15. package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
  16. package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
  17. package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
  18. package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
  19. package/lib/cjs/ECName.js.map +1 -1
  20. package/lib/cjs/ECObjects.js.map +1 -1
  21. package/lib/cjs/Exception.js.map +1 -1
  22. package/lib/cjs/Interfaces.js.map +1 -1
  23. package/lib/cjs/Metadata/Class.d.ts +30 -4
  24. package/lib/cjs/Metadata/Class.d.ts.map +1 -1
  25. package/lib/cjs/Metadata/Class.js +76 -10
  26. package/lib/cjs/Metadata/Class.js.map +1 -1
  27. package/lib/cjs/Metadata/Constant.d.ts +1 -1
  28. package/lib/cjs/Metadata/Constant.d.ts.map +1 -1
  29. package/lib/cjs/Metadata/Constant.js.map +1 -1
  30. package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
  31. package/lib/cjs/Metadata/CustomAttributeClass.d.ts +2 -4
  32. package/lib/cjs/Metadata/CustomAttributeClass.d.ts.map +1 -1
  33. package/lib/cjs/Metadata/CustomAttributeClass.js +4 -4
  34. package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
  35. package/lib/cjs/Metadata/EntityClass.d.ts +2 -4
  36. package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
  37. package/lib/cjs/Metadata/EntityClass.js +2 -2
  38. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  39. package/lib/cjs/Metadata/Enumeration.d.ts +1 -1
  40. package/lib/cjs/Metadata/Enumeration.d.ts.map +1 -1
  41. package/lib/cjs/Metadata/Enumeration.js.map +1 -1
  42. package/lib/cjs/Metadata/Format.d.ts +1 -1
  43. package/lib/cjs/Metadata/Format.d.ts.map +1 -1
  44. package/lib/cjs/Metadata/Format.js.map +1 -1
  45. package/lib/cjs/Metadata/InvertedUnit.d.ts +1 -3
  46. package/lib/cjs/Metadata/InvertedUnit.d.ts.map +1 -1
  47. package/lib/cjs/Metadata/InvertedUnit.js +2 -2
  48. package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
  49. package/lib/cjs/Metadata/KindOfQuantity.d.ts +1 -3
  50. package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
  51. package/lib/cjs/Metadata/KindOfQuantity.js +6 -6
  52. package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
  53. package/lib/cjs/Metadata/Mixin.d.ts +1 -1
  54. package/lib/cjs/Metadata/Mixin.d.ts.map +1 -1
  55. package/lib/cjs/Metadata/Mixin.js.map +1 -1
  56. package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
  57. package/lib/cjs/Metadata/Phenomenon.d.ts +1 -1
  58. package/lib/cjs/Metadata/Phenomenon.d.ts.map +1 -1
  59. package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
  60. package/lib/cjs/Metadata/Property.d.ts.map +1 -1
  61. package/lib/cjs/Metadata/Property.js +49 -15
  62. package/lib/cjs/Metadata/Property.js.map +1 -1
  63. package/lib/cjs/Metadata/PropertyCategory.d.ts +1 -1
  64. package/lib/cjs/Metadata/PropertyCategory.d.ts.map +1 -1
  65. package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
  66. package/lib/cjs/Metadata/RelationshipClass.d.ts +1 -1
  67. package/lib/cjs/Metadata/RelationshipClass.d.ts.map +1 -1
  68. package/lib/cjs/Metadata/RelationshipClass.js +4 -4
  69. package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
  70. package/lib/cjs/Metadata/Schema.js +1 -1
  71. package/lib/cjs/Metadata/Schema.js.map +1 -1
  72. package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
  73. package/lib/cjs/Metadata/Unit.d.ts +1 -1
  74. package/lib/cjs/Metadata/Unit.d.ts.map +1 -1
  75. package/lib/cjs/Metadata/Unit.js.map +1 -1
  76. package/lib/cjs/Metadata/UnitSystem.d.ts +1 -3
  77. package/lib/cjs/Metadata/UnitSystem.d.ts.map +1 -1
  78. package/lib/cjs/Metadata/UnitSystem.js +2 -2
  79. package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
  80. package/lib/cjs/PropertyTypes.js.map +1 -1
  81. package/lib/cjs/SchemaJsonLocater.js.map +1 -1
  82. package/lib/cjs/SchemaKey.js.map +1 -1
  83. package/lib/cjs/SchemaLoader.js.map +1 -1
  84. package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
  85. package/lib/cjs/UnitConversion/Graph.js.map +1 -1
  86. package/lib/cjs/UnitConversion/Parser.js.map +1 -1
  87. package/lib/cjs/UnitConversion/UnitConversion.js +2 -2
  88. package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
  89. package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
  90. package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
  91. package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
  92. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  93. package/lib/cjs/ecschema-metadata.js.map +1 -1
  94. package/lib/cjs/utils/SchemaGraph.js.map +1 -1
  95. package/lib/esm/Constants.js +20 -20
  96. package/lib/esm/Constants.js.map +1 -1
  97. package/lib/esm/Context.d.ts +19 -0
  98. package/lib/esm/Context.d.ts.map +1 -1
  99. package/lib/esm/Context.js +29 -1
  100. package/lib/esm/Context.js.map +1 -1
  101. package/lib/esm/DelayedPromise.js +1 -1
  102. package/lib/esm/DelayedPromise.js.map +1 -1
  103. package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
  104. package/lib/esm/Deserialization/Helper.js.map +1 -1
  105. package/lib/esm/Deserialization/JsonParser.js.map +1 -1
  106. package/lib/esm/Deserialization/JsonProps.d.ts +3 -0
  107. package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
  108. package/lib/esm/Deserialization/JsonProps.js.map +1 -1
  109. package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
  110. package/lib/esm/Deserialization/XmlParser.js.map +1 -1
  111. package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
  112. package/lib/esm/ECName.js.map +1 -1
  113. package/lib/esm/ECObjects.js.map +1 -1
  114. package/lib/esm/Exception.js.map +1 -1
  115. package/lib/esm/Interfaces.js.map +1 -1
  116. package/lib/esm/Metadata/Class.d.ts +30 -4
  117. package/lib/esm/Metadata/Class.d.ts.map +1 -1
  118. package/lib/esm/Metadata/Class.js +76 -10
  119. package/lib/esm/Metadata/Class.js.map +1 -1
  120. package/lib/esm/Metadata/Constant.d.ts +1 -1
  121. package/lib/esm/Metadata/Constant.d.ts.map +1 -1
  122. package/lib/esm/Metadata/Constant.js.map +1 -1
  123. package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
  124. package/lib/esm/Metadata/CustomAttributeClass.d.ts +2 -4
  125. package/lib/esm/Metadata/CustomAttributeClass.d.ts.map +1 -1
  126. package/lib/esm/Metadata/CustomAttributeClass.js +4 -4
  127. package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
  128. package/lib/esm/Metadata/EntityClass.d.ts +2 -4
  129. package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
  130. package/lib/esm/Metadata/EntityClass.js +2 -2
  131. package/lib/esm/Metadata/EntityClass.js.map +1 -1
  132. package/lib/esm/Metadata/Enumeration.d.ts +1 -1
  133. package/lib/esm/Metadata/Enumeration.d.ts.map +1 -1
  134. package/lib/esm/Metadata/Enumeration.js.map +1 -1
  135. package/lib/esm/Metadata/Format.d.ts +1 -1
  136. package/lib/esm/Metadata/Format.d.ts.map +1 -1
  137. package/lib/esm/Metadata/Format.js.map +1 -1
  138. package/lib/esm/Metadata/InvertedUnit.d.ts +1 -3
  139. package/lib/esm/Metadata/InvertedUnit.d.ts.map +1 -1
  140. package/lib/esm/Metadata/InvertedUnit.js +2 -2
  141. package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
  142. package/lib/esm/Metadata/KindOfQuantity.d.ts +1 -3
  143. package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
  144. package/lib/esm/Metadata/KindOfQuantity.js +6 -6
  145. package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
  146. package/lib/esm/Metadata/Mixin.d.ts +1 -1
  147. package/lib/esm/Metadata/Mixin.d.ts.map +1 -1
  148. package/lib/esm/Metadata/Mixin.js.map +1 -1
  149. package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
  150. package/lib/esm/Metadata/Phenomenon.d.ts +1 -1
  151. package/lib/esm/Metadata/Phenomenon.d.ts.map +1 -1
  152. package/lib/esm/Metadata/Phenomenon.js.map +1 -1
  153. package/lib/esm/Metadata/Property.d.ts.map +1 -1
  154. package/lib/esm/Metadata/Property.js +49 -15
  155. package/lib/esm/Metadata/Property.js.map +1 -1
  156. package/lib/esm/Metadata/PropertyCategory.d.ts +1 -1
  157. package/lib/esm/Metadata/PropertyCategory.d.ts.map +1 -1
  158. package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
  159. package/lib/esm/Metadata/RelationshipClass.d.ts +1 -1
  160. package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -1
  161. package/lib/esm/Metadata/RelationshipClass.js +4 -4
  162. package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
  163. package/lib/esm/Metadata/Schema.js +1 -1
  164. package/lib/esm/Metadata/Schema.js.map +1 -1
  165. package/lib/esm/Metadata/SchemaItem.js.map +1 -1
  166. package/lib/esm/Metadata/Unit.d.ts +1 -1
  167. package/lib/esm/Metadata/Unit.d.ts.map +1 -1
  168. package/lib/esm/Metadata/Unit.js.map +1 -1
  169. package/lib/esm/Metadata/UnitSystem.d.ts +1 -3
  170. package/lib/esm/Metadata/UnitSystem.d.ts.map +1 -1
  171. package/lib/esm/Metadata/UnitSystem.js +2 -2
  172. package/lib/esm/Metadata/UnitSystem.js.map +1 -1
  173. package/lib/esm/PropertyTypes.js.map +1 -1
  174. package/lib/esm/SchemaJsonLocater.js.map +1 -1
  175. package/lib/esm/SchemaKey.js.map +1 -1
  176. package/lib/esm/SchemaLoader.js.map +1 -1
  177. package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
  178. package/lib/esm/UnitConversion/Graph.js.map +1 -1
  179. package/lib/esm/UnitConversion/Parser.js.map +1 -1
  180. package/lib/esm/UnitConversion/UnitConversion.js +2 -2
  181. package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
  182. package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
  183. package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
  184. package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
  185. package/lib/esm/Validation/SchemaWalker.js.map +1 -1
  186. package/lib/esm/ecschema-metadata.js.map +1 -1
  187. package/lib/esm/utils/SchemaGraph.js.map +1 -1
  188. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipClass.js","sourceRoot":"","sources":["../../../src/Metadata/RelationshipClass.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4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AwB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC7C,iCAAQ,GAAG,IAAI,wBAAwB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;AACtD,+BAAM,GAAG,IAAI,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,gCAAO,GAAG,IAAI,wBAAwB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;AAsC9E;;;GAGG;AACH,MAAsB,wBAAyB,SAAQ,iBAAiB;IACtE,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;IACtF,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;CAMvF;AARD,4DAQC","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 { DelayedPromiseWithProps } from \"../DelayedPromise\";\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\nimport { RelationshipClassProps, RelationshipConstraintProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport {\n ECClassModifier, parseStrength, parseStrengthDirection, RelationshipEnd, SchemaItemType, StrengthDirection, strengthDirectionToString,\n strengthToString, StrengthType,\n} from \"../ECObjects\";\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\nimport { LazyLoadedRelationshipConstraintClass } from \"../Interfaces\";\nimport { SchemaItemKey } from \"../SchemaKey\";\nimport { ECClass } from \"./Class\";\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\nimport { createNavigationProperty, createNavigationPropertySync, EntityClass } from \"./EntityClass\";\nimport { Mixin } from \"./Mixin\";\nimport { NavigationProperty } from \"./Property\";\nimport { Schema } from \"./Schema\";\nimport { SchemaItem } from \"./SchemaItem\";\n\ntype AnyConstraintClass = EntityClass | Mixin | RelationshipClass;\n\n/**\n * A Typescript class representation of a ECRelationshipClass.\n * @beta\n */\nexport class RelationshipClass extends ECClass {\n public override readonly schema!: Schema;\n public override readonly schemaItemType!: SchemaItemType.RelationshipClass;\n protected _strength: StrengthType;\n protected _strengthDirection: StrengthDirection;\n protected _source: RelationshipConstraint;\n protected _target: RelationshipConstraint;\n\n constructor(schema: Schema, name: string, modifier?: ECClassModifier) {\n super(schema, name, modifier);\n this.schemaItemType = SchemaItemType.RelationshipClass;\n this._strengthDirection = StrengthDirection.Forward;\n this._strength = StrengthType.Referencing;\n this._source = new RelationshipConstraint(this, RelationshipEnd.Source);\n this._target = new RelationshipConstraint(this, RelationshipEnd.Target);\n }\n\n public get strength() { return this._strength; }\n public get strengthDirection() { return this._strengthDirection; }\n public get source() { return this._source; }\n public get target() { return this._target; }\n\n /**\n *\n * @param name\n * @param relationship\n * @param direction\n */\n protected async createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\n return this.addProperty(await createNavigationProperty(this, name, relationship, direction));\n }\n\n protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\n return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));\n }\n\n /**\n * @alpha Used for schema editing.\n */\n protected setStrength(strength: StrengthType) {\n this._strength = strength;\n }\n\n /**\n * @alpha Used for schema editing.\n */\n protected setStrengthDirection(direction: StrengthDirection) {\n this._strengthDirection = direction;\n }\n\n /**\n * @alpha Used for schema editing.\n */\n protected setSourceConstraint(source: RelationshipConstraint) {\n this._source = source;\n }\n\n /**\n * @alpha Used for schema editing.\n */\n protected setTargetConstraint(target: RelationshipConstraint) {\n this._target = target;\n }\n /**\n * Save this RelationshipClass's properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): RelationshipClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.strength = strengthToString(this.strength);\n schemaJson.strengthDirection = strengthDirectionToString(this.strengthDirection);\n schemaJson.source = this.source.toJSON();\n schemaJson.target = this.target.toJSON();\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n itemElement.setAttribute(\"strength\", strengthToString(this.strength));\n itemElement.setAttribute(\"strengthDirection\", strengthDirectionToString(this.strengthDirection));\n itemElement.appendChild(await this.source.toXml(schemaXml));\n itemElement.appendChild(await this.target.toXml(schemaXml));\n return itemElement;\n }\n\n public override fromJSONSync(relationshipClassProps: RelationshipClassProps) {\n super.fromJSONSync(relationshipClassProps);\n\n let strength = parseStrength(relationshipClassProps.strength);\n if (undefined === strength) {\n if (SchemaReadHelper.isECSpecVersionNewer({readVersion: relationshipClassProps.originalECSpecMajorVersion, writeVersion: relationshipClassProps.originalECSpecMinorVersion} as ECSpecVersion))\n strength = StrengthType.Referencing;\n else\n throw new ECObjectsError(ECObjectsStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strength' attribute. '${relationshipClassProps.strength}' is not a valid StrengthType.`);\n }\n\n const strengthDirection = parseStrengthDirection(relationshipClassProps.strengthDirection);\n if (undefined === strengthDirection)\n throw new ECObjectsError(ECObjectsStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strengthDirection' attribute. '${relationshipClassProps.strengthDirection}' is not a valid StrengthDirection.`);\n\n this._strength = strength;\n this._strengthDirection = strengthDirection;\n }\n\n public override async fromJSON(relationshipClassProps: RelationshipClassProps) {\n this.fromJSONSync(relationshipClassProps);\n }\n}\n\n/**\n * A Typescript class representation of a ECRelationshipConstraint.\n * @beta\n */\nexport class RelationshipConstraint implements CustomAttributeContainerProps {\n protected _abstractConstraint?: LazyLoadedRelationshipConstraintClass;\n protected _relationshipClass: RelationshipClass;\n protected _relationshipEnd: RelationshipEnd;\n protected _multiplicity?: RelationshipMultiplicity;\n protected _polymorphic?: boolean;\n protected _roleLabel?: string;\n protected _constraintClasses?: LazyLoadedRelationshipConstraintClass[];\n private _customAttributes?: Map<string, CustomAttribute>;\n\n constructor(relClass: RelationshipClass, relEnd: RelationshipEnd, roleLabel?: string, polymorphic?: boolean) {\n this._relationshipEnd = relEnd;\n if (polymorphic)\n this._polymorphic = polymorphic;\n else\n this._polymorphic = false;\n\n this._multiplicity = RelationshipMultiplicity.zeroOne;\n this._relationshipClass = relClass;\n this._roleLabel = roleLabel;\n }\n\n public get multiplicity() { return this._multiplicity ?? RelationshipMultiplicity.zeroOne; }\n protected set multiplicity(multiplicity: RelationshipMultiplicity) {\n this._multiplicity = multiplicity;\n }\n\n public get polymorphic() { return this._polymorphic ?? false; }\n protected set polymorphic(polymorphic: boolean) {\n this._polymorphic = polymorphic;\n }\n\n public get roleLabel() { return this._roleLabel; }\n protected set roleLabel(roleLabel: string | undefined) {\n this._roleLabel = roleLabel;\n }\n\n public get constraintClasses(): LazyLoadedRelationshipConstraintClass[] | undefined { return this._constraintClasses; }\n\n public get relationshipClass() { return this._relationshipClass; }\n\n public get relationshipEnd() { return this._relationshipEnd; }\n protected set relationshipEnd(relationshipEnd: RelationshipEnd) {\n this._relationshipEnd = relationshipEnd;\n }\n\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\n\n /** Returns the constraint name, ie. 'RelationshipName.Source/Target' */\n public get fullName() { return `${this._relationshipClass.name}:${this.isSource ? \"Source\" : \"Target\"}`; }\n\n /** Returns the schema of the RelationshipClass. */\n public get schema(): Schema { return this._relationshipClass.schema; }\n\n public get abstractConstraint(): LazyLoadedRelationshipConstraintClass | undefined {\n if (this._abstractConstraint)\n return this._abstractConstraint;\n\n if (this.constraintClasses && this.constraintClasses.length === 1)\n return this.constraintClasses[0];\n\n return this._abstractConstraint;\n }\n\n public set abstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined) {\n this._abstractConstraint = abstractConstraint;\n }\n\n /**\n * True if this RelationshipConstraint is the Source relationship end.\n */\n public get isSource(): boolean { return this.relationshipEnd === RelationshipEnd.Source; }\n\n /**\n * Adds the provided class as a constraint class to this constraint.\n * @param constraint The class to add as a constraint class.\n */\n public addClass(constraint: EntityClass | Mixin | RelationshipClass): void {\n // TODO: Ensure we don't start mixing constraint class types\n // TODO: Check that this class is or subclasses abstract constraint?\n\n if (!this._constraintClasses)\n this._constraintClasses = [];\n\n // TODO: Handle relationship constraints\n this._constraintClasses.push(new DelayedPromiseWithProps(constraint.key, async () => constraint));\n }\n\n /**\n * Removes the provided class as a constraint class from this constraint.\n * @param constraint The class to add as a constraint class.\n */\n protected removeClass(constraint: EntityClass | Mixin | RelationshipClass): void {\n if (undefined === this._constraintClasses)\n return;\n\n this._constraintClasses.forEach( (item, index) => {\n const constraintName = item.fullName;\n if(constraintName === constraint.fullName)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._constraintClasses?.splice(index,1);\n });\n }\n\n /**\n * Save this RelationshipConstraint's properties to an object for serializing to JSON.\n */\n public toJSON(): RelationshipConstraintProps {\n const schemaJson: { [value: string]: any } = {};\n schemaJson.multiplicity = this.multiplicity.toString();\n schemaJson.roleLabel = this.roleLabel;\n schemaJson.polymorphic = this.polymorphic;\n if (undefined !== this._abstractConstraint)\n schemaJson.abstractConstraint = this._abstractConstraint.fullName;\n if (undefined !== this.constraintClasses && this.constraintClasses.length > 0)\n schemaJson.constraintClasses = this.constraintClasses.map((constraintClass) => constraintClass.fullName);\n\n const customAttributes = serializeCustomAttributes(this.customAttributes);\n if (undefined !== customAttributes)\n schemaJson.customAttributes = customAttributes;\n return schemaJson as RelationshipConstraintProps;\n }\n\n /** @internal */\n public async toXml(schemaXml: Document): Promise<Element> {\n const elementName = this.isSource ? \"Source\" : \"Target\";\n const itemElement = schemaXml.createElement(elementName);\n if (undefined !== this.polymorphic)\n itemElement.setAttribute(\"polymorphic\", this.polymorphic.toString());\n if (undefined !== this.roleLabel)\n itemElement.setAttribute(\"roleLabel\", this.roleLabel);\n if (undefined !== this.multiplicity)\n itemElement.setAttribute(\"multiplicity\", this.multiplicity.toString());\n\n const abstractConstraint = await this.abstractConstraint;\n if (undefined !== abstractConstraint) {\n const abstractConstraintName = XmlSerializationUtils.createXmlTypedName(this.schema, abstractConstraint.schema, abstractConstraint.name);\n itemElement.setAttribute(\"abstractConstraint\", abstractConstraintName);\n }\n\n if (undefined !== this.constraintClasses) {\n for (const item of this.constraintClasses) {\n const constraintClass = await item;\n const classElement = schemaXml.createElement(\"Class\");\n const constraintClassName = XmlSerializationUtils.createXmlTypedName(this.schema, constraintClass.schema, constraintClass.name);\n classElement.setAttribute(\"class\", constraintClassName);\n itemElement.appendChild(classElement);\n }\n }\n\n if (this._customAttributes) {\n const caContainerElement = schemaXml.createElement(\"ECCustomAttributes\");\n for (const [name, attribute] of this._customAttributes) {\n const caElement = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this.schema);\n caContainerElement.appendChild(caElement);\n }\n itemElement.appendChild(caContainerElement);\n }\n\n return itemElement;\n }\n\n public fromJSONSync(relationshipConstraintProps: RelationshipConstraintProps) {\n\n this._roleLabel = relationshipConstraintProps.roleLabel;\n this._polymorphic = relationshipConstraintProps.polymorphic;\n\n const parsedMultiplicity = RelationshipMultiplicity.fromString(relationshipConstraintProps.multiplicity);\n if (!parsedMultiplicity)\n throw new ECObjectsError(ECObjectsStatus.InvalidMultiplicity, ``);\n this._multiplicity = parsedMultiplicity;\n\n const relClassSchema = this.relationshipClass.schema;\n\n if (undefined !== relationshipConstraintProps.abstractConstraint) {\n const abstractConstraintSchemaItemKey = relClassSchema.getSchemaItemKey(relationshipConstraintProps.abstractConstraint);\n if (!abstractConstraintSchemaItemKey)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);\n this.abstractConstraint = new DelayedPromiseWithProps<SchemaItemKey, AnyConstraintClass>(abstractConstraintSchemaItemKey,\n async () => {\n const tempAbstractConstraint = await relClassSchema.lookupItem<AnyConstraintClass>(relationshipConstraintProps.abstractConstraint!);\n if (undefined === tempAbstractConstraint)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);\n\n return tempAbstractConstraint;\n });\n }\n\n const loadEachConstraint = (constraintClassName: any) => {\n const tempConstraintClass = relClassSchema.lookupItemSync<AnyConstraintClass>(constraintClassName);\n if (!tempConstraintClass)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\n return tempConstraintClass;\n };\n\n for (const constraintClassName of relationshipConstraintProps.constraintClasses) {\n const constraintClass = loadEachConstraint(constraintClassName);\n this.addClass(constraintClass);\n }\n }\n\n public async fromJSON(relationshipConstraintProps: RelationshipConstraintProps) {\n this.fromJSONSync(relationshipConstraintProps);\n }\n\n /**\n * Indicates if the provided [[ECClass]] is supported by this [[RelationshipConstraint]].\n * @param ecClass The class to check.\n */\n public async supportsClass(ecClass: ECClass): Promise<boolean> {\n if (!this.constraintClasses) {\n if (this.relationshipClass.baseClass) {\n const baseRelationship = await this.relationshipClass.baseClass as RelationshipClass;\n const baseConstraint = this.isSource ? baseRelationship.source : baseRelationship.target;\n return baseConstraint.supportsClass(ecClass);\n }\n return false;\n }\n\n if (ecClass.schemaItemType !== SchemaItemType.EntityClass && ecClass.schemaItemType !== SchemaItemType.RelationshipClass &&\n ecClass.schemaItemType !== SchemaItemType.Mixin) {\n return false;\n }\n\n const abstractConstraint = await this.abstractConstraint;\n\n if (abstractConstraint && await RelationshipConstraint.classCompatibleWithConstraint(abstractConstraint, ecClass, this.polymorphic || false))\n return true;\n\n for (const constraint of this.constraintClasses) {\n if (await RelationshipConstraint.classCompatibleWithConstraint(await constraint, ecClass, this.polymorphic || false))\n return true;\n }\n\n return false;\n }\n\n /**\n * Indicates if an ECClass is of the type or applies to the type (if a mixin) of the ECClass specified by the constraintClass parameter.\n * @param constraintClass The ECClass that is a constraint class of a relationship.\n * @param testClass The ECClass to check against the constraint class.\n * @param isPolymorphic Indicates if the testClass should be checked polymorphically.\n */\n public static async classCompatibleWithConstraint(constraintClass: ECClass, testClass: ECClass, isPolymorphic: boolean): Promise<boolean> {\n if (SchemaItem.equalByKey(constraintClass, testClass))\n return true;\n\n if (isPolymorphic) {\n if (testClass.schemaItemType === SchemaItemType.EntityClass || testClass.schemaItemType === SchemaItemType.RelationshipClass) {\n return testClass.is(constraintClass);\n }\n\n if (testClass.schemaItemType === SchemaItemType.Mixin) {\n if (constraintClass.schemaItemType === SchemaItemType.EntityClass)\n return (testClass as Mixin).applicableTo(constraintClass as EntityClass);\n else\n return testClass.is(constraintClass);\n }\n }\n return false;\n }\n\n /**\n * @internal\n */\n public static isRelationshipConstraint(object: any): object is RelationshipConstraint {\n const relationshipConstrait = object as RelationshipConstraint;\n\n return relationshipConstrait !== undefined && relationshipConstrait.polymorphic !== undefined && relationshipConstrait.multiplicity !== undefined\n && relationshipConstrait.relationshipEnd !== undefined && relationshipConstrait._relationshipClass !== undefined;\n }\n\n protected addCustomAttribute(customAttribute: CustomAttribute) {\n if (!this._customAttributes)\n this._customAttributes = new Map<string, CustomAttribute>();\n\n this._customAttributes.set(customAttribute.className, customAttribute);\n }\n\n}\n\n/**\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\n * @internal\n */\nexport abstract class MutableRelationshipConstraint extends RelationshipConstraint {\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\n\n}\n\nconst INT32_MAX = 2147483647;\n\n/**\n * @beta\n */\nexport class RelationshipMultiplicity {\n public static readonly zeroOne = new RelationshipMultiplicity(0, 1);\n public static readonly zeroMany = new RelationshipMultiplicity(0, INT32_MAX);\n public static readonly oneOne = new RelationshipMultiplicity(1, 1);\n public static readonly oneMany = new RelationshipMultiplicity(1, INT32_MAX);\n\n public readonly lowerLimit: number;\n public readonly upperLimit: number;\n\n constructor(lowerLimit: number, upperLimit: number) {\n this.lowerLimit = lowerLimit;\n this.upperLimit = upperLimit;\n }\n\n public static fromString(str: string): RelationshipMultiplicity | undefined {\n const matches = /^\\(([0-9]*)\\.\\.([0-9]*|\\*)\\)$/.exec(str);\n if (matches === null || matches.length !== 3)\n return undefined;\n\n const lowerLimit = parseInt(matches[1], 10);\n const upperLimit = matches[2] === \"*\" ? INT32_MAX : parseInt(matches[2], 10);\n if (0 === lowerLimit && 1 === upperLimit)\n return RelationshipMultiplicity.zeroOne;\n else if (0 === lowerLimit && INT32_MAX === upperLimit)\n return RelationshipMultiplicity.zeroMany;\n else if (1 === lowerLimit && 1 === upperLimit)\n return RelationshipMultiplicity.oneOne;\n else if (1 === lowerLimit && INT32_MAX === upperLimit)\n return RelationshipMultiplicity.oneMany;\n\n return new RelationshipMultiplicity(lowerLimit, upperLimit);\n }\n\n public equals(rhs: RelationshipMultiplicity): boolean {\n return this.lowerLimit === rhs.lowerLimit && this.upperLimit === rhs.upperLimit;\n }\n\n public toString(): string {\n return `(${this.lowerLimit}..${this.upperLimit === INT32_MAX ? \"*\" : this.upperLimit})`;\n }\n}\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableRelationshipClass extends RelationshipClass {\n public override get source() { return this._source as MutableRelationshipConstraint; }\n public override get target() { return this._target as MutableRelationshipConstraint; }\n public abstract override setStrength(strength: StrengthType): void;\n public abstract override setStrengthDirection(direction: StrengthDirection): void;\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
1
+ {"version":3,"file":"RelationshipClass.js","sourceRoot":"","sources":["../../../src/Metadata/RelationshipClass.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;A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CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,KAAK,GAAG,CAAC,UAAU,CAAC;IAClF,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC;IAC1F,CAAC;;AAvCH,4DAwCC;AAED;;;GAGG;AACH,MAAsB,wBAAyB,SAAQ,iBAAiB;IACtE,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;IACtF,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;CAMvF;AARD,4DAQC","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 { DelayedPromiseWithProps } from \"../DelayedPromise\";\r\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\r\nimport { RelationshipClassProps, RelationshipConstraintProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport {\r\n ECClassModifier, parseStrength, parseStrengthDirection, RelationshipEnd, SchemaItemType, StrengthDirection, strengthDirectionToString,\r\n strengthToString, StrengthType,\r\n} from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { LazyLoadedRelationshipConstraintClass } from \"../Interfaces\";\r\nimport { SchemaItemKey } from \"../SchemaKey\";\r\nimport { ECClass } from \"./Class\";\r\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\r\nimport { createNavigationProperty, createNavigationPropertySync, EntityClass } from \"./EntityClass\";\r\nimport { Mixin } from \"./Mixin\";\r\nimport { NavigationProperty } from \"./Property\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\n\r\ntype AnyConstraintClass = EntityClass | Mixin | RelationshipClass;\r\n\r\n/**\r\n * A Typescript class representation of a ECRelationshipClass.\r\n * @beta\r\n */\r\nexport class RelationshipClass extends ECClass {\r\n public override readonly schema!: Schema;\r\n public override readonly schemaItemType = SchemaItemType.RelationshipClass;\r\n protected _strength: StrengthType;\r\n protected _strengthDirection: StrengthDirection;\r\n protected _source: RelationshipConstraint;\r\n protected _target: RelationshipConstraint;\r\n\r\n constructor(schema: Schema, name: string, modifier?: ECClassModifier) {\r\n super(schema, name, modifier);\r\n this._strengthDirection = StrengthDirection.Forward;\r\n this._strength = StrengthType.Referencing;\r\n this._source = new RelationshipConstraint(this, RelationshipEnd.Source);\r\n this._target = new RelationshipConstraint(this, RelationshipEnd.Target);\r\n }\r\n\r\n public get strength() { return this._strength; }\r\n public get strengthDirection() { return this._strengthDirection; }\r\n public get source() { return this._source; }\r\n public get target() { return this._target; }\r\n\r\n /**\r\n *\r\n * @param name\r\n * @param relationship\r\n * @param direction\r\n */\r\n protected async createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\r\n return this.addProperty(await createNavigationProperty(this, name, relationship, direction));\r\n }\r\n\r\n protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\r\n return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));\r\n }\r\n\r\n /**\r\n * @alpha Used for schema editing.\r\n */\r\n protected setStrength(strength: StrengthType) {\r\n this._strength = strength;\r\n }\r\n\r\n /**\r\n * @alpha Used for schema editing.\r\n */\r\n protected setStrengthDirection(direction: StrengthDirection) {\r\n this._strengthDirection = direction;\r\n }\r\n\r\n /**\r\n * @alpha Used for schema editing.\r\n */\r\n protected setSourceConstraint(source: RelationshipConstraint) {\r\n this._source = source;\r\n }\r\n\r\n /**\r\n * @alpha Used for schema editing.\r\n */\r\n protected setTargetConstraint(target: RelationshipConstraint) {\r\n this._target = target;\r\n }\r\n /**\r\n * Save this RelationshipClass's properties to an object for serializing to JSON.\r\n * @param standalone Serialization includes only this object (as opposed to the full schema).\r\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\r\n */\r\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): RelationshipClassProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n schemaJson.strength = strengthToString(this.strength);\r\n schemaJson.strengthDirection = strengthDirectionToString(this.strengthDirection);\r\n schemaJson.source = this.source.toJSON();\r\n schemaJson.target = this.target.toJSON();\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n itemElement.setAttribute(\"strength\", strengthToString(this.strength));\r\n itemElement.setAttribute(\"strengthDirection\", strengthDirectionToString(this.strengthDirection));\r\n itemElement.appendChild(await this.source.toXml(schemaXml));\r\n itemElement.appendChild(await this.target.toXml(schemaXml));\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(relationshipClassProps: RelationshipClassProps) {\r\n super.fromJSONSync(relationshipClassProps);\r\n\r\n let strength = parseStrength(relationshipClassProps.strength);\r\n if (undefined === strength) {\r\n if (SchemaReadHelper.isECSpecVersionNewer({readVersion: relationshipClassProps.originalECSpecMajorVersion, writeVersion: relationshipClassProps.originalECSpecMinorVersion} as ECSpecVersion))\r\n strength = StrengthType.Referencing;\r\n else\r\n throw new ECObjectsError(ECObjectsStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strength' attribute. '${relationshipClassProps.strength}' is not a valid StrengthType.`);\r\n }\r\n\r\n const strengthDirection = parseStrengthDirection(relationshipClassProps.strengthDirection);\r\n if (undefined === strengthDirection)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strengthDirection' attribute. '${relationshipClassProps.strengthDirection}' is not a valid StrengthDirection.`);\r\n\r\n this._strength = strength;\r\n this._strengthDirection = strengthDirection;\r\n }\r\n\r\n public override async fromJSON(relationshipClassProps: RelationshipClassProps) {\r\n this.fromJSONSync(relationshipClassProps);\r\n }\r\n}\r\n\r\n/**\r\n * A Typescript class representation of a ECRelationshipConstraint.\r\n * @beta\r\n */\r\nexport class RelationshipConstraint implements CustomAttributeContainerProps {\r\n protected _abstractConstraint?: LazyLoadedRelationshipConstraintClass;\r\n protected _relationshipClass: RelationshipClass;\r\n protected _relationshipEnd: RelationshipEnd;\r\n protected _multiplicity?: RelationshipMultiplicity;\r\n protected _polymorphic?: boolean;\r\n protected _roleLabel?: string;\r\n protected _constraintClasses?: LazyLoadedRelationshipConstraintClass[];\r\n private _customAttributes?: Map<string, CustomAttribute>;\r\n\r\n constructor(relClass: RelationshipClass, relEnd: RelationshipEnd, roleLabel?: string, polymorphic?: boolean) {\r\n this._relationshipEnd = relEnd;\r\n if (polymorphic)\r\n this._polymorphic = polymorphic;\r\n else\r\n this._polymorphic = false;\r\n\r\n this._multiplicity = RelationshipMultiplicity.zeroOne;\r\n this._relationshipClass = relClass;\r\n this._roleLabel = roleLabel;\r\n }\r\n\r\n public get multiplicity() { return this._multiplicity ?? RelationshipMultiplicity.zeroOne; }\r\n protected set multiplicity(multiplicity: RelationshipMultiplicity) {\r\n this._multiplicity = multiplicity;\r\n }\r\n\r\n public get polymorphic() { return this._polymorphic ?? false; }\r\n protected set polymorphic(polymorphic: boolean) {\r\n this._polymorphic = polymorphic;\r\n }\r\n\r\n public get roleLabel() { return this._roleLabel; }\r\n protected set roleLabel(roleLabel: string | undefined) {\r\n this._roleLabel = roleLabel;\r\n }\r\n\r\n public get constraintClasses(): LazyLoadedRelationshipConstraintClass[] | undefined { return this._constraintClasses; }\r\n\r\n public get relationshipClass() { return this._relationshipClass; }\r\n\r\n public get relationshipEnd() { return this._relationshipEnd; }\r\n protected set relationshipEnd(relationshipEnd: RelationshipEnd) {\r\n this._relationshipEnd = relationshipEnd;\r\n }\r\n\r\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\r\n\r\n /** Returns the constraint name, ie. 'RelationshipName.Source/Target' */\r\n public get fullName() { return `${this._relationshipClass.name}:${this.isSource ? \"Source\" : \"Target\"}`; }\r\n\r\n /** Returns the schema of the RelationshipClass. */\r\n public get schema(): Schema { return this._relationshipClass.schema; }\r\n\r\n public get abstractConstraint(): LazyLoadedRelationshipConstraintClass | undefined {\r\n if (this._abstractConstraint)\r\n return this._abstractConstraint;\r\n\r\n if (this.constraintClasses && this.constraintClasses.length === 1)\r\n return this.constraintClasses[0];\r\n\r\n return this._abstractConstraint;\r\n }\r\n\r\n public set abstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined) {\r\n this._abstractConstraint = abstractConstraint;\r\n }\r\n\r\n /**\r\n * True if this RelationshipConstraint is the Source relationship end.\r\n */\r\n public get isSource(): boolean { return this.relationshipEnd === RelationshipEnd.Source; }\r\n\r\n /**\r\n * Adds the provided class as a constraint class to this constraint.\r\n * @param constraint The class to add as a constraint class.\r\n */\r\n public addClass(constraint: EntityClass | Mixin | RelationshipClass): void {\r\n // TODO: Ensure we don't start mixing constraint class types\r\n // TODO: Check that this class is or subclasses abstract constraint?\r\n\r\n if (!this._constraintClasses)\r\n this._constraintClasses = [];\r\n\r\n // TODO: Handle relationship constraints\r\n this._constraintClasses.push(new DelayedPromiseWithProps(constraint.key, async () => constraint));\r\n }\r\n\r\n /**\r\n * Removes the provided class as a constraint class from this constraint.\r\n * @param constraint The class to add as a constraint class.\r\n */\r\n protected removeClass(constraint: EntityClass | Mixin | RelationshipClass): void {\r\n if (undefined === this._constraintClasses)\r\n return;\r\n\r\n this._constraintClasses.forEach( (item, index) => {\r\n const constraintName = item.fullName;\r\n if(constraintName === constraint.fullName)\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._constraintClasses?.splice(index,1);\r\n });\r\n }\r\n\r\n /**\r\n * Save this RelationshipConstraint's properties to an object for serializing to JSON.\r\n */\r\n public toJSON(): RelationshipConstraintProps {\r\n const schemaJson: { [value: string]: any } = {};\r\n schemaJson.multiplicity = this.multiplicity.toString();\r\n schemaJson.roleLabel = this.roleLabel;\r\n schemaJson.polymorphic = this.polymorphic;\r\n if (undefined !== this._abstractConstraint)\r\n schemaJson.abstractConstraint = this._abstractConstraint.fullName;\r\n if (undefined !== this.constraintClasses && this.constraintClasses.length > 0)\r\n schemaJson.constraintClasses = this.constraintClasses.map((constraintClass) => constraintClass.fullName);\r\n\r\n const customAttributes = serializeCustomAttributes(this.customAttributes);\r\n if (undefined !== customAttributes)\r\n schemaJson.customAttributes = customAttributes;\r\n return schemaJson as RelationshipConstraintProps;\r\n }\r\n\r\n /** @internal */\r\n public async toXml(schemaXml: Document): Promise<Element> {\r\n const elementName = this.isSource ? \"Source\" : \"Target\";\r\n const itemElement = schemaXml.createElement(elementName);\r\n if (undefined !== this.polymorphic)\r\n itemElement.setAttribute(\"polymorphic\", this.polymorphic.toString());\r\n if (undefined !== this.roleLabel)\r\n itemElement.setAttribute(\"roleLabel\", this.roleLabel);\r\n if (undefined !== this.multiplicity)\r\n itemElement.setAttribute(\"multiplicity\", this.multiplicity.toString());\r\n\r\n const abstractConstraint = await this.abstractConstraint;\r\n if (undefined !== abstractConstraint) {\r\n const abstractConstraintName = XmlSerializationUtils.createXmlTypedName(this.schema, abstractConstraint.schema, abstractConstraint.name);\r\n itemElement.setAttribute(\"abstractConstraint\", abstractConstraintName);\r\n }\r\n\r\n if (undefined !== this.constraintClasses) {\r\n for (const item of this.constraintClasses) {\r\n const constraintClass = await item;\r\n const classElement = schemaXml.createElement(\"Class\");\r\n const constraintClassName = XmlSerializationUtils.createXmlTypedName(this.schema, constraintClass.schema, constraintClass.name);\r\n classElement.setAttribute(\"class\", constraintClassName);\r\n itemElement.appendChild(classElement);\r\n }\r\n }\r\n\r\n if (this._customAttributes) {\r\n const caContainerElement = schemaXml.createElement(\"ECCustomAttributes\");\r\n for (const [name, attribute] of this._customAttributes) {\r\n const caElement = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this.schema);\r\n caContainerElement.appendChild(caElement);\r\n }\r\n itemElement.appendChild(caContainerElement);\r\n }\r\n\r\n return itemElement;\r\n }\r\n\r\n public fromJSONSync(relationshipConstraintProps: RelationshipConstraintProps) {\r\n\r\n this._roleLabel = relationshipConstraintProps.roleLabel;\r\n this._polymorphic = relationshipConstraintProps.polymorphic;\r\n\r\n const parsedMultiplicity = RelationshipMultiplicity.fromString(relationshipConstraintProps.multiplicity);\r\n if (!parsedMultiplicity)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidMultiplicity, ``);\r\n this._multiplicity = parsedMultiplicity;\r\n\r\n const relClassSchema = this.relationshipClass.schema;\r\n\r\n if (undefined !== relationshipConstraintProps.abstractConstraint) {\r\n const abstractConstraintSchemaItemKey = relClassSchema.getSchemaItemKey(relationshipConstraintProps.abstractConstraint);\r\n if (!abstractConstraintSchemaItemKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);\r\n this.abstractConstraint = new DelayedPromiseWithProps<SchemaItemKey, AnyConstraintClass>(abstractConstraintSchemaItemKey,\r\n async () => {\r\n const tempAbstractConstraint = await relClassSchema.lookupItem<AnyConstraintClass>(relationshipConstraintProps.abstractConstraint!);\r\n if (undefined === tempAbstractConstraint)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);\r\n\r\n return tempAbstractConstraint;\r\n });\r\n }\r\n\r\n const loadEachConstraint = (constraintClassName: any) => {\r\n const tempConstraintClass = relClassSchema.lookupItemSync<AnyConstraintClass>(constraintClassName);\r\n if (!tempConstraintClass)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\r\n return tempConstraintClass;\r\n };\r\n\r\n for (const constraintClassName of relationshipConstraintProps.constraintClasses) {\r\n const constraintClass = loadEachConstraint(constraintClassName);\r\n this.addClass(constraintClass);\r\n }\r\n }\r\n\r\n public async fromJSON(relationshipConstraintProps: RelationshipConstraintProps) {\r\n this.fromJSONSync(relationshipConstraintProps);\r\n }\r\n\r\n /**\r\n * Indicates if the provided [[ECClass]] is supported by this [[RelationshipConstraint]].\r\n * @param ecClass The class to check.\r\n */\r\n public async supportsClass(ecClass: ECClass): Promise<boolean> {\r\n if (!this.constraintClasses) {\r\n if (this.relationshipClass.baseClass) {\r\n const baseRelationship = await this.relationshipClass.baseClass as RelationshipClass;\r\n const baseConstraint = this.isSource ? baseRelationship.source : baseRelationship.target;\r\n return baseConstraint.supportsClass(ecClass);\r\n }\r\n return false;\r\n }\r\n\r\n if (ecClass.schemaItemType !== SchemaItemType.EntityClass && ecClass.schemaItemType !== SchemaItemType.RelationshipClass &&\r\n ecClass.schemaItemType !== SchemaItemType.Mixin) {\r\n return false;\r\n }\r\n\r\n const abstractConstraint = await this.abstractConstraint;\r\n\r\n if (abstractConstraint && await RelationshipConstraint.classCompatibleWithConstraint(abstractConstraint, ecClass, this.polymorphic || false))\r\n return true;\r\n\r\n for (const constraint of this.constraintClasses) {\r\n if (await RelationshipConstraint.classCompatibleWithConstraint(await constraint, ecClass, this.polymorphic || false))\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Indicates if an ECClass is of the type or applies to the type (if a mixin) of the ECClass specified by the constraintClass parameter.\r\n * @param constraintClass The ECClass that is a constraint class of a relationship.\r\n * @param testClass The ECClass to check against the constraint class.\r\n * @param isPolymorphic Indicates if the testClass should be checked polymorphically.\r\n */\r\n public static async classCompatibleWithConstraint(constraintClass: ECClass, testClass: ECClass, isPolymorphic: boolean): Promise<boolean> {\r\n if (SchemaItem.equalByKey(constraintClass, testClass))\r\n return true;\r\n\r\n if (isPolymorphic) {\r\n if (testClass.schemaItemType === SchemaItemType.EntityClass || testClass.schemaItemType === SchemaItemType.RelationshipClass) {\r\n return testClass.is(constraintClass);\r\n }\r\n\r\n if (testClass.schemaItemType === SchemaItemType.Mixin) {\r\n if (constraintClass.schemaItemType === SchemaItemType.EntityClass)\r\n return (testClass as Mixin).applicableTo(constraintClass as EntityClass);\r\n else\r\n return testClass.is(constraintClass);\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static isRelationshipConstraint(object: any): object is RelationshipConstraint {\r\n const relationshipConstrait = object as RelationshipConstraint;\r\n\r\n return relationshipConstrait !== undefined && relationshipConstrait.polymorphic !== undefined && relationshipConstrait.multiplicity !== undefined\r\n && relationshipConstrait.relationshipEnd !== undefined && relationshipConstrait._relationshipClass !== undefined;\r\n }\r\n\r\n protected addCustomAttribute(customAttribute: CustomAttribute) {\r\n if (!this._customAttributes)\r\n this._customAttributes = new Map<string, CustomAttribute>();\r\n\r\n this._customAttributes.set(customAttribute.className, customAttribute);\r\n }\r\n\r\n}\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\n * @internal\r\n */\r\nexport abstract class MutableRelationshipConstraint extends RelationshipConstraint {\r\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\r\n\r\n}\r\n\r\nconst INT32_MAX = 2147483647;\r\n\r\n/**\r\n * @beta\r\n */\r\nexport class RelationshipMultiplicity {\r\n public static readonly zeroOne = new RelationshipMultiplicity(0, 1);\r\n public static readonly zeroMany = new RelationshipMultiplicity(0, INT32_MAX);\r\n public static readonly oneOne = new RelationshipMultiplicity(1, 1);\r\n public static readonly oneMany = new RelationshipMultiplicity(1, INT32_MAX);\r\n\r\n public readonly lowerLimit: number;\r\n public readonly upperLimit: number;\r\n\r\n constructor(lowerLimit: number, upperLimit: number) {\r\n this.lowerLimit = lowerLimit;\r\n this.upperLimit = upperLimit;\r\n }\r\n\r\n public static fromString(str: string): RelationshipMultiplicity | undefined {\r\n const matches = /^\\(([0-9]*)\\.\\.([0-9]*|\\*)\\)$/.exec(str);\r\n if (matches === null || matches.length !== 3)\r\n return undefined;\r\n\r\n const lowerLimit = parseInt(matches[1], 10);\r\n const upperLimit = matches[2] === \"*\" ? INT32_MAX : parseInt(matches[2], 10);\r\n if (0 === lowerLimit && 1 === upperLimit)\r\n return RelationshipMultiplicity.zeroOne;\r\n else if (0 === lowerLimit && INT32_MAX === upperLimit)\r\n return RelationshipMultiplicity.zeroMany;\r\n else if (1 === lowerLimit && 1 === upperLimit)\r\n return RelationshipMultiplicity.oneOne;\r\n else if (1 === lowerLimit && INT32_MAX === upperLimit)\r\n return RelationshipMultiplicity.oneMany;\r\n\r\n return new RelationshipMultiplicity(lowerLimit, upperLimit);\r\n }\r\n\r\n public equals(rhs: RelationshipMultiplicity): boolean {\r\n return this.lowerLimit === rhs.lowerLimit && this.upperLimit === rhs.upperLimit;\r\n }\r\n\r\n public toString(): string {\r\n return `(${this.lowerLimit}..${this.upperLimit === INT32_MAX ? \"*\" : this.upperLimit})`;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableRelationshipClass extends RelationshipClass {\r\n public override get source() { return this._source as MutableRelationshipConstraint; }\r\n public override get target() { return this._target as MutableRelationshipConstraint; }\r\n public abstract override setStrength(strength: StrengthType): void;\r\n public abstract override setStrengthDirection(direction: StrengthDirection): void;\r\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\r\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
@@ -37,6 +37,7 @@ const SCHEMAURL3_2_XML = "http://www.bentley.com/schemas/Bentley.ECXML.3.2";
37
37
  * @beta
38
38
  */
39
39
  class Schema {
40
+ static { this._currentECSpecVersion = "3.2"; }
40
41
  /** @internal */
41
42
  constructor(context, nameOrKey, alias, readVer, writeVer, minorVer) {
42
43
  this._schemaKey = (typeof (nameOrKey) === "string") ? new SchemaKey_1.SchemaKey(nameOrKey, new SchemaKey_1.ECVersion(readVer, writeVer, minorVer)) : nameOrKey;
@@ -639,7 +640,6 @@ class Schema {
639
640
  }
640
641
  }
641
642
  exports.Schema = Schema;
642
- Schema._currentECSpecVersion = "3.2";
643
643
  /**
644
644
  * Hackish approach that works like a "friend class" so we can access protected members without making them public.
645
645
  * We cannot put this into Helper.ts and make it non-export, because we are importing Helper.ts from this file, and the circular import
@@ -1 +1 @@
1
- {"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../../src/Metadata/Schema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,sDAA4E;AAC5E,8DAA2D;AAE3D,4DAAyD;AACzD,oFAAiF;AAEjF,4CAA+D;AAE/D,4CAAmE;AACnE,sCAAmC;AACnC,mCAA+C;AAC/C,yCAAsC;AACtC,uDAAkI;AAClI,iEAA8D;AAC9D,+CAA4C;AAC5C,+CAA4C;AAC5C,qCAAkC;AAClC,iDAA8C;AAC9C,qDAAkD;AAClD,mCAAgC;AAChC,6CAA0C;AAC1C,yDAAsD;AACtD,2DAAwD;AACxD,6CAA0C;AAC1C,iCAA8B;AAC9B,6CAA0C;AAE1C,MAAM,iBAAiB,GAAG,qDAAqD,CAAC;AAChF,MAAM,gBAAgB,GAAG,kDAAkD,CAAC;AAE5E;;GAEG;AACH,MAAa,MAAM;IAkCjB,gBAAgB;IAChB,YAAY,OAAsB,EAAE,SAA8B,EAAE,KAAc,EAAE,OAAgB,EAAE,QAAiB,EAAE,QAAiB;QACxI,IAAI,CAAC,UAAU,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,qBAAS,CAAC,SAAS,EAAE,IAAI,qBAAS,CAAC,OAAiB,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CA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AA/tBgB,4BAAqB,GAAG,KAAK,CAAC;AAiuB/C;;;;;GAKG;AACH,MAAsB,aAAc,SAAQ,MAAM;CAuCjD;AAvCD,sCAuCC","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 { SchemaContext } from \"../Context\";\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\nimport { JsonParser } from \"../Deserialization/JsonParser\";\nimport { SchemaProps } from \"../Deserialization/JsonProps\";\nimport { XmlParser } from \"../Deserialization/XmlParser\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { ECClassModifier, PrimitiveType } from \"../ECObjects\";\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\nimport { AnyClass, AnySchemaItem, SchemaInfo } from \"../Interfaces\";\nimport { ECVersion, SchemaItemKey, SchemaKey } from \"../SchemaKey\";\nimport { ECName } from \"../ECName\";\nimport { ECClass, StructClass } from \"./Class\";\nimport { Constant } from \"./Constant\";\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\nimport { CustomAttributeClass } from \"./CustomAttributeClass\";\nimport { EntityClass } from \"./EntityClass\";\nimport { Enumeration } from \"./Enumeration\";\nimport { Format } from \"./Format\";\nimport { InvertedUnit } from \"./InvertedUnit\";\nimport { KindOfQuantity } from \"./KindOfQuantity\";\nimport { Mixin } from \"./Mixin\";\nimport { Phenomenon } from \"./Phenomenon\";\nimport { PropertyCategory } from \"./PropertyCategory\";\nimport { RelationshipClass } from \"./RelationshipClass\";\nimport { SchemaItem } from \"./SchemaItem\";\nimport { Unit } from \"./Unit\";\nimport { UnitSystem } from \"./UnitSystem\";\n\nconst SCHEMAURL3_2_JSON = \"https://dev.bentley.com/json_schemas/ec/32/ecschema\";\nconst SCHEMAURL3_2_XML = \"http://www.bentley.com/schemas/Bentley.ECXML.3.2\";\n\n/**\n * @beta\n */\nexport class Schema implements CustomAttributeContainerProps {\n private static _currentECSpecVersion = \"3.2\";\n private _context: SchemaContext;\n protected _schemaKey?: SchemaKey;\n protected _alias?: string;\n protected _label?: string;\n protected _description?: string;\n public readonly references: Schema[];\n private readonly _items: Map<string, SchemaItem>;\n private _customAttributes?: Map<string, CustomAttribute>;\n private _originalECSpecMajorVersion?: number;\n private _originalECSpecMinorVersion?: number;\n /**\n * Constructs an empty Schema with the given name and version in the provided context.\n * @param context The SchemaContext that will control the lifetime of the schema\n * @param name The schema's name\n * @param readVersion The integer read (major) version of the schema\n * @param writeVersion The integer write version of the schema\n * @param minorVersion The integer minor version of the schema\n */\n constructor(context: SchemaContext, name: string, alias: string, readVersion: number, writeVersion: number, minorVersion: number);\n /**\n * Constructs an empty Schema with the given key in the provided context.\n * @param context The SchemaContext that will control the lifetime of the schema\n * @param key A SchemaKey that uniquely identifies the schema\n */\n constructor(context: SchemaContext, key: SchemaKey, alias: string);\n /**\n * Constructs an empty Schema (without a SchemaKey) in the provided context.\n * This should only be used when the schema name and version will be deserialized (via `fromJson()`) immediately after this Schema is instantiated.\n * @param context The SchemaContext that will control the lifetime of the schema\n * @internal\n */\n constructor(context: SchemaContext);\n /** @internal */\n constructor(context: SchemaContext, nameOrKey?: SchemaKey | string, alias?: string, readVer?: number, writeVer?: number, minorVer?: number) {\n this._schemaKey = (typeof (nameOrKey) === \"string\") ? new SchemaKey(nameOrKey, new ECVersion(readVer as number, writeVer, minorVer)) : nameOrKey;\n this._context = context;\n this.references = [];\n this._items = new Map<string, SchemaItem>();\n\n if (alias !== undefined && ECName.validate(alias)) {\n this._alias = alias;\n } else if (nameOrKey !== undefined) {\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not have the required 'alias' attribute.`);\n }\n\n this._originalECSpecMajorVersion = Schema.currentECSpecMajorVersion;\n this._originalECSpecMinorVersion = Schema.currentECSpecMinorVersion;\n }\n\n public get schemaKey() {\n if (undefined === this._schemaKey)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\n return this._schemaKey;\n }\n\n public get name() {\n if (this._schemaKey === undefined)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\n return this.schemaKey.name;\n }\n\n public get readVersion() {\n if (this._schemaKey === undefined)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\n return this.schemaKey.readVersion;\n }\n\n public get writeVersion() {\n if (this._schemaKey === undefined)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\n return this.schemaKey.writeVersion;\n }\n\n public get minorVersion() {\n if (this._schemaKey === undefined)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\n return this.schemaKey.minorVersion;\n }\n\n public get originalECSpecMajorVersion() { return this._originalECSpecMajorVersion; }\n public get originalECSpecMinorVersion() { return this._originalECSpecMinorVersion; }\n public static get currentECSpecMajorVersion(): number { return parseInt(Schema._currentECSpecVersion.split(\".\")[0], 10); }\n public static get currentECSpecMinorVersion(): number { return parseInt(Schema._currentECSpecVersion.split(\".\")[1], 10); }\n\n public get alias() {\n if (this._alias === undefined || this._alias === null) {\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not have the required 'alias' attribute.`);\n } else { return this._alias; }\n }\n\n public get label() { return this._label; }\n\n public get description() { return this._description; }\n\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\n\n /** Returns the schema name. */\n public get fullName() { return this.schemaKey.name; }\n\n /** Returns the schema. */\n public get schema(): Schema { return this; }\n\n /** Returns the schema context this schema is within. */\n public get context(): SchemaContext { return this._context; }\n\n /**\n * Returns a SchemaItemKey given the item name and the schema it belongs to\n * @param fullName fully qualified name {Schema name}.{Item Name}\n */\n public getSchemaItemKey(fullName: string): SchemaItemKey {\n const [schemaName, itemName] = SchemaItem.parseFullName(fullName);\n let schemaKey = this.schemaKey;\n if (this.name !== schemaName) {\n const newSchemaRef = this.getReferenceSync(schemaName);\n if (undefined === newSchemaRef)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to find the referenced SchemaItem ${itemName}.`);\n schemaKey = newSchemaRef.schemaKey;\n }\n return new SchemaItemKey(itemName, schemaKey);\n }\n\n protected addItem<T extends SchemaItem>(item: T): void {\n if (undefined !== this.getItemSync(item.name))\n throw new ECObjectsError(ECObjectsStatus.DuplicateItem, `The SchemaItem ${item.name} cannot be added to the schema ${this.name} because it already exists`);\n\n this._items.set(item.name.toUpperCase(), item);\n }\n\n /**\n * @alpha\n */\n protected createClass<T extends AnyClass>(type: (new (_schema: Schema, _name: string, _modifier?: ECClassModifier) => T), name: string, modifier?: ECClassModifier): T {\n const item = new type(this, name, modifier);\n this.addItem(item);\n return item;\n }\n\n /**\n * Deletes a class from within this schema.\n * @param name the local (unqualified) class name, lookup is case-insensitive\n * @alpha\n */\n protected async deleteClass(name: string): Promise<void> {\n const schemaItem = await this.getItem(name);\n if (ECClass.isECClass(schemaItem)) {\n this._items.delete(name.toUpperCase());\n }\n }\n\n /**\n * Deletes a class from within this schema.\n * @param name the local (unqualified) class name, lookup is case-insensitive\n * @alpha\n */\n protected deleteClassSync(name: string): void {\n const schemaItem = this.getItemSync(name);\n if (ECClass.isECClass(schemaItem))\n this._items.delete(name.toUpperCase());\n }\n\n /**\n * Deletes a SchemaItem from within this schema.\n * @param name the local (unqualified) class name, lookup is case-insensitive\n * @alpha\n */\n protected async deleteSchemaItem(name: string): Promise<void> {\n const schemaItem = await this.getItem(name);\n if (SchemaItem.isSchemaItem(schemaItem)) {\n this._items.delete(name.toUpperCase());\n }\n }\n\n /**\n * Deletes a SchemaItem from within this schema.\n * @param name the local (unqualified) class name, lookup is case-insensitive\n * @alpha\n */\n protected deleteSchemaItemSync(name: string): void {\n const schemaItem = this.getItemSync(name);\n if (SchemaItem.isSchemaItem(schemaItem))\n this._items.delete(name.toUpperCase());\n }\n\n /**\n * @alpha\n */\n protected createItem<T extends AnySchemaItem>(type: (new (_schema: Schema, _name: string) => T), name: string): T {\n const item = new type(this, name);\n this.addItem(item);\n return item;\n }\n\n protected addCustomAttribute(customAttribute: CustomAttribute) {\n if (!this._customAttributes)\n this._customAttributes = new Map<string, CustomAttribute>();\n\n this._customAttributes.set(customAttribute.className, customAttribute);\n }\n\n /**\n * Creates a EntityClass with the provided name in this schema.\n * @param name\n * @param modifier\n */\n protected async createEntityClass(name: string, modifier?: ECClassModifier): Promise<EntityClass> {\n return this.createClass<EntityClass>(EntityClass, name, modifier);\n }\n\n protected createEntityClassSync(name: string, modifier?: ECClassModifier): EntityClass {\n return this.createClass<EntityClass>(EntityClass, name, modifier);\n }\n\n /**\n * Creates a Mixin with the provided name in this schema.\n * @param name\n */\n protected async createMixinClass(name: string): Promise<Mixin> { return this.createClass<Mixin>(Mixin, name); }\n protected createMixinClassSync(name: string): Mixin { return this.createClass<Mixin>(Mixin, name); }\n\n /**\n * Creates a StructClass with the provided name in this schema.\n * @param name\n * @param modifier\n */\n protected async createStructClass(name: string, modifier?: ECClassModifier): Promise<StructClass> {\n return this.createClass<StructClass>(StructClass, name, modifier);\n }\n\n protected createStructClassSync(name: string, modifier?: ECClassModifier): StructClass {\n return this.createClass<StructClass>(StructClass, name, modifier);\n }\n\n /**\n * Creates a CustomAttributeClass with the provided name in this schema.\n * @param name\n * @param modifier\n */\n protected async createCustomAttributeClass(name: string, modifier?: ECClassModifier): Promise<CustomAttributeClass> {\n return this.createClass<CustomAttributeClass>(CustomAttributeClass, name, modifier);\n }\n\n protected createCustomAttributeClassSync(name: string, modifier?: ECClassModifier): CustomAttributeClass {\n return this.createClass<CustomAttributeClass>(CustomAttributeClass, name, modifier);\n }\n\n /**\n * Creates a RelationshipClass with the provided name in this schema.\n * @param name\n * @param modifier\n */\n protected async createRelationshipClass(name: string, modifier?: ECClassModifier): Promise<RelationshipClass> {\n return this.createRelationshipClassSync(name, modifier);\n }\n\n protected createRelationshipClassSync(name: string, modifier?: ECClassModifier): RelationshipClass {\n return this.createClass<RelationshipClass>(RelationshipClass, name, modifier);\n }\n\n /**\n * Creates an Enumeration with the provided name in this schema.\n * @param name\n */\n protected async createEnumeration(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Promise<Enumeration> {\n return this.createEnumerationSync(name, primitiveType);\n }\n\n protected createEnumerationSync(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Enumeration {\n const item = new Enumeration(this, name, primitiveType);\n this.addItem(item);\n return item;\n }\n\n /**\n * Creates an KindOfQuantity with the provided name in this schema.\n * @param name\n */\n protected async createKindOfQuantity(name: string): Promise<KindOfQuantity> {\n return this.createKindOfQuantitySync(name);\n }\n\n protected createKindOfQuantitySync(name: string): KindOfQuantity {\n return this.createItem<KindOfQuantity>(KindOfQuantity, name);\n }\n\n /**\n * Creates a Constant with the provided name in this schema.\n * @param name\n */\n protected async createConstant(name: string): Promise<Constant> {\n return this.createItem<Constant>(Constant, name);\n }\n\n protected createConstantSync(name: string): Constant {\n return this.createItem<Constant>(Constant, name);\n }\n\n /**\n * Creates a Inverted Unit with the provided name in this schema.\n * @param name\n */\n protected async createInvertedUnit(name: string): Promise<InvertedUnit> {\n return this.createItem<InvertedUnit>(InvertedUnit, name);\n }\n\n protected createInvertedUnitSync(name: string): InvertedUnit {\n return this.createItem<InvertedUnit>(InvertedUnit, name);\n }\n\n /**\n * Creates an Format with the provided name in this schema.\n * @param name\n */\n protected async createFormat(name: string): Promise<Format> {\n return this.createItem<Format>(Format, name);\n }\n\n protected createFormatSync(name: string): Format {\n return this.createItem<Format>(Format, name);\n }\n\n /**\n * Creates a UnitSystem with the provided name in this schema.\n * @param name\n */\n protected async createUnitSystem(name: string): Promise<UnitSystem> {\n return this.createItem<UnitSystem>(UnitSystem, name);\n }\n\n protected createUnitSystemSync(name: string): UnitSystem {\n return this.createItem<UnitSystem>(UnitSystem, name);\n }\n\n /**\n * Creates a Phenomenon with the provided name in this schema.\n * @param name\n */\n protected async createPhenomenon(name: string): Promise<Phenomenon> {\n return this.createItem<Phenomenon>(Phenomenon, name);\n }\n\n protected createPhenomenonSync(name: string): Phenomenon {\n return this.createItem<Phenomenon>(Phenomenon, name);\n }\n\n /**\n * Creates a Unit with the provided name in this schema.\n * @param name\n */\n protected async createUnit(name: string): Promise<Unit> {\n return this.createItem<Unit>(Unit, name);\n }\n\n protected createUnitSync(name: string): Unit {\n return this.createItem<Unit>(Unit, name);\n }\n\n /**\n * Creates an PropertyCategory with the provided name in this schema.\n * @param name\n */\n protected async createPropertyCategory(name: string): Promise<PropertyCategory> {\n return this.createItem<PropertyCategory>(PropertyCategory, name);\n }\n\n protected createPropertyCategorySync(name: string): PropertyCategory {\n return this.createItem<PropertyCategory>(PropertyCategory, name);\n }\n /**\n *\n * @param refSchema\n */\n protected async addReference(refSchema: Schema): Promise<void> {\n // TODO validation of reference schema. For now just adding\n this.addReferenceSync(refSchema);\n }\n\n protected addReferenceSync(refSchema: Schema): void {\n this.references.push(refSchema);\n }\n\n /**\n * @alpha Used for schema editing.\n */\n protected setContext(context: SchemaContext): void {\n this._context = context;\n }\n\n /**\n * Sets the version of the SchemaKey identifying the schema.\n * @param readVersion The read version of the schema. If undefined, the value from the existing SchemaKey will be used.\n * @param writeVersion The write version of the schema. If undefined, the value from the existing SchemaKey will be used.\n * @param minorVersion The minor version of the schema. If undefined, the value from the existing SchemaKey will be used.\n */\n public setVersion(readVersion?: number, writeVersion?: number, minorVersion?: number): void {\n if (!this._schemaKey)\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaKey, `The schema '${this.name}' has an invalid SchemaKey.`);\n\n const newVersion = new ECVersion(readVersion ?? this._schemaKey.readVersion, writeVersion ?? this._schemaKey.writeVersion, minorVersion ?? this._schemaKey.minorVersion);\n this._schemaKey = new SchemaKey(this._schemaKey.name, newVersion);\n }\n\n /**\n * Gets an item from within this schema. To get by full name use lookupItem instead.\n * @param key the local (unqualified) name, lookup is case-insensitive\n */\n public async getItem<T extends SchemaItem>(name: string): Promise<T | undefined> {\n // this method exists so we can rewire it later when we load partial schemas, for now it is identical to the sync version\n return this.getItemSync<T>(name);\n }\n\n /**\n * Gets an item from within this schema. To get by full name use lookupItem instead.\n * @param key the local (unqualified) name, lookup is case-insensitive\n */\n public getItemSync<T extends SchemaItem>(name: string): T | undefined {\n // Case-insensitive search\n return this._items.get(name.toUpperCase()) as T;\n }\n\n /**\n * Attempts to find a schema item within this schema or a (directly) referenced schema\n * @param key The full name or a SchemaItemKey identifying the desired item.\n */\n public async lookupItem<T extends SchemaItem>(key: Readonly<SchemaItemKey> | string): Promise<T | undefined> {\n let schemaName, itemName: string;\n if (typeof (key) === \"string\") {\n [schemaName, itemName] = SchemaItem.parseFullName(key);\n } else {\n itemName = key.name;\n schemaName = key.schemaName;\n }\n\n if (!schemaName || schemaName.toUpperCase() === this.name.toUpperCase()) {\n return this.getItem<T>(itemName);\n }\n\n const refSchema = await this.getReference(schemaName);\n if (!refSchema)\n return undefined;\n\n return refSchema.getItem<T>(itemName);\n }\n\n /**\n * Attempts to find a schema item within this schema or a (directly) referenced schema\n * @param key The full name or a SchemaItemKey identifying the desired item.\n */\n public lookupItemSync<T extends SchemaItem>(key: Readonly<SchemaItemKey> | string): T | undefined {\n let schemaName, itemName: string;\n if (typeof (key) === \"string\") {\n [schemaName, itemName] = SchemaItem.parseFullName(key);\n } else {\n itemName = key.name;\n schemaName = key.schemaName;\n }\n\n if (!schemaName || schemaName.toUpperCase() === this.name.toUpperCase()) {\n return this.getItemSync<T>(itemName);\n }\n\n const refSchema = this.getReferenceSync(schemaName);\n if (!refSchema)\n return undefined;\n\n return refSchema.getItemSync<T>(itemName);\n }\n\n public getItems<T extends AnySchemaItem>(): IterableIterator<T> {\n if (!this._items)\n return new Map<string, SchemaItem>().values() as IterableIterator<T>;\n\n return this._items.values() as IterableIterator<T>;\n }\n\n public *getClasses(): IterableIterator<ECClass> {\n for (const [, value] of this._items) {\n if (ECClass.isECClass(value))\n yield value;\n }\n }\n\n public async getReference<T extends Schema>(refSchemaName: string): Promise<T | undefined> {\n if (this.references.length === 0)\n return undefined;\n\n return this.references.find((ref) => ref.name.toLowerCase() === refSchemaName.toLowerCase()) as T;\n }\n\n public getReferenceNameByAlias(alias: string): string | undefined {\n if (this.references.length === 0)\n return undefined;\n\n const schema = this.references.find((ref) => ref.alias ? ref.alias.toLowerCase() === alias.toLowerCase() : false);\n return schema ? schema.name : undefined;\n }\n\n public getReferenceSync<T extends Schema>(refSchemaName: string): T | undefined {\n if (this.references.length === 0)\n return undefined;\n\n return this.references.find((ref) => ref.name.toLowerCase() === refSchemaName.toLowerCase()) as T;\n }\n\n /**\n * Save this Schema's properties to an object for serializing to JSON.\n */\n public toJSON(): SchemaProps {\n if (!this.isECSpecVersionSupported())\n throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECSpecVersion and cannot be serialized.`);\n\n const schemaJson: { [value: string]: any } = {};\n schemaJson.$schema = SCHEMAURL3_2_JSON; // $schema is required\n schemaJson.name = this.name; // name is required\n schemaJson.version = this.schemaKey.version.toString(true);\n schemaJson.alias = this.alias; // alias is required\n if (undefined !== this.label) // label is optional\n schemaJson.label = this.label;\n if (undefined !== this.description) // description is optional\n schemaJson.description = this.description;\n if (undefined !== this.references && this.references.length > 0) // references is optional\n schemaJson.references = this.references.map(({ name, schemaKey }) => ({ name, version: schemaKey.version.toString() }));\n\n const customAttributes = serializeCustomAttributes(this.customAttributes);\n if (undefined !== customAttributes)\n schemaJson.customAttributes = customAttributes;\n if (this._items.size > 0) {\n schemaJson.items = {};\n this._items.forEach((schemaItem: SchemaItem) => {\n schemaJson.items[schemaItem.name] = schemaItem.toJSON(false, true);\n });\n }\n return schemaJson as SchemaProps;\n }\n\n /**\n * Converts the schema to a DOM XML Document.\n * @param schemaXml An empty DOM document to which the schema will be written\n */\n public async toXml(schemaXml: Document): Promise<Document> {\n if (!this.isECSpecVersionSupported())\n throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECSpecVersion and cannot be serialized.`);\n\n const schemaMetadata = schemaXml.createElement(\"ECSchema\");\n schemaMetadata.setAttribute(\"xmlns\", SCHEMAURL3_2_XML);\n schemaMetadata.setAttribute(\"version\", this.schemaKey.version.toString());\n schemaMetadata.setAttribute(\"schemaName\", this.name);\n schemaMetadata.setAttribute(\"alias\", this.alias ? this.alias : \"\");\n if (undefined !== this.label)\n schemaMetadata.setAttribute(\"displayLabel\", this.label);\n if (undefined !== this.description)\n schemaMetadata.setAttribute(\"description\", this.description);\n\n // Map used for CA serialization\n const refSchemaMap = new Map<string, string>();\n\n this.references.forEach(({ name, schemaKey, alias }) => {\n const schemaRef = schemaXml.createElement(\"ECSchemaReference\");\n schemaRef.setAttribute(\"name\", name);\n schemaRef.setAttribute(\"version\", schemaKey.version.toString());\n schemaRef.setAttribute(\"alias\", alias ? alias : \"\");\n schemaMetadata.appendChild(schemaRef);\n refSchemaMap.set(name, schemaKey.version.toString());\n });\n\n if (this._customAttributes) {\n const parentElem = schemaXml.createElement(\"ECCustomAttributes\");\n for (const [name, attribute] of this._customAttributes) {\n const caElem = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this);\n parentElem.appendChild(caElem);\n }\n schemaMetadata.appendChild(parentElem);\n }\n\n for (const [, item] of this._items) {\n const itemXml = await item.toXml(schemaXml);\n schemaMetadata.appendChild(itemXml);\n }\n\n schemaXml.appendChild(schemaMetadata);\n return schemaXml;\n }\n\n // Check if the ECSpecVersion read-version is greater than the current ECSpecVersion supported.\n // If a specific ECSpecVersion is given, check against that version.\n // If no argument is given, check against the original ECSpecVersion of the schema.\n private isECSpecMajorVersionSupported(ecSpecMajorVersionToCheck?: number): boolean {\n // If argument is supplied, check the argument against the current ECSpecVersion supported\n if (ecSpecMajorVersionToCheck !== undefined)\n return (Schema.currentECSpecMajorVersion >= ecSpecMajorVersionToCheck);\n\n // If argument is not supplied, check against the original ECSpecVersion of the schema\n if (this.originalECSpecMajorVersion === undefined)\n return false;\n return (Schema.currentECSpecMajorVersion >= this.originalECSpecMajorVersion);\n }\n\n // Check if the full ECSpecVersion is greater than the current ECSpecVersion supported.\n // If a specific ECSpecVersion is given, check against that version.\n // If no argument is given, check against the original ECSpecVersion of the schema.\n private isECSpecVersionSupported(ecSpecMajorVersionToCheck?: number, ecSpecMinorVersionToCheck?: number): boolean {\n // If arguments are supplied, check the arguments against the current ECSpecVersion supported\n if (ecSpecMajorVersionToCheck !== undefined && ecSpecMinorVersionToCheck !== undefined) {\n if (!this.isECSpecMajorVersionSupported(ecSpecMajorVersionToCheck))\n return false;\n return (Schema.currentECSpecMinorVersion >= ecSpecMinorVersionToCheck);\n }\n // If arguments are not supplied, check against the original ECSpecVersion of the schema\n if (!this.isECSpecMajorVersionSupported() || this.originalECSpecMinorVersion === undefined)\n return false;\n return (Schema.currentECSpecMinorVersion >= this.originalECSpecMinorVersion);\n }\n\n /**\n * Loads the schema header (name, version alias, label and description) from the input SchemaProps\n */\n public fromJSONSync(schemaProps: SchemaProps) {\n if (undefined === this._schemaKey) {\n const schemaName = schemaProps.name;\n const version = ECVersion.fromString(schemaProps.version);\n this._schemaKey = new SchemaKey(schemaName, version);\n } else {\n if (schemaProps.name.toLowerCase() !== this.name.toLowerCase())\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not match the provided name, '${schemaProps.name}'.`);\n if (this.schemaKey.version.compare(ECVersion.fromString(schemaProps.version)))\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} has the version '${this.schemaKey.version}' that does not match the provided version '${schemaProps.version}'.`);\n }\n\n if (schemaProps.$schema.match(`https://dev\\\\.bentley\\\\.com/json_schemas/ec/([0-9]+)/ecschema`) == null && schemaProps.$schema.match(`http://www\\\\.bentley\\\\.com/schemas/Bentley\\\\.ECXML\\\\.([0-9]+)`) == null)\n throw new ECObjectsError(ECObjectsStatus.MissingSchemaUrl, `The Schema '${this.name}' has an unsupported namespace '${schemaProps.$schema}'.`);\n\n // The schema props have not been parsed. Parse the ECXml version from the $schema attribute\n let ecVersion: ECSpecVersion;\n if (schemaProps.ecSpecMajorVersion === undefined || schemaProps.ecSpecMinorVersion === undefined) {\n ecVersion = ((schemaProps.$schema.search(\"ECXML\") !== -1) ? XmlParser.parseXmlNamespace(schemaProps.$schema) : JsonParser.parseJSUri(schemaProps.$schema)) as ECSpecVersion;\n } else {\n ecVersion = { readVersion: schemaProps.ecSpecMajorVersion, writeVersion: schemaProps.ecSpecMinorVersion } as ECSpecVersion;\n }\n\n this._originalECSpecMajorVersion = ecVersion?.readVersion;\n this._originalECSpecMinorVersion = ecVersion?.writeVersion;\n\n if (!this.isECSpecMajorVersionSupported(ecVersion?.readVersion))\n throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECVersion and cannot be loaded.`);\n\n if (ECName.validate(schemaProps.alias)) {\n this._alias = schemaProps.alias;\n } else {\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${schemaProps.name} does not have the required 'alias' attribute.`);\n }\n\n if (undefined !== schemaProps.label)\n this._label = schemaProps.label;\n\n if (undefined !== schemaProps.description)\n this._description = schemaProps.description;\n }\n\n /**\n * Loads the schema header (name, version alias, label and description) from the input SchemaProps\n */\n public async fromJSON(schemaProps: SchemaProps) {\n this.fromJSONSync(schemaProps);\n }\n\n /**\n * Completely loads the SchemaInfo from the input json and starts loading the entire schema. The complete schema can be retrieved from the\n * schema context using the getCachedSchema method\n */\n public static async startLoadingFromJson(jsonObj: object | string, context: SchemaContext): Promise<SchemaInfo> {\n const schema = new Schema(context);\n\n const reader = new SchemaReadHelper(JsonParser, context);\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\n return reader.readSchemaInfo(schema, rawSchema);\n }\n\n public static async fromJson(jsonObj: object | string, context: SchemaContext): Promise<Schema> {\n let schema: Schema = new Schema(context);\n\n const reader = new SchemaReadHelper(JsonParser, context);\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\n schema = await reader.readSchema(schema, rawSchema);\n\n return schema;\n }\n\n /**\n * Completely loads the Schema from the input json. The schema is cached in the schema context.\n */\n public static fromJsonSync(jsonObj: object | string, context: SchemaContext): Schema {\n let schema: Schema = new Schema(context);\n\n const reader = new SchemaReadHelper(JsonParser, context);\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\n schema = reader.readSchemaSync(schema, rawSchema);\n\n return schema;\n }\n\n /**\n * @internal\n */\n public static isSchema(object: any): object is Schema {\n const schema = object as Schema;\n\n return schema !== undefined && schema.schemaKey !== undefined && schema.context !== undefined;\n }\n\n /**\n * @alpha\n * Used for schema editing.\n */\n protected setDisplayLabel(displayLabel: string) {\n this._label = displayLabel;\n }\n\n /**\n * @alpha\n * Used for schema editing.\n */\n protected setDescription(description: string) {\n this._description = description;\n }\n\n /**\n * @alpha\n * Used for schema editing.\n */\n protected setAlias(alias: string) {\n if (!ECName.validate(alias)) {\n throw new ECObjectsError(ECObjectsStatus.InvalidECName, \"The specified schema alias is invalid.\");\n }\n this._alias = alias;\n }\n}\n\n/**\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\n * We cannot put this into Helper.ts and make it non-export, because we are importing Helper.ts from this file, and the circular import\n * would prevent this class from extending Schema.\n * @internal\n */\nexport abstract class MutableSchema extends Schema {\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\n public abstract override createEntityClass(name: string, modifier?: ECClassModifier): Promise<EntityClass>;\n public abstract override createEntityClassSync(name: string, modifier?: ECClassModifier): EntityClass;\n public abstract override createMixinClass(name: string): Promise<Mixin>;\n public abstract override createMixinClassSync(name: string): Mixin;\n public abstract override createStructClass(name: string, modifier?: ECClassModifier): Promise<StructClass>;\n public abstract override createStructClassSync(name: string, modifier?: ECClassModifier): StructClass;\n public abstract override createCustomAttributeClass(name: string, modifier?: ECClassModifier): Promise<CustomAttributeClass>;\n public abstract override createCustomAttributeClassSync(name: string, modifier?: ECClassModifier): CustomAttributeClass;\n public abstract override createRelationshipClass(name: string, modifier?: ECClassModifier): Promise<RelationshipClass>;\n public abstract override createRelationshipClassSync(name: string, modifier?: ECClassModifier): RelationshipClass;\n public abstract override createEnumeration(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Promise<Enumeration>;\n public abstract override createEnumerationSync(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Enumeration;\n public abstract override createKindOfQuantity(name: string): Promise<KindOfQuantity>;\n public abstract override createKindOfQuantitySync(name: string): KindOfQuantity;\n public abstract override createUnit(name: string): Promise<Unit>;\n public abstract override createUnitSync(name: string): Unit;\n public abstract override createConstant(name: string): Promise<Constant>;\n public abstract override createConstantSync(name: string): Constant;\n public abstract override createInvertedUnit(name: string): Promise<InvertedUnit>;\n public abstract override createInvertedUnitSync(name: string): InvertedUnit;\n public abstract override createPhenomenon(name: string): Promise<Phenomenon>;\n public abstract override createPhenomenonSync(name: string): Phenomenon;\n public abstract override createFormat(name: string): Promise<Format>;\n public abstract override createFormatSync(name: string): Format;\n public abstract override createUnitSystem(name: string): Promise<UnitSystem>;\n public abstract override createUnitSystemSync(name: string): UnitSystem;\n public abstract override createPropertyCategory(name: string): Promise<PropertyCategory>;\n public abstract override createPropertyCategorySync(name: string): PropertyCategory;\n public abstract override addItem<T extends SchemaItem>(item: T): void;\n public abstract override addReference(refSchema: Schema): Promise<void>;\n public abstract override addReferenceSync(refSchema: Schema): void;\n public abstract override setContext(schemaContext: SchemaContext): void;\n public abstract override deleteClass(name: string): Promise<void>;\n public abstract override deleteClassSync(name: string): void;\n public abstract override deleteSchemaItem(name: string): Promise<void>;\n public abstract override deleteSchemaItemSync(name: string): void;\n public abstract override set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EAAE,OAAO,CAAC,CAAC;QACzD,MAAM,SAAS,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAC9E,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAElD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,QAAQ,CAAC,MAAW;QAChC,MAAM,MAAM,GAAG,MAAgB,CAAC;QAEhC,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,CAAC;IAChG,CAAC;IAED;;;OAGG;IACO,eAAe,CAAC,YAAoB;QAC5C,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,WAAmB;QAC1C,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IAED;;;OAGG;IACO,QAAQ,CAAC,KAAa;QAC9B,IAAI,CAAC,eAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,0BAAc,CAAC,2BAAe,CAAC,aAAa,EAAE,wCAAwC,CAAC,CAAC;QACpG,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;;AA/tBH,wBAguBC;AAED;;;;;GAKG;AACH,MAAsB,aAAc,SAAQ,MAAM;CAuCjD;AAvCD,sCAuCC","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 { SchemaContext } from \"../Context\";\r\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\r\nimport { JsonParser } from \"../Deserialization/JsonParser\";\r\nimport { SchemaProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlParser } from \"../Deserialization/XmlParser\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { ECClassModifier, PrimitiveType } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { AnyClass, AnySchemaItem, SchemaInfo } from \"../Interfaces\";\r\nimport { ECVersion, SchemaItemKey, SchemaKey } from \"../SchemaKey\";\r\nimport { ECName } from \"../ECName\";\r\nimport { ECClass, StructClass } from \"./Class\";\r\nimport { Constant } from \"./Constant\";\r\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\r\nimport { CustomAttributeClass } from \"./CustomAttributeClass\";\r\nimport { EntityClass } from \"./EntityClass\";\r\nimport { Enumeration } from \"./Enumeration\";\r\nimport { Format } from \"./Format\";\r\nimport { InvertedUnit } from \"./InvertedUnit\";\r\nimport { KindOfQuantity } from \"./KindOfQuantity\";\r\nimport { Mixin } from \"./Mixin\";\r\nimport { Phenomenon } from \"./Phenomenon\";\r\nimport { PropertyCategory } from \"./PropertyCategory\";\r\nimport { RelationshipClass } from \"./RelationshipClass\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\nimport { Unit } from \"./Unit\";\r\nimport { UnitSystem } from \"./UnitSystem\";\r\n\r\nconst SCHEMAURL3_2_JSON = \"https://dev.bentley.com/json_schemas/ec/32/ecschema\";\r\nconst SCHEMAURL3_2_XML = \"http://www.bentley.com/schemas/Bentley.ECXML.3.2\";\r\n\r\n/**\r\n * @beta\r\n */\r\nexport class Schema implements CustomAttributeContainerProps {\r\n private static _currentECSpecVersion = \"3.2\";\r\n private _context: SchemaContext;\r\n protected _schemaKey?: SchemaKey;\r\n protected _alias?: string;\r\n protected _label?: string;\r\n protected _description?: string;\r\n public readonly references: Schema[];\r\n private readonly _items: Map<string, SchemaItem>;\r\n private _customAttributes?: Map<string, CustomAttribute>;\r\n private _originalECSpecMajorVersion?: number;\r\n private _originalECSpecMinorVersion?: number;\r\n /**\r\n * Constructs an empty Schema with the given name and version in the provided context.\r\n * @param context The SchemaContext that will control the lifetime of the schema\r\n * @param name The schema's name\r\n * @param readVersion The integer read (major) version of the schema\r\n * @param writeVersion The integer write version of the schema\r\n * @param minorVersion The integer minor version of the schema\r\n */\r\n constructor(context: SchemaContext, name: string, alias: string, readVersion: number, writeVersion: number, minorVersion: number);\r\n /**\r\n * Constructs an empty Schema with the given key in the provided context.\r\n * @param context The SchemaContext that will control the lifetime of the schema\r\n * @param key A SchemaKey that uniquely identifies the schema\r\n */\r\n constructor(context: SchemaContext, key: SchemaKey, alias: string);\r\n /**\r\n * Constructs an empty Schema (without a SchemaKey) in the provided context.\r\n * This should only be used when the schema name and version will be deserialized (via `fromJson()`) immediately after this Schema is instantiated.\r\n * @param context The SchemaContext that will control the lifetime of the schema\r\n * @internal\r\n */\r\n constructor(context: SchemaContext);\r\n /** @internal */\r\n constructor(context: SchemaContext, nameOrKey?: SchemaKey | string, alias?: string, readVer?: number, writeVer?: number, minorVer?: number) {\r\n this._schemaKey = (typeof (nameOrKey) === \"string\") ? new SchemaKey(nameOrKey, new ECVersion(readVer as number, writeVer, minorVer)) : nameOrKey;\r\n this._context = context;\r\n this.references = [];\r\n this._items = new Map<string, SchemaItem>();\r\n\r\n if (alias !== undefined && ECName.validate(alias)) {\r\n this._alias = alias;\r\n } else if (nameOrKey !== undefined) {\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not have the required 'alias' attribute.`);\r\n }\r\n\r\n this._originalECSpecMajorVersion = Schema.currentECSpecMajorVersion;\r\n this._originalECSpecMinorVersion = Schema.currentECSpecMinorVersion;\r\n }\r\n\r\n public get schemaKey() {\r\n if (undefined === this._schemaKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\r\n return this._schemaKey;\r\n }\r\n\r\n public get name() {\r\n if (this._schemaKey === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\r\n return this.schemaKey.name;\r\n }\r\n\r\n public get readVersion() {\r\n if (this._schemaKey === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\r\n return this.schemaKey.readVersion;\r\n }\r\n\r\n public get writeVersion() {\r\n if (this._schemaKey === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\r\n return this.schemaKey.writeVersion;\r\n }\r\n\r\n public get minorVersion() {\r\n if (this._schemaKey === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\r\n return this.schemaKey.minorVersion;\r\n }\r\n\r\n public get originalECSpecMajorVersion() { return this._originalECSpecMajorVersion; }\r\n public get originalECSpecMinorVersion() { return this._originalECSpecMinorVersion; }\r\n public static get currentECSpecMajorVersion(): number { return parseInt(Schema._currentECSpecVersion.split(\".\")[0], 10); }\r\n public static get currentECSpecMinorVersion(): number { return parseInt(Schema._currentECSpecVersion.split(\".\")[1], 10); }\r\n\r\n public get alias() {\r\n if (this._alias === undefined || this._alias === null) {\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not have the required 'alias' attribute.`);\r\n } else { return this._alias; }\r\n }\r\n\r\n public get label() { return this._label; }\r\n\r\n public get description() { return this._description; }\r\n\r\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\r\n\r\n /** Returns the schema name. */\r\n public get fullName() { return this.schemaKey.name; }\r\n\r\n /** Returns the schema. */\r\n public get schema(): Schema { return this; }\r\n\r\n /** Returns the schema context this schema is within. */\r\n public get context(): SchemaContext { return this._context; }\r\n\r\n /**\r\n * Returns a SchemaItemKey given the item name and the schema it belongs to\r\n * @param fullName fully qualified name {Schema name}.{Item Name}\r\n */\r\n public getSchemaItemKey(fullName: string): SchemaItemKey {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(fullName);\r\n let schemaKey = this.schemaKey;\r\n if (this.name !== schemaName) {\r\n const newSchemaRef = this.getReferenceSync(schemaName);\r\n if (undefined === newSchemaRef)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to find the referenced SchemaItem ${itemName}.`);\r\n schemaKey = newSchemaRef.schemaKey;\r\n }\r\n return new SchemaItemKey(itemName, schemaKey);\r\n }\r\n\r\n protected addItem<T extends SchemaItem>(item: T): void {\r\n if (undefined !== this.getItemSync(item.name))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateItem, `The SchemaItem ${item.name} cannot be added to the schema ${this.name} because it already exists`);\r\n\r\n this._items.set(item.name.toUpperCase(), item);\r\n }\r\n\r\n /**\r\n * @alpha\r\n */\r\n protected createClass<T extends AnyClass>(type: (new (_schema: Schema, _name: string, _modifier?: ECClassModifier) => T), name: string, modifier?: ECClassModifier): T {\r\n const item = new type(this, name, modifier);\r\n this.addItem(item);\r\n return item;\r\n }\r\n\r\n /**\r\n * Deletes a class from within this schema.\r\n * @param name the local (unqualified) class name, lookup is case-insensitive\r\n * @alpha\r\n */\r\n protected async deleteClass(name: string): Promise<void> {\r\n const schemaItem = await this.getItem(name);\r\n if (ECClass.isECClass(schemaItem)) {\r\n this._items.delete(name.toUpperCase());\r\n }\r\n }\r\n\r\n /**\r\n * Deletes a class from within this schema.\r\n * @param name the local (unqualified) class name, lookup is case-insensitive\r\n * @alpha\r\n */\r\n protected deleteClassSync(name: string): void {\r\n const schemaItem = this.getItemSync(name);\r\n if (ECClass.isECClass(schemaItem))\r\n this._items.delete(name.toUpperCase());\r\n }\r\n\r\n /**\r\n * Deletes a SchemaItem from within this schema.\r\n * @param name the local (unqualified) class name, lookup is case-insensitive\r\n * @alpha\r\n */\r\n protected async deleteSchemaItem(name: string): Promise<void> {\r\n const schemaItem = await this.getItem(name);\r\n if (SchemaItem.isSchemaItem(schemaItem)) {\r\n this._items.delete(name.toUpperCase());\r\n }\r\n }\r\n\r\n /**\r\n * Deletes a SchemaItem from within this schema.\r\n * @param name the local (unqualified) class name, lookup is case-insensitive\r\n * @alpha\r\n */\r\n protected deleteSchemaItemSync(name: string): void {\r\n const schemaItem = this.getItemSync(name);\r\n if (SchemaItem.isSchemaItem(schemaItem))\r\n this._items.delete(name.toUpperCase());\r\n }\r\n\r\n /**\r\n * @alpha\r\n */\r\n protected createItem<T extends AnySchemaItem>(type: (new (_schema: Schema, _name: string) => T), name: string): T {\r\n const item = new type(this, name);\r\n this.addItem(item);\r\n return item;\r\n }\r\n\r\n protected addCustomAttribute(customAttribute: CustomAttribute) {\r\n if (!this._customAttributes)\r\n this._customAttributes = new Map<string, CustomAttribute>();\r\n\r\n this._customAttributes.set(customAttribute.className, customAttribute);\r\n }\r\n\r\n /**\r\n * Creates a EntityClass with the provided name in this schema.\r\n * @param name\r\n * @param modifier\r\n */\r\n protected async createEntityClass(name: string, modifier?: ECClassModifier): Promise<EntityClass> {\r\n return this.createClass<EntityClass>(EntityClass, name, modifier);\r\n }\r\n\r\n protected createEntityClassSync(name: string, modifier?: ECClassModifier): EntityClass {\r\n return this.createClass<EntityClass>(EntityClass, name, modifier);\r\n }\r\n\r\n /**\r\n * Creates a Mixin with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createMixinClass(name: string): Promise<Mixin> { return this.createClass<Mixin>(Mixin, name); }\r\n protected createMixinClassSync(name: string): Mixin { return this.createClass<Mixin>(Mixin, name); }\r\n\r\n /**\r\n * Creates a StructClass with the provided name in this schema.\r\n * @param name\r\n * @param modifier\r\n */\r\n protected async createStructClass(name: string, modifier?: ECClassModifier): Promise<StructClass> {\r\n return this.createClass<StructClass>(StructClass, name, modifier);\r\n }\r\n\r\n protected createStructClassSync(name: string, modifier?: ECClassModifier): StructClass {\r\n return this.createClass<StructClass>(StructClass, name, modifier);\r\n }\r\n\r\n /**\r\n * Creates a CustomAttributeClass with the provided name in this schema.\r\n * @param name\r\n * @param modifier\r\n */\r\n protected async createCustomAttributeClass(name: string, modifier?: ECClassModifier): Promise<CustomAttributeClass> {\r\n return this.createClass<CustomAttributeClass>(CustomAttributeClass, name, modifier);\r\n }\r\n\r\n protected createCustomAttributeClassSync(name: string, modifier?: ECClassModifier): CustomAttributeClass {\r\n return this.createClass<CustomAttributeClass>(CustomAttributeClass, name, modifier);\r\n }\r\n\r\n /**\r\n * Creates a RelationshipClass with the provided name in this schema.\r\n * @param name\r\n * @param modifier\r\n */\r\n protected async createRelationshipClass(name: string, modifier?: ECClassModifier): Promise<RelationshipClass> {\r\n return this.createRelationshipClassSync(name, modifier);\r\n }\r\n\r\n protected createRelationshipClassSync(name: string, modifier?: ECClassModifier): RelationshipClass {\r\n return this.createClass<RelationshipClass>(RelationshipClass, name, modifier);\r\n }\r\n\r\n /**\r\n * Creates an Enumeration with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createEnumeration(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Promise<Enumeration> {\r\n return this.createEnumerationSync(name, primitiveType);\r\n }\r\n\r\n protected createEnumerationSync(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Enumeration {\r\n const item = new Enumeration(this, name, primitiveType);\r\n this.addItem(item);\r\n return item;\r\n }\r\n\r\n /**\r\n * Creates an KindOfQuantity with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createKindOfQuantity(name: string): Promise<KindOfQuantity> {\r\n return this.createKindOfQuantitySync(name);\r\n }\r\n\r\n protected createKindOfQuantitySync(name: string): KindOfQuantity {\r\n return this.createItem<KindOfQuantity>(KindOfQuantity, name);\r\n }\r\n\r\n /**\r\n * Creates a Constant with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createConstant(name: string): Promise<Constant> {\r\n return this.createItem<Constant>(Constant, name);\r\n }\r\n\r\n protected createConstantSync(name: string): Constant {\r\n return this.createItem<Constant>(Constant, name);\r\n }\r\n\r\n /**\r\n * Creates a Inverted Unit with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createInvertedUnit(name: string): Promise<InvertedUnit> {\r\n return this.createItem<InvertedUnit>(InvertedUnit, name);\r\n }\r\n\r\n protected createInvertedUnitSync(name: string): InvertedUnit {\r\n return this.createItem<InvertedUnit>(InvertedUnit, name);\r\n }\r\n\r\n /**\r\n * Creates an Format with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createFormat(name: string): Promise<Format> {\r\n return this.createItem<Format>(Format, name);\r\n }\r\n\r\n protected createFormatSync(name: string): Format {\r\n return this.createItem<Format>(Format, name);\r\n }\r\n\r\n /**\r\n * Creates a UnitSystem with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createUnitSystem(name: string): Promise<UnitSystem> {\r\n return this.createItem<UnitSystem>(UnitSystem, name);\r\n }\r\n\r\n protected createUnitSystemSync(name: string): UnitSystem {\r\n return this.createItem<UnitSystem>(UnitSystem, name);\r\n }\r\n\r\n /**\r\n * Creates a Phenomenon with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createPhenomenon(name: string): Promise<Phenomenon> {\r\n return this.createItem<Phenomenon>(Phenomenon, name);\r\n }\r\n\r\n protected createPhenomenonSync(name: string): Phenomenon {\r\n return this.createItem<Phenomenon>(Phenomenon, name);\r\n }\r\n\r\n /**\r\n * Creates a Unit with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createUnit(name: string): Promise<Unit> {\r\n return this.createItem<Unit>(Unit, name);\r\n }\r\n\r\n protected createUnitSync(name: string): Unit {\r\n return this.createItem<Unit>(Unit, name);\r\n }\r\n\r\n /**\r\n * Creates an PropertyCategory with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createPropertyCategory(name: string): Promise<PropertyCategory> {\r\n return this.createItem<PropertyCategory>(PropertyCategory, name);\r\n }\r\n\r\n protected createPropertyCategorySync(name: string): PropertyCategory {\r\n return this.createItem<PropertyCategory>(PropertyCategory, name);\r\n }\r\n /**\r\n *\r\n * @param refSchema\r\n */\r\n protected async addReference(refSchema: Schema): Promise<void> {\r\n // TODO validation of reference schema. For now just adding\r\n this.addReferenceSync(refSchema);\r\n }\r\n\r\n protected addReferenceSync(refSchema: Schema): void {\r\n this.references.push(refSchema);\r\n }\r\n\r\n /**\r\n * @alpha Used for schema editing.\r\n */\r\n protected setContext(context: SchemaContext): void {\r\n this._context = context;\r\n }\r\n\r\n /**\r\n * Sets the version of the SchemaKey identifying the schema.\r\n * @param readVersion The read version of the schema. If undefined, the value from the existing SchemaKey will be used.\r\n * @param writeVersion The write version of the schema. If undefined, the value from the existing SchemaKey will be used.\r\n * @param minorVersion The minor version of the schema. If undefined, the value from the existing SchemaKey will be used.\r\n */\r\n public setVersion(readVersion?: number, writeVersion?: number, minorVersion?: number): void {\r\n if (!this._schemaKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaKey, `The schema '${this.name}' has an invalid SchemaKey.`);\r\n\r\n const newVersion = new ECVersion(readVersion ?? this._schemaKey.readVersion, writeVersion ?? this._schemaKey.writeVersion, minorVersion ?? this._schemaKey.minorVersion);\r\n this._schemaKey = new SchemaKey(this._schemaKey.name, newVersion);\r\n }\r\n\r\n /**\r\n * Gets an item from within this schema. To get by full name use lookupItem instead.\r\n * @param key the local (unqualified) name, lookup is case-insensitive\r\n */\r\n public async getItem<T extends SchemaItem>(name: string): Promise<T | undefined> {\r\n // this method exists so we can rewire it later when we load partial schemas, for now it is identical to the sync version\r\n return this.getItemSync<T>(name);\r\n }\r\n\r\n /**\r\n * Gets an item from within this schema. To get by full name use lookupItem instead.\r\n * @param key the local (unqualified) name, lookup is case-insensitive\r\n */\r\n public getItemSync<T extends SchemaItem>(name: string): T | undefined {\r\n // Case-insensitive search\r\n return this._items.get(name.toUpperCase()) as T;\r\n }\r\n\r\n /**\r\n * Attempts to find a schema item within this schema or a (directly) referenced schema\r\n * @param key The full name or a SchemaItemKey identifying the desired item.\r\n */\r\n public async lookupItem<T extends SchemaItem>(key: Readonly<SchemaItemKey> | string): Promise<T | undefined> {\r\n let schemaName, itemName: string;\r\n if (typeof (key) === \"string\") {\r\n [schemaName, itemName] = SchemaItem.parseFullName(key);\r\n } else {\r\n itemName = key.name;\r\n schemaName = key.schemaName;\r\n }\r\n\r\n if (!schemaName || schemaName.toUpperCase() === this.name.toUpperCase()) {\r\n return this.getItem<T>(itemName);\r\n }\r\n\r\n const refSchema = await this.getReference(schemaName);\r\n if (!refSchema)\r\n return undefined;\r\n\r\n return refSchema.getItem<T>(itemName);\r\n }\r\n\r\n /**\r\n * Attempts to find a schema item within this schema or a (directly) referenced schema\r\n * @param key The full name or a SchemaItemKey identifying the desired item.\r\n */\r\n public lookupItemSync<T extends SchemaItem>(key: Readonly<SchemaItemKey> | string): T | undefined {\r\n let schemaName, itemName: string;\r\n if (typeof (key) === \"string\") {\r\n [schemaName, itemName] = SchemaItem.parseFullName(key);\r\n } else {\r\n itemName = key.name;\r\n schemaName = key.schemaName;\r\n }\r\n\r\n if (!schemaName || schemaName.toUpperCase() === this.name.toUpperCase()) {\r\n return this.getItemSync<T>(itemName);\r\n }\r\n\r\n const refSchema = this.getReferenceSync(schemaName);\r\n if (!refSchema)\r\n return undefined;\r\n\r\n return refSchema.getItemSync<T>(itemName);\r\n }\r\n\r\n public getItems<T extends AnySchemaItem>(): IterableIterator<T> {\r\n if (!this._items)\r\n return new Map<string, SchemaItem>().values() as IterableIterator<T>;\r\n\r\n return this._items.values() as IterableIterator<T>;\r\n }\r\n\r\n public *getClasses(): IterableIterator<ECClass> {\r\n for (const [, value] of this._items) {\r\n if (ECClass.isECClass(value))\r\n yield value;\r\n }\r\n }\r\n\r\n public async getReference<T extends Schema>(refSchemaName: string): Promise<T | undefined> {\r\n if (this.references.length === 0)\r\n return undefined;\r\n\r\n return this.references.find((ref) => ref.name.toLowerCase() === refSchemaName.toLowerCase()) as T;\r\n }\r\n\r\n public getReferenceNameByAlias(alias: string): string | undefined {\r\n if (this.references.length === 0)\r\n return undefined;\r\n\r\n const schema = this.references.find((ref) => ref.alias ? ref.alias.toLowerCase() === alias.toLowerCase() : false);\r\n return schema ? schema.name : undefined;\r\n }\r\n\r\n public getReferenceSync<T extends Schema>(refSchemaName: string): T | undefined {\r\n if (this.references.length === 0)\r\n return undefined;\r\n\r\n return this.references.find((ref) => ref.name.toLowerCase() === refSchemaName.toLowerCase()) as T;\r\n }\r\n\r\n /**\r\n * Save this Schema's properties to an object for serializing to JSON.\r\n */\r\n public toJSON(): SchemaProps {\r\n if (!this.isECSpecVersionSupported())\r\n throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECSpecVersion and cannot be serialized.`);\r\n\r\n const schemaJson: { [value: string]: any } = {};\r\n schemaJson.$schema = SCHEMAURL3_2_JSON; // $schema is required\r\n schemaJson.name = this.name; // name is required\r\n schemaJson.version = this.schemaKey.version.toString(true);\r\n schemaJson.alias = this.alias; // alias is required\r\n if (undefined !== this.label) // label is optional\r\n schemaJson.label = this.label;\r\n if (undefined !== this.description) // description is optional\r\n schemaJson.description = this.description;\r\n if (undefined !== this.references && this.references.length > 0) // references is optional\r\n schemaJson.references = this.references.map(({ name, schemaKey }) => ({ name, version: schemaKey.version.toString() }));\r\n\r\n const customAttributes = serializeCustomAttributes(this.customAttributes);\r\n if (undefined !== customAttributes)\r\n schemaJson.customAttributes = customAttributes;\r\n if (this._items.size > 0) {\r\n schemaJson.items = {};\r\n this._items.forEach((schemaItem: SchemaItem) => {\r\n schemaJson.items[schemaItem.name] = schemaItem.toJSON(false, true);\r\n });\r\n }\r\n return schemaJson as SchemaProps;\r\n }\r\n\r\n /**\r\n * Converts the schema to a DOM XML Document.\r\n * @param schemaXml An empty DOM document to which the schema will be written\r\n */\r\n public async toXml(schemaXml: Document): Promise<Document> {\r\n if (!this.isECSpecVersionSupported())\r\n throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECSpecVersion and cannot be serialized.`);\r\n\r\n const schemaMetadata = schemaXml.createElement(\"ECSchema\");\r\n schemaMetadata.setAttribute(\"xmlns\", SCHEMAURL3_2_XML);\r\n schemaMetadata.setAttribute(\"version\", this.schemaKey.version.toString());\r\n schemaMetadata.setAttribute(\"schemaName\", this.name);\r\n schemaMetadata.setAttribute(\"alias\", this.alias ? this.alias : \"\");\r\n if (undefined !== this.label)\r\n schemaMetadata.setAttribute(\"displayLabel\", this.label);\r\n if (undefined !== this.description)\r\n schemaMetadata.setAttribute(\"description\", this.description);\r\n\r\n // Map used for CA serialization\r\n const refSchemaMap = new Map<string, string>();\r\n\r\n this.references.forEach(({ name, schemaKey, alias }) => {\r\n const schemaRef = schemaXml.createElement(\"ECSchemaReference\");\r\n schemaRef.setAttribute(\"name\", name);\r\n schemaRef.setAttribute(\"version\", schemaKey.version.toString());\r\n schemaRef.setAttribute(\"alias\", alias ? alias : \"\");\r\n schemaMetadata.appendChild(schemaRef);\r\n refSchemaMap.set(name, schemaKey.version.toString());\r\n });\r\n\r\n if (this._customAttributes) {\r\n const parentElem = schemaXml.createElement(\"ECCustomAttributes\");\r\n for (const [name, attribute] of this._customAttributes) {\r\n const caElem = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this);\r\n parentElem.appendChild(caElem);\r\n }\r\n schemaMetadata.appendChild(parentElem);\r\n }\r\n\r\n for (const [, item] of this._items) {\r\n const itemXml = await item.toXml(schemaXml);\r\n schemaMetadata.appendChild(itemXml);\r\n }\r\n\r\n schemaXml.appendChild(schemaMetadata);\r\n return schemaXml;\r\n }\r\n\r\n // Check if the ECSpecVersion read-version is greater than the current ECSpecVersion supported.\r\n // If a specific ECSpecVersion is given, check against that version.\r\n // If no argument is given, check against the original ECSpecVersion of the schema.\r\n private isECSpecMajorVersionSupported(ecSpecMajorVersionToCheck?: number): boolean {\r\n // If argument is supplied, check the argument against the current ECSpecVersion supported\r\n if (ecSpecMajorVersionToCheck !== undefined)\r\n return (Schema.currentECSpecMajorVersion >= ecSpecMajorVersionToCheck);\r\n\r\n // If argument is not supplied, check against the original ECSpecVersion of the schema\r\n if (this.originalECSpecMajorVersion === undefined)\r\n return false;\r\n return (Schema.currentECSpecMajorVersion >= this.originalECSpecMajorVersion);\r\n }\r\n\r\n // Check if the full ECSpecVersion is greater than the current ECSpecVersion supported.\r\n // If a specific ECSpecVersion is given, check against that version.\r\n // If no argument is given, check against the original ECSpecVersion of the schema.\r\n private isECSpecVersionSupported(ecSpecMajorVersionToCheck?: number, ecSpecMinorVersionToCheck?: number): boolean {\r\n // If arguments are supplied, check the arguments against the current ECSpecVersion supported\r\n if (ecSpecMajorVersionToCheck !== undefined && ecSpecMinorVersionToCheck !== undefined) {\r\n if (!this.isECSpecMajorVersionSupported(ecSpecMajorVersionToCheck))\r\n return false;\r\n return (Schema.currentECSpecMinorVersion >= ecSpecMinorVersionToCheck);\r\n }\r\n // If arguments are not supplied, check against the original ECSpecVersion of the schema\r\n if (!this.isECSpecMajorVersionSupported() || this.originalECSpecMinorVersion === undefined)\r\n return false;\r\n return (Schema.currentECSpecMinorVersion >= this.originalECSpecMinorVersion);\r\n }\r\n\r\n /**\r\n * Loads the schema header (name, version alias, label and description) from the input SchemaProps\r\n */\r\n public fromJSONSync(schemaProps: SchemaProps) {\r\n if (undefined === this._schemaKey) {\r\n const schemaName = schemaProps.name;\r\n const version = ECVersion.fromString(schemaProps.version);\r\n this._schemaKey = new SchemaKey(schemaName, version);\r\n } else {\r\n if (schemaProps.name.toLowerCase() !== this.name.toLowerCase())\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not match the provided name, '${schemaProps.name}'.`);\r\n if (this.schemaKey.version.compare(ECVersion.fromString(schemaProps.version)))\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} has the version '${this.schemaKey.version}' that does not match the provided version '${schemaProps.version}'.`);\r\n }\r\n\r\n if (schemaProps.$schema.match(`https://dev\\\\.bentley\\\\.com/json_schemas/ec/([0-9]+)/ecschema`) == null && schemaProps.$schema.match(`http://www\\\\.bentley\\\\.com/schemas/Bentley\\\\.ECXML\\\\.([0-9]+)`) == null)\r\n throw new ECObjectsError(ECObjectsStatus.MissingSchemaUrl, `The Schema '${this.name}' has an unsupported namespace '${schemaProps.$schema}'.`);\r\n\r\n // The schema props have not been parsed. Parse the ECXml version from the $schema attribute\r\n let ecVersion: ECSpecVersion;\r\n if (schemaProps.ecSpecMajorVersion === undefined || schemaProps.ecSpecMinorVersion === undefined) {\r\n ecVersion = ((schemaProps.$schema.search(\"ECXML\") !== -1) ? XmlParser.parseXmlNamespace(schemaProps.$schema) : JsonParser.parseJSUri(schemaProps.$schema)) as ECSpecVersion;\r\n } else {\r\n ecVersion = { readVersion: schemaProps.ecSpecMajorVersion, writeVersion: schemaProps.ecSpecMinorVersion } as ECSpecVersion;\r\n }\r\n\r\n this._originalECSpecMajorVersion = ecVersion?.readVersion;\r\n this._originalECSpecMinorVersion = ecVersion?.writeVersion;\r\n\r\n if (!this.isECSpecMajorVersionSupported(ecVersion?.readVersion))\r\n throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECVersion and cannot be loaded.`);\r\n\r\n if (ECName.validate(schemaProps.alias)) {\r\n this._alias = schemaProps.alias;\r\n } else {\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${schemaProps.name} does not have the required 'alias' attribute.`);\r\n }\r\n\r\n if (undefined !== schemaProps.label)\r\n this._label = schemaProps.label;\r\n\r\n if (undefined !== schemaProps.description)\r\n this._description = schemaProps.description;\r\n }\r\n\r\n /**\r\n * Loads the schema header (name, version alias, label and description) from the input SchemaProps\r\n */\r\n public async fromJSON(schemaProps: SchemaProps) {\r\n this.fromJSONSync(schemaProps);\r\n }\r\n\r\n /**\r\n * Completely loads the SchemaInfo from the input json and starts loading the entire schema. The complete schema can be retrieved from the\r\n * schema context using the getCachedSchema method\r\n */\r\n public static async startLoadingFromJson(jsonObj: object | string, context: SchemaContext): Promise<SchemaInfo> {\r\n const schema = new Schema(context);\r\n\r\n const reader = new SchemaReadHelper(JsonParser, context);\r\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\r\n return reader.readSchemaInfo(schema, rawSchema);\r\n }\r\n\r\n public static async fromJson(jsonObj: object | string, context: SchemaContext): Promise<Schema> {\r\n let schema: Schema = new Schema(context);\r\n\r\n const reader = new SchemaReadHelper(JsonParser, context);\r\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\r\n schema = await reader.readSchema(schema, rawSchema);\r\n\r\n return schema;\r\n }\r\n\r\n /**\r\n * Completely loads the Schema from the input json. The schema is cached in the schema context.\r\n */\r\n public static fromJsonSync(jsonObj: object | string, context: SchemaContext): Schema {\r\n let schema: Schema = new Schema(context);\r\n\r\n const reader = new SchemaReadHelper(JsonParser, context);\r\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\r\n schema = reader.readSchemaSync(schema, rawSchema);\r\n\r\n return schema;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static isSchema(object: any): object is Schema {\r\n const schema = object as Schema;\r\n\r\n return schema !== undefined && schema.schemaKey !== undefined && schema.context !== undefined;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected setDisplayLabel(displayLabel: string) {\r\n this._label = displayLabel;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected setDescription(description: string) {\r\n this._description = description;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected setAlias(alias: string) {\r\n if (!ECName.validate(alias)) {\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECName, \"The specified schema alias is invalid.\");\r\n }\r\n this._alias = alias;\r\n }\r\n}\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\n * We cannot put this into Helper.ts and make it non-export, because we are importing Helper.ts from this file, and the circular import\r\n * would prevent this class from extending Schema.\r\n * @internal\r\n */\r\nexport abstract class MutableSchema extends Schema {\r\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\r\n public abstract override createEntityClass(name: string, modifier?: ECClassModifier): Promise<EntityClass>;\r\n public abstract override createEntityClassSync(name: string, modifier?: ECClassModifier): EntityClass;\r\n public abstract override createMixinClass(name: string): Promise<Mixin>;\r\n public abstract override createMixinClassSync(name: string): Mixin;\r\n public abstract override createStructClass(name: string, modifier?: ECClassModifier): Promise<StructClass>;\r\n public abstract override createStructClassSync(name: string, modifier?: ECClassModifier): StructClass;\r\n public abstract override createCustomAttributeClass(name: string, modifier?: ECClassModifier): Promise<CustomAttributeClass>;\r\n public abstract override createCustomAttributeClassSync(name: string, modifier?: ECClassModifier): CustomAttributeClass;\r\n public abstract override createRelationshipClass(name: string, modifier?: ECClassModifier): Promise<RelationshipClass>;\r\n public abstract override createRelationshipClassSync(name: string, modifier?: ECClassModifier): RelationshipClass;\r\n public abstract override createEnumeration(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Promise<Enumeration>;\r\n public abstract override createEnumerationSync(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Enumeration;\r\n public abstract override createKindOfQuantity(name: string): Promise<KindOfQuantity>;\r\n public abstract override createKindOfQuantitySync(name: string): KindOfQuantity;\r\n public abstract override createUnit(name: string): Promise<Unit>;\r\n public abstract override createUnitSync(name: string): Unit;\r\n public abstract override createConstant(name: string): Promise<Constant>;\r\n public abstract override createConstantSync(name: string): Constant;\r\n public abstract override createInvertedUnit(name: string): Promise<InvertedUnit>;\r\n public abstract override createInvertedUnitSync(name: string): InvertedUnit;\r\n public abstract override createPhenomenon(name: string): Promise<Phenomenon>;\r\n public abstract override createPhenomenonSync(name: string): Phenomenon;\r\n public abstract override createFormat(name: string): Promise<Format>;\r\n public abstract override createFormatSync(name: string): Format;\r\n public abstract override createUnitSystem(name: string): Promise<UnitSystem>;\r\n public abstract override createUnitSystemSync(name: string): UnitSystem;\r\n public abstract override createPropertyCategory(name: string): Promise<PropertyCategory>;\r\n public abstract override createPropertyCategorySync(name: string): PropertyCategory;\r\n public abstract override addItem<T extends SchemaItem>(item: T): void;\r\n public abstract override addReference(refSchema: Schema): Promise<void>;\r\n public abstract override addReferenceSync(refSchema: Schema): void;\r\n public abstract override setContext(schemaContext: SchemaContext): void;\r\n public abstract override deleteClass(name: string): Promise<void>;\r\n public abstract override deleteClassSync(name: string): void;\r\n public abstract override deleteSchemaItem(name: string): Promise<void>;\r\n public abstract override deleteSchemaItemSync(name: string): void;\r\n public abstract override setAlias(alias: string): void;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaItem.js","sourceRoot":"","sources":["../../../src/Metadata/SchemaItem.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,4CAAyE;AACzE,4CAA+D;AAC/D,4CAAwD;AAGxD,MAAM,YAAY,GAAG,uDAAuD,CAAC;AAE7E;;;GAGG;AACH,MAAsB,UAAU;IAO9B,YAAY,MAAc,EAAE,IAAY;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,yBAAa,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,IAAW,IAAI,KAAK,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3C,IAAW,QAAQ,KAAK,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACxG,IAAW,GAAG,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,IAAW,KAAK,KAAK,OAAO,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B;YACtB,OAAO,IAAI,CAAC;QAEd,MAAM,GAAG,GAAG,UAAU,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,mBAAmB,CAAC;QACzG,OAAO,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IAED;;MAEE;IACK,MAAM,CAAC,YAAY,CAAC,MAAW;QACpC,MAAM,UAAU,GAAG,MAAoB,CAAC;QAExC,OAAO,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,GAAG,KAAK,SAAS,IAAI,UAAU,CAAC,MAAM,KAAK,SAAS;eACtF,UAAU,CAAC,cAAc,KAAK,SAAS,CAAC;IACtD,CAAC;IAED;;;OAGG;IACO,OAAO,CAAC,IAAY;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,yBAAa,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7D,CAAC;IAED;;;OAGG;IACO,eAAe,CAAC,YAAoB;QAC5C,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,WAAmB;QAC1C,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;CACF;AAzJD,gCAyJC","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 { SchemaItemProps } from \"../Deserialization/JsonProps\";\nimport { SchemaItemType, schemaItemTypeToXmlString } from \"../ECObjects\";\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\nimport { ECVersion, SchemaItemKey } from \"../SchemaKey\";\nimport { Schema } from \"./Schema\";\n\nconst SCHEMAURL3_2 = \"https://dev.bentley.com/json_schemas/ec/32/schemaitem\";\n\n/**\n * An abstract class that supplies all of the common parts of a SchemaItem.\n * @beta\n */\nexport abstract class SchemaItem {\n public readonly schemaItemType!: SchemaItemType; // allow the derived classes to define their own schemaItemType\n public readonly schema: Schema;\n protected _key: SchemaItemKey;\n protected _description?: string;\n protected _label?: string;\n\n constructor(schema: Schema, name: string) {\n this._key = new SchemaItemKey(name, schema.schemaKey);\n this.schema = schema;\n }\n\n public get name() { return this.key.name; }\n public get fullName() { return this.key.schemaKey ? `${this.key.schemaName}.${this.name}` : this.name; }\n public get key() { return this._key; }\n public get label() { return this._label; }\n public get description() { return this._description; }\n\n // Proposal: Create protected setter methods for description and label? For UnitSystems as an example, where using createFromProps isn't that necessary and can just use basic create().\n /**\n * Save this SchemaItem's properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false) {\n const itemJson: { [value: string]: any } = {};\n if (standalone) {\n itemJson.$schema = SCHEMAURL3_2; // $schema is required\n itemJson.schema = this.schema.name;\n itemJson.name = this.name; // name is required\n if (includeSchemaVersion) // check flag to see if we should output version\n itemJson.schemaVersion = this.key.schemaKey.version.toString();\n }\n itemJson.schemaItemType = this.schemaItemType;\n if (undefined !== this.label)\n itemJson.label = this.label;\n if (undefined !== this.description)\n itemJson.description = this.description;\n\n return itemJson as SchemaItemProps;\n }\n\n /** @internal */\n public async toXml(schemaXml: Document): Promise<Element> {\n const itemType = schemaItemTypeToXmlString(this.schemaItemType);\n const itemElement = schemaXml.createElement(itemType);\n itemElement.setAttribute(\"typeName\", this.name);\n if (undefined !== this.label)\n itemElement.setAttribute(\"displayLabel\", this.label);\n if (undefined !== this.description)\n itemElement.setAttribute(\"description\", this.description);\n\n // When all schema items support custom attributes they should be added here rather than in ECClass\n\n return itemElement;\n }\n\n public fromJSONSync(schemaItemProps: SchemaItemProps) {\n if (undefined !== schemaItemProps.label)\n this._label = schemaItemProps.label;\n\n this._description = schemaItemProps.description;\n\n if (undefined !== schemaItemProps.schema) {\n if (schemaItemProps.schema.toLowerCase() !== this.schema.name.toLowerCase())\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to deserialize the SchemaItem '${this.fullName}' with a different schema name, ${schemaItemProps.schema}, than the current Schema of this SchemaItem, ${this.schema.fullName}.`);\n }\n\n if (undefined !== schemaItemProps.schemaVersion) {\n if (this.key.schemaKey.version.compare(ECVersion.fromString(schemaItemProps.schemaVersion)))\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to deserialize the SchemaItem '${this.fullName}' with a different schema version, ${schemaItemProps.schemaVersion}, than the current Schema version of this SchemaItem, ${this.key.schemaKey.version}.`);\n }\n }\n\n public async fromJSON(schemaItemProps: SchemaItemProps) {\n if (undefined !== schemaItemProps.label)\n this._label = schemaItemProps.label;\n\n this._description = schemaItemProps.description;\n\n if (undefined !== schemaItemProps.schema) {\n if (schemaItemProps.schema.toLowerCase() !== this.schema.name.toLowerCase())\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to deserialize the SchemaItem ${this.fullName}' with a different schema name, ${schemaItemProps.schema}, than the current Schema of this SchemaItem, ${this.schema.fullName}`);\n }\n\n if (undefined !== schemaItemProps.schemaVersion) {\n if (this.key.schemaKey.version.compare(ECVersion.fromString(schemaItemProps.schemaVersion)))\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to deserialize the SchemaItem '${this.fullName}' with a different schema version, ${schemaItemProps.schemaVersion}, than the current Schema version of this SchemaItem, ${this.key.schemaKey.version}.`);\n }\n }\n\n /**\n * Parses the given full name, {schemaName}.{schemaItemName} or {schemaName}:{schemaItemName}, into two separate strings.\n * @note The schema name can be a schema alias.\n * @param fullName The full name to be parsed.\n * @returns A tuple of the parsed Schema name and Schema Item name. If the full name does not contain a '.' or ':', the second string in the tuple will returned the exact string pass in.\n */\n public static parseFullName(fullName: string): [string, string] {\n const matches = /^([a-zA-Z_]+[a-zA-Z0-9_]*(\\.\\d+\\.\\d+\\.\\d+)?)[.:]([a-zA-Z_]+[a-zA-Z0-9_]*)$/.exec(fullName);\n\n // The first match will be the full string match, the second three will be the three groups\n if (matches === null || matches.length !== 4)\n return [\"\", fullName];\n\n return [matches[1], matches[3]];\n }\n\n /**\n * Indicates if the two SchemaItem objects are equal by comparing their respective [[key]] properties.\n * @param thisSchemaItem The first SchemaItem.\n * @param thatSchemaItemOrKey The second SchemaItem or SchemaItemKey.\n */\n public static equalByKey(thisSchemaItem: SchemaItem, thatSchemaItemOrKey?: SchemaItem | SchemaItemKey): boolean {\n if (!thatSchemaItemOrKey)\n return true;\n\n const key = SchemaItem.isSchemaItem(thatSchemaItemOrKey) ? thatSchemaItemOrKey.key : thatSchemaItemOrKey;\n return thisSchemaItem.key.matches(key);\n }\n\n /**\n * @internal\n */\n public static isSchemaItem(object: any): object is SchemaItem {\n const schemaItem = object as SchemaItem;\n\n return schemaItem !== undefined && schemaItem.key !== undefined && schemaItem.schema !== undefined\n && schemaItem.schemaItemType !== undefined;\n }\n\n /**\n * @alpha\n * Used for schema editing.\n */\n protected setName(name: string) {\n this._key = new SchemaItemKey(name, this.schema.schemaKey);\n }\n\n /**\n * @alpha\n * Used for schema editing.\n */\n protected setDisplayLabel(displayLabel: string) {\n this._label = displayLabel;\n }\n\n /**\n * @alpha\n * Used for schema editing.\n */\n protected setDescription(description: string) {\n this._description = description;\n }\n}\n"]}
1
+ {"version":3,"file":"SchemaItem.js","sourceRoot":"","sources":["../../../src/Metadata/SchemaItem.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,4CAAyE;AACzE,4CAA+D;AAC/D,4CAAwD;AAGxD,MAAM,YAAY,GAAG,uDAAuD,CAAC;AAE7E;;;GAGG;AACH,MAAsB,UAAU;IAO9B,YAAY,MAAc,EAAE,IAAY;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,yBAAa,CAAC,IAAI,EAAE,M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I,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;CACF;AAzJD,gCAyJC","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 { SchemaItemProps } from \"../Deserialization/JsonProps\";\r\nimport { SchemaItemType, schemaItemTypeToXmlString } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { ECVersion, SchemaItemKey } from \"../SchemaKey\";\r\nimport { Schema } from \"./Schema\";\r\n\r\nconst SCHEMAURL3_2 = \"https://dev.bentley.com/json_schemas/ec/32/schemaitem\";\r\n\r\n/**\r\n * An abstract class that supplies all of the common parts of a SchemaItem.\r\n * @beta\r\n */\r\nexport abstract class SchemaItem {\r\n public readonly schemaItemType!: SchemaItemType; // allow the derived classes to define their own schemaItemType\r\n public readonly schema: Schema;\r\n protected _key: SchemaItemKey;\r\n protected _description?: string;\r\n protected _label?: string;\r\n\r\n constructor(schema: Schema, name: string) {\r\n this._key = new SchemaItemKey(name, schema.schemaKey);\r\n this.schema = schema;\r\n }\r\n\r\n public get name() { return this.key.name; }\r\n public get fullName() { return this.key.schemaKey ? `${this.key.schemaName}.${this.name}` : this.name; }\r\n public get key() { return this._key; }\r\n public get label() { return this._label; }\r\n public get description() { return this._description; }\r\n\r\n // Proposal: Create protected setter methods for description and label? For UnitSystems as an example, where using createFromProps isn't that necessary and can just use basic create().\r\n /**\r\n * Save this SchemaItem's properties to an object for serializing to JSON.\r\n * @param standalone Serialization includes only this object (as opposed to the full schema).\r\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\r\n */\r\n public toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false) {\r\n const itemJson: { [value: string]: any } = {};\r\n if (standalone) {\r\n itemJson.$schema = SCHEMAURL3_2; // $schema is required\r\n itemJson.schema = this.schema.name;\r\n itemJson.name = this.name; // name is required\r\n if (includeSchemaVersion) // check flag to see if we should output version\r\n itemJson.schemaVersion = this.key.schemaKey.version.toString();\r\n }\r\n itemJson.schemaItemType = this.schemaItemType;\r\n if (undefined !== this.label)\r\n itemJson.label = this.label;\r\n if (undefined !== this.description)\r\n itemJson.description = this.description;\r\n\r\n return itemJson as SchemaItemProps;\r\n }\r\n\r\n /** @internal */\r\n public async toXml(schemaXml: Document): Promise<Element> {\r\n const itemType = schemaItemTypeToXmlString(this.schemaItemType);\r\n const itemElement = schemaXml.createElement(itemType);\r\n itemElement.setAttribute(\"typeName\", this.name);\r\n if (undefined !== this.label)\r\n itemElement.setAttribute(\"displayLabel\", this.label);\r\n if (undefined !== this.description)\r\n itemElement.setAttribute(\"description\", this.description);\r\n\r\n // When all schema items support custom attributes they should be added here rather than in ECClass\r\n\r\n return itemElement;\r\n }\r\n\r\n public fromJSONSync(schemaItemProps: SchemaItemProps) {\r\n if (undefined !== schemaItemProps.label)\r\n this._label = schemaItemProps.label;\r\n\r\n this._description = schemaItemProps.description;\r\n\r\n if (undefined !== schemaItemProps.schema) {\r\n if (schemaItemProps.schema.toLowerCase() !== this.schema.name.toLowerCase())\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to deserialize the SchemaItem '${this.fullName}' with a different schema name, ${schemaItemProps.schema}, than the current Schema of this SchemaItem, ${this.schema.fullName}.`);\r\n }\r\n\r\n if (undefined !== schemaItemProps.schemaVersion) {\r\n if (this.key.schemaKey.version.compare(ECVersion.fromString(schemaItemProps.schemaVersion)))\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to deserialize the SchemaItem '${this.fullName}' with a different schema version, ${schemaItemProps.schemaVersion}, than the current Schema version of this SchemaItem, ${this.key.schemaKey.version}.`);\r\n }\r\n }\r\n\r\n public async fromJSON(schemaItemProps: SchemaItemProps) {\r\n if (undefined !== schemaItemProps.label)\r\n this._label = schemaItemProps.label;\r\n\r\n this._description = schemaItemProps.description;\r\n\r\n if (undefined !== schemaItemProps.schema) {\r\n if (schemaItemProps.schema.toLowerCase() !== this.schema.name.toLowerCase())\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to deserialize the SchemaItem ${this.fullName}' with a different schema name, ${schemaItemProps.schema}, than the current Schema of this SchemaItem, ${this.schema.fullName}`);\r\n }\r\n\r\n if (undefined !== schemaItemProps.schemaVersion) {\r\n if (this.key.schemaKey.version.compare(ECVersion.fromString(schemaItemProps.schemaVersion)))\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to deserialize the SchemaItem '${this.fullName}' with a different schema version, ${schemaItemProps.schemaVersion}, than the current Schema version of this SchemaItem, ${this.key.schemaKey.version}.`);\r\n }\r\n }\r\n\r\n /**\r\n * Parses the given full name, {schemaName}.{schemaItemName} or {schemaName}:{schemaItemName}, into two separate strings.\r\n * @note The schema name can be a schema alias.\r\n * @param fullName The full name to be parsed.\r\n * @returns A tuple of the parsed Schema name and Schema Item name. If the full name does not contain a '.' or ':', the second string in the tuple will returned the exact string pass in.\r\n */\r\n public static parseFullName(fullName: string): [string, string] {\r\n const matches = /^([a-zA-Z_]+[a-zA-Z0-9_]*(\\.\\d+\\.\\d+\\.\\d+)?)[.:]([a-zA-Z_]+[a-zA-Z0-9_]*)$/.exec(fullName);\r\n\r\n // The first match will be the full string match, the second three will be the three groups\r\n if (matches === null || matches.length !== 4)\r\n return [\"\", fullName];\r\n\r\n return [matches[1], matches[3]];\r\n }\r\n\r\n /**\r\n * Indicates if the two SchemaItem objects are equal by comparing their respective [[key]] properties.\r\n * @param thisSchemaItem The first SchemaItem.\r\n * @param thatSchemaItemOrKey The second SchemaItem or SchemaItemKey.\r\n */\r\n public static equalByKey(thisSchemaItem: SchemaItem, thatSchemaItemOrKey?: SchemaItem | SchemaItemKey): boolean {\r\n if (!thatSchemaItemOrKey)\r\n return true;\r\n\r\n const key = SchemaItem.isSchemaItem(thatSchemaItemOrKey) ? thatSchemaItemOrKey.key : thatSchemaItemOrKey;\r\n return thisSchemaItem.key.matches(key);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static isSchemaItem(object: any): object is SchemaItem {\r\n const schemaItem = object as SchemaItem;\r\n\r\n return schemaItem !== undefined && schemaItem.key !== undefined && schemaItem.schema !== undefined\r\n && schemaItem.schemaItemType !== undefined;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected setName(name: string) {\r\n this._key = new SchemaItemKey(name, this.schema.schemaKey);\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected setDisplayLabel(displayLabel: string) {\r\n this._label = displayLabel;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected setDescription(description: string) {\r\n this._description = description;\r\n }\r\n}\r\n"]}
@@ -12,7 +12,7 @@ import { SchemaItem } from "./SchemaItem";
12
12
  * @beta
13
13
  */
14
14
  export declare class Unit extends SchemaItem {
15
- readonly schemaItemType: SchemaItemType.Unit;
15
+ readonly schemaItemType = SchemaItemType.Unit;
16
16
  protected _phenomenon?: LazyLoadedPhenomenon;
17
17
  protected _unitSystem?: LazyLoadedUnitSystem;
18
18
  protected _definition: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Unit.d.ts","sourceRoot":"","sources":["../../../src/Metadata/Unit.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAG3E,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;;;GAIG;AACH,qBAAa,IAAK,SAAQ,UAAU;IAClC,SAAyB,cAAc,EA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