@itwin/ecschema-editing 4.6.0-dev.9 → 4.7.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 +11 -1
- package/lib/cjs/Differencing/SchemaConflicts.d.ts +14 -0
- package/lib/cjs/Differencing/SchemaConflicts.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaConflicts.js +15 -2
- package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +0 -52
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifference.d.ts +2 -2
- package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDifference.js +3 -3
- package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
- package/lib/cjs/Editing/Constants.js.map +1 -1
- package/lib/cjs/Editing/CustomAttributes.d.ts +1 -1
- package/lib/cjs/Editing/CustomAttributes.d.ts.map +1 -1
- package/lib/cjs/Editing/CustomAttributes.js +2 -2
- package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
- package/lib/cjs/Editing/ECClasses.d.ts +29 -23
- package/lib/cjs/Editing/ECClasses.d.ts.map +1 -1
- package/lib/cjs/Editing/ECClasses.js +51 -95
- package/lib/cjs/Editing/ECClasses.js.map +1 -1
- package/lib/cjs/Editing/Editor.js.map +1 -1
- package/lib/cjs/Editing/Entities.d.ts +6 -7
- package/lib/cjs/Editing/Entities.d.ts.map +1 -1
- package/lib/cjs/Editing/Entities.js +7 -27
- package/lib/cjs/Editing/Entities.js.map +1 -1
- package/lib/cjs/Editing/Enumerations.js.map +1 -1
- package/lib/cjs/Editing/Formats.js.map +1 -1
- package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
- package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
- package/lib/cjs/Editing/Mixins.d.ts +6 -2
- package/lib/cjs/Editing/Mixins.d.ts.map +1 -1
- package/lib/cjs/Editing/Mixins.js +7 -22
- package/lib/cjs/Editing/Mixins.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableArrayProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableEntityClass.js +2 -2
- package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableMixin.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableNavigationProperty.d.ts +8 -0
- package/lib/cjs/Editing/Mutable/MutableNavigationProperty.d.ts.map +1 -0
- package/lib/cjs/Editing/Mutable/MutableNavigationProperty.js +16 -0
- package/lib/cjs/Editing/Mutable/MutableNavigationProperty.js.map +1 -0
- package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableStructProperty.d.ts +8 -0
- package/lib/cjs/Editing/Mutable/MutableStructProperty.d.ts.map +1 -0
- package/lib/cjs/Editing/Mutable/MutableStructProperty.js +16 -0
- package/lib/cjs/Editing/Mutable/MutableStructProperty.js.map +1 -0
- package/lib/cjs/Editing/Mutable/MutableUnit.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
- package/lib/cjs/Editing/Phenomena.js.map +1 -1
- package/lib/cjs/Editing/Properties.d.ts +201 -0
- package/lib/cjs/Editing/Properties.d.ts.map +1 -0
- package/lib/cjs/Editing/Properties.js +349 -0
- package/lib/cjs/Editing/Properties.js.map +1 -0
- package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
- package/lib/cjs/Editing/RelationshipClasses.d.ts +12 -1
- package/lib/cjs/Editing/RelationshipClasses.d.ts.map +1 -1
- package/lib/cjs/Editing/RelationshipClasses.js +26 -3
- package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
- package/lib/cjs/Editing/SchemaItems.js.map +1 -1
- package/lib/cjs/Editing/Structs.d.ts +1 -1
- package/lib/cjs/Editing/Structs.d.ts.map +1 -1
- package/lib/cjs/Editing/Structs.js +2 -2
- package/lib/cjs/Editing/Structs.js.map +1 -1
- package/lib/cjs/Editing/UnitSystems.js.map +1 -1
- package/lib/cjs/Editing/Units.js.map +1 -1
- package/lib/cjs/Merging/CAClassMerger.js.map +1 -1
- package/lib/cjs/Merging/ClassMerger.js +7 -16
- package/lib/cjs/Merging/ClassMerger.js.map +1 -1
- package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
- package/lib/cjs/Merging/CustomAttributeMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/CustomAttributeMerger.js +6 -1
- package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
- package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
- package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
- package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
- package/lib/cjs/Merging/MixinMerger.js.map +1 -1
- package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
- package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -1
- package/lib/cjs/Merging/PropertyMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/PropertyMerger.js +54 -23
- package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
- package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaItemMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaMerger.d.ts +1 -1
- package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/SchemaMerger.js +12 -8
- package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
- package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -1
- package/lib/cjs/Validation/Diagnostic.d.ts +2 -2
- package/lib/cjs/Validation/Diagnostic.d.ts.map +1 -1
- package/lib/cjs/Validation/Diagnostic.js +4 -4
- package/lib/cjs/Validation/Diagnostic.js.map +1 -1
- package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
- package/lib/cjs/Validation/ECRules.d.ts +35 -35
- package/lib/cjs/Validation/ECRules.d.ts.map +1 -1
- package/lib/cjs/Validation/ECRules.js.map +1 -1
- package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
- package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
- package/lib/cjs/Validation/Rules.js.map +1 -1
- package/lib/cjs/Validation/SchemaChanges.d.ts +38 -6
- package/lib/cjs/Validation/SchemaChanges.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaChanges.js +97 -27
- package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareVisitor.js +4 -3
- package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
- package/lib/cjs/Validation/SchemaComparer.d.ts +1 -0
- package/lib/cjs/Validation/SchemaComparer.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaComparer.js +238 -260
- package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
- package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
- package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-editing.d.ts +2 -0
- package/lib/cjs/ecschema-editing.d.ts.map +1 -1
- package/lib/cjs/ecschema-editing.js +2 -0
- package/lib/cjs/ecschema-editing.js.map +1 -1
- package/package.json +11 -11
- package/public/locales/en/ECSchemaEditing.json +26 -26
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { CustomAttribute, SchemaItemKey } from "@itwin/ecschema-metadata";
|
|
2
|
+
import { SchemaContextEditor } from "./Editor";
|
|
3
|
+
import { MutableArrayProperty } from "./Mutable/MutableArrayProperty";
|
|
4
|
+
import { MutableProperty } from "./Mutable/MutableProperty";
|
|
5
|
+
import { MutablePrimitiveOrEnumPropertyBase } from "./Mutable/MutablePrimitiveOrEnumProperty";
|
|
6
|
+
import { MutableStructProperty } from "./Mutable/MutableStructProperty";
|
|
7
|
+
import { MutableNavigationProperty } from "./Mutable/MutableNavigationProperty";
|
|
8
|
+
import { ECClassSchemaItems } from "./ECClasses";
|
|
9
|
+
type MutablePropertyType = MutableProperty | MutableArrayProperty | MutablePrimitiveOrEnumPropertyBase | MutableNavigationProperty | MutableStructProperty;
|
|
10
|
+
/**
|
|
11
|
+
* @alpha
|
|
12
|
+
* A class allowing editing of attributes of the base Property class.
|
|
13
|
+
*/
|
|
14
|
+
export declare class Properties {
|
|
15
|
+
protected ecClassType: ECClassSchemaItems;
|
|
16
|
+
protected _schemaEditor: SchemaContextEditor;
|
|
17
|
+
constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor);
|
|
18
|
+
setName(classKey: SchemaItemKey, propertyName: string, newPropertyName: string): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Sets the property description.
|
|
21
|
+
* @param classKey The SchemaItemKey of the class.
|
|
22
|
+
* @param propertyName The name of the property.
|
|
23
|
+
* @param description The new description to set.
|
|
24
|
+
*/
|
|
25
|
+
setDescription(classKey: SchemaItemKey, propertyName: string, description: string): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Sets the property label.
|
|
28
|
+
* @param classKey The SchemaItemKey of the class.
|
|
29
|
+
* @param propertyName The name of the property.
|
|
30
|
+
* @param label The new label to set.
|
|
31
|
+
*/
|
|
32
|
+
setLabel(classKey: SchemaItemKey, propertyName: string, label: string): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Sets the property isReadOnly attribute.
|
|
35
|
+
* @param classKey The SchemaItemKey of the class.
|
|
36
|
+
* @param propertyName The name of the property.
|
|
37
|
+
* @param isReadOnly The new isReadOnly value.
|
|
38
|
+
*/
|
|
39
|
+
setIsReadOnly(classKey: SchemaItemKey, propertyName: string, isReadOnly: boolean): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Sets the property priority.
|
|
42
|
+
* @param classKey The SchemaItemKey of the class.
|
|
43
|
+
* @param propertyName The name of the property.
|
|
44
|
+
* @param priority The new priority.
|
|
45
|
+
*/
|
|
46
|
+
setPriority(classKey: SchemaItemKey, propertyName: string, priority: number): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Sets the property category.
|
|
49
|
+
* @param classKey The SchemaItemKey of the class.
|
|
50
|
+
* @param propertyName The name of the property.
|
|
51
|
+
* @param categoryKey The SchemaItemKey of the property category.
|
|
52
|
+
*/
|
|
53
|
+
setCategory(classKey: SchemaItemKey, propertyName: string, categoryKey: SchemaItemKey): Promise<{
|
|
54
|
+
errorMessage: string;
|
|
55
|
+
itemKey?: undefined;
|
|
56
|
+
propertyName?: undefined;
|
|
57
|
+
} | {
|
|
58
|
+
itemKey: SchemaItemKey;
|
|
59
|
+
propertyName: string;
|
|
60
|
+
errorMessage?: undefined;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Adds a CustomAttribute instance to the Property identified by the given SchemaItemKey and property name.
|
|
64
|
+
* @param classKey The SchemaItemKey identifying the class.
|
|
65
|
+
* @param propertyName The name of the property.
|
|
66
|
+
* @param customAttribute The CustomAttribute instance to add.
|
|
67
|
+
*/
|
|
68
|
+
addCustomAttribute(classKey: SchemaItemKey, propertyName: string, customAttribute: CustomAttribute): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Gets the property with the specified name from the class identified by the given key.
|
|
71
|
+
* @param classKey The SchemaItemKey of the class.
|
|
72
|
+
* @param propertyName The name of the property to retrieve.
|
|
73
|
+
*/
|
|
74
|
+
protected getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T>;
|
|
75
|
+
private findDerivedClasses;
|
|
76
|
+
private getClass;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @alpha
|
|
80
|
+
* A class extending Properties allowing editing of attributes of PrimitiveArrayProperty,
|
|
81
|
+
* EnumerationArrayProperty and StructArrayProperty.
|
|
82
|
+
*/
|
|
83
|
+
export declare class ArrayProperties extends Properties {
|
|
84
|
+
constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor);
|
|
85
|
+
/**
|
|
86
|
+
* Sets the array property minOccurs attribute.
|
|
87
|
+
* @param classKey The SchemaItemKey of the class.
|
|
88
|
+
* @param propertyName The name of the property.
|
|
89
|
+
* @param minOccurs The new minOccurs value.
|
|
90
|
+
*/
|
|
91
|
+
setMinOccurs(classKey: SchemaItemKey, propertyName: string, minOccurs: number): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Sets the array property maxOccurs attribute.
|
|
94
|
+
* @param classKey The SchemaItemKey of the class.
|
|
95
|
+
* @param propertyName The name of the property.
|
|
96
|
+
* @param maxOccurs The new maxOccurs value.
|
|
97
|
+
*/
|
|
98
|
+
setMaxOccurs(classKey: SchemaItemKey, propertyName: string, maxOccurs: number): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Override to validate that the found property is an ArrayProperty.
|
|
101
|
+
* @param classKey The SchemaItemKey of the class.
|
|
102
|
+
* @param propertyName The name of the property.
|
|
103
|
+
*/
|
|
104
|
+
protected getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* @alpha
|
|
108
|
+
* A class extending Properties allowing editing of attributes of PrimitiveProperty and EnumerationProperty.
|
|
109
|
+
*/
|
|
110
|
+
declare class PrimitiveOrEnumProperties extends Properties {
|
|
111
|
+
constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor);
|
|
112
|
+
/**
|
|
113
|
+
* Sets the extendTypeName attribute value.
|
|
114
|
+
* @param classKey The SchemaItemKey of the class.
|
|
115
|
+
* @param propertyName The name of the property.
|
|
116
|
+
* @param extendTypeName The extended type name of the property.
|
|
117
|
+
*/
|
|
118
|
+
setExtendedTypeName(classKey: SchemaItemKey, propertyName: string, extendedTypeName: string): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Sets the minLength attribute value.
|
|
121
|
+
* @param classKey The SchemaItemKey of the class.
|
|
122
|
+
* @param propertyName The name of the property.
|
|
123
|
+
* @param minLength The minimum length of the property.
|
|
124
|
+
*/
|
|
125
|
+
setMinLength(classKey: SchemaItemKey, propertyName: string, minLength: number): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Sets the maxLength attribute value.
|
|
128
|
+
* @param classKey The SchemaItemKey of the class.
|
|
129
|
+
* @param propertyName The name of the property.
|
|
130
|
+
* @param maxLength The maximum length of the property.
|
|
131
|
+
*/
|
|
132
|
+
setMaxLength(classKey: SchemaItemKey, propertyName: string, maxLength: number): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Sets the minValue attribute value.
|
|
135
|
+
* @param classKey The SchemaItemKey of the class.
|
|
136
|
+
* @param propertyName The name of the property.
|
|
137
|
+
* @param minValue The minimum value of the property.
|
|
138
|
+
*/
|
|
139
|
+
setMinValue(classKey: SchemaItemKey, propertyName: string, minValue: number): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Sets the maxValue attribute value.
|
|
142
|
+
* @param classKey The SchemaItemKey of the class.
|
|
143
|
+
* @param propertyName The name of the property.
|
|
144
|
+
* @param maxValue The maximum value of the property.
|
|
145
|
+
*/
|
|
146
|
+
setMaxValue(classKey: SchemaItemKey, propertyName: string, maxValue: number): Promise<void>;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @alpha
|
|
150
|
+
* A class extending Properties allowing editing of PrimitiveProperty attributes.
|
|
151
|
+
*/
|
|
152
|
+
export declare class PrimitiveProperties extends PrimitiveOrEnumProperties {
|
|
153
|
+
constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor);
|
|
154
|
+
/**
|
|
155
|
+
* Override to validate that the found property is a PrimitiveProperty.
|
|
156
|
+
* @param classKey The SchemaItemKey of the class.
|
|
157
|
+
* @param propertyName The name of the property.
|
|
158
|
+
*/
|
|
159
|
+
protected getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T>;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* @alpha
|
|
163
|
+
* A class extending Properties allowing editing of EnumerationProperty attributes.
|
|
164
|
+
*/
|
|
165
|
+
export declare class EnumerationProperties extends PrimitiveOrEnumProperties {
|
|
166
|
+
constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor);
|
|
167
|
+
/**
|
|
168
|
+
* Override to validate that the found property is a EnumerationProperty.
|
|
169
|
+
* @param classKey The SchemaItemKey of the class.
|
|
170
|
+
* @param propertyName The name of the property.
|
|
171
|
+
*/
|
|
172
|
+
protected getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T>;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* @alpha
|
|
176
|
+
* A class extending Properties allowing editing of NavigationProperties attributes.
|
|
177
|
+
*/
|
|
178
|
+
export declare class NavigationProperties extends Properties {
|
|
179
|
+
constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor);
|
|
180
|
+
/**
|
|
181
|
+
* Override to validate that the found property is a NavigationProperty.
|
|
182
|
+
* @param classKey The SchemaItemKey of the class.
|
|
183
|
+
* @param propertyName The name of the property.
|
|
184
|
+
*/
|
|
185
|
+
protected getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T>;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* @alpha
|
|
189
|
+
* A class extending Properties allowing editing of StructProperty attributes.
|
|
190
|
+
*/
|
|
191
|
+
export declare class StructProperties extends Properties {
|
|
192
|
+
constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor);
|
|
193
|
+
/**
|
|
194
|
+
* Override to validate that the found property is a StructProperty.
|
|
195
|
+
* @param classKey The SchemaItemKey of the class.
|
|
196
|
+
* @param propertyName The name of the property.
|
|
197
|
+
*/
|
|
198
|
+
protected getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T>;
|
|
199
|
+
}
|
|
200
|
+
export {};
|
|
201
|
+
//# sourceMappingURL=Properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Properties.d.ts","sourceRoot":"","sources":["../../../src/Editing/Properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAEJ,aAAa,EAAkC,MAAM,0BAA0B,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,kCAAkC,EAAE,MAAM,0CAA0C,CAAC;AAE9F,OAAO,EAAE,qBAAqB,EAA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OAIG;cACsB,WAAW,CAAC,CAAC,SAAS,mBAAmB,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;CAQ/H;AAED;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,yBAAyB;gBAC/C,WAAW,EAAE,kBAAkB,EAAE,aAAa,EAAE,mBAAmB;IAItF;;;;OAIG;cACsB,WAAW,CAAC,CAAC,SAAS,mBAAmB,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;CAQ/H;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,UAAU;gBAC/B,WAAW,EAAE,kBAAkB,EAAE,aAAa,EAAE,mBAAmB;IAItF;;;;OAIG;cACsB,WAAW,CAAC,CAAC,SAAS,mBAAmB,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;CAQ/H;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;gBAC3B,WAAW,EAAE,kBAAkB,EAAE,aAAa,EAAE,mBAAmB;IAItF;;;;OAIG;cACsB,WAAW,CAAC,CAAC,SAAS,mBAAmB,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;CAQ/H"}
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StructProperties = exports.NavigationProperties = exports.EnumerationProperties = exports.PrimitiveProperties = exports.ArrayProperties = exports.Properties = void 0;
|
|
4
|
+
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
5
|
+
const Rules = require("../Validation/ECRules");
|
|
6
|
+
/**
|
|
7
|
+
* @alpha
|
|
8
|
+
* A class allowing editing of attributes of the base Property class.
|
|
9
|
+
*/
|
|
10
|
+
class Properties {
|
|
11
|
+
constructor(ecClassType, _schemaEditor) {
|
|
12
|
+
this.ecClassType = ecClassType;
|
|
13
|
+
this._schemaEditor = _schemaEditor;
|
|
14
|
+
}
|
|
15
|
+
async setName(classKey, propertyName, newPropertyName) {
|
|
16
|
+
const newName = new ecschema_metadata_1.ECName(newPropertyName);
|
|
17
|
+
const existingProperty = await this.getProperty(classKey, propertyName);
|
|
18
|
+
const baseProperty = await existingProperty.class.getProperty(newPropertyName, true);
|
|
19
|
+
if (baseProperty)
|
|
20
|
+
throw new Error(`An ECProperty with the name ${newPropertyName} already exists in the class ${baseProperty.class.name}.`);
|
|
21
|
+
// Handle derived classes
|
|
22
|
+
const derivedProperties = [];
|
|
23
|
+
const derivedClasses = await this.findDerivedClasses(existingProperty.class);
|
|
24
|
+
for (const derivedClass of derivedClasses) {
|
|
25
|
+
if (await derivedClass.getProperty(newPropertyName))
|
|
26
|
+
throw new Error(`An ECProperty with the name ${newPropertyName} already exists in the class ${derivedClass.fullName}.`);
|
|
27
|
+
const propertyOverride = await derivedClass.getProperty(propertyName);
|
|
28
|
+
// If found the property is overridden in the derived class.
|
|
29
|
+
if (propertyOverride)
|
|
30
|
+
derivedProperties.push(propertyOverride);
|
|
31
|
+
}
|
|
32
|
+
// Re-name the overridden property in all derived classes
|
|
33
|
+
derivedProperties.forEach((prop) => {
|
|
34
|
+
prop.setName(newName);
|
|
35
|
+
});
|
|
36
|
+
existingProperty.setName(newName);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Sets the property description.
|
|
40
|
+
* @param classKey The SchemaItemKey of the class.
|
|
41
|
+
* @param propertyName The name of the property.
|
|
42
|
+
* @param description The new description to set.
|
|
43
|
+
*/
|
|
44
|
+
async setDescription(classKey, propertyName, description) {
|
|
45
|
+
const property = await this.getProperty(classKey, propertyName);
|
|
46
|
+
property.setDescription(description);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Sets the property label.
|
|
50
|
+
* @param classKey The SchemaItemKey of the class.
|
|
51
|
+
* @param propertyName The name of the property.
|
|
52
|
+
* @param label The new label to set.
|
|
53
|
+
*/
|
|
54
|
+
async setLabel(classKey, propertyName, label) {
|
|
55
|
+
const property = await this.getProperty(classKey, propertyName);
|
|
56
|
+
property.setLabel(label);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Sets the property isReadOnly attribute.
|
|
60
|
+
* @param classKey The SchemaItemKey of the class.
|
|
61
|
+
* @param propertyName The name of the property.
|
|
62
|
+
* @param isReadOnly The new isReadOnly value.
|
|
63
|
+
*/
|
|
64
|
+
async setIsReadOnly(classKey, propertyName, isReadOnly) {
|
|
65
|
+
const property = await this.getProperty(classKey, propertyName);
|
|
66
|
+
property.setIsReadOnly(isReadOnly);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Sets the property priority.
|
|
70
|
+
* @param classKey The SchemaItemKey of the class.
|
|
71
|
+
* @param propertyName The name of the property.
|
|
72
|
+
* @param priority The new priority.
|
|
73
|
+
*/
|
|
74
|
+
async setPriority(classKey, propertyName, priority) {
|
|
75
|
+
const property = await this.getProperty(classKey, propertyName);
|
|
76
|
+
property.setPriority(priority);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Sets the property category.
|
|
80
|
+
* @param classKey The SchemaItemKey of the class.
|
|
81
|
+
* @param propertyName The name of the property.
|
|
82
|
+
* @param categoryKey The SchemaItemKey of the property category.
|
|
83
|
+
*/
|
|
84
|
+
async setCategory(classKey, propertyName, categoryKey) {
|
|
85
|
+
const property = await this.getProperty(classKey, propertyName);
|
|
86
|
+
const category = await property.class.schema.lookupItem(categoryKey);
|
|
87
|
+
if (category === undefined) {
|
|
88
|
+
return { errorMessage: `Can't locate the Property Category ${categoryKey.fullName} in the schema ${property.class.schema.fullName}.` };
|
|
89
|
+
}
|
|
90
|
+
property.setCategory(new ecschema_metadata_1.DelayedPromiseWithProps(categoryKey, async () => category));
|
|
91
|
+
return { itemKey: classKey, propertyName };
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Adds a CustomAttribute instance to the Property identified by the given SchemaItemKey and property name.
|
|
95
|
+
* @param classKey The SchemaItemKey identifying the class.
|
|
96
|
+
* @param propertyName The name of the property.
|
|
97
|
+
* @param customAttribute The CustomAttribute instance to add.
|
|
98
|
+
*/
|
|
99
|
+
async addCustomAttribute(classKey, propertyName, customAttribute) {
|
|
100
|
+
const property = await this.getProperty(classKey, propertyName);
|
|
101
|
+
property.addCustomAttribute(customAttribute);
|
|
102
|
+
const diagnostics = Rules.validateCustomAttributeInstance(property, customAttribute);
|
|
103
|
+
// TODO: Update error
|
|
104
|
+
const error = new Error();
|
|
105
|
+
for await (const diagnostic of diagnostics) {
|
|
106
|
+
error.message += `${diagnostic.code}: ${diagnostic.messageText}\r\n`;
|
|
107
|
+
}
|
|
108
|
+
if (error.message) {
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Gets the property with the specified name from the class identified by the given key.
|
|
114
|
+
* @param classKey The SchemaItemKey of the class.
|
|
115
|
+
* @param propertyName The name of the property to retrieve.
|
|
116
|
+
*/
|
|
117
|
+
async getProperty(classKey, propertyName) {
|
|
118
|
+
const mutableClass = await this.getClass(classKey);
|
|
119
|
+
if (mutableClass.schemaItemType !== this.ecClassType) {
|
|
120
|
+
throw new Error(`The class ${classKey.fullName} is not an ${ecschema_metadata_1.SchemaItemType[this.ecClassType]}.`);
|
|
121
|
+
}
|
|
122
|
+
const property = await mutableClass.getProperty(propertyName);
|
|
123
|
+
if (property === undefined) {
|
|
124
|
+
// TODO: Update error
|
|
125
|
+
throw new Error(`An ECProperty with the name ${propertyName} could not be found in the class ${classKey.fullName}.`);
|
|
126
|
+
}
|
|
127
|
+
return property;
|
|
128
|
+
}
|
|
129
|
+
async findDerivedClasses(mutableClass) {
|
|
130
|
+
const derivedClasses = [];
|
|
131
|
+
for await (const schemaItem of this._schemaEditor.schemaContext.getSchemaItems()) {
|
|
132
|
+
if (ecschema_metadata_1.ECClass.isECClass(schemaItem) && await schemaItem.is(mutableClass)) {
|
|
133
|
+
if (!mutableClass.key.matches(schemaItem.key)) {
|
|
134
|
+
derivedClasses.push(schemaItem);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return derivedClasses;
|
|
139
|
+
}
|
|
140
|
+
async getClass(classKey) {
|
|
141
|
+
const schema = await this._schemaEditor.getSchema(classKey.schemaKey);
|
|
142
|
+
if (schema === undefined)
|
|
143
|
+
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.UnableToLocateSchema, `Schema Key ${classKey.schemaKey.toString(true)} not found in context`);
|
|
144
|
+
const ecClass = await schema.getItem(classKey.name);
|
|
145
|
+
if (ecClass === undefined)
|
|
146
|
+
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Class ${classKey.name} was not found in schema ${classKey.schemaKey.toString(true)}`);
|
|
147
|
+
if (!(ecClass instanceof ecschema_metadata_1.ECClass)) {
|
|
148
|
+
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Schema item type not supported`);
|
|
149
|
+
}
|
|
150
|
+
return ecClass;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
exports.Properties = Properties;
|
|
154
|
+
/**
|
|
155
|
+
* @alpha
|
|
156
|
+
* A class extending Properties allowing editing of attributes of PrimitiveArrayProperty,
|
|
157
|
+
* EnumerationArrayProperty and StructArrayProperty.
|
|
158
|
+
*/
|
|
159
|
+
class ArrayProperties extends Properties {
|
|
160
|
+
constructor(ecClassType, _schemaEditor) {
|
|
161
|
+
super(ecClassType, _schemaEditor);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Sets the array property minOccurs attribute.
|
|
165
|
+
* @param classKey The SchemaItemKey of the class.
|
|
166
|
+
* @param propertyName The name of the property.
|
|
167
|
+
* @param minOccurs The new minOccurs value.
|
|
168
|
+
*/
|
|
169
|
+
async setMinOccurs(classKey, propertyName, minOccurs) {
|
|
170
|
+
const property = await this.getProperty(classKey, propertyName);
|
|
171
|
+
property.setMinOccurs(minOccurs);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Sets the array property maxOccurs attribute.
|
|
175
|
+
* @param classKey The SchemaItemKey of the class.
|
|
176
|
+
* @param propertyName The name of the property.
|
|
177
|
+
* @param maxOccurs The new maxOccurs value.
|
|
178
|
+
*/
|
|
179
|
+
async setMaxOccurs(classKey, propertyName, maxOccurs) {
|
|
180
|
+
const property = await this.getProperty(classKey, propertyName);
|
|
181
|
+
property.setMaxOccurs(maxOccurs);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Override to validate that the found property is an ArrayProperty.
|
|
185
|
+
* @param classKey The SchemaItemKey of the class.
|
|
186
|
+
* @param propertyName The name of the property.
|
|
187
|
+
*/
|
|
188
|
+
async getProperty(classKey, propertyName) {
|
|
189
|
+
const property = await super.getProperty(classKey, propertyName);
|
|
190
|
+
if (!property.isArray()) {
|
|
191
|
+
// TODO: Update error
|
|
192
|
+
throw new Error(`The property ${propertyName} is not an ArrayProperty.`);
|
|
193
|
+
}
|
|
194
|
+
return property;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
exports.ArrayProperties = ArrayProperties;
|
|
198
|
+
/**
|
|
199
|
+
* @alpha
|
|
200
|
+
* A class extending Properties allowing editing of attributes of PrimitiveProperty and EnumerationProperty.
|
|
201
|
+
*/
|
|
202
|
+
class PrimitiveOrEnumProperties extends Properties {
|
|
203
|
+
constructor(ecClassType, _schemaEditor) {
|
|
204
|
+
super(ecClassType, _schemaEditor);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Sets the extendTypeName attribute value.
|
|
208
|
+
* @param classKey The SchemaItemKey of the class.
|
|
209
|
+
* @param propertyName The name of the property.
|
|
210
|
+
* @param extendTypeName The extended type name of the property.
|
|
211
|
+
*/
|
|
212
|
+
async setExtendedTypeName(classKey, propertyName, extendedTypeName) {
|
|
213
|
+
const property = await this.getProperty(classKey, propertyName);
|
|
214
|
+
property.setExtendedTypeName(extendedTypeName);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Sets the minLength attribute value.
|
|
218
|
+
* @param classKey The SchemaItemKey of the class.
|
|
219
|
+
* @param propertyName The name of the property.
|
|
220
|
+
* @param minLength The minimum length of the property.
|
|
221
|
+
*/
|
|
222
|
+
async setMinLength(classKey, propertyName, minLength) {
|
|
223
|
+
const property = await this.getProperty(classKey, propertyName);
|
|
224
|
+
property.setMinLength(minLength);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Sets the maxLength attribute value.
|
|
228
|
+
* @param classKey The SchemaItemKey of the class.
|
|
229
|
+
* @param propertyName The name of the property.
|
|
230
|
+
* @param maxLength The maximum length of the property.
|
|
231
|
+
*/
|
|
232
|
+
async setMaxLength(classKey, propertyName, maxLength) {
|
|
233
|
+
const property = await this.getProperty(classKey, propertyName);
|
|
234
|
+
property.setMaxLength(maxLength);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Sets the minValue attribute value.
|
|
238
|
+
* @param classKey The SchemaItemKey of the class.
|
|
239
|
+
* @param propertyName The name of the property.
|
|
240
|
+
* @param minValue The minimum value of the property.
|
|
241
|
+
*/
|
|
242
|
+
async setMinValue(classKey, propertyName, minValue) {
|
|
243
|
+
const property = await this.getProperty(classKey, propertyName);
|
|
244
|
+
property.setMinValue(minValue);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Sets the maxValue attribute value.
|
|
248
|
+
* @param classKey The SchemaItemKey of the class.
|
|
249
|
+
* @param propertyName The name of the property.
|
|
250
|
+
* @param maxValue The maximum value of the property.
|
|
251
|
+
*/
|
|
252
|
+
async setMaxValue(classKey, propertyName, maxValue) {
|
|
253
|
+
const property = await this.getProperty(classKey, propertyName);
|
|
254
|
+
property.setMaxValue(maxValue);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* @alpha
|
|
259
|
+
* A class extending Properties allowing editing of PrimitiveProperty attributes.
|
|
260
|
+
*/
|
|
261
|
+
class PrimitiveProperties extends PrimitiveOrEnumProperties {
|
|
262
|
+
constructor(ecClassType, _schemaEditor) {
|
|
263
|
+
super(ecClassType, _schemaEditor);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Override to validate that the found property is a PrimitiveProperty.
|
|
267
|
+
* @param classKey The SchemaItemKey of the class.
|
|
268
|
+
* @param propertyName The name of the property.
|
|
269
|
+
*/
|
|
270
|
+
async getProperty(classKey, propertyName) {
|
|
271
|
+
const property = await super.getProperty(classKey, propertyName);
|
|
272
|
+
if (!(property instanceof ecschema_metadata_1.PrimitiveProperty)) {
|
|
273
|
+
// TODO: Update error
|
|
274
|
+
throw new Error(`The property ${propertyName} is not an PrimitiveProperty.`);
|
|
275
|
+
}
|
|
276
|
+
return property;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
exports.PrimitiveProperties = PrimitiveProperties;
|
|
280
|
+
/**
|
|
281
|
+
* @alpha
|
|
282
|
+
* A class extending Properties allowing editing of EnumerationProperty attributes.
|
|
283
|
+
*/
|
|
284
|
+
class EnumerationProperties extends PrimitiveOrEnumProperties {
|
|
285
|
+
constructor(ecClassType, _schemaEditor) {
|
|
286
|
+
super(ecClassType, _schemaEditor);
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Override to validate that the found property is a EnumerationProperty.
|
|
290
|
+
* @param classKey The SchemaItemKey of the class.
|
|
291
|
+
* @param propertyName The name of the property.
|
|
292
|
+
*/
|
|
293
|
+
async getProperty(classKey, propertyName) {
|
|
294
|
+
const property = await super.getProperty(classKey, propertyName);
|
|
295
|
+
if (!(property instanceof ecschema_metadata_1.EnumerationProperty)) {
|
|
296
|
+
// TODO: Update error
|
|
297
|
+
throw new Error(`The property ${propertyName} is not an EnumerationProperty.`);
|
|
298
|
+
}
|
|
299
|
+
return property;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
exports.EnumerationProperties = EnumerationProperties;
|
|
303
|
+
/**
|
|
304
|
+
* @alpha
|
|
305
|
+
* A class extending Properties allowing editing of NavigationProperties attributes.
|
|
306
|
+
*/
|
|
307
|
+
class NavigationProperties extends Properties {
|
|
308
|
+
constructor(ecClassType, _schemaEditor) {
|
|
309
|
+
super(ecClassType, _schemaEditor);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Override to validate that the found property is a NavigationProperty.
|
|
313
|
+
* @param classKey The SchemaItemKey of the class.
|
|
314
|
+
* @param propertyName The name of the property.
|
|
315
|
+
*/
|
|
316
|
+
async getProperty(classKey, propertyName) {
|
|
317
|
+
const property = await super.getProperty(classKey, propertyName);
|
|
318
|
+
if (!(property instanceof ecschema_metadata_1.NavigationProperty)) {
|
|
319
|
+
// TODO: Update error
|
|
320
|
+
throw new Error(`The property ${propertyName} is not a NavigationProperty.`);
|
|
321
|
+
}
|
|
322
|
+
return property;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
exports.NavigationProperties = NavigationProperties;
|
|
326
|
+
/**
|
|
327
|
+
* @alpha
|
|
328
|
+
* A class extending Properties allowing editing of StructProperty attributes.
|
|
329
|
+
*/
|
|
330
|
+
class StructProperties extends Properties {
|
|
331
|
+
constructor(ecClassType, _schemaEditor) {
|
|
332
|
+
super(ecClassType, _schemaEditor);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Override to validate that the found property is a StructProperty.
|
|
336
|
+
* @param classKey The SchemaItemKey of the class.
|
|
337
|
+
* @param propertyName The name of the property.
|
|
338
|
+
*/
|
|
339
|
+
async getProperty(classKey, propertyName) {
|
|
340
|
+
const property = await super.getProperty(classKey, propertyName);
|
|
341
|
+
if (!(property instanceof ecschema_metadata_1.StructProperty)) {
|
|
342
|
+
// TODO: Update error
|
|
343
|
+
throw new Error(`The property ${propertyName} is not a StructProperty.`);
|
|
344
|
+
}
|
|
345
|
+
return property;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
exports.StructProperties = StructProperties;
|
|
349
|
+
//# sourceMappingURL=Properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Properties.js","sourceRoot":"","sources":["../../../src/Editing/Properties.ts"],"names":[],"mappings":";;;AAAA,gEAEoG;AAEpG,+CAA+C;AAW/C;;;GAGG;AACH,MAAa,UAAU;IACrB,YAA6B,WAA+B,EAAY,aAAkC;QAA7E,gBAAW,GAAX,WAAW,CAAoB;QAAY,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAExG,KAAK,CAAC,OAAO,CAAC,QAAuB,EAAE,YAAoB,EAAE,eAAuB;QACzF,MAAM,OAAO,GAAG,IAAI,0BAAM,CAAC,eAAe,CAAC,CAAC;QAE5C,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,WAAW,CAAkB,QAAQ,EAAE,YAAY,CAAC,CAAC;QAEzF,MAAM,YAAY,GAAG,MAAM,gBAAgB,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,EAAE,IAAI,CAAoB,CAAC;QACxG,IAAI,YAAY;YACd,MAAM,IAAI,KAAK,CAAC,+BAA+B,eAAe,gCAAgC,YAAY,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;QAE5H,yBAAyB;QACzB,MAAM,iBAAiB,GAA2B,EAAE,CAAC;QACrD,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,KAAqB,CAAC,CAAC;QAC7F,KAAK,MAAM,YAAY,IAAI,cAAc,EAAE,CAAC;YAC1C,IAAI,MAAM,YAAY,CAAC,WAAW,CAAC,eAAe,CAAC;gBACjD,MAAM,IAAI,KAAK,CAAC,+BAA+B,eAAe,gCAAgC,YAAY,CAAC,QAAQ,GAAG,CAAC,CA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B,MAAM,IAAI,KAAK,CAAC,gBAAgB,YAAY,2BAA2B,CAAC,CAAC;QAC3E,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAlBD,4CAkBC","sourcesContent":["import { CustomAttribute, DelayedPromiseWithProps, ECClass, ECName, ECObjectsError,\n ECObjectsStatus, EnumerationProperty, NavigationProperty, PrimitiveProperty,\n PropertyCategory, SchemaItemKey, SchemaItemType, StructProperty } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport * as Rules from \"../Validation/ECRules\";\nimport { MutableArrayProperty } from \"./Mutable/MutableArrayProperty\";\nimport { MutableProperty } from \"./Mutable/MutableProperty\";\nimport { MutablePrimitiveOrEnumPropertyBase } from \"./Mutable/MutablePrimitiveOrEnumProperty\";\nimport { MutableClass } from \"./Mutable/MutableClass\";\nimport { MutableStructProperty } from \"./Mutable/MutableStructProperty\";\nimport { MutableNavigationProperty } from \"./Mutable/MutableNavigationProperty\";\nimport { ECClassSchemaItems } from \"./ECClasses\";\n\ntype MutablePropertyType = MutableProperty | MutableArrayProperty | MutablePrimitiveOrEnumPropertyBase | MutableNavigationProperty | MutableStructProperty;\n\n/**\n * @alpha\n * A class allowing editing of attributes of the base Property class.\n */\nexport class Properties {\n public constructor(protected ecClassType: ECClassSchemaItems, protected _schemaEditor: SchemaContextEditor) { }\n\n public async setName(classKey: SchemaItemKey, propertyName: string, newPropertyName: string) {\n const newName = new ECName(newPropertyName);\n\n const existingProperty = await this.getProperty<MutableProperty>(classKey, propertyName);\n\n const baseProperty = await existingProperty.class.getProperty(newPropertyName, true) as MutableProperty;\n if (baseProperty)\n throw new Error(`An ECProperty with the name ${newPropertyName} already exists in the class ${baseProperty.class.name}.`);\n\n // Handle derived classes\n const derivedProperties: Array<MutableProperty> = [];\n const derivedClasses = await this.findDerivedClasses(existingProperty.class as MutableClass);\n for (const derivedClass of derivedClasses) {\n if (await derivedClass.getProperty(newPropertyName))\n throw new Error(`An ECProperty with the name ${newPropertyName} already exists in the class ${derivedClass.fullName}.`);\n\n const propertyOverride = await derivedClass.getProperty(propertyName) as MutableProperty;\n // If found the property is overridden in the derived class.\n if (propertyOverride)\n derivedProperties.push(propertyOverride);\n }\n\n // Re-name the overridden property in all derived classes\n derivedProperties.forEach((prop: MutableProperty) => {\n prop.setName(newName);\n });\n\n existingProperty.setName(newName);\n }\n\n /**\n * Sets the property description.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param description The new description to set.\n */\n public async setDescription(classKey: SchemaItemKey, propertyName: string, description: string) {\n const property = await this.getProperty<MutableProperty>(classKey, propertyName);\n property.setDescription(description);\n }\n\n /**\n * Sets the property label.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param label The new label to set.\n */\n public async setLabel(classKey: SchemaItemKey, propertyName: string, label: string) {\n const property = await this.getProperty<MutableProperty>(classKey, propertyName);\n property.setLabel(label);\n }\n\n /**\n * Sets the property isReadOnly attribute.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param isReadOnly The new isReadOnly value.\n */\n public async setIsReadOnly(classKey: SchemaItemKey, propertyName: string, isReadOnly: boolean) {\n const property = await this.getProperty<MutableProperty>(classKey, propertyName);\n property.setIsReadOnly(isReadOnly);\n }\n\n /**\n * Sets the property priority.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param priority The new priority.\n */\n public async setPriority(classKey: SchemaItemKey, propertyName: string, priority: number) {\n const property = await this.getProperty<MutableProperty>(classKey, propertyName);\n property.setPriority(priority);\n }\n\n /**\n * Sets the property category.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param categoryKey The SchemaItemKey of the property category.\n */\n public async setCategory(classKey: SchemaItemKey, propertyName: string, categoryKey: SchemaItemKey) {\n const property = await this.getProperty<MutableProperty>(classKey, propertyName);\n\n const category = await property.class.schema.lookupItem<PropertyCategory>(categoryKey);\n if (category === undefined) {\n return { errorMessage: `Can't locate the Property Category ${categoryKey.fullName} in the schema ${property.class.schema.fullName}.` };\n }\n\n property.setCategory(new DelayedPromiseWithProps<SchemaItemKey, PropertyCategory>(categoryKey, async () => category));\n return { itemKey: classKey, propertyName };\n }\n\n /**\n * Adds a CustomAttribute instance to the Property identified by the given SchemaItemKey and property name.\n * @param classKey The SchemaItemKey identifying the class.\n * @param propertyName The name of the property.\n * @param customAttribute The CustomAttribute instance to add.\n */\n public async addCustomAttribute(classKey: SchemaItemKey, propertyName: string, customAttribute: CustomAttribute) {\n const property = await this.getProperty<MutableProperty>(classKey, propertyName);\n\n property.addCustomAttribute(customAttribute);\n\n const diagnostics = Rules.validateCustomAttributeInstance(property, customAttribute);\n\n // TODO: Update error\n const error = new Error();\n for await (const diagnostic of diagnostics) {\n error.message += `${diagnostic.code}: ${diagnostic.messageText}\\r\\n`;\n }\n\n if (error.message) {\n throw error;\n }\n }\n\n /**\n * Gets the property with the specified name from the class identified by the given key.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property to retrieve.\n */\n protected async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\n const mutableClass = await this.getClass(classKey);\n\n if (mutableClass.schemaItemType !== this.ecClassType){\n throw new Error(`The class ${classKey.fullName} is not an ${SchemaItemType[this.ecClassType]}.`);\n }\n\n const property = await mutableClass.getProperty(propertyName) as T;\n if (property === undefined) {\n // TODO: Update error\n throw new Error(`An ECProperty with the name ${propertyName} could not be found in the class ${classKey.fullName}.`);\n }\n\n return property;\n }\n\n private async findDerivedClasses(mutableClass: MutableClass): Promise<Array<MutableClass>>{\n const derivedClasses: Array<MutableClass> = [];\n\n for await (const schemaItem of this._schemaEditor.schemaContext.getSchemaItems()) {\n if(ECClass.isECClass(schemaItem) && await schemaItem.is(mutableClass)) {\n if (!mutableClass.key.matches(schemaItem.key)) {\n derivedClasses.push(schemaItem as MutableClass);\n }\n }\n }\n\n return derivedClasses;\n }\n\n private async getClass(classKey: SchemaItemKey): Promise<MutableClass> {\n const schema = await this._schemaEditor.getSchema(classKey.schemaKey);\n if (schema === undefined)\n throw new ECObjectsError(ECObjectsStatus.UnableToLocateSchema,`Schema Key ${classKey.schemaKey.toString(true)} not found in context`);\n\n const ecClass = await schema.getItem(classKey.name);\n if (ecClass === undefined)\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Class ${classKey.name} was not found in schema ${classKey.schemaKey.toString(true)}`);\n\n if (!(ecClass instanceof ECClass)) {\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Schema item type not supported`);\n }\n\n return ecClass as MutableClass;\n }\n}\n\n/**\n * @alpha\n * A class extending Properties allowing editing of attributes of PrimitiveArrayProperty,\n * EnumerationArrayProperty and StructArrayProperty.\n */\nexport class ArrayProperties extends Properties {\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\n super(ecClassType, _schemaEditor);\n }\n\n /**\n * Sets the array property minOccurs attribute.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param minOccurs The new minOccurs value.\n */\n public async setMinOccurs(classKey: SchemaItemKey, propertyName: string, minOccurs: number) {\n const property = await this.getProperty<MutableArrayProperty>(classKey, propertyName);\n property.setMinOccurs(minOccurs);\n }\n\n /**\n * Sets the array property maxOccurs attribute.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param maxOccurs The new maxOccurs value.\n */\n public async setMaxOccurs(classKey: SchemaItemKey, propertyName: string, maxOccurs: number) {\n const property = await this.getProperty<MutableArrayProperty>(classKey, propertyName);\n property.setMaxOccurs(maxOccurs);\n }\n\n /**\n * Override to validate that the found property is an ArrayProperty.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n */\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\n const property = await super.getProperty<MutableArrayProperty>(classKey, propertyName) as T;\n if (!property.isArray()){\n // TODO: Update error\n throw new Error(`The property ${propertyName} is not an ArrayProperty.`);\n }\n return property;\n }\n}\n\n/**\n * @alpha\n * A class extending Properties allowing editing of attributes of PrimitiveProperty and EnumerationProperty.\n */\nclass PrimitiveOrEnumProperties extends Properties {\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\n super(ecClassType, _schemaEditor);\n }\n\n /**\n * Sets the extendTypeName attribute value.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param extendTypeName The extended type name of the property.\n */\n public async setExtendedTypeName(classKey: SchemaItemKey, propertyName: string, extendedTypeName: string) {\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName);\n property.setExtendedTypeName(extendedTypeName);\n }\n\n /**\n * Sets the minLength attribute value.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param minLength The minimum length of the property.\n */\n public async setMinLength(classKey: SchemaItemKey, propertyName: string, minLength: number) {\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName);\n property.setMinLength(minLength);\n }\n\n /**\n * Sets the maxLength attribute value.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param maxLength The maximum length of the property.\n */\n public async setMaxLength(classKey: SchemaItemKey, propertyName: string, maxLength: number) {\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName);\n property.setMaxLength(maxLength);\n }\n\n /**\n * Sets the minValue attribute value.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param minValue The minimum value of the property.\n */\n public async setMinValue(classKey: SchemaItemKey, propertyName: string, minValue: number) {\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName);\n property.setMinValue(minValue);\n }\n\n /**\n * Sets the maxValue attribute value.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param maxValue The maximum value of the property.\n */\n public async setMaxValue(classKey: SchemaItemKey, propertyName: string, maxValue: number) {\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName);\n property.setMaxValue(maxValue);\n }\n}\n\n/**\n * @alpha\n * A class extending Properties allowing editing of PrimitiveProperty attributes.\n */\nexport class PrimitiveProperties extends PrimitiveOrEnumProperties {\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\n super(ecClassType, _schemaEditor);\n }\n\n /**\n * Override to validate that the found property is a PrimitiveProperty.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n */\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\n const property = await super.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName) as T;\n if (!(property instanceof PrimitiveProperty)){\n // TODO: Update error\n throw new Error(`The property ${propertyName} is not an PrimitiveProperty.`);\n }\n return property;\n }\n}\n\n/**\n * @alpha\n * A class extending Properties allowing editing of EnumerationProperty attributes.\n */\nexport class EnumerationProperties extends PrimitiveOrEnumProperties {\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\n super(ecClassType, _schemaEditor);\n }\n\n /**\n * Override to validate that the found property is a EnumerationProperty.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n */\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\n const property = await super.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName) as T;\n if (!(property instanceof EnumerationProperty)){\n // TODO: Update error\n throw new Error(`The property ${propertyName} is not an EnumerationProperty.`);\n }\n return property;\n }\n}\n\n/**\n * @alpha\n * A class extending Properties allowing editing of NavigationProperties attributes.\n */\nexport class NavigationProperties extends Properties {\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\n super(ecClassType, _schemaEditor);\n }\n\n /**\n * Override to validate that the found property is a NavigationProperty.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n */\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\n const property = await super.getProperty<MutableNavigationProperty>(classKey, propertyName) as T;\n if (!(property instanceof NavigationProperty)){\n // TODO: Update error\n throw new Error(`The property ${propertyName} is not a NavigationProperty.`);\n }\n return property;\n }\n}\n\n/**\n * @alpha\n * A class extending Properties allowing editing of StructProperty attributes.\n */\nexport class StructProperties extends Properties {\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\n super(ecClassType, _schemaEditor);\n }\n\n /**\n * Override to validate that the found property is a StructProperty.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n */\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\n const property = await super.getProperty<MutableStructProperty>(classKey, propertyName) as T;\n if (!(property instanceof StructProperty)){\n // TODO: Update error\n throw new Error(`The property ${propertyName} is not a StructProperty.`);\n }\n return property;\n }\n}\n\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyCategories.js","sourceRoot":"","sources":["../../../src/Editing/PropertyCategories.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA4I;AAI5I;;;GAGG;AACH,MAAa,kBAAkB;IAC7B,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAC7D,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,QAAgB,EAAE,YAAqB;QAC7F,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEzF,MAAM,eAAe,GAAG,CAAC,MAAM,MAAM,CAAC,sBAAsB,C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e,CAAC,QAAQ,+BAA+B,CAAC,CAAC;QAExI,IAAI,gBAAgB,CAAC,cAAc,KAAK,kCAAc,CAAC,gBAAgB;YACrE,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,qBAAqB,EAAE,YAAY,eAAe,CAAC,QAAQ,mCAAmC,CAAC,CAAC;QAE3I,gBAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;CACF;AA1CD,gDA0CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"PropertyCategories.js","sourceRoot":"","sources":["../../../src/Editing/PropertyCategories.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA4I;AAI5I;;;GAGG;AACH,MAAa,kBAAkB;IAC7B,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAC7D,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,QAAgB,EAAE,YAAqB;QAC7F,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEzF,MAAM,eAAe,GAAG,CAAC,MAAM,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAA4B,CAAC;QAC/F,eAAe,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACtC,IAAI,YAAY;YACd,eAAe,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QAEhD,OAAO,EAAE,OAAO,EAAE,eAAe,CAAC,GAAG,EAAE,CAAC;IAC1C,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,qBAA4C;QAC7F,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAA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right (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 Editing\n */\n\nimport { ECObjectsError, ECObjectsStatus, PropertyCategoryProps, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\nimport { MutablePropertyCategory } from \"./Mutable/MutablePropertyCategory\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type Property Category.\n */\nexport class PropertyCategories {\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\n public async create(schemaKey: SchemaKey, name: string, priority: number, displayLabel?: string): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n const newPropCategory = (await schema.createPropertyCategory(name)) as MutablePropertyCategory;\n newPropCategory.setPriority(priority);\n if (displayLabel)\n newPropCategory.setDisplayLabel(displayLabel);\n\n return { itemKey: newPropCategory.key };\n }\n\n public async createFromProps(schemaKey: SchemaKey, propertyCategoryProps: PropertyCategoryProps): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n if (propertyCategoryProps.name === undefined)\n return { errorMessage: `No name was supplied within props.` };\n\n const newPropCategory = (await schema.createPropertyCategory(propertyCategoryProps.name)) as MutablePropertyCategory;\n if (newPropCategory === undefined)\n return { errorMessage: `Failed to create class ${propertyCategoryProps.name} in schema ${schemaKey.toString(true)}.` };\n\n await newPropCategory.fromJSON(propertyCategoryProps);\n return { itemKey: newPropCategory.key };\n }\n\n public async setPriority(propCategoryKey: SchemaItemKey, priority: number): Promise<void> {\n const propertyCategory = (await this._schemaEditor.schemaContext.getSchemaItem<MutablePropertyCategory>(propCategoryKey));\n\n if (propertyCategory === undefined)\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Property Category ${propCategoryKey.fullName} not found in schema context.`);\n\n if (propertyCategory.schemaItemType !== SchemaItemType.PropertyCategory)\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${propCategoryKey.fullName} to be of type Property Category.`);\n\n propertyCategory.setPriority(priority);\n }\n}\n"]}
|