@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"}
|
|
@@ -15,6 +15,7 @@ const ECObjects_1 = require("../ECObjects");
|
|
|
15
15
|
const Exception_1 = require("../Exception");
|
|
16
16
|
const SchemaKey_1 = require("../SchemaKey");
|
|
17
17
|
const CustomAttribute_1 = require("./CustomAttribute");
|
|
18
|
+
const Enumeration_1 = require("./Enumeration");
|
|
18
19
|
const Property_1 = require("./Property");
|
|
19
20
|
const SchemaItem_1 = require("./SchemaItem");
|
|
20
21
|
const Helper_1 = require("../Deserialization/Helper");
|
|
@@ -23,10 +24,14 @@ const Helper_1 = require("../Deserialization/Helper");
|
|
|
23
24
|
* @beta
|
|
24
25
|
*/
|
|
25
26
|
class ECClass extends SchemaItem_1.SchemaItem {
|
|
27
|
+
static get schemaItemType() { return ECObjects_1.AbstractSchemaItemType.Class; } // need this so getItem("name", ECClass) in schema works
|
|
28
|
+
_modifier;
|
|
29
|
+
_baseClass;
|
|
30
|
+
_derivedClasses;
|
|
31
|
+
_properties;
|
|
32
|
+
_customAttributes;
|
|
33
|
+
_mergedPropertyCache;
|
|
26
34
|
get modifier() { return this._modifier; }
|
|
27
|
-
get baseClass() { return this._baseClass; }
|
|
28
|
-
set baseClass(baseClass) { this._baseClass = baseClass; }
|
|
29
|
-
get properties() { return this._properties?.values(); }
|
|
30
35
|
get customAttributes() { return this._customAttributes; }
|
|
31
36
|
constructor(schema, name, modifier) {
|
|
32
37
|
super(schema, name);
|
|
@@ -35,6 +40,32 @@ class ECClass extends SchemaItem_1.SchemaItem {
|
|
|
35
40
|
else
|
|
36
41
|
this._modifier = ECObjects_1.ECClassModifier.None;
|
|
37
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Gets the base class if it exists, otherwise returns undefined.
|
|
45
|
+
*/
|
|
46
|
+
get baseClass() {
|
|
47
|
+
return this._baseClass;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Sets the base class of the ECClass. Pass undefined to 'remove' the base class.
|
|
51
|
+
*/
|
|
52
|
+
async setBaseClass(baseClass) {
|
|
53
|
+
const oldBaseClass = this._baseClass;
|
|
54
|
+
this._baseClass = baseClass;
|
|
55
|
+
if (baseClass)
|
|
56
|
+
this.addDerivedClass(await baseClass, this);
|
|
57
|
+
else if (oldBaseClass)
|
|
58
|
+
this.removeDerivedClass(await oldBaseClass, this);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Gets the derived classes belonging to this class.
|
|
62
|
+
* @returns An array of ECClasses or undefined if no derived classes exist.
|
|
63
|
+
*/
|
|
64
|
+
async getDerivedClasses() {
|
|
65
|
+
if (!this._derivedClasses || this._derivedClasses.size === 0)
|
|
66
|
+
return undefined;
|
|
67
|
+
return Array.from(await Promise.all(this._derivedClasses.values()));
|
|
68
|
+
}
|
|
38
69
|
/**
|
|
39
70
|
* Convenience method for adding an already loaded ECProperty used by create*Property methods.
|
|
40
71
|
* @param prop The property to add.
|
|
@@ -44,6 +75,7 @@ class ECClass extends SchemaItem_1.SchemaItem {
|
|
|
44
75
|
if (!this._properties)
|
|
45
76
|
this._properties = new Map();
|
|
46
77
|
this._properties.set(prop.name.toUpperCase(), prop);
|
|
78
|
+
this.cleanCache();
|
|
47
79
|
return prop;
|
|
48
80
|
}
|
|
49
81
|
/**
|
|
@@ -54,8 +86,10 @@ class ECClass extends SchemaItem_1.SchemaItem {
|
|
|
54
86
|
async deleteProperty(name) {
|
|
55
87
|
if (this._properties) {
|
|
56
88
|
const property = await this.getProperty(name);
|
|
57
|
-
if (property)
|
|
89
|
+
if (property) {
|
|
58
90
|
this._properties.delete(name.toUpperCase());
|
|
91
|
+
this.cleanCache();
|
|
92
|
+
}
|
|
59
93
|
}
|
|
60
94
|
}
|
|
61
95
|
/**
|
|
@@ -66,15 +100,17 @@ class ECClass extends SchemaItem_1.SchemaItem {
|
|
|
66
100
|
deletePropertySync(name) {
|
|
67
101
|
if (this._properties) {
|
|
68
102
|
const property = this.getPropertySync(name);
|
|
69
|
-
if (property)
|
|
103
|
+
if (property) {
|
|
70
104
|
this._properties.delete(name.toUpperCase());
|
|
105
|
+
this.cleanCache();
|
|
106
|
+
}
|
|
71
107
|
}
|
|
72
108
|
}
|
|
73
109
|
getBaseClassSync() {
|
|
74
110
|
if (!this.baseClass) {
|
|
75
111
|
return undefined;
|
|
76
112
|
}
|
|
77
|
-
return this.schema.lookupItemSync(this.baseClass);
|
|
113
|
+
return this.schema.lookupItemSync(this.baseClass, ECClass);
|
|
78
114
|
}
|
|
79
115
|
/**
|
|
80
116
|
* Searches, case-insensitive, for a local ECProperty with the name provided.
|
|
@@ -204,7 +240,7 @@ class ECClass extends SchemaItem_1.SchemaItem {
|
|
|
204
240
|
async loadStructType(structType, schema) {
|
|
205
241
|
let correctType;
|
|
206
242
|
if (typeof (structType) === "string") {
|
|
207
|
-
correctType = await schema.lookupItem(structType);
|
|
243
|
+
correctType = await schema.lookupItem(structType, StructClass);
|
|
208
244
|
}
|
|
209
245
|
else
|
|
210
246
|
correctType = structType;
|
|
@@ -215,7 +251,7 @@ class ECClass extends SchemaItem_1.SchemaItem {
|
|
|
215
251
|
loadStructTypeSync(structType, schema) {
|
|
216
252
|
let correctType;
|
|
217
253
|
if (typeof (structType) === "string") {
|
|
218
|
-
correctType = schema.lookupItemSync(structType);
|
|
254
|
+
correctType = schema.lookupItemSync(structType, StructClass);
|
|
219
255
|
}
|
|
220
256
|
else
|
|
221
257
|
correctType = structType;
|
|
@@ -229,7 +265,7 @@ class ECClass extends SchemaItem_1.SchemaItem {
|
|
|
229
265
|
if (typeof (primitiveType) === "string") {
|
|
230
266
|
let resolvedType = (0, ECObjects_1.parsePrimitiveType)(primitiveType);
|
|
231
267
|
if (!resolvedType) {
|
|
232
|
-
resolvedType = await schema.lookupItem(primitiveType);
|
|
268
|
+
resolvedType = await schema.lookupItem(primitiveType, Enumeration_1.Enumeration);
|
|
233
269
|
}
|
|
234
270
|
if (resolvedType === undefined)
|
|
235
271
|
throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);
|
|
@@ -246,7 +282,7 @@ class ECClass extends SchemaItem_1.SchemaItem {
|
|
|
246
282
|
if (typeof (primitiveType) === "string") {
|
|
247
283
|
let resolvedType = (0, ECObjects_1.parsePrimitiveType)(primitiveType);
|
|
248
284
|
if (!resolvedType) {
|
|
249
|
-
resolvedType = schema.lookupItemSync(primitiveType);
|
|
285
|
+
resolvedType = schema.lookupItemSync(primitiveType, Enumeration_1.Enumeration);
|
|
250
286
|
}
|
|
251
287
|
if (resolvedType === undefined)
|
|
252
288
|
throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);
|
|
@@ -268,7 +304,7 @@ class ECClass extends SchemaItem_1.SchemaItem {
|
|
|
268
304
|
if (this.baseClass !== undefined)
|
|
269
305
|
schemaJson.baseClass = this.baseClass.fullName;
|
|
270
306
|
if (this._properties !== undefined && this._properties.size > 0)
|
|
271
|
-
schemaJson.properties = [...this.
|
|
307
|
+
schemaJson.properties = [...this._properties.values()].map((prop) => prop.toJSON());
|
|
272
308
|
const customAttributes = (0, CustomAttribute_1.serializeCustomAttributes)(this.customAttributes);
|
|
273
309
|
if (customAttributes !== undefined)
|
|
274
310
|
schemaJson.customAttributes = customAttributes;
|
|
@@ -286,8 +322,8 @@ class ECClass extends SchemaItem_1.SchemaItem {
|
|
|
286
322
|
baseClassElement.textContent = baseClassName;
|
|
287
323
|
itemElement.appendChild(baseClassElement);
|
|
288
324
|
}
|
|
289
|
-
if (undefined !== this.
|
|
290
|
-
for (const prop of this.
|
|
325
|
+
if (undefined !== this._properties) {
|
|
326
|
+
for (const prop of this._properties.values()) {
|
|
291
327
|
const propXml = await prop.toXml(schemaXml);
|
|
292
328
|
itemElement.appendChild(propXml);
|
|
293
329
|
}
|
|
@@ -320,12 +356,25 @@ class ECClass extends SchemaItem_1.SchemaItem {
|
|
|
320
356
|
const ecClassSchemaItemKey = this.schema.getSchemaItemKey(classProps.baseClass);
|
|
321
357
|
if (!ecClassSchemaItemKey)
|
|
322
358
|
throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidECJson, `Unable to locate the baseClass ${classProps.baseClass}.`);
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
359
|
+
const baseClass = this.schema.lookupItemSync(ecClassSchemaItemKey);
|
|
360
|
+
let lazyBase;
|
|
361
|
+
if (!baseClass) {
|
|
362
|
+
lazyBase = new DelayedPromise_1.DelayedPromiseWithProps(ecClassSchemaItemKey, async () => {
|
|
363
|
+
const baseItem = await this.schema.lookupItem(ecClassSchemaItemKey);
|
|
364
|
+
if (undefined === baseItem || !ECClass.isECClass(baseItem))
|
|
365
|
+
throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidECJson, `Unable to locate the baseClass ${classProps.baseClass}.`);
|
|
366
|
+
return baseItem;
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
lazyBase = new DelayedPromise_1.DelayedPromiseWithProps(ecClassSchemaItemKey, async () => {
|
|
371
|
+
return baseClass;
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
this._baseClass = lazyBase;
|
|
375
|
+
if (!baseClass)
|
|
376
|
+
return;
|
|
377
|
+
this.addDerivedClass(baseClass, this);
|
|
329
378
|
}
|
|
330
379
|
}
|
|
331
380
|
async fromJSON(classProps) {
|
|
@@ -344,8 +393,8 @@ class ECClass extends SchemaItem_1.SchemaItem {
|
|
|
344
393
|
const baseClasses = [this];
|
|
345
394
|
const addBaseClasses = async (ecClass) => {
|
|
346
395
|
if (ECObjects_1.SchemaItemType.EntityClass === ecClass.schemaItemType) {
|
|
347
|
-
for (let i =
|
|
348
|
-
baseClasses.push(await
|
|
396
|
+
for (let i = ecClass.mixins.length - 1; i >= 0; i--) {
|
|
397
|
+
baseClasses.push(await ecClass.mixins[i]);
|
|
349
398
|
}
|
|
350
399
|
}
|
|
351
400
|
if (ecClass.baseClass)
|
|
@@ -361,7 +410,7 @@ class ECClass extends SchemaItem_1.SchemaItem {
|
|
|
361
410
|
*getAllBaseClassesSync() {
|
|
362
411
|
const baseClasses = [this];
|
|
363
412
|
const addBaseClasses = (ecClass) => {
|
|
364
|
-
if (ECObjects_1.SchemaItemType.EntityClass
|
|
413
|
+
if (ecClass.schemaItemType === ECObjects_1.SchemaItemType.EntityClass) { // cannot use EntityClass typeguard because of circular reference
|
|
365
414
|
for (const m of Array.from(ecClass.getMixinsSync()).reverse()) {
|
|
366
415
|
baseClasses.push(m);
|
|
367
416
|
}
|
|
@@ -392,52 +441,71 @@ class ECClass extends SchemaItem_1.SchemaItem {
|
|
|
392
441
|
}
|
|
393
442
|
}
|
|
394
443
|
}
|
|
395
|
-
async buildPropertyCache(result, existingValues
|
|
444
|
+
async buildPropertyCache(result, existingValues) {
|
|
396
445
|
if (!existingValues) {
|
|
397
446
|
existingValues = new Map();
|
|
398
447
|
}
|
|
399
448
|
if (this.baseClass) {
|
|
400
|
-
|
|
449
|
+
const baseClass = await this.baseClass;
|
|
450
|
+
if (baseClass) {
|
|
451
|
+
ECClass.mergeProperties(result, existingValues, await baseClass.getProperties(), false);
|
|
452
|
+
}
|
|
401
453
|
}
|
|
402
|
-
if (!this.
|
|
454
|
+
if (!this._properties)
|
|
403
455
|
return;
|
|
404
|
-
ECClass.mergeProperties(result, existingValues, [...this.
|
|
456
|
+
ECClass.mergeProperties(result, existingValues, [...this._properties.values()], true);
|
|
405
457
|
}
|
|
406
|
-
buildPropertyCacheSync(result, existingValues
|
|
458
|
+
buildPropertyCacheSync(result, existingValues) {
|
|
407
459
|
if (!existingValues) {
|
|
408
460
|
existingValues = new Map();
|
|
409
461
|
}
|
|
410
462
|
const baseClass = this.getBaseClassSync();
|
|
411
463
|
if (baseClass) {
|
|
412
|
-
ECClass.mergeProperties(result, existingValues, baseClass.getPropertiesSync(
|
|
464
|
+
ECClass.mergeProperties(result, existingValues, baseClass.getPropertiesSync(), false);
|
|
413
465
|
}
|
|
414
|
-
if (!this.
|
|
466
|
+
if (!this._properties)
|
|
415
467
|
return;
|
|
416
|
-
ECClass.mergeProperties(result, existingValues, [...this.
|
|
468
|
+
ECClass.mergeProperties(result, existingValues, [...this._properties.values()], true);
|
|
417
469
|
}
|
|
418
470
|
/**
|
|
419
|
-
*
|
|
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.
|
|
420
480
|
* Since this is an expensive operation, results will be cached after first call.
|
|
421
|
-
* @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.
|
|
422
483
|
*/
|
|
423
|
-
getPropertiesSync(
|
|
424
|
-
if (
|
|
484
|
+
getPropertiesSync(excludeInherited) {
|
|
485
|
+
if (excludeInherited) {
|
|
486
|
+
return this._properties && this._properties.size > 0 ? this._properties.values() : [];
|
|
487
|
+
}
|
|
488
|
+
if (!this._mergedPropertyCache) {
|
|
425
489
|
this._mergedPropertyCache = [];
|
|
426
|
-
this.buildPropertyCacheSync(this._mergedPropertyCache, undefined
|
|
490
|
+
this.buildPropertyCacheSync(this._mergedPropertyCache, undefined);
|
|
427
491
|
}
|
|
428
492
|
return this._mergedPropertyCache;
|
|
429
493
|
}
|
|
430
494
|
/**
|
|
431
|
-
*
|
|
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.
|
|
432
502
|
* Since this is an expensive operation, results will be cached after first call.
|
|
433
|
-
* @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.
|
|
434
505
|
*/
|
|
435
|
-
async getProperties(
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
await this.buildPropertyCache(this._mergedPropertyCache, undefined, resetCache);
|
|
439
|
-
}
|
|
440
|
-
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);
|
|
441
509
|
}
|
|
442
510
|
/**
|
|
443
511
|
* Retrieve all custom attributes in the current class and its bases
|
|
@@ -536,6 +604,35 @@ class ECClass extends SchemaItem_1.SchemaItem {
|
|
|
536
604
|
setModifier(modifier) {
|
|
537
605
|
this._modifier = modifier;
|
|
538
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 DelayedPromise_1.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
|
+
}
|
|
539
636
|
}
|
|
540
637
|
exports.ECClass = ECClass;
|
|
541
638
|
/**
|
|
@@ -543,9 +640,34 @@ exports.ECClass = ECClass;
|
|
|
543
640
|
* @beta
|
|
544
641
|
*/
|
|
545
642
|
class StructClass extends ECClass {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
643
|
+
/**
|
|
644
|
+
* Get the type of item represented by this instance
|
|
645
|
+
* @beta
|
|
646
|
+
*/
|
|
647
|
+
schemaItemType = StructClass.schemaItemType;
|
|
648
|
+
/**
|
|
649
|
+
* Get the type of item represented by this class
|
|
650
|
+
* @beta
|
|
651
|
+
*/
|
|
652
|
+
static get schemaItemType() { return ECObjects_1.SchemaItemType.StructClass; }
|
|
653
|
+
/**
|
|
654
|
+
* Type guard to check if the SchemaItem is of type StructClass.
|
|
655
|
+
* @param item The SchemaItem to check.
|
|
656
|
+
* @returns True if the item is a StructClass, false otherwise.
|
|
657
|
+
*/
|
|
658
|
+
static isStructClass(item) {
|
|
659
|
+
if (item && item.schemaItemType === ECObjects_1.SchemaItemType.StructClass)
|
|
660
|
+
return true;
|
|
661
|
+
return false;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Type assertion to check if the SchemaItem is of type StructClass.
|
|
665
|
+
* @param item The SchemaItem to check.
|
|
666
|
+
* @returns The item cast to StructClass if it is a StructClass, undefined otherwise.
|
|
667
|
+
*/
|
|
668
|
+
static assertIsStructClass(item) {
|
|
669
|
+
if (!this.isStructClass(item))
|
|
670
|
+
throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidSchemaItemType, `Expected '${ECObjects_1.SchemaItemType.StructClass}' (StructClass)`);
|
|
549
671
|
}
|
|
550
672
|
}
|
|
551
673
|
exports.StructClass = StructClass;
|