@itwin/ecschema-metadata 5.0.0-dev.10 → 5.0.0-dev.102
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 +56 -1
- package/lib/cjs/Constants.d.ts +8 -0
- package/lib/cjs/Constants.d.ts.map +1 -1
- package/lib/cjs/Constants.js +30 -21
- package/lib/cjs/Constants.js.map +1 -1
- package/lib/cjs/Context.d.ts +83 -34
- package/lib/cjs/Context.d.ts.map +1 -1
- package/lib/cjs/Context.js +73 -23
- 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 +14 -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.d.ts.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.js +11 -3
- package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.js +2 -6
- package/lib/cjs/Deserialization/XmlSerializationUtils.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 +33 -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 +83 -21
- package/lib/cjs/Metadata/Class.d.ts.map +1 -1
- package/lib/cjs/Metadata/Class.js +188 -63
- 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 +20 -8
- package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js +43 -23
- 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 +5 -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 +117 -13
- package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
- package/lib/cjs/Metadata/Schema.js +148 -70
- 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 +12 -2
- 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.d.ts.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js +8 -9
- 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 +6 -4
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-metadata.d.ts +1 -1
- package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
- package/lib/cjs/ecschema-metadata.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.d.ts +8 -0
- package/lib/esm/Constants.d.ts.map +1 -1
- package/lib/esm/Constants.js +29 -20
- package/lib/esm/Constants.js.map +1 -1
- package/lib/esm/Context.d.ts +83 -34
- package/lib/esm/Context.d.ts.map +1 -1
- package/lib/esm/Context.js +71 -21
- 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 +14 -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.d.ts.map +1 -1
- package/lib/esm/Deserialization/XmlParser.js +11 -3
- package/lib/esm/Deserialization/XmlParser.js.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.js +2 -6
- package/lib/esm/Deserialization/XmlSerializationUtils.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 +31 -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 +83 -21
- package/lib/esm/Metadata/Class.d.ts.map +1 -1
- package/lib/esm/Metadata/Class.js +189 -64
- 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 +20 -8
- package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/esm/Metadata/EntityClass.js +43 -23
- 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 +5 -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 +117 -13
- package/lib/esm/Metadata/Schema.d.ts.map +1 -1
- package/lib/esm/Metadata/Schema.js +148 -70
- 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 +13 -3
- 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.d.ts.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.js +8 -9
- 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 +6 -4
- package/lib/esm/Validation/SchemaWalker.js.map +1 -1
- package/lib/esm/ecschema-metadata.d.ts +1 -1
- package/lib/esm/ecschema-metadata.d.ts.map +1 -1
- package/lib/esm/ecschema-metadata.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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Class.d.ts","sourceRoot":"","sources":["../../../src/Metadata/Class.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,
|
|
1
|
+
{"version":3,"file":"Class.d.ts","sourceRoot":"","sources":["../../../src/Metadata/Class.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAiD,eAAe,EAA0C,aAAa,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE9L,OAAO,EAAE,QAAQ,EAAa,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,6BAA6B,EAAE,kBAAkB,EAA6B,MAAM,mBAAmB,CAAC;AAClI,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,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AAE,aAAa,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,WAAW,GAAG,QAAQ;aAE9G,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;aAC7F,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,GAAG,cAAc;aAExF,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC;aACvG,6BAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,GAAG,mBAAmB;aAElG,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;aAC3C,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAChE"}
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
import { assert } from "@itwin/core-bentley";
|
|
9
9
|
import { DelayedPromiseWithProps } from "../DelayedPromise";
|
|
10
10
|
import { XmlSerializationUtils } from "../Deserialization/XmlSerializationUtils";
|
|
11
|
-
import { classModifierToString, ECClassModifier, parseClassModifier, parsePrimitiveType, PrimitiveType, SchemaItemType } from "../ECObjects";
|
|
11
|
+
import { AbstractSchemaItemType, classModifierToString, ECClassModifier, parseClassModifier, parsePrimitiveType, PrimitiveType, SchemaItemType } from "../ECObjects";
|
|
12
12
|
import { ECObjectsError, ECObjectsStatus } from "../Exception";
|
|
13
13
|
import { SchemaItemKey, SchemaKey } from "../SchemaKey";
|
|
14
14
|
import { serializeCustomAttributes } from "./CustomAttribute";
|
|
15
|
+
import { Enumeration } from "./Enumeration";
|
|
15
16
|
import { EnumerationArrayProperty, EnumerationProperty, PrimitiveArrayProperty, PrimitiveProperty, StructArrayProperty, StructProperty, } from "./Property";
|
|
16
17
|
import { SchemaItem } from "./SchemaItem";
|
|
17
18
|
import { SchemaReadHelper } from "../Deserialization/Helper";
|
|
@@ -20,10 +21,14 @@ import { SchemaReadHelper } from "../Deserialization/Helper";
|
|
|
20
21
|
* @beta
|
|
21
22
|
*/
|
|
22
23
|
export class ECClass extends SchemaItem {
|
|
24
|
+
static get schemaItemType() { return AbstractSchemaItemType.Class; } // need this so getItem("name", ECClass) in schema works
|
|
25
|
+
_modifier;
|
|
26
|
+
_baseClass;
|
|
27
|
+
_derivedClasses;
|
|
28
|
+
_properties;
|
|
29
|
+
_customAttributes;
|
|
30
|
+
_mergedPropertyCache;
|
|
23
31
|
get modifier() { return this._modifier; }
|
|
24
|
-
get baseClass() { return this._baseClass; }
|
|
25
|
-
set baseClass(baseClass) { this._baseClass = baseClass; }
|
|
26
|
-
get properties() { return this._properties?.values(); }
|
|
27
32
|
get customAttributes() { return this._customAttributes; }
|
|
28
33
|
constructor(schema, name, modifier) {
|
|
29
34
|
super(schema, name);
|
|
@@ -32,6 +37,32 @@ export class ECClass extends SchemaItem {
|
|
|
32
37
|
else
|
|
33
38
|
this._modifier = ECClassModifier.None;
|
|
34
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Gets the base class if it exists, otherwise returns undefined.
|
|
42
|
+
*/
|
|
43
|
+
get baseClass() {
|
|
44
|
+
return this._baseClass;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Sets the base class of the ECClass. Pass undefined to 'remove' the base class.
|
|
48
|
+
*/
|
|
49
|
+
async setBaseClass(baseClass) {
|
|
50
|
+
const oldBaseClass = this._baseClass;
|
|
51
|
+
this._baseClass = baseClass;
|
|
52
|
+
if (baseClass)
|
|
53
|
+
this.addDerivedClass(await baseClass, this);
|
|
54
|
+
else if (oldBaseClass)
|
|
55
|
+
this.removeDerivedClass(await oldBaseClass, this);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Gets the derived classes belonging to this class.
|
|
59
|
+
* @returns An array of ECClasses or undefined if no derived classes exist.
|
|
60
|
+
*/
|
|
61
|
+
async getDerivedClasses() {
|
|
62
|
+
if (!this._derivedClasses || this._derivedClasses.size === 0)
|
|
63
|
+
return undefined;
|
|
64
|
+
return Array.from(await Promise.all(this._derivedClasses.values()));
|
|
65
|
+
}
|
|
35
66
|
/**
|
|
36
67
|
* Convenience method for adding an already loaded ECProperty used by create*Property methods.
|
|
37
68
|
* @param prop The property to add.
|
|
@@ -41,6 +72,7 @@ export class ECClass extends SchemaItem {
|
|
|
41
72
|
if (!this._properties)
|
|
42
73
|
this._properties = new Map();
|
|
43
74
|
this._properties.set(prop.name.toUpperCase(), prop);
|
|
75
|
+
this.cleanCache();
|
|
44
76
|
return prop;
|
|
45
77
|
}
|
|
46
78
|
/**
|
|
@@ -51,8 +83,10 @@ export class ECClass extends SchemaItem {
|
|
|
51
83
|
async deleteProperty(name) {
|
|
52
84
|
if (this._properties) {
|
|
53
85
|
const property = await this.getProperty(name);
|
|
54
|
-
if (property)
|
|
86
|
+
if (property) {
|
|
55
87
|
this._properties.delete(name.toUpperCase());
|
|
88
|
+
this.cleanCache();
|
|
89
|
+
}
|
|
56
90
|
}
|
|
57
91
|
}
|
|
58
92
|
/**
|
|
@@ -63,44 +97,49 @@ export class ECClass extends SchemaItem {
|
|
|
63
97
|
deletePropertySync(name) {
|
|
64
98
|
if (this._properties) {
|
|
65
99
|
const property = this.getPropertySync(name);
|
|
66
|
-
if (property)
|
|
100
|
+
if (property) {
|
|
67
101
|
this._properties.delete(name.toUpperCase());
|
|
102
|
+
this.cleanCache();
|
|
103
|
+
}
|
|
68
104
|
}
|
|
69
105
|
}
|
|
70
106
|
getBaseClassSync() {
|
|
71
107
|
if (!this.baseClass) {
|
|
72
108
|
return undefined;
|
|
73
109
|
}
|
|
74
|
-
return this.schema.lookupItemSync(this.baseClass);
|
|
110
|
+
return this.schema.lookupItemSync(this.baseClass, ECClass);
|
|
75
111
|
}
|
|
76
112
|
/**
|
|
77
|
-
* Searches, case-insensitive, for
|
|
78
|
-
*
|
|
113
|
+
* Searches, case-insensitive, for an ECProperty with given the name on this class and, by default, on
|
|
114
|
+
* all base classes. Set excludeInherited to 'true' to only search the local class.
|
|
115
|
+
* @param name The name of the property to retrieve.
|
|
116
|
+
* @param excludeInherited If true, excludes inherited properties from the results. Defaults to false.
|
|
79
117
|
*/
|
|
80
|
-
async getProperty(name,
|
|
118
|
+
async getProperty(name, excludeInherited = false) {
|
|
81
119
|
if (this._properties) {
|
|
82
120
|
const upperKey = name.toUpperCase();
|
|
83
121
|
const property = this._properties.get(upperKey);
|
|
84
122
|
if (property)
|
|
85
123
|
return property;
|
|
86
124
|
}
|
|
87
|
-
if (
|
|
125
|
+
if (excludeInherited) {
|
|
88
126
|
return undefined;
|
|
89
127
|
}
|
|
90
128
|
return this.getInheritedProperty(name);
|
|
91
129
|
}
|
|
92
130
|
/**
|
|
93
131
|
* Searches, case-insensitive, for a local ECProperty with the name provided.
|
|
94
|
-
* @param name
|
|
132
|
+
* @param name The name of the property to retrieve.
|
|
133
|
+
* @param excludeInherited If true, excludes inherited properties from the results. Defaults to false.
|
|
95
134
|
*/
|
|
96
|
-
getPropertySync(name,
|
|
135
|
+
getPropertySync(name, excludeInherited = false) {
|
|
97
136
|
if (this._properties) {
|
|
98
137
|
const upperKey = name.toUpperCase();
|
|
99
138
|
const property = this._properties.get(upperKey);
|
|
100
139
|
if (property)
|
|
101
140
|
return property;
|
|
102
141
|
}
|
|
103
|
-
if (
|
|
142
|
+
if (excludeInherited) {
|
|
104
143
|
return undefined;
|
|
105
144
|
}
|
|
106
145
|
return this.getInheritedPropertySync(name);
|
|
@@ -112,7 +151,7 @@ export class ECClass extends SchemaItem {
|
|
|
112
151
|
async getInheritedProperty(name) {
|
|
113
152
|
if (this.baseClass) {
|
|
114
153
|
const baseClassObj = await this.baseClass;
|
|
115
|
-
return baseClassObj.getProperty(name
|
|
154
|
+
return baseClassObj.getProperty(name);
|
|
116
155
|
}
|
|
117
156
|
return undefined;
|
|
118
157
|
}
|
|
@@ -123,11 +162,11 @@ export class ECClass extends SchemaItem {
|
|
|
123
162
|
getInheritedPropertySync(name) {
|
|
124
163
|
const baseClassObj = this.getBaseClassSync();
|
|
125
164
|
if (baseClassObj)
|
|
126
|
-
return baseClassObj.getPropertySync(name
|
|
165
|
+
return baseClassObj.getPropertySync(name);
|
|
127
166
|
return undefined;
|
|
128
167
|
}
|
|
129
168
|
async createPrimitiveProperty(name, primitiveType) {
|
|
130
|
-
if (await this.getProperty(name))
|
|
169
|
+
if (await this.getProperty(name, true))
|
|
131
170
|
throw new ECObjectsError(ECObjectsStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);
|
|
132
171
|
const propType = await this.loadPrimitiveType(primitiveType, this.schema);
|
|
133
172
|
if (typeof (propType) === "number")
|
|
@@ -135,7 +174,7 @@ export class ECClass extends SchemaItem {
|
|
|
135
174
|
return this.addProperty(new EnumerationProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));
|
|
136
175
|
}
|
|
137
176
|
createPrimitivePropertySync(name, primitiveType) {
|
|
138
|
-
if (this.getPropertySync(name))
|
|
177
|
+
if (this.getPropertySync(name, true))
|
|
139
178
|
throw new ECObjectsError(ECObjectsStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);
|
|
140
179
|
const propType = this.loadPrimitiveTypeSync(primitiveType, this.schema);
|
|
141
180
|
if (typeof (propType) === "number")
|
|
@@ -143,7 +182,7 @@ export class ECClass extends SchemaItem {
|
|
|
143
182
|
return this.addProperty(new EnumerationProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));
|
|
144
183
|
}
|
|
145
184
|
async createPrimitiveArrayProperty(name, primitiveType) {
|
|
146
|
-
if (await this.getProperty(name))
|
|
185
|
+
if (await this.getProperty(name, true))
|
|
147
186
|
throw new ECObjectsError(ECObjectsStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);
|
|
148
187
|
const propType = await this.loadPrimitiveType(primitiveType, this.schema);
|
|
149
188
|
if (typeof (propType) === "number")
|
|
@@ -151,7 +190,7 @@ export class ECClass extends SchemaItem {
|
|
|
151
190
|
return this.addProperty(new EnumerationArrayProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));
|
|
152
191
|
}
|
|
153
192
|
createPrimitiveArrayPropertySync(name, primitiveType) {
|
|
154
|
-
if (this.getPropertySync(name))
|
|
193
|
+
if (this.getPropertySync(name, true))
|
|
155
194
|
throw new ECObjectsError(ECObjectsStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);
|
|
156
195
|
const propType = this.loadPrimitiveTypeSync(primitiveType, this.schema);
|
|
157
196
|
if (typeof (propType) === "number")
|
|
@@ -164,7 +203,7 @@ export class ECClass extends SchemaItem {
|
|
|
164
203
|
* @param structType The struct type of property to create.
|
|
165
204
|
*/
|
|
166
205
|
async createStructProperty(name, structType) {
|
|
167
|
-
if (await this.getProperty(name))
|
|
206
|
+
if (await this.getProperty(name, true))
|
|
168
207
|
throw new ECObjectsError(ECObjectsStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);
|
|
169
208
|
return this.addProperty(new StructProperty(this, name, await this.loadStructType(structType, this.schema)));
|
|
170
209
|
}
|
|
@@ -174,7 +213,7 @@ export class ECClass extends SchemaItem {
|
|
|
174
213
|
* @param structType The struct type of property to create.
|
|
175
214
|
*/
|
|
176
215
|
createStructPropertySync(name, structType) {
|
|
177
|
-
if (this.getPropertySync(name))
|
|
216
|
+
if (this.getPropertySync(name, true))
|
|
178
217
|
throw new ECObjectsError(ECObjectsStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);
|
|
179
218
|
return this.addProperty(new StructProperty(this, name, this.loadStructTypeSync(structType, this.schema)));
|
|
180
219
|
}
|
|
@@ -184,7 +223,7 @@ export class ECClass extends SchemaItem {
|
|
|
184
223
|
* @param type
|
|
185
224
|
*/
|
|
186
225
|
async createStructArrayProperty(name, structType) {
|
|
187
|
-
if (await this.getProperty(name))
|
|
226
|
+
if (await this.getProperty(name, true))
|
|
188
227
|
throw new ECObjectsError(ECObjectsStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);
|
|
189
228
|
return this.addProperty(new StructArrayProperty(this, name, await this.loadStructType(structType, this.schema)));
|
|
190
229
|
}
|
|
@@ -194,14 +233,14 @@ export class ECClass extends SchemaItem {
|
|
|
194
233
|
* @param type
|
|
195
234
|
*/
|
|
196
235
|
createStructArrayPropertySync(name, structType) {
|
|
197
|
-
if (this.getPropertySync(name))
|
|
236
|
+
if (this.getPropertySync(name, true))
|
|
198
237
|
throw new ECObjectsError(ECObjectsStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);
|
|
199
238
|
return this.addProperty(new StructArrayProperty(this, name, this.loadStructTypeSync(structType, this.schema)));
|
|
200
239
|
}
|
|
201
240
|
async loadStructType(structType, schema) {
|
|
202
241
|
let correctType;
|
|
203
242
|
if (typeof (structType) === "string") {
|
|
204
|
-
correctType = await schema.lookupItem(structType);
|
|
243
|
+
correctType = await schema.lookupItem(structType, StructClass);
|
|
205
244
|
}
|
|
206
245
|
else
|
|
207
246
|
correctType = structType;
|
|
@@ -212,7 +251,7 @@ export class ECClass extends SchemaItem {
|
|
|
212
251
|
loadStructTypeSync(structType, schema) {
|
|
213
252
|
let correctType;
|
|
214
253
|
if (typeof (structType) === "string") {
|
|
215
|
-
correctType = schema.lookupItemSync(structType);
|
|
254
|
+
correctType = schema.lookupItemSync(structType, StructClass);
|
|
216
255
|
}
|
|
217
256
|
else
|
|
218
257
|
correctType = structType;
|
|
@@ -226,7 +265,7 @@ export class ECClass extends SchemaItem {
|
|
|
226
265
|
if (typeof (primitiveType) === "string") {
|
|
227
266
|
let resolvedType = parsePrimitiveType(primitiveType);
|
|
228
267
|
if (!resolvedType) {
|
|
229
|
-
resolvedType = await schema.lookupItem(primitiveType);
|
|
268
|
+
resolvedType = await schema.lookupItem(primitiveType, Enumeration);
|
|
230
269
|
}
|
|
231
270
|
if (resolvedType === undefined)
|
|
232
271
|
throw new ECObjectsError(ECObjectsStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);
|
|
@@ -243,7 +282,7 @@ export class ECClass extends SchemaItem {
|
|
|
243
282
|
if (typeof (primitiveType) === "string") {
|
|
244
283
|
let resolvedType = parsePrimitiveType(primitiveType);
|
|
245
284
|
if (!resolvedType) {
|
|
246
|
-
resolvedType = schema.lookupItemSync(primitiveType);
|
|
285
|
+
resolvedType = schema.lookupItemSync(primitiveType, Enumeration);
|
|
247
286
|
}
|
|
248
287
|
if (resolvedType === undefined)
|
|
249
288
|
throw new ECObjectsError(ECObjectsStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);
|
|
@@ -265,7 +304,7 @@ export class ECClass extends SchemaItem {
|
|
|
265
304
|
if (this.baseClass !== undefined)
|
|
266
305
|
schemaJson.baseClass = this.baseClass.fullName;
|
|
267
306
|
if (this._properties !== undefined && this._properties.size > 0)
|
|
268
|
-
schemaJson.properties = [...this.
|
|
307
|
+
schemaJson.properties = [...this._properties.values()].map((prop) => prop.toJSON());
|
|
269
308
|
const customAttributes = serializeCustomAttributes(this.customAttributes);
|
|
270
309
|
if (customAttributes !== undefined)
|
|
271
310
|
schemaJson.customAttributes = customAttributes;
|
|
@@ -283,8 +322,8 @@ export class ECClass extends SchemaItem {
|
|
|
283
322
|
baseClassElement.textContent = baseClassName;
|
|
284
323
|
itemElement.appendChild(baseClassElement);
|
|
285
324
|
}
|
|
286
|
-
if (undefined !== this.
|
|
287
|
-
for (const prop of this.
|
|
325
|
+
if (undefined !== this._properties) {
|
|
326
|
+
for (const prop of this._properties.values()) {
|
|
288
327
|
const propXml = await prop.toXml(schemaXml);
|
|
289
328
|
itemElement.appendChild(propXml);
|
|
290
329
|
}
|
|
@@ -317,12 +356,25 @@ export class ECClass extends SchemaItem {
|
|
|
317
356
|
const ecClassSchemaItemKey = this.schema.getSchemaItemKey(classProps.baseClass);
|
|
318
357
|
if (!ecClassSchemaItemKey)
|
|
319
358
|
throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the baseClass ${classProps.baseClass}.`);
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
359
|
+
const baseClass = this.schema.lookupItemSync(ecClassSchemaItemKey);
|
|
360
|
+
let lazyBase;
|
|
361
|
+
if (!baseClass) {
|
|
362
|
+
lazyBase = new DelayedPromiseWithProps(ecClassSchemaItemKey, async () => {
|
|
363
|
+
const baseItem = await this.schema.lookupItem(ecClassSchemaItemKey);
|
|
364
|
+
if (undefined === baseItem || !ECClass.isECClass(baseItem))
|
|
365
|
+
throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the baseClass ${classProps.baseClass}.`);
|
|
366
|
+
return baseItem;
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
lazyBase = new DelayedPromiseWithProps(ecClassSchemaItemKey, async () => {
|
|
371
|
+
return baseClass;
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
this._baseClass = lazyBase;
|
|
375
|
+
if (!baseClass)
|
|
376
|
+
return;
|
|
377
|
+
this.addDerivedClass(baseClass, this);
|
|
326
378
|
}
|
|
327
379
|
}
|
|
328
380
|
async fromJSON(classProps) {
|
|
@@ -341,8 +393,8 @@ export class ECClass extends SchemaItem {
|
|
|
341
393
|
const baseClasses = [this];
|
|
342
394
|
const addBaseClasses = async (ecClass) => {
|
|
343
395
|
if (SchemaItemType.EntityClass === ecClass.schemaItemType) {
|
|
344
|
-
for (let i =
|
|
345
|
-
baseClasses.push(await
|
|
396
|
+
for (let i = ecClass.mixins.length - 1; i >= 0; i--) {
|
|
397
|
+
baseClasses.push(await ecClass.mixins[i]);
|
|
346
398
|
}
|
|
347
399
|
}
|
|
348
400
|
if (ecClass.baseClass)
|
|
@@ -358,7 +410,7 @@ export class ECClass extends SchemaItem {
|
|
|
358
410
|
*getAllBaseClassesSync() {
|
|
359
411
|
const baseClasses = [this];
|
|
360
412
|
const addBaseClasses = (ecClass) => {
|
|
361
|
-
if (
|
|
413
|
+
if (ecClass.schemaItemType === SchemaItemType.EntityClass) { // cannot use EntityClass typeguard because of circular reference
|
|
362
414
|
for (const m of Array.from(ecClass.getMixinsSync()).reverse()) {
|
|
363
415
|
baseClasses.push(m);
|
|
364
416
|
}
|
|
@@ -389,52 +441,71 @@ export class ECClass extends SchemaItem {
|
|
|
389
441
|
}
|
|
390
442
|
}
|
|
391
443
|
}
|
|
392
|
-
async buildPropertyCache(result, existingValues
|
|
444
|
+
async buildPropertyCache(result, existingValues) {
|
|
393
445
|
if (!existingValues) {
|
|
394
446
|
existingValues = new Map();
|
|
395
447
|
}
|
|
396
448
|
if (this.baseClass) {
|
|
397
|
-
|
|
449
|
+
const baseClass = await this.baseClass;
|
|
450
|
+
if (baseClass) {
|
|
451
|
+
ECClass.mergeProperties(result, existingValues, await baseClass.getProperties(), false);
|
|
452
|
+
}
|
|
398
453
|
}
|
|
399
|
-
if (!this.
|
|
454
|
+
if (!this._properties)
|
|
400
455
|
return;
|
|
401
|
-
ECClass.mergeProperties(result, existingValues, [...this.
|
|
456
|
+
ECClass.mergeProperties(result, existingValues, [...this._properties.values()], true);
|
|
402
457
|
}
|
|
403
|
-
buildPropertyCacheSync(result, existingValues
|
|
458
|
+
buildPropertyCacheSync(result, existingValues) {
|
|
404
459
|
if (!existingValues) {
|
|
405
460
|
existingValues = new Map();
|
|
406
461
|
}
|
|
407
462
|
const baseClass = this.getBaseClassSync();
|
|
408
463
|
if (baseClass) {
|
|
409
|
-
ECClass.mergeProperties(result, existingValues, baseClass.getPropertiesSync(
|
|
464
|
+
ECClass.mergeProperties(result, existingValues, baseClass.getPropertiesSync(), false);
|
|
410
465
|
}
|
|
411
|
-
if (!this.
|
|
466
|
+
if (!this._properties)
|
|
412
467
|
return;
|
|
413
|
-
ECClass.mergeProperties(result, existingValues, [...this.
|
|
468
|
+
ECClass.mergeProperties(result, existingValues, [...this._properties.values()], true);
|
|
414
469
|
}
|
|
415
470
|
/**
|
|
416
|
-
*
|
|
471
|
+
* Clears all caches on this object. This is called implicitly for this class,
|
|
472
|
+
* but needs to be called if derived classes have changed.
|
|
473
|
+
* @internal
|
|
474
|
+
*/
|
|
475
|
+
cleanCache() {
|
|
476
|
+
this._mergedPropertyCache = undefined;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Returns the properties on this class and its base classes.
|
|
417
480
|
* Since this is an expensive operation, results will be cached after first call.
|
|
418
|
-
* @param
|
|
481
|
+
* @param excludeInherited If true, only properties defined directly on this class will be returned. Defaults to false.
|
|
482
|
+
* @returns An array of properties, empty array if none exist.
|
|
419
483
|
*/
|
|
420
|
-
getPropertiesSync(
|
|
421
|
-
if (
|
|
484
|
+
getPropertiesSync(excludeInherited) {
|
|
485
|
+
if (excludeInherited) {
|
|
486
|
+
return this._properties && this._properties.size > 0 ? this._properties.values() : [];
|
|
487
|
+
}
|
|
488
|
+
if (!this._mergedPropertyCache) {
|
|
422
489
|
this._mergedPropertyCache = [];
|
|
423
|
-
this.buildPropertyCacheSync(this._mergedPropertyCache, undefined
|
|
490
|
+
this.buildPropertyCacheSync(this._mergedPropertyCache, undefined);
|
|
424
491
|
}
|
|
425
492
|
return this._mergedPropertyCache;
|
|
426
493
|
}
|
|
427
494
|
/**
|
|
428
|
-
*
|
|
495
|
+
* Quick way to check whether this class has any local properties without having to use the iterable
|
|
496
|
+
*/
|
|
497
|
+
get hasLocalProperties() {
|
|
498
|
+
return this._properties !== undefined && this._properties.size > 0;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Returns the properties on this class and its base classes.
|
|
429
502
|
* Since this is an expensive operation, results will be cached after first call.
|
|
430
|
-
* @param
|
|
503
|
+
* @param excludeInherited If true, only properties defined directly on this class will be returned.
|
|
504
|
+
* @returns An array of properties, empty array if none exist.
|
|
431
505
|
*/
|
|
432
|
-
async getProperties(
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
await this.buildPropertyCache(this._mergedPropertyCache, undefined, resetCache);
|
|
436
|
-
}
|
|
437
|
-
return this._mergedPropertyCache;
|
|
506
|
+
async getProperties(excludeInherited) {
|
|
507
|
+
// At the moment we do not lazy load properties, so this is the same as getPropertiesSync
|
|
508
|
+
return this.getPropertiesSync(excludeInherited);
|
|
438
509
|
}
|
|
439
510
|
/**
|
|
440
511
|
* Retrieve all custom attributes in the current class and its bases
|
|
@@ -533,15 +604,69 @@ export class ECClass extends SchemaItem {
|
|
|
533
604
|
setModifier(modifier) {
|
|
534
605
|
this._modifier = modifier;
|
|
535
606
|
}
|
|
607
|
+
/**
|
|
608
|
+
* Adds an ECClass to the derived class collection. This method is only intended to update the local
|
|
609
|
+
* cache of derived classes. For adding a class to the hierarchy, use the baseClass setter method.
|
|
610
|
+
* @param prop The property to add.
|
|
611
|
+
* @return The property that was added.
|
|
612
|
+
*/
|
|
613
|
+
addDerivedClass(baseClass, derivedClass) {
|
|
614
|
+
if (!baseClass._derivedClasses)
|
|
615
|
+
baseClass._derivedClasses = new Map();
|
|
616
|
+
if (baseClass._derivedClasses.has(derivedClass.fullName))
|
|
617
|
+
return;
|
|
618
|
+
if (derivedClass.isSync(baseClass)) {
|
|
619
|
+
const promise = new DelayedPromiseWithProps(derivedClass.key, async () => derivedClass);
|
|
620
|
+
baseClass._derivedClasses.set(derivedClass.fullName, promise);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Removes an ECClass from the derived class collection. This method is only intended to update the local
|
|
625
|
+
* cache of derived classes. For updating the class hierarchy, use the baseClass setter method.
|
|
626
|
+
* @param prop The property to add.
|
|
627
|
+
* @return The property that was added.
|
|
628
|
+
*/
|
|
629
|
+
removeDerivedClass(baseClass, derivedClass) {
|
|
630
|
+
if (!baseClass._derivedClasses)
|
|
631
|
+
return;
|
|
632
|
+
if (!baseClass._derivedClasses.has(derivedClass.fullName))
|
|
633
|
+
return;
|
|
634
|
+
baseClass._derivedClasses.delete(derivedClass.fullName);
|
|
635
|
+
}
|
|
536
636
|
}
|
|
537
637
|
/**
|
|
538
638
|
* A Typescript class representation of an ECStructClass.
|
|
539
639
|
* @beta
|
|
540
640
|
*/
|
|
541
641
|
export class StructClass extends ECClass {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
642
|
+
/**
|
|
643
|
+
* Get the type of item represented by this instance
|
|
644
|
+
* @beta
|
|
645
|
+
*/
|
|
646
|
+
schemaItemType = StructClass.schemaItemType;
|
|
647
|
+
/**
|
|
648
|
+
* Get the type of item represented by this class
|
|
649
|
+
* @beta
|
|
650
|
+
*/
|
|
651
|
+
static get schemaItemType() { return SchemaItemType.StructClass; }
|
|
652
|
+
/**
|
|
653
|
+
* Type guard to check if the SchemaItem is of type StructClass.
|
|
654
|
+
* @param item The SchemaItem to check.
|
|
655
|
+
* @returns True if the item is a StructClass, false otherwise.
|
|
656
|
+
*/
|
|
657
|
+
static isStructClass(item) {
|
|
658
|
+
if (item && item.schemaItemType === SchemaItemType.StructClass)
|
|
659
|
+
return true;
|
|
660
|
+
return false;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Type assertion to check if the SchemaItem is of type StructClass.
|
|
664
|
+
* @param item The SchemaItem to check.
|
|
665
|
+
* @returns The item cast to StructClass if it is a StructClass, undefined otherwise.
|
|
666
|
+
*/
|
|
667
|
+
static assertIsStructClass(item) {
|
|
668
|
+
if (!this.isStructClass(item))
|
|
669
|
+
throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.StructClass}' (StructClass)`);
|
|
545
670
|
}
|
|
546
671
|
}
|
|
547
672
|
/**
|