@itwin/ecschema-metadata 5.0.0-dev.99 → 5.1.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -1
- package/lib/cjs/Constants.js.map +1 -1
- package/lib/cjs/Context.d.ts +3 -3
- package/lib/cjs/Context.d.ts.map +1 -1
- package/lib/cjs/Context.js +6 -6
- package/lib/cjs/Context.js.map +1 -1
- package/lib/cjs/DelayedPromise.d.ts +9 -8
- package/lib/cjs/DelayedPromise.d.ts.map +1 -1
- package/lib/cjs/DelayedPromise.js +2 -2
- package/lib/cjs/DelayedPromise.js.map +1 -1
- package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
- package/lib/cjs/Deserialization/Helper.d.ts.map +1 -1
- package/lib/cjs/Deserialization/Helper.js +27 -26
- package/lib/cjs/Deserialization/Helper.js.map +1 -1
- package/lib/cjs/Deserialization/JsonParser.js +150 -150
- package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.d.ts +34 -34
- package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.js +3 -3
- package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
- package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.js +49 -49
- package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts +0 -5
- package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.js +6 -11
- package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/cjs/ECName.d.ts +2 -2
- package/lib/cjs/ECName.js +4 -4
- package/lib/cjs/ECName.js.map +1 -1
- package/lib/cjs/ECObjects.d.ts +23 -11
- package/lib/cjs/ECObjects.d.ts.map +1 -1
- package/lib/cjs/ECObjects.js +47 -24
- package/lib/cjs/ECObjects.js.map +1 -1
- package/lib/cjs/Exception.d.ts +4 -4
- package/lib/cjs/Exception.d.ts.map +1 -1
- package/lib/cjs/Exception.js +60 -60
- package/lib/cjs/Exception.js.map +1 -1
- package/lib/cjs/Interfaces.d.ts +30 -34
- package/lib/cjs/Interfaces.d.ts.map +1 -1
- package/lib/cjs/Interfaces.js.map +1 -1
- package/lib/cjs/Metadata/Class.d.ts +107 -19
- package/lib/cjs/Metadata/Class.d.ts.map +1 -1
- package/lib/cjs/Metadata/Class.js +127 -47
- package/lib/cjs/Metadata/Class.js.map +1 -1
- package/lib/cjs/Metadata/Constant.d.ts +12 -9
- package/lib/cjs/Metadata/Constant.d.ts.map +1 -1
- package/lib/cjs/Metadata/Constant.js +12 -9
- package/lib/cjs/Metadata/Constant.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttribute.d.ts +2 -2
- package/lib/cjs/Metadata/CustomAttribute.d.ts.map +1 -1
- package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.d.ts +5 -3
- package/lib/cjs/Metadata/CustomAttributeClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.js +7 -5
- package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/cjs/Metadata/EntityClass.d.ts +20 -3
- package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js +32 -14
- package/lib/cjs/Metadata/EntityClass.js.map +1 -1
- package/lib/cjs/Metadata/Enumeration.d.ts +16 -9
- package/lib/cjs/Metadata/Enumeration.d.ts.map +1 -1
- package/lib/cjs/Metadata/Enumeration.js +20 -13
- package/lib/cjs/Metadata/Enumeration.js.map +1 -1
- package/lib/cjs/Metadata/Format.d.ts +32 -24
- package/lib/cjs/Metadata/Format.d.ts.map +1 -1
- package/lib/cjs/Metadata/Format.js +47 -27
- package/lib/cjs/Metadata/Format.js.map +1 -1
- package/lib/cjs/Metadata/InvertedUnit.d.ts +11 -7
- package/lib/cjs/Metadata/InvertedUnit.d.ts.map +1 -1
- package/lib/cjs/Metadata/InvertedUnit.js +16 -10
- package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.d.ts +24 -15
- package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.js +54 -29
- package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/cjs/Metadata/Mixin.d.ts +16 -3
- package/lib/cjs/Metadata/Mixin.d.ts.map +1 -1
- package/lib/cjs/Metadata/Mixin.js +20 -7
- package/lib/cjs/Metadata/Mixin.js.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.d.ts +12 -12
- package/lib/cjs/Metadata/OverrideFormat.d.ts.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.js +27 -19
- package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
- package/lib/cjs/Metadata/Phenomenon.d.ts +10 -2
- package/lib/cjs/Metadata/Phenomenon.d.ts.map +1 -1
- package/lib/cjs/Metadata/Phenomenon.js +11 -3
- package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
- package/lib/cjs/Metadata/Property.d.ts +46 -28
- package/lib/cjs/Metadata/Property.d.ts.map +1 -1
- package/lib/cjs/Metadata/Property.js +46 -22
- package/lib/cjs/Metadata/Property.js.map +1 -1
- package/lib/cjs/Metadata/PropertyCategory.d.ts +6 -3
- package/lib/cjs/Metadata/PropertyCategory.d.ts.map +1 -1
- package/lib/cjs/Metadata/PropertyCategory.js +12 -5
- package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.d.ts +48 -25
- package/lib/cjs/Metadata/RelationshipClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.js +54 -34
- package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
- package/lib/cjs/Metadata/Schema.d.ts +50 -28
- package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
- package/lib/cjs/Metadata/Schema.js +64 -42
- package/lib/cjs/Metadata/Schema.js.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.d.ts +10 -19
- package/lib/cjs/Metadata/SchemaItem.d.ts.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.js +12 -20
- package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
- package/lib/cjs/Metadata/Unit.d.ts +17 -21
- package/lib/cjs/Metadata/Unit.d.ts.map +1 -1
- package/lib/cjs/Metadata/Unit.js +20 -22
- package/lib/cjs/Metadata/Unit.js.map +1 -1
- package/lib/cjs/Metadata/UnitSystem.d.ts +3 -1
- package/lib/cjs/Metadata/UnitSystem.d.ts.map +1 -1
- package/lib/cjs/Metadata/UnitSystem.js +4 -2
- package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
- package/lib/cjs/PropertyTypes.d.ts +11 -11
- package/lib/cjs/PropertyTypes.d.ts.map +1 -1
- package/lib/cjs/PropertyTypes.js +28 -20
- package/lib/cjs/PropertyTypes.js.map +1 -1
- package/lib/cjs/SchemaFormatsProvider.d.ts +39 -0
- package/lib/cjs/SchemaFormatsProvider.d.ts.map +1 -0
- package/lib/cjs/SchemaFormatsProvider.js +146 -0
- package/lib/cjs/SchemaFormatsProvider.js.map +1 -0
- package/lib/cjs/SchemaJsonLocater.d.ts +5 -5
- package/lib/cjs/SchemaJsonLocater.js +4 -4
- package/lib/cjs/SchemaJsonLocater.js.map +1 -1
- package/lib/cjs/SchemaKey.d.ts +6 -6
- package/lib/cjs/SchemaKey.d.ts.map +1 -1
- package/lib/cjs/SchemaKey.js +9 -9
- package/lib/cjs/SchemaKey.js.map +1 -1
- package/lib/cjs/SchemaLoader.d.ts +3 -3
- package/lib/cjs/SchemaLoader.js +4 -4
- package/lib/cjs/SchemaLoader.js.map +1 -1
- package/lib/cjs/SchemaPartVisitorDelegate.d.ts +2 -2
- package/lib/cjs/SchemaPartVisitorDelegate.js +1 -1
- package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/cjs/UnitConversion/Graph.js.map +1 -1
- package/lib/cjs/UnitConversion/Parser.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-metadata.d.ts +2 -1
- package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
- package/lib/cjs/ecschema-metadata.js +1 -0
- package/lib/cjs/ecschema-metadata.js.map +1 -1
- package/lib/cjs/utils/SchemaGraph.js +3 -3
- package/lib/cjs/utils/SchemaGraph.js.map +1 -1
- package/lib/esm/Constants.js.map +1 -1
- package/lib/esm/Context.d.ts +3 -3
- package/lib/esm/Context.d.ts.map +1 -1
- package/lib/esm/Context.js +7 -7
- package/lib/esm/Context.js.map +1 -1
- package/lib/esm/DelayedPromise.d.ts +9 -8
- package/lib/esm/DelayedPromise.d.ts.map +1 -1
- package/lib/esm/DelayedPromise.js +2 -2
- package/lib/esm/DelayedPromise.js.map +1 -1
- package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
- package/lib/esm/Deserialization/Helper.d.ts.map +1 -1
- package/lib/esm/Deserialization/Helper.js +28 -27
- package/lib/esm/Deserialization/Helper.js.map +1 -1
- package/lib/esm/Deserialization/JsonParser.js +151 -151
- package/lib/esm/Deserialization/JsonParser.js.map +1 -1
- package/lib/esm/Deserialization/JsonProps.d.ts +34 -34
- package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/esm/Deserialization/JsonProps.js +3 -3
- package/lib/esm/Deserialization/JsonProps.js.map +1 -1
- package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
- package/lib/esm/Deserialization/XmlParser.js +50 -50
- package/lib/esm/Deserialization/XmlParser.js.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.d.ts +0 -5
- package/lib/esm/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.js +7 -12
- package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/esm/ECName.d.ts +2 -2
- package/lib/esm/ECName.js +5 -5
- package/lib/esm/ECName.js.map +1 -1
- package/lib/esm/ECObjects.d.ts +23 -11
- package/lib/esm/ECObjects.d.ts.map +1 -1
- package/lib/esm/ECObjects.js +48 -25
- package/lib/esm/ECObjects.js.map +1 -1
- package/lib/esm/Exception.d.ts +4 -4
- package/lib/esm/Exception.d.ts.map +1 -1
- package/lib/esm/Exception.js +58 -58
- package/lib/esm/Exception.js.map +1 -1
- package/lib/esm/Interfaces.d.ts +30 -34
- package/lib/esm/Interfaces.d.ts.map +1 -1
- package/lib/esm/Interfaces.js.map +1 -1
- package/lib/esm/Metadata/Class.d.ts +107 -19
- package/lib/esm/Metadata/Class.d.ts.map +1 -1
- package/lib/esm/Metadata/Class.js +128 -48
- package/lib/esm/Metadata/Class.js.map +1 -1
- package/lib/esm/Metadata/Constant.d.ts +12 -9
- package/lib/esm/Metadata/Constant.d.ts.map +1 -1
- package/lib/esm/Metadata/Constant.js +13 -10
- package/lib/esm/Metadata/Constant.js.map +1 -1
- package/lib/esm/Metadata/CustomAttribute.d.ts +2 -2
- package/lib/esm/Metadata/CustomAttribute.d.ts.map +1 -1
- package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.d.ts +5 -3
- package/lib/esm/Metadata/CustomAttributeClass.d.ts.map +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.js +8 -6
- package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/esm/Metadata/EntityClass.d.ts +20 -3
- package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/esm/Metadata/EntityClass.js +33 -15
- package/lib/esm/Metadata/EntityClass.js.map +1 -1
- package/lib/esm/Metadata/Enumeration.d.ts +16 -9
- package/lib/esm/Metadata/Enumeration.d.ts.map +1 -1
- package/lib/esm/Metadata/Enumeration.js +21 -14
- package/lib/esm/Metadata/Enumeration.js.map +1 -1
- package/lib/esm/Metadata/Format.d.ts +32 -24
- package/lib/esm/Metadata/Format.d.ts.map +1 -1
- package/lib/esm/Metadata/Format.js +48 -28
- package/lib/esm/Metadata/Format.js.map +1 -1
- package/lib/esm/Metadata/InvertedUnit.d.ts +11 -7
- package/lib/esm/Metadata/InvertedUnit.d.ts.map +1 -1
- package/lib/esm/Metadata/InvertedUnit.js +17 -11
- package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.d.ts +24 -15
- package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.js +55 -30
- package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/esm/Metadata/Mixin.d.ts +16 -3
- package/lib/esm/Metadata/Mixin.d.ts.map +1 -1
- package/lib/esm/Metadata/Mixin.js +21 -8
- package/lib/esm/Metadata/Mixin.js.map +1 -1
- package/lib/esm/Metadata/OverrideFormat.d.ts +12 -12
- package/lib/esm/Metadata/OverrideFormat.d.ts.map +1 -1
- package/lib/esm/Metadata/OverrideFormat.js +28 -20
- package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
- package/lib/esm/Metadata/Phenomenon.d.ts +10 -2
- package/lib/esm/Metadata/Phenomenon.d.ts.map +1 -1
- package/lib/esm/Metadata/Phenomenon.js +12 -4
- package/lib/esm/Metadata/Phenomenon.js.map +1 -1
- package/lib/esm/Metadata/Property.d.ts +46 -28
- package/lib/esm/Metadata/Property.d.ts.map +1 -1
- package/lib/esm/Metadata/Property.js +47 -23
- package/lib/esm/Metadata/Property.js.map +1 -1
- package/lib/esm/Metadata/PropertyCategory.d.ts +6 -3
- package/lib/esm/Metadata/PropertyCategory.d.ts.map +1 -1
- package/lib/esm/Metadata/PropertyCategory.js +13 -6
- package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.d.ts +48 -25
- package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.js +55 -35
- package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
- package/lib/esm/Metadata/Schema.d.ts +50 -28
- package/lib/esm/Metadata/Schema.d.ts.map +1 -1
- package/lib/esm/Metadata/Schema.js +65 -43
- package/lib/esm/Metadata/Schema.js.map +1 -1
- package/lib/esm/Metadata/SchemaItem.d.ts +10 -19
- package/lib/esm/Metadata/SchemaItem.d.ts.map +1 -1
- package/lib/esm/Metadata/SchemaItem.js +13 -21
- package/lib/esm/Metadata/SchemaItem.js.map +1 -1
- package/lib/esm/Metadata/Unit.d.ts +17 -21
- package/lib/esm/Metadata/Unit.d.ts.map +1 -1
- package/lib/esm/Metadata/Unit.js +21 -23
- package/lib/esm/Metadata/Unit.js.map +1 -1
- package/lib/esm/Metadata/UnitSystem.d.ts +3 -1
- package/lib/esm/Metadata/UnitSystem.d.ts.map +1 -1
- package/lib/esm/Metadata/UnitSystem.js +5 -3
- package/lib/esm/Metadata/UnitSystem.js.map +1 -1
- package/lib/esm/PropertyTypes.d.ts +11 -11
- package/lib/esm/PropertyTypes.d.ts.map +1 -1
- package/lib/esm/PropertyTypes.js +29 -21
- package/lib/esm/PropertyTypes.js.map +1 -1
- package/lib/esm/SchemaFormatsProvider.d.ts +39 -0
- package/lib/esm/SchemaFormatsProvider.d.ts.map +1 -0
- package/lib/esm/SchemaFormatsProvider.js +142 -0
- package/lib/esm/SchemaFormatsProvider.js.map +1 -0
- package/lib/esm/SchemaJsonLocater.d.ts +5 -5
- package/lib/esm/SchemaJsonLocater.js +4 -4
- package/lib/esm/SchemaJsonLocater.js.map +1 -1
- package/lib/esm/SchemaKey.d.ts +6 -6
- package/lib/esm/SchemaKey.d.ts.map +1 -1
- package/lib/esm/SchemaKey.js +10 -10
- package/lib/esm/SchemaKey.js.map +1 -1
- package/lib/esm/SchemaLoader.d.ts +3 -3
- package/lib/esm/SchemaLoader.js +5 -5
- package/lib/esm/SchemaLoader.js.map +1 -1
- package/lib/esm/SchemaPartVisitorDelegate.d.ts +2 -2
- package/lib/esm/SchemaPartVisitorDelegate.js +1 -1
- package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/esm/UnitConversion/Graph.js.map +1 -1
- package/lib/esm/UnitConversion/Parser.js.map +1 -1
- package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
- package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/esm/Validation/SchemaWalker.js.map +1 -1
- package/lib/esm/ecschema-metadata.d.ts +2 -1
- package/lib/esm/ecschema-metadata.d.ts.map +1 -1
- package/lib/esm/ecschema-metadata.js +1 -0
- package/lib/esm/ecschema-metadata.js.map +1 -1
- package/lib/esm/utils/SchemaGraph.js +4 -4
- package/lib/esm/utils/SchemaGraph.js.map +1 -1
- package/package.json +8 -6
|
@@ -6,22 +6,26 @@ import { ECClassModifier, RelationshipEnd, SchemaItemType, StrengthDirection, St
|
|
|
6
6
|
import { LazyLoadedRelationshipConstraintClass } from "../Interfaces";
|
|
7
7
|
import { ECClass } from "./Class";
|
|
8
8
|
import { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet } from "./CustomAttribute";
|
|
9
|
-
import { EntityClass } from "./EntityClass";
|
|
10
|
-
import { Mixin } from "./Mixin";
|
|
11
9
|
import { NavigationProperty } from "./Property";
|
|
12
10
|
import { Schema } from "./Schema";
|
|
13
11
|
import { SchemaItem } from "./SchemaItem";
|
|
14
12
|
/**
|
|
15
13
|
* A Typescript class representation of a ECRelationshipClass.
|
|
16
|
-
* @
|
|
14
|
+
* @public @preview
|
|
17
15
|
*/
|
|
18
16
|
export declare class RelationshipClass extends ECClass {
|
|
19
17
|
readonly schemaItemType: SchemaItemType;
|
|
18
|
+
/** @internal */
|
|
20
19
|
static get schemaItemType(): SchemaItemType;
|
|
20
|
+
/** @internal */
|
|
21
21
|
protected _strength: StrengthType;
|
|
22
|
+
/** @internal */
|
|
22
23
|
protected _strengthDirection: StrengthDirection;
|
|
24
|
+
/** @internal */
|
|
23
25
|
protected _source: RelationshipConstraint;
|
|
26
|
+
/** @internal */
|
|
24
27
|
protected _target: RelationshipConstraint;
|
|
28
|
+
/** @internal */
|
|
25
29
|
constructor(schema: Schema, name: string, modifier?: ECClassModifier);
|
|
26
30
|
get strength(): StrengthType;
|
|
27
31
|
get strengthDirection(): StrengthDirection;
|
|
@@ -32,23 +36,25 @@ export declare class RelationshipClass extends ECClass {
|
|
|
32
36
|
* @param name
|
|
33
37
|
* @param relationship
|
|
34
38
|
* @param direction
|
|
39
|
+
* @internal
|
|
35
40
|
*/
|
|
36
41
|
protected createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;
|
|
42
|
+
/** @internal */
|
|
37
43
|
protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;
|
|
38
44
|
/**
|
|
39
|
-
* @
|
|
45
|
+
* @internal Used for schema editing.
|
|
40
46
|
*/
|
|
41
47
|
protected setStrength(strength: StrengthType): void;
|
|
42
48
|
/**
|
|
43
|
-
* @
|
|
49
|
+
* @internal Used for schema editing.
|
|
44
50
|
*/
|
|
45
51
|
protected setStrengthDirection(direction: StrengthDirection): void;
|
|
46
52
|
/**
|
|
47
|
-
* @
|
|
53
|
+
* @internal Used for schema editing.
|
|
48
54
|
*/
|
|
49
55
|
protected setSourceConstraint(source: RelationshipConstraint): void;
|
|
50
56
|
/**
|
|
51
|
-
* @
|
|
57
|
+
* @internal Used for schema editing.
|
|
52
58
|
*/
|
|
53
59
|
protected setTargetConstraint(target: RelationshipConstraint): void;
|
|
54
60
|
/**
|
|
@@ -71,40 +77,37 @@ export declare class RelationshipClass extends ECClass {
|
|
|
71
77
|
* Type assertion to check if the SchemaItem is of type RelationshipClass.
|
|
72
78
|
* @param item The SchemaItem to check.
|
|
73
79
|
* @returns The item cast to RelationshipClass if it is a RelationshipClass, undefined otherwise.
|
|
80
|
+
* @internal
|
|
74
81
|
*/
|
|
75
82
|
static assertIsRelationshipClass(item?: SchemaItem): asserts item is RelationshipClass;
|
|
76
83
|
}
|
|
77
84
|
/**
|
|
78
85
|
* A Typescript class representation of a ECRelationshipConstraint.
|
|
79
|
-
* @
|
|
86
|
+
* @public @preview
|
|
80
87
|
*/
|
|
81
88
|
export declare class RelationshipConstraint implements CustomAttributeContainerProps {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
private _abstractConstraint?;
|
|
90
|
+
private _relationshipClass;
|
|
91
|
+
private _relationshipEnd;
|
|
92
|
+
private _multiplicity?;
|
|
93
|
+
private _polymorphic?;
|
|
94
|
+
private _roleLabel?;
|
|
95
|
+
private _constraintClasses?;
|
|
89
96
|
private _customAttributes?;
|
|
97
|
+
/** @internal */
|
|
90
98
|
constructor(relClass: RelationshipClass, relEnd: RelationshipEnd, roleLabel?: string, polymorphic?: boolean);
|
|
91
99
|
get multiplicity(): RelationshipMultiplicity;
|
|
92
|
-
protected set multiplicity(multiplicity: RelationshipMultiplicity);
|
|
93
100
|
get polymorphic(): boolean;
|
|
94
|
-
protected set polymorphic(polymorphic: boolean);
|
|
95
101
|
get roleLabel(): string | undefined;
|
|
96
|
-
|
|
97
|
-
get constraintClasses(): LazyLoadedRelationshipConstraintClass[] | undefined;
|
|
102
|
+
get constraintClasses(): ReadonlyArray<LazyLoadedRelationshipConstraintClass> | undefined;
|
|
98
103
|
get relationshipClass(): RelationshipClass;
|
|
99
104
|
get relationshipEnd(): RelationshipEnd;
|
|
100
|
-
protected set relationshipEnd(relationshipEnd: RelationshipEnd);
|
|
101
105
|
get customAttributes(): CustomAttributeSet | undefined;
|
|
102
106
|
/** Returns the constraint name, ie. 'RelationshipName.Source/Target' */
|
|
103
107
|
get fullName(): string;
|
|
104
108
|
/** Returns the schema of the RelationshipClass. */
|
|
105
109
|
get schema(): Schema;
|
|
106
110
|
get abstractConstraint(): LazyLoadedRelationshipConstraintClass | undefined;
|
|
107
|
-
set abstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined);
|
|
108
111
|
/**
|
|
109
112
|
* True if this RelationshipConstraint is the Source relationship end.
|
|
110
113
|
*/
|
|
@@ -112,13 +115,16 @@ export declare class RelationshipConstraint implements CustomAttributeContainerP
|
|
|
112
115
|
/**
|
|
113
116
|
* Adds the provided class as a constraint class to this constraint.
|
|
114
117
|
* @param constraint The class to add as a constraint class.
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
addClass(constraint: LazyLoadedRelationshipConstraintClass): void;
|
|
117
121
|
/**
|
|
118
122
|
* Removes the provided class as a constraint class from this constraint.
|
|
119
123
|
* @param constraint The class to add as a constraint class.
|
|
124
|
+
*
|
|
125
|
+
* @internal
|
|
120
126
|
*/
|
|
121
|
-
protected removeClass(constraint:
|
|
127
|
+
protected removeClass(constraint: LazyLoadedRelationshipConstraintClass): void;
|
|
122
128
|
/**
|
|
123
129
|
* Save this RelationshipConstraint's properties to an object for serializing to JSON.
|
|
124
130
|
*/
|
|
@@ -143,7 +149,18 @@ export declare class RelationshipConstraint implements CustomAttributeContainerP
|
|
|
143
149
|
* @internal
|
|
144
150
|
*/
|
|
145
151
|
static isRelationshipConstraint(object: any): object is RelationshipConstraint;
|
|
152
|
+
/** @internal */
|
|
146
153
|
protected addCustomAttribute(customAttribute: CustomAttribute): void;
|
|
154
|
+
/** @internal */
|
|
155
|
+
protected setRoleLabel(roleLabel: string | undefined): void;
|
|
156
|
+
/** @internal */
|
|
157
|
+
protected setRelationshipEnd(relationshipEnd: RelationshipEnd): void;
|
|
158
|
+
/** @internal */
|
|
159
|
+
protected setPolymorphic(polymorphic: boolean): void;
|
|
160
|
+
/** @internal */
|
|
161
|
+
protected setMultiplicity(multiplicity: RelationshipMultiplicity): void;
|
|
162
|
+
/** @internal */
|
|
163
|
+
protected setAbstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined): void;
|
|
147
164
|
}
|
|
148
165
|
/**
|
|
149
166
|
* Hackish approach that works like a "friend class" so we can access protected members without making them public.
|
|
@@ -151,9 +168,14 @@ export declare class RelationshipConstraint implements CustomAttributeContainerP
|
|
|
151
168
|
*/
|
|
152
169
|
export declare abstract class MutableRelationshipConstraint extends RelationshipConstraint {
|
|
153
170
|
abstract addCustomAttribute(customAttribute: CustomAttribute): void;
|
|
171
|
+
abstract setRoleLabel(roleLabel: string | undefined): void;
|
|
172
|
+
abstract setRelationshipEnd(relationshipEnd: RelationshipEnd): void;
|
|
173
|
+
abstract setPolymorphic(polymorphic: boolean): void;
|
|
174
|
+
abstract setMultiplicity(multiplicity: RelationshipMultiplicity): void;
|
|
175
|
+
abstract setAbstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined): void;
|
|
154
176
|
}
|
|
155
177
|
/**
|
|
156
|
-
* @
|
|
178
|
+
* @public @preview
|
|
157
179
|
*/
|
|
158
180
|
export declare class RelationshipMultiplicity {
|
|
159
181
|
static readonly zeroOne: RelationshipMultiplicity;
|
|
@@ -162,6 +184,7 @@ export declare class RelationshipMultiplicity {
|
|
|
162
184
|
static readonly oneMany: RelationshipMultiplicity;
|
|
163
185
|
readonly lowerLimit: number;
|
|
164
186
|
readonly upperLimit: number;
|
|
187
|
+
/** @internal */
|
|
165
188
|
constructor(lowerLimit: number, upperLimit: number);
|
|
166
189
|
static fromString(str: string): RelationshipMultiplicity | undefined;
|
|
167
190
|
equals(rhs: RelationshipMultiplicity): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationshipClass.d.ts","sourceRoot":"","sources":["../../../src/Metadata/RelationshipClass.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAEnG,OAAO,EACL,eAAe,EAAyC,eAAe,EAAE,cAAc,EAAE,iBAAiB,EACxF,YAAY,EAC/B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,qCAAqC,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,6BAA6B,EAAE,kBAAkB,EAA6B,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"RelationshipClass.d.ts","sourceRoot":"","sources":["../../../src/Metadata/RelationshipClass.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAEnG,OAAO,EACL,eAAe,EAAyC,eAAe,EAAE,cAAc,EAAE,iBAAiB,EACxF,YAAY,EAC/B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,qCAAqC,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,6BAA6B,EAAE,kBAAkB,EAA6B,MAAM,mBAAmB,CAAC;AAGlI,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,OAAO;IAC5C,SAAyB,cAAc,iBAAoC;IAC3E,gBAAgB;IAChB,WAA2B,cAAc,mBAA+C;IACxF,gBAAgB;IAChB,SAAS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} from "../DelayedPromise";
|
|
|
9
9
|
import { SchemaReadHelper } from "../Deserialization/Helper";
|
|
10
10
|
import { XmlSerializationUtils } from "../Deserialization/XmlSerializationUtils";
|
|
11
11
|
import { parseStrength, parseStrengthDirection, RelationshipEnd, SchemaItemType, StrengthDirection, strengthDirectionToString, strengthToString, StrengthType, } from "../ECObjects";
|
|
12
|
-
import {
|
|
12
|
+
import { ECSchemaError, ECSchemaStatus } from "../Exception";
|
|
13
13
|
import { ECClass } from "./Class";
|
|
14
14
|
import { serializeCustomAttributes } from "./CustomAttribute";
|
|
15
15
|
import { createNavigationProperty, createNavigationPropertySync, EntityClass } from "./EntityClass";
|
|
@@ -17,15 +17,21 @@ import { Mixin } from "./Mixin";
|
|
|
17
17
|
import { SchemaItem } from "./SchemaItem";
|
|
18
18
|
/**
|
|
19
19
|
* A Typescript class representation of a ECRelationshipClass.
|
|
20
|
-
* @
|
|
20
|
+
* @public @preview
|
|
21
21
|
*/
|
|
22
22
|
export class RelationshipClass extends ECClass {
|
|
23
23
|
schemaItemType = RelationshipClass.schemaItemType;
|
|
24
|
+
/** @internal */
|
|
24
25
|
static get schemaItemType() { return SchemaItemType.RelationshipClass; }
|
|
26
|
+
/** @internal */
|
|
25
27
|
_strength;
|
|
28
|
+
/** @internal */
|
|
26
29
|
_strengthDirection;
|
|
30
|
+
/** @internal */
|
|
27
31
|
_source;
|
|
32
|
+
/** @internal */
|
|
28
33
|
_target;
|
|
34
|
+
/** @internal */
|
|
29
35
|
constructor(schema, name, modifier) {
|
|
30
36
|
super(schema, name, modifier);
|
|
31
37
|
this._strengthDirection = StrengthDirection.Forward;
|
|
@@ -42,33 +48,35 @@ export class RelationshipClass extends ECClass {
|
|
|
42
48
|
* @param name
|
|
43
49
|
* @param relationship
|
|
44
50
|
* @param direction
|
|
51
|
+
* @internal
|
|
45
52
|
*/
|
|
46
53
|
async createNavigationProperty(name, relationship, direction) {
|
|
47
54
|
return this.addProperty(await createNavigationProperty(this, name, relationship, direction));
|
|
48
55
|
}
|
|
56
|
+
/** @internal */
|
|
49
57
|
createNavigationPropertySync(name, relationship, direction) {
|
|
50
58
|
return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));
|
|
51
59
|
}
|
|
52
60
|
/**
|
|
53
|
-
* @
|
|
61
|
+
* @internal Used for schema editing.
|
|
54
62
|
*/
|
|
55
63
|
setStrength(strength) {
|
|
56
64
|
this._strength = strength;
|
|
57
65
|
}
|
|
58
66
|
/**
|
|
59
|
-
* @
|
|
67
|
+
* @internal Used for schema editing.
|
|
60
68
|
*/
|
|
61
69
|
setStrengthDirection(direction) {
|
|
62
70
|
this._strengthDirection = direction;
|
|
63
71
|
}
|
|
64
72
|
/**
|
|
65
|
-
* @
|
|
73
|
+
* @internal Used for schema editing.
|
|
66
74
|
*/
|
|
67
75
|
setSourceConstraint(source) {
|
|
68
76
|
this._source = source;
|
|
69
77
|
}
|
|
70
78
|
/**
|
|
71
|
-
* @
|
|
79
|
+
* @internal Used for schema editing.
|
|
72
80
|
*/
|
|
73
81
|
setTargetConstraint(target) {
|
|
74
82
|
this._target = target;
|
|
@@ -102,11 +110,11 @@ export class RelationshipClass extends ECClass {
|
|
|
102
110
|
if (SchemaReadHelper.isECSpecVersionNewer({ readVersion: relationshipClassProps.originalECSpecMajorVersion, writeVersion: relationshipClassProps.originalECSpecMinorVersion }))
|
|
103
111
|
strength = StrengthType.Referencing;
|
|
104
112
|
else
|
|
105
|
-
throw new
|
|
113
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strength' attribute. '${relationshipClassProps.strength}' is not a valid StrengthType.`);
|
|
106
114
|
}
|
|
107
115
|
const strengthDirection = parseStrengthDirection(relationshipClassProps.strengthDirection);
|
|
108
116
|
if (undefined === strengthDirection)
|
|
109
|
-
throw new
|
|
117
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strengthDirection' attribute. '${relationshipClassProps.strengthDirection}' is not a valid StrengthDirection.`);
|
|
110
118
|
this._strength = strength;
|
|
111
119
|
this._strengthDirection = strengthDirection;
|
|
112
120
|
}
|
|
@@ -127,15 +135,16 @@ export class RelationshipClass extends ECClass {
|
|
|
127
135
|
* Type assertion to check if the SchemaItem is of type RelationshipClass.
|
|
128
136
|
* @param item The SchemaItem to check.
|
|
129
137
|
* @returns The item cast to RelationshipClass if it is a RelationshipClass, undefined otherwise.
|
|
138
|
+
* @internal
|
|
130
139
|
*/
|
|
131
140
|
static assertIsRelationshipClass(item) {
|
|
132
141
|
if (!this.isRelationshipClass(item))
|
|
133
|
-
throw new
|
|
142
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.RelationshipClass}' (RelationshipClass)`);
|
|
134
143
|
}
|
|
135
144
|
}
|
|
136
145
|
/**
|
|
137
146
|
* A Typescript class representation of a ECRelationshipConstraint.
|
|
138
|
-
* @
|
|
147
|
+
* @public @preview
|
|
139
148
|
*/
|
|
140
149
|
export class RelationshipConstraint {
|
|
141
150
|
_abstractConstraint;
|
|
@@ -146,6 +155,7 @@ export class RelationshipConstraint {
|
|
|
146
155
|
_roleLabel;
|
|
147
156
|
_constraintClasses;
|
|
148
157
|
_customAttributes;
|
|
158
|
+
/** @internal */
|
|
149
159
|
constructor(relClass, relEnd, roleLabel, polymorphic) {
|
|
150
160
|
this._relationshipEnd = relEnd;
|
|
151
161
|
if (polymorphic)
|
|
@@ -157,23 +167,11 @@ export class RelationshipConstraint {
|
|
|
157
167
|
this._roleLabel = roleLabel;
|
|
158
168
|
}
|
|
159
169
|
get multiplicity() { return this._multiplicity ?? RelationshipMultiplicity.zeroOne; }
|
|
160
|
-
set multiplicity(multiplicity) {
|
|
161
|
-
this._multiplicity = multiplicity;
|
|
162
|
-
}
|
|
163
170
|
get polymorphic() { return this._polymorphic ?? false; }
|
|
164
|
-
set polymorphic(polymorphic) {
|
|
165
|
-
this._polymorphic = polymorphic;
|
|
166
|
-
}
|
|
167
171
|
get roleLabel() { return this._roleLabel; }
|
|
168
|
-
set roleLabel(roleLabel) {
|
|
169
|
-
this._roleLabel = roleLabel;
|
|
170
|
-
}
|
|
171
172
|
get constraintClasses() { return this._constraintClasses; }
|
|
172
173
|
get relationshipClass() { return this._relationshipClass; }
|
|
173
174
|
get relationshipEnd() { return this._relationshipEnd; }
|
|
174
|
-
set relationshipEnd(relationshipEnd) {
|
|
175
|
-
this._relationshipEnd = relationshipEnd;
|
|
176
|
-
}
|
|
177
175
|
get customAttributes() { return this._customAttributes; }
|
|
178
176
|
/** Returns the constraint name, ie. 'RelationshipName.Source/Target' */
|
|
179
177
|
get fullName() { return `${this._relationshipClass.name}:${this.isSource ? "Source" : "Target"}`; }
|
|
@@ -186,9 +184,6 @@ export class RelationshipConstraint {
|
|
|
186
184
|
return this.constraintClasses[0];
|
|
187
185
|
return this._abstractConstraint;
|
|
188
186
|
}
|
|
189
|
-
set abstractConstraint(abstractConstraint) {
|
|
190
|
-
this._abstractConstraint = abstractConstraint;
|
|
191
|
-
}
|
|
192
187
|
/**
|
|
193
188
|
* True if this RelationshipConstraint is the Source relationship end.
|
|
194
189
|
*/
|
|
@@ -196,18 +191,21 @@ export class RelationshipConstraint {
|
|
|
196
191
|
/**
|
|
197
192
|
* Adds the provided class as a constraint class to this constraint.
|
|
198
193
|
* @param constraint The class to add as a constraint class.
|
|
199
|
-
|
|
194
|
+
* @internal
|
|
195
|
+
*/
|
|
200
196
|
addClass(constraint) {
|
|
201
197
|
// TODO: Ensure we don't start mixing constraint class types
|
|
202
198
|
// TODO: Check that this class is or subclasses abstract constraint?
|
|
203
199
|
if (!this._constraintClasses)
|
|
204
200
|
this._constraintClasses = [];
|
|
205
201
|
// TODO: Handle relationship constraints
|
|
206
|
-
this._constraintClasses.push(
|
|
202
|
+
this._constraintClasses.push(constraint);
|
|
207
203
|
}
|
|
208
204
|
/**
|
|
209
205
|
* Removes the provided class as a constraint class from this constraint.
|
|
210
206
|
* @param constraint The class to add as a constraint class.
|
|
207
|
+
*
|
|
208
|
+
* @internal
|
|
211
209
|
*/
|
|
212
210
|
removeClass(constraint) {
|
|
213
211
|
if (undefined === this._constraintClasses)
|
|
@@ -275,31 +273,31 @@ export class RelationshipConstraint {
|
|
|
275
273
|
this._polymorphic = relationshipConstraintProps.polymorphic;
|
|
276
274
|
const parsedMultiplicity = RelationshipMultiplicity.fromString(relationshipConstraintProps.multiplicity);
|
|
277
275
|
if (!parsedMultiplicity)
|
|
278
|
-
throw new
|
|
276
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidMultiplicity, ``);
|
|
279
277
|
this._multiplicity = parsedMultiplicity;
|
|
280
278
|
const relClassSchema = this.relationshipClass.schema;
|
|
281
279
|
if (undefined !== relationshipConstraintProps.abstractConstraint) {
|
|
282
280
|
const abstractConstraintSchemaItemKey = relClassSchema.getSchemaItemKey(relationshipConstraintProps.abstractConstraint);
|
|
283
281
|
if (!abstractConstraintSchemaItemKey)
|
|
284
|
-
throw new
|
|
285
|
-
this.
|
|
282
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);
|
|
283
|
+
this.setAbstractConstraint(new DelayedPromiseWithProps(abstractConstraintSchemaItemKey, async () => {
|
|
286
284
|
const tempAbstractConstraint = await relClassSchema.lookupItem(relationshipConstraintProps.abstractConstraint);
|
|
287
285
|
if (undefined === tempAbstractConstraint ||
|
|
288
286
|
(!EntityClass.isEntityClass(tempAbstractConstraint) && !Mixin.isMixin(tempAbstractConstraint) && !RelationshipClass.isRelationshipClass(tempAbstractConstraint)))
|
|
289
|
-
throw new
|
|
287
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);
|
|
290
288
|
return tempAbstractConstraint;
|
|
291
|
-
});
|
|
289
|
+
}));
|
|
292
290
|
}
|
|
293
291
|
const loadEachConstraint = (constraintClassName) => {
|
|
294
292
|
const tempConstraintClass = relClassSchema.lookupItemSync(constraintClassName);
|
|
295
293
|
if (!tempConstraintClass ||
|
|
296
294
|
(!EntityClass.isEntityClass(tempConstraintClass) && !Mixin.isMixin(tempConstraintClass) && !RelationshipClass.isRelationshipClass(tempConstraintClass)))
|
|
297
|
-
throw new
|
|
295
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);
|
|
298
296
|
return tempConstraintClass;
|
|
299
297
|
};
|
|
300
298
|
for (const constraintClassName of relationshipConstraintProps.constraintClasses) {
|
|
301
299
|
const constraintClass = loadEachConstraint(constraintClassName);
|
|
302
|
-
this.addClass(constraintClass);
|
|
300
|
+
this.addClass(new DelayedPromiseWithProps(constraintClass.key, async () => constraintClass));
|
|
303
301
|
}
|
|
304
302
|
}
|
|
305
303
|
async fromJSON(relationshipConstraintProps) {
|
|
@@ -361,11 +359,32 @@ export class RelationshipConstraint {
|
|
|
361
359
|
return relationshipConstraint !== undefined && relationshipConstraint.polymorphic !== undefined && relationshipConstraint.multiplicity !== undefined
|
|
362
360
|
&& relationshipConstraint.relationshipEnd !== undefined && relationshipConstraint._relationshipClass !== undefined;
|
|
363
361
|
}
|
|
362
|
+
/** @internal */
|
|
364
363
|
addCustomAttribute(customAttribute) {
|
|
365
364
|
if (!this._customAttributes)
|
|
366
365
|
this._customAttributes = new Map();
|
|
367
366
|
this._customAttributes.set(customAttribute.className, customAttribute);
|
|
368
367
|
}
|
|
368
|
+
/** @internal */
|
|
369
|
+
setRoleLabel(roleLabel) {
|
|
370
|
+
this._roleLabel = roleLabel;
|
|
371
|
+
}
|
|
372
|
+
/** @internal */
|
|
373
|
+
setRelationshipEnd(relationshipEnd) {
|
|
374
|
+
this._relationshipEnd = relationshipEnd;
|
|
375
|
+
}
|
|
376
|
+
/** @internal */
|
|
377
|
+
setPolymorphic(polymorphic) {
|
|
378
|
+
this._polymorphic = polymorphic;
|
|
379
|
+
}
|
|
380
|
+
/** @internal */
|
|
381
|
+
setMultiplicity(multiplicity) {
|
|
382
|
+
this._multiplicity = multiplicity;
|
|
383
|
+
}
|
|
384
|
+
/** @internal */
|
|
385
|
+
setAbstractConstraint(abstractConstraint) {
|
|
386
|
+
this._abstractConstraint = abstractConstraint;
|
|
387
|
+
}
|
|
369
388
|
}
|
|
370
389
|
/**
|
|
371
390
|
* Hackish approach that works like a "friend class" so we can access protected members without making them public.
|
|
@@ -375,7 +394,7 @@ export class MutableRelationshipConstraint extends RelationshipConstraint {
|
|
|
375
394
|
}
|
|
376
395
|
const INT32_MAX = 2147483647;
|
|
377
396
|
/**
|
|
378
|
-
* @
|
|
397
|
+
* @public @preview
|
|
379
398
|
*/
|
|
380
399
|
export class RelationshipMultiplicity {
|
|
381
400
|
static zeroOne = new RelationshipMultiplicity(0, 1);
|
|
@@ -384,6 +403,7 @@ export class RelationshipMultiplicity {
|
|
|
384
403
|
static oneMany = new RelationshipMultiplicity(1, INT32_MAX);
|
|
385
404
|
lowerLimit;
|
|
386
405
|
upperLimit;
|
|
406
|
+
/** @internal */
|
|
387
407
|
constructor(lowerLimit, upperLimit) {
|
|
388
408
|
this.lowerLimit = lowerLimit;
|
|
389
409
|
this.upperLimit = upperLimit;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationshipClass.js","sourceRoot":"","sources":["../../../src/Metadata/RelationshipClass.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAiB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EACY,aAAa,EAAE,sBAAsB,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,yBAAyB,EACrI,gBAAgB,EAAE,YAAY,GAC/B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE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GAAG,CAAC,UAAU,CAAC;IAClF,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC;IAC1F,CAAC;;AAGH;;;GAGG;AACH,MAAM,OAAgB,wBAAyB,SAAQ,iBAAiB;IACtE,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;IACtF,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;CAMvF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\nimport { RelationshipClassProps, RelationshipConstraintProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport {\n ECClassModifier, parseStrength, parseStrengthDirection, RelationshipEnd, SchemaItemType, StrengthDirection, strengthDirectionToString,\n strengthToString, StrengthType,\n} from \"../ECObjects\";\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\nimport { LazyLoadedRelationshipConstraintClass } from \"../Interfaces\";\nimport { SchemaItemKey } from \"../SchemaKey\";\nimport { ECClass } from \"./Class\";\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\nimport { createNavigationProperty, createNavigationPropertySync, EntityClass } from \"./EntityClass\";\nimport { Mixin } from \"./Mixin\";\nimport { NavigationProperty } from \"./Property\";\nimport { Schema } from \"./Schema\";\nimport { SchemaItem } from \"./SchemaItem\";\n\ntype AnyConstraintClass = EntityClass | Mixin | RelationshipClass;\n\n/**\n * A Typescript class representation of a ECRelationshipClass.\n * @beta\n */\nexport class RelationshipClass extends ECClass {\n public override readonly schemaItemType = RelationshipClass.schemaItemType;\n public static override get schemaItemType() { return SchemaItemType.RelationshipClass; }\n protected _strength: StrengthType;\n protected _strengthDirection: StrengthDirection;\n protected _source: RelationshipConstraint;\n protected _target: RelationshipConstraint;\n\n constructor(schema: Schema, name: string, modifier?: ECClassModifier) {\n super(schema, name, modifier);\n this._strengthDirection = StrengthDirection.Forward;\n this._strength = StrengthType.Referencing;\n this._source = new RelationshipConstraint(this, RelationshipEnd.Source);\n this._target = new RelationshipConstraint(this, RelationshipEnd.Target);\n }\n\n public get strength() { return this._strength; }\n public get strengthDirection() { return this._strengthDirection; }\n public get source() { return this._source; }\n public get target() { return this._target; }\n\n /**\n *\n * @param name\n * @param relationship\n * @param direction\n */\n protected async createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\n return this.addProperty(await createNavigationProperty(this, name, relationship, direction));\n }\n\n protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\n return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));\n }\n\n /**\n * @alpha Used for schema editing.\n */\n protected setStrength(strength: StrengthType) {\n this._strength = strength;\n }\n\n /**\n * @alpha Used for schema editing.\n */\n protected setStrengthDirection(direction: StrengthDirection) {\n this._strengthDirection = direction;\n }\n\n /**\n * @alpha Used for schema editing.\n */\n protected setSourceConstraint(source: RelationshipConstraint) {\n this._source = source;\n }\n\n /**\n * @alpha Used for schema editing.\n */\n protected setTargetConstraint(target: RelationshipConstraint) {\n this._target = target;\n }\n /**\n * Save this RelationshipClass's properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): RelationshipClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.strength = strengthToString(this.strength);\n schemaJson.strengthDirection = strengthDirectionToString(this.strengthDirection);\n schemaJson.source = this.source.toJSON();\n schemaJson.target = this.target.toJSON();\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n itemElement.setAttribute(\"strength\", strengthToString(this.strength));\n itemElement.setAttribute(\"strengthDirection\", strengthDirectionToString(this.strengthDirection));\n itemElement.appendChild(await this.source.toXml(schemaXml));\n itemElement.appendChild(await this.target.toXml(schemaXml));\n return itemElement;\n }\n\n public override fromJSONSync(relationshipClassProps: RelationshipClassProps) {\n super.fromJSONSync(relationshipClassProps);\n\n let strength = parseStrength(relationshipClassProps.strength);\n if (undefined === strength) {\n if (SchemaReadHelper.isECSpecVersionNewer({ readVersion: relationshipClassProps.originalECSpecMajorVersion, writeVersion: relationshipClassProps.originalECSpecMinorVersion } as ECSpecVersion))\n strength = StrengthType.Referencing;\n else\n throw new ECObjectsError(ECObjectsStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strength' attribute. '${relationshipClassProps.strength}' is not a valid StrengthType.`);\n }\n\n const strengthDirection = parseStrengthDirection(relationshipClassProps.strengthDirection);\n if (undefined === strengthDirection)\n throw new ECObjectsError(ECObjectsStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strengthDirection' attribute. '${relationshipClassProps.strengthDirection}' is not a valid StrengthDirection.`);\n\n this._strength = strength;\n this._strengthDirection = strengthDirection;\n }\n\n public override async fromJSON(relationshipClassProps: RelationshipClassProps) {\n this.fromJSONSync(relationshipClassProps);\n }\n\n /**\n * Type guard to check if the SchemaItem is of type RelationshipClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is a RelationshipClass, false otherwise.\n */\n public static isRelationshipClass(item?: SchemaItem): item is RelationshipClass {\n if (item && item.schemaItemType === SchemaItemType.RelationshipClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type RelationshipClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to RelationshipClass if it is a RelationshipClass, undefined otherwise.\n */\n public static assertIsRelationshipClass(item?: SchemaItem): asserts item is RelationshipClass {\n if (!this.isRelationshipClass(item))\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.RelationshipClass}' (RelationshipClass)`);\n }\n}\n\n/**\n * A Typescript class representation of a ECRelationshipConstraint.\n * @beta\n */\nexport class RelationshipConstraint implements CustomAttributeContainerProps {\n protected _abstractConstraint?: LazyLoadedRelationshipConstraintClass;\n protected _relationshipClass: RelationshipClass;\n protected _relationshipEnd: RelationshipEnd;\n protected _multiplicity?: RelationshipMultiplicity;\n protected _polymorphic?: boolean;\n protected _roleLabel?: string;\n protected _constraintClasses?: LazyLoadedRelationshipConstraintClass[];\n private _customAttributes?: Map<string, CustomAttribute>;\n\n constructor(relClass: RelationshipClass, relEnd: RelationshipEnd, roleLabel?: string, polymorphic?: boolean) {\n this._relationshipEnd = relEnd;\n if (polymorphic)\n this._polymorphic = polymorphic;\n else\n this._polymorphic = false;\n\n this._multiplicity = RelationshipMultiplicity.zeroOne;\n this._relationshipClass = relClass;\n this._roleLabel = roleLabel;\n }\n\n public get multiplicity() { return this._multiplicity ?? RelationshipMultiplicity.zeroOne; }\n protected set multiplicity(multiplicity: RelationshipMultiplicity) {\n this._multiplicity = multiplicity;\n }\n\n public get polymorphic() { return this._polymorphic ?? false; }\n protected set polymorphic(polymorphic: boolean) {\n this._polymorphic = polymorphic;\n }\n\n public get roleLabel() { return this._roleLabel; }\n protected set roleLabel(roleLabel: string | undefined) {\n this._roleLabel = roleLabel;\n }\n\n public get constraintClasses(): LazyLoadedRelationshipConstraintClass[] | undefined { return this._constraintClasses; }\n\n public get relationshipClass() { return this._relationshipClass; }\n\n public get relationshipEnd() { return this._relationshipEnd; }\n protected set relationshipEnd(relationshipEnd: RelationshipEnd) {\n this._relationshipEnd = relationshipEnd;\n }\n\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\n\n /** Returns the constraint name, ie. 'RelationshipName.Source/Target' */\n public get fullName() { return `${this._relationshipClass.name}:${this.isSource ? \"Source\" : \"Target\"}`; }\n\n /** Returns the schema of the RelationshipClass. */\n public get schema(): Schema { return this._relationshipClass.schema; }\n\n public get abstractConstraint(): LazyLoadedRelationshipConstraintClass | undefined {\n if (this._abstractConstraint)\n return this._abstractConstraint;\n\n if (this.constraintClasses && this.constraintClasses.length === 1)\n return this.constraintClasses[0];\n\n return this._abstractConstraint;\n }\n\n public set abstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined) {\n this._abstractConstraint = abstractConstraint;\n }\n\n /**\n * True if this RelationshipConstraint is the Source relationship end.\n */\n public get isSource(): boolean { return this.relationshipEnd === RelationshipEnd.Source; }\n\n /**\n * Adds the provided class as a constraint class to this constraint.\n * @param constraint The class to add as a constraint class.\n */\n public addClass(constraint: EntityClass | Mixin | RelationshipClass): void {\n // TODO: Ensure we don't start mixing constraint class types\n // TODO: Check that this class is or subclasses abstract constraint?\n\n if (!this._constraintClasses)\n this._constraintClasses = [];\n\n // TODO: Handle relationship constraints\n this._constraintClasses.push(new DelayedPromiseWithProps(constraint.key, async () => constraint));\n }\n\n /**\n * Removes the provided class as a constraint class from this constraint.\n * @param constraint The class to add as a constraint class.\n */\n protected removeClass(constraint: EntityClass | Mixin | RelationshipClass): void {\n if (undefined === this._constraintClasses)\n return;\n\n this._constraintClasses.forEach((item, index) => {\n const constraintName = item.fullName;\n if (constraintName === constraint.fullName)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._constraintClasses?.splice(index, 1);\n });\n }\n\n /**\n * Save this RelationshipConstraint's properties to an object for serializing to JSON.\n */\n public toJSON(): RelationshipConstraintProps {\n const schemaJson: { [value: string]: any } = {};\n schemaJson.multiplicity = this.multiplicity.toString();\n schemaJson.roleLabel = this.roleLabel;\n schemaJson.polymorphic = this.polymorphic;\n if (undefined !== this._abstractConstraint)\n schemaJson.abstractConstraint = this._abstractConstraint.fullName;\n if (undefined !== this.constraintClasses && this.constraintClasses.length > 0)\n schemaJson.constraintClasses = this.constraintClasses.map((constraintClass) => constraintClass.fullName);\n\n const customAttributes = serializeCustomAttributes(this.customAttributes);\n if (undefined !== customAttributes)\n schemaJson.customAttributes = customAttributes;\n return schemaJson as RelationshipConstraintProps;\n }\n\n /** @internal */\n public async toXml(schemaXml: Document): Promise<Element> {\n const elementName = this.isSource ? \"Source\" : \"Target\";\n const itemElement = schemaXml.createElement(elementName);\n if (undefined !== this.polymorphic)\n itemElement.setAttribute(\"polymorphic\", this.polymorphic.toString());\n if (undefined !== this.roleLabel)\n itemElement.setAttribute(\"roleLabel\", this.roleLabel);\n if (undefined !== this.multiplicity)\n itemElement.setAttribute(\"multiplicity\", this.multiplicity.toString());\n\n const abstractConstraint = await this.abstractConstraint;\n if (undefined !== abstractConstraint) {\n const abstractConstraintName = XmlSerializationUtils.createXmlTypedName(this.schema, abstractConstraint.schema, abstractConstraint.name);\n itemElement.setAttribute(\"abstractConstraint\", abstractConstraintName);\n }\n\n if (undefined !== this.constraintClasses) {\n for (const item of this.constraintClasses) {\n const constraintClass = await item;\n const classElement = schemaXml.createElement(\"Class\");\n const constraintClassName = XmlSerializationUtils.createXmlTypedName(this.schema, constraintClass.schema, constraintClass.name);\n classElement.setAttribute(\"class\", constraintClassName);\n itemElement.appendChild(classElement);\n }\n }\n\n if (this._customAttributes) {\n const caContainerElement = schemaXml.createElement(\"ECCustomAttributes\");\n for (const [name, attribute] of this._customAttributes) {\n const caElement = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this.schema);\n caContainerElement.appendChild(caElement);\n }\n itemElement.appendChild(caContainerElement);\n }\n\n return itemElement;\n }\n\n public fromJSONSync(relationshipConstraintProps: RelationshipConstraintProps) {\n\n this._roleLabel = relationshipConstraintProps.roleLabel;\n this._polymorphic = relationshipConstraintProps.polymorphic;\n\n const parsedMultiplicity = RelationshipMultiplicity.fromString(relationshipConstraintProps.multiplicity);\n if (!parsedMultiplicity)\n throw new ECObjectsError(ECObjectsStatus.InvalidMultiplicity, ``);\n this._multiplicity = parsedMultiplicity;\n\n const relClassSchema = this.relationshipClass.schema;\n\n if (undefined !== relationshipConstraintProps.abstractConstraint) {\n const abstractConstraintSchemaItemKey = relClassSchema.getSchemaItemKey(relationshipConstraintProps.abstractConstraint);\n if (!abstractConstraintSchemaItemKey)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);\n this.abstractConstraint = new DelayedPromiseWithProps<SchemaItemKey, AnyConstraintClass>(abstractConstraintSchemaItemKey,\n async () => {\n const tempAbstractConstraint = await relClassSchema.lookupItem(relationshipConstraintProps.abstractConstraint!);\n if (undefined === tempAbstractConstraint ||\n (!EntityClass.isEntityClass(tempAbstractConstraint) && !Mixin.isMixin(tempAbstractConstraint) && !RelationshipClass.isRelationshipClass(tempAbstractConstraint)))\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);\n\n return tempAbstractConstraint;\n });\n }\n\n const loadEachConstraint = (constraintClassName: any) => {\n const tempConstraintClass = relClassSchema.lookupItemSync(constraintClassName);\n if (!tempConstraintClass ||\n (!EntityClass.isEntityClass(tempConstraintClass) && !Mixin.isMixin(tempConstraintClass) && !RelationshipClass.isRelationshipClass(tempConstraintClass)))\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, ``);\n return tempConstraintClass;\n };\n\n for (const constraintClassName of relationshipConstraintProps.constraintClasses) {\n const constraintClass = loadEachConstraint(constraintClassName);\n this.addClass(constraintClass);\n }\n }\n\n public async fromJSON(relationshipConstraintProps: RelationshipConstraintProps) {\n this.fromJSONSync(relationshipConstraintProps);\n }\n\n /**\n * Indicates if the provided [[ECClass]] is supported by this [[RelationshipConstraint]].\n * @param ecClass The class to check.\n */\n public async supportsClass(ecClass: ECClass): Promise<boolean> {\n if (!this.constraintClasses) {\n if (this.relationshipClass.baseClass) {\n const baseRelationship = await this.relationshipClass.baseClass as RelationshipClass;\n const baseConstraint = this.isSource ? baseRelationship.source : baseRelationship.target;\n return baseConstraint.supportsClass(ecClass);\n }\n return false;\n }\n\n if (ecClass.schemaItemType !== SchemaItemType.EntityClass && ecClass.schemaItemType !== SchemaItemType.RelationshipClass &&\n ecClass.schemaItemType !== SchemaItemType.Mixin) {\n return false;\n }\n\n const abstractConstraint = await this.abstractConstraint;\n\n if (abstractConstraint && await RelationshipConstraint.classCompatibleWithConstraint(abstractConstraint, ecClass, this.polymorphic || false))\n return true;\n\n for (const constraint of this.constraintClasses) {\n if (await RelationshipConstraint.classCompatibleWithConstraint(await constraint, ecClass, this.polymorphic || false))\n return true;\n }\n\n return false;\n }\n\n /**\n * Indicates if an ECClass is of the type or applies to the type (if a mixin) of the ECClass specified by the constraintClass parameter.\n * @param constraintClass The ECClass that is a constraint class of a relationship.\n * @param testClass The ECClass to check against the constraint class.\n * @param isPolymorphic Indicates if the testClass should be checked polymorphically.\n */\n public static async classCompatibleWithConstraint(constraintClass: ECClass, testClass: ECClass, isPolymorphic: boolean): Promise<boolean> {\n if (SchemaItem.equalByKey(constraintClass, testClass))\n return true;\n\n if (isPolymorphic) {\n if (testClass.schemaItemType === SchemaItemType.EntityClass || testClass.schemaItemType === SchemaItemType.RelationshipClass) {\n return testClass.is(constraintClass);\n }\n\n if (testClass.schemaItemType === SchemaItemType.Mixin) {\n if (constraintClass.schemaItemType === SchemaItemType.EntityClass)\n return (testClass as Mixin).applicableTo(constraintClass as EntityClass);\n else\n return testClass.is(constraintClass);\n }\n }\n return false;\n }\n\n /**\n * @internal\n */\n public static isRelationshipConstraint(object: any): object is RelationshipConstraint {\n const relationshipConstraint = object as RelationshipConstraint;\n\n return relationshipConstraint !== undefined && relationshipConstraint.polymorphic !== undefined && relationshipConstraint.multiplicity !== undefined\n && relationshipConstraint.relationshipEnd !== undefined && relationshipConstraint._relationshipClass !== undefined;\n }\n\n protected addCustomAttribute(customAttribute: CustomAttribute) {\n if (!this._customAttributes)\n this._customAttributes = new Map<string, CustomAttribute>();\n\n this._customAttributes.set(customAttribute.className, customAttribute);\n }\n\n}\n\n/**\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\n * @internal\n */\nexport abstract class MutableRelationshipConstraint extends RelationshipConstraint {\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\n\n}\n\nconst INT32_MAX = 2147483647;\n\n/**\n * @beta\n */\nexport class RelationshipMultiplicity {\n public static readonly zeroOne = new RelationshipMultiplicity(0, 1);\n public static readonly zeroMany = new RelationshipMultiplicity(0, INT32_MAX);\n public static readonly oneOne = new RelationshipMultiplicity(1, 1);\n public static readonly oneMany = new RelationshipMultiplicity(1, INT32_MAX);\n\n public readonly lowerLimit: number;\n public readonly upperLimit: number;\n\n constructor(lowerLimit: number, upperLimit: number) {\n this.lowerLimit = lowerLimit;\n this.upperLimit = upperLimit;\n }\n\n public static fromString(str: string): RelationshipMultiplicity | undefined {\n const matches = /^\\(([0-9]*)\\.\\.([0-9]*|\\*)\\)$/.exec(str);\n if (matches === null || matches.length !== 3)\n return undefined;\n\n const lowerLimit = parseInt(matches[1], 10);\n const upperLimit = matches[2] === \"*\" ? INT32_MAX : parseInt(matches[2], 10);\n if (0 === lowerLimit && 1 === upperLimit)\n return RelationshipMultiplicity.zeroOne;\n else if (0 === lowerLimit && INT32_MAX === upperLimit)\n return RelationshipMultiplicity.zeroMany;\n else if (1 === lowerLimit && 1 === upperLimit)\n return RelationshipMultiplicity.oneOne;\n else if (1 === lowerLimit && INT32_MAX === upperLimit)\n return RelationshipMultiplicity.oneMany;\n\n return new RelationshipMultiplicity(lowerLimit, upperLimit);\n }\n\n public equals(rhs: RelationshipMultiplicity): boolean {\n return this.lowerLimit === rhs.lowerLimit && this.upperLimit === rhs.upperLimit;\n }\n\n public toString(): string {\n return `(${this.lowerLimit}..${this.upperLimit === INT32_MAX ? \"*\" : this.upperLimit})`;\n }\n}\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableRelationshipClass extends RelationshipClass {\n public override get source() { return this._source as MutableRelationshipConstraint; }\n public override get target() { return this._target as MutableRelationshipConstraint; }\n public abstract override setStrength(strength: StrengthType): void;\n public abstract override setStrengthDirection(direction: StrengthDirection): void;\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RelationshipClass.js","sourceRoot":"","sources":["../../../src/Metadata/RelationshipClass.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAiB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EACY,aAAa,EAAE,sBAAsB,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,yBAAyB,EACrI,gBAAgB,EAAE,YAAY,GAC/B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG7D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAsE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAClI,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C;;;GAGG;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C,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC;IAC1F,CAAC;;AAGH;;;GAGG;AACH,MAAM,OAAgB,wBAAyB,SAAQ,iBAAiB;IACtE,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;IACtF,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;CAMvF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Metadata\r\n */\r\n\r\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\r\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\r\nimport { RelationshipClassProps, RelationshipConstraintProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport {\r\n ECClassModifier, parseStrength, parseStrengthDirection, RelationshipEnd, SchemaItemType, StrengthDirection, strengthDirectionToString,\r\n strengthToString, StrengthType,\r\n} from \"../ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\r\nimport { LazyLoadedRelationshipConstraintClass } from \"../Interfaces\";\r\nimport { SchemaItemKey } from \"../SchemaKey\";\r\nimport { ECClass } from \"./Class\";\r\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\r\nimport { createNavigationProperty, createNavigationPropertySync, EntityClass } from \"./EntityClass\";\r\nimport { Mixin } from \"./Mixin\";\r\nimport { NavigationProperty } from \"./Property\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\n\r\ntype AnyConstraintClass = EntityClass | Mixin | RelationshipClass;\r\n\r\n/**\r\n * A Typescript class representation of a ECRelationshipClass.\r\n * @public @preview\r\n */\r\nexport class RelationshipClass extends ECClass {\r\n public override readonly schemaItemType = RelationshipClass.schemaItemType;\r\n /** @internal */\r\n public static override get schemaItemType() { return SchemaItemType.RelationshipClass; }\r\n /** @internal */\r\n protected _strength: StrengthType;\r\n /** @internal */\r\n protected _strengthDirection: StrengthDirection;\r\n /** @internal */\r\n protected _source: RelationshipConstraint;\r\n /** @internal */\r\n protected _target: RelationshipConstraint;\r\n\r\n /** @internal */\r\n constructor(schema: Schema, name: string, modifier?: ECClassModifier) {\r\n super(schema, name, modifier);\r\n this._strengthDirection = StrengthDirection.Forward;\r\n this._strength = StrengthType.Referencing;\r\n this._source = new RelationshipConstraint(this, RelationshipEnd.Source);\r\n this._target = new RelationshipConstraint(this, RelationshipEnd.Target);\r\n }\r\n\r\n public get strength() { return this._strength; }\r\n public get strengthDirection() { return this._strengthDirection; }\r\n public get source() { return this._source; }\r\n public get target() { return this._target; }\r\n\r\n /**\r\n *\r\n * @param name\r\n * @param relationship\r\n * @param direction\r\n * @internal\r\n */\r\n protected async createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\r\n return this.addProperty(await createNavigationProperty(this, name, relationship, direction));\r\n }\r\n\r\n /** @internal */\r\n protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\r\n return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));\r\n }\r\n\r\n /**\r\n * @internal Used for schema editing.\r\n */\r\n protected setStrength(strength: StrengthType) {\r\n this._strength = strength;\r\n }\r\n\r\n /**\r\n * @internal Used for schema editing.\r\n */\r\n protected setStrengthDirection(direction: StrengthDirection) {\r\n this._strengthDirection = direction;\r\n }\r\n\r\n /**\r\n * @internal Used for schema editing.\r\n */\r\n protected setSourceConstraint(source: RelationshipConstraint) {\r\n this._source = source;\r\n }\r\n\r\n /**\r\n * @internal Used for schema editing.\r\n */\r\n protected setTargetConstraint(target: RelationshipConstraint) {\r\n this._target = target;\r\n }\r\n /**\r\n * Save this RelationshipClass's properties to an object for serializing to JSON.\r\n * @param standalone Serialization includes only this object (as opposed to the full schema).\r\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\r\n */\r\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): RelationshipClassProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n schemaJson.strength = strengthToString(this.strength);\r\n schemaJson.strengthDirection = strengthDirectionToString(this.strengthDirection);\r\n schemaJson.source = this.source.toJSON();\r\n schemaJson.target = this.target.toJSON();\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n itemElement.setAttribute(\"strength\", strengthToString(this.strength));\r\n itemElement.setAttribute(\"strengthDirection\", strengthDirectionToString(this.strengthDirection));\r\n itemElement.appendChild(await this.source.toXml(schemaXml));\r\n itemElement.appendChild(await this.target.toXml(schemaXml));\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(relationshipClassProps: RelationshipClassProps) {\r\n super.fromJSONSync(relationshipClassProps);\r\n\r\n let strength = parseStrength(relationshipClassProps.strength);\r\n if (undefined === strength) {\r\n if (SchemaReadHelper.isECSpecVersionNewer({ readVersion: relationshipClassProps.originalECSpecMajorVersion, writeVersion: relationshipClassProps.originalECSpecMinorVersion } as ECSpecVersion))\r\n strength = StrengthType.Referencing;\r\n else\r\n throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strength' attribute. '${relationshipClassProps.strength}' is not a valid StrengthType.`);\r\n }\r\n\r\n const strengthDirection = parseStrengthDirection(relationshipClassProps.strengthDirection);\r\n if (undefined === strengthDirection)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strengthDirection' attribute. '${relationshipClassProps.strengthDirection}' is not a valid StrengthDirection.`);\r\n\r\n this._strength = strength;\r\n this._strengthDirection = strengthDirection;\r\n }\r\n\r\n public override async fromJSON(relationshipClassProps: RelationshipClassProps) {\r\n this.fromJSONSync(relationshipClassProps);\r\n }\r\n\r\n /**\r\n * Type guard to check if the SchemaItem is of type RelationshipClass.\r\n * @param item The SchemaItem to check.\r\n * @returns True if the item is a RelationshipClass, false otherwise.\r\n */\r\n public static isRelationshipClass(item?: SchemaItem): item is RelationshipClass {\r\n if (item && item.schemaItemType === SchemaItemType.RelationshipClass)\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Type assertion to check if the SchemaItem is of type RelationshipClass.\r\n * @param item The SchemaItem to check.\r\n * @returns The item cast to RelationshipClass if it is a RelationshipClass, undefined otherwise.\r\n * @internal\r\n */\r\n public static assertIsRelationshipClass(item?: SchemaItem): asserts item is RelationshipClass {\r\n if (!this.isRelationshipClass(item))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.RelationshipClass}' (RelationshipClass)`);\r\n }\r\n}\r\n\r\n/**\r\n * A Typescript class representation of a ECRelationshipConstraint.\r\n * @public @preview\r\n */\r\nexport class RelationshipConstraint implements CustomAttributeContainerProps {\r\n private _abstractConstraint?: LazyLoadedRelationshipConstraintClass;\r\n private _relationshipClass: RelationshipClass;\r\n private _relationshipEnd: RelationshipEnd;\r\n private _multiplicity?: RelationshipMultiplicity;\r\n private _polymorphic?: boolean;\r\n private _roleLabel?: string;\r\n private _constraintClasses?: LazyLoadedRelationshipConstraintClass[];\r\n private _customAttributes?: Map<string, CustomAttribute>;\r\n\r\n /** @internal */\r\n constructor(relClass: RelationshipClass, relEnd: RelationshipEnd, roleLabel?: string, polymorphic?: boolean) {\r\n this._relationshipEnd = relEnd;\r\n if (polymorphic)\r\n this._polymorphic = polymorphic;\r\n else\r\n this._polymorphic = false;\r\n\r\n this._multiplicity = RelationshipMultiplicity.zeroOne;\r\n this._relationshipClass = relClass;\r\n this._roleLabel = roleLabel;\r\n }\r\n\r\n public get multiplicity() { return this._multiplicity ?? RelationshipMultiplicity.zeroOne; }\r\n\r\n public get polymorphic() { return this._polymorphic ?? false; }\r\n\r\n public get roleLabel() { return this._roleLabel; }\r\n\r\n public get constraintClasses(): ReadonlyArray<LazyLoadedRelationshipConstraintClass> | undefined { return this._constraintClasses; }\r\n\r\n public get relationshipClass() { return this._relationshipClass; }\r\n\r\n public get relationshipEnd() { return this._relationshipEnd; }\r\n\r\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\r\n\r\n /** Returns the constraint name, ie. 'RelationshipName.Source/Target' */\r\n public get fullName() { return `${this._relationshipClass.name}:${this.isSource ? \"Source\" : \"Target\"}`; }\r\n\r\n /** Returns the schema of the RelationshipClass. */\r\n public get schema(): Schema { return this._relationshipClass.schema; }\r\n\r\n public get abstractConstraint(): LazyLoadedRelationshipConstraintClass | undefined {\r\n if (this._abstractConstraint)\r\n return this._abstractConstraint;\r\n\r\n if (this.constraintClasses && this.constraintClasses.length === 1)\r\n return this.constraintClasses[0];\r\n\r\n return this._abstractConstraint;\r\n }\r\n\r\n /**\r\n * True if this RelationshipConstraint is the Source relationship end.\r\n */\r\n public get isSource(): boolean { return this.relationshipEnd === RelationshipEnd.Source; }\r\n\r\n /**\r\n * Adds the provided class as a constraint class to this constraint.\r\n * @param constraint The class to add as a constraint class.\r\n * @internal\r\n */\r\n public addClass(constraint: LazyLoadedRelationshipConstraintClass): void {\r\n // TODO: Ensure we don't start mixing constraint class types\r\n // TODO: Check that this class is or subclasses abstract constraint?\r\n\r\n if (!this._constraintClasses)\r\n this._constraintClasses = [];\r\n\r\n // TODO: Handle relationship constraints\r\n this._constraintClasses.push(constraint);\r\n }\r\n\r\n /**\r\n * Removes the provided class as a constraint class from this constraint.\r\n * @param constraint The class to add as a constraint class.\r\n *\r\n * @internal\r\n */\r\n protected removeClass(constraint: LazyLoadedRelationshipConstraintClass): void {\r\n if (undefined === this._constraintClasses)\r\n return;\r\n\r\n this._constraintClasses.forEach((item, index) => {\r\n const constraintName = item.fullName;\r\n if (constraintName === constraint.fullName)\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._constraintClasses?.splice(index, 1);\r\n });\r\n }\r\n\r\n /**\r\n * Save this RelationshipConstraint's properties to an object for serializing to JSON.\r\n */\r\n public toJSON(): RelationshipConstraintProps {\r\n const schemaJson: { [value: string]: any } = {};\r\n schemaJson.multiplicity = this.multiplicity.toString();\r\n schemaJson.roleLabel = this.roleLabel;\r\n schemaJson.polymorphic = this.polymorphic;\r\n if (undefined !== this._abstractConstraint)\r\n schemaJson.abstractConstraint = this._abstractConstraint.fullName;\r\n if (undefined !== this.constraintClasses && this.constraintClasses.length > 0)\r\n schemaJson.constraintClasses = this.constraintClasses.map((constraintClass) => constraintClass.fullName);\r\n\r\n const customAttributes = serializeCustomAttributes(this.customAttributes);\r\n if (undefined !== customAttributes)\r\n schemaJson.customAttributes = customAttributes;\r\n return schemaJson as RelationshipConstraintProps;\r\n }\r\n\r\n /** @internal */\r\n public async toXml(schemaXml: Document): Promise<Element> {\r\n const elementName = this.isSource ? \"Source\" : \"Target\";\r\n const itemElement = schemaXml.createElement(elementName);\r\n if (undefined !== this.polymorphic)\r\n itemElement.setAttribute(\"polymorphic\", this.polymorphic.toString());\r\n if (undefined !== this.roleLabel)\r\n itemElement.setAttribute(\"roleLabel\", this.roleLabel);\r\n if (undefined !== this.multiplicity)\r\n itemElement.setAttribute(\"multiplicity\", this.multiplicity.toString());\r\n\r\n const abstractConstraint = await this.abstractConstraint;\r\n if (undefined !== abstractConstraint) {\r\n const abstractConstraintName = XmlSerializationUtils.createXmlTypedName(this.schema, abstractConstraint.schema, abstractConstraint.name);\r\n itemElement.setAttribute(\"abstractConstraint\", abstractConstraintName);\r\n }\r\n\r\n if (undefined !== this.constraintClasses) {\r\n for (const item of this.constraintClasses) {\r\n const constraintClass = await item;\r\n const classElement = schemaXml.createElement(\"Class\");\r\n const constraintClassName = XmlSerializationUtils.createXmlTypedName(this.schema, constraintClass.schema, constraintClass.name);\r\n classElement.setAttribute(\"class\", constraintClassName);\r\n itemElement.appendChild(classElement);\r\n }\r\n }\r\n\r\n if (this._customAttributes) {\r\n const caContainerElement = schemaXml.createElement(\"ECCustomAttributes\");\r\n for (const [name, attribute] of this._customAttributes) {\r\n const caElement = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this.schema);\r\n caContainerElement.appendChild(caElement);\r\n }\r\n itemElement.appendChild(caContainerElement);\r\n }\r\n\r\n return itemElement;\r\n }\r\n\r\n public fromJSONSync(relationshipConstraintProps: RelationshipConstraintProps) {\r\n\r\n this._roleLabel = relationshipConstraintProps.roleLabel;\r\n this._polymorphic = relationshipConstraintProps.polymorphic;\r\n\r\n const parsedMultiplicity = RelationshipMultiplicity.fromString(relationshipConstraintProps.multiplicity);\r\n if (!parsedMultiplicity)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidMultiplicity, ``);\r\n this._multiplicity = parsedMultiplicity;\r\n\r\n const relClassSchema = this.relationshipClass.schema;\r\n\r\n if (undefined !== relationshipConstraintProps.abstractConstraint) {\r\n const abstractConstraintSchemaItemKey = relClassSchema.getSchemaItemKey(relationshipConstraintProps.abstractConstraint);\r\n if (!abstractConstraintSchemaItemKey)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);\r\n this.setAbstractConstraint(new DelayedPromiseWithProps<SchemaItemKey, AnyConstraintClass>(abstractConstraintSchemaItemKey,\r\n async () => {\r\n const tempAbstractConstraint = await relClassSchema.lookupItem(relationshipConstraintProps.abstractConstraint!);\r\n if (undefined === tempAbstractConstraint ||\r\n (!EntityClass.isEntityClass(tempAbstractConstraint) && !Mixin.isMixin(tempAbstractConstraint) && !RelationshipClass.isRelationshipClass(tempAbstractConstraint)))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);\r\n\r\n return tempAbstractConstraint;\r\n }));\r\n }\r\n\r\n const loadEachConstraint = (constraintClassName: any) => {\r\n const tempConstraintClass = relClassSchema.lookupItemSync(constraintClassName);\r\n if (!tempConstraintClass ||\r\n (!EntityClass.isEntityClass(tempConstraintClass) && !Mixin.isMixin(tempConstraintClass) && !RelationshipClass.isRelationshipClass(tempConstraintClass)))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\r\n return tempConstraintClass;\r\n };\r\n\r\n for (const constraintClassName of relationshipConstraintProps.constraintClasses) {\r\n const constraintClass = loadEachConstraint(constraintClassName);\r\n this.addClass(new DelayedPromiseWithProps(constraintClass.key, async () => constraintClass));\r\n }\r\n }\r\n\r\n public async fromJSON(relationshipConstraintProps: RelationshipConstraintProps) {\r\n this.fromJSONSync(relationshipConstraintProps);\r\n }\r\n\r\n /**\r\n * Indicates if the provided [[ECClass]] is supported by this [[RelationshipConstraint]].\r\n * @param ecClass The class to check.\r\n */\r\n public async supportsClass(ecClass: ECClass): Promise<boolean> {\r\n if (!this.constraintClasses) {\r\n if (this.relationshipClass.baseClass) {\r\n const baseRelationship = await this.relationshipClass.baseClass as RelationshipClass;\r\n const baseConstraint = this.isSource ? baseRelationship.source : baseRelationship.target;\r\n return baseConstraint.supportsClass(ecClass);\r\n }\r\n return false;\r\n }\r\n\r\n if (ecClass.schemaItemType !== SchemaItemType.EntityClass && ecClass.schemaItemType !== SchemaItemType.RelationshipClass &&\r\n ecClass.schemaItemType !== SchemaItemType.Mixin) {\r\n return false;\r\n }\r\n\r\n const abstractConstraint = await this.abstractConstraint;\r\n\r\n if (abstractConstraint && await RelationshipConstraint.classCompatibleWithConstraint(abstractConstraint, ecClass, this.polymorphic || false))\r\n return true;\r\n\r\n for (const constraint of this.constraintClasses) {\r\n if (await RelationshipConstraint.classCompatibleWithConstraint(await constraint, ecClass, this.polymorphic || false))\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Indicates if an ECClass is of the type or applies to the type (if a mixin) of the ECClass specified by the constraintClass parameter.\r\n * @param constraintClass The ECClass that is a constraint class of a relationship.\r\n * @param testClass The ECClass to check against the constraint class.\r\n * @param isPolymorphic Indicates if the testClass should be checked polymorphically.\r\n */\r\n public static async classCompatibleWithConstraint(constraintClass: ECClass, testClass: ECClass, isPolymorphic: boolean): Promise<boolean> {\r\n if (SchemaItem.equalByKey(constraintClass, testClass))\r\n return true;\r\n\r\n if (isPolymorphic) {\r\n if (testClass.schemaItemType === SchemaItemType.EntityClass || testClass.schemaItemType === SchemaItemType.RelationshipClass) {\r\n return testClass.is(constraintClass);\r\n }\r\n\r\n if (testClass.schemaItemType === SchemaItemType.Mixin) {\r\n if (constraintClass.schemaItemType === SchemaItemType.EntityClass)\r\n return (testClass as Mixin).applicableTo(constraintClass as EntityClass);\r\n else\r\n return testClass.is(constraintClass);\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static isRelationshipConstraint(object: any): object is RelationshipConstraint {\r\n const relationshipConstraint = object as RelationshipConstraint;\r\n\r\n return relationshipConstraint !== undefined && relationshipConstraint.polymorphic !== undefined && relationshipConstraint.multiplicity !== undefined\r\n && relationshipConstraint.relationshipEnd !== undefined && relationshipConstraint._relationshipClass !== undefined;\r\n }\r\n\r\n /** @internal */\r\n protected addCustomAttribute(customAttribute: CustomAttribute) {\r\n if (!this._customAttributes)\r\n this._customAttributes = new Map<string, CustomAttribute>();\r\n\r\n this._customAttributes.set(customAttribute.className, customAttribute);\r\n }\r\n\r\n /** @internal */\r\n protected setRoleLabel(roleLabel: string | undefined) {\r\n this._roleLabel = roleLabel;\r\n }\r\n\r\n /** @internal */\r\n protected setRelationshipEnd(relationshipEnd: RelationshipEnd) {\r\n this._relationshipEnd = relationshipEnd;\r\n }\r\n\r\n /** @internal */\r\n protected setPolymorphic(polymorphic: boolean) {\r\n this._polymorphic = polymorphic;\r\n }\r\n\r\n /** @internal */\r\n protected setMultiplicity(multiplicity: RelationshipMultiplicity) {\r\n this._multiplicity = multiplicity;\r\n }\r\n\r\n /** @internal */\r\n protected setAbstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined) {\r\n this._abstractConstraint = abstractConstraint;\r\n }\r\n}\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\n * @internal\r\n */\r\nexport abstract class MutableRelationshipConstraint extends RelationshipConstraint {\r\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\r\n public abstract override setRoleLabel(roleLabel: string | undefined): void;\r\n public abstract override setRelationshipEnd(relationshipEnd: RelationshipEnd): void;\r\n public abstract override setPolymorphic(polymorphic: boolean): void;\r\n public abstract override setMultiplicity(multiplicity: RelationshipMultiplicity): void;\r\n public abstract override setAbstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined): void;\r\n}\r\n\r\nconst INT32_MAX = 2147483647;\r\n\r\n/**\r\n * @public @preview\r\n */\r\nexport class RelationshipMultiplicity {\r\n public static readonly zeroOne = new RelationshipMultiplicity(0, 1);\r\n public static readonly zeroMany = new RelationshipMultiplicity(0, INT32_MAX);\r\n public static readonly oneOne = new RelationshipMultiplicity(1, 1);\r\n public static readonly oneMany = new RelationshipMultiplicity(1, INT32_MAX);\r\n\r\n public readonly lowerLimit: number;\r\n public readonly upperLimit: number;\r\n\r\n /** @internal */\r\n constructor(lowerLimit: number, upperLimit: number) {\r\n this.lowerLimit = lowerLimit;\r\n this.upperLimit = upperLimit;\r\n }\r\n\r\n public static fromString(str: string): RelationshipMultiplicity | undefined {\r\n const matches = /^\\(([0-9]*)\\.\\.([0-9]*|\\*)\\)$/.exec(str);\r\n if (matches === null || matches.length !== 3)\r\n return undefined;\r\n\r\n const lowerLimit = parseInt(matches[1], 10);\r\n const upperLimit = matches[2] === \"*\" ? INT32_MAX : parseInt(matches[2], 10);\r\n if (0 === lowerLimit && 1 === upperLimit)\r\n return RelationshipMultiplicity.zeroOne;\r\n else if (0 === lowerLimit && INT32_MAX === upperLimit)\r\n return RelationshipMultiplicity.zeroMany;\r\n else if (1 === lowerLimit && 1 === upperLimit)\r\n return RelationshipMultiplicity.oneOne;\r\n else if (1 === lowerLimit && INT32_MAX === upperLimit)\r\n return RelationshipMultiplicity.oneMany;\r\n\r\n return new RelationshipMultiplicity(lowerLimit, upperLimit);\r\n }\r\n\r\n public equals(rhs: RelationshipMultiplicity): boolean {\r\n return this.lowerLimit === rhs.lowerLimit && this.upperLimit === rhs.upperLimit;\r\n }\r\n\r\n public toString(): string {\r\n return `(${this.lowerLimit}..${this.upperLimit === INT32_MAX ? \"*\" : this.upperLimit})`;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableRelationshipClass extends RelationshipClass {\r\n public override get source() { return this._source as MutableRelationshipConstraint; }\r\n public override get target() { return this._target as MutableRelationshipConstraint; }\r\n public abstract override setStrength(strength: StrengthType): void;\r\n public abstract override setStrengthDirection(direction: StrengthDirection): void;\r\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\r\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
|