@itwin/ecschema-metadata 5.0.0-dev.8 → 5.0.0-dev.83
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.
- package/CHANGELOG.md +46 -1
- package/lib/cjs/Constants.js +20 -20
- package/lib/cjs/Constants.js.map +1 -1
- package/lib/cjs/Context.d.ts +60 -20
- package/lib/cjs/Context.d.ts.map +1 -1
- package/lib/cjs/Context.js +43 -19
- package/lib/cjs/Context.js.map +1 -1
- package/lib/cjs/DelayedPromise.js +6 -4
- package/lib/cjs/DelayedPromise.js.map +1 -1
- package/lib/cjs/Deserialization/AbstractParser.js +1 -0
- package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
- package/lib/cjs/Deserialization/Helper.d.ts +3 -3
- package/lib/cjs/Deserialization/Helper.d.ts.map +1 -1
- package/lib/cjs/Deserialization/Helper.js +8 -0
- package/lib/cjs/Deserialization/Helper.js.map +1 -1
- package/lib/cjs/Deserialization/JsonParser.js +3 -0
- package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.d.ts +3 -0
- package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.js +11 -1
- package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
- package/lib/cjs/ECName.js +1 -0
- package/lib/cjs/ECName.js.map +1 -1
- package/lib/cjs/ECObjects.d.ts +21 -1
- package/lib/cjs/ECObjects.d.ts.map +1 -1
- package/lib/cjs/ECObjects.js +34 -2
- package/lib/cjs/ECObjects.js.map +1 -1
- package/lib/cjs/Exception.js +1 -0
- package/lib/cjs/Exception.js.map +1 -1
- package/lib/cjs/Interfaces.d.ts +10 -3
- package/lib/cjs/Interfaces.d.ts.map +1 -1
- package/lib/cjs/Interfaces.js.map +1 -1
- package/lib/cjs/Metadata/Class.d.ts +53 -5
- package/lib/cjs/Metadata/Class.d.ts.map +1 -1
- package/lib/cjs/Metadata/Class.js +118 -19
- package/lib/cjs/Metadata/Class.js.map +1 -1
- package/lib/cjs/Metadata/Constant.d.ts +14 -1
- package/lib/cjs/Metadata/Constant.d.ts.map +1 -1
- package/lib/cjs/Metadata/Constant.js +27 -2
- package/lib/cjs/Metadata/Constant.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.d.ts +16 -4
- package/lib/cjs/Metadata/CustomAttributeClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.js +22 -4
- package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/cjs/Metadata/EntityClass.d.ts +18 -6
- package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js +29 -9
- package/lib/cjs/Metadata/EntityClass.js.map +1 -1
- package/lib/cjs/Metadata/Enumeration.d.ts +14 -1
- package/lib/cjs/Metadata/Enumeration.d.ts.map +1 -1
- package/lib/cjs/Metadata/Enumeration.js +22 -1
- package/lib/cjs/Metadata/Enumeration.js.map +1 -1
- package/lib/cjs/Metadata/Format.d.ts +41 -1
- package/lib/cjs/Metadata/Format.d.ts.map +1 -1
- package/lib/cjs/Metadata/Format.js +68 -3
- package/lib/cjs/Metadata/Format.js.map +1 -1
- package/lib/cjs/Metadata/InvertedUnit.d.ts +8 -3
- package/lib/cjs/Metadata/InvertedUnit.d.ts.map +1 -1
- package/lib/cjs/Metadata/InvertedUnit.js +17 -6
- package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.d.ts +14 -3
- package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.js +43 -18
- package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/cjs/Metadata/Mixin.d.ts +15 -1
- package/lib/cjs/Metadata/Mixin.d.ts.map +1 -1
- package/lib/cjs/Metadata/Mixin.js +23 -2
- package/lib/cjs/Metadata/Mixin.js.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.js +9 -0
- package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
- package/lib/cjs/Metadata/Phenomenon.d.ts +14 -1
- package/lib/cjs/Metadata/Phenomenon.d.ts.map +1 -1
- package/lib/cjs/Metadata/Phenomenon.js +22 -1
- package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
- package/lib/cjs/Metadata/Property.d.ts +1 -1
- package/lib/cjs/Metadata/Property.d.ts.map +1 -1
- package/lib/cjs/Metadata/Property.js +83 -28
- package/lib/cjs/Metadata/Property.js.map +1 -1
- package/lib/cjs/Metadata/PropertyCategory.d.ts +14 -1
- package/lib/cjs/Metadata/PropertyCategory.d.ts.map +1 -1
- package/lib/cjs/Metadata/PropertyCategory.js +21 -1
- package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.d.ts +15 -2
- package/lib/cjs/Metadata/RelationshipClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.js +47 -10
- package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
- package/lib/cjs/Metadata/Schema.d.ts +116 -11
- package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
- package/lib/cjs/Metadata/Schema.js +135 -33
- package/lib/cjs/Metadata/Schema.js.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.d.ts +11 -2
- package/lib/cjs/Metadata/SchemaItem.d.ts.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.js +10 -0
- package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
- package/lib/cjs/Metadata/Unit.d.ts +8 -1
- package/lib/cjs/Metadata/Unit.d.ts.map +1 -1
- package/lib/cjs/Metadata/Unit.js +21 -3
- package/lib/cjs/Metadata/Unit.js.map +1 -1
- package/lib/cjs/Metadata/UnitSystem.d.ts +14 -3
- package/lib/cjs/Metadata/UnitSystem.d.ts.map +1 -1
- package/lib/cjs/Metadata/UnitSystem.js +21 -3
- package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
- package/lib/cjs/SchemaJsonLocater.d.ts +3 -3
- package/lib/cjs/SchemaJsonLocater.d.ts.map +1 -1
- package/lib/cjs/SchemaJsonLocater.js +3 -3
- package/lib/cjs/SchemaJsonLocater.js.map +1 -1
- package/lib/cjs/SchemaKey.d.ts +7 -1
- package/lib/cjs/SchemaKey.d.ts.map +1 -1
- package/lib/cjs/SchemaKey.js +13 -3
- package/lib/cjs/SchemaKey.js.map +1 -1
- package/lib/cjs/SchemaLoader.d.ts +2 -2
- package/lib/cjs/SchemaLoader.d.ts.map +1 -1
- package/lib/cjs/SchemaLoader.js +1 -0
- package/lib/cjs/SchemaLoader.js.map +1 -1
- package/lib/cjs/SchemaPartVisitorDelegate.js +1 -0
- package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/cjs/UnitConversion/Graph.js +69 -65
- package/lib/cjs/UnitConversion/Graph.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConversion.d.ts +1 -1
- package/lib/cjs/UnitConversion/UnitConversion.d.ts.map +1 -1
- package/lib/cjs/UnitConversion/UnitConversion.js +9 -7
- package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConverter.js +2 -0
- package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitTree.d.ts +2 -0
- package/lib/cjs/UnitConversion/UnitTree.d.ts.map +1 -1
- package/lib/cjs/UnitConversion/UnitTree.js +11 -1
- package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js +6 -3
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.d.ts +1 -1
- package/lib/cjs/Validation/SchemaWalker.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js +4 -0
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/utils/SchemaGraph.js +2 -3
- package/lib/cjs/utils/SchemaGraph.js.map +1 -1
- package/lib/esm/Constants.js +20 -20
- package/lib/esm/Constants.js.map +1 -1
- package/lib/esm/Context.d.ts +60 -20
- package/lib/esm/Context.d.ts.map +1 -1
- package/lib/esm/Context.js +41 -17
- package/lib/esm/Context.js.map +1 -1
- package/lib/esm/DelayedPromise.js +6 -4
- package/lib/esm/DelayedPromise.js.map +1 -1
- package/lib/esm/Deserialization/AbstractParser.js +1 -0
- package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
- package/lib/esm/Deserialization/Helper.d.ts +3 -3
- package/lib/esm/Deserialization/Helper.d.ts.map +1 -1
- package/lib/esm/Deserialization/Helper.js +8 -0
- package/lib/esm/Deserialization/Helper.js.map +1 -1
- package/lib/esm/Deserialization/JsonParser.js +3 -0
- package/lib/esm/Deserialization/JsonParser.js.map +1 -1
- package/lib/esm/Deserialization/JsonProps.d.ts +3 -0
- package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/esm/Deserialization/JsonProps.js.map +1 -1
- package/lib/esm/Deserialization/XmlParser.js +11 -1
- package/lib/esm/Deserialization/XmlParser.js.map +1 -1
- package/lib/esm/ECName.js +1 -0
- package/lib/esm/ECName.js.map +1 -1
- package/lib/esm/ECObjects.d.ts +21 -1
- package/lib/esm/ECObjects.d.ts.map +1 -1
- package/lib/esm/ECObjects.js +32 -1
- package/lib/esm/ECObjects.js.map +1 -1
- package/lib/esm/Exception.js +1 -0
- package/lib/esm/Exception.js.map +1 -1
- package/lib/esm/Interfaces.d.ts +10 -3
- package/lib/esm/Interfaces.d.ts.map +1 -1
- package/lib/esm/Interfaces.js.map +1 -1
- package/lib/esm/Metadata/Class.d.ts +53 -5
- package/lib/esm/Metadata/Class.d.ts.map +1 -1
- package/lib/esm/Metadata/Class.js +119 -20
- package/lib/esm/Metadata/Class.js.map +1 -1
- package/lib/esm/Metadata/Constant.d.ts +14 -1
- package/lib/esm/Metadata/Constant.d.ts.map +1 -1
- package/lib/esm/Metadata/Constant.js +27 -2
- package/lib/esm/Metadata/Constant.js.map +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.d.ts +16 -4
- package/lib/esm/Metadata/CustomAttributeClass.d.ts.map +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.js +22 -4
- package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/esm/Metadata/EntityClass.d.ts +18 -6
- package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/esm/Metadata/EntityClass.js +29 -9
- package/lib/esm/Metadata/EntityClass.js.map +1 -1
- package/lib/esm/Metadata/Enumeration.d.ts +14 -1
- package/lib/esm/Metadata/Enumeration.d.ts.map +1 -1
- package/lib/esm/Metadata/Enumeration.js +22 -1
- package/lib/esm/Metadata/Enumeration.js.map +1 -1
- package/lib/esm/Metadata/Format.d.ts +41 -1
- package/lib/esm/Metadata/Format.d.ts.map +1 -1
- package/lib/esm/Metadata/Format.js +68 -3
- package/lib/esm/Metadata/Format.js.map +1 -1
- package/lib/esm/Metadata/InvertedUnit.d.ts +8 -3
- package/lib/esm/Metadata/InvertedUnit.d.ts.map +1 -1
- package/lib/esm/Metadata/InvertedUnit.js +17 -6
- package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.d.ts +14 -3
- package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.js +43 -18
- package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/esm/Metadata/Mixin.d.ts +15 -1
- package/lib/esm/Metadata/Mixin.d.ts.map +1 -1
- package/lib/esm/Metadata/Mixin.js +24 -3
- package/lib/esm/Metadata/Mixin.js.map +1 -1
- package/lib/esm/Metadata/OverrideFormat.js +9 -0
- package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
- package/lib/esm/Metadata/Phenomenon.d.ts +14 -1
- package/lib/esm/Metadata/Phenomenon.d.ts.map +1 -1
- package/lib/esm/Metadata/Phenomenon.js +22 -1
- package/lib/esm/Metadata/Phenomenon.js.map +1 -1
- package/lib/esm/Metadata/Property.d.ts +1 -1
- package/lib/esm/Metadata/Property.d.ts.map +1 -1
- package/lib/esm/Metadata/Property.js +84 -29
- package/lib/esm/Metadata/Property.js.map +1 -1
- package/lib/esm/Metadata/PropertyCategory.d.ts +14 -1
- package/lib/esm/Metadata/PropertyCategory.d.ts.map +1 -1
- package/lib/esm/Metadata/PropertyCategory.js +21 -1
- package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.d.ts +15 -2
- package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.js +48 -11
- package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
- package/lib/esm/Metadata/Schema.d.ts +116 -11
- package/lib/esm/Metadata/Schema.d.ts.map +1 -1
- package/lib/esm/Metadata/Schema.js +135 -33
- package/lib/esm/Metadata/Schema.js.map +1 -1
- package/lib/esm/Metadata/SchemaItem.d.ts +11 -2
- package/lib/esm/Metadata/SchemaItem.d.ts.map +1 -1
- package/lib/esm/Metadata/SchemaItem.js +11 -1
- package/lib/esm/Metadata/SchemaItem.js.map +1 -1
- package/lib/esm/Metadata/Unit.d.ts +8 -1
- package/lib/esm/Metadata/Unit.d.ts.map +1 -1
- package/lib/esm/Metadata/Unit.js +21 -3
- package/lib/esm/Metadata/Unit.js.map +1 -1
- package/lib/esm/Metadata/UnitSystem.d.ts +14 -3
- package/lib/esm/Metadata/UnitSystem.d.ts.map +1 -1
- package/lib/esm/Metadata/UnitSystem.js +21 -3
- package/lib/esm/Metadata/UnitSystem.js.map +1 -1
- package/lib/esm/SchemaJsonLocater.d.ts +3 -3
- package/lib/esm/SchemaJsonLocater.d.ts.map +1 -1
- package/lib/esm/SchemaJsonLocater.js +3 -3
- package/lib/esm/SchemaJsonLocater.js.map +1 -1
- package/lib/esm/SchemaKey.d.ts +7 -1
- package/lib/esm/SchemaKey.d.ts.map +1 -1
- package/lib/esm/SchemaKey.js +13 -3
- package/lib/esm/SchemaKey.js.map +1 -1
- package/lib/esm/SchemaLoader.d.ts +2 -2
- package/lib/esm/SchemaLoader.d.ts.map +1 -1
- package/lib/esm/SchemaLoader.js +1 -0
- package/lib/esm/SchemaLoader.js.map +1 -1
- package/lib/esm/SchemaPartVisitorDelegate.js +1 -0
- package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/esm/UnitConversion/Graph.js +69 -65
- package/lib/esm/UnitConversion/Graph.js.map +1 -1
- package/lib/esm/UnitConversion/UnitConversion.d.ts +1 -1
- package/lib/esm/UnitConversion/UnitConversion.d.ts.map +1 -1
- package/lib/esm/UnitConversion/UnitConversion.js +9 -7
- package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
- package/lib/esm/UnitConversion/UnitConverter.js +2 -0
- package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/esm/UnitConversion/UnitTree.d.ts +2 -0
- package/lib/esm/UnitConversion/UnitTree.d.ts.map +1 -1
- package/lib/esm/UnitConversion/UnitTree.js +11 -1
- package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.js +6 -3
- package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/esm/Validation/SchemaWalker.d.ts +1 -1
- package/lib/esm/Validation/SchemaWalker.d.ts.map +1 -1
- package/lib/esm/Validation/SchemaWalker.js +4 -0
- package/lib/esm/Validation/SchemaWalker.js.map +1 -1
- package/lib/esm/utils/SchemaGraph.js +2 -3
- package/lib/esm/utils/SchemaGraph.js.map +1 -1
- package/package.json +14 -14
|
@@ -19,6 +19,9 @@ const InvertedUnit_1 = require("../Metadata/InvertedUnit");
|
|
|
19
19
|
* @beta
|
|
20
20
|
*/
|
|
21
21
|
class SchemaUnitProvider {
|
|
22
|
+
_unitExtraData;
|
|
23
|
+
_unitConverter;
|
|
24
|
+
_context;
|
|
22
25
|
/**
|
|
23
26
|
*
|
|
24
27
|
* @param contextOrLocater The SchemaContext or a different ISchemaLocater implementation used to retrieve the schema. The SchemaContext
|
|
@@ -51,10 +54,10 @@ class SchemaUnitProvider {
|
|
|
51
54
|
return new core_quantity_1.BadUnit(); // return BadUnit if schema does not exist
|
|
52
55
|
}
|
|
53
56
|
const itemKey = new SchemaKey_1.SchemaItemKey(schemaItemName, schema.schemaKey);
|
|
54
|
-
const unit = await this._context.getSchemaItem(itemKey);
|
|
57
|
+
const unit = await this._context.getSchemaItem(itemKey, Unit_1.Unit);
|
|
55
58
|
if (unit && unit.schemaItemType === ECObjects_1.SchemaItemType.Unit)
|
|
56
59
|
return this.getUnitsProps(unit);
|
|
57
|
-
const invertedUnit = await this._context.getSchemaItem(itemKey);
|
|
60
|
+
const invertedUnit = await this._context.getSchemaItem(itemKey, InvertedUnit_1.InvertedUnit);
|
|
58
61
|
if (invertedUnit && invertedUnit.schemaItemType === ECObjects_1.SchemaItemType.InvertedUnit) {
|
|
59
62
|
return this.getUnitsProps(invertedUnit);
|
|
60
63
|
}
|
|
@@ -181,7 +184,7 @@ class SchemaUnitProvider {
|
|
|
181
184
|
});
|
|
182
185
|
}
|
|
183
186
|
const itemKey = new SchemaKey_1.SchemaItemKey(schemaItemName, schema.schemaKey);
|
|
184
|
-
const invertedUnit = await context.getSchemaItem(itemKey);
|
|
187
|
+
const invertedUnit = await context.getSchemaItem(itemKey, InvertedUnit_1.InvertedUnit);
|
|
185
188
|
// Check if we found an item, the item is an inverted unit, and it has its invertsUnit property set
|
|
186
189
|
if (invertedUnit && InvertedUnit_1.InvertedUnit.isInvertedUnit(invertedUnit) && invertedUnit.invertsUnit) {
|
|
187
190
|
return { unitName: invertedUnit.invertsUnit.fullName, isInverted: true };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaUnitProvider.js","sourceRoot":"","sources":["../../../src/UnitProvider/Schem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,eAAuB,EAAE,UAAmB,EAAE,UAAmB,EAAE,UAAmB;QAC5H,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxC,IAAI,KAAK,CAAC,gBAAgB,IAAI,KAAK,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAChE,IAAI,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;oBACpG,mDAAmD;oBACnD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBACxD,6EAA6E;oBAC7E,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU;wBAC3C,OAAO,SAAS,CAAC;oBAEnB,+CAA+C;oBAC/C,MAAM,iBAAiB,GAAG,CAAC,UAAU,IAAI,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;oBAC7F,MAAM,iBAAiB,GAAG,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC;oBAC3F,MAAM,iBAAiB,GAAG,CAAC,UAAU,IAAI,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC;oBACvF,iDAAiD;oBACjD,IAAI,iBAAiB,IAAI,iBAAiB,IAAI,iBAAiB;wBAC7D,OAAO,SAAS,CAAC;gBACrB,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,IAAI,uBAAO,EAAE,CAAC;IACvB,CAAC;CACF;AA5RD,gDA4RC","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*--------------------------------------------------------------------------------------------*/\nimport { BentleyError, BentleyStatus } from \"@itwin/core-bentley\";\nimport { BadUnit, UnitConversionInvert, UnitConversionProps, UnitExtraData, UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\nimport { ISchemaLocater, SchemaContext } from \"../Context\";\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\nimport { SchemaItemKey, SchemaKey } from \"../SchemaKey\";\nimport { Unit } from \"../Metadata/Unit\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { UnitConverter } from \"../UnitConversion/UnitConverter\";\nimport { InvertedUnit } from \"../Metadata/InvertedUnit\";\n\n/**\n * Class used to find Units in SchemaContext by attributes such as Phenomenon and DisplayLabel.\n * @beta\n */\nexport class SchemaUnitProvider implements UnitsProvider {\n private _unitConverter: UnitConverter;\n private _context: SchemaContext;\n\n /**\n *\n * @param contextOrLocater The SchemaContext or a different ISchemaLocater implementation used to retrieve the schema. The SchemaContext\n * class implements the ISchemaLocater interface. If the provided locater is not a SchemaContext instance a new SchemaContext will be\n * created and the locater will be added.\n * @param _unitExtraData Additional data like alternate display label not found in Units Schema to match with Units; Defaults to empty array.\n */\n constructor(contextOrLocater: ISchemaLocater, private _unitExtraData: UnitExtraData[] = []) {\n if (contextOrLocater instanceof SchemaContext) {\n this._context = contextOrLocater;\n } else {\n this._context = new SchemaContext();\n this._context.addLocater(contextOrLocater);\n }\n this._unitConverter = new UnitConverter(this._context);\n }\n\n /**\n * Find unit in a schema that has unitName.\n * @param unitName Full name of unit.\n * @returns UnitProps interface from @itwin/core-quantity whose name matches unitName.\n */\n public async findUnitByName(unitName: string): Promise<UnitProps> {\n // Check if schema exists and unit exists in schema\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(unitName);\n const schemaKey = new SchemaKey(schemaName);\n const schema = await this._context.getSchema(schemaKey);\n\n if (!schema) {\n return new BadUnit(); // return BadUnit if schema does not exist\n }\n\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n const unit = await this._context.getSchemaItem<Unit>(itemKey);\n if (unit && unit.schemaItemType === SchemaItemType.Unit)\n return this.getUnitsProps(unit);\n\n const invertedUnit = await this._context.getSchemaItem<InvertedUnit>(itemKey);\n if (invertedUnit && invertedUnit.schemaItemType === SchemaItemType.InvertedUnit) {\n return this.getUnitsProps(invertedUnit);\n }\n\n return new BadUnit();\n }\n\n /**\n * Find all units in context that belongs to given phenomenon.\n * @param phenomenon Full name of phenomenon.\n * @returns Array of UnitProps (from @itwin/core-quantity) interface objects whose name matches phenomenon param.\n */\n public async getUnitsByFamily(phenomenon: string): Promise<Array<UnitProps>> {\n // Check if schema exists and phenomenon exists in schema\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(phenomenon);\n const schemaKey = new SchemaKey(schemaName);\n const schema = await this._context.getSchema(schemaKey);\n\n if (!schema) {\n throw new BentleyError(BentleyStatus.ERROR, \"Cannot find schema for phenomenon\", () => {\n return { phenomenon, schema: schemaName };\n });\n }\n\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n const phenom = await this._context.getSchemaItem(itemKey);\n if (!phenom)\n throw new BentleyError(BentleyStatus.ERROR, \"Cannot find schema item/phenomenon\", () => {\n return { item: schemaItemName, schema: schemaName };\n });\n\n if (phenom.schemaItemType !== SchemaItemType.Phenomenon)\n throw new BentleyError(BentleyStatus.ERROR, \"Item is not a phenomenon\", () => {\n return { itemType: phenom.key.fullName };\n });\n\n // Find units' full name that match given phenomenon param.\n const filteredUnits: Array<UnitProps> = [];\n const schemaItems = this._context.getSchemaItems();\n let { value, done } = schemaItems.next();\n while (!done) {\n if (Unit.isUnit(value)) {\n const foundPhenomenon = await value.phenomenon;\n if (foundPhenomenon && foundPhenomenon.key.matchesFullName(phenomenon)) {\n const unitProps = await this.getUnitsProps(value);\n filteredUnits.push(unitProps);\n }\n } else if (InvertedUnit.isInvertedUnit(value) && value.invertsUnit) {\n const invertsUnit = await value.invertsUnit;\n if (invertsUnit) {\n const foundPhenomenon = await invertsUnit.phenomenon;\n if (foundPhenomenon && foundPhenomenon.key.matchesFullName(phenomenon)) {\n const unitProps = await this.getUnitsProps(value);\n filteredUnits.push(unitProps);\n }\n }\n }\n ({ value, done } = schemaItems.next());\n }\n\n return filteredUnits;\n }\n\n /**\n * Find alternate display labels associated with unitName, if any.\n * @param unitName Full name of Unit.\n */\n public getAlternateDisplayLabels(unitName: string): Array<string> {\n let alternateLabels: Array<string> = [];\n for (const entry of this._unitExtraData) {\n if (entry.name.toLowerCase() === unitName.toLowerCase()) {\n alternateLabels = entry.altDisplayLabels;\n }\n }\n\n return alternateLabels;\n }\n\n /**\n * Finds Unit by unitLabel, which could be a display label in the schema or alternate an display label defined in\n * this._unitExtraData. If there are duplicates of the same display label in the context or teh same alternate display\n * labels, specify schemaName, phenomenon, or unitSystem to get a specific unit.\n *\n * @param unitLabel Display label or alternate display label to query unit by.\n * @param schemaName Ensure Unit with unitLabel belongs to Schema with schemaName.\n * @param phenomenon Full name of phenomenon that Unit belongs to.\n * @param unitSystem Full name of unitSystem that Unit belongs to.\n * @returns The UnitProps interface from the @itwin/core-quantity package.\n */\n public async findUnit(unitLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\n const findLabel = unitLabel.toLowerCase();\n const findSchema = schemaName ? schemaName.toLowerCase() : undefined;\n const findPhenomenon = phenomenon ? phenomenon.toLowerCase() : undefined;\n const findUnitSystem = unitSystem ? unitSystem.toLowerCase() : undefined;\n\n const foundUnit: UnitProps = await this.findUnitByDisplayLabel(findLabel, findSchema, findPhenomenon, findUnitSystem);\n if (foundUnit.isValid)\n return foundUnit;\n\n // If there is no Unit with display label that matches label, then check for alternate display labels that may match\n return this.findUnitByAltDisplayLabel(findLabel, findSchema, findPhenomenon, findUnitSystem);\n }\n\n /**\n * Gets the @itwin/core-quantity UnitConversionProps for the given fromUnit and toUnit.\n * @param fromUnit The UnitProps of the 'from' unit.\n * @param toUnit The UnitProps of the 'to' unit.\n * @returns The UnitConversionProps interface from the @itwin/core-quantity package.\n */\n public async getConversion(fromUnit: UnitProps, toUnit: UnitProps): Promise<UnitConversionProps> {\n // need to check if either side is an inverted unit. The UnitConverter can only handle Units\n if (!fromUnit.isValid || !toUnit.isValid)\n throw new BentleyError(BentleyStatus.ERROR, \"Both provided units must be valid.\", () => {\n return { fromUnit, toUnit };\n });\n\n const { unitName: fromUnitName, isInverted: fromIsInverted } = await this.checkUnitPropsForConversion(fromUnit, this._context);\n const { unitName: toUnitName, isInverted: toIsInverted } = await this.checkUnitPropsForConversion(toUnit, this._context);\n\n const conversion = await this._unitConverter.calculateConversion(fromUnitName, toUnitName);\n const result: UnitConversionProps = {\n factor: conversion.factor,\n offset: conversion.offset,\n };\n if (fromIsInverted && !toIsInverted)\n result.inversion = UnitConversionInvert.InvertPreConversion;\n else if (!fromIsInverted && toIsInverted)\n result.inversion = UnitConversionInvert.InvertPostConversion;\n\n return result;\n }\n\n private async checkUnitPropsForConversion(input: UnitProps, context: SchemaContext): Promise<{ unitName: string, isInverted: boolean }> {\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(input.name);\n const schemaKey = new SchemaKey(schemaName);\n const schema = await context.getSchema(schemaKey);\n\n if (!schema) {\n throw new BentleyError(BentleyStatus.ERROR, \"Could not obtain schema for unit.\", () => {\n return { name: input.name };\n });\n }\n\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n const invertedUnit = await context.getSchemaItem<InvertedUnit>(itemKey);\n // Check if we found an item, the item is an inverted unit, and it has its invertsUnit property set\n if (invertedUnit && InvertedUnit.isInvertedUnit(invertedUnit) && invertedUnit.invertsUnit) {\n return { unitName: invertedUnit.invertsUnit.fullName, isInverted: true };\n }\n\n return { unitName: input.name, isInverted: false };\n }\n\n /**\n * Gets the @itwin/core UnitProps for the given Unit.\n * @param unit The Unit to convert.\n * @returns UnitProps interface from @itwin/core.\n */\n private async getUnitsProps(unit: Unit | InvertedUnit): Promise<UnitProps> {\n if (Unit.isUnit(unit)) {\n return {\n name: unit.fullName,\n label: unit.label ?? \"\",\n phenomenon: unit.phenomenon ? unit.phenomenon.fullName : \"\",\n isValid: true,\n system: unit.unitSystem === undefined ? \"\" : unit.unitSystem.fullName,\n };\n }\n\n const invertsUnit = await unit.invertsUnit;\n if (!invertsUnit)\n return new BadUnit();\n\n return {\n name: unit.fullName,\n label: unit.label ?? \"\",\n phenomenon: invertsUnit.phenomenon ? invertsUnit.phenomenon.fullName : \"\",\n isValid: true,\n system: unit.unitSystem === undefined ? \"\" : unit.unitSystem.fullName,\n };\n }\n\n /**\n * Finds Unit by displayLabel and that it belongs to schemaName, phenomenon, and unitSystem if defined.\n * @internal\n */\n private async findUnitByDisplayLabel(displayLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\n // TODO: Known bug: This only looks through loaded schemas. If schema name is provided, we can attempt to load that schema\n const schemaItems = this._context.getSchemaItems();\n let { value, done } = schemaItems.next();\n while (!done) {\n if (Unit.isUnit(value) && value.label?.toLowerCase() === displayLabel) {\n // TODO: this can be optimized. We don't have to await these if we don't want to check for them\n const currPhenomenon = await value.phenomenon;\n const currUnitSystem = await value.unitSystem;\n if (!schemaName || value.schema.name.toLowerCase() === schemaName)\n if (!phenomenon || (currPhenomenon && currPhenomenon.key.matchesFullName(phenomenon)))\n if (!unitSystem || (currUnitSystem && currUnitSystem.key.matchesFullName(unitSystem)))\n return this.getUnitsProps(value);\n } else if (InvertedUnit.isInvertedUnit(value) && value.label?.toLowerCase() === displayLabel && value.invertsUnit) {\n const invertsUnit = await value.invertsUnit;\n if (invertsUnit) {\n const currPhenomenon = await invertsUnit.phenomenon;\n const currUnitSystem = await invertsUnit.unitSystem;\n if (!schemaName || value.schema.name.toLowerCase() === schemaName)\n if (!phenomenon || (currPhenomenon && currPhenomenon.key.matchesFullName(phenomenon)))\n if (!unitSystem || (currUnitSystem && currUnitSystem.key.matchesFullName(unitSystem)))\n return this.getUnitsProps(value);\n }\n }\n ({ value, done } = schemaItems.next());\n }\n\n return new BadUnit();\n }\n\n /**\n * Finds Unit by altDisplayLabel and that it belongs to schemaName, phenomenon, and unitSystem if defined.\n * @internal\n */\n private async findUnitByAltDisplayLabel(altDisplayLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\n for (const entry of this._unitExtraData) {\n if (entry.altDisplayLabels && entry.altDisplayLabels.length > 0) {\n if (entry.altDisplayLabels.findIndex((ref: string) => ref.toLowerCase() === altDisplayLabel) !== -1) {\n // Found altDisplayLabel that matches label to find\n const unitProps = await this.findUnitByName(entry.name);\n // If no schemaName, phenomenon, or unitSystem are provided, return unitProps\n if (!schemaName && !phenomenon && !unitSystem)\n return unitProps;\n\n // Check if the provided values match unitProps\n const schemaNameMatches = !schemaName || unitProps.name.toLowerCase().startsWith(schemaName);\n const phenomenonMatches = !phenomenon || unitProps.phenomenon.toLowerCase() === phenomenon;\n const unitSystemMatches = !unitSystem || unitProps.system.toLowerCase() === unitSystem;\n // If all provided values match, return unitProps\n if (schemaNameMatches && phenomenonMatches && unitSystemMatches)\n return unitProps;\n }\n }\n }\n return new BadUnit();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaUnitProvider.js","sourceRoot":"","sources":["../../../src/UnitProvider/SchemaUnitProvider.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,sDAAkE;AAClE,wDAAmI;AACnI,wCAA2D;AAC3D,uDAAoD;AACpD,4CAAwD;AACxD,2CAAwC;AACxC,4CAA8C;AAC9C,mEAAgE;AAChE,2DAAwD;AAExD;;;GAGG;AACH,MAAa,kBAAkB;IAWyB;IAV9C,cAAc,CAAgB;IAC9B,QAAQ,CAAgB;IAEhC;;;;;;OAMG;IACH,YAAY,gBAAgC,EAAU,iBAAkC,EAAE;QAApC,mBAAc,GAAd,cAAc,CAAsB;QACxF,IAAI,gBAAgB,YAAY,uBAAa,EAAE,CAAC;YAC9C,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC;QACnC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,GAAG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AAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBACxD,6EAA6E;oBAC7E,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU;wBAC3C,OAAO,SAAS,CAAC;oBAEnB,+CAA+C;oBAC/C,MAAM,iBAAiB,GAAG,CAAC,UAAU,IAAI,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;oBAC7F,MAAM,iBAAiB,GAAG,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC;oBAC3F,MAAM,iBAAiB,GAAG,CAAC,UAAU,IAAI,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC;oBACvF,iDAAiD;oBACjD,IAAI,iBAAiB,IAAI,iBAAiB,IAAI,iBAAiB;wBAC7D,OAAO,SAAS,CAAC;gBACrB,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,IAAI,uBAAO,EAAE,CAAC;IACvB,CAAC;CACF;AA5RD,gDA4RC","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*--------------------------------------------------------------------------------------------*/\nimport { BentleyError, BentleyStatus } from \"@itwin/core-bentley\";\nimport { BadUnit, UnitConversionInvert, UnitConversionProps, UnitExtraData, UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\nimport { ISchemaLocater, SchemaContext } from \"../Context\";\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\nimport { SchemaItemKey, SchemaKey } from \"../SchemaKey\";\nimport { Unit } from \"../Metadata/Unit\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { UnitConverter } from \"../UnitConversion/UnitConverter\";\nimport { InvertedUnit } from \"../Metadata/InvertedUnit\";\n\n/**\n * Class used to find Units in SchemaContext by attributes such as Phenomenon and DisplayLabel.\n * @beta\n */\nexport class SchemaUnitProvider implements UnitsProvider {\n private _unitConverter: UnitConverter;\n private _context: SchemaContext;\n\n /**\n *\n * @param contextOrLocater The SchemaContext or a different ISchemaLocater implementation used to retrieve the schema. The SchemaContext\n * class implements the ISchemaLocater interface. If the provided locater is not a SchemaContext instance a new SchemaContext will be\n * created and the locater will be added.\n * @param _unitExtraData Additional data like alternate display label not found in Units Schema to match with Units; Defaults to empty array.\n */\n constructor(contextOrLocater: ISchemaLocater, private _unitExtraData: UnitExtraData[] = []) {\n if (contextOrLocater instanceof SchemaContext) {\n this._context = contextOrLocater;\n } else {\n this._context = new SchemaContext();\n this._context.addLocater(contextOrLocater);\n }\n this._unitConverter = new UnitConverter(this._context);\n }\n\n /**\n * Find unit in a schema that has unitName.\n * @param unitName Full name of unit.\n * @returns UnitProps interface from @itwin/core-quantity whose name matches unitName.\n */\n public async findUnitByName(unitName: string): Promise<UnitProps> {\n // Check if schema exists and unit exists in schema\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(unitName);\n const schemaKey = new SchemaKey(schemaName);\n const schema = await this._context.getSchema(schemaKey);\n\n if (!schema) {\n return new BadUnit(); // return BadUnit if schema does not exist\n }\n\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n const unit = await this._context.getSchemaItem(itemKey, Unit);\n if (unit && unit.schemaItemType === SchemaItemType.Unit)\n return this.getUnitsProps(unit);\n\n const invertedUnit = await this._context.getSchemaItem(itemKey, InvertedUnit);\n if (invertedUnit && invertedUnit.schemaItemType === SchemaItemType.InvertedUnit) {\n return this.getUnitsProps(invertedUnit);\n }\n\n return new BadUnit();\n }\n\n /**\n * Find all units in context that belongs to given phenomenon.\n * @param phenomenon Full name of phenomenon.\n * @returns Array of UnitProps (from @itwin/core-quantity) interface objects whose name matches phenomenon param.\n */\n public async getUnitsByFamily(phenomenon: string): Promise<Array<UnitProps>> {\n // Check if schema exists and phenomenon exists in schema\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(phenomenon);\n const schemaKey = new SchemaKey(schemaName);\n const schema = await this._context.getSchema(schemaKey);\n\n if (!schema) {\n throw new BentleyError(BentleyStatus.ERROR, \"Cannot find schema for phenomenon\", () => {\n return { phenomenon, schema: schemaName };\n });\n }\n\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n const phenom = await this._context.getSchemaItem(itemKey);\n if (!phenom)\n throw new BentleyError(BentleyStatus.ERROR, \"Cannot find schema item/phenomenon\", () => {\n return { item: schemaItemName, schema: schemaName };\n });\n\n if (phenom.schemaItemType !== SchemaItemType.Phenomenon)\n throw new BentleyError(BentleyStatus.ERROR, \"Item is not a phenomenon\", () => {\n return { itemType: phenom.key.fullName };\n });\n\n // Find units' full name that match given phenomenon param.\n const filteredUnits: Array<UnitProps> = [];\n const schemaItems = this._context.getSchemaItems();\n let { value, done } = schemaItems.next();\n while (!done) {\n if (Unit.isUnit(value)) {\n const foundPhenomenon = await value.phenomenon;\n if (foundPhenomenon && foundPhenomenon.key.matchesFullName(phenomenon)) {\n const unitProps = await this.getUnitsProps(value);\n filteredUnits.push(unitProps);\n }\n } else if (InvertedUnit.isInvertedUnit(value) && value.invertsUnit) {\n const invertsUnit = await value.invertsUnit;\n if (invertsUnit) {\n const foundPhenomenon = await invertsUnit.phenomenon;\n if (foundPhenomenon && foundPhenomenon.key.matchesFullName(phenomenon)) {\n const unitProps = await this.getUnitsProps(value);\n filteredUnits.push(unitProps);\n }\n }\n }\n ({ value, done } = schemaItems.next());\n }\n\n return filteredUnits;\n }\n\n /**\n * Find alternate display labels associated with unitName, if any.\n * @param unitName Full name of Unit.\n */\n public getAlternateDisplayLabels(unitName: string): Array<string> {\n let alternateLabels: Array<string> = [];\n for (const entry of this._unitExtraData) {\n if (entry.name.toLowerCase() === unitName.toLowerCase()) {\n alternateLabels = entry.altDisplayLabels;\n }\n }\n\n return alternateLabels;\n }\n\n /**\n * Finds Unit by unitLabel, which could be a display label in the schema or alternate an display label defined in\n * this._unitExtraData. If there are duplicates of the same display label in the context or teh same alternate display\n * labels, specify schemaName, phenomenon, or unitSystem to get a specific unit.\n *\n * @param unitLabel Display label or alternate display label to query unit by.\n * @param schemaName Ensure Unit with unitLabel belongs to Schema with schemaName.\n * @param phenomenon Full name of phenomenon that Unit belongs to.\n * @param unitSystem Full name of unitSystem that Unit belongs to.\n * @returns The UnitProps interface from the @itwin/core-quantity package.\n */\n public async findUnit(unitLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\n const findLabel = unitLabel.toLowerCase();\n const findSchema = schemaName ? schemaName.toLowerCase() : undefined;\n const findPhenomenon = phenomenon ? phenomenon.toLowerCase() : undefined;\n const findUnitSystem = unitSystem ? unitSystem.toLowerCase() : undefined;\n\n const foundUnit: UnitProps = await this.findUnitByDisplayLabel(findLabel, findSchema, findPhenomenon, findUnitSystem);\n if (foundUnit.isValid)\n return foundUnit;\n\n // If there is no Unit with display label that matches label, then check for alternate display labels that may match\n return this.findUnitByAltDisplayLabel(findLabel, findSchema, findPhenomenon, findUnitSystem);\n }\n\n /**\n * Gets the @itwin/core-quantity UnitConversionProps for the given fromUnit and toUnit.\n * @param fromUnit The UnitProps of the 'from' unit.\n * @param toUnit The UnitProps of the 'to' unit.\n * @returns The UnitConversionProps interface from the @itwin/core-quantity package.\n */\n public async getConversion(fromUnit: UnitProps, toUnit: UnitProps): Promise<UnitConversionProps> {\n // need to check if either side is an inverted unit. The UnitConverter can only handle Units\n if (!fromUnit.isValid || !toUnit.isValid)\n throw new BentleyError(BentleyStatus.ERROR, \"Both provided units must be valid.\", () => {\n return { fromUnit, toUnit };\n });\n\n const { unitName: fromUnitName, isInverted: fromIsInverted } = await this.checkUnitPropsForConversion(fromUnit, this._context);\n const { unitName: toUnitName, isInverted: toIsInverted } = await this.checkUnitPropsForConversion(toUnit, this._context);\n\n const conversion = await this._unitConverter.calculateConversion(fromUnitName, toUnitName);\n const result: UnitConversionProps = {\n factor: conversion.factor,\n offset: conversion.offset,\n };\n if (fromIsInverted && !toIsInverted)\n result.inversion = UnitConversionInvert.InvertPreConversion;\n else if (!fromIsInverted && toIsInverted)\n result.inversion = UnitConversionInvert.InvertPostConversion;\n\n return result;\n }\n\n private async checkUnitPropsForConversion(input: UnitProps, context: SchemaContext): Promise<{ unitName: string, isInverted: boolean }> {\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(input.name);\n const schemaKey = new SchemaKey(schemaName);\n const schema = await context.getSchema(schemaKey);\n\n if (!schema) {\n throw new BentleyError(BentleyStatus.ERROR, \"Could not obtain schema for unit.\", () => {\n return { name: input.name };\n });\n }\n\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n const invertedUnit = await context.getSchemaItem(itemKey, InvertedUnit);\n // Check if we found an item, the item is an inverted unit, and it has its invertsUnit property set\n if (invertedUnit && InvertedUnit.isInvertedUnit(invertedUnit) && invertedUnit.invertsUnit) {\n return { unitName: invertedUnit.invertsUnit.fullName, isInverted: true };\n }\n\n return { unitName: input.name, isInverted: false };\n }\n\n /**\n * Gets the @itwin/core UnitProps for the given Unit.\n * @param unit The Unit to convert.\n * @returns UnitProps interface from @itwin/core.\n */\n private async getUnitsProps(unit: Unit | InvertedUnit): Promise<UnitProps> {\n if (Unit.isUnit(unit)) {\n return {\n name: unit.fullName,\n label: unit.label ?? \"\",\n phenomenon: unit.phenomenon ? unit.phenomenon.fullName : \"\",\n isValid: true,\n system: unit.unitSystem === undefined ? \"\" : unit.unitSystem.fullName,\n };\n }\n\n const invertsUnit = await unit.invertsUnit;\n if (!invertsUnit)\n return new BadUnit();\n\n return {\n name: unit.fullName,\n label: unit.label ?? \"\",\n phenomenon: invertsUnit.phenomenon ? invertsUnit.phenomenon.fullName : \"\",\n isValid: true,\n system: unit.unitSystem === undefined ? \"\" : unit.unitSystem.fullName,\n };\n }\n\n /**\n * Finds Unit by displayLabel and that it belongs to schemaName, phenomenon, and unitSystem if defined.\n * @internal\n */\n private async findUnitByDisplayLabel(displayLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\n // TODO: Known bug: This only looks through loaded schemas. If schema name is provided, we can attempt to load that schema\n const schemaItems = this._context.getSchemaItems();\n let { value, done } = schemaItems.next();\n while (!done) {\n if (Unit.isUnit(value) && value.label?.toLowerCase() === displayLabel) {\n // TODO: this can be optimized. We don't have to await these if we don't want to check for them\n const currPhenomenon = await value.phenomenon;\n const currUnitSystem = await value.unitSystem;\n if (!schemaName || value.schema.name.toLowerCase() === schemaName)\n if (!phenomenon || (currPhenomenon && currPhenomenon.key.matchesFullName(phenomenon)))\n if (!unitSystem || (currUnitSystem && currUnitSystem.key.matchesFullName(unitSystem)))\n return this.getUnitsProps(value);\n } else if (InvertedUnit.isInvertedUnit(value) && value.label?.toLowerCase() === displayLabel && value.invertsUnit) {\n const invertsUnit = await value.invertsUnit;\n if (invertsUnit) {\n const currPhenomenon = await invertsUnit.phenomenon;\n const currUnitSystem = await invertsUnit.unitSystem;\n if (!schemaName || value.schema.name.toLowerCase() === schemaName)\n if (!phenomenon || (currPhenomenon && currPhenomenon.key.matchesFullName(phenomenon)))\n if (!unitSystem || (currUnitSystem && currUnitSystem.key.matchesFullName(unitSystem)))\n return this.getUnitsProps(value);\n }\n }\n ({ value, done } = schemaItems.next());\n }\n\n return new BadUnit();\n }\n\n /**\n * Finds Unit by altDisplayLabel and that it belongs to schemaName, phenomenon, and unitSystem if defined.\n * @internal\n */\n private async findUnitByAltDisplayLabel(altDisplayLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\n for (const entry of this._unitExtraData) {\n if (entry.altDisplayLabels && entry.altDisplayLabels.length > 0) {\n if (entry.altDisplayLabels.findIndex((ref: string) => ref.toLowerCase() === altDisplayLabel) !== -1) {\n // Found altDisplayLabel that matches label to find\n const unitProps = await this.findUnitByName(entry.name);\n // If no schemaName, phenomenon, or unitSystem are provided, return unitProps\n if (!schemaName && !phenomenon && !unitSystem)\n return unitProps;\n\n // Check if the provided values match unitProps\n const schemaNameMatches = !schemaName || unitProps.name.toLowerCase().startsWith(schemaName);\n const phenomenonMatches = !phenomenon || unitProps.phenomenon.toLowerCase() === phenomenon;\n const unitSystemMatches = !unitSystem || unitProps.system.toLowerCase() === unitSystem;\n // If all provided values match, return unitProps\n if (schemaNameMatches && phenomenonMatches && unitSystemMatches)\n return unitProps;\n }\n }\n }\n return new BadUnit();\n }\n}\n"]}
|
|
@@ -17,7 +17,7 @@ export declare class SchemaWalker {
|
|
|
17
17
|
* Traverses the given Schema, calling ISchemaWalkerVisitor methods along the way.
|
|
18
18
|
* @param schema The Schema to traverse.
|
|
19
19
|
*/
|
|
20
|
-
traverseSchema
|
|
20
|
+
traverseSchema(schema: Schema): Promise<Schema>;
|
|
21
21
|
private traverseSchemaItem;
|
|
22
22
|
private traverseClass;
|
|
23
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaWalker.d.ts","sourceRoot":"","sources":["../../../src/Validation/SchemaWalker.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,kBAAkB,EAA6B,MAAM,8BAA8B,CAAC;AAE7F;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,cAAc,CAA4B;IAIlD,OAAO,CAAC,OAAO,CAAC,CAAS;IAEzB;;;OAGG;gBACS,OAAO,EAAE,kBAAkB;IAIvC;;;OAGG;IACU,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"SchemaWalker.d.ts","sourceRoot":"","sources":["../../../src/Validation/SchemaWalker.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,kBAAkB,EAA6B,MAAM,8BAA8B,CAAC;AAE7F;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,cAAc,CAA4B;IAIlD,OAAO,CAAC,OAAO,CAAC,CAAS;IAEzB;;;OAGG;gBACS,OAAO,EAAE,kBAAkB;IAIvC;;;OAGG;IACU,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAW9C,kBAAkB;YAOlB,aAAa;CAY5B"}
|
|
@@ -14,6 +14,10 @@ const SchemaPartVisitorDelegate_1 = require("../SchemaPartVisitorDelegate");
|
|
|
14
14
|
* @internal
|
|
15
15
|
*/
|
|
16
16
|
class SchemaWalker {
|
|
17
|
+
_visitorHelper;
|
|
18
|
+
// This is a cache of the schema we are traversing. The schema also exists within the _context but in order
|
|
19
|
+
// to not have to go back to the context every time we use this cache.
|
|
20
|
+
_schema;
|
|
17
21
|
/**
|
|
18
22
|
* Initializes a new SchemaWalker instance.
|
|
19
23
|
* @param visitor An ISchemaWalkerVisitor implementation whose methods will be called during schema traversal.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaWalker.js","sourceRoot":"","sources":["../../../src/Validation/SchemaWalker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,4CAA8C;AAC9C,6CAA4C;AAI5C,4EAA6F;AAE7F;;;;GAIG;AACH,MAAa,YAAY;
|
|
1
|
+
{"version":3,"file":"SchemaWalker.js","sourceRoot":"","sources":["../../../src/Validation/SchemaWalker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,4CAA8C;AAC9C,6CAA4C;AAI5C,4EAA6F;AAE7F;;;;GAIG;AACH,MAAa,YAAY;IACf,cAAc,CAA4B;IAElD,2GAA2G;IAC3G,sEAAsE;IAC9D,OAAO,CAAU;IAEzB;;;OAGG;IACH,YAAY,OAA2B;QACrC,IAAI,CAAC,cAAc,GAAG,IAAI,qDAAyB,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,cAAc,CAAC,MAAc;QACxC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAEtB,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC9C,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAElD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YACxC,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAC,UAAsB;QACrD,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAEtD,IAAI,eAAO,CAAC,SAAS,CAAC,UAAU,CAAC;YAC/B,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAEO,KAAK,CAAC,aAAa,CAAC,OAAgB;QAC1C,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACvB,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;gBAC1C,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;QAED,IAAI,OAAO,CAAC,cAAc,KAAK,0BAAc,CAAC,iBAAiB,EAAE,CAAC;YAChE,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAE,OAA6B,CAAC,MAAM,CAAC,CAAC;YACjF,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAE,OAA6B,CAAC,MAAM,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;CACF;AAjDD,oCAiDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { SchemaItemType } from \"../ECObjects\";\nimport { ECClass } from \"../Metadata/Class\";\nimport { RelationshipClass } from \"../Metadata/RelationshipClass\";\nimport { Schema } from \"../Metadata/Schema\";\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\nimport { ISchemaPartVisitor, SchemaPartVisitorDelegate } from \"../SchemaPartVisitorDelegate\";\n\n/**\n * The purpose of this class is to traverse a given schema, allowing clients to hook into\n * the traversal process via Visitors to allow for custom processing of the schema elements.\n * @internal\n */\nexport class SchemaWalker {\n private _visitorHelper: SchemaPartVisitorDelegate;\n\n // This is a cache of the schema we are traversing. The schema also exists within the _context but in order\n // to not have to go back to the context every time we use this cache.\n private _schema?: Schema;\n\n /**\n * Initializes a new SchemaWalker instance.\n * @param visitor An ISchemaWalkerVisitor implementation whose methods will be called during schema traversal.\n */\n constructor(visitor: ISchemaPartVisitor) {\n this._visitorHelper = new SchemaPartVisitorDelegate(visitor);\n }\n\n /**\n * Traverses the given Schema, calling ISchemaWalkerVisitor methods along the way.\n * @param schema The Schema to traverse.\n */\n public async traverseSchema(schema: Schema): Promise<Schema> {\n this._schema = schema;\n\n await this._visitorHelper.visitSchema(schema);\n await this._visitorHelper.visitSchemaPart(schema);\n\n for (const item of this._schema.getItems())\n await this.traverseSchemaItem(item);\n return schema;\n }\n\n private async traverseSchemaItem(schemaItem: SchemaItem): Promise<void> {\n await this._visitorHelper.visitSchemaPart(schemaItem);\n\n if (ECClass.isECClass(schemaItem))\n await this.traverseClass(schemaItem);\n }\n\n private async traverseClass(ecClass: ECClass): Promise<void> {\n if (ecClass.properties) {\n for (const property of ecClass.properties) {\n await this._visitorHelper.visitSchemaPart(property);\n }\n }\n\n if (ecClass.schemaItemType === SchemaItemType.RelationshipClass) {\n await this._visitorHelper.visitSchemaPart((ecClass as RelationshipClass).source);\n await this._visitorHelper.visitSchemaPart((ecClass as RelationshipClass).target);\n }\n }\n}\n"]}
|
|
@@ -12,9 +12,8 @@ const Exception_1 = require("../Exception");
|
|
|
12
12
|
* @internal
|
|
13
13
|
*/
|
|
14
14
|
class SchemaGraph {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
15
|
+
_schemas = [];
|
|
16
|
+
constructor() { }
|
|
18
17
|
find(schemaKey) {
|
|
19
18
|
return this._schemas.find((info) => info.schemaKey.matches(schemaKey, ECObjects_1.SchemaMatchType.Latest));
|
|
20
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaGraph.js","sourceRoot":"","sources":["../../../src/utils/SchemaGraph.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAG/F,4CAA+C;AAC/C,4CAA+D;AAc/D;;;GAGG;AACH,MAAa,WAAW;
|
|
1
|
+
{"version":3,"file":"SchemaGraph.js","sourceRoot":"","sources":["../../../src/utils/SchemaGraph.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAG/F,4CAA+C;AAC/C,4CAA+D;AAc/D;;;GAGG;AACH,MAAa,WAAW;IACd,QAAQ,GAAiB,EAAE,CAAC;IAEpC,gBAAwB,CAAC;IAEjB,IAAI,CAAC,SAAoB;QAC/B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,2BAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7G,CAAC;IAED;;OAEG;IACI,aAAa;QAClB,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACnC,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,QAAQ,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxH,MAAM,IAAI,0BAAc,CAAC,2BAAe,CAAC,aAAa,EAAE,WAAW,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,2BAA2B,MAAM,EAAE,CAAC,CAAC;QACzI,CAA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AAI,IAAI,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,SAAS,CAAC,IAAI,kCAAkC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;oBACpM,CAAC;oBACD,MAAM,QAAQ,CAAC,OAAO,CAAC,CAAC;gBAC1B,CAAC;YACH,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC;QACvB,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,iBAAiB,CAAC,MAAc;QAC5C,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC;QAEhC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE;YAC7B,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;gBACzB,OAAO;YAET,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAEvB,KAAK,MAAM,SAAS,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;gBACrC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;oBAClC,QAAQ,CAAC,SAAS,CAAC,CAAC;YACxB,CAAC;QACH,CAAC,CAAC;QAEF,QAAQ,CAAC,MAAM,CAAC,CAAC;QACjB,OAAO,KAAK,CAAC;IACf,CAAC;CAEF;AAvHD,kCAuHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { SchemaContext } from \"../Context\";\nimport { SchemaMatchType } from \"../ECObjects\";\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\nimport { SchemaInfo } from \"../Interfaces\";\nimport { Schema } from \"../Metadata/Schema\";\nimport { SchemaKey } from \"../SchemaKey\";\n\n/**\n * A schema and it's reference that make up part of a schema cycle\n * @internal\n */\nexport interface ReferenceCycle {\n schema: SchemaInfo;\n refSchema: SchemaInfo;\n}\n\n/**\n * Utility class for detecting cyclic references in a Schema graph.\n * @internal\n */\nexport class SchemaGraph {\n private _schemas: SchemaInfo[] = [];\n\n private constructor() { }\n\n private find(schemaKey: SchemaKey) {\n return this._schemas.find((info: SchemaInfo) => info.schemaKey.matches(schemaKey, SchemaMatchType.Latest));\n }\n\n /**\n * Detected cyclic references in a schema and throw an exception if a cycle is found.\n */\n public throwIfCycles() {\n const cycles = this.detectCycles();\n if (cycles) {\n const result = cycles.map((cycle) => `${cycle.schema.schemaKey.name} --> ${cycle.refSchema.schemaKey.name}`).join(\", \");\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Schema '${this._schemas[0].schemaKey.name}' has reference cycles: ${result}`);\n }\n }\n\n /**\n * Detected cyclic references in a schema.\n * @returns An array describing the cycle if there is a cycle or undefined if no cycles found.\n */\n public detectCycles(): ReferenceCycle[] | undefined {\n const visited = {};\n const recStack = {};\n const cycles: ReferenceCycle[] = [];\n\n for (const schema of this._schemas) {\n if (this.detectCycleUtil(schema, visited, recStack, cycles)) {\n return cycles.length > 0 ? cycles : undefined;\n }\n }\n\n return undefined;\n }\n\n private detectCycleUtil(schema: SchemaInfo, visited: any, recStack: any, cycles: ReferenceCycle[]): boolean {\n let cycleFound = false;\n\n if (!visited[schema.schemaKey.name]) {\n visited[schema.schemaKey.name] = true;\n recStack[schema.schemaKey.name] = true;\n\n for (const refKey of schema.references) {\n const refSchema = this.find(refKey.schemaKey);\n if (undefined === refSchema)\n throw new ECObjectsError(ECObjectsStatus.UnableToLoadSchema, `Could not find the schema info for ref schema ${refKey.schemaKey.toString()} for schema ${schema.schemaKey.toString()}`);\n if (!visited[refKey.schemaKey.name] && this.detectCycleUtil(refSchema, visited, recStack, cycles)) {\n cycles.push({ schema, refSchema });\n cycleFound = true;\n } else if (recStack[refKey.schemaKey.name]) {\n cycles.push({ schema, refSchema });\n cycleFound = true;\n }\n }\n }\n if (!cycleFound)\n recStack[schema.schemaKey.name] = false;\n\n return cycleFound;\n }\n\n /**\n * Generates a SchemaGraph for the input schema using the context to find info on referenced schemas. Use the generateGraphSync if you have the fully loaded Schema.\n * @param schema The SchemaInfo to build the graph from\n * @param context The SchemaContext used to locate info on the referenced schemas\n * @returns A SchemaGraph that can be used to detect schema cycles\n */\n public static async generateGraph(schema: SchemaInfo, context: SchemaContext): Promise<SchemaGraph> {\n const graph = new SchemaGraph();\n\n const genGraph = async (s: SchemaInfo) => {\n if (graph.find(s.schemaKey))\n return;\n\n graph._schemas.push(s);\n\n for (const refSchema of s.references) {\n if (!graph.find(refSchema.schemaKey)) {\n const refInfo = await context.getSchemaInfo(refSchema.schemaKey, SchemaMatchType.LatestWriteCompatible);\n if (undefined === refInfo) {\n throw new ECObjectsError(ECObjectsStatus.UnableToLocateSchema,\n `Could not locate the referenced schema, ${refSchema.schemaKey.name}.${refSchema.schemaKey.version.toString()}, of ${s.schemaKey.name} when populating the graph for ${schema.schemaKey.name}`);\n }\n await genGraph(refInfo);\n }\n }\n };\n\n await genGraph(schema);\n return graph;\n }\n\n /**\n * Generates a SchemaGraph for the input schema. Use the generateGraph if you just have schema info.\n * @param schema The Schema to build the graph from.\n * @returns A SchemaGraph that can be used to detect schema cycles\n */\n public static generateGraphSync(schema: Schema): SchemaGraph {\n const graph = new SchemaGraph();\n\n const genGraph = (s: Schema) => {\n if (graph.find(s.schemaKey))\n return;\n\n graph._schemas.push(s);\n\n for (const refSchema of s.references) {\n if (!graph.find(refSchema.schemaKey))\n genGraph(refSchema);\n }\n };\n\n genGraph(schema);\n return graph;\n }\n\n}\n\n"]}
|
package/lib/esm/Constants.js
CHANGED
|
@@ -6,25 +6,25 @@
|
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
export class ECStringConstants {
|
|
9
|
+
// Relationship End
|
|
10
|
+
static RELATIONSHIP_END_SOURCE = "Source";
|
|
11
|
+
static RELATIONSHIP_END_TARGET = "Target";
|
|
12
|
+
// Container Type
|
|
13
|
+
static CONTAINERTYPE_SCHEMA = "Schema";
|
|
14
|
+
static CONTAINERTYPE_ENTITYCLASS = "EntityClass";
|
|
15
|
+
static CONTAINERTYPE_CUSTOMATTRIBUTECLASS = "CustomAttributeClass";
|
|
16
|
+
static CONTAINERTYPE_STRUCTCLASS = "StructClass";
|
|
17
|
+
static CONTAINERTYPE_RELATIONSHIPCLASS = "RelationshipClass";
|
|
18
|
+
static CONTAINERTYPE_ANYCLASS = "AnyClass";
|
|
19
|
+
static CONTAINERTYPE_PRIMITIVEPROPERTY = "PrimitiveProperty";
|
|
20
|
+
static CONTAINERTYPE_STRUCTPROPERTY = "StructProperty";
|
|
21
|
+
static CONTAINERTYPE_PRIMITIVEARRAYPROPERTY = "ArrayProperty";
|
|
22
|
+
static CONTAINERTYPE_STRUCTARRAYPROPERTY = "StructArrayProperty";
|
|
23
|
+
static CONTAINERTYPE_NAVIGATIONPROPERTY = "NavigationProperty";
|
|
24
|
+
static CONTAINERTYPE_ANYPROPERTY = "AnyProperty";
|
|
25
|
+
static CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT = "SourceRelationshipConstraint";
|
|
26
|
+
static CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT = "TargetRelationshipConstraint";
|
|
27
|
+
static CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT = "AnyRelationshipConstraint";
|
|
28
|
+
static CONTAINERTYPE_ANY = "Any";
|
|
9
29
|
}
|
|
10
|
-
// Relationship End
|
|
11
|
-
ECStringConstants.RELATIONSHIP_END_SOURCE = "Source";
|
|
12
|
-
ECStringConstants.RELATIONSHIP_END_TARGET = "Target";
|
|
13
|
-
// Container Type
|
|
14
|
-
ECStringConstants.CONTAINERTYPE_SCHEMA = "Schema";
|
|
15
|
-
ECStringConstants.CONTAINERTYPE_ENTITYCLASS = "EntityClass";
|
|
16
|
-
ECStringConstants.CONTAINERTYPE_CUSTOMATTRIBUTECLASS = "CustomAttributeClass";
|
|
17
|
-
ECStringConstants.CONTAINERTYPE_STRUCTCLASS = "StructClass";
|
|
18
|
-
ECStringConstants.CONTAINERTYPE_RELATIONSHIPCLASS = "RelationshipClass";
|
|
19
|
-
ECStringConstants.CONTAINERTYPE_ANYCLASS = "AnyClass";
|
|
20
|
-
ECStringConstants.CONTAINERTYPE_PRIMITIVEPROPERTY = "PrimitiveProperty";
|
|
21
|
-
ECStringConstants.CONTAINERTYPE_STRUCTPROPERTY = "StructProperty";
|
|
22
|
-
ECStringConstants.CONTAINERTYPE_PRIMITIVEARRAYPROPERTY = "ArrayProperty";
|
|
23
|
-
ECStringConstants.CONTAINERTYPE_STRUCTARRAYPROPERTY = "StructArrayProperty";
|
|
24
|
-
ECStringConstants.CONTAINERTYPE_NAVIGATIONPROPERTY = "NavigationProperty";
|
|
25
|
-
ECStringConstants.CONTAINERTYPE_ANYPROPERTY = "AnyProperty";
|
|
26
|
-
ECStringConstants.CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT = "SourceRelationshipConstraint";
|
|
27
|
-
ECStringConstants.CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT = "TargetRelationshipConstraint";
|
|
28
|
-
ECStringConstants.CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT = "AnyRelationshipConstraint";
|
|
29
|
-
ECStringConstants.CONTAINERTYPE_ANY = "Any";
|
|
30
30
|
//# sourceMappingURL=Constants.js.map
|
package/lib/esm/Constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/Constants.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,MAAM,OAAO,iBAAiB
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/Constants.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAC5B,mBAAmB;IACZ,MAAM,CAAU,uBAAuB,GAAW,QAAQ,CAAC;IAC3D,MAAM,CAAU,uBAAuB,GAAW,QAAQ,CAAC;IAElE,iBAAiB;IACV,MAAM,CAAU,oBAAoB,GAAW,QAAQ,CAAC;IACxD,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAClE,MAAM,CAAU,kCAAkC,GAAW,sBAAsB,CAAC;IACpF,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAClE,MAAM,CAAU,+BAA+B,GAAW,mBAAmB,CAAC;IAC9E,MAAM,CAAU,sBAAsB,GAAW,UAAU,CAAC;IAE5D,MAAM,CAAU,+BAA+B,GAAW,mBAAmB,CAAC;IAC9E,MAAM,CAAU,4BAA4B,GAAW,gBAAgB,CAAC;IACxE,MAAM,CAAU,oCAAoC,GAAW,eAAe,CAAC;IAC/E,MAAM,CAAU,iCAAiC,GAAW,qBAAqB,CAAC;IAClF,MAAM,CAAU,gCAAgC,GAAW,oBAAoB,CAAC;IAChF,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAElE,MAAM,CAAU,0CAA0C,GAAW,8BAA8B,CAAC;IACpG,MAAM,CAAU,0CAA0C,GAAW,8BAA8B,CAAC;IACpG,MAAM,CAAU,uCAAuC,GAAW,2BAA2B,CAAC;IAE9F,MAAM,CAAU,iBAAiB,GAAW,KAAK,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\n/**\n * @internal\n */\nexport class ECStringConstants {\n // Relationship End\n public static readonly RELATIONSHIP_END_SOURCE: string = \"Source\";\n public static readonly RELATIONSHIP_END_TARGET: string = \"Target\";\n\n // Container Type\n public static readonly CONTAINERTYPE_SCHEMA: string = \"Schema\";\n public static readonly CONTAINERTYPE_ENTITYCLASS: string = \"EntityClass\";\n public static readonly CONTAINERTYPE_CUSTOMATTRIBUTECLASS: string = \"CustomAttributeClass\";\n public static readonly CONTAINERTYPE_STRUCTCLASS: string = \"StructClass\";\n public static readonly CONTAINERTYPE_RELATIONSHIPCLASS: string = \"RelationshipClass\";\n public static readonly CONTAINERTYPE_ANYCLASS: string = \"AnyClass\";\n\n public static readonly CONTAINERTYPE_PRIMITIVEPROPERTY: string = \"PrimitiveProperty\";\n public static readonly CONTAINERTYPE_STRUCTPROPERTY: string = \"StructProperty\";\n public static readonly CONTAINERTYPE_PRIMITIVEARRAYPROPERTY: string = \"ArrayProperty\";\n public static readonly CONTAINERTYPE_STRUCTARRAYPROPERTY: string = \"StructArrayProperty\";\n public static readonly CONTAINERTYPE_NAVIGATIONPROPERTY: string = \"NavigationProperty\";\n public static readonly CONTAINERTYPE_ANYPROPERTY: string = \"AnyProperty\";\n\n public static readonly CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT: string = \"SourceRelationshipConstraint\";\n public static readonly CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT: string = \"TargetRelationshipConstraint\";\n public static readonly CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT: string = \"AnyRelationshipConstraint\";\n\n public static readonly CONTAINERTYPE_ANY: string = \"Any\";\n}\n"]}
|
package/lib/esm/Context.d.ts
CHANGED
|
@@ -19,14 +19,14 @@ export interface ISchemaLocater {
|
|
|
19
19
|
* @param matchType how to match key against candidate schemas
|
|
20
20
|
* @param context context for loading schema references
|
|
21
21
|
*/
|
|
22
|
-
getSchema
|
|
22
|
+
getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<Schema | undefined>;
|
|
23
23
|
/**
|
|
24
24
|
* Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.
|
|
25
25
|
* May return the entire Schema so long as it is completely loaded as it satisfies the SchemaInfo interface.
|
|
26
26
|
* @param schemaKey The SchemaKey describing the schema to get from the cache.
|
|
27
27
|
* @param matchType The match type to use when locating the schema
|
|
28
28
|
*/
|
|
29
|
-
getSchemaInfo(schemaKey:
|
|
29
|
+
getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined>;
|
|
30
30
|
/**
|
|
31
31
|
* Attempts to get a schema from the locater. Yields undefined if no matching schema is found.
|
|
32
32
|
* For schemas that may have references, construct and call through a SchemaContext instead.
|
|
@@ -34,13 +34,30 @@ export interface ISchemaLocater {
|
|
|
34
34
|
* @param matchType how to match key against candidate schemas
|
|
35
35
|
* @param context context for loading schema references
|
|
36
36
|
*/
|
|
37
|
-
getSchemaSync
|
|
37
|
+
getSchemaSync(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Schema | undefined;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
+
* Base interface for types that allow location of items inside a schema
|
|
40
41
|
* @beta
|
|
41
42
|
*/
|
|
42
43
|
export interface ISchemaItemLocater {
|
|
43
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Gets the schema item from the specified schema if it exists in this [[SchemaContext]].
|
|
46
|
+
* Will await a partially loaded schema then look in it for the requested item.
|
|
47
|
+
* @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.
|
|
48
|
+
* @returns The requested schema item.
|
|
49
|
+
*/
|
|
50
|
+
getSchemaItem(schemaItemKey: SchemaItemKey): Promise<SchemaItem | undefined>;
|
|
51
|
+
getSchemaItem<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): Promise<InstanceType<T> | undefined>;
|
|
52
|
+
/**
|
|
53
|
+
* Gets the schema item from the specified schema if it exists in this [[SchemaContext]].
|
|
54
|
+
* Will skip a partially loaded schema and return undefined if the item belongs to that schema. Use the async method to await partially loaded schemas.
|
|
55
|
+
* @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.
|
|
56
|
+
* @param itemConstructor The constructor of the item to return.
|
|
57
|
+
* @returns The requested schema item.
|
|
58
|
+
*/
|
|
59
|
+
getSchemaItemSync(schemaItemKey: SchemaItemKey): SchemaItem | undefined;
|
|
60
|
+
getSchemaItemSync<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): InstanceType<T> | undefined;
|
|
44
61
|
}
|
|
45
62
|
/**
|
|
46
63
|
* @internal
|
|
@@ -58,7 +75,7 @@ export declare class SchemaCache implements ISchemaLocater {
|
|
|
58
75
|
* Returns true if the schema exists in either the schema cache or the promise cache. SchemaMatchType.Latest used.
|
|
59
76
|
* @param schemaKey The key to search for.
|
|
60
77
|
*/
|
|
61
|
-
schemaExists(schemaKey:
|
|
78
|
+
schemaExists(schemaKey: SchemaKey): boolean;
|
|
62
79
|
/**
|
|
63
80
|
* Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.
|
|
64
81
|
* When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache
|
|
@@ -71,30 +88,30 @@ export declare class SchemaCache implements ISchemaLocater {
|
|
|
71
88
|
* Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.
|
|
72
89
|
* @param schema The schema to add to the cache.
|
|
73
90
|
*/
|
|
74
|
-
addSchema
|
|
91
|
+
addSchema(schema: Schema): Promise<void>;
|
|
75
92
|
/**
|
|
76
93
|
* Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.
|
|
77
94
|
* @param schema The schema to add to the cache.
|
|
78
95
|
*/
|
|
79
|
-
addSchemaSync
|
|
96
|
+
addSchemaSync(schema: Schema): void;
|
|
80
97
|
/**
|
|
81
98
|
* Gets the schema which matches the provided SchemaKey.
|
|
82
99
|
* @param schemaKey The SchemaKey describing the schema to get from the cache.
|
|
83
100
|
* @param matchType The match type to use when locating the schema
|
|
84
101
|
*/
|
|
85
|
-
getSchema
|
|
102
|
+
getSchema(schemaKey: SchemaKey, matchType?: SchemaMatchType): Promise<Schema | undefined>;
|
|
86
103
|
/**
|
|
87
104
|
* Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.
|
|
88
105
|
* @param schemaKey The SchemaKey describing the schema to get from the cache.
|
|
89
106
|
* @param matchType The match type to use when locating the schema
|
|
90
107
|
*/
|
|
91
|
-
getSchemaInfo(schemaKey:
|
|
108
|
+
getSchemaInfo(schemaKey: SchemaKey, matchType?: SchemaMatchType): Promise<SchemaInfo | undefined>;
|
|
92
109
|
/**
|
|
93
110
|
* Gets the schema which matches the provided SchemaKey. If the schema is partially loaded an exception will be thrown.
|
|
94
111
|
* @param schemaKey The SchemaKey describing the schema to get from the cache.
|
|
95
112
|
* @param matchType The match type to use when locating the schema
|
|
96
113
|
*/
|
|
97
|
-
getSchemaSync
|
|
114
|
+
getSchemaSync(schemaKey: SchemaKey, matchType?: SchemaMatchType): Schema | undefined;
|
|
98
115
|
/**
|
|
99
116
|
* Generator function that can iterate through each schema in _schema SchemaMap and items for each Schema.
|
|
100
117
|
* Does not include schema items from schemas that are not completely loaded yet.
|
|
@@ -118,8 +135,27 @@ export declare class SchemaCache implements ISchemaLocater {
|
|
|
118
135
|
export declare class SchemaContext implements ISchemaItemLocater {
|
|
119
136
|
private _locaters;
|
|
120
137
|
private _knownSchemas;
|
|
138
|
+
private _fallbackLocaterDefined;
|
|
121
139
|
constructor();
|
|
140
|
+
get locaters(): ISchemaLocater[];
|
|
141
|
+
/**
|
|
142
|
+
* Adds a locater to the context.
|
|
143
|
+
*
|
|
144
|
+
* If no locaters are defined or a fallback locater is not defined, the new locater is added at the end of the locaters array.
|
|
145
|
+
* If a fallback locater is already defined, the new locater is inserted before the fallback locater.
|
|
146
|
+
*
|
|
147
|
+
* @param locater - The locater to be added.
|
|
148
|
+
*/
|
|
122
149
|
addLocater(locater: ISchemaLocater): void;
|
|
150
|
+
/**
|
|
151
|
+
* Adds a fallback locater to the context.
|
|
152
|
+
*
|
|
153
|
+
* If a fallback locater is already defined, it replaces the existing one.
|
|
154
|
+
* Otherwise, it adds the new locater to the end of the locaters array and marks the fallback locater as defined.
|
|
155
|
+
*
|
|
156
|
+
* @param locater - The locater to be added as a fallback.
|
|
157
|
+
*/
|
|
158
|
+
addFallbackLocater(locater: ISchemaLocater): void;
|
|
123
159
|
/**
|
|
124
160
|
* Adds the schema to this context. Use addSchemaPromise instead when asynchronously loading schemas.
|
|
125
161
|
* @param schema The schema to add to this context
|
|
@@ -140,7 +176,7 @@ export declare class SchemaContext implements ISchemaItemLocater {
|
|
|
140
176
|
* Returns true if the schema is already in the context. SchemaMatchType.Latest is used to find a match.
|
|
141
177
|
* @param schemaKey
|
|
142
178
|
*/
|
|
143
|
-
schemaExists(schemaKey:
|
|
179
|
+
schemaExists(schemaKey: SchemaKey): boolean;
|
|
144
180
|
/**
|
|
145
181
|
* Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.
|
|
146
182
|
* When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache.
|
|
@@ -155,21 +191,21 @@ export declare class SchemaContext implements ISchemaItemLocater {
|
|
|
155
191
|
* @param matchType Criteria by which to identify potentially matching schemas.
|
|
156
192
|
* @returns the schema matching the input criteria, or `undefined` if no such schema could be located.
|
|
157
193
|
*/
|
|
158
|
-
getSchema
|
|
194
|
+
getSchema(schemaKey: SchemaKey, matchType?: SchemaMatchType): Promise<Schema | undefined>;
|
|
159
195
|
/**
|
|
160
196
|
* Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.
|
|
161
197
|
* The fully loaded schema can be gotten later from the context using [[getSchema]].
|
|
162
198
|
* @param schemaKey The SchemaKey describing the schema to get from the cache.
|
|
163
199
|
* @param matchType The match type to use when locating the schema
|
|
164
200
|
*/
|
|
165
|
-
getSchemaInfo(schemaKey:
|
|
201
|
+
getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType): Promise<SchemaInfo | undefined>;
|
|
166
202
|
/** Attempts to obtain a schema from this context that matches the specified criteria.
|
|
167
203
|
* Will return undefined if the schema is partially loaded. Use [[getSchema]] to await until the schema is completely loaded.
|
|
168
204
|
* @param schemaKey Identifies the schema to obtain.
|
|
169
205
|
* @param matchType Criteria by which to identify potentially matching schemas.
|
|
170
206
|
* @returns the schema matching the input criteria, or `undefined` if no such schema could be located.
|
|
171
207
|
*/
|
|
172
|
-
getSchemaSync
|
|
208
|
+
getSchemaSync(schemaKey: SchemaKey, matchType?: SchemaMatchType): Schema | undefined;
|
|
173
209
|
/**
|
|
174
210
|
* Attempts to get a Schema from the context's cache.
|
|
175
211
|
* Will await a partially loaded schema then return when it is completely loaded.
|
|
@@ -177,7 +213,7 @@ export declare class SchemaContext implements ISchemaItemLocater {
|
|
|
177
213
|
* @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.
|
|
178
214
|
* @internal
|
|
179
215
|
*/
|
|
180
|
-
getCachedSchema
|
|
216
|
+
getCachedSchema(schemaKey: SchemaKey, matchType?: SchemaMatchType): Promise<Schema | undefined>;
|
|
181
217
|
/**
|
|
182
218
|
* Attempts to get a Schema from the context's cache.
|
|
183
219
|
* Will return undefined if the cached schema is partially loaded. Use [[getCachedSchema]] to await until the schema is completely loaded.
|
|
@@ -185,21 +221,25 @@ export declare class SchemaContext implements ISchemaItemLocater {
|
|
|
185
221
|
* @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.
|
|
186
222
|
* @internal
|
|
187
223
|
*/
|
|
188
|
-
getCachedSchemaSync
|
|
224
|
+
getCachedSchemaSync(schemaKey: SchemaKey, matchType?: SchemaMatchType): Schema | undefined;
|
|
189
225
|
/**
|
|
190
226
|
* Gets the schema item from the specified schema if it exists in this [[SchemaContext]].
|
|
191
227
|
* Will await a partially loaded schema then look in it for the requested item
|
|
192
228
|
* @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.
|
|
229
|
+
* @param itemConstructor The constructor of the item to return.
|
|
193
230
|
* @returns The requested schema item
|
|
194
231
|
*/
|
|
195
|
-
getSchemaItem
|
|
232
|
+
getSchemaItem(schemaItemKey: SchemaItemKey): Promise<SchemaItem | undefined>;
|
|
233
|
+
getSchemaItem<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): Promise<InstanceType<T> | undefined>;
|
|
196
234
|
/**
|
|
197
235
|
* Gets the schema item from the specified schema if it exists in this [[SchemaContext]].
|
|
198
|
-
* Will
|
|
199
|
-
* @param schemaItemKey The SchemaItemKey identifying the item to return.
|
|
236
|
+
* Will return undefined if the cached schema is partially loaded. Use [[getSchemaItem]] to await until the schema is completely loaded.
|
|
237
|
+
* @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.
|
|
238
|
+
* @param itemConstructor The constructor of the item to return.
|
|
200
239
|
* @returns The requested schema item
|
|
201
240
|
*/
|
|
202
|
-
getSchemaItemSync
|
|
241
|
+
getSchemaItemSync(schemaItemKey: SchemaItemKey): SchemaItem | undefined;
|
|
242
|
+
getSchemaItemSync<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): InstanceType<T> | undefined;
|
|
203
243
|
/**
|
|
204
244
|
* Iterates through the items of each schema known to the context. This includes schemas added to the
|
|
205
245
|
* context using [[SchemaContext.addSchema]]. This does not include schemas that
|
package/lib/esm/Context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/Context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/Context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAiB,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aA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