@itwin/ecschema-metadata 4.0.0-dev.10 → 4.0.0-dev.101

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 (156) hide show
  1. package/CHANGELOG.md +51 -1
  2. package/lib/cjs/Constants.d.ts +23 -23
  3. package/lib/cjs/Constants.js +33 -33
  4. package/lib/cjs/Constants.js.map +1 -1
  5. package/lib/cjs/Context.d.ts +139 -139
  6. package/lib/cjs/Context.js +204 -204
  7. package/lib/cjs/DelayedPromise.d.ts +88 -88
  8. package/lib/cjs/DelayedPromise.d.ts.map +1 -1
  9. package/lib/cjs/DelayedPromise.js +91 -91
  10. package/lib/cjs/DelayedPromise.js.map +1 -1
  11. package/lib/cjs/Deserialization/AbstractParser.d.ts +45 -45
  12. package/lib/cjs/Deserialization/AbstractParser.d.ts.map +1 -1
  13. package/lib/cjs/Deserialization/AbstractParser.js +11 -11
  14. package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
  15. package/lib/cjs/Deserialization/Helper.d.ts +251 -251
  16. package/lib/cjs/Deserialization/Helper.js +843 -843
  17. package/lib/cjs/Deserialization/Helper.js.map +1 -1
  18. package/lib/cjs/Deserialization/JsonParser.d.ts +165 -165
  19. package/lib/cjs/Deserialization/JsonParser.d.ts.map +1 -1
  20. package/lib/cjs/Deserialization/JsonParser.js +680 -680
  21. package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
  22. package/lib/cjs/Deserialization/JsonProps.d.ts +268 -282
  23. package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
  24. package/lib/cjs/Deserialization/JsonProps.js +9 -9
  25. package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
  26. package/lib/cjs/Deserialization/SchemaGraphUtil.d.ts +34 -34
  27. package/lib/cjs/Deserialization/SchemaGraphUtil.js +77 -77
  28. package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
  29. package/lib/cjs/Deserialization/XmlParser.d.ts +85 -85
  30. package/lib/cjs/Deserialization/XmlParser.d.ts.map +1 -1
  31. package/lib/cjs/Deserialization/XmlParser.js +973 -973
  32. package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
  33. package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts +54 -54
  34. package/lib/cjs/Deserialization/XmlSerializationUtils.js +174 -174
  35. package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
  36. package/lib/cjs/ECName.d.ts +30 -30
  37. package/lib/cjs/ECName.js +85 -85
  38. package/lib/cjs/ECName.js.map +1 -1
  39. package/lib/cjs/ECObjects.d.ts +162 -162
  40. package/lib/cjs/ECObjects.js +453 -453
  41. package/lib/cjs/ECObjects.js.map +1 -1
  42. package/lib/cjs/Exception.d.ts +43 -43
  43. package/lib/cjs/Exception.js +84 -84
  44. package/lib/cjs/Exception.js.map +1 -1
  45. package/lib/cjs/Interfaces.d.ts +66 -66
  46. package/lib/cjs/Interfaces.d.ts.map +1 -1
  47. package/lib/cjs/Interfaces.js +9 -9
  48. package/lib/cjs/Interfaces.js.map +1 -1
  49. package/lib/cjs/Metadata/Class.d.ts +243 -243
  50. package/lib/cjs/Metadata/Class.js +558 -558
  51. package/lib/cjs/Metadata/Class.js.map +1 -1
  52. package/lib/cjs/Metadata/Constant.d.ts +64 -64
  53. package/lib/cjs/Metadata/Constant.js +123 -123
  54. package/lib/cjs/Metadata/Constant.js.map +1 -1
  55. package/lib/cjs/Metadata/CustomAttribute.d.ts +23 -23
  56. package/lib/cjs/Metadata/CustomAttribute.js +27 -27
  57. package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
  58. package/lib/cjs/Metadata/CustomAttributeClass.d.ts +39 -39
  59. package/lib/cjs/Metadata/CustomAttributeClass.js +68 -68
  60. package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
  61. package/lib/cjs/Metadata/EntityClass.d.ts +77 -77
  62. package/lib/cjs/Metadata/EntityClass.js +230 -230
  63. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  64. package/lib/cjs/Metadata/Enumeration.d.ts +86 -86
  65. package/lib/cjs/Metadata/Enumeration.d.ts.map +1 -1
  66. package/lib/cjs/Metadata/Enumeration.js +159 -159
  67. package/lib/cjs/Metadata/Enumeration.js.map +1 -1
  68. package/lib/cjs/Metadata/Format.d.ts +98 -98
  69. package/lib/cjs/Metadata/Format.d.ts.map +1 -1
  70. package/lib/cjs/Metadata/Format.js +242 -242
  71. package/lib/cjs/Metadata/Format.js.map +1 -1
  72. package/lib/cjs/Metadata/InvertedUnit.d.ts +49 -49
  73. package/lib/cjs/Metadata/InvertedUnit.js +97 -97
  74. package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
  75. package/lib/cjs/Metadata/KindOfQuantity.d.ts +65 -65
  76. package/lib/cjs/Metadata/KindOfQuantity.js +225 -225
  77. package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
  78. package/lib/cjs/Metadata/Mixin.d.ts +54 -54
  79. package/lib/cjs/Metadata/Mixin.js +113 -113
  80. package/lib/cjs/Metadata/Mixin.js.map +1 -1
  81. package/lib/cjs/Metadata/OverrideFormat.d.ts +67 -55
  82. package/lib/cjs/Metadata/OverrideFormat.d.ts.map +1 -1
  83. package/lib/cjs/Metadata/OverrideFormat.js +126 -88
  84. package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
  85. package/lib/cjs/Metadata/Phenomenon.d.ts +33 -33
  86. package/lib/cjs/Metadata/Phenomenon.js +59 -59
  87. package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
  88. package/lib/cjs/Metadata/Property.d.ts +197 -197
  89. package/lib/cjs/Metadata/Property.d.ts.map +1 -1
  90. package/lib/cjs/Metadata/Property.js +491 -491
  91. package/lib/cjs/Metadata/Property.js.map +1 -1
  92. package/lib/cjs/Metadata/PropertyCategory.d.ts +39 -39
  93. package/lib/cjs/Metadata/PropertyCategory.js +61 -61
  94. package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
  95. package/lib/cjs/Metadata/RelationshipClass.d.ts +152 -152
  96. package/lib/cjs/Metadata/RelationshipClass.js +349 -349
  97. package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
  98. package/lib/cjs/Metadata/Schema.d.ts +291 -291
  99. package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
  100. package/lib/cjs/Metadata/Schema.js +520 -520
  101. package/lib/cjs/Metadata/Schema.js.map +1 -1
  102. package/lib/cjs/Metadata/SchemaItem.d.ts +61 -61
  103. package/lib/cjs/Metadata/SchemaItem.js +136 -136
  104. package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
  105. package/lib/cjs/Metadata/Unit.d.ts +76 -76
  106. package/lib/cjs/Metadata/Unit.d.ts.map +1 -1
  107. package/lib/cjs/Metadata/Unit.js +162 -162
  108. package/lib/cjs/Metadata/Unit.js.map +1 -1
  109. package/lib/cjs/Metadata/UnitSystem.d.ts +20 -20
  110. package/lib/cjs/Metadata/UnitSystem.js +29 -29
  111. package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
  112. package/lib/cjs/PropertyTypes.d.ts +49 -49
  113. package/lib/cjs/PropertyTypes.js +91 -91
  114. package/lib/cjs/PropertyTypes.js.map +1 -1
  115. package/lib/cjs/SchemaJsonLocater.d.ts +34 -34
  116. package/lib/cjs/SchemaJsonLocater.d.ts.map +1 -1
  117. package/lib/cjs/SchemaJsonLocater.js +42 -42
  118. package/lib/cjs/SchemaJsonLocater.js.map +1 -1
  119. package/lib/cjs/SchemaKey.d.ts +110 -110
  120. package/lib/cjs/SchemaKey.js +219 -219
  121. package/lib/cjs/SchemaKey.js.map +1 -1
  122. package/lib/cjs/SchemaLoader.d.ts +23 -23
  123. package/lib/cjs/SchemaLoader.js +47 -47
  124. package/lib/cjs/SchemaLoader.js.map +1 -1
  125. package/lib/cjs/SchemaPartVisitorDelegate.d.ts +274 -274
  126. package/lib/cjs/SchemaPartVisitorDelegate.js +212 -212
  127. package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
  128. package/lib/cjs/UnitConversion/Graph.d.ts +34 -34
  129. package/lib/cjs/UnitConversion/Graph.js +83 -83
  130. package/lib/cjs/UnitConversion/Graph.js.map +1 -1
  131. package/lib/cjs/UnitConversion/Parser.d.ts +8 -8
  132. package/lib/cjs/UnitConversion/Parser.js +42 -42
  133. package/lib/cjs/UnitConversion/Parser.js.map +1 -1
  134. package/lib/cjs/UnitConversion/UnitConversion.d.ts +45 -45
  135. package/lib/cjs/UnitConversion/UnitConversion.js +77 -77
  136. package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
  137. package/lib/cjs/UnitConversion/UnitConverter.d.ts +39 -39
  138. package/lib/cjs/UnitConversion/UnitConverter.js +116 -116
  139. package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
  140. package/lib/cjs/UnitConversion/UnitTree.d.ts +43 -43
  141. package/lib/cjs/UnitConversion/UnitTree.js +169 -169
  142. package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
  143. package/lib/cjs/UnitProvider/SchemaUnitProvider.d.ts +77 -77
  144. package/lib/cjs/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
  145. package/lib/cjs/UnitProvider/SchemaUnitProvider.js +234 -236
  146. package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
  147. package/lib/cjs/Validation/SchemaWalker.d.ts +23 -23
  148. package/lib/cjs/Validation/SchemaWalker.js +53 -53
  149. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  150. package/lib/cjs/ecschema-metadata.d.ts +51 -51
  151. package/lib/cjs/ecschema-metadata.js +100 -96
  152. package/lib/cjs/ecschema-metadata.js.map +1 -1
  153. package/lib/cjs/utils/SchemaGraph.d.ts +25 -25
  154. package/lib/cjs/utils/SchemaGraph.js +65 -65
  155. package/lib/cjs/utils/SchemaGraph.js.map +1 -1
  156. package/package.json +13 -14
@@ -1,50 +1,50 @@
1
- /** @packageDocumentation
2
- * @module Metadata
3
- */
4
- import { InvertedUnitProps } from "../Deserialization/JsonProps";
5
- import { SchemaItemType } from "../ECObjects";
6
- import { LazyLoadedUnit, LazyLoadedUnitSystem } from "../Interfaces";
7
- import { Schema } from "./Schema";
8
- import { SchemaItem } from "./SchemaItem";
9
- /**
10
- * An InvertedUnit is a specific type of Unit that describes the inverse of a single Unit whose dimensional derivation is unit-less.
11
- * @beta
12
- */
13
- export declare class InvertedUnit extends SchemaItem {
14
- readonly schemaItemType: SchemaItemType.InvertedUnit;
15
- protected _invertsUnit?: LazyLoadedUnit;
16
- protected _unitSystem?: LazyLoadedUnitSystem;
17
- constructor(schema: Schema, name: string);
18
- get invertsUnit(): LazyLoadedUnit | undefined;
19
- get unitSystem(): LazyLoadedUnitSystem | undefined;
20
- /**
21
- * Save this InvertedUnit's properties to an object for serializing to JSON.
22
- * @param standalone Serialization includes only this object (as opposed to the full schema).
23
- * @param includeSchemaVersion Include the Schema's version information in the serialized object.
24
- */
25
- toJSON(standalone?: boolean, includeSchemaVersion?: boolean): InvertedUnitProps;
26
- /** @internal */
27
- toXml(schemaXml: Document): Promise<Element>;
28
- fromJSONSync(invertedUnitProps: InvertedUnitProps): void;
29
- fromJSON(invertedUnitProps: InvertedUnitProps): Promise<void>;
30
- /**
31
- * @alpha
32
- * Used for schema editing
33
- */
34
- protected setInvertsUnit(invertsUnit: LazyLoadedUnit): void;
35
- /**
36
- * @alpha
37
- * Used for schema editing
38
- */
39
- protected setUnitSystem(unitSystem: LazyLoadedUnitSystem): void;
40
- }
41
- /**
42
- * @internal
43
- * An abstract class used for schema editing.
44
- */
45
- export declare abstract class MutableInvertedUnit extends InvertedUnit {
46
- abstract setInvertsUnit(invertsUnit: LazyLoadedUnit): void;
47
- abstract setUnitSystem(unitSystem: LazyLoadedUnitSystem): void;
48
- abstract setDisplayLabel(displayLabel: string): void;
49
- }
1
+ /** @packageDocumentation
2
+ * @module Metadata
3
+ */
4
+ import { InvertedUnitProps } from "../Deserialization/JsonProps";
5
+ import { SchemaItemType } from "../ECObjects";
6
+ import { LazyLoadedUnit, LazyLoadedUnitSystem } from "../Interfaces";
7
+ import { Schema } from "./Schema";
8
+ import { SchemaItem } from "./SchemaItem";
9
+ /**
10
+ * An InvertedUnit is a specific type of Unit that describes the inverse of a single Unit whose dimensional derivation is unit-less.
11
+ * @beta
12
+ */
13
+ export declare class InvertedUnit extends SchemaItem {
14
+ readonly schemaItemType: SchemaItemType.InvertedUnit;
15
+ protected _invertsUnit?: LazyLoadedUnit;
16
+ protected _unitSystem?: LazyLoadedUnitSystem;
17
+ constructor(schema: Schema, name: string);
18
+ get invertsUnit(): LazyLoadedUnit | undefined;
19
+ get unitSystem(): LazyLoadedUnitSystem | undefined;
20
+ /**
21
+ * Save this InvertedUnit's properties to an object for serializing to JSON.
22
+ * @param standalone Serialization includes only this object (as opposed to the full schema).
23
+ * @param includeSchemaVersion Include the Schema's version information in the serialized object.
24
+ */
25
+ toJSON(standalone?: boolean, includeSchemaVersion?: boolean): InvertedUnitProps;
26
+ /** @internal */
27
+ toXml(schemaXml: Document): Promise<Element>;
28
+ fromJSONSync(invertedUnitProps: InvertedUnitProps): void;
29
+ fromJSON(invertedUnitProps: InvertedUnitProps): Promise<void>;
30
+ /**
31
+ * @alpha
32
+ * Used for schema editing
33
+ */
34
+ protected setInvertsUnit(invertsUnit: LazyLoadedUnit): void;
35
+ /**
36
+ * @alpha
37
+ * Used for schema editing
38
+ */
39
+ protected setUnitSystem(unitSystem: LazyLoadedUnitSystem): void;
40
+ }
41
+ /**
42
+ * @internal
43
+ * An abstract class used for schema editing.
44
+ */
45
+ export declare abstract class MutableInvertedUnit extends InvertedUnit {
46
+ abstract setInvertsUnit(invertsUnit: LazyLoadedUnit): void;
47
+ abstract setUnitSystem(unitSystem: LazyLoadedUnitSystem): void;
48
+ abstract setDisplayLabel(displayLabel: string): void;
49
+ }
50
50
  //# sourceMappingURL=InvertedUnit.d.ts.map
@@ -1,98 +1,98 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module Metadata
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.MutableInvertedUnit = exports.InvertedUnit = void 0;
11
- const DelayedPromise_1 = require("../DelayedPromise");
12
- const XmlSerializationUtils_1 = require("../Deserialization/XmlSerializationUtils");
13
- const ECObjects_1 = require("../ECObjects");
14
- const Exception_1 = require("../Exception");
15
- const SchemaItem_1 = require("./SchemaItem");
16
- /**
17
- * An InvertedUnit is a specific type of Unit that describes the inverse of a single Unit whose dimensional derivation is unit-less.
18
- * @beta
19
- */
20
- class InvertedUnit extends SchemaItem_1.SchemaItem {
21
- constructor(schema, name) {
22
- super(schema, name);
23
- this.schemaItemType = ECObjects_1.SchemaItemType.InvertedUnit;
24
- }
25
- get invertsUnit() { return this._invertsUnit; }
26
- get unitSystem() { return this._unitSystem; }
27
- /**
28
- * Save this InvertedUnit's properties to an object for serializing to JSON.
29
- * @param standalone Serialization includes only this object (as opposed to the full schema).
30
- * @param includeSchemaVersion Include the Schema's version information in the serialized object.
31
- */
32
- toJSON(standalone = false, includeSchemaVersion = false) {
33
- const schemaJson = super.toJSON(standalone, includeSchemaVersion);
34
- schemaJson.invertsUnit = this.invertsUnit.fullName;
35
- schemaJson.unitSystem = this.unitSystem.fullName;
36
- return schemaJson;
37
- }
38
- /** @internal */
39
- async toXml(schemaXml) {
40
- const itemElement = await super.toXml(schemaXml);
41
- const unitSystem = await this.unitSystem;
42
- if (undefined !== unitSystem) {
43
- const unitSystemName = XmlSerializationUtils_1.XmlSerializationUtils.createXmlTypedName(this.schema, unitSystem.schema, unitSystem.name);
44
- itemElement.setAttribute("unitSystem", unitSystemName);
45
- }
46
- const invertsUnit = await this.invertsUnit;
47
- if (undefined !== invertsUnit) {
48
- const invertsUnitName = XmlSerializationUtils_1.XmlSerializationUtils.createXmlTypedName(this.schema, invertsUnit.schema, invertsUnit.name);
49
- itemElement.setAttribute("invertsUnit", invertsUnitName);
50
- }
51
- return itemElement;
52
- }
53
- fromJSONSync(invertedUnitProps) {
54
- super.fromJSONSync(invertedUnitProps);
55
- const unitSchemaItemKey = this.schema.getSchemaItemKey(invertedUnitProps.invertsUnit);
56
- this._invertsUnit = new DelayedPromise_1.DelayedPromiseWithProps(unitSchemaItemKey, async () => {
57
- const invertsUnit = await this.schema.lookupItem(unitSchemaItemKey);
58
- if (undefined === invertsUnit)
59
- throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidECJson, `Unable to locate the invertsUnit ${invertedUnitProps.invertsUnit}.`);
60
- return invertsUnit;
61
- });
62
- const unitSystemSchemaItemKey = this.schema.getSchemaItemKey(invertedUnitProps.unitSystem);
63
- if (!unitSystemSchemaItemKey)
64
- throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidECJson, `Unable to locate the unitSystem ${invertedUnitProps.unitSystem}.`);
65
- this._unitSystem = new DelayedPromise_1.DelayedPromiseWithProps(unitSystemSchemaItemKey, async () => {
66
- const unitSystem = await this.schema.lookupItem(unitSystemSchemaItemKey);
67
- if (undefined === unitSystem)
68
- throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidECJson, `Unable to locate the unitSystem ${invertedUnitProps.unitSystem}.`);
69
- return unitSystem;
70
- });
71
- }
72
- async fromJSON(invertedUnitProps) {
73
- this.fromJSONSync(invertedUnitProps);
74
- }
75
- /**
76
- * @alpha
77
- * Used for schema editing
78
- */
79
- setInvertsUnit(invertsUnit) {
80
- this._invertsUnit = invertsUnit;
81
- }
82
- /**
83
- * @alpha
84
- * Used for schema editing
85
- */
86
- setUnitSystem(unitSystem) {
87
- this._unitSystem = unitSystem;
88
- }
89
- }
90
- exports.InvertedUnit = InvertedUnit;
91
- /**
92
- * @internal
93
- * An abstract class used for schema editing.
94
- */
95
- class MutableInvertedUnit extends InvertedUnit {
96
- }
97
- exports.MutableInvertedUnit = MutableInvertedUnit;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Metadata
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.MutableInvertedUnit = exports.InvertedUnit = void 0;
11
+ const DelayedPromise_1 = require("../DelayedPromise");
12
+ const XmlSerializationUtils_1 = require("../Deserialization/XmlSerializationUtils");
13
+ const ECObjects_1 = require("../ECObjects");
14
+ const Exception_1 = require("../Exception");
15
+ const SchemaItem_1 = require("./SchemaItem");
16
+ /**
17
+ * An InvertedUnit is a specific type of Unit that describes the inverse of a single Unit whose dimensional derivation is unit-less.
18
+ * @beta
19
+ */
20
+ class InvertedUnit extends SchemaItem_1.SchemaItem {
21
+ constructor(schema, name) {
22
+ super(schema, name);
23
+ this.schemaItemType = ECObjects_1.SchemaItemType.InvertedUnit;
24
+ }
25
+ get invertsUnit() { return this._invertsUnit; }
26
+ get unitSystem() { return this._unitSystem; }
27
+ /**
28
+ * Save this InvertedUnit's properties to an object for serializing to JSON.
29
+ * @param standalone Serialization includes only this object (as opposed to the full schema).
30
+ * @param includeSchemaVersion Include the Schema's version information in the serialized object.
31
+ */
32
+ toJSON(standalone = false, includeSchemaVersion = false) {
33
+ const schemaJson = super.toJSON(standalone, includeSchemaVersion);
34
+ schemaJson.invertsUnit = this.invertsUnit.fullName;
35
+ schemaJson.unitSystem = this.unitSystem.fullName;
36
+ return schemaJson;
37
+ }
38
+ /** @internal */
39
+ async toXml(schemaXml) {
40
+ const itemElement = await super.toXml(schemaXml);
41
+ const unitSystem = await this.unitSystem;
42
+ if (undefined !== unitSystem) {
43
+ const unitSystemName = XmlSerializationUtils_1.XmlSerializationUtils.createXmlTypedName(this.schema, unitSystem.schema, unitSystem.name);
44
+ itemElement.setAttribute("unitSystem", unitSystemName);
45
+ }
46
+ const invertsUnit = await this.invertsUnit;
47
+ if (undefined !== invertsUnit) {
48
+ const invertsUnitName = XmlSerializationUtils_1.XmlSerializationUtils.createXmlTypedName(this.schema, invertsUnit.schema, invertsUnit.name);
49
+ itemElement.setAttribute("invertsUnit", invertsUnitName);
50
+ }
51
+ return itemElement;
52
+ }
53
+ fromJSONSync(invertedUnitProps) {
54
+ super.fromJSONSync(invertedUnitProps);
55
+ const unitSchemaItemKey = this.schema.getSchemaItemKey(invertedUnitProps.invertsUnit);
56
+ this._invertsUnit = new DelayedPromise_1.DelayedPromiseWithProps(unitSchemaItemKey, async () => {
57
+ const invertsUnit = await this.schema.lookupItem(unitSchemaItemKey);
58
+ if (undefined === invertsUnit)
59
+ throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidECJson, `Unable to locate the invertsUnit ${invertedUnitProps.invertsUnit}.`);
60
+ return invertsUnit;
61
+ });
62
+ const unitSystemSchemaItemKey = this.schema.getSchemaItemKey(invertedUnitProps.unitSystem);
63
+ if (!unitSystemSchemaItemKey)
64
+ throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidECJson, `Unable to locate the unitSystem ${invertedUnitProps.unitSystem}.`);
65
+ this._unitSystem = new DelayedPromise_1.DelayedPromiseWithProps(unitSystemSchemaItemKey, async () => {
66
+ const unitSystem = await this.schema.lookupItem(unitSystemSchemaItemKey);
67
+ if (undefined === unitSystem)
68
+ throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidECJson, `Unable to locate the unitSystem ${invertedUnitProps.unitSystem}.`);
69
+ return unitSystem;
70
+ });
71
+ }
72
+ async fromJSON(invertedUnitProps) {
73
+ this.fromJSONSync(invertedUnitProps);
74
+ }
75
+ /**
76
+ * @alpha
77
+ * Used for schema editing
78
+ */
79
+ setInvertsUnit(invertsUnit) {
80
+ this._invertsUnit = invertsUnit;
81
+ }
82
+ /**
83
+ * @alpha
84
+ * Used for schema editing
85
+ */
86
+ setUnitSystem(unitSystem) {
87
+ this._unitSystem = unitSystem;
88
+ }
89
+ }
90
+ exports.InvertedUnit = InvertedUnit;
91
+ /**
92
+ * @internal
93
+ * An abstract class used for schema editing.
94
+ */
95
+ class MutableInvertedUnit extends InvertedUnit {
96
+ }
97
+ exports.MutableInvertedUnit = MutableInvertedUnit;
98
98
  //# sourceMappingURL=InvertedUnit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InvertedUnit.js","sourceRoot":"","sources":["../../../src/Metadata/InvertedUnit.ts"],"names":[],"mappings":"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","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; // eslint-disable-line\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 * 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":"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","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 { Schema } from \"./Schema\";\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; // eslint-disable-line\n protected _invertsUnit?: LazyLoadedUnit; // required\n protected _unitSystem?: LazyLoadedUnitSystem; // required\n\n constructor(schema: Schema, name: string) {\n super(schema, name);\n this.schemaItemType = SchemaItemType.InvertedUnit;\n }\n\n public get invertsUnit(): LazyLoadedUnit | undefined { return this._invertsUnit; }\n public get unitSystem(): LazyLoadedUnitSystem | undefined { return this._unitSystem; }\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"]}
@@ -1,66 +1,66 @@
1
- /** @packageDocumentation
2
- * @module Metadata
3
- */
4
- import { KindOfQuantityProps } from "../Deserialization/JsonProps";
5
- import { SchemaItemType } from "../ECObjects";
6
- import { LazyLoadedInvertedUnit, LazyLoadedUnit } from "../Interfaces";
7
- import { Format } from "./Format";
8
- import { InvertedUnit } from "./InvertedUnit";
9
- import { OverrideFormat } from "./OverrideFormat";
10
- import { Schema } from "./Schema";
11
- import { SchemaItem } from "./SchemaItem";
12
- import { Unit } from "./Unit";
13
- /** A Typescript class representation of a KindOfQuantity.
14
- * @beta
15
- */
16
- export declare class KindOfQuantity extends SchemaItem {
17
- readonly schemaItemType: SchemaItemType.KindOfQuantity;
18
- protected _relativeError: number;
19
- protected _presentationFormats: Array<Format | OverrideFormat>;
20
- protected _persistenceUnit?: LazyLoadedUnit | LazyLoadedInvertedUnit;
21
- /** The first presentation format in the list of Formats. */
22
- get defaultPresentationFormat(): Format | OverrideFormat | undefined;
23
- /** A list of presentation formats. */
24
- get presentationFormats(): Array<Format | OverrideFormat>;
25
- get persistenceUnit(): LazyLoadedUnit | LazyLoadedInvertedUnit | undefined;
26
- get relativeError(): number;
27
- constructor(schema: Schema, name: string);
28
- /**
29
- *
30
- * @param format The Format to add to this KindOfQuantity
31
- * @param isDefault
32
- */
33
- protected addPresentationFormat(format: Format | OverrideFormat, isDefault?: boolean): void;
34
- /** Parses the format string into the parts that make up an Override Format
35
- * @param formatString
36
- */
37
- private parseFormatString;
38
- /** Creates an OverrideFormat in the context of this KindOfQuantity.
39
- * @param parent The Format to override.
40
- * @param precision The precision override
41
- * @param unitLabelOverrides The list of unit and label overrides.
42
- */
43
- protected createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[Unit | InvertedUnit, string | undefined]>): OverrideFormat;
44
- private processPresentationUnits;
45
- private processPresentationUnitsSync;
46
- /**
47
- * Save this KindOfQuantity's properties to an object for serializing to JSON.
48
- * @param standalone Serialization includes only this object (as opposed to the full schema).
49
- * @param includeSchemaVersion Include the Schema's version information in the serialized object.
50
- */
51
- toJSON(standalone?: boolean, includeSchemaVersion?: boolean): KindOfQuantityProps;
52
- /** @internal */
53
- toXml(schemaXml: Document): Promise<Element>;
54
- fromJSONSync(kindOfQuantityProps: KindOfQuantityProps): void;
55
- fromJSON(kindOfQuantityProps: KindOfQuantityProps): Promise<void>;
56
- }
57
- /**
58
- * @internal
59
- * An abstract class used for schema editing.
60
- */
61
- export declare abstract class MutableKindOfQuantity extends KindOfQuantity {
62
- abstract addPresentationFormat(format: Format | OverrideFormat, isDefault: boolean): void;
63
- abstract createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[Unit | InvertedUnit, string | undefined]>): OverrideFormat;
64
- abstract setDisplayLabel(displayLabel: string): void;
65
- }
1
+ /** @packageDocumentation
2
+ * @module Metadata
3
+ */
4
+ import { KindOfQuantityProps } from "../Deserialization/JsonProps";
5
+ import { SchemaItemType } from "../ECObjects";
6
+ import { LazyLoadedInvertedUnit, LazyLoadedUnit } from "../Interfaces";
7
+ import { Format } from "./Format";
8
+ import { InvertedUnit } from "./InvertedUnit";
9
+ import { OverrideFormat } from "./OverrideFormat";
10
+ import { Schema } from "./Schema";
11
+ import { SchemaItem } from "./SchemaItem";
12
+ import { Unit } from "./Unit";
13
+ /** A Typescript class representation of a KindOfQuantity.
14
+ * @beta
15
+ */
16
+ export declare class KindOfQuantity extends SchemaItem {
17
+ readonly schemaItemType: SchemaItemType.KindOfQuantity;
18
+ protected _relativeError: number;
19
+ protected _presentationFormats: Array<Format | OverrideFormat>;
20
+ protected _persistenceUnit?: LazyLoadedUnit | LazyLoadedInvertedUnit;
21
+ /** The first presentation format in the list of Formats. */
22
+ get defaultPresentationFormat(): Format | OverrideFormat | undefined;
23
+ /** A list of presentation formats. */
24
+ get presentationFormats(): Array<Format | OverrideFormat>;
25
+ get persistenceUnit(): LazyLoadedUnit | LazyLoadedInvertedUnit | undefined;
26
+ get relativeError(): number;
27
+ constructor(schema: Schema, name: string);
28
+ /**
29
+ *
30
+ * @param format The Format to add to this KindOfQuantity
31
+ * @param isDefault
32
+ */
33
+ protected addPresentationFormat(format: Format | OverrideFormat, isDefault?: boolean): void;
34
+ /** Parses the format string into the parts that make up an Override Format
35
+ * @param formatString
36
+ */
37
+ private parseFormatString;
38
+ /** Creates an OverrideFormat in the context of this KindOfQuantity.
39
+ * @param parent The Format to override.
40
+ * @param precision The precision override
41
+ * @param unitLabelOverrides The list of unit and label overrides.
42
+ */
43
+ protected createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[Unit | InvertedUnit, string | undefined]>): OverrideFormat;
44
+ private processPresentationUnits;
45
+ private processPresentationUnitsSync;
46
+ /**
47
+ * Save this KindOfQuantity's properties to an object for serializing to JSON.
48
+ * @param standalone Serialization includes only this object (as opposed to the full schema).
49
+ * @param includeSchemaVersion Include the Schema's version information in the serialized object.
50
+ */
51
+ toJSON(standalone?: boolean, includeSchemaVersion?: boolean): KindOfQuantityProps;
52
+ /** @internal */
53
+ toXml(schemaXml: Document): Promise<Element>;
54
+ fromJSONSync(kindOfQuantityProps: KindOfQuantityProps): void;
55
+ fromJSON(kindOfQuantityProps: KindOfQuantityProps): Promise<void>;
56
+ }
57
+ /**
58
+ * @internal
59
+ * An abstract class used for schema editing.
60
+ */
61
+ export declare abstract class MutableKindOfQuantity extends KindOfQuantity {
62
+ abstract addPresentationFormat(format: Format | OverrideFormat, isDefault: boolean): void;
63
+ abstract createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[Unit | InvertedUnit, string | undefined]>): OverrideFormat;
64
+ abstract setDisplayLabel(displayLabel: string): void;
65
+ }
66
66
  //# sourceMappingURL=KindOfQuantity.d.ts.map