@itwin/ecschema-metadata 5.0.0-dev.9 → 5.0.0-dev.92
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 +51 -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/SchemaGraphUtil.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 +75 -16
- package/lib/cjs/Metadata/Class.d.ts.map +1 -1
- package/lib/cjs/Metadata/Class.js +168 -46
- 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/CustomAttribute.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 +42 -22
- 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/PropertyTypes.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/Parser.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/SchemaGraphUtil.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 +75 -16
- package/lib/esm/Metadata/Class.d.ts.map +1 -1
- package/lib/esm/Metadata/Class.js +169 -47
- 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/CustomAttribute.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 +42 -22
- 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/PropertyTypes.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/Parser.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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module Metadata
|
|
3
3
|
*/
|
|
4
4
|
import { ClassProps } from "../Deserialization/JsonProps";
|
|
5
|
-
import { ECClassModifier, PrimitiveType, SchemaItemType } from "../ECObjects";
|
|
5
|
+
import { ECClassModifier, PrimitiveType, SchemaItemType, SupportedSchemaItemType } from "../ECObjects";
|
|
6
6
|
import { AnyClass, LazyLoadedECClass } from "../Interfaces";
|
|
7
7
|
import { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet } from "./CustomAttribute";
|
|
8
8
|
import { Enumeration } from "./Enumeration";
|
|
@@ -14,17 +14,29 @@ import { SchemaItem } from "./SchemaItem";
|
|
|
14
14
|
* @beta
|
|
15
15
|
*/
|
|
16
16
|
export declare abstract class ECClass extends SchemaItem implements CustomAttributeContainerProps {
|
|
17
|
+
static get schemaItemType(): SupportedSchemaItemType;
|
|
17
18
|
protected _modifier: ECClassModifier;
|
|
18
19
|
protected _baseClass?: LazyLoadedECClass;
|
|
20
|
+
protected _derivedClasses?: Map<string, LazyLoadedECClass>;
|
|
19
21
|
protected _properties?: Map<string, Property>;
|
|
20
22
|
private _customAttributes?;
|
|
21
23
|
private _mergedPropertyCache?;
|
|
22
24
|
get modifier(): ECClassModifier;
|
|
23
|
-
get baseClass(): LazyLoadedECClass | undefined;
|
|
24
|
-
set baseClass(baseClass: LazyLoadedECClass | undefined);
|
|
25
|
-
get properties(): IterableIterator<Property> | undefined;
|
|
26
25
|
get customAttributes(): CustomAttributeSet | undefined;
|
|
27
26
|
constructor(schema: Schema, name: string, modifier?: ECClassModifier);
|
|
27
|
+
/**
|
|
28
|
+
* Gets the base class if it exists, otherwise returns undefined.
|
|
29
|
+
*/
|
|
30
|
+
get baseClass(): LazyLoadedECClass | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Sets the base class of the ECClass. Pass undefined to 'remove' the base class.
|
|
33
|
+
*/
|
|
34
|
+
protected setBaseClass(baseClass: LazyLoadedECClass | undefined): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the derived classes belonging to this class.
|
|
37
|
+
* @returns An array of ECClasses or undefined if no derived classes exist.
|
|
38
|
+
*/
|
|
39
|
+
getDerivedClasses(): Promise<ECClass[] | undefined>;
|
|
28
40
|
/**
|
|
29
41
|
* Convenience method for adding an already loaded ECProperty used by create*Property methods.
|
|
30
42
|
* @param prop The property to add.
|
|
@@ -137,23 +149,35 @@ export declare abstract class ECClass extends SchemaItem implements CustomAttrib
|
|
|
137
149
|
* Iterates (recursively) over all base classes and mixins, in "property override" order.
|
|
138
150
|
* This is essentially a depth-first traversal through the inheritance tree.
|
|
139
151
|
*/
|
|
140
|
-
getAllBaseClasses():
|
|
152
|
+
getAllBaseClasses(): AsyncIterable<ECClass>;
|
|
141
153
|
getAllBaseClassesSync(): Iterable<AnyClass>;
|
|
142
|
-
protected static mergeProperties(target: Property[], existingValues: Map<string, number>, propertiesToMerge: Property
|
|
143
|
-
protected buildPropertyCache(result: Property[], existingValues?: Map<string, number
|
|
144
|
-
protected buildPropertyCacheSync(result: Property[], existingValues?: Map<string, number
|
|
154
|
+
protected static mergeProperties(target: Property[], existingValues: Map<string, number>, propertiesToMerge: Iterable<Property>, overwriteExisting: boolean): void;
|
|
155
|
+
protected buildPropertyCache(result: Property[], existingValues?: Map<string, number>): Promise<void>;
|
|
156
|
+
protected buildPropertyCacheSync(result: Property[], existingValues?: Map<string, number>): void;
|
|
145
157
|
/**
|
|
146
|
-
*
|
|
158
|
+
* Clears all caches on this object. This is called implicitly for this class,
|
|
159
|
+
* but needs to be called if derived classes have changed.
|
|
160
|
+
* @internal
|
|
161
|
+
*/
|
|
162
|
+
cleanCache(): void;
|
|
163
|
+
/**
|
|
164
|
+
* Returns the properties on this class and its base classes.
|
|
147
165
|
* Since this is an expensive operation, results will be cached after first call.
|
|
148
|
-
* @param
|
|
166
|
+
* @param excludeInherited If true, only properties defined directly on this class will be returned. Defaults to false.
|
|
167
|
+
* @returns An array of properties, empty array if none exist.
|
|
149
168
|
*/
|
|
150
|
-
getPropertiesSync(
|
|
169
|
+
getPropertiesSync(excludeInherited?: boolean): Iterable<Property>;
|
|
151
170
|
/**
|
|
152
|
-
*
|
|
171
|
+
* Quick way to check whether this class has any local properties without having to use the iterable
|
|
172
|
+
*/
|
|
173
|
+
get hasLocalProperties(): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Returns the properties on this class and its base classes.
|
|
153
176
|
* Since this is an expensive operation, results will be cached after first call.
|
|
154
|
-
* @param
|
|
177
|
+
* @param excludeInherited If true, only properties defined directly on this class will be returned.
|
|
178
|
+
* @returns An array of properties, empty array if none exist.
|
|
155
179
|
*/
|
|
156
|
-
getProperties(
|
|
180
|
+
getProperties(excludeInherited?: boolean): Promise<Iterable<Property>>;
|
|
157
181
|
/**
|
|
158
182
|
* Retrieve all custom attributes in the current class and its bases
|
|
159
183
|
* This is the async version of getCustomAttributesSync()
|
|
@@ -199,14 +223,48 @@ export declare abstract class ECClass extends SchemaItem implements CustomAttrib
|
|
|
199
223
|
* @param modifier
|
|
200
224
|
*/
|
|
201
225
|
protected setModifier(modifier: ECClassModifier): void;
|
|
226
|
+
/**
|
|
227
|
+
* Adds an ECClass to the derived class collection. This method is only intended to update the local
|
|
228
|
+
* cache of derived classes. For adding a class to the hierarchy, use the baseClass setter method.
|
|
229
|
+
* @param prop The property to add.
|
|
230
|
+
* @return The property that was added.
|
|
231
|
+
*/
|
|
232
|
+
private addDerivedClass;
|
|
233
|
+
/**
|
|
234
|
+
* Removes an ECClass from the derived class collection. This method is only intended to update the local
|
|
235
|
+
* cache of derived classes. For updating the class hierarchy, use the baseClass setter method.
|
|
236
|
+
* @param prop The property to add.
|
|
237
|
+
* @return The property that was added.
|
|
238
|
+
*/
|
|
239
|
+
private removeDerivedClass;
|
|
202
240
|
}
|
|
203
241
|
/**
|
|
204
242
|
* A Typescript class representation of an ECStructClass.
|
|
205
243
|
* @beta
|
|
206
244
|
*/
|
|
207
245
|
export declare class StructClass extends ECClass {
|
|
208
|
-
|
|
209
|
-
|
|
246
|
+
/**
|
|
247
|
+
* Get the type of item represented by this instance
|
|
248
|
+
* @beta
|
|
249
|
+
*/
|
|
250
|
+
readonly schemaItemType: SchemaItemType;
|
|
251
|
+
/**
|
|
252
|
+
* Get the type of item represented by this class
|
|
253
|
+
* @beta
|
|
254
|
+
*/
|
|
255
|
+
static get schemaItemType(): SchemaItemType;
|
|
256
|
+
/**
|
|
257
|
+
* Type guard to check if the SchemaItem is of type StructClass.
|
|
258
|
+
* @param item The SchemaItem to check.
|
|
259
|
+
* @returns True if the item is a StructClass, false otherwise.
|
|
260
|
+
*/
|
|
261
|
+
static isStructClass(item?: SchemaItem): item is StructClass;
|
|
262
|
+
/**
|
|
263
|
+
* Type assertion to check if the SchemaItem is of type StructClass.
|
|
264
|
+
* @param item The SchemaItem to check.
|
|
265
|
+
* @returns The item cast to StructClass if it is a StructClass, undefined otherwise.
|
|
266
|
+
*/
|
|
267
|
+
static assertIsStructClass(item?: SchemaItem): asserts item is StructClass;
|
|
210
268
|
}
|
|
211
269
|
/**
|
|
212
270
|
* @internal
|
|
@@ -220,6 +278,7 @@ export declare abstract class MutableStructClass extends StructClass {
|
|
|
220
278
|
* @internal
|
|
221
279
|
*/
|
|
222
280
|
export declare abstract class MutableClass extends ECClass {
|
|
281
|
+
abstract setBaseClass(baseClass: LazyLoadedECClass | undefined): Promise<void>;
|
|
223
282
|
abstract addCustomAttribute(customAttribute: CustomAttribute): void;
|
|
224
283
|
abstract setModifier(modifier: ECClassModifier): void;
|
|
225
284
|
abstract setName(name: string): void;
|
|
@@ -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;AACl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wBAAwB;aACpG,gCAAgC,CAAC,IAAI,EAAE,MAAM,EAAE,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,15 +97,17 @@ 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
113
|
* Searches, case-insensitive, for a local ECProperty with the name provided.
|
|
@@ -201,7 +237,7 @@ export class ECClass extends SchemaItem {
|
|
|
201
237
|
async loadStructType(structType, schema) {
|
|
202
238
|
let correctType;
|
|
203
239
|
if (typeof (structType) === "string") {
|
|
204
|
-
correctType = await schema.lookupItem(structType);
|
|
240
|
+
correctType = await schema.lookupItem(structType, StructClass);
|
|
205
241
|
}
|
|
206
242
|
else
|
|
207
243
|
correctType = structType;
|
|
@@ -212,7 +248,7 @@ export class ECClass extends SchemaItem {
|
|
|
212
248
|
loadStructTypeSync(structType, schema) {
|
|
213
249
|
let correctType;
|
|
214
250
|
if (typeof (structType) === "string") {
|
|
215
|
-
correctType = schema.lookupItemSync(structType);
|
|
251
|
+
correctType = schema.lookupItemSync(structType, StructClass);
|
|
216
252
|
}
|
|
217
253
|
else
|
|
218
254
|
correctType = structType;
|
|
@@ -226,7 +262,7 @@ export class ECClass extends SchemaItem {
|
|
|
226
262
|
if (typeof (primitiveType) === "string") {
|
|
227
263
|
let resolvedType = parsePrimitiveType(primitiveType);
|
|
228
264
|
if (!resolvedType) {
|
|
229
|
-
resolvedType = await schema.lookupItem(primitiveType);
|
|
265
|
+
resolvedType = await schema.lookupItem(primitiveType, Enumeration);
|
|
230
266
|
}
|
|
231
267
|
if (resolvedType === undefined)
|
|
232
268
|
throw new ECObjectsError(ECObjectsStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);
|
|
@@ -243,7 +279,7 @@ export class ECClass extends SchemaItem {
|
|
|
243
279
|
if (typeof (primitiveType) === "string") {
|
|
244
280
|
let resolvedType = parsePrimitiveType(primitiveType);
|
|
245
281
|
if (!resolvedType) {
|
|
246
|
-
resolvedType = schema.lookupItemSync(primitiveType);
|
|
282
|
+
resolvedType = schema.lookupItemSync(primitiveType, Enumeration);
|
|
247
283
|
}
|
|
248
284
|
if (resolvedType === undefined)
|
|
249
285
|
throw new ECObjectsError(ECObjectsStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);
|
|
@@ -265,7 +301,7 @@ export class ECClass extends SchemaItem {
|
|
|
265
301
|
if (this.baseClass !== undefined)
|
|
266
302
|
schemaJson.baseClass = this.baseClass.fullName;
|
|
267
303
|
if (this._properties !== undefined && this._properties.size > 0)
|
|
268
|
-
schemaJson.properties = [...this.
|
|
304
|
+
schemaJson.properties = [...this._properties.values()].map((prop) => prop.toJSON());
|
|
269
305
|
const customAttributes = serializeCustomAttributes(this.customAttributes);
|
|
270
306
|
if (customAttributes !== undefined)
|
|
271
307
|
schemaJson.customAttributes = customAttributes;
|
|
@@ -283,8 +319,8 @@ export class ECClass extends SchemaItem {
|
|
|
283
319
|
baseClassElement.textContent = baseClassName;
|
|
284
320
|
itemElement.appendChild(baseClassElement);
|
|
285
321
|
}
|
|
286
|
-
if (undefined !== this.
|
|
287
|
-
for (const prop of this.
|
|
322
|
+
if (undefined !== this._properties) {
|
|
323
|
+
for (const prop of this._properties.values()) {
|
|
288
324
|
const propXml = await prop.toXml(schemaXml);
|
|
289
325
|
itemElement.appendChild(propXml);
|
|
290
326
|
}
|
|
@@ -317,12 +353,25 @@ export class ECClass extends SchemaItem {
|
|
|
317
353
|
const ecClassSchemaItemKey = this.schema.getSchemaItemKey(classProps.baseClass);
|
|
318
354
|
if (!ecClassSchemaItemKey)
|
|
319
355
|
throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the baseClass ${classProps.baseClass}.`);
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
356
|
+
const baseClass = this.schema.lookupItemSync(ecClassSchemaItemKey);
|
|
357
|
+
let lazyBase;
|
|
358
|
+
if (!baseClass) {
|
|
359
|
+
lazyBase = new DelayedPromiseWithProps(ecClassSchemaItemKey, async () => {
|
|
360
|
+
const baseItem = await this.schema.lookupItem(ecClassSchemaItemKey);
|
|
361
|
+
if (undefined === baseItem || !ECClass.isECClass(baseItem))
|
|
362
|
+
throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the baseClass ${classProps.baseClass}.`);
|
|
363
|
+
return baseItem;
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
lazyBase = new DelayedPromiseWithProps(ecClassSchemaItemKey, async () => {
|
|
368
|
+
return baseClass;
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
this._baseClass = lazyBase;
|
|
372
|
+
if (!baseClass)
|
|
373
|
+
return;
|
|
374
|
+
this.addDerivedClass(baseClass, this);
|
|
326
375
|
}
|
|
327
376
|
}
|
|
328
377
|
async fromJSON(classProps) {
|
|
@@ -341,8 +390,8 @@ export class ECClass extends SchemaItem {
|
|
|
341
390
|
const baseClasses = [this];
|
|
342
391
|
const addBaseClasses = async (ecClass) => {
|
|
343
392
|
if (SchemaItemType.EntityClass === ecClass.schemaItemType) {
|
|
344
|
-
for (let i =
|
|
345
|
-
baseClasses.push(await
|
|
393
|
+
for (let i = ecClass.mixins.length - 1; i >= 0; i--) {
|
|
394
|
+
baseClasses.push(await ecClass.mixins[i]);
|
|
346
395
|
}
|
|
347
396
|
}
|
|
348
397
|
if (ecClass.baseClass)
|
|
@@ -358,7 +407,7 @@ export class ECClass extends SchemaItem {
|
|
|
358
407
|
*getAllBaseClassesSync() {
|
|
359
408
|
const baseClasses = [this];
|
|
360
409
|
const addBaseClasses = (ecClass) => {
|
|
361
|
-
if (
|
|
410
|
+
if (ecClass.schemaItemType === SchemaItemType.EntityClass) { // cannot use EntityClass typeguard because of circular reference
|
|
362
411
|
for (const m of Array.from(ecClass.getMixinsSync()).reverse()) {
|
|
363
412
|
baseClasses.push(m);
|
|
364
413
|
}
|
|
@@ -389,52 +438,71 @@ export class ECClass extends SchemaItem {
|
|
|
389
438
|
}
|
|
390
439
|
}
|
|
391
440
|
}
|
|
392
|
-
async buildPropertyCache(result, existingValues
|
|
441
|
+
async buildPropertyCache(result, existingValues) {
|
|
393
442
|
if (!existingValues) {
|
|
394
443
|
existingValues = new Map();
|
|
395
444
|
}
|
|
396
445
|
if (this.baseClass) {
|
|
397
|
-
|
|
446
|
+
const baseClass = await this.baseClass;
|
|
447
|
+
if (baseClass) {
|
|
448
|
+
ECClass.mergeProperties(result, existingValues, await baseClass.getProperties(), false);
|
|
449
|
+
}
|
|
398
450
|
}
|
|
399
|
-
if (!this.
|
|
451
|
+
if (!this._properties)
|
|
400
452
|
return;
|
|
401
|
-
ECClass.mergeProperties(result, existingValues, [...this.
|
|
453
|
+
ECClass.mergeProperties(result, existingValues, [...this._properties.values()], true);
|
|
402
454
|
}
|
|
403
|
-
buildPropertyCacheSync(result, existingValues
|
|
455
|
+
buildPropertyCacheSync(result, existingValues) {
|
|
404
456
|
if (!existingValues) {
|
|
405
457
|
existingValues = new Map();
|
|
406
458
|
}
|
|
407
459
|
const baseClass = this.getBaseClassSync();
|
|
408
460
|
if (baseClass) {
|
|
409
|
-
ECClass.mergeProperties(result, existingValues, baseClass.getPropertiesSync(
|
|
461
|
+
ECClass.mergeProperties(result, existingValues, baseClass.getPropertiesSync(), false);
|
|
410
462
|
}
|
|
411
|
-
if (!this.
|
|
463
|
+
if (!this._properties)
|
|
412
464
|
return;
|
|
413
|
-
ECClass.mergeProperties(result, existingValues, [...this.
|
|
465
|
+
ECClass.mergeProperties(result, existingValues, [...this._properties.values()], true);
|
|
414
466
|
}
|
|
415
467
|
/**
|
|
416
|
-
*
|
|
468
|
+
* Clears all caches on this object. This is called implicitly for this class,
|
|
469
|
+
* but needs to be called if derived classes have changed.
|
|
470
|
+
* @internal
|
|
471
|
+
*/
|
|
472
|
+
cleanCache() {
|
|
473
|
+
this._mergedPropertyCache = undefined;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Returns the properties on this class and its base classes.
|
|
417
477
|
* Since this is an expensive operation, results will be cached after first call.
|
|
418
|
-
* @param
|
|
478
|
+
* @param excludeInherited If true, only properties defined directly on this class will be returned. Defaults to false.
|
|
479
|
+
* @returns An array of properties, empty array if none exist.
|
|
419
480
|
*/
|
|
420
|
-
getPropertiesSync(
|
|
421
|
-
if (
|
|
481
|
+
getPropertiesSync(excludeInherited) {
|
|
482
|
+
if (excludeInherited) {
|
|
483
|
+
return this._properties && this._properties.size > 0 ? this._properties.values() : [];
|
|
484
|
+
}
|
|
485
|
+
if (!this._mergedPropertyCache) {
|
|
422
486
|
this._mergedPropertyCache = [];
|
|
423
|
-
this.buildPropertyCacheSync(this._mergedPropertyCache, undefined
|
|
487
|
+
this.buildPropertyCacheSync(this._mergedPropertyCache, undefined);
|
|
424
488
|
}
|
|
425
489
|
return this._mergedPropertyCache;
|
|
426
490
|
}
|
|
427
491
|
/**
|
|
428
|
-
*
|
|
492
|
+
* Quick way to check whether this class has any local properties without having to use the iterable
|
|
493
|
+
*/
|
|
494
|
+
get hasLocalProperties() {
|
|
495
|
+
return this._properties !== undefined && this._properties.size > 0;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Returns the properties on this class and its base classes.
|
|
429
499
|
* Since this is an expensive operation, results will be cached after first call.
|
|
430
|
-
* @param
|
|
500
|
+
* @param excludeInherited If true, only properties defined directly on this class will be returned.
|
|
501
|
+
* @returns An array of properties, empty array if none exist.
|
|
431
502
|
*/
|
|
432
|
-
async getProperties(
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
await this.buildPropertyCache(this._mergedPropertyCache, undefined, resetCache);
|
|
436
|
-
}
|
|
437
|
-
return this._mergedPropertyCache;
|
|
503
|
+
async getProperties(excludeInherited) {
|
|
504
|
+
// At the moment we do not lazy load properties, so this is the same as getPropertiesSync
|
|
505
|
+
return this.getPropertiesSync(excludeInherited);
|
|
438
506
|
}
|
|
439
507
|
/**
|
|
440
508
|
* Retrieve all custom attributes in the current class and its bases
|
|
@@ -533,15 +601,69 @@ export class ECClass extends SchemaItem {
|
|
|
533
601
|
setModifier(modifier) {
|
|
534
602
|
this._modifier = modifier;
|
|
535
603
|
}
|
|
604
|
+
/**
|
|
605
|
+
* Adds an ECClass to the derived class collection. This method is only intended to update the local
|
|
606
|
+
* cache of derived classes. For adding a class to the hierarchy, use the baseClass setter method.
|
|
607
|
+
* @param prop The property to add.
|
|
608
|
+
* @return The property that was added.
|
|
609
|
+
*/
|
|
610
|
+
addDerivedClass(baseClass, derivedClass) {
|
|
611
|
+
if (!baseClass._derivedClasses)
|
|
612
|
+
baseClass._derivedClasses = new Map();
|
|
613
|
+
if (baseClass._derivedClasses.has(derivedClass.fullName))
|
|
614
|
+
return;
|
|
615
|
+
if (derivedClass.isSync(baseClass)) {
|
|
616
|
+
const promise = new DelayedPromiseWithProps(derivedClass.key, async () => derivedClass);
|
|
617
|
+
baseClass._derivedClasses.set(derivedClass.fullName, promise);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Removes an ECClass from the derived class collection. This method is only intended to update the local
|
|
622
|
+
* cache of derived classes. For updating the class hierarchy, use the baseClass setter method.
|
|
623
|
+
* @param prop The property to add.
|
|
624
|
+
* @return The property that was added.
|
|
625
|
+
*/
|
|
626
|
+
removeDerivedClass(baseClass, derivedClass) {
|
|
627
|
+
if (!baseClass._derivedClasses)
|
|
628
|
+
return;
|
|
629
|
+
if (!baseClass._derivedClasses.has(derivedClass.fullName))
|
|
630
|
+
return;
|
|
631
|
+
baseClass._derivedClasses.delete(derivedClass.fullName);
|
|
632
|
+
}
|
|
536
633
|
}
|
|
537
634
|
/**
|
|
538
635
|
* A Typescript class representation of an ECStructClass.
|
|
539
636
|
* @beta
|
|
540
637
|
*/
|
|
541
638
|
export class StructClass extends ECClass {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
639
|
+
/**
|
|
640
|
+
* Get the type of item represented by this instance
|
|
641
|
+
* @beta
|
|
642
|
+
*/
|
|
643
|
+
schemaItemType = StructClass.schemaItemType;
|
|
644
|
+
/**
|
|
645
|
+
* Get the type of item represented by this class
|
|
646
|
+
* @beta
|
|
647
|
+
*/
|
|
648
|
+
static get schemaItemType() { return SchemaItemType.StructClass; }
|
|
649
|
+
/**
|
|
650
|
+
* Type guard to check if the SchemaItem is of type StructClass.
|
|
651
|
+
* @param item The SchemaItem to check.
|
|
652
|
+
* @returns True if the item is a StructClass, false otherwise.
|
|
653
|
+
*/
|
|
654
|
+
static isStructClass(item) {
|
|
655
|
+
if (item && item.schemaItemType === SchemaItemType.StructClass)
|
|
656
|
+
return true;
|
|
657
|
+
return false;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Type assertion to check if the SchemaItem is of type StructClass.
|
|
661
|
+
* @param item The SchemaItem to check.
|
|
662
|
+
* @returns The item cast to StructClass if it is a StructClass, undefined otherwise.
|
|
663
|
+
*/
|
|
664
|
+
static assertIsStructClass(item) {
|
|
665
|
+
if (!this.isStructClass(item))
|
|
666
|
+
throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.StructClass}' (StructClass)`);
|
|
545
667
|
}
|
|
546
668
|
}
|
|
547
669
|
/**
|