@itwin/ecschema-metadata 3.6.0-dev.7 → 3.6.0

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 (142) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/LICENSE.md +1 -1
  3. package/lib/cjs/Constants.d.ts +23 -23
  4. package/lib/cjs/Constants.js +33 -33
  5. package/lib/cjs/Constants.js.map +1 -1
  6. package/lib/cjs/Context.d.ts +139 -139
  7. package/lib/cjs/Context.js +204 -204
  8. package/lib/cjs/DelayedPromise.d.ts +88 -88
  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.js +11 -11
  13. package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
  14. package/lib/cjs/Deserialization/Helper.d.ts +251 -251
  15. package/lib/cjs/Deserialization/Helper.js +843 -843
  16. package/lib/cjs/Deserialization/Helper.js.map +1 -1
  17. package/lib/cjs/Deserialization/JsonParser.d.ts +165 -165
  18. package/lib/cjs/Deserialization/JsonParser.js +680 -680
  19. package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
  20. package/lib/cjs/Deserialization/JsonProps.d.ts +282 -282
  21. package/lib/cjs/Deserialization/JsonProps.js +9 -9
  22. package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
  23. package/lib/cjs/Deserialization/SchemaGraphUtil.d.ts +34 -34
  24. package/lib/cjs/Deserialization/SchemaGraphUtil.js +77 -77
  25. package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
  26. package/lib/cjs/Deserialization/XmlParser.d.ts +85 -85
  27. package/lib/cjs/Deserialization/XmlParser.js +973 -973
  28. package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
  29. package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts +54 -54
  30. package/lib/cjs/Deserialization/XmlSerializationUtils.js +174 -174
  31. package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
  32. package/lib/cjs/ECName.d.ts +30 -30
  33. package/lib/cjs/ECName.js +85 -85
  34. package/lib/cjs/ECName.js.map +1 -1
  35. package/lib/cjs/ECObjects.d.ts +162 -162
  36. package/lib/cjs/ECObjects.js +453 -453
  37. package/lib/cjs/ECObjects.js.map +1 -1
  38. package/lib/cjs/Exception.d.ts +43 -43
  39. package/lib/cjs/Exception.js +86 -86
  40. package/lib/cjs/Exception.js.map +1 -1
  41. package/lib/cjs/Interfaces.d.ts +66 -66
  42. package/lib/cjs/Interfaces.js +9 -9
  43. package/lib/cjs/Interfaces.js.map +1 -1
  44. package/lib/cjs/Metadata/Class.d.ts +243 -243
  45. package/lib/cjs/Metadata/Class.js +558 -558
  46. package/lib/cjs/Metadata/Class.js.map +1 -1
  47. package/lib/cjs/Metadata/Constant.d.ts +64 -64
  48. package/lib/cjs/Metadata/Constant.js +123 -123
  49. package/lib/cjs/Metadata/Constant.js.map +1 -1
  50. package/lib/cjs/Metadata/CustomAttribute.d.ts +23 -23
  51. package/lib/cjs/Metadata/CustomAttribute.js +27 -27
  52. package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
  53. package/lib/cjs/Metadata/CustomAttributeClass.d.ts +39 -39
  54. package/lib/cjs/Metadata/CustomAttributeClass.js +68 -68
  55. package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
  56. package/lib/cjs/Metadata/EntityClass.d.ts +77 -77
  57. package/lib/cjs/Metadata/EntityClass.js +230 -230
  58. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  59. package/lib/cjs/Metadata/Enumeration.d.ts +86 -86
  60. package/lib/cjs/Metadata/Enumeration.js +159 -159
  61. package/lib/cjs/Metadata/Enumeration.js.map +1 -1
  62. package/lib/cjs/Metadata/Format.d.ts +98 -98
  63. package/lib/cjs/Metadata/Format.js +242 -242
  64. package/lib/cjs/Metadata/Format.js.map +1 -1
  65. package/lib/cjs/Metadata/InvertedUnit.d.ts +49 -49
  66. package/lib/cjs/Metadata/InvertedUnit.js +97 -97
  67. package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
  68. package/lib/cjs/Metadata/KindOfQuantity.d.ts +65 -65
  69. package/lib/cjs/Metadata/KindOfQuantity.js +225 -225
  70. package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
  71. package/lib/cjs/Metadata/Mixin.d.ts +54 -54
  72. package/lib/cjs/Metadata/Mixin.js +113 -113
  73. package/lib/cjs/Metadata/Mixin.js.map +1 -1
  74. package/lib/cjs/Metadata/OverrideFormat.d.ts +55 -55
  75. package/lib/cjs/Metadata/OverrideFormat.js +88 -88
  76. package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
  77. package/lib/cjs/Metadata/Phenomenon.d.ts +33 -33
  78. package/lib/cjs/Metadata/Phenomenon.js +59 -59
  79. package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
  80. package/lib/cjs/Metadata/Property.d.ts +197 -197
  81. package/lib/cjs/Metadata/Property.js +491 -491
  82. package/lib/cjs/Metadata/Property.js.map +1 -1
  83. package/lib/cjs/Metadata/PropertyCategory.d.ts +39 -39
  84. package/lib/cjs/Metadata/PropertyCategory.js +61 -61
  85. package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
  86. package/lib/cjs/Metadata/RelationshipClass.d.ts +152 -152
  87. package/lib/cjs/Metadata/RelationshipClass.js +349 -349
  88. package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
  89. package/lib/cjs/Metadata/Schema.d.ts +291 -291
  90. package/lib/cjs/Metadata/Schema.js +520 -520
  91. package/lib/cjs/Metadata/Schema.js.map +1 -1
  92. package/lib/cjs/Metadata/SchemaItem.d.ts +61 -61
  93. package/lib/cjs/Metadata/SchemaItem.js +136 -136
  94. package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
  95. package/lib/cjs/Metadata/Unit.d.ts +76 -76
  96. package/lib/cjs/Metadata/Unit.js +162 -162
  97. package/lib/cjs/Metadata/UnitSystem.d.ts +20 -20
  98. package/lib/cjs/Metadata/UnitSystem.js +29 -29
  99. package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
  100. package/lib/cjs/PropertyTypes.d.ts +49 -49
  101. package/lib/cjs/PropertyTypes.js +91 -91
  102. package/lib/cjs/PropertyTypes.js.map +1 -1
  103. package/lib/cjs/SchemaJsonLocater.d.ts +34 -34
  104. package/lib/cjs/SchemaJsonLocater.js +42 -42
  105. package/lib/cjs/SchemaJsonLocater.js.map +1 -1
  106. package/lib/cjs/SchemaKey.d.ts +110 -110
  107. package/lib/cjs/SchemaKey.js +219 -219
  108. package/lib/cjs/SchemaKey.js.map +1 -1
  109. package/lib/cjs/SchemaLoader.d.ts +23 -23
  110. package/lib/cjs/SchemaLoader.js +47 -47
  111. package/lib/cjs/SchemaLoader.js.map +1 -1
  112. package/lib/cjs/SchemaPartVisitorDelegate.d.ts +274 -274
  113. package/lib/cjs/SchemaPartVisitorDelegate.js +212 -212
  114. package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
  115. package/lib/cjs/UnitConversion/Graph.d.ts +34 -34
  116. package/lib/cjs/UnitConversion/Graph.js +83 -83
  117. package/lib/cjs/UnitConversion/Graph.js.map +1 -1
  118. package/lib/cjs/UnitConversion/Parser.d.ts +8 -8
  119. package/lib/cjs/UnitConversion/Parser.js +42 -42
  120. package/lib/cjs/UnitConversion/Parser.js.map +1 -1
  121. package/lib/cjs/UnitConversion/UnitConversion.d.ts +45 -45
  122. package/lib/cjs/UnitConversion/UnitConversion.js +77 -77
  123. package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
  124. package/lib/cjs/UnitConversion/UnitConverter.d.ts +39 -39
  125. package/lib/cjs/UnitConversion/UnitConverter.js +116 -116
  126. package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
  127. package/lib/cjs/UnitConversion/UnitTree.d.ts +43 -43
  128. package/lib/cjs/UnitConversion/UnitTree.js +169 -169
  129. package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
  130. package/lib/cjs/UnitProvider/SchemaUnitProvider.d.ts +77 -77
  131. package/lib/cjs/UnitProvider/SchemaUnitProvider.js +236 -236
  132. package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
  133. package/lib/cjs/Validation/SchemaWalker.d.ts +23 -23
  134. package/lib/cjs/Validation/SchemaWalker.js +53 -53
  135. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  136. package/lib/cjs/ecschema-metadata.d.ts +51 -51
  137. package/lib/cjs/ecschema-metadata.js +96 -96
  138. package/lib/cjs/ecschema-metadata.js.map +1 -1
  139. package/lib/cjs/utils/SchemaGraph.d.ts +25 -25
  140. package/lib/cjs/utils/SchemaGraph.js +65 -65
  141. package/lib/cjs/utils/SchemaGraph.js.map +1 -1
  142. package/package.json +7 -7
@@ -1,89 +1,89 @@
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.OverrideFormat = void 0;
11
- const XmlSerializationUtils_1 = require("../Deserialization/XmlSerializationUtils");
12
- const ECObjects_1 = require("../ECObjects");
13
- /**
14
- * Overrides of a Format, from a Schema, and is SchemaItem that is used specifically on KindOfQuantity.
15
- * @beta
16
- */
17
- class OverrideFormat {
18
- constructor(parent, precision, unitAndLabels) {
19
- this.parent = parent;
20
- this.name = OverrideFormat.createOverrideFormatFullName(parent, precision, unitAndLabels);
21
- this._precision = precision;
22
- this._units = unitAndLabels;
23
- }
24
- // Properties that can be overriden
25
- get precision() { return (undefined === this._precision) ? this.parent.precision : this._precision; }
26
- get units() { return (undefined === this._units) ? this.parent.units : this._units; }
27
- // Properties that cannot be overriden
28
- get fullName() { return this.name; }
29
- get roundFactor() { return this.parent.roundFactor; }
30
- get type() { return this.parent.type; }
31
- get minWidth() { return this.parent.minWidth; }
32
- get scientificType() { return this.parent.scientificType; }
33
- get showSignOption() { return this.parent.showSignOption; }
34
- get decimalSeparator() { return this.parent.decimalSeparator; }
35
- get thousandSeparator() { return this.parent.thousandSeparator; }
36
- get uomSeparator() { return this.parent.uomSeparator; }
37
- get stationSeparator() { return this.parent.stationSeparator; }
38
- get stationOffsetSize() { return this.parent.stationOffsetSize; }
39
- get formatTraits() { return this.parent.formatTraits; }
40
- get spacer() { return this.parent.spacer; }
41
- get includeZero() { return this.parent.includeZero; }
42
- hasFormatTrait(formatTrait) {
43
- return (this.parent.formatTraits & formatTrait) === formatTrait;
44
- }
45
- /** Returns the format string of this override in the Xml full name format.
46
- * @alpha
47
- */
48
- fullNameXml(koqSchema) {
49
- let fullName = XmlSerializationUtils_1.XmlSerializationUtils.createXmlTypedName(koqSchema, this.parent.schema, this.parent.name);
50
- if (undefined !== this.precision)
51
- fullName += `(${this.precision.toString()})`;
52
- if (undefined === this._units)
53
- return fullName;
54
- for (const [unit, unitLabel] of this._units) {
55
- fullName += "[";
56
- fullName += XmlSerializationUtils_1.XmlSerializationUtils.createXmlTypedName(koqSchema, unit.schema, unit.name);
57
- fullName += `|${unitLabel}]`;
58
- }
59
- return fullName;
60
- }
61
- /**
62
- * Creates a valid OverrideFormat fullName from the parent Format and overridden units.
63
- * @param parent The parent Format.
64
- * @param unitAndLabels The overridden unit and labels collection.
65
- */
66
- static createOverrideFormatFullName(parent, precision, unitAndLabels) {
67
- let fullName = parent.fullName;
68
- if (precision)
69
- fullName += `(${precision.toString()})`;
70
- if (undefined === unitAndLabels)
71
- return fullName;
72
- for (const [unit, unitLabel] of unitAndLabels)
73
- if (undefined === unitLabel)
74
- fullName += `[${unit.fullName}]`;
75
- else
76
- fullName += `[${unit.fullName}|${unitLabel}]`;
77
- return fullName;
78
- }
79
- /**
80
- * @internal
81
- */
82
- static isOverrideFormat(object) {
83
- const overrideFormat = object;
84
- return overrideFormat !== undefined && overrideFormat.name !== undefined && overrideFormat.parent !== undefined &&
85
- overrideFormat.parent.schemaItemType === ECObjects_1.SchemaItemType.Format;
86
- }
87
- }
88
- exports.OverrideFormat = OverrideFormat;
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.OverrideFormat = void 0;
11
+ const XmlSerializationUtils_1 = require("../Deserialization/XmlSerializationUtils");
12
+ const ECObjects_1 = require("../ECObjects");
13
+ /**
14
+ * Overrides of a Format, from a Schema, and is SchemaItem that is used specifically on KindOfQuantity.
15
+ * @beta
16
+ */
17
+ class OverrideFormat {
18
+ constructor(parent, precision, unitAndLabels) {
19
+ this.parent = parent;
20
+ this.name = OverrideFormat.createOverrideFormatFullName(parent, precision, unitAndLabels);
21
+ this._precision = precision;
22
+ this._units = unitAndLabels;
23
+ }
24
+ // Properties that can be overriden
25
+ get precision() { return (undefined === this._precision) ? this.parent.precision : this._precision; }
26
+ get units() { return (undefined === this._units) ? this.parent.units : this._units; }
27
+ // Properties that cannot be overriden
28
+ get fullName() { return this.name; }
29
+ get roundFactor() { return this.parent.roundFactor; }
30
+ get type() { return this.parent.type; }
31
+ get minWidth() { return this.parent.minWidth; }
32
+ get scientificType() { return this.parent.scientificType; }
33
+ get showSignOption() { return this.parent.showSignOption; }
34
+ get decimalSeparator() { return this.parent.decimalSeparator; }
35
+ get thousandSeparator() { return this.parent.thousandSeparator; }
36
+ get uomSeparator() { return this.parent.uomSeparator; }
37
+ get stationSeparator() { return this.parent.stationSeparator; }
38
+ get stationOffsetSize() { return this.parent.stationOffsetSize; }
39
+ get formatTraits() { return this.parent.formatTraits; }
40
+ get spacer() { return this.parent.spacer; }
41
+ get includeZero() { return this.parent.includeZero; }
42
+ hasFormatTrait(formatTrait) {
43
+ return (this.parent.formatTraits & formatTrait) === formatTrait;
44
+ }
45
+ /** Returns the format string of this override in the Xml full name format.
46
+ * @alpha
47
+ */
48
+ fullNameXml(koqSchema) {
49
+ let fullName = XmlSerializationUtils_1.XmlSerializationUtils.createXmlTypedName(koqSchema, this.parent.schema, this.parent.name);
50
+ if (undefined !== this.precision)
51
+ fullName += `(${this.precision.toString()})`;
52
+ if (undefined === this._units)
53
+ return fullName;
54
+ for (const [unit, unitLabel] of this._units) {
55
+ fullName += "[";
56
+ fullName += XmlSerializationUtils_1.XmlSerializationUtils.createXmlTypedName(koqSchema, unit.schema, unit.name);
57
+ fullName += `|${unitLabel}]`;
58
+ }
59
+ return fullName;
60
+ }
61
+ /**
62
+ * Creates a valid OverrideFormat fullName from the parent Format and overridden units.
63
+ * @param parent The parent Format.
64
+ * @param unitAndLabels The overridden unit and labels collection.
65
+ */
66
+ static createOverrideFormatFullName(parent, precision, unitAndLabels) {
67
+ let fullName = parent.fullName;
68
+ if (precision)
69
+ fullName += `(${precision.toString()})`;
70
+ if (undefined === unitAndLabels)
71
+ return fullName;
72
+ for (const [unit, unitLabel] of unitAndLabels)
73
+ if (undefined === unitLabel)
74
+ fullName += `[${unit.fullName}]`;
75
+ else
76
+ fullName += `[${unit.fullName}|${unitLabel}]`;
77
+ return fullName;
78
+ }
79
+ /**
80
+ * @internal
81
+ */
82
+ static isOverrideFormat(object) {
83
+ const overrideFormat = object;
84
+ return overrideFormat !== undefined && overrideFormat.name !== undefined && overrideFormat.parent !== undefined &&
85
+ overrideFormat.parent.schemaItemType === ECObjects_1.SchemaItemType.Format;
86
+ }
87
+ }
88
+ exports.OverrideFormat = OverrideFormat;
89
89
  //# sourceMappingURL=OverrideFormat.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OverrideFormat.js","sourceRoot":"","sources":["../../../src/Metadata/OverrideFormat.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;A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,CAAC;YAChB,QAAQ,IAAI,6CAAqB,CAAC,kBAAkB,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACxF,QAAQ,IAAI,IAAI,SAAS,GAAG,CAAC;SAC9B;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,4BAA4B,CAAC,MAAc,EAAE,SAAkD,EAAE,aAAgE;QAC7K,IAAI,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAE/B,IAAI,SAAS;YACX,QAAQ,IAAI,IAAI,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC;QAE1C,IAAI,SAAS,KAAK,aAAa;YAC7B,OAAO,QAAQ,CAAC;QAClB,KAAK,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,aAAa;YAC3C,IAAI,SAAS,KAAK,SAAS;gBACzB,QAAQ,IAAI,IAAI,IAAI,CAAC,QAAQ,GAAG,CAAC;;gBAEjC,QAAQ,IAAI,IAAI,IAAI,CAAC,QAAQ,IAAI,SAAS,GAAG,CAAC;QAClD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,gBAAgB,CAAC,MAAW;QACxC,MAAM,cAAc,GAAG,MAAwB,CAAC;QAEhD,OAAO,cAAc,KAAK,SAAS,IAAI,cAAc,CAAC,IAAI,KAAK,SAAS,IAAI,cAAc,CAAC,MAAM,KAAK,SAAS;YACtG,cAAc,CAAC,MAAM,CAAC,cAAc,KAAK,0BAAc,CAAC,MAAM,CAAC;IAC1E,CAAC;CACF;AA7FD,wCA6FC","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, 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 { Unit } from \"./Unit\";\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 fullName += `|${unitLabel}]`;\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 /**\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 &&\r\n overrideFormat.parent.sch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I,CAAC,MAAM;YAC3B,OAAO,QAAQ,CAAC;QAClB,KAAK,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE;YAC3C,QAAQ,IAAI,GAAG,CAAC;YAChB,QAAQ,IAAI,6CAAqB,CAAC,kBAAkB,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACxF,QAAQ,IAAI,IAAI,SAAS,GAAG,CAAC;SAC9B;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,4BAA4B,CAAC,MAAc,EAAE,SAAkD,EAAE,aAAgE;QAC7K,IAAI,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAE/B,IAAI,SAAS;YACX,QAAQ,IAAI,IAAI,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC;QAE1C,IAAI,SAAS,KAAK,aAAa;YAC7B,OAAO,QAAQ,CAAC;QAClB,KAAK,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,aAAa;YAC3C,IAAI,SAAS,KAAK,SAAS;gBACzB,QAAQ,IAAI,IAAI,IAAI,CAAC,QAAQ,GAAG,CAAC;;gBAEjC,QAAQ,IAAI,IAAI,IAAI,CAAC,QAAQ,IAAI,SAAS,GAAG,CAAC;QAClD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,gBAAgB,CAAC,MAAW;QACxC,MAAM,cAAc,GAAG,MAAwB,CAAC;QAEhD,OAAO,cAAc,KAAK,SAAS,IAAI,cAAc,CAAC,IAAI,KAAK,SAAS,IAAI,cAAc,CAAC,MAAM,KAAK,SAAS;YACtG,cAAc,CAAC,MAAM,CAAC,cAAc,KAAK,0BAAc,CAAC,MAAM,CAAC;IAC1E,CAAC;CACF;AA7FD,wCA6FC","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, FormatTraits, FormatType, FractionalPrecision, ScientificType, ShowSignOption } from \"@itwin/core-quantity\";\nimport { Format } from \"./Format\";\nimport { InvertedUnit } from \"./InvertedUnit\";\nimport { Schema } from \"./Schema\";\nimport { Unit } from \"./Unit\";\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 fullName += `|${unitLabel}]`;\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 /**\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 &&\n overrideFormat.parent.schemaItemType === SchemaItemType.Format;\n }\n}\n"]}
@@ -1,34 +1,34 @@
1
- /** @packageDocumentation
2
- * @module Metadata
3
- */
4
- import { PhenomenonProps } from "../Deserialization/JsonProps";
5
- import { SchemaItemType } from "../ECObjects";
6
- import { Schema } from "./Schema";
7
- import { SchemaItem } from "./SchemaItem";
8
- /** @beta */
9
- export declare class Phenomenon extends SchemaItem {
10
- readonly schemaItemType: SchemaItemType.Phenomenon;
11
- protected _definition: string;
12
- constructor(schema: Schema, name: string);
13
- get definition(): string;
14
- /**
15
- * Save this Phenomenon's properties to an object for serializing to JSON.
16
- * @param standalone Serialization includes only this object (as opposed to the full schema).
17
- * @param includeSchemaVersion Include the Schema's version information in the serialized object.
18
- */
19
- toJSON(standalone?: boolean, includeSchemaVersion?: boolean): PhenomenonProps;
20
- /** @internal */
21
- toXml(schemaXml: Document): Promise<Element>;
22
- fromJSONSync(phenomenonProps: PhenomenonProps): void;
23
- fromJSON(phenomenonProps: PhenomenonProps): Promise<void>;
24
- protected setDefinition(definition: string): Promise<void>;
25
- }
26
- /**
27
- * @internal
28
- * An abstract class used for schema editing.
29
- */
30
- export declare abstract class MutablePhenomenon extends Phenomenon {
31
- abstract setDefinition(definition: string): Promise<void>;
32
- abstract setDisplayLabel(displayLabel: string): void;
33
- }
1
+ /** @packageDocumentation
2
+ * @module Metadata
3
+ */
4
+ import { PhenomenonProps } from "../Deserialization/JsonProps";
5
+ import { SchemaItemType } from "../ECObjects";
6
+ import { Schema } from "./Schema";
7
+ import { SchemaItem } from "./SchemaItem";
8
+ /** @beta */
9
+ export declare class Phenomenon extends SchemaItem {
10
+ readonly schemaItemType: SchemaItemType.Phenomenon;
11
+ protected _definition: string;
12
+ constructor(schema: Schema, name: string);
13
+ get definition(): string;
14
+ /**
15
+ * Save this Phenomenon's properties to an object for serializing to JSON.
16
+ * @param standalone Serialization includes only this object (as opposed to the full schema).
17
+ * @param includeSchemaVersion Include the Schema's version information in the serialized object.
18
+ */
19
+ toJSON(standalone?: boolean, includeSchemaVersion?: boolean): PhenomenonProps;
20
+ /** @internal */
21
+ toXml(schemaXml: Document): Promise<Element>;
22
+ fromJSONSync(phenomenonProps: PhenomenonProps): void;
23
+ fromJSON(phenomenonProps: PhenomenonProps): Promise<void>;
24
+ protected setDefinition(definition: string): Promise<void>;
25
+ }
26
+ /**
27
+ * @internal
28
+ * An abstract class used for schema editing.
29
+ */
30
+ export declare abstract class MutablePhenomenon extends Phenomenon {
31
+ abstract setDefinition(definition: string): Promise<void>;
32
+ abstract setDisplayLabel(displayLabel: string): void;
33
+ }
34
34
  //# sourceMappingURL=Phenomenon.d.ts.map
@@ -1,60 +1,60 @@
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.MutablePhenomenon = exports.Phenomenon = void 0;
11
- const ECObjects_1 = require("../ECObjects");
12
- const Exception_1 = require("../Exception");
13
- const SchemaItem_1 = require("./SchemaItem");
14
- /** @beta */
15
- class Phenomenon extends SchemaItem_1.SchemaItem {
16
- constructor(schema, name) {
17
- super(schema, name);
18
- this.schemaItemType = ECObjects_1.SchemaItemType.Phenomenon;
19
- this._definition = "";
20
- }
21
- get definition() { return this._definition; }
22
- /**
23
- * Save this Phenomenon's properties to an object for serializing to JSON.
24
- * @param standalone Serialization includes only this object (as opposed to the full schema).
25
- * @param includeSchemaVersion Include the Schema's version information in the serialized object.
26
- */
27
- toJSON(standalone = false, includeSchemaVersion = false) {
28
- const schemaJson = super.toJSON(standalone, includeSchemaVersion);
29
- schemaJson.definition = this.definition;
30
- return schemaJson;
31
- }
32
- /** @internal */
33
- async toXml(schemaXml) {
34
- const itemElement = await super.toXml(schemaXml);
35
- itemElement.setAttribute("definition", this.definition);
36
- return itemElement;
37
- }
38
- fromJSONSync(phenomenonProps) {
39
- super.fromJSONSync(phenomenonProps);
40
- if (this._definition !== "" && phenomenonProps.definition.toLowerCase() !== this._definition.toLowerCase())
41
- throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidECJson, `The Phenomenon ${this.name} has an invalid 'definition' attribute.`);
42
- else if (this._definition === "")
43
- this._definition = phenomenonProps.definition;
44
- }
45
- async fromJSON(phenomenonProps) {
46
- this.fromJSONSync(phenomenonProps);
47
- }
48
- async setDefinition(definition) {
49
- this._definition = definition;
50
- }
51
- }
52
- exports.Phenomenon = Phenomenon;
53
- /**
54
- * @internal
55
- * An abstract class used for schema editing.
56
- */
57
- class MutablePhenomenon extends Phenomenon {
58
- }
59
- exports.MutablePhenomenon = MutablePhenomenon;
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.MutablePhenomenon = exports.Phenomenon = void 0;
11
+ const ECObjects_1 = require("../ECObjects");
12
+ const Exception_1 = require("../Exception");
13
+ const SchemaItem_1 = require("./SchemaItem");
14
+ /** @beta */
15
+ class Phenomenon extends SchemaItem_1.SchemaItem {
16
+ constructor(schema, name) {
17
+ super(schema, name);
18
+ this.schemaItemType = ECObjects_1.SchemaItemType.Phenomenon;
19
+ this._definition = "";
20
+ }
21
+ get definition() { return this._definition; }
22
+ /**
23
+ * Save this Phenomenon's properties to an object for serializing to JSON.
24
+ * @param standalone Serialization includes only this object (as opposed to the full schema).
25
+ * @param includeSchemaVersion Include the Schema's version information in the serialized object.
26
+ */
27
+ toJSON(standalone = false, includeSchemaVersion = false) {
28
+ const schemaJson = super.toJSON(standalone, includeSchemaVersion);
29
+ schemaJson.definition = this.definition;
30
+ return schemaJson;
31
+ }
32
+ /** @internal */
33
+ async toXml(schemaXml) {
34
+ const itemElement = await super.toXml(schemaXml);
35
+ itemElement.setAttribute("definition", this.definition);
36
+ return itemElement;
37
+ }
38
+ fromJSONSync(phenomenonProps) {
39
+ super.fromJSONSync(phenomenonProps);
40
+ if (this._definition !== "" && phenomenonProps.definition.toLowerCase() !== this._definition.toLowerCase())
41
+ throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidECJson, `The Phenomenon ${this.name} has an invalid 'definition' attribute.`);
42
+ else if (this._definition === "")
43
+ this._definition = phenomenonProps.definition;
44
+ }
45
+ async fromJSON(phenomenonProps) {
46
+ this.fromJSONSync(phenomenonProps);
47
+ }
48
+ async setDefinition(definition) {
49
+ this._definition = definition;
50
+ }
51
+ }
52
+ exports.Phenomenon = Phenomenon;
53
+ /**
54
+ * @internal
55
+ * An abstract class used for schema editing.
56
+ */
57
+ class MutablePhenomenon extends Phenomenon {
58
+ }
59
+ exports.MutablePhenomenon = MutablePhenomenon;
60
60
  //# sourceMappingURL=Phenomenon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Phenomenon.js","sourceRoot":"","sources":["../../../src/Metadata/Phenomenon.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,4CAA8C;AAC9C,4CAA+D;AAE/D,6CAA0C;AAE1C,YAAY;AACZ,MAAa,UAAW,SAAQ,uBAAU;IAIxC,YAAY,MAAc,EAAE,IAAY;QACtC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,cAAc,GAAG,0BAAc,CAAC,UAAU,CAAC;QAChD,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,0BAAc,CAAC,2BAAe,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;AA7CD,gCA6CC;AAED;;;GAGG;AACH,MAAsB,iBAAkB,SAAQ,UAAU;CAGzD;AAHD,8CAGC","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; // eslint-disable-line\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,4CAA8C;AAC9C,4CAA+D;AAE/D,6CAA0C;AAE1C,YAAY;AACZ,MAAa,UAAW,SAAQ,uBAAU;IAIxC,YAAY,MAAc,EAAE,IAAY;QACtC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,cAAc,GAAG,0BAAc,CAAC,UAAU,CAAC;QAChD,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,0BAAc,CAAC,2BAAe,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;AA7CD,gCA6CC;AAED;;;GAGG;AACH,MAAsB,iBAAkB,SAAQ,UAAU;CAGzD;AAHD,8CAGC","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; // eslint-disable-line\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.schemaItemType = SchemaItemType.Phenomenon;\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"]}