@itwin/ecschema-metadata 5.0.0-dev.3 → 5.0.0-dev.34

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 (184) hide show
  1. package/CHANGELOG.md +20 -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.js.map +1 -1
  14. package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
  15. package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
  16. package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
  17. package/lib/cjs/ECName.js.map +1 -1
  18. package/lib/cjs/ECObjects.js.map +1 -1
  19. package/lib/cjs/Exception.js.map +1 -1
  20. package/lib/cjs/Interfaces.js.map +1 -1
  21. package/lib/cjs/Metadata/Class.d.ts +1 -2
  22. package/lib/cjs/Metadata/Class.d.ts.map +1 -1
  23. package/lib/cjs/Metadata/Class.js +2 -2
  24. package/lib/cjs/Metadata/Class.js.map +1 -1
  25. package/lib/cjs/Metadata/Constant.d.ts +1 -1
  26. package/lib/cjs/Metadata/Constant.d.ts.map +1 -1
  27. package/lib/cjs/Metadata/Constant.js.map +1 -1
  28. package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
  29. package/lib/cjs/Metadata/CustomAttributeClass.d.ts +2 -4
  30. package/lib/cjs/Metadata/CustomAttributeClass.d.ts.map +1 -1
  31. package/lib/cjs/Metadata/CustomAttributeClass.js +4 -4
  32. package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
  33. package/lib/cjs/Metadata/EntityClass.d.ts +2 -4
  34. package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
  35. package/lib/cjs/Metadata/EntityClass.js +2 -2
  36. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  37. package/lib/cjs/Metadata/Enumeration.d.ts +1 -1
  38. package/lib/cjs/Metadata/Enumeration.d.ts.map +1 -1
  39. package/lib/cjs/Metadata/Enumeration.js.map +1 -1
  40. package/lib/cjs/Metadata/Format.d.ts +1 -1
  41. package/lib/cjs/Metadata/Format.d.ts.map +1 -1
  42. package/lib/cjs/Metadata/Format.js.map +1 -1
  43. package/lib/cjs/Metadata/InvertedUnit.d.ts +1 -3
  44. package/lib/cjs/Metadata/InvertedUnit.d.ts.map +1 -1
  45. package/lib/cjs/Metadata/InvertedUnit.js +2 -2
  46. package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
  47. package/lib/cjs/Metadata/KindOfQuantity.d.ts +1 -3
  48. package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
  49. package/lib/cjs/Metadata/KindOfQuantity.js +6 -6
  50. package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
  51. package/lib/cjs/Metadata/Mixin.d.ts +1 -1
  52. package/lib/cjs/Metadata/Mixin.d.ts.map +1 -1
  53. package/lib/cjs/Metadata/Mixin.js.map +1 -1
  54. package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
  55. package/lib/cjs/Metadata/Phenomenon.d.ts +1 -1
  56. package/lib/cjs/Metadata/Phenomenon.d.ts.map +1 -1
  57. package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
  58. package/lib/cjs/Metadata/Property.d.ts.map +1 -1
  59. package/lib/cjs/Metadata/Property.js +49 -15
  60. package/lib/cjs/Metadata/Property.js.map +1 -1
  61. package/lib/cjs/Metadata/PropertyCategory.d.ts +1 -1
  62. package/lib/cjs/Metadata/PropertyCategory.d.ts.map +1 -1
  63. package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
  64. package/lib/cjs/Metadata/RelationshipClass.d.ts +1 -1
  65. package/lib/cjs/Metadata/RelationshipClass.d.ts.map +1 -1
  66. package/lib/cjs/Metadata/RelationshipClass.js +4 -4
  67. package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
  68. package/lib/cjs/Metadata/Schema.js +1 -1
  69. package/lib/cjs/Metadata/Schema.js.map +1 -1
  70. package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
  71. package/lib/cjs/Metadata/Unit.d.ts +1 -1
  72. package/lib/cjs/Metadata/Unit.d.ts.map +1 -1
  73. package/lib/cjs/Metadata/Unit.js.map +1 -1
  74. package/lib/cjs/Metadata/UnitSystem.d.ts +1 -3
  75. package/lib/cjs/Metadata/UnitSystem.d.ts.map +1 -1
  76. package/lib/cjs/Metadata/UnitSystem.js +2 -2
  77. package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
  78. package/lib/cjs/PropertyTypes.js.map +1 -1
  79. package/lib/cjs/SchemaJsonLocater.js.map +1 -1
  80. package/lib/cjs/SchemaKey.js.map +1 -1
  81. package/lib/cjs/SchemaLoader.js.map +1 -1
  82. package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
  83. package/lib/cjs/UnitConversion/Graph.js.map +1 -1
  84. package/lib/cjs/UnitConversion/Parser.js.map +1 -1
  85. package/lib/cjs/UnitConversion/UnitConversion.js +2 -2
  86. package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
  87. package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
  88. package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
  89. package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
  90. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  91. package/lib/cjs/ecschema-metadata.js.map +1 -1
  92. package/lib/cjs/utils/SchemaGraph.js.map +1 -1
  93. package/lib/esm/Constants.js +20 -20
  94. package/lib/esm/Constants.js.map +1 -1
  95. package/lib/esm/Context.d.ts +19 -0
  96. package/lib/esm/Context.d.ts.map +1 -1
  97. package/lib/esm/Context.js +29 -1
  98. package/lib/esm/Context.js.map +1 -1
  99. package/lib/esm/DelayedPromise.js +1 -1
  100. package/lib/esm/DelayedPromise.js.map +1 -1
  101. package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
  102. package/lib/esm/Deserialization/Helper.js.map +1 -1
  103. package/lib/esm/Deserialization/JsonParser.js.map +1 -1
  104. package/lib/esm/Deserialization/JsonProps.js.map +1 -1
  105. package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
  106. package/lib/esm/Deserialization/XmlParser.js.map +1 -1
  107. package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
  108. package/lib/esm/ECName.js.map +1 -1
  109. package/lib/esm/ECObjects.js.map +1 -1
  110. package/lib/esm/Exception.js.map +1 -1
  111. package/lib/esm/Interfaces.js.map +1 -1
  112. package/lib/esm/Metadata/Class.d.ts +1 -2
  113. package/lib/esm/Metadata/Class.d.ts.map +1 -1
  114. package/lib/esm/Metadata/Class.js +2 -2
  115. package/lib/esm/Metadata/Class.js.map +1 -1
  116. package/lib/esm/Metadata/Constant.d.ts +1 -1
  117. package/lib/esm/Metadata/Constant.d.ts.map +1 -1
  118. package/lib/esm/Metadata/Constant.js.map +1 -1
  119. package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
  120. package/lib/esm/Metadata/CustomAttributeClass.d.ts +2 -4
  121. package/lib/esm/Metadata/CustomAttributeClass.d.ts.map +1 -1
  122. package/lib/esm/Metadata/CustomAttributeClass.js +4 -4
  123. package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
  124. package/lib/esm/Metadata/EntityClass.d.ts +2 -4
  125. package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
  126. package/lib/esm/Metadata/EntityClass.js +2 -2
  127. package/lib/esm/Metadata/EntityClass.js.map +1 -1
  128. package/lib/esm/Metadata/Enumeration.d.ts +1 -1
  129. package/lib/esm/Metadata/Enumeration.d.ts.map +1 -1
  130. package/lib/esm/Metadata/Enumeration.js.map +1 -1
  131. package/lib/esm/Metadata/Format.d.ts +1 -1
  132. package/lib/esm/Metadata/Format.d.ts.map +1 -1
  133. package/lib/esm/Metadata/Format.js.map +1 -1
  134. package/lib/esm/Metadata/InvertedUnit.d.ts +1 -3
  135. package/lib/esm/Metadata/InvertedUnit.d.ts.map +1 -1
  136. package/lib/esm/Metadata/InvertedUnit.js +2 -2
  137. package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
  138. package/lib/esm/Metadata/KindOfQuantity.d.ts +1 -3
  139. package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
  140. package/lib/esm/Metadata/KindOfQuantity.js +6 -6
  141. package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
  142. package/lib/esm/Metadata/Mixin.d.ts +1 -1
  143. package/lib/esm/Metadata/Mixin.d.ts.map +1 -1
  144. package/lib/esm/Metadata/Mixin.js.map +1 -1
  145. package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
  146. package/lib/esm/Metadata/Phenomenon.d.ts +1 -1
  147. package/lib/esm/Metadata/Phenomenon.d.ts.map +1 -1
  148. package/lib/esm/Metadata/Phenomenon.js.map +1 -1
  149. package/lib/esm/Metadata/Property.d.ts.map +1 -1
  150. package/lib/esm/Metadata/Property.js +49 -15
  151. package/lib/esm/Metadata/Property.js.map +1 -1
  152. package/lib/esm/Metadata/PropertyCategory.d.ts +1 -1
  153. package/lib/esm/Metadata/PropertyCategory.d.ts.map +1 -1
  154. package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
  155. package/lib/esm/Metadata/RelationshipClass.d.ts +1 -1
  156. package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -1
  157. package/lib/esm/Metadata/RelationshipClass.js +4 -4
  158. package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
  159. package/lib/esm/Metadata/Schema.js +1 -1
  160. package/lib/esm/Metadata/Schema.js.map +1 -1
  161. package/lib/esm/Metadata/SchemaItem.js.map +1 -1
  162. package/lib/esm/Metadata/Unit.d.ts +1 -1
  163. package/lib/esm/Metadata/Unit.d.ts.map +1 -1
  164. package/lib/esm/Metadata/Unit.js.map +1 -1
  165. package/lib/esm/Metadata/UnitSystem.d.ts +1 -3
  166. package/lib/esm/Metadata/UnitSystem.d.ts.map +1 -1
  167. package/lib/esm/Metadata/UnitSystem.js +2 -2
  168. package/lib/esm/Metadata/UnitSystem.js.map +1 -1
  169. package/lib/esm/PropertyTypes.js.map +1 -1
  170. package/lib/esm/SchemaJsonLocater.js.map +1 -1
  171. package/lib/esm/SchemaKey.js.map +1 -1
  172. package/lib/esm/SchemaLoader.js.map +1 -1
  173. package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
  174. package/lib/esm/UnitConversion/Graph.js.map +1 -1
  175. package/lib/esm/UnitConversion/Parser.js.map +1 -1
  176. package/lib/esm/UnitConversion/UnitConversion.js +2 -2
  177. package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
  178. package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
  179. package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
  180. package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
  181. package/lib/esm/Validation/SchemaWalker.js.map +1 -1
  182. package/lib/esm/ecschema-metadata.js.map +1 -1
  183. package/lib/esm/utils/SchemaGraph.js.map +1 -1
  184. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"InvertedUnit.js","sourceRoot":"","sources":["../../../src/Metadata/InvertedUnit.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,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4B,uBAAuB,EAC/F,KAAK,IAAI,EAAE;YACT,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAa,uBAAuB,CAAC,CAAC;YACrF,IAAI,SAAS,KAAK,UAAU;gBAC1B,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,aAAa,EAAE,mCAAmC,iBAAiB,CAAC,UAAU,GAAG,CAAC,CAAC;YAC9H,OAAO,UAAU,CAAC;QACpB,CAAC,CAAC,CAAC;IACP,CAAC;IAEe,KAAK,CAAC,QAAQ,CAAC,iBAAoC;QACjE,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,WAA2B;QAClD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IAED;;;OAGG;IACO,aAAa,CAAC,UAAgC;QACtD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,YAAY;CAI7D","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 { InvertedUnitProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { SchemaItemType } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { LazyLoadedUnit, LazyLoadedUnitSystem } from \"../Interfaces\";\r\nimport { SchemaItemKey } from \"../SchemaKey\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\nimport { Unit } from \"./Unit\";\r\nimport { UnitSystem } from \"./UnitSystem\";\r\n\r\n/**\r\n * An InvertedUnit is a specific type of Unit that describes the inverse of a single Unit whose dimensional derivation is unit-less.\r\n * @beta\r\n */\r\nexport class InvertedUnit extends SchemaItem {\r\n public override readonly schemaItemType!: SchemaItemType.InvertedUnit;\r\n protected _invertsUnit?: LazyLoadedUnit; // required\r\n protected _unitSystem?: LazyLoadedUnitSystem; // required\r\n\r\n constructor(schema: Schema, name: string) {\r\n super(schema, name);\r\n this.schemaItemType = SchemaItemType.InvertedUnit;\r\n }\r\n\r\n public get invertsUnit(): LazyLoadedUnit | undefined { return this._invertsUnit; }\r\n public get unitSystem(): LazyLoadedUnitSystem | undefined { return this._unitSystem; }\r\n\r\n /**\r\n * @alpha\r\n */\r\n public static isInvertedUnit(object: any): object is InvertedUnit {\r\n return SchemaItem.isSchemaItem(object) && object.schemaItemType === SchemaItemType.InvertedUnit;\r\n }\r\n\r\n /**\r\n * Save this InvertedUnit'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): InvertedUnitProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n schemaJson.invertsUnit = this.invertsUnit!.fullName;\r\n schemaJson.unitSystem = this.unitSystem!.fullName;\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\r\n const unitSystem = await this.unitSystem;\r\n if (undefined !== unitSystem) {\r\n const unitSystemName = XmlSerializationUtils.createXmlTypedName(this.schema, unitSystem.schema, unitSystem.name);\r\n itemElement.setAttribute(\"unitSystem\", unitSystemName);\r\n }\r\n\r\n const invertsUnit = await this.invertsUnit;\r\n if (undefined !== invertsUnit) {\r\n const invertsUnitName = XmlSerializationUtils.createXmlTypedName(this.schema, invertsUnit.schema, invertsUnit.name);\r\n itemElement.setAttribute(\"invertsUnit\", invertsUnitName);\r\n }\r\n\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(invertedUnitProps: InvertedUnitProps) {\r\n super.fromJSONSync(invertedUnitProps);\r\n const unitSchemaItemKey = this.schema.getSchemaItemKey(invertedUnitProps.invertsUnit);\r\n this._invertsUnit = new DelayedPromiseWithProps<SchemaItemKey, Unit>(unitSchemaItemKey,\r\n async () => {\r\n const invertsUnit = await this.schema.lookupItem<Unit>(unitSchemaItemKey);\r\n if (undefined === invertsUnit)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the invertsUnit ${invertedUnitProps.invertsUnit}.`);\r\n return invertsUnit;\r\n });\r\n\r\n const unitSystemSchemaItemKey = this.schema.getSchemaItemKey(invertedUnitProps.unitSystem);\r\n if (!unitSystemSchemaItemKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the unitSystem ${invertedUnitProps.unitSystem}.`);\r\n this._unitSystem = new DelayedPromiseWithProps<SchemaItemKey, UnitSystem>(unitSystemSchemaItemKey,\r\n async () => {\r\n const unitSystem = await this.schema.lookupItem<UnitSystem>(unitSystemSchemaItemKey);\r\n if (undefined === unitSystem)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the unitSystem ${invertedUnitProps.unitSystem}.`);\r\n return unitSystem;\r\n });\r\n }\r\n\r\n public override async fromJSON(invertedUnitProps: InvertedUnitProps) {\r\n this.fromJSONSync(invertedUnitProps);\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing\r\n */\r\n protected setInvertsUnit(invertsUnit: LazyLoadedUnit) {\r\n this._invertsUnit = invertsUnit;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing\r\n */\r\n protected setUnitSystem(unitSystem: LazyLoadedUnitSystem) {\r\n this._unitSystem = unitSystem;\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 MutableInvertedUnit extends InvertedUnit {\r\n public abstract override setInvertsUnit(invertsUnit: LazyLoadedUnit): void;\r\n public abstract override setUnitSystem(unitSystem: LazyLoadedUnitSystem): void;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"InvertedUnit.js","sourceRoot":"","sources":["../../../src/Metadata/InvertedUnit.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,UAAU;IAA5C;;QAC2B,mBAAc,GAAG,cAAc,CAAC,YAAY,CAAC;IAuFxE,CAAC;IAnFC,IAAW,WAAW,KAAiC,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAClF,IAAW,UAAU,KAAuC,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAEtF;;OAEG;IACI,MAAM,CAAC,cAAc,CAAC,MAAW;QACtC,OAAO,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,cAAc,KAAK,cAAc,CAAC,YAAY,CAAC;IAClG,CAAC;IAED;;;;OAIG;IACa,MAAM,CAAC,aAAsB,KAAK,EAAE,uBAAgC,KAAK;QACvF,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,oBAAoB,CAAQ,CAAC;QACzE,UAAU,CAAC,WAAW,GAAG,IAAI,CAAC,WAAY,CAAC,QAAQ,CAAC;QACpD,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,UAAW,CAAC,Q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AAa,EAAE,oCAAoC,iBAAiB,CAAC,WAAW,GAAG,CAAC,CAAC;YAChI,OAAO,WAAW,CAAC;QACrB,CAAC,CAAC,CAAC;QAEL,MAAM,uBAAuB,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAC3F,IAAI,CAAC,uBAAuB;YAC1B,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,aAAa,EAAE,mCAAmC,iBAAiB,CAAC,UAAU,GAAG,CAAC,CAAC;QAC9H,IAAI,CAAC,WAAW,GAAG,IAAI,uBAAuB,CAA4B,uBAAuB,EAC/F,KAAK,IAAI,EAAE;YACT,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAa,uBAAuB,CAAC,CAAC;YACrF,IAAI,SAAS,KAAK,UAAU;gBAC1B,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,aAAa,EAAE,mCAAmC,iBAAiB,CAAC,UAAU,GAAG,CAAC,CAAC;YAC9H,OAAO,UAAU,CAAC;QACpB,CAAC,CAAC,CAAC;IACP,CAAC;IAEe,KAAK,CAAC,QAAQ,CAAC,iBAAoC;QACjE,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,WAA2B;QAClD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IAED;;;OAGG;IACO,aAAa,CAAC,UAAgC;QACtD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,YAAY;CAI7D","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 { InvertedUnitProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\nimport { LazyLoadedUnit, LazyLoadedUnitSystem } from \"../Interfaces\";\nimport { SchemaItemKey } from \"../SchemaKey\";\nimport { SchemaItem } from \"./SchemaItem\";\nimport { Unit } from \"./Unit\";\nimport { UnitSystem } from \"./UnitSystem\";\n\n/**\n * An InvertedUnit is a specific type of Unit that describes the inverse of a single Unit whose dimensional derivation is unit-less.\n * @beta\n */\nexport class InvertedUnit extends SchemaItem {\n public override readonly schemaItemType = SchemaItemType.InvertedUnit;\n protected _invertsUnit?: LazyLoadedUnit; // required\n protected _unitSystem?: LazyLoadedUnitSystem; // required\n\n public get invertsUnit(): LazyLoadedUnit | undefined { return this._invertsUnit; }\n public get unitSystem(): LazyLoadedUnitSystem | undefined { return this._unitSystem; }\n\n /**\n * @alpha\n */\n public static isInvertedUnit(object: any): object is InvertedUnit {\n return SchemaItem.isSchemaItem(object) && object.schemaItemType === SchemaItemType.InvertedUnit;\n }\n\n /**\n * Save this InvertedUnit'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): InvertedUnitProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.invertsUnit = this.invertsUnit!.fullName;\n schemaJson.unitSystem = this.unitSystem!.fullName;\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n\n const unitSystem = await this.unitSystem;\n if (undefined !== unitSystem) {\n const unitSystemName = XmlSerializationUtils.createXmlTypedName(this.schema, unitSystem.schema, unitSystem.name);\n itemElement.setAttribute(\"unitSystem\", unitSystemName);\n }\n\n const invertsUnit = await this.invertsUnit;\n if (undefined !== invertsUnit) {\n const invertsUnitName = XmlSerializationUtils.createXmlTypedName(this.schema, invertsUnit.schema, invertsUnit.name);\n itemElement.setAttribute(\"invertsUnit\", invertsUnitName);\n }\n\n return itemElement;\n }\n\n public override fromJSONSync(invertedUnitProps: InvertedUnitProps) {\n super.fromJSONSync(invertedUnitProps);\n const unitSchemaItemKey = this.schema.getSchemaItemKey(invertedUnitProps.invertsUnit);\n this._invertsUnit = new DelayedPromiseWithProps<SchemaItemKey, Unit>(unitSchemaItemKey,\n async () => {\n const invertsUnit = await this.schema.lookupItem<Unit>(unitSchemaItemKey);\n if (undefined === invertsUnit)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the invertsUnit ${invertedUnitProps.invertsUnit}.`);\n return invertsUnit;\n });\n\n const unitSystemSchemaItemKey = this.schema.getSchemaItemKey(invertedUnitProps.unitSystem);\n if (!unitSystemSchemaItemKey)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the unitSystem ${invertedUnitProps.unitSystem}.`);\n this._unitSystem = new DelayedPromiseWithProps<SchemaItemKey, UnitSystem>(unitSystemSchemaItemKey,\n async () => {\n const unitSystem = await this.schema.lookupItem<UnitSystem>(unitSystemSchemaItemKey);\n if (undefined === unitSystem)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the unitSystem ${invertedUnitProps.unitSystem}.`);\n return unitSystem;\n });\n }\n\n public override async fromJSON(invertedUnitProps: InvertedUnitProps) {\n this.fromJSONSync(invertedUnitProps);\n }\n\n /**\n * @alpha\n * Used for schema editing\n */\n protected setInvertsUnit(invertsUnit: LazyLoadedUnit) {\n this._invertsUnit = invertsUnit;\n }\n\n /**\n * @alpha\n * Used for schema editing\n */\n protected setUnitSystem(unitSystem: LazyLoadedUnitSystem) {\n this._unitSystem = unitSystem;\n }\n}\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableInvertedUnit extends InvertedUnit {\n public abstract override setInvertsUnit(invertsUnit: LazyLoadedUnit): void;\n public abstract override setUnitSystem(unitSystem: LazyLoadedUnitSystem): void;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
@@ -7,14 +7,13 @@ import { LazyLoadedInvertedUnit, LazyLoadedUnit } from "../Interfaces";
7
7
  import { Format } from "./Format";
8
8
  import { InvertedUnit } from "./InvertedUnit";
9
9
  import { OverrideFormat } from "./OverrideFormat";
10
- import { Schema } from "./Schema";
11
10
  import { SchemaItem } from "./SchemaItem";
12
11
  import { Unit } from "./Unit";
13
12
  /** A Typescript class representation of a KindOfQuantity.
14
13
  * @beta
15
14
  */
16
15
  export declare class KindOfQuantity extends SchemaItem {
17
- readonly schemaItemType: SchemaItemType.KindOfQuantity;
16
+ readonly schemaItemType = SchemaItemType.KindOfQuantity;
18
17
  protected _relativeError: number;
19
18
  protected _presentationFormats: Array<Format | OverrideFormat>;
20
19
  protected _persistenceUnit?: LazyLoadedUnit | LazyLoadedInvertedUnit;
@@ -25,7 +24,6 @@ export declare class KindOfQuantity extends SchemaItem {
25
24
  get persistenceUnit(): LazyLoadedUnit | LazyLoadedInvertedUnit | undefined;
26
25
  protected set persistenceUnit(value: LazyLoadedUnit | LazyLoadedInvertedUnit | undefined);
27
26
  get relativeError(): number;
28
- constructor(schema: Schema, name: string);
29
27
  /**
30
28
  *
31
29
  * @param format The Format to add to this KindOfQuantity
@@ -1 +1 @@
1
- {"version":3,"file":"KindOfQuantity.d.ts","sourceRoot":"","sources":["../../../src/Metadata/KindOfQuantity.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EA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AE,mBAAmB,GAAG,IAAI;IAiBtD,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBvF;;;OAGG;IACH,SAAS,CAAC,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;CAGxD;AACD;;;GAGG;AACH,8BAAsB,qBAAsB,SAAQ,cAAc;aACvC,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI;aAChF,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,GAAG,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GAAG,cAAc;aAC/I,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;CACrE"}
@@ -15,6 +15,12 @@ import { SchemaItem } from "./SchemaItem";
15
15
  * @beta
16
16
  */
17
17
  export class KindOfQuantity extends SchemaItem {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.schemaItemType = SchemaItemType.KindOfQuantity; // Needed to allow both run-time and compile-time check.
21
+ this._relativeError = 1.0;
22
+ this._presentationFormats = new Array();
23
+ }
18
24
  /** The first presentation format in the list of Formats. */
19
25
  get defaultPresentationFormat() { return this.presentationFormats[0]; }
20
26
  /** A list of presentation formats. */
@@ -22,12 +28,6 @@ export class KindOfQuantity extends SchemaItem {
22
28
  get persistenceUnit() { return this._persistenceUnit; }
23
29
  set persistenceUnit(value) { this._persistenceUnit = value; }
24
30
  get relativeError() { return this._relativeError; }
25
- constructor(schema, name) {
26
- super(schema, name);
27
- this._relativeError = 1.0;
28
- this._presentationFormats = new Array();
29
- this.schemaItemType = SchemaItemType.KindOfQuantity; // Needed to allow both run-time and compile-time check.
30
- }
31
31
  /**
32
32
  *
33
33
  * @param format The Format to add to this KindOfQuantity
@@ -1 +1 @@
1
- {"version":3,"file":"KindOfQ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AqB;QAC9C,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACtC,CAAC;CACF;AACD;;;GAGG;AACH,MAAM,OAAgB,qBAAsB,SAAQ,cAAc;CAIjE","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 { KindOfQuantityProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { SchemaItemType } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { LazyLoadedInvertedUnit, LazyLoadedUnit } from \"../Interfaces\";\r\nimport { Format } from \"./Format\";\r\nimport { InvertedUnit } from \"./InvertedUnit\";\r\nimport { OverrideFormat, OverrideFormatProps } from \"./OverrideFormat\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\nimport { Unit } from \"./Unit\";\r\n\r\n/** A Typescript class representation of a KindOfQuantity.\r\n * @beta\r\n */\r\nexport class KindOfQuantity extends SchemaItem {\r\n public override readonly schemaItemType!: SchemaItemType.KindOfQuantity;\r\n protected _relativeError: number = 1.0;\r\n protected _presentationFormats: Array<Format | OverrideFormat> = new Array<Format | OverrideFormat>();\r\n protected _persistenceUnit?: LazyLoadedUnit | LazyLoadedInvertedUnit;\r\n\r\n /** The first presentation format in the list of Formats. */\r\n public get defaultPresentationFormat(): Format | OverrideFormat | undefined { return this.presentationFormats[0]; }\r\n\r\n /** A list of presentation formats. */\r\n public get presentationFormats(): Array<Format | OverrideFormat> { return this._presentationFormats; }\r\n\r\n public get persistenceUnit(): LazyLoadedUnit | LazyLoadedInvertedUnit | undefined { return this._persistenceUnit; }\r\n protected set persistenceUnit(value: LazyLoadedUnit | LazyLoadedInvertedUnit | undefined) { this._persistenceUnit = value; }\r\n\r\n public get relativeError() { return this._relativeError; }\r\n\r\n constructor(schema: Schema, name: string) {\r\n super(schema, name);\r\n this.schemaItemType = SchemaItemType.KindOfQuantity; // Needed to allow both run-time and compile-time check.\r\n }\r\n\r\n /**\r\n *\r\n * @param format The Format to add to this KindOfQuantity\r\n * @param isDefault\r\n */\r\n protected addPresentationFormat(format: Format | OverrideFormat, isDefault: boolean = false) {\r\n // TODO: Add some sort of validation?\r\n (isDefault) ? this._presentationFormats.splice(0, 0, format) : this._presentationFormats.push(format);\r\n }\r\n\r\n /** Creates an OverrideFormat in the context of this KindOfQuantity.\r\n * @param parent The Format to override.\r\n * @param precision The precision override\r\n * @param unitLabelOverrides The list of unit and label overrides.\r\n */\r\n protected createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[Unit | InvertedUnit, string | undefined]>): OverrideFormat {\r\n if (unitLabelOverrides && parent.units && parent.units.length !== unitLabelOverrides.length)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Cannot add presentation format to KindOfQuantity '${this.name}' because the number of unit overrides is inconsistent with the number in the Format '${parent.name}'.`);\r\n\r\n if (parent.units && 0 === parent.units.length && unitLabelOverrides && 0 < unitLabelOverrides.length)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Cannot add a presentation format to KindOfQuantity '${this.name}' without any units and no unit overrides.`);\r\n\r\n // TODO: Check compatibility of Unit overrides with the persistence unit\r\n\r\n return new OverrideFormat(parent, precision, unitLabelOverrides);\r\n }\r\n\r\n private async processPresentationUnits(presentationUnitsJson: string | string[]): Promise<void> {\r\n const presUnitsArr = Array.isArray(presentationUnitsJson) ? presentationUnitsJson : presentationUnitsJson.split(\";\");\r\n for (const formatString of presUnitsArr) {\r\n const presFormatOverride: OverrideFormatProps = OverrideFormat.parseFormatString(formatString);\r\n\r\n const format = await this.schema.lookupItem<Format>(presFormatOverride.name);\r\n if (undefined === format || format.schemaItemType !== SchemaItemType.Format)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate Format '${presFormatOverride.name}' for the presentation unit on KindOfQuantity ${this.fullName}.`);\r\n\r\n if (undefined === presFormatOverride.precision && undefined === presFormatOverride.unitAndLabels) {\r\n this.addPresentationFormat(format);\r\n continue;\r\n }\r\n\r\n let unitAndLabels: Array<[Unit | InvertedUnit, string | undefined]> | undefined;\r\n if (undefined !== presFormatOverride.unitAndLabels) {\r\n if (4 < presFormatOverride.unitAndLabels.length)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\r\n\r\n unitAndLabels = [];\r\n for (const unitOverride of presFormatOverride.unitAndLabels) {\r\n const unit = await this.schema.lookupItem<Unit | InvertedUnit>(unitOverride[0]);\r\n if (undefined === unit)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate SchemaItem ${unitOverride[0]}.`);\r\n\r\n unitAndLabels.push([unit, unitOverride[1]]);\r\n }\r\n }\r\n\r\n const overrideFormat: OverrideFormat = this.createFormatOverride(format, presFormatOverride.precision, unitAndLabels);\r\n this.addPresentationFormat(overrideFormat);\r\n }\r\n }\r\n\r\n private processPresentationUnitsSync(presentationUnitsJson: string | string[]): void {\r\n const presUnitsArr = Array.isArray(presentationUnitsJson) ? presentationUnitsJson : presentationUnitsJson.split(\";\");\r\n for (const formatString of presUnitsArr) {\r\n const presFormatOverride: OverrideFormatProps = OverrideFormat.parseFormatString(formatString);\r\n\r\n const format = this.schema.lookupItemSync<Format>(presFormatOverride.name);\r\n if (undefined === format || format.schemaItemType !== SchemaItemType.Format)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate Format '${presFormatOverride.name}' for the presentation unit on KindOfQuantity ${this.fullName}.`);\r\n\r\n if (undefined === presFormatOverride.precision && undefined === presFormatOverride.unitAndLabels) {\r\n this.addPresentationFormat(format);\r\n continue;\r\n }\r\n\r\n let unitAndLabels: Array<[Unit | InvertedUnit, string | undefined]> | undefined;\r\n if (undefined !== presFormatOverride.unitAndLabels) {\r\n if (4 < presFormatOverride.unitAndLabels.length)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\r\n\r\n unitAndLabels = [];\r\n for (const unitOverride of presFormatOverride.unitAndLabels) {\r\n const unit = this.schema.lookupItemSync<Unit | InvertedUnit>(unitOverride[0]);\r\n if (undefined === unit)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate SchemaItem ${unitOverride[0]}.`);\r\n\r\n unitAndLabels.push([unit, unitOverride[1]]);\r\n }\r\n }\r\n\r\n const overrideFormat: OverrideFormat = this.createFormatOverride(format, presFormatOverride.precision, unitAndLabels);\r\n this.addPresentationFormat(overrideFormat);\r\n }\r\n }\r\n\r\n /**\r\n * Save this KindOfQuantity'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): KindOfQuantityProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n schemaJson.relativeError = this.relativeError;\r\n schemaJson.persistenceUnit = this.persistenceUnit!.fullName;\r\n if (undefined !== this.presentationFormats && 0 < this.presentationFormats.length)\r\n schemaJson.presentationUnits = this.presentationFormats.map((format: Format | OverrideFormat) => format.fullName);\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\r\n const persistenceUnit = await this.persistenceUnit;\r\n if (undefined !== persistenceUnit) {\r\n const unitName = XmlSerializationUtils.createXmlTypedName(this.schema, persistenceUnit.schema, persistenceUnit.name);\r\n itemElement.setAttribute(\"persistenceUnit\", unitName);\r\n }\r\n\r\n if (undefined !== this.presentationFormats) {\r\n const presUnitStrings = this.presentationFormats.map((format: Format | OverrideFormat) => {\r\n if (!OverrideFormat.isOverrideFormat(format))\r\n return XmlSerializationUtils.createXmlTypedName(this.schema, format.schema, format.name);\r\n return format.fullNameXml(this.schema);\r\n });\r\n itemElement.setAttribute(\"presentationUnits\", presUnitStrings.join(\";\"));\r\n }\r\n itemElement.setAttribute(\"relativeError\", this.relativeError.toString());\r\n\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(kindOfQuantityProps: KindOfQuantityProps): void {\r\n super.fromJSONSync(kindOfQuantityProps);\r\n this._relativeError = kindOfQuantityProps.relativeError;\r\n\r\n const persistenceUnit = this.schema.lookupItemSync<Unit>(kindOfQuantityProps.persistenceUnit);\r\n if (undefined === persistenceUnit)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Unit ${kindOfQuantityProps.persistenceUnit} does not exist.`);\r\n\r\n if (persistenceUnit.schemaItemType !== SchemaItemType.Unit && persistenceUnit.schemaItemType !== SchemaItemType.InvertedUnit)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The item ${kindOfQuantityProps.persistenceUnit} is not a Unit or InvertedUnit.`);\r\n\r\n this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);\r\n\r\n if (undefined !== kindOfQuantityProps.presentationUnits)\r\n this.processPresentationUnitsSync(kindOfQuantityProps.presentationUnits);\r\n }\r\n\r\n public override async fromJSON(kindOfQuantityProps: KindOfQuantityProps): Promise<void> {\r\n await super.fromJSON(kindOfQuantityProps);\r\n this._relativeError = kindOfQuantityProps.relativeError;\r\n\r\n const persistenceUnit = await this.schema.lookupItem<Unit>(kindOfQuantityProps.persistenceUnit);\r\n if (undefined === persistenceUnit)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Unit ${kindOfQuantityProps.persistenceUnit} does not exist.`);\r\n\r\n if (persistenceUnit.schemaItemType !== SchemaItemType.Unit && persistenceUnit.schemaItemType !== SchemaItemType.InvertedUnit)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The item ${kindOfQuantityProps.persistenceUnit} is not a Unit or InvertedUnit.`);\r\n\r\n this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);\r\n\r\n if (undefined !== kindOfQuantityProps.presentationUnits)\r\n await this.processPresentationUnits(kindOfQuantityProps.presentationUnits);\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected setRelativeError(relativeError: number): void {\r\n this._relativeError = relativeError;\r\n }\r\n}\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableKindOfQuantity extends KindOfQuantity {\r\n public abstract override addPresentationFormat(format: Format | OverrideFormat, isDefault: boolean): void;\r\n public abstract override createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[Unit | InvertedUnit, string | undefined]>): OverrideFormat;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"KindOfQuantity.js","sourceRoot":"","sources":["../../../src/Metadata/KindOfQuantity.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/D,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,UAAU;IAA9C;;QAC2B,mBAAc,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC,wDAAwD;QACvH,mBAAc,GAAW,GAAG,CAAC;QAC7B,yBAAoB,GAAmC,IAAI,KAAK,EAA2B,CAAC;IA2LxG,CAAC;IAxLC,4DAA4D;IAC5D,IAAW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;QAE7H,IAAI,eAAe,CAAC,cAAc,KAAK,cAAc,CAAC,IAAI,IAAI,eAAe,CAAC,cAAc,KAAK,cAAc,CAAC,YAAY;YAC1H,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,aAAa,EAAE,YAAY,mBAAmB,CAAC,eAAe,iCAAiC,CAAC,CAAC;QAE5I,IAAI,CAAC,gBAAgB,GAAG,IAAI,uBAAuB,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,eAAe,CAAC,CAAC;QAEtG,IAAI,SAAS,KAAK,mBAAmB,CAAC,iBAAiB;YACrD,MAAM,IAAI,CAAC,wBAAwB,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;IAC/E,CAAC;IAED;;;OAGG;IACO,gBAAgB,CAAC,aAAqB;QAC9C,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACtC,CAAC;CACF;AACD;;;GAGG;AACH,MAAM,OAAgB,qBAAsB,SAAQ,cAAc;CAIjE","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 { KindOfQuantityProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\nimport { LazyLoadedInvertedUnit, LazyLoadedUnit } from \"../Interfaces\";\nimport { Format } from \"./Format\";\nimport { InvertedUnit } from \"./InvertedUnit\";\nimport { OverrideFormat, OverrideFormatProps } from \"./OverrideFormat\";\nimport { SchemaItem } from \"./SchemaItem\";\nimport { Unit } from \"./Unit\";\n\n/** A Typescript class representation of a KindOfQuantity.\n * @beta\n */\nexport class KindOfQuantity extends SchemaItem {\n public override readonly schemaItemType = SchemaItemType.KindOfQuantity; // Needed to allow both run-time and compile-time check.\n protected _relativeError: number = 1.0;\n protected _presentationFormats: Array<Format | OverrideFormat> = new Array<Format | OverrideFormat>();\n protected _persistenceUnit?: LazyLoadedUnit | LazyLoadedInvertedUnit;\n\n /** The first presentation format in the list of Formats. */\n public get defaultPresentationFormat(): Format | OverrideFormat | undefined { return this.presentationFormats[0]; }\n\n /** A list of presentation formats. */\n public get presentationFormats(): Array<Format | OverrideFormat> { return this._presentationFormats; }\n\n public get persistenceUnit(): LazyLoadedUnit | LazyLoadedInvertedUnit | undefined { return this._persistenceUnit; }\n protected set persistenceUnit(value: LazyLoadedUnit | LazyLoadedInvertedUnit | undefined) { this._persistenceUnit = value; }\n\n public get relativeError() { return this._relativeError; }\n\n /**\n *\n * @param format The Format to add to this KindOfQuantity\n * @param isDefault\n */\n protected addPresentationFormat(format: Format | OverrideFormat, isDefault: boolean = false) {\n // TODO: Add some sort of validation?\n (isDefault) ? this._presentationFormats.splice(0, 0, format) : this._presentationFormats.push(format);\n }\n\n /** Creates an OverrideFormat in the context of this KindOfQuantity.\n * @param parent The Format to override.\n * @param precision The precision override\n * @param unitLabelOverrides The list of unit and label overrides.\n */\n protected createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[Unit | InvertedUnit, string | undefined]>): OverrideFormat {\n if (unitLabelOverrides && parent.units && parent.units.length !== unitLabelOverrides.length)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Cannot add presentation format to KindOfQuantity '${this.name}' because the number of unit overrides is inconsistent with the number in the Format '${parent.name}'.`);\n\n if (parent.units && 0 === parent.units.length && unitLabelOverrides && 0 < unitLabelOverrides.length)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Cannot add a presentation format to KindOfQuantity '${this.name}' without any units and no unit overrides.`);\n\n // TODO: Check compatibility of Unit overrides with the persistence unit\n\n return new OverrideFormat(parent, precision, unitLabelOverrides);\n }\n\n private async processPresentationUnits(presentationUnitsJson: string | string[]): Promise<void> {\n const presUnitsArr = Array.isArray(presentationUnitsJson) ? presentationUnitsJson : presentationUnitsJson.split(\";\");\n for (const formatString of presUnitsArr) {\n const presFormatOverride: OverrideFormatProps = OverrideFormat.parseFormatString(formatString);\n\n const format = await this.schema.lookupItem<Format>(presFormatOverride.name);\n if (undefined === format || format.schemaItemType !== SchemaItemType.Format)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate Format '${presFormatOverride.name}' for the presentation unit on KindOfQuantity ${this.fullName}.`);\n\n if (undefined === presFormatOverride.precision && undefined === presFormatOverride.unitAndLabels) {\n this.addPresentationFormat(format);\n continue;\n }\n\n let unitAndLabels: Array<[Unit | InvertedUnit, string | undefined]> | undefined;\n if (undefined !== presFormatOverride.unitAndLabels) {\n if (4 < presFormatOverride.unitAndLabels.length)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\n\n unitAndLabels = [];\n for (const unitOverride of presFormatOverride.unitAndLabels) {\n const unit = await this.schema.lookupItem<Unit | InvertedUnit>(unitOverride[0]);\n if (undefined === unit)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate SchemaItem ${unitOverride[0]}.`);\n\n unitAndLabels.push([unit, unitOverride[1]]);\n }\n }\n\n const overrideFormat: OverrideFormat = this.createFormatOverride(format, presFormatOverride.precision, unitAndLabels);\n this.addPresentationFormat(overrideFormat);\n }\n }\n\n private processPresentationUnitsSync(presentationUnitsJson: string | string[]): void {\n const presUnitsArr = Array.isArray(presentationUnitsJson) ? presentationUnitsJson : presentationUnitsJson.split(\";\");\n for (const formatString of presUnitsArr) {\n const presFormatOverride: OverrideFormatProps = OverrideFormat.parseFormatString(formatString);\n\n const format = this.schema.lookupItemSync<Format>(presFormatOverride.name);\n if (undefined === format || format.schemaItemType !== SchemaItemType.Format)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate Format '${presFormatOverride.name}' for the presentation unit on KindOfQuantity ${this.fullName}.`);\n\n if (undefined === presFormatOverride.precision && undefined === presFormatOverride.unitAndLabels) {\n this.addPresentationFormat(format);\n continue;\n }\n\n let unitAndLabels: Array<[Unit | InvertedUnit, string | undefined]> | undefined;\n if (undefined !== presFormatOverride.unitAndLabels) {\n if (4 < presFormatOverride.unitAndLabels.length)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\n\n unitAndLabels = [];\n for (const unitOverride of presFormatOverride.unitAndLabels) {\n const unit = this.schema.lookupItemSync<Unit | InvertedUnit>(unitOverride[0]);\n if (undefined === unit)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate SchemaItem ${unitOverride[0]}.`);\n\n unitAndLabels.push([unit, unitOverride[1]]);\n }\n }\n\n const overrideFormat: OverrideFormat = this.createFormatOverride(format, presFormatOverride.precision, unitAndLabels);\n this.addPresentationFormat(overrideFormat);\n }\n }\n\n /**\n * Save this KindOfQuantity'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): KindOfQuantityProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.relativeError = this.relativeError;\n schemaJson.persistenceUnit = this.persistenceUnit!.fullName;\n if (undefined !== this.presentationFormats && 0 < this.presentationFormats.length)\n schemaJson.presentationUnits = this.presentationFormats.map((format: Format | OverrideFormat) => format.fullName);\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n\n const persistenceUnit = await this.persistenceUnit;\n if (undefined !== persistenceUnit) {\n const unitName = XmlSerializationUtils.createXmlTypedName(this.schema, persistenceUnit.schema, persistenceUnit.name);\n itemElement.setAttribute(\"persistenceUnit\", unitName);\n }\n\n if (undefined !== this.presentationFormats) {\n const presUnitStrings = this.presentationFormats.map((format: Format | OverrideFormat) => {\n if (!OverrideFormat.isOverrideFormat(format))\n return XmlSerializationUtils.createXmlTypedName(this.schema, format.schema, format.name);\n return format.fullNameXml(this.schema);\n });\n itemElement.setAttribute(\"presentationUnits\", presUnitStrings.join(\";\"));\n }\n itemElement.setAttribute(\"relativeError\", this.relativeError.toString());\n\n return itemElement;\n }\n\n public override fromJSONSync(kindOfQuantityProps: KindOfQuantityProps): void {\n super.fromJSONSync(kindOfQuantityProps);\n this._relativeError = kindOfQuantityProps.relativeError;\n\n const persistenceUnit = this.schema.lookupItemSync<Unit>(kindOfQuantityProps.persistenceUnit);\n if (undefined === persistenceUnit)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Unit ${kindOfQuantityProps.persistenceUnit} does not exist.`);\n\n if (persistenceUnit.schemaItemType !== SchemaItemType.Unit && persistenceUnit.schemaItemType !== SchemaItemType.InvertedUnit)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The item ${kindOfQuantityProps.persistenceUnit} is not a Unit or InvertedUnit.`);\n\n this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);\n\n if (undefined !== kindOfQuantityProps.presentationUnits)\n this.processPresentationUnitsSync(kindOfQuantityProps.presentationUnits);\n }\n\n public override async fromJSON(kindOfQuantityProps: KindOfQuantityProps): Promise<void> {\n await super.fromJSON(kindOfQuantityProps);\n this._relativeError = kindOfQuantityProps.relativeError;\n\n const persistenceUnit = await this.schema.lookupItem<Unit>(kindOfQuantityProps.persistenceUnit);\n if (undefined === persistenceUnit)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Unit ${kindOfQuantityProps.persistenceUnit} does not exist.`);\n\n if (persistenceUnit.schemaItemType !== SchemaItemType.Unit && persistenceUnit.schemaItemType !== SchemaItemType.InvertedUnit)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The item ${kindOfQuantityProps.persistenceUnit} is not a Unit or InvertedUnit.`);\n\n this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);\n\n if (undefined !== kindOfQuantityProps.presentationUnits)\n await this.processPresentationUnits(kindOfQuantityProps.presentationUnits);\n }\n\n /**\n * @alpha\n * Used for schema editing.\n */\n protected setRelativeError(relativeError: number): void {\n this._relativeError = relativeError;\n }\n}\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableKindOfQuantity extends KindOfQuantity {\n public abstract override addPresentationFormat(format: Format | OverrideFormat, isDefault: boolean): void;\n public abstract override createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[Unit | InvertedUnit, string | undefined]>): OverrideFormat;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
@@ -14,7 +14,7 @@ import { Schema } from "./Schema";
14
14
  * @beta
15
15
  */
16
16
  export declare class Mixin extends ECClass {
17
- readonly schemaItemType: SchemaItemType.Mixin;
17
+ readonly schemaItemType = SchemaItemType.Mixin;
18
18
  protected _appliesTo?: LazyLoadedEntityClass;
19
19
  get appliesTo(): LazyLoadedEntityClass | undefined;
20
20
  constructor(schema: Schema, name: string);
@@ -1 +1 @@
1
- {"version":3,"file":"Mixin.d.ts","sourceRoot":"","sources":["../../../src/Metadata/Mixin.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAmB,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAElF,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAA0D,WAAW,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;GAGG;AACH,qBAAa,KAAM,SAAQ,OAAO;IAChC,SAA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B,wBAAwB,EAChG,KAAK,IAAI,EAAE;YACT,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAc,wBAAwB,CAAC,CAAC;YACtF,IAAI,SAAS,KAAK,SAAS;gBACzB,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,aAAa,EAAE,kCAAkC,UAAU,CAAC,SAAS,GAAG,CAAC,CAAC;YACrH,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;IAEe,KAAK,CAAC,QAAQ,CAAC,UAAsB;QACnD,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,WAAwB;QAChD,IAAI,CAAC,IAAI,CAAC,SAAS;YACjB,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,WAAW,EAAE,uCAAuC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAEjH,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC;QACvC,IAAI,SAAS,KAAK,SAAS;YACzB,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,WAAW,EAAE,kCAAkC,IAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,CAAC,CAAC;QAEtH,OAAO,SAAS,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;CACF;AACD;;;GAGG;AACH,MAAM,OAAgB,YAAa,SAAQ,KAAK;CAK/C","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 { MixinProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { ECClassModifier, SchemaItemType, StrengthDirection } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { LazyLoadedEntityClass } from \"../Interfaces\";\r\nimport { SchemaItemKey } from \"../SchemaKey\";\r\nimport { ECClass } from \"./Class\";\r\nimport { createNavigationProperty, createNavigationPropertySync, EntityClass } from \"./EntityClass\";\r\nimport { NavigationProperty } from \"./Property\";\r\nimport { RelationshipClass } from \"./RelationshipClass\";\r\nimport { Schema } from \"./Schema\";\r\n\r\n/**\r\n * A Typescript class representation of a Mixin.\r\n * @beta\r\n */\r\nexport class Mixin extends ECClass {\r\n public override readonly schemaItemType!: SchemaItemType.Mixin;\r\n protected _appliesTo?: LazyLoadedEntityClass;\r\n\r\n public get appliesTo(): LazyLoadedEntityClass | undefined {\r\n return this._appliesTo;\r\n }\r\n\r\n constructor(schema: Schema, name: string) {\r\n super(schema, name, ECClassModifier.Abstract);\r\n this.schemaItemType = SchemaItemType.Mixin;\r\n }\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 setAppliesTo(appliesTo: LazyLoadedEntityClass) {\r\n this._appliesTo = appliesTo;\r\n }\r\n /**\r\n * Save this Mixin'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): MixinProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n if (undefined !== this.appliesTo) {\r\n schemaJson.appliesTo = this.appliesTo.fullName;\r\n }\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\r\n // When CustomAttributes are added, there must be a check to see if the ECCustomAttributes\r\n // already exist for this item before creating a new one to apply IsMixin\r\n const customAttributes = schemaXml.createElement(\"ECCustomAttributes\");\r\n const isMixinElement = schemaXml.createElement(\"IsMixin\");\r\n const coreCustomSchema = this.schema.getReferenceSync(\"CoreCustomAttributes\");\r\n if (undefined !== coreCustomSchema) {\r\n const xmlns = `CoreCustomAttributes.${coreCustomSchema.schemaKey.version.toString()}`;\r\n isMixinElement.setAttribute(\"xmlns\", xmlns);\r\n }\r\n\r\n const appliesToElement = schemaXml.createElement(\"AppliesToEntityClass\");\r\n const appliesTo = await this.appliesTo;\r\n if (undefined !== appliesTo) {\r\n const appliesToName = XmlSerializationUtils.createXmlTypedName(this.schema, appliesTo.schema, appliesTo.name);\r\n appliesToElement.textContent = appliesToName;\r\n isMixinElement.appendChild(appliesToElement);\r\n }\r\n\r\n customAttributes.appendChild(isMixinElement);\r\n itemElement.appendChild(customAttributes);\r\n\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(mixinProps: MixinProps) {\r\n super.fromJSONSync(mixinProps);\r\n const entityClassSchemaItemKey = this.schema.getSchemaItemKey(mixinProps.appliesTo);\r\n if (!entityClassSchemaItemKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the appliesTo ${mixinProps.appliesTo}.`);\r\n this._appliesTo = new DelayedPromiseWithProps<SchemaItemKey, EntityClass>(entityClassSchemaItemKey,\r\n async () => {\r\n const appliesTo = await this.schema.lookupItem<EntityClass>(entityClassSchemaItemKey);\r\n if (undefined === appliesTo)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the appliesTo ${mixinProps.appliesTo}.`);\r\n return appliesTo;\r\n });\r\n }\r\n\r\n public override async fromJSON(mixinProps: MixinProps) {\r\n this.fromJSONSync(mixinProps);\r\n }\r\n\r\n public async applicableTo(entityClass: EntityClass) {\r\n if (!this.appliesTo)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidType, `appliesTo is undefined in the class ${this.fullName}.`);\r\n\r\n const appliesTo = await this.appliesTo;\r\n if (appliesTo === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidType, `Unable to locate the appliesTo ${this.appliesTo.fullName}.`);\r\n\r\n return appliesTo.is(entityClass);\r\n }\r\n}\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableMixin extends Mixin {\r\n public abstract override setAppliesTo(entityClass: LazyLoadedEntityClass): 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"]}
1
+ {"version":3,"file":"Mixin.js","sourceRoot":"","sources":["../../../src/Metadata/Mixin.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,cAAc,EAAqB,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAe,MAAM,eAAe,CAAC;AAKpG;;;GAGG;AACH,MAAM,OAAO,KAAM,SAAQ,OAAO;IAIhC,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,YAAY,M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MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAc,wBAAwB,CAAC,CAAC;YACtF,IAAI,SAAS,KAAK,SAAS;gBACzB,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,aAAa,EAAE,kCAAkC,UAAU,CAAC,SAAS,GAAG,CAAC,CAAC;YACrH,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;IAEe,KAAK,CAAC,QAAQ,CAAC,UAAsB;QACnD,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,WAAwB;QAChD,IAAI,CAAC,IAAI,CAAC,SAAS;YACjB,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,WAAW,EAAE,uCAAuC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAEjH,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC;QACvC,IAAI,SAAS,KAAK,SAAS;YACzB,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,WAAW,EAAE,kCAAkC,IAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,CAAC,CAAC;QAEtH,OAAO,SAAS,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;CACF;AACD;;;GAGG;AACH,MAAM,OAAgB,YAAa,SAAQ,KAAK;CAK/C","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 { MixinProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { ECClassModifier, SchemaItemType, StrengthDirection } from \"../ECObjects\";\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\nimport { LazyLoadedEntityClass } from \"../Interfaces\";\nimport { SchemaItemKey } from \"../SchemaKey\";\nimport { ECClass } from \"./Class\";\nimport { createNavigationProperty, createNavigationPropertySync, EntityClass } from \"./EntityClass\";\nimport { NavigationProperty } from \"./Property\";\nimport { RelationshipClass } from \"./RelationshipClass\";\nimport { Schema } from \"./Schema\";\n\n/**\n * A Typescript class representation of a Mixin.\n * @beta\n */\nexport class Mixin extends ECClass {\n public override readonly schemaItemType = SchemaItemType.Mixin;\n protected _appliesTo?: LazyLoadedEntityClass;\n\n public get appliesTo(): LazyLoadedEntityClass | undefined {\n return this._appliesTo;\n }\n\n constructor(schema: Schema, name: string) {\n super(schema, name, ECClassModifier.Abstract);\n }\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 setAppliesTo(appliesTo: LazyLoadedEntityClass) {\n this._appliesTo = appliesTo;\n }\n /**\n * Save this Mixin'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): MixinProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n if (undefined !== this.appliesTo) {\n schemaJson.appliesTo = this.appliesTo.fullName;\n }\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n\n // When CustomAttributes are added, there must be a check to see if the ECCustomAttributes\n // already exist for this item before creating a new one to apply IsMixin\n const customAttributes = schemaXml.createElement(\"ECCustomAttributes\");\n const isMixinElement = schemaXml.createElement(\"IsMixin\");\n const coreCustomSchema = this.schema.getReferenceSync(\"CoreCustomAttributes\");\n if (undefined !== coreCustomSchema) {\n const xmlns = `CoreCustomAttributes.${coreCustomSchema.schemaKey.version.toString()}`;\n isMixinElement.setAttribute(\"xmlns\", xmlns);\n }\n\n const appliesToElement = schemaXml.createElement(\"AppliesToEntityClass\");\n const appliesTo = await this.appliesTo;\n if (undefined !== appliesTo) {\n const appliesToName = XmlSerializationUtils.createXmlTypedName(this.schema, appliesTo.schema, appliesTo.name);\n appliesToElement.textContent = appliesToName;\n isMixinElement.appendChild(appliesToElement);\n }\n\n customAttributes.appendChild(isMixinElement);\n itemElement.appendChild(customAttributes);\n\n return itemElement;\n }\n\n public override fromJSONSync(mixinProps: MixinProps) {\n super.fromJSONSync(mixinProps);\n const entityClassSchemaItemKey = this.schema.getSchemaItemKey(mixinProps.appliesTo);\n if (!entityClassSchemaItemKey)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the appliesTo ${mixinProps.appliesTo}.`);\n this._appliesTo = new DelayedPromiseWithProps<SchemaItemKey, EntityClass>(entityClassSchemaItemKey,\n async () => {\n const appliesTo = await this.schema.lookupItem<EntityClass>(entityClassSchemaItemKey);\n if (undefined === appliesTo)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the appliesTo ${mixinProps.appliesTo}.`);\n return appliesTo;\n });\n }\n\n public override async fromJSON(mixinProps: MixinProps) {\n this.fromJSONSync(mixinProps);\n }\n\n public async applicableTo(entityClass: EntityClass) {\n if (!this.appliesTo)\n throw new ECObjectsError(ECObjectsStatus.InvalidType, `appliesTo is undefined in the class ${this.fullName}.`);\n\n const appliesTo = await this.appliesTo;\n if (appliesTo === undefined)\n throw new ECObjectsError(ECObjectsStatus.InvalidType, `Unable to locate the appliesTo ${this.appliesTo.fullName}.`);\n\n return appliesTo.is(entityClass);\n }\n}\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableMixin extends Mixin {\n public abstract override setAppliesTo(entityClass: LazyLoadedEntityClass): 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 +1 @@
1
- {"version":3,"file":"OverrideFormat.js","sourceRoot":"","sources":["../../../src/Metadata/OverrideFormat.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAiC,eAAe,EAAiF,MAAM,sBAAsB,CAAC;AAOrK,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAW/D;;;GAGG;AACH,MAAM,OAAO,cAAc;IAazB,YAAY,MAAc,EAAE,SAAkD,EAAE,aAAgE;QAC9I,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,4BAA4B,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;QAC1F,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC;IAC9B,CAAC;IAED,mCAAmC;IACnC,IAAW,SAAS,KAA6C,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IACpJ,IAAW,KAAK,KAAK,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAA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CAAC;YAED,UAAU,CAAC,SAAS,GAAG;gBACrB,MAAM,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;gBACvD,WAAW,EAAE,CAAC,IAAI,CAAC,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;gBACxE,KAAK;aACN,CAAC;QACJ,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,MAA+B;IAC5D,OAAO,cAAc,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;AAC7F,CAAC","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 { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { SchemaItemType } from \"../ECObjects\";\r\nimport { DecimalPrecision, FormatProps, formatStringRgx, FormatTraits, FormatType, FractionalPrecision, ScientificType, ShowSignOption } from \"@itwin/core-quantity\";\r\nimport { Format } from \"./Format\";\r\nimport { InvertedUnit } from \"./InvertedUnit\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItemOverrideFormatProps } from \"../Deserialization/JsonProps\";\r\nimport { Unit } from \"./Unit\";\r\nimport { Mutable } from \"@itwin/core-bentley\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface OverrideFormatProps {\r\n name: string;\r\n precision?: number;\r\n unitAndLabels?: Array<[string, string | undefined]>; // Tuple of [unit name | unit label]\r\n}\r\n\r\n/**\r\n * Overrides of a Format, from a Schema, and is SchemaItem that is used specifically on KindOfQuantity.\r\n * @beta\r\n */\r\nexport class OverrideFormat {\r\n private _precision?: DecimalPrecision | FractionalPrecision;\r\n private _units?: Array<[Unit | InvertedUnit, string | undefined]>;\r\n\r\n /** The Format that this OverrideFormat is extending */\r\n public readonly parent: Format;\r\n\r\n /** The name of this OverrideFormat.\r\n *\r\n * This should be set to the [FormatString]($docs/bis/ec/kindofquantity/#format-string) which represents the format override.\r\n */\r\n public readonly name: string;\r\n\r\n constructor(parent: Format, precision?: DecimalPrecision | FractionalPrecision, unitAndLabels?: Array<[Unit | InvertedUnit, string | undefined]>) {\r\n this.parent = parent;\r\n this.name = OverrideFormat.createOverrideFormatFullName(parent, precision, unitAndLabels);\r\n this._precision = precision;\r\n this._units = unitAndLabels;\r\n }\r\n\r\n // Properties that can be overriden\r\n public get precision(): DecimalPrecision | FractionalPrecision { return (undefined === this._precision) ? this.parent.precision : this._precision; }\r\n public get units() { return (undefined === this._units) ? this.parent.units : this._units; }\r\n\r\n // Properties that cannot be overriden\r\n public get fullName(): string { return this.name; }\r\n public get roundFactor(): number { return this.parent.roundFactor; }\r\n public get type(): FormatType { return this.parent.type; }\r\n public get minWidth(): number | undefined { return this.parent.minWidth; }\r\n public get scientificType(): ScientificType | undefined { return this.parent.scientificType; }\r\n public get showSignOption(): ShowSignOption { return this.parent.showSignOption; }\r\n public get decimalSeparator(): string { return this.parent.decimalSeparator; }\r\n public get thousandSeparator(): string { return this.parent.thousandSeparator; }\r\n public get uomSeparator(): string { return this.parent.uomSeparator; }\r\n public get stationSeparator(): string { return this.parent.stationSeparator; }\r\n public get stationOffsetSize(): number | undefined { return this.parent.stationOffsetSize; }\r\n public get formatTraits(): FormatTraits { return this.parent.formatTraits; }\r\n public get spacer(): string | undefined { return this.parent.spacer; }\r\n public get includeZero(): boolean | undefined { return this.parent.includeZero; }\r\n\r\n public hasFormatTrait(formatTrait: FormatTraits) {\r\n return (this.parent.formatTraits & formatTrait) === formatTrait;\r\n }\r\n\r\n /** Returns the format string of this override in the Xml full name format.\r\n * @alpha\r\n */\r\n public fullNameXml(koqSchema: Schema): string {\r\n let fullName = XmlSerializationUtils.createXmlTypedName(koqSchema, this.parent.schema, this.parent.name);\r\n\r\n if (undefined !== this.precision)\r\n fullName += `(${this.precision.toString()})`;\r\n\r\n if (undefined === this._units)\r\n return fullName;\r\n for (const [unit, unitLabel] of this._units) {\r\n fullName += \"[\";\r\n fullName += XmlSerializationUtils.createXmlTypedName(koqSchema, unit.schema, unit.name);\r\n if (unitLabel !== undefined)\r\n fullName += `|${unitLabel}`;\r\n fullName += `]`;\r\n }\r\n return fullName;\r\n }\r\n\r\n /**\r\n * Creates a valid OverrideFormat fullName from the parent Format and overridden units.\r\n * @param parent The parent Format.\r\n * @param unitAndLabels The overridden unit and labels collection.\r\n */\r\n public static createOverrideFormatFullName(parent: Format, precision?: DecimalPrecision | FractionalPrecision, unitAndLabels?: Array<[Unit | InvertedUnit, string | undefined]>): string {\r\n let fullName = parent.fullName;\r\n\r\n if (precision)\r\n fullName += `(${precision.toString()})`;\r\n\r\n if (undefined === unitAndLabels)\r\n return fullName;\r\n for (const [unit, unitLabel] of unitAndLabels)\r\n if (undefined === unitLabel)\r\n fullName += `[${unit.fullName}]`;\r\n else\r\n fullName += `[${unit.fullName}|${unitLabel}]`;\r\n return fullName;\r\n }\r\n\r\n /** Parses the format string into the parts that make up an Override Format\r\n * @param formatString\r\n */\r\n public static parseFormatString(formatString: string): OverrideFormatProps {\r\n const match = formatString.split(formatStringRgx); // split string based on regex groups\r\n if (undefined === match[1])\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The format string, ${formatString}, on KindOfQuantity is missing a format.`);\r\n\r\n const returnValue: OverrideFormatProps = { name: match[1] };\r\n\r\n if (undefined !== match[2] && undefined !== match[3]) {\r\n const overrideString = match[2];\r\n const tokens: string[] = [];\r\n let prevPos = 1; // Initial position is the character directly after the opening '(' in the override string.\r\n let currPos;\r\n\r\n // TODO need to include `,` as a valid search argument.\r\n while (-1 !== (currPos = overrideString.indexOf(\")\", prevPos))) {\r\n tokens.push(overrideString.substring(prevPos, currPos));\r\n prevPos = currPos + 1;\r\n }\r\n\r\n if (overrideString.length > 0 && undefined === tokens.find((token) => {\r\n return \"\" !== token; // there is at least one token that is not empty.\r\n })) {\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\r\n }\r\n\r\n // The first override parameter overrides the default precision of the format\r\n const precisionIndx: number = 0;\r\n\r\n if (tokens.length >= precisionIndx + 1) {\r\n if (tokens[precisionIndx].length > 0) {\r\n const precision = Number.parseInt(tokens[precisionIndx], 10);\r\n if (Number.isNaN(precision))\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The format string '${formatString}' on KindOfQuantity has a precision override '${tokens[precisionIndx]}' that is not number.`);\r\n returnValue.precision = precision;\r\n }\r\n }\r\n }\r\n\r\n let i = 4;\r\n while (i < match.length - 1) { // The regex match ends with an empty last value, which causes problems when exactly 4 unit overrides as specified, so ignore this last empty value\r\n if (undefined === match[i])\r\n break;\r\n // Unit override required\r\n if (undefined === match[i + 1])\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\r\n\r\n if (undefined === returnValue.unitAndLabels)\r\n returnValue.unitAndLabels = [];\r\n\r\n if (undefined !== match[i + 2]) // matches '|'\r\n returnValue.unitAndLabels.push([match[i + 1], match[i + 3] ?? \"\"]); // add unit name and label override (if '|' matches and next value is undefined, save it as an empty string)\r\n else\r\n returnValue.unitAndLabels.push([match[i + 1], undefined]); // add unit name\r\n\r\n i += 4;\r\n }\r\n\r\n return returnValue;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static isOverrideFormat(object: any): object is OverrideFormat {\r\n const overrideFormat = object as OverrideFormat;\r\n\r\n return overrideFormat !== undefined && overrideFormat.name !== undefined && overrideFormat.parent !== undefined && overrideFormat.parent.schemaItemType === SchemaItemType.Format;\r\n }\r\n\r\n /**\r\n * Returns a JSON object that contains the specification for the OverrideFormat where the precision and units properties have been overriden.\r\n * If the precision and/or units properties have been overriden, the returned object will contain a \"name\" and a \"parent\" property.\r\n * The \"name\" property identifies the OverrideFormat object itself and the \"parent\" property identifies the Format that has been overriden.\r\n * This method is not intended for complete serialization as it does not serialize any of the schema item properties.\r\n */\r\n public getFormatProps(): SchemaItemOverrideFormatProps {\r\n const formatJson = this.parent.toJSON() as Mutable<SchemaItemOverrideFormatProps>;\r\n\r\n if (this.parent.fullName !== this.fullName) {\r\n // Update name and parent properties to distinguish it from parent Format\r\n formatJson.name = this.fullName;\r\n formatJson.parent = this.parent.fullName;\r\n }\r\n\r\n // Update Precision overriden property\r\n formatJson.precision = this.precision;\r\n\r\n if (this.units !== undefined) {\r\n // Update Units overriden property\r\n const units = [];\r\n for (const unit of this.units) {\r\n units.push({\r\n name: unit[0].fullName,\r\n label: unit[1],\r\n });\r\n }\r\n\r\n formatJson.composite = {\r\n spacer: (this.spacer !== \" \") ? this.spacer : undefined,\r\n includeZero: (this.includeZero === false) ? this.includeZero : undefined,\r\n units,\r\n };\r\n }\r\n\r\n return formatJson;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function getFormatProps(format: Format | OverrideFormat): FormatProps {\r\n return OverrideFormat.isOverrideFormat(format) ? format.getFormatProps() : format.toJSON();\r\n}\r\n"]}
1
+ {"version":3,"file":"OverrideFormat.js","sourceRoot":"","sources":["../../../src/Metadata/OverrideFormat.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAiC,eAAe,EAAiF,MAAM,sBAAsB,CAAC;AAOrK,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAW/D;;;GAGG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AC;QAElF,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC3C,yEAAyE;YACzE,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC;YAChC,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC3C,CAAC;QAED,sCAAsC;QACtC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAEtC,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC7B,kCAAkC;YAClC,MAAM,KAAK,GAAG,EAAE,CAAC;YACjB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBAC9B,KAAK,CAAC,IAAI,CAAC;oBACT,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ;oBACtB,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;iBACf,CAAC,CAAC;YACL,CAAC;YAED,UAAU,CAAC,SAAS,GAAG;gBACrB,MAAM,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;gBACvD,WAAW,EAAE,CAAC,IAAI,CAAC,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;gBACxE,KAAK;aACN,CAAC;QACJ,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,MAA+B;IAC5D,OAAO,cAAc,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;AAC7F,CAAC","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 { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { DecimalPrecision, FormatProps, formatStringRgx, FormatTraits, FormatType, FractionalPrecision, ScientificType, ShowSignOption } from \"@itwin/core-quantity\";\nimport { Format } from \"./Format\";\nimport { InvertedUnit } from \"./InvertedUnit\";\nimport { Schema } from \"./Schema\";\nimport { SchemaItemOverrideFormatProps } from \"../Deserialization/JsonProps\";\nimport { Unit } from \"./Unit\";\nimport { Mutable } from \"@itwin/core-bentley\";\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\n\n/**\n * @beta\n */\nexport interface OverrideFormatProps {\n name: string;\n precision?: number;\n unitAndLabels?: Array<[string, string | undefined]>; // Tuple of [unit name | unit label]\n}\n\n/**\n * Overrides of a Format, from a Schema, and is SchemaItem that is used specifically on KindOfQuantity.\n * @beta\n */\nexport class OverrideFormat {\n private _precision?: DecimalPrecision | FractionalPrecision;\n private _units?: Array<[Unit | InvertedUnit, string | undefined]>;\n\n /** The Format that this OverrideFormat is extending */\n public readonly parent: Format;\n\n /** The name of this OverrideFormat.\n *\n * This should be set to the [FormatString]($docs/bis/ec/kindofquantity/#format-string) which represents the format override.\n */\n public readonly name: string;\n\n constructor(parent: Format, precision?: DecimalPrecision | FractionalPrecision, unitAndLabels?: Array<[Unit | InvertedUnit, string | undefined]>) {\n this.parent = parent;\n this.name = OverrideFormat.createOverrideFormatFullName(parent, precision, unitAndLabels);\n this._precision = precision;\n this._units = unitAndLabels;\n }\n\n // Properties that can be overriden\n public get precision(): DecimalPrecision | FractionalPrecision { return (undefined === this._precision) ? this.parent.precision : this._precision; }\n public get units() { return (undefined === this._units) ? this.parent.units : this._units; }\n\n // Properties that cannot be overriden\n public get fullName(): string { return this.name; }\n public get roundFactor(): number { return this.parent.roundFactor; }\n public get type(): FormatType { return this.parent.type; }\n public get minWidth(): number | undefined { return this.parent.minWidth; }\n public get scientificType(): ScientificType | undefined { return this.parent.scientificType; }\n public get showSignOption(): ShowSignOption { return this.parent.showSignOption; }\n public get decimalSeparator(): string { return this.parent.decimalSeparator; }\n public get thousandSeparator(): string { return this.parent.thousandSeparator; }\n public get uomSeparator(): string { return this.parent.uomSeparator; }\n public get stationSeparator(): string { return this.parent.stationSeparator; }\n public get stationOffsetSize(): number | undefined { return this.parent.stationOffsetSize; }\n public get formatTraits(): FormatTraits { return this.parent.formatTraits; }\n public get spacer(): string | undefined { return this.parent.spacer; }\n public get includeZero(): boolean | undefined { return this.parent.includeZero; }\n\n public hasFormatTrait(formatTrait: FormatTraits) {\n return (this.parent.formatTraits & formatTrait) === formatTrait;\n }\n\n /** Returns the format string of this override in the Xml full name format.\n * @alpha\n */\n public fullNameXml(koqSchema: Schema): string {\n let fullName = XmlSerializationUtils.createXmlTypedName(koqSchema, this.parent.schema, this.parent.name);\n\n if (undefined !== this.precision)\n fullName += `(${this.precision.toString()})`;\n\n if (undefined === this._units)\n return fullName;\n for (const [unit, unitLabel] of this._units) {\n fullName += \"[\";\n fullName += XmlSerializationUtils.createXmlTypedName(koqSchema, unit.schema, unit.name);\n if (unitLabel !== undefined)\n fullName += `|${unitLabel}`;\n fullName += `]`;\n }\n return fullName;\n }\n\n /**\n * Creates a valid OverrideFormat fullName from the parent Format and overridden units.\n * @param parent The parent Format.\n * @param unitAndLabels The overridden unit and labels collection.\n */\n public static createOverrideFormatFullName(parent: Format, precision?: DecimalPrecision | FractionalPrecision, unitAndLabels?: Array<[Unit | InvertedUnit, string | undefined]>): string {\n let fullName = parent.fullName;\n\n if (precision)\n fullName += `(${precision.toString()})`;\n\n if (undefined === unitAndLabels)\n return fullName;\n for (const [unit, unitLabel] of unitAndLabels)\n if (undefined === unitLabel)\n fullName += `[${unit.fullName}]`;\n else\n fullName += `[${unit.fullName}|${unitLabel}]`;\n return fullName;\n }\n\n /** Parses the format string into the parts that make up an Override Format\n * @param formatString\n */\n public static parseFormatString(formatString: string): OverrideFormatProps {\n const match = formatString.split(formatStringRgx); // split string based on regex groups\n if (undefined === match[1])\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The format string, ${formatString}, on KindOfQuantity is missing a format.`);\n\n const returnValue: OverrideFormatProps = { name: match[1] };\n\n if (undefined !== match[2] && undefined !== match[3]) {\n const overrideString = match[2];\n const tokens: string[] = [];\n let prevPos = 1; // Initial position is the character directly after the opening '(' in the override string.\n let currPos;\n\n // TODO need to include `,` as a valid search argument.\n while (-1 !== (currPos = overrideString.indexOf(\")\", prevPos))) {\n tokens.push(overrideString.substring(prevPos, currPos));\n prevPos = currPos + 1;\n }\n\n if (overrideString.length > 0 && undefined === tokens.find((token) => {\n return \"\" !== token; // there is at least one token that is not empty.\n })) {\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\n }\n\n // The first override parameter overrides the default precision of the format\n const precisionIndx: number = 0;\n\n if (tokens.length >= precisionIndx + 1) {\n if (tokens[precisionIndx].length > 0) {\n const precision = Number.parseInt(tokens[precisionIndx], 10);\n if (Number.isNaN(precision))\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The format string '${formatString}' on KindOfQuantity has a precision override '${tokens[precisionIndx]}' that is not number.`);\n returnValue.precision = precision;\n }\n }\n }\n\n let i = 4;\n while (i < match.length - 1) { // The regex match ends with an empty last value, which causes problems when exactly 4 unit overrides as specified, so ignore this last empty value\n if (undefined === match[i])\n break;\n // Unit override required\n if (undefined === match[i + 1])\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\n\n if (undefined === returnValue.unitAndLabels)\n returnValue.unitAndLabels = [];\n\n if (undefined !== match[i + 2]) // matches '|'\n returnValue.unitAndLabels.push([match[i + 1], match[i + 3] ?? \"\"]); // add unit name and label override (if '|' matches and next value is undefined, save it as an empty string)\n else\n returnValue.unitAndLabels.push([match[i + 1], undefined]); // add unit name\n\n i += 4;\n }\n\n return returnValue;\n }\n\n /**\n * @internal\n */\n public static isOverrideFormat(object: any): object is OverrideFormat {\n const overrideFormat = object as OverrideFormat;\n\n return overrideFormat !== undefined && overrideFormat.name !== undefined && overrideFormat.parent !== undefined && overrideFormat.parent.schemaItemType === SchemaItemType.Format;\n }\n\n /**\n * Returns a JSON object that contains the specification for the OverrideFormat where the precision and units properties have been overriden.\n * If the precision and/or units properties have been overriden, the returned object will contain a \"name\" and a \"parent\" property.\n * The \"name\" property identifies the OverrideFormat object itself and the \"parent\" property identifies the Format that has been overriden.\n * This method is not intended for complete serialization as it does not serialize any of the schema item properties.\n */\n public getFormatProps(): SchemaItemOverrideFormatProps {\n const formatJson = this.parent.toJSON() as Mutable<SchemaItemOverrideFormatProps>;\n\n if (this.parent.fullName !== this.fullName) {\n // Update name and parent properties to distinguish it from parent Format\n formatJson.name = this.fullName;\n formatJson.parent = this.parent.fullName;\n }\n\n // Update Precision overriden property\n formatJson.precision = this.precision;\n\n if (this.units !== undefined) {\n // Update Units overriden property\n const units = [];\n for (const unit of this.units) {\n units.push({\n name: unit[0].fullName,\n label: unit[1],\n });\n }\n\n formatJson.composite = {\n spacer: (this.spacer !== \" \") ? this.spacer : undefined,\n includeZero: (this.includeZero === false) ? this.includeZero : undefined,\n units,\n };\n }\n\n return formatJson;\n }\n}\n\n/**\n * @internal\n */\nexport function getFormatProps(format: Format | OverrideFormat): FormatProps {\n return OverrideFormat.isOverrideFormat(format) ? format.getFormatProps() : format.toJSON();\n}\n"]}
@@ -7,7 +7,7 @@ import { Schema } from "./Schema";
7
7
  import { SchemaItem } from "./SchemaItem";
8
8
  /** @beta */
9
9
  export declare class Phenomenon extends SchemaItem {
10
- readonly schemaItemType: SchemaItemType.Phenomenon;
10
+ readonly schemaItemType = SchemaItemType.Phenomenon;
11
11
  protected _definition: string;
12
12
  constructor(schema: Schema, name: string);
13
13
  get definition(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"Phenomenon.d.ts","sourceRoot":"","sources":["../../../src/Metadata/Phenomenon.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,YAAY;AACZ,qBAAa,UAAW,SAAQ,UAAU;IACxC,SAAyB,cAAc,EAAG,cAAc,CAAC,UAAU,CAAC;IACpE,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;gBAElB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAMxC,IAAW,UAAU,IAAI,MAAM,CAA6B;IAE5D;;;;OAIG;IACa,MAAM,CAAC,UAAU,GAAE,OAAe,EAAE,oBAAoB,GAAE,OAAe,GAAG,eAAe;IAM3G,gBAAgB;IACM,KAAK,CAAC,SAAS,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAMlD,YAAY,CAAC,eAAe,EAAE,eAAe;IAQvC,QAAQ,CAAC,eAAe,EAAE,eAAe;cAI/C,aAAa,CAAC,UAAU,EAAE,MAAM;CAGjD;AAED;;;GAGG;AACH,8BAAsB,iBAAkB,SAAQ,UAAU;aAC/B,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;aAChD,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;CACrE"}
1
+ {"version":3,"file":"Phenomenon.d.ts","sourceRoot":"","sources":["../../../src/Metadata/Phenomenon.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAA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O,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAE5D;;;;OAIG;IACa,MAAM,CAAC,aAAsB,KAAK,EAAE,uBAAgC,KAAK;QACvF,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,oBAAoB,CAAQ,CAAC;QACzE,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACxC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,gBAAgB;IACA,KAAK,CAAC,KAAK,CAAC,SAAmB;QAC7C,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACjD,WAAW,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACxD,OAAO,WAAW,CAAC;IACrB,CAAC;IAEe,YAAY,CAAC,eAAgC;QAC3D,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;QACpC,IAAI,IAAI,CAAC,WAAW,KAAK,EAAE,IAAI,eAAe,CAAC,UAAU,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE;YACxG,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,aAAa,EAAE,kBAAkB,IAAI,CAAC,IAAI,yCAAyC,CAAC,CAAC;aAC3H,IAAI,IAAI,CAAC,WAAW,KAAK,EAAE;YAC9B,IAAI,CAAC,WAAW,GAAG,eAAe,CAAC,UAAU,CAAC;IAClD,CAAC;IAEe,KAAK,CAAC,QAAQ,CAAC,eAAgC;QAC7D,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IACrC,CAAC;IAES,KAAK,CAAC,aAAa,CAAC,UAAkB;QAC9C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAgB,iBAAkB,SAAQ,UAAU;CAGzD","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 { PhenomenonProps } from \"../Deserialization/JsonProps\";\r\nimport { SchemaItemType } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\n\r\n/** @beta */\r\nexport class Phenomenon extends SchemaItem {\r\n public override readonly schemaItemType!: SchemaItemType.Phenomenon;\r\n protected _definition: string; // Contains a combination of Phenomena names which form this Phenomenon. Each Phenomena name is separated by a * and may have an exponent, specified using parentheses\r\n\r\n constructor(schema: Schema, name: string) {\r\n super(schema, name);\r\n this.schemaItemType = SchemaItemType.Phenomenon;\r\n this._definition = \"\";\r\n }\r\n\r\n public get definition(): string { return this._definition; }\r\n\r\n /**\r\n * Save this Phenomenon'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): PhenomenonProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n schemaJson.definition = this.definition;\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(\"definition\", this.definition);\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(phenomenonProps: PhenomenonProps) {\r\n super.fromJSONSync(phenomenonProps);\r\n if (this._definition !== \"\" && phenomenonProps.definition.toLowerCase() !== this._definition.toLowerCase())\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Phenomenon ${this.name} has an invalid 'definition' attribute.`);\r\n else if (this._definition === \"\")\r\n this._definition = phenomenonProps.definition;\r\n }\r\n\r\n public override async fromJSON(phenomenonProps: PhenomenonProps) {\r\n this.fromJSONSync(phenomenonProps);\r\n }\r\n\r\n protected async setDefinition(definition: string) {\r\n this._definition = definition;\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 MutablePhenomenon extends Phenomenon {\r\n public abstract override setDefinition(definition: string): Promise<void>;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"Phenomenon.js","sourceRoot":"","sources":["../../../src/Metadata/Phenomenon.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,YAAY;AACZ,MAAM,OAAO,UAAW,SAAQ,UAAU;IAIxC,YAAY,MAAc,EAAE,IAAY;QACtC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAJG,mBAAc,GAAG,cAAc,CAAC,UAAU,CAAC;QAKlE,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;IAED,IAAW,UAAU,KAAa,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAE5D;;;;OAIG;IACa,MAAM,CAAC,aAAsB,KAAK,EAAE,uBAAgC,KAAK;QACvF,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,oBAAoB,CAAQ,CAAC;QACzE,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACxC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,gBAAgB;IACA,KAAK,CAAC,KAAK,CAAC,SAAmB;QAC7C,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACjD,WAAW,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACxD,OAAO,WAAW,CAAC;IACrB,CAAC;IAEe,YAAY,CAAC,eAAgC;QAC3D,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;QACpC,IAAI,IAAI,CAAC,WAAW,KAAK,EAAE,IAAI,eAAe,CAAC,UAAU,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE;YACxG,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,aAAa,EAAE,kBAAkB,IAAI,CAAC,IAAI,yCAAyC,CAAC,CAAC;aAC3H,IAAI,IAAI,CAAC,WAAW,KAAK,EAAE;YAC9B,IAAI,CAAC,WAAW,GAAG,eAAe,CAAC,UAAU,CAAC;IAClD,CAAC;IAEe,KAAK,CAAC,QAAQ,CAAC,eAAgC;QAC7D,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IACrC,CAAC;IAES,KAAK,CAAC,aAAa,CAAC,UAAkB;QAC9C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAgB,iBAAkB,SAAQ,UAAU;CAGzD","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 { PhenomenonProps } from \"../Deserialization/JsonProps\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\nimport { Schema } from \"./Schema\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/** @beta */\nexport class Phenomenon extends SchemaItem {\n public override readonly schemaItemType = SchemaItemType.Phenomenon;\n protected _definition: string; // Contains a combination of Phenomena names which form this Phenomenon. Each Phenomena name is separated by a * and may have an exponent, specified using parentheses\n\n constructor(schema: Schema, name: string) {\n super(schema, name);\n this._definition = \"\";\n }\n\n public get definition(): string { return this._definition; }\n\n /**\n * Save this Phenomenon'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): PhenomenonProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.definition = this.definition;\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(\"definition\", this.definition);\n return itemElement;\n }\n\n public override fromJSONSync(phenomenonProps: PhenomenonProps) {\n super.fromJSONSync(phenomenonProps);\n if (this._definition !== \"\" && phenomenonProps.definition.toLowerCase() !== this._definition.toLowerCase())\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Phenomenon ${this.name} has an invalid 'definition' attribute.`);\n else if (this._definition === \"\")\n this._definition = phenomenonProps.definition;\n }\n\n public override async fromJSON(phenomenonProps: PhenomenonProps) {\n this.fromJSONSync(phenomenonProps);\n }\n\n protected async setDefinition(definition: string) {\n this._definition = definition;\n }\n}\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutablePhenomenon extends Phenomenon {\n public abstract override setDefinition(definition: string): Promise<void>;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Property.d.ts","sourceRoot":"","sources":["../../../src/Metadata/Property.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EACe,wBAAwB,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,gCAAgC,EACpI,sBAAsB,EAAE,aAAa,EAAE,mBAAmB,EAC3D,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAsB,aAAa,EAAyB,iBAAiB,EAA6B,MAAM,cAAc,CAAC;AAEtI,OAAO,EAAE,QAAQ,EAAE,qBAAq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AC;AACvG,YAAY;AACZ,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,GAAG,sBAAsB,CAAC;AAC9E,YAAY;AACZ,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,GAAG,wBAAwB,CAAC;AACpF,YAAY;AACZ,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG,mBAAmB,CAAC;AACrE,YAAY;AACZ,MAAM,MAAM,WAAW,GAAG,oBAAoB,GAAG,sBAAsB,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;AAEjH;;;GAGG;AACH,8BAAsB,eAAgB,SAAQ,QAAQ;aAC3B,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI;CACpF"}
@@ -32,9 +32,33 @@ export class Property {
32
32
  get label() { return this._label; }
33
33
  get description() { return this._description; }
34
34
  get isReadOnly() { return this._isReadOnly || false; }
35
- get priority() { return this._priority || 0; }
36
- get category() { return this._category; }
37
- get kindOfQuantity() { return this._kindOfQuantity; }
35
+ get priority() {
36
+ if (this._priority === undefined) {
37
+ const baseProperty = this.class.getInheritedPropertySync(this.name);
38
+ if (undefined !== baseProperty) {
39
+ return baseProperty.priority;
40
+ }
41
+ }
42
+ return this._priority || 0;
43
+ }
44
+ get category() {
45
+ if (this._category === undefined) {
46
+ const baseProperty = this.class.getInheritedPropertySync(this.name);
47
+ if (undefined !== baseProperty) {
48
+ return baseProperty.category;
49
+ }
50
+ }
51
+ return this._category;
52
+ }
53
+ get kindOfQuantity() {
54
+ if (this._kindOfQuantity === undefined) {
55
+ const baseProperty = this.class.getInheritedPropertySync(this.name);
56
+ if (undefined !== baseProperty) {
57
+ return baseProperty.kindOfQuantity;
58
+ }
59
+ }
60
+ return this._kindOfQuantity;
61
+ }
38
62
  get propertyType() { return this._type; }
39
63
  get customAttributes() { return this._customAttributes; }
40
64
  /** Returns the name in the format 'ClassName.PropertyName'. */
@@ -42,13 +66,23 @@ export class Property {
42
66
  /** Returns the schema of the class holding the property. */
43
67
  get schema() { return this._class.schema; }
44
68
  getCategorySync() {
45
- if (!this._category)
69
+ if (!this._category) {
70
+ const baseProperty = this.class.getInheritedPropertySync(this.name);
71
+ if (undefined !== baseProperty) {
72
+ return baseProperty.getCategorySync();
73
+ }
46
74
  return undefined;
75
+ }
47
76
  return this.class.schema.lookupItemSync(this._category);
48
77
  }
49
78
  getKindOfQuantitySync() {
50
- if (!this._kindOfQuantity)
79
+ if (!this._kindOfQuantity) {
80
+ const baseProperty = this.class.getInheritedPropertySync(this.name);
81
+ if (undefined !== baseProperty) {
82
+ return baseProperty.getKindOfQuantitySync();
83
+ }
51
84
  return undefined;
85
+ }
52
86
  return this.class.schema.lookupItemSync(this._kindOfQuantity);
53
87
  }
54
88
  /**
@@ -64,12 +98,12 @@ export class Property {
64
98
  schemaJson.label = this.label;
65
99
  if (this._isReadOnly !== undefined)
66
100
  schemaJson.isReadOnly = this._isReadOnly;
67
- if (this.category !== undefined)
68
- schemaJson.category = this.category.fullName; // needs to be fully qualified name
101
+ if (this._category !== undefined)
102
+ schemaJson.category = this._category.fullName; // needs to be fully qualified name
69
103
  if (this._priority !== undefined)
70
104
  schemaJson.priority = this._priority;
71
- if (this.kindOfQuantity !== undefined)
72
- schemaJson.kindOfQuantity = this.kindOfQuantity.fullName;
105
+ if (this._kindOfQuantity !== undefined)
106
+ schemaJson.kindOfQuantity = this._kindOfQuantity.fullName;
73
107
  const customAttributes = serializeCustomAttributes(this.customAttributes);
74
108
  if (customAttributes !== undefined)
75
109
  schemaJson.customAttributes = customAttributes;
@@ -86,15 +120,15 @@ export class Property {
86
120
  itemElement.setAttribute("displayLabel", this.label);
87
121
  if (undefined !== this.isReadOnly)
88
122
  itemElement.setAttribute("readOnly", String(this.isReadOnly));
89
- if (undefined !== this.category) {
90
- const category = await this.category;
123
+ if (undefined !== this._category) {
124
+ const category = await this._category;
91
125
  const categoryName = XmlSerializationUtils.createXmlTypedName(this.schema, category.schema, category.name);
92
126
  itemElement.setAttribute("category", categoryName);
93
127
  }
94
- if (undefined !== this.priority)
95
- itemElement.setAttribute("priority", this.priority.toString());
96
- if (undefined !== this.kindOfQuantity) {
97
- const kindOfQuantity = await this.kindOfQuantity;
128
+ if (undefined !== this._priority)
129
+ itemElement.setAttribute("priority", this._priority.toString());
130
+ if (undefined !== this._kindOfQuantity) {
131
+ const kindOfQuantity = await this._kindOfQuantity;
98
132
  const kindOfQuantityName = XmlSerializationUtils.createXmlTypedName(this.schema, kindOfQuantity.schema, kindOfQuantity.name);
99
133
  itemElement.setAttribute("kindOfQuantity", kindOfQuantityName);
100
134
  }