@itwin/ecschema-editing 4.7.0-dev.8 → 4.7.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.
Files changed (187) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/lib/cjs/Differencing/Errors.d.ts +19 -0
  3. package/lib/cjs/Differencing/Errors.d.ts.map +1 -0
  4. package/lib/cjs/Differencing/Errors.js +24 -0
  5. package/lib/cjs/Differencing/Errors.js.map +1 -0
  6. package/lib/cjs/Differencing/SchemaConflicts.d.ts +0 -14
  7. package/lib/cjs/Differencing/SchemaConflicts.d.ts.map +1 -1
  8. package/lib/cjs/Differencing/SchemaConflicts.js +1 -14
  9. package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
  10. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts +4 -4
  11. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
  12. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +31 -31
  13. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
  14. package/lib/cjs/Differencing/SchemaDifference.d.ts +1 -1
  15. package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
  16. package/lib/cjs/Differencing/SchemaDifference.js +6 -6
  17. package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
  18. package/lib/cjs/Editing/Constants.d.ts +6 -6
  19. package/lib/cjs/Editing/Constants.d.ts.map +1 -1
  20. package/lib/cjs/Editing/Constants.js +26 -31
  21. package/lib/cjs/Editing/Constants.js.map +1 -1
  22. package/lib/cjs/Editing/CustomAttributes.d.ts +3 -3
  23. package/lib/cjs/Editing/CustomAttributes.d.ts.map +1 -1
  24. package/lib/cjs/Editing/CustomAttributes.js +18 -28
  25. package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
  26. package/lib/cjs/Editing/ECClasses.d.ts +24 -23
  27. package/lib/cjs/Editing/ECClasses.d.ts.map +1 -1
  28. package/lib/cjs/Editing/ECClasses.js +126 -156
  29. package/lib/cjs/Editing/ECClasses.js.map +1 -1
  30. package/lib/cjs/Editing/Editor.d.ts +10 -31
  31. package/lib/cjs/Editing/Editor.d.ts.map +1 -1
  32. package/lib/cjs/Editing/Editor.js +59 -43
  33. package/lib/cjs/Editing/Editor.js.map +1 -1
  34. package/lib/cjs/Editing/Entities.d.ts +9 -9
  35. package/lib/cjs/Editing/Entities.d.ts.map +1 -1
  36. package/lib/cjs/Editing/Entities.js +65 -85
  37. package/lib/cjs/Editing/Entities.js.map +1 -1
  38. package/lib/cjs/Editing/Enumerations.d.ts +6 -6
  39. package/lib/cjs/Editing/Enumerations.d.ts.map +1 -1
  40. package/lib/cjs/Editing/Enumerations.js +57 -55
  41. package/lib/cjs/Editing/Enumerations.js.map +1 -1
  42. package/lib/cjs/Editing/Exception.d.ts +257 -0
  43. package/lib/cjs/Editing/Exception.d.ts.map +1 -0
  44. package/lib/cjs/Editing/Exception.js +426 -0
  45. package/lib/cjs/Editing/Exception.js.map +1 -0
  46. package/lib/cjs/Editing/Formats.d.ts +6 -6
  47. package/lib/cjs/Editing/Formats.d.ts.map +1 -1
  48. package/lib/cjs/Editing/Formats.js +28 -33
  49. package/lib/cjs/Editing/Formats.js.map +1 -1
  50. package/lib/cjs/Editing/InvertedUnits.d.ts +6 -6
  51. package/lib/cjs/Editing/InvertedUnits.d.ts.map +1 -1
  52. package/lib/cjs/Editing/InvertedUnits.js +41 -56
  53. package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
  54. package/lib/cjs/Editing/KindOfQuantities.d.ts +6 -6
  55. package/lib/cjs/Editing/KindOfQuantities.d.ts.map +1 -1
  56. package/lib/cjs/Editing/KindOfQuantities.js +50 -57
  57. package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
  58. package/lib/cjs/Editing/Mixins.d.ts +5 -5
  59. package/lib/cjs/Editing/Mixins.d.ts.map +1 -1
  60. package/lib/cjs/Editing/Mixins.js +43 -58
  61. package/lib/cjs/Editing/Mixins.js.map +1 -1
  62. package/lib/cjs/Editing/Mutable/MutableArrayProperty.js.map +1 -1
  63. package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
  64. package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
  65. package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
  66. package/lib/cjs/Editing/Mutable/MutableEntityClass.d.ts +1 -5
  67. package/lib/cjs/Editing/Mutable/MutableEntityClass.d.ts.map +1 -1
  68. package/lib/cjs/Editing/Mutable/MutableEntityClass.js +1 -45
  69. package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
  70. package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
  71. package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
  72. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
  73. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
  74. package/lib/cjs/Editing/Mutable/MutableMixin.js.map +1 -1
  75. package/lib/cjs/Editing/Mutable/MutableNavigationProperty.js.map +1 -1
  76. package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
  77. package/lib/cjs/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -1
  78. package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
  79. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
  80. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
  81. package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
  82. package/lib/cjs/Editing/Mutable/MutableStructProperty.js.map +1 -1
  83. package/lib/cjs/Editing/Mutable/MutableUnit.js.map +1 -1
  84. package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
  85. package/lib/cjs/Editing/Phenomena.d.ts +7 -7
  86. package/lib/cjs/Editing/Phenomena.d.ts.map +1 -1
  87. package/lib/cjs/Editing/Phenomena.js +23 -23
  88. package/lib/cjs/Editing/Phenomena.js.map +1 -1
  89. package/lib/cjs/Editing/Properties.d.ts +7 -6
  90. package/lib/cjs/Editing/Properties.d.ts.map +1 -1
  91. package/lib/cjs/Editing/Properties.js +99 -46
  92. package/lib/cjs/Editing/Properties.js.map +1 -1
  93. package/lib/cjs/Editing/PropertyCategories.d.ts +6 -6
  94. package/lib/cjs/Editing/PropertyCategories.d.ts.map +1 -1
  95. package/lib/cjs/Editing/PropertyCategories.js +29 -27
  96. package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
  97. package/lib/cjs/Editing/RelationshipClasses.d.ts +15 -17
  98. package/lib/cjs/Editing/RelationshipClasses.d.ts.map +1 -1
  99. package/lib/cjs/Editing/RelationshipClasses.js +97 -101
  100. package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
  101. package/lib/cjs/Editing/SchemaItems.d.ts +13 -5
  102. package/lib/cjs/Editing/SchemaItems.d.ts.map +1 -1
  103. package/lib/cjs/Editing/SchemaItems.js +58 -6
  104. package/lib/cjs/Editing/SchemaItems.js.map +1 -1
  105. package/lib/cjs/Editing/Structs.d.ts +3 -3
  106. package/lib/cjs/Editing/Structs.d.ts.map +1 -1
  107. package/lib/cjs/Editing/Structs.js +17 -27
  108. package/lib/cjs/Editing/Structs.js.map +1 -1
  109. package/lib/cjs/Editing/UnitSystems.d.ts +7 -7
  110. package/lib/cjs/Editing/UnitSystems.d.ts.map +1 -1
  111. package/lib/cjs/Editing/UnitSystems.js +22 -20
  112. package/lib/cjs/Editing/UnitSystems.js.map +1 -1
  113. package/lib/cjs/Editing/Units.d.ts +6 -6
  114. package/lib/cjs/Editing/Units.d.ts.map +1 -1
  115. package/lib/cjs/Editing/Units.js +26 -35
  116. package/lib/cjs/Editing/Units.js.map +1 -1
  117. package/lib/cjs/Merging/CAClassMerger.js +2 -2
  118. package/lib/cjs/Merging/CAClassMerger.js.map +1 -1
  119. package/lib/cjs/Merging/ClassMerger.d.ts +1 -2
  120. package/lib/cjs/Merging/ClassMerger.d.ts.map +1 -1
  121. package/lib/cjs/Merging/ClassMerger.js +15 -39
  122. package/lib/cjs/Merging/ClassMerger.js.map +1 -1
  123. package/lib/cjs/Merging/ConstantMerger.d.ts.map +1 -1
  124. package/lib/cjs/Merging/ConstantMerger.js +2 -3
  125. package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
  126. package/lib/cjs/Merging/CustomAttributeMerger.d.ts +4 -5
  127. package/lib/cjs/Merging/CustomAttributeMerger.d.ts.map +1 -1
  128. package/lib/cjs/Merging/CustomAttributeMerger.js +8 -18
  129. package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
  130. package/lib/cjs/Merging/EntityClassMerger.d.ts +1 -2
  131. package/lib/cjs/Merging/EntityClassMerger.d.ts.map +1 -1
  132. package/lib/cjs/Merging/EntityClassMerger.js +3 -10
  133. package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
  134. package/lib/cjs/Merging/EnumerationMerger.d.ts.map +1 -1
  135. package/lib/cjs/Merging/EnumerationMerger.js +8 -10
  136. package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
  137. package/lib/cjs/Merging/KindOfQuantityMerger.d.ts.map +1 -1
  138. package/lib/cjs/Merging/KindOfQuantityMerger.js +2 -3
  139. package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
  140. package/lib/cjs/Merging/MixinMerger.js +2 -2
  141. package/lib/cjs/Merging/MixinMerger.js.map +1 -1
  142. package/lib/cjs/Merging/PhenomenonMerger.d.ts.map +1 -1
  143. package/lib/cjs/Merging/PhenomenonMerger.js +1 -2
  144. package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
  145. package/lib/cjs/Merging/PropertyCategoryMerger.d.ts.map +1 -1
  146. package/lib/cjs/Merging/PropertyCategoryMerger.js +1 -2
  147. package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -1
  148. package/lib/cjs/Merging/PropertyMerger.d.ts +2 -3
  149. package/lib/cjs/Merging/PropertyMerger.d.ts.map +1 -1
  150. package/lib/cjs/Merging/PropertyMerger.js +21 -42
  151. package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
  152. package/lib/cjs/Merging/RelationshipClassMerger.d.ts +5 -3
  153. package/lib/cjs/Merging/RelationshipClassMerger.d.ts.map +1 -1
  154. package/lib/cjs/Merging/RelationshipClassMerger.js +35 -33
  155. package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
  156. package/lib/cjs/Merging/SchemaItemMerger.d.ts +3 -4
  157. package/lib/cjs/Merging/SchemaItemMerger.d.ts.map +1 -1
  158. package/lib/cjs/Merging/SchemaItemMerger.js +3 -2
  159. package/lib/cjs/Merging/SchemaItemMerger.js.map +1 -1
  160. package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
  161. package/lib/cjs/Merging/SchemaMerger.js +8 -14
  162. package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
  163. package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
  164. package/lib/cjs/Merging/UnitSystemMerger.d.ts.map +1 -1
  165. package/lib/cjs/Merging/UnitSystemMerger.js +1 -2
  166. package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -1
  167. package/lib/cjs/Validation/Diagnostic.js.map +1 -1
  168. package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
  169. package/lib/cjs/Validation/ECRules.js.map +1 -1
  170. package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
  171. package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
  172. package/lib/cjs/Validation/Rules.js.map +1 -1
  173. package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
  174. package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
  175. package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
  176. package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
  177. package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
  178. package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
  179. package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
  180. package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
  181. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  182. package/lib/cjs/ecschema-editing.d.ts +1 -0
  183. package/lib/cjs/ecschema-editing.d.ts.map +1 -1
  184. package/lib/cjs/ecschema-editing.js +1 -0
  185. package/lib/cjs/ecschema-editing.js.map +1 -1
  186. package/package.json +9 -9
  187. package/public/locales/en/ECSchemaEditing.json +26 -26
@@ -1 +1 @@
1
- {"version":3,"file":"ECClasses.d.ts","sourceRoot":"","sources":["../../../src/Editing/ECClasses.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,eAAe,EACf,6BAA6B,EAEa,WAAW,EAAE,wBAAwB,EAAE,2BAA2B,EAC5G,sBAAsB,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,wBAAwB,EAC9F,WAAW,EAAE,mBAAmB,EACjC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAG3F,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEzH,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,WAAW,GAAG,cAAc,CAAC,WAAW,GAAG,cAAc,CAAC,iBAAiB,GAAG,cAAc,CAAC,KAAK,GAAG,cAAc,CAAC,oBAAoB,CAAC;AAEzL;;;GAGG;AACH,qBAAa,SAAS;IAEE,SAAS,CAAC,cAAc,EAAE,kBAAkB;IAAE,SAAS,CAAC,aAAa,EAAE,mBAAmB;IAAhH,SAAS,aAAuB,cAAc,EAAE,kBAAkB,EAAY,aAAa,EAAE,mBAAmB;IAEhH;;OAEG;IACH,SAAgB,UAAU,aAA2D;IACrF;;OAEG;IACH,SAAgB,eAAe,kBAAgE;IAC/F;;OAEG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EAAE,eAAe,EAAE,eAAe;YAM5F,kBAAkB;CAejC"}
@@ -12,34 +12,45 @@ const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
12
12
  const core_bentley_1 = require("@itwin/core-bentley");
13
13
  const Rules = require("../Validation/ECRules");
14
14
  const Properties_1 = require("./Properties");
15
+ const Exception_1 = require("./Exception");
16
+ const SchemaItems_1 = require("./SchemaItems");
15
17
  /**
16
18
  * @alpha
17
19
  * Acts as a base class for schema class creation. Enables property creation.
18
20
  */
19
- class ECClasses {
20
- constructor(schemaItemType, _schemaEditor) {
21
- this.schemaItemType = schemaItemType;
22
- this._schemaEditor = _schemaEditor;
21
+ class ECClasses extends SchemaItems_1.SchemaItems {
22
+ constructor(schemaItemType, schemaEditor) {
23
+ super(schemaItemType, schemaEditor);
23
24
  /**
24
25
  * Allows access for editing of base Property attributes.
25
26
  */
26
- this.properties = new Properties_1.Properties(this.schemaItemType, this._schemaEditor);
27
+ this.properties = new Properties_1.Properties(this.schemaItemType, this.schemaEditor);
27
28
  /**
28
29
  * Allows access for editing of ArrayProperty attributes.
29
30
  */
30
- this.arrayProperties = new Properties_1.ArrayProperties(this.schemaItemType, this._schemaEditor);
31
+ this.arrayProperties = new Properties_1.ArrayProperties(this.schemaItemType, this.schemaEditor);
31
32
  /**
32
33
  * Allows access for editing of PrimitiveProperty attributes.
33
34
  */
34
- this.primitiveProperties = new Properties_1.PrimitiveProperties(this.schemaItemType, this._schemaEditor);
35
+ this.primitiveProperties = new Properties_1.PrimitiveProperties(this.schemaItemType, this.schemaEditor);
35
36
  /**
36
37
  * Allows access for editing of EnumerationProperty attributes.
37
38
  */
38
- this.enumerationProperties = new Properties_1.EnumerationProperties(this.schemaItemType, this._schemaEditor);
39
+ this.enumerationProperties = new Properties_1.EnumerationProperties(this.schemaItemType, this.schemaEditor);
39
40
  /**
40
41
  * Allows access for editing of StructProperty attributes.
41
42
  */
42
- this.structProperties = new Properties_1.StructProperties(this.schemaItemType, this._schemaEditor);
43
+ this.structProperties = new Properties_1.StructProperties(this.schemaItemType, this.schemaEditor);
44
+ this.schemaItemType = schemaItemType;
45
+ }
46
+ async createClass(schemaKey, type, create, name, baseClassKey, ...args) {
47
+ const newClass = await this.createSchemaItem(schemaKey, type, create, name, ...args);
48
+ if (baseClassKey !== undefined) {
49
+ const baseClassSchema = !baseClassKey.schemaKey.matches(newClass.schema.schemaKey) ? await this.getSchema(baseClassKey.schemaKey) : newClass.schema;
50
+ const baseClassItem = await this.lookupSchemaItem(baseClassSchema, baseClassKey);
51
+ newClass.baseClass = new ecschema_metadata_1.DelayedPromiseWithProps(baseClassKey, async () => baseClassItem);
52
+ }
53
+ return newClass;
43
54
  }
44
55
  /**
45
56
  * Creates a property on class identified by the given SchemaItemKey. This method restricts the
@@ -49,21 +60,14 @@ class ECClasses {
49
60
  * @param type The PrimitiveType assigned to the new property.
50
61
  */
51
62
  async createProperty(classKey, name, type, prefix) {
52
- let mutableClass;
53
63
  if (type !== ecschema_metadata_1.PrimitiveType.Double && type !== ecschema_metadata_1.PrimitiveType.String && type !== ecschema_metadata_1.PrimitiveType.DateTime
54
64
  && type !== ecschema_metadata_1.PrimitiveType.Integer)
55
65
  throw new Error("Property creation is restricted to type Double, String, DateTime, and Integer.");
56
66
  if ("" === prefix)
57
67
  throw new Error("The specified property name prefix is invalid");
58
68
  const prefixedName = `${prefix}_${name}`;
59
- try {
60
- mutableClass = await this.getClass(classKey);
61
- }
62
- catch (e) {
63
- return { errorMessage: e.message };
64
- }
69
+ const mutableClass = await this.getClass(classKey);
65
70
  await mutableClass.createPrimitiveProperty(prefixedName, type);
66
- return { itemKey: classKey, propertyName: prefixedName };
67
71
  }
68
72
  /**
69
73
  * Create a primitive property on class identified by the given SchemaItemKey.
@@ -72,166 +76,142 @@ class ECClasses {
72
76
  * @param type The PrimitiveType assigned to the new property.
73
77
  */
74
78
  async createPrimitiveProperty(classKey, name, type) {
75
- let mutableClass;
76
79
  try {
77
- mutableClass = await this.getClass(classKey);
80
+ const mutableClass = await this.getClass(classKey);
81
+ await mutableClass.createPrimitiveProperty(name, type);
78
82
  }
79
83
  catch (e) {
80
- return { errorMessage: e.message };
84
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreatePrimitiveProperty, new Exception_1.PropertyId(this.schemaItemType, classKey, name), e);
81
85
  }
82
- await mutableClass.createPrimitiveProperty(name, type);
83
- return { itemKey: classKey, propertyName: name };
84
86
  }
85
87
  async createPrimitivePropertyFromProps(classKey, name, type, primitiveProps) {
86
- let mutableClass;
87
88
  try {
88
- mutableClass = await this.getClass(classKey);
89
+ const mutableClass = await this.getClass(classKey);
90
+ const newProperty = await mutableClass.createPrimitiveProperty(name, type);
91
+ await newProperty.fromJSON(primitiveProps);
89
92
  }
90
93
  catch (e) {
91
- return { errorMessage: e.message };
94
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreatePrimitivePropertyFromProps, new Exception_1.PropertyId(this.schemaItemType, classKey, name), e);
92
95
  }
93
- const newProperty = await mutableClass.createPrimitiveProperty(name, type);
94
- await newProperty.fromJSON(primitiveProps);
95
- return { itemKey: classKey, propertyName: name };
96
96
  }
97
97
  async createEnumerationProperty(classKey, name, type) {
98
- let mutableClass;
99
98
  try {
100
- mutableClass = await this.getClass(classKey);
99
+ const mutableClass = await this.getClass(classKey);
100
+ const enumSchemaItemKey = mutableClass.schema.getSchemaItemKey(type.fullName);
101
+ if (enumSchemaItemKey === undefined)
102
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SchemaItemNotFound, new Exception_1.SchemaItemId(ecschema_metadata_1.SchemaItemType.Enumeration, type.name, mutableClass.schema.schemaKey));
103
+ await mutableClass.createPrimitiveProperty(name, type);
101
104
  }
102
105
  catch (e) {
103
- return { errorMessage: e.message };
106
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateEnumerationProperty, new Exception_1.PropertyId(this.schemaItemType, classKey, name), e);
104
107
  }
105
- const enumSchemaItemKey = mutableClass.schema.getSchemaItemKey(type.fullName);
106
- if (enumSchemaItemKey === undefined)
107
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidECJson, `Unable to locate the enumeration ${type.fullName}.`);
108
- await mutableClass.createPrimitiveProperty(name, type);
109
- return { itemKey: classKey, propertyName: name };
110
108
  }
111
109
  async createEnumerationPropertyFromProps(classKey, name, type, enumProps) {
112
- let mutableClass;
113
110
  try {
114
- mutableClass = await this.getClass(classKey);
111
+ const mutableClass = await this.getClass(classKey);
112
+ const newProperty = await mutableClass.createPrimitiveProperty(name, type);
113
+ await newProperty.fromJSON(enumProps);
115
114
  }
116
115
  catch (e) {
117
- return { errorMessage: e.message };
116
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateEnumerationArrayPropertyFromProps, new Exception_1.PropertyId(this.schemaItemType, classKey, name), e);
118
117
  }
119
- const newProperty = await mutableClass.createPrimitiveProperty(name, type);
120
- await newProperty.fromJSON(enumProps);
121
- return { itemKey: classKey, propertyName: name };
122
118
  }
123
119
  async createPrimitiveArrayProperty(classKey, name, type) {
124
- let mutableClass;
125
120
  try {
126
- mutableClass = await this.getClass(classKey);
121
+ const mutableClass = await this.getClass(classKey);
122
+ await mutableClass.createPrimitiveArrayProperty(name, type);
127
123
  }
128
124
  catch (e) {
129
- return { errorMessage: e.message };
125
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreatePrimitiveArrayProperty, new Exception_1.PropertyId(this.schemaItemType, classKey, name), e);
130
126
  }
131
- await mutableClass.createPrimitiveArrayProperty(name, type);
132
- return { itemKey: classKey, propertyName: name };
133
127
  }
134
128
  async createPrimitiveArrayPropertyFromProps(classKey, name, type, primitiveProps) {
135
- let mutableClass;
136
129
  try {
137
- mutableClass = await this.getClass(classKey);
130
+ const mutableClass = await this.getClass(classKey);
131
+ const newProperty = await mutableClass.createPrimitiveArrayProperty(name, type);
132
+ await newProperty.fromJSON(primitiveProps);
138
133
  }
139
134
  catch (e) {
140
- return { errorMessage: e.message };
135
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreatePrimitiveArrayPropertyFromProps, new Exception_1.PropertyId(this.schemaItemType, classKey, name), e);
141
136
  }
142
- const newProperty = await mutableClass.createPrimitiveArrayProperty(name, type);
143
- await newProperty.fromJSON(primitiveProps);
144
- return { itemKey: classKey, propertyName: name };
145
137
  }
146
138
  async createEnumerationArrayProperty(classKey, name, type) {
147
- let mutableClass;
148
139
  try {
149
- mutableClass = await this.getClass(classKey);
140
+ const mutableClass = await this.getClass(classKey);
141
+ await mutableClass.createPrimitiveArrayProperty(name, type);
150
142
  }
151
143
  catch (e) {
152
- return { errorMessage: e.message };
144
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateEnumerationArrayProperty, new Exception_1.PropertyId(this.schemaItemType, classKey, name), e);
153
145
  }
154
- await mutableClass.createPrimitiveArrayProperty(name, type);
155
- return { itemKey: classKey, propertyName: name };
156
146
  }
157
147
  async createEnumerationArrayPropertyFromProps(classKey, name, type, props) {
158
- let mutableClass;
159
148
  try {
160
- mutableClass = await this.getClass(classKey);
149
+ const mutableClass = await this.getClass(classKey);
150
+ const newProperty = await mutableClass.createPrimitiveArrayProperty(name, type);
151
+ await newProperty.fromJSON(props);
161
152
  }
162
153
  catch (e) {
163
- return { errorMessage: e.message };
154
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateEnumerationArrayPropertyFromProps, new Exception_1.PropertyId(this.schemaItemType, classKey, name), e);
164
155
  }
165
- const newProperty = await mutableClass.createPrimitiveArrayProperty(name, type);
166
- await newProperty.fromJSON(props);
167
- return { itemKey: classKey, propertyName: name };
168
156
  }
169
157
  async createStructProperty(classKey, name, type) {
170
- let mutableClass;
171
158
  try {
172
- mutableClass = await this.getClass(classKey);
159
+ const mutableClass = await this.getClass(classKey);
160
+ await mutableClass.createStructProperty(name, type);
173
161
  }
174
162
  catch (e) {
175
- return { errorMessage: e.message };
163
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateStructProperty, new Exception_1.PropertyId(this.schemaItemType, classKey, name), e);
176
164
  }
177
- await mutableClass.createStructProperty(name, type);
178
- return { itemKey: classKey, propertyName: name };
179
165
  }
180
166
  async createStructPropertyFromProps(classKey, name, type, structProps) {
181
- let mutableClass;
182
167
  try {
183
- mutableClass = await this.getClass(classKey);
168
+ const mutableClass = await this.getClass(classKey);
169
+ const newProperty = await mutableClass.createStructProperty(name, type);
170
+ await newProperty.fromJSON(structProps);
184
171
  }
185
172
  catch (e) {
186
- return { errorMessage: e.message };
173
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateStructPropertyFromProps, new Exception_1.PropertyId(this.schemaItemType, classKey, name), e);
187
174
  }
188
- const newProperty = await mutableClass.createStructProperty(name, type);
189
- await newProperty.fromJSON(structProps);
190
- return { itemKey: classKey, propertyName: name };
191
175
  }
192
176
  async createStructArrayProperty(classKey, name, type) {
193
- let mutableClass;
194
177
  try {
195
- mutableClass = await this.getClass(classKey);
178
+ const mutableClass = await this.getClass(classKey);
179
+ await mutableClass.createStructArrayProperty(name, type);
196
180
  }
197
181
  catch (e) {
198
- return { errorMessage: e.message };
182
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateStructArrayProperty, new Exception_1.PropertyId(this.schemaItemType, classKey, name), e);
199
183
  }
200
- await mutableClass.createStructArrayProperty(name, type);
201
- return { itemKey: classKey, propertyName: name };
202
184
  }
203
185
  async createStructArrayPropertyFromProps(classKey, name, type, structProps) {
204
- let mutableClass;
205
186
  try {
206
- mutableClass = await this.getClass(classKey);
187
+ const mutableClass = await this.getClass(classKey);
188
+ const newProperty = await mutableClass.createStructArrayProperty(name, type);
189
+ await newProperty.fromJSON(structProps);
207
190
  }
208
191
  catch (e) {
209
- return { errorMessage: e.message };
192
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateStructArrayPropertyFromProps, new Exception_1.PropertyId(this.schemaItemType, classKey, name), e);
210
193
  }
211
- const newProperty = await mutableClass.createStructArrayProperty(name, type);
212
- await newProperty.fromJSON(structProps);
213
- return { itemKey: classKey, propertyName: name };
214
194
  }
215
195
  async deleteProperty(classKey, name) {
216
- let mutableClass;
217
196
  try {
218
- mutableClass = await this.getClass(classKey);
197
+ const mutableClass = await this.getClass(classKey);
198
+ await mutableClass.deleteProperty(name);
219
199
  }
220
200
  catch (e) {
221
- return { errorMessage: e.message };
201
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.DeleteProperty, new Exception_1.PropertyId(this.schemaItemType, classKey, name), e);
222
202
  }
223
- await mutableClass.deleteProperty(name);
224
- return { itemKey: classKey, propertyName: name };
225
203
  }
226
204
  async delete(classKey) {
227
- const schema = await this._schemaEditor.getSchema(classKey.schemaKey);
228
- if (schema === undefined)
229
- return { errorMessage: `Schema Key ${classKey.schemaKey.toString(true)} not found in context` };
230
- const ecClass = await schema.getItem(classKey.name);
231
- if (ecClass === undefined)
232
- return {};
233
- await schema.deleteClass(ecClass.name);
234
- return { itemKey: classKey };
205
+ try {
206
+ const schema = await this.getSchema(classKey.schemaKey);
207
+ const ecClass = await schema.getItem(classKey.name);
208
+ if (ecClass === undefined)
209
+ return;
210
+ await schema.deleteClass(ecClass.name);
211
+ }
212
+ catch (e) {
213
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.DeleteClass, new Exception_1.ClassId(this.schemaItemType, classKey), e);
214
+ }
235
215
  }
236
216
  /**
237
217
  * Adds a CustomAttribute instance to the Class identified by the given SchemaItemKey
@@ -239,24 +219,22 @@ class ECClasses {
239
219
  * @param customAttribute The CustomAttribute instance to add.
240
220
  */
241
221
  async addCustomAttribute(classKey, customAttribute) {
242
- let mutableClass;
243
222
  try {
244
- mutableClass = await this.getClass(classKey);
223
+ const mutableClass = await this.getClass(classKey);
224
+ mutableClass.addCustomAttribute(customAttribute);
225
+ const diagnosticIterable = Rules.validateCustomAttributeInstance(mutableClass, customAttribute);
226
+ const diagnostics = [];
227
+ for await (const diagnostic of diagnosticIterable) {
228
+ diagnostics.push(diagnostic);
229
+ }
230
+ if (diagnostics.length > 0) {
231
+ this.removeCustomAttribute(mutableClass, customAttribute);
232
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.RuleViolation, new Exception_1.CustomAttributeId(customAttribute.className, mutableClass), undefined, diagnostics);
233
+ }
245
234
  }
246
235
  catch (e) {
247
- return { errorMessage: e.message };
236
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.AddCustomAttributeToClass, new Exception_1.ClassId(this.schemaItemType, classKey), e);
248
237
  }
249
- mutableClass.addCustomAttribute(customAttribute);
250
- const diagnostics = Rules.validateCustomAttributeInstance(mutableClass, customAttribute);
251
- const result = { errorMessage: "" };
252
- for await (const diagnostic of diagnostics) {
253
- result.errorMessage += `${diagnostic.code}: ${diagnostic.messageText}\r\n`;
254
- }
255
- if (result.errorMessage) {
256
- this.removeCustomAttribute(mutableClass, customAttribute);
257
- return result;
258
- }
259
- return {};
260
238
  }
261
239
  /**
262
240
  * Sets the name of the ECClass.
@@ -265,26 +243,25 @@ class ECClasses {
265
243
  * @throws ECObjectsError if `name` does not meet the criteria for a valid EC name
266
244
  */
267
245
  async setName(classKey, name) {
268
- let mutableClass;
269
- const schema = await this._schemaEditor.getSchema(classKey.schemaKey);
270
- if (schema === undefined) {
271
- return { errorMessage: `Schema Key ${classKey.schemaKey.toString(true)} not found in context` };
272
- }
273
- const ecClass = await schema.getItem(name);
274
- if (ecClass !== undefined)
275
- return { errorMessage: `An EC Class with the name ${name} already exists within the schema ${schema.name}` };
276
246
  try {
277
- mutableClass = await this.getClass(classKey);
247
+ const schema = await this.getSchema(classKey.schemaKey);
248
+ const ecClass = await schema.getItem(name);
249
+ if (ecClass !== undefined)
250
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SchemaItemNameAlreadyExists, new Exception_1.ClassId(this.schemaItemType, name, schema.schemaKey));
251
+ const mutableClass = await this.getClass(classKey);
252
+ const existingName = classKey.name;
253
+ mutableClass.setName(name);
254
+ // Must reset in schema item map
255
+ await schema.deleteClass(existingName);
256
+ schema.addItem(mutableClass);
257
+ return mutableClass.key;
278
258
  }
279
259
  catch (e) {
280
- return { errorMessage: e.message };
281
- }
282
- const existingName = classKey.name;
283
- mutableClass.setName(name);
284
- // Must reset in schema item map
285
- await schema.deleteClass(existingName);
286
- schema.addItem(mutableClass);
287
- return {};
260
+ if (e instanceof ecschema_metadata_1.ECObjectsError && e.errorNumber === ecschema_metadata_1.ECObjectsStatus.InvalidECName) {
261
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SetClassName, new Exception_1.ClassId(this.schemaItemType, classKey), new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.InvalidECName, new Exception_1.ClassId(this.schemaItemType, classKey)));
262
+ }
263
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SetClassName, new Exception_1.ClassId(this.schemaItemType, classKey), e);
264
+ }
288
265
  }
289
266
  /**
290
267
  * Sets the base class of a SchemaItem.
@@ -292,34 +269,27 @@ class ECClasses {
292
269
  * @param baseClassKey The SchemaItemKey of the base class. Specifying 'undefined' removes the base class.
293
270
  */
294
271
  async setBaseClass(itemKey, baseClassKey) {
295
- const classItem = await this._schemaEditor.schemaContext.getSchemaItem(itemKey);
296
- if (classItem === undefined)
297
- return { itemKey, errorMessage: `Class ${itemKey.fullName} not found in schema context.` };
298
- if (baseClassKey === undefined) {
299
- classItem.baseClass = undefined;
300
- return { itemKey };
301
- }
302
- const baseClassSchema = !baseClassKey.schemaKey.matches(itemKey.schemaKey) ? await this._schemaEditor.getSchema(baseClassKey.schemaKey) : classItem.schema;
303
- if (baseClassSchema === undefined) {
304
- return { itemKey, errorMessage: `Schema Key ${baseClassKey.schemaKey.toString(true)} not found in context` };
305
- }
306
- const baseClassItem = await baseClassSchema.lookupItem(baseClassKey);
307
- if (baseClassItem === undefined)
308
- return { itemKey, errorMessage: `Unable to locate base class ${baseClassKey.fullName} in schema ${baseClassSchema.fullName}.` };
309
- if (baseClassItem.schemaItemType !== classItem.schemaItemType)
310
- return { itemKey, errorMessage: `${baseClassItem.fullName} is not of type ${classItem.schemaItemType}.` };
311
- if (classItem.baseClass !== undefined && !await baseClassItem.is(await classItem.baseClass))
312
- return { itemKey, errorMessage: `Baseclass ${baseClassItem.fullName} must derive from ${classItem.baseClass.fullName}.` };
313
- classItem.baseClass = new ecschema_metadata_1.DelayedPromiseWithProps(baseClassKey, async () => baseClassItem);
314
- return { itemKey };
272
+ try {
273
+ const classItem = await this.getSchemaItem(itemKey);
274
+ if (!baseClassKey) {
275
+ classItem.baseClass = undefined;
276
+ return;
277
+ }
278
+ const baseClassSchema = !baseClassKey.schemaKey.matches(itemKey.schemaKey) ? await this.getSchema(baseClassKey.schemaKey) : classItem.schema;
279
+ const baseClassItem = await this.lookupSchemaItem(baseClassSchema, baseClassKey);
280
+ if (classItem.baseClass !== undefined && !await baseClassItem.is(await classItem.baseClass))
281
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.InvalidBaseClass, new Exception_1.ClassId(this.schemaItemType, baseClassKey), undefined, undefined, `Base class ${baseClassKey.fullName} must derive from ${(await classItem.baseClass).fullName}.`);
282
+ classItem.baseClass = new ecschema_metadata_1.DelayedPromiseWithProps(baseClassKey, async () => baseClassItem);
283
+ }
284
+ catch (e) {
285
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SetBaseClass, new Exception_1.ClassId(this.schemaItemType, itemKey), e);
286
+ }
315
287
  }
316
288
  async getClass(classKey) {
317
- const schema = await this._schemaEditor.getSchema(classKey.schemaKey);
318
- if (schema === undefined)
319
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.UnableToLocateSchema, `Schema Key ${classKey.schemaKey.toString(true)} not found in context`);
289
+ const schema = await this.getSchema(classKey.schemaKey);
320
290
  const ecClass = await schema.getItem(classKey.name);
321
291
  if (ecClass === undefined)
322
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Class ${classKey.name} was not found in schema ${classKey.schemaKey.toString(true)}`);
292
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SchemaItemNotFound, new Exception_1.ClassId(this.schemaItemType, classKey));
323
293
  switch (ecClass.schemaItemType) {
324
294
  case ecschema_metadata_1.SchemaItemType.EntityClass:
325
295
  case ecschema_metadata_1.SchemaItemType.Mixin:
@@ -328,7 +298,7 @@ class ECClasses {
328
298
  case ecschema_metadata_1.SchemaItemType.RelationshipClass:
329
299
  break;
330
300
  default:
331
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Schema item type not supported`);
301
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.InvalidSchemaItemType, new Exception_1.ClassId(this.schemaItemType, classKey));
332
302
  }
333
303
  return ecClass;
334
304
  }
@@ -339,7 +309,7 @@ class ECClasses {
339
309
  }
340
310
  async findDerivedClasses(mutableClass) {
341
311
  const derivedClasses = [];
342
- const schemaItems = this._schemaEditor.schemaContext.getSchemaItems();
312
+ const schemaItems = this.schemaEditor.schemaContext.getSchemaItems();
343
313
  let { value, done } = schemaItems.next();
344
314
  while (!done) {
345
315
  if (await value.is(mutableClass)) {
@@ -1 +1 @@
1
- {"version":3,"file":"ECClasses.js","sourceRoot":"","sources":["../../../src/Editing/ECClasses.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAOkC;AAClC,sDAA6C;AAG7C,+CAA+C;AAC/C,6CAAyH;AAIzH;;;GAGG;AACH,MAAa,SAAS;IAEpB,YAAgC,cAAkC,EAAY,aAAkC;QAAhF,mBAAc,GAAd,cAAc,CAAoB;QAAY,kBAAa,GAAb,aAAa,CAAqB;QAEhH;;WAEG;QACa,eAAU,GAAG,IAAI,uBAAU,CAAC,IAAI,CAAC,cAAc,EAA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,CAAC,CAAC;QACzC,CAAC;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;CACF;AA/XD,8BA+XC","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 Editing\n */\n\nimport {\n CustomAttribute,\n CustomAttributeContainerProps,\n DelayedPromiseWithProps,\n ECClass, ECObjectsError, ECObjectsStatus, Enumeration, EnumerationPropertyProps, PrimitiveArrayPropertyProps,\n PrimitivePropertyProps, PrimitiveType, SchemaItemKey, SchemaItemType, StructArrayPropertyProps,\n StructClass, StructPropertyProps,\n} from \"@itwin/ecschema-metadata\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { PropertyEditResults, SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\nimport { MutableClass } from \"./Mutable/MutableClass\";\nimport * as Rules from \"../Validation/ECRules\";\nimport { ArrayProperties, EnumerationProperties, PrimitiveProperties, Properties, StructProperties } from \"./Properties\";\n\nexport type ECClassSchemaItems = SchemaItemType.EntityClass | SchemaItemType.StructClass | SchemaItemType.RelationshipClass | SchemaItemType.Mixin | SchemaItemType.CustomAttributeClass;\n\n/**\n * @alpha\n * Acts as a base class for schema class creation. Enables property creation.\n */\nexport class ECClasses {\n\n protected constructor(protected schemaItemType: ECClassSchemaItems, protected _schemaEditor: SchemaContextEditor) { }\n\n /**\n * Allows access for editing of base Property attributes.\n */\n public readonly properties = new Properties(this.schemaItemType, this._schemaEditor);\n /**\n * Allows access for editing of ArrayProperty attributes.\n */\n public readonly arrayProperties = new ArrayProperties(this.schemaItemType, this._schemaEditor);\n /**\n * Allows access for editing of PrimitiveProperty attributes.\n */\n public readonly primitiveProperties = new PrimitiveProperties(this.schemaItemType, this._schemaEditor);\n /**\n * Allows access for editing of EnumerationProperty attributes.\n */\n public readonly enumerationProperties = new EnumerationProperties(this.schemaItemType, this._schemaEditor);\n /**\n * Allows access for editing of StructProperty attributes.\n */\n public readonly structProperties = new StructProperties(this.schemaItemType, this._schemaEditor);\n\n /**\n * Creates a property on class identified by the given SchemaItemKey. This method restricts the\n * property type to primitives of type Double, String, DateTime and Integer.\n * @param classKey The SchemaItemKey of the class.\n * @param name The name of the new property.\n * @param type The PrimitiveType assigned to the new property.\n */\n public async createProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType, prefix: string): Promise<PropertyEditResults> {\n let mutableClass: MutableClass;\n\n if (type !== PrimitiveType.Double && type !== PrimitiveType.String && type !== PrimitiveType.DateTime\n && type !== PrimitiveType.Integer)\n throw new Error (\"Property creation is restricted to type Double, String, DateTime, and Integer.\");\n\n if (\"\" === prefix)\n throw new Error(\"The specified property name prefix is invalid\");\n\n const prefixedName = `${prefix}_${name}`;\n\n try {\n mutableClass = await this.getClass(classKey);\n } catch (e: any) {\n return { errorMessage: e.message };\n }\n\n await mutableClass.createPrimitiveProperty(prefixedName, type);\n return { itemKey: classKey, propertyName: prefixedName };\n }\n\n /**\n * Create a primitive property on class identified by the given SchemaItemKey.\n * @param classKey The SchemaItemKey of the class.\n * @param name The name of the new property.\n * @param type The PrimitiveType assigned to the new property.\n */\n public async createPrimitiveProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType): Promise<PropertyEditResults> {\n let mutableClass: MutableClass;\n try {\n mutableClass = await this.getClass(classKey);\n } catch (e: any) {\n return { errorMessage: e.message };\n }\n\n await mutableClass.createPrimitiveProperty(name, type);\n return { itemKey: classKey, propertyName: name };\n }\n\n public async createPrimitivePropertyFromProps(classKey: SchemaItemKey, name: string, type: PrimitiveType, primitiveProps: PrimitivePropertyProps): Promise<PropertyEditResults> {\n let mutableClass: MutableClass;\n try {\n mutableClass = await this.getClass(classKey);\n } catch (e: any) {\n return { errorMessage: e.message };\n }\n\n const newProperty = await mutableClass.createPrimitiveProperty(name, type);\n await newProperty.fromJSON(primitiveProps);\n return { itemKey: classKey, propertyName: name };\n }\n\n public async createEnumerationProperty(classKey: SchemaItemKey, name: string, type: Enumeration): Promise<PropertyEditResults> {\n let mutableClass: MutableClass;\n try {\n mutableClass = await this.getClass(classKey);\n } catch (e: any) {\n return { errorMessage: e.message };\n }\n\n const enumSchemaItemKey = mutableClass.schema.getSchemaItemKey(type.fullName);\n if (enumSchemaItemKey === undefined)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the enumeration ${type.fullName}.`);\n\n await mutableClass.createPrimitiveProperty(name, type);\n return { itemKey: classKey, propertyName: name };\n }\n\n public async createEnumerationPropertyFromProps(classKey: SchemaItemKey, name: string, type: Enumeration, enumProps: EnumerationPropertyProps): Promise<PropertyEditResults> {\n let mutableClass: MutableClass;\n try {\n mutableClass = await this.getClass(classKey);\n } catch (e: any) {\n return { errorMessage: e.message };\n }\n\n const newProperty = await mutableClass.createPrimitiveProperty(name, type);\n await newProperty.fromJSON(enumProps);\n return { itemKey: classKey, propertyName: name };\n }\n\n public async createPrimitiveArrayProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType): Promise<PropertyEditResults> {\n let mutableClass: MutableClass;\n try {\n mutableClass = await this.getClass(classKey);\n } catch (e: any) {\n return { errorMessage: e.message };\n }\n\n await mutableClass.createPrimitiveArrayProperty(name, type);\n return { itemKey: classKey, propertyName: name };\n }\n\n public async createPrimitiveArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: PrimitiveType, primitiveProps: PrimitiveArrayPropertyProps): Promise<PropertyEditResults> {\n let mutableClass: MutableClass;\n try {\n mutableClass = await this.getClass(classKey);\n } catch (e: any) {\n return { errorMessage: e.message };\n }\n\n const newProperty = await mutableClass.createPrimitiveArrayProperty(name, type);\n await newProperty.fromJSON(primitiveProps);\n return { itemKey: classKey, propertyName: name };\n }\n\n public async createEnumerationArrayProperty(classKey: SchemaItemKey, name: string, type: Enumeration): Promise<PropertyEditResults> {\n let mutableClass: MutableClass;\n try {\n mutableClass = await this.getClass(classKey);\n } catch (e: any) {\n return { errorMessage: e.message };\n }\n\n await mutableClass.createPrimitiveArrayProperty(name, type);\n return { itemKey: classKey, propertyName: name };\n }\n\n public async createEnumerationArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: Enumeration, props: PrimitiveArrayPropertyProps): Promise<PropertyEditResults> {\n let mutableClass: MutableClass;\n try {\n mutableClass = await this.getClass(classKey);\n } catch (e: any) {\n return { errorMessage: e.message };\n }\n\n const newProperty = await mutableClass.createPrimitiveArrayProperty(name, type);\n await newProperty.fromJSON(props);\n return { itemKey: classKey, propertyName: name };\n }\n\n public async createStructProperty(classKey: SchemaItemKey, name: string, type: StructClass): Promise<PropertyEditResults> {\n let mutableClass: MutableClass;\n try {\n mutableClass = await this.getClass(classKey);\n } catch (e: any) {\n return { errorMessage: e.message };\n }\n\n await mutableClass.createStructProperty(name, type);\n return { itemKey: classKey, propertyName: name };\n }\n\n public async createStructPropertyFromProps(classKey: SchemaItemKey, name: string, type: StructClass, structProps: StructPropertyProps): Promise<PropertyEditResults> {\n let mutableClass: MutableClass;\n try {\n mutableClass = await this.getClass(classKey);\n } catch (e: any) {\n return { errorMessage: e.message };\n }\n\n const newProperty = await mutableClass.createStructProperty(name, type);\n await newProperty.fromJSON(structProps);\n return { itemKey: classKey, propertyName: name };\n }\n\n public async createStructArrayProperty(classKey: SchemaItemKey, name: string, type: StructClass): Promise<PropertyEditResults> {\n let mutableClass: MutableClass;\n try {\n mutableClass = await this.getClass(classKey);\n } catch (e: any) {\n return { errorMessage: e.message };\n }\n\n await mutableClass.createStructArrayProperty(name, type);\n return { itemKey: classKey, propertyName: name };\n }\n\n public async createStructArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: StructClass, structProps: StructArrayPropertyProps): Promise<PropertyEditResults> {\n let mutableClass: MutableClass;\n try {\n mutableClass = await this.getClass(classKey);\n } catch (e: any) {\n return { errorMessage: e.message };\n }\n\n const newProperty = await mutableClass.createStructArrayProperty(name, type);\n await newProperty.fromJSON(structProps);\n return { itemKey: classKey, propertyName: name };\n }\n\n public async deleteProperty(classKey: SchemaItemKey, name: string): Promise<PropertyEditResults> {\n let mutableClass: MutableClass;\n try {\n mutableClass = await this.getClass(classKey);\n } catch (e: any) {\n return { errorMessage: e.message };\n }\n\n await mutableClass.deleteProperty(name);\n return { itemKey: classKey, propertyName: name };\n }\n\n public async delete(classKey: SchemaItemKey): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(classKey.schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${classKey.schemaKey.toString(true)} not found in context` };\n\n const ecClass = await schema.getItem<ECClass>(classKey.name);\n if (ecClass === undefined)\n return {};\n\n await schema.deleteClass(ecClass.name);\n\n return { itemKey: classKey };\n }\n\n /**\n * Adds a CustomAttribute instance to the Class identified by the given SchemaItemKey\n * @param classKey The SchemaItemKey identifying the schema.\n * @param customAttribute The CustomAttribute instance to add.\n */\n public async addCustomAttribute(classKey: SchemaItemKey, customAttribute: CustomAttribute): Promise<SchemaItemEditResults> {\n let mutableClass: MutableClass;\n try {\n mutableClass = await this.getClass(classKey);\n } catch (e: any) {\n return { errorMessage: e.message };\n }\n\n mutableClass.addCustomAttribute(customAttribute);\n\n const diagnostics = Rules.validateCustomAttributeInstance(mutableClass, customAttribute);\n\n const result: SchemaItemEditResults = { errorMessage: \"\" };\n for await (const diagnostic of diagnostics) {\n result.errorMessage += `${diagnostic.code}: ${diagnostic.messageText}\\r\\n`;\n }\n\n if (result.errorMessage) {\n this.removeCustomAttribute(mutableClass, customAttribute);\n return result;\n }\n\n return {};\n }\n\n /**\n * Sets the name of the ECClass.\n * @param classKey The SchemaItemKey of the class.\n * @param name The new name of the class.\n * @throws ECObjectsError if `name` does not meet the criteria for a valid EC name\n */\n public async setName(classKey: SchemaItemKey, name: string): Promise<SchemaItemEditResults> {\n let mutableClass: MutableClass;\n\n const schema = await this._schemaEditor.getSchema(classKey.schemaKey);\n if (schema === undefined) {\n return { errorMessage: `Schema Key ${classKey.schemaKey.toString(true)} not found in context` };\n }\n\n const ecClass = await schema.getItem<MutableClass>(name);\n if (ecClass !== undefined)\n return { errorMessage: `An EC Class with the name ${name} already exists within the schema ${schema.name}` };\n\n try {\n mutableClass = await this.getClass(classKey);\n } catch (e: any) {\n return { errorMessage: e.message };\n }\n\n const existingName = classKey.name;\n mutableClass.setName(name);\n\n // Must reset in schema item map\n await schema.deleteClass(existingName);\n schema.addItem(mutableClass);\n\n return {};\n }\n\n /**\n * Sets the base class of a SchemaItem.\n * @param itemKey The SchemaItemKey of the Item.\n * @param baseClassKey The SchemaItemKey of the base class. Specifying 'undefined' removes the base class.\n */\n public async setBaseClass(itemKey: SchemaItemKey, baseClassKey?: SchemaItemKey): Promise<SchemaItemEditResults> {\n const classItem = await this._schemaEditor.schemaContext.getSchemaItem<MutableClass>(itemKey);\n\n if (classItem === undefined)\n return { itemKey, errorMessage: `Class ${itemKey.fullName} not found in schema context.` };\n\n if (baseClassKey === undefined) {\n classItem.baseClass = undefined;\n return { itemKey };\n }\n\n const baseClassSchema = !baseClassKey.schemaKey.matches(itemKey.schemaKey) ? await this._schemaEditor.getSchema(baseClassKey.schemaKey) : classItem.schema;\n if (baseClassSchema === undefined) {\n return { itemKey, errorMessage: `Schema Key ${baseClassKey.schemaKey.toString(true)} not found in context` };\n }\n\n const baseClassItem = await baseClassSchema.lookupItem<ECClass>(baseClassKey);\n if (baseClassItem === undefined)\n return { itemKey, errorMessage: `Unable to locate base class ${baseClassKey.fullName} in schema ${baseClassSchema.fullName}.` };\n\n if (baseClassItem.schemaItemType !== classItem.schemaItemType)\n return { itemKey, errorMessage: `${baseClassItem.fullName} is not of type ${classItem.schemaItemType}.` };\n\n if (classItem.baseClass !== undefined && !await baseClassItem.is(await classItem.baseClass))\n return { itemKey, errorMessage: `Baseclass ${baseClassItem.fullName} must derive from ${classItem.baseClass.fullName}.`};\n\n classItem.baseClass = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(baseClassKey, async () => baseClassItem);\n return { itemKey };\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<MutableClass>(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 switch (ecClass.schemaItemType) {\n case SchemaItemType.EntityClass:\n case SchemaItemType.Mixin:\n case SchemaItemType.StructClass:\n case SchemaItemType.CustomAttributeClass:\n case SchemaItemType.RelationshipClass:\n break;\n default:\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Schema item type not supported`);\n }\n\n return ecClass;\n }\n\n protected removeCustomAttribute(container: CustomAttributeContainerProps, customAttribute: CustomAttribute) {\n assert(container.customAttributes !== undefined);\n const map = container.customAttributes as Map<string, CustomAttribute>;\n map.delete(customAttribute.className);\n }\n\n private async findDerivedClasses(mutableClass: MutableClass): Promise<Array<MutableClass>>{\n const derivedClasses: Array<MutableClass> = [];\n const schemaItems = this._schemaEditor.schemaContext.getSchemaItems();\n let { value, done } = schemaItems.next();\n while (!done) {\n if (await value.is(mutableClass)) {\n if (!mutableClass.key.matches(value.key)) {\n derivedClasses.push(value);\n }\n }\n ({ value, done } = schemaItems.next());\n }\n\n return derivedClasses;\n }\n}\n"]}
1
+ {"version":3,"file":"ECClasses.js","sourceRoot":"","sources":["../../../src/Editing/ECClasses.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAOkC;AAClC,sDAA6C;AAG7C,+CAA+C;AAC/C,6CAAyH;AACzH,2CAAwH;AAExH,+CAA8D;AAK9D;;;GAGG;AACH,MAAa,SAAU,SAAQ,yBAAW;IAExC,YAAsB,cAAkC,EAAE,YAAiC;QACzF,KAAK,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC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,KAAK,CAAC,kBAAkB,CAAC,YAA0B;QACzD,MAAM,cAAc,GAAwB,EAAE,CAAC;QAC/C,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;QACrE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;QACzC,OAAO,CAAC,IAAI,EAAE,CAAC;YACb,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC;gBACjC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;oBACzC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAC7B,CAAC;YACH,CAAC;YACD,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QACzC,CAAC;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;CACF;AA9UD,8BA8UC","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 Editing\r\n */\r\n\r\nimport {\r\n CustomAttribute,\r\n CustomAttributeContainerProps,\r\n DelayedPromiseWithProps,\r\n ECClass, ECObjectsError, ECObjectsStatus, Enumeration, EnumerationPropertyProps, PrimitiveArrayPropertyProps,\r\n PrimitivePropertyProps, PrimitiveType, SchemaItemKey, SchemaItemType, SchemaKey, StructArrayPropertyProps,\r\n StructClass, StructPropertyProps,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableClass } from \"./Mutable/MutableClass\";\r\nimport * as Rules from \"../Validation/ECRules\";\r\nimport { ArrayProperties, EnumerationProperties, PrimitiveProperties, Properties, StructProperties } from \"./Properties\";\r\nimport { ClassId, CustomAttributeId, ECEditingStatus, PropertyId, SchemaEditingError, SchemaItemId } from \"./Exception\";\r\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { CreateSchemaItem, SchemaItems } from \"./SchemaItems\";\r\nimport { MutableSchema } from \"./Mutable/MutableSchema\";\r\n\r\nexport type ECClassSchemaItems = SchemaItemType.EntityClass | SchemaItemType.StructClass | SchemaItemType.RelationshipClass | SchemaItemType.Mixin | SchemaItemType.CustomAttributeClass;\r\n\r\n/**\r\n * @alpha\r\n * Acts as a base class for schema class creation. Enables property creation.\r\n */\r\nexport class ECClasses extends SchemaItems{\r\n\r\n protected constructor(schemaItemType: ECClassSchemaItems, schemaEditor: SchemaContextEditor) {\r\n super(schemaItemType, schemaEditor);\r\n this.schemaItemType = schemaItemType;\r\n }\r\n\r\n protected override schemaItemType: ECClassSchemaItems;\r\n\r\n /**\r\n * Allows access for editing of base Property attributes.\r\n */\r\n public readonly properties = new Properties(this.schemaItemType, this.schemaEditor);\r\n /**\r\n * Allows access for editing of ArrayProperty attributes.\r\n */\r\n public readonly arrayProperties = new ArrayProperties(this.schemaItemType, this.schemaEditor);\r\n /**\r\n * Allows access for editing of PrimitiveProperty attributes.\r\n */\r\n public readonly primitiveProperties = new PrimitiveProperties(this.schemaItemType, this.schemaEditor);\r\n /**\r\n * Allows access for editing of EnumerationProperty attributes.\r\n */\r\n public readonly enumerationProperties = new EnumerationProperties(this.schemaItemType, this.schemaEditor);\r\n /**\r\n * Allows access for editing of StructProperty attributes.\r\n */\r\n public readonly structProperties = new StructProperties(this.schemaItemType, this.schemaEditor);\r\n\r\n public async createClass<T extends ECClass>(schemaKey: SchemaKey, type: SchemaItemType, create: CreateSchemaItem<T>, name: string, baseClassKey?: SchemaItemKey, ...args: any[]): Promise<T> {\r\n const newClass = await this.createSchemaItem(schemaKey, type, create, name, ...args);\r\n\r\n if (baseClassKey !== undefined) {\r\n const baseClassSchema = !baseClassKey.schemaKey.matches(newClass.schema.schemaKey) ? await this.getSchema(baseClassKey.schemaKey) : newClass.schema as MutableSchema;\r\n const baseClassItem = await this.lookupSchemaItem<ECClass>(baseClassSchema, baseClassKey);\r\n newClass.baseClass = new DelayedPromiseWithProps<SchemaItemKey, T>(baseClassKey, async () => baseClassItem as T);\r\n }\r\n\r\n return newClass;\r\n }\r\n\r\n /**\r\n * Creates a property on class identified by the given SchemaItemKey. This method restricts the\r\n * property type to primitives of type Double, String, DateTime and Integer.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param name The name of the new property.\r\n * @param type The PrimitiveType assigned to the new property.\r\n */\r\n public async createProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType, prefix: string): Promise<void> {\r\n if (type !== PrimitiveType.Double && type !== PrimitiveType.String && type !== PrimitiveType.DateTime\r\n && type !== PrimitiveType.Integer)\r\n throw new Error (\"Property creation is restricted to type Double, String, DateTime, and Integer.\");\r\n\r\n if (\"\" === prefix)\r\n throw new Error(\"The specified property name prefix is invalid\");\r\n\r\n const prefixedName = `${prefix}_${name}`;\r\n\r\n const mutableClass = await this.getClass(classKey);\r\n\r\n await mutableClass.createPrimitiveProperty(prefixedName, type);\r\n }\r\n\r\n /**\r\n * Create a primitive property on class identified by the given SchemaItemKey.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param name The name of the new property.\r\n * @param type The PrimitiveType assigned to the new property.\r\n */\r\n public async createPrimitiveProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.createPrimitiveProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreatePrimitiveProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createPrimitivePropertyFromProps(classKey: SchemaItemKey, name: string, type: PrimitiveType, primitiveProps: PrimitivePropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createPrimitiveProperty(name, type);\r\n await newProperty.fromJSON(primitiveProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreatePrimitivePropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createEnumerationProperty(classKey: SchemaItemKey, name: string, type: Enumeration): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const enumSchemaItemKey = mutableClass.schema.getSchemaItemKey(type.fullName);\r\n if (enumSchemaItemKey === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new SchemaItemId(SchemaItemType.Enumeration, type.name, mutableClass.schema.schemaKey));\r\n\r\n await mutableClass.createPrimitiveProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateEnumerationProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createEnumerationPropertyFromProps(classKey: SchemaItemKey, name: string, type: Enumeration, enumProps: EnumerationPropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createPrimitiveProperty(name, type);\r\n await newProperty.fromJSON(enumProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateEnumerationArrayPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createPrimitiveArrayProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.createPrimitiveArrayProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreatePrimitiveArrayProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createPrimitiveArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: PrimitiveType, primitiveProps: PrimitiveArrayPropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createPrimitiveArrayProperty(name, type);\r\n await newProperty.fromJSON(primitiveProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreatePrimitiveArrayPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createEnumerationArrayProperty(classKey: SchemaItemKey, name: string, type: Enumeration): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.createPrimitiveArrayProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateEnumerationArrayProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createEnumerationArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: Enumeration, props: PrimitiveArrayPropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createPrimitiveArrayProperty(name, type);\r\n await newProperty.fromJSON(props);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateEnumerationArrayPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createStructProperty(classKey: SchemaItemKey, name: string, type: StructClass): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.createStructProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateStructProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createStructPropertyFromProps(classKey: SchemaItemKey, name: string, type: StructClass, structProps: StructPropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createStructProperty(name, type);\r\n await newProperty.fromJSON(structProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateStructPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createStructArrayProperty(classKey: SchemaItemKey, name: string, type: StructClass): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.createStructArrayProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateStructArrayProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createStructArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: StructClass, structProps: StructArrayPropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createStructArrayProperty(name, type);\r\n await newProperty.fromJSON(structProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateStructArrayPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async deleteProperty(classKey: SchemaItemKey, name: string): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.deleteProperty(name);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.DeleteProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async delete(classKey: SchemaItemKey): Promise<void> {\r\n try {\r\n const schema = await this.getSchema(classKey.schemaKey);\r\n const ecClass = await schema.getItem<ECClass>(classKey.name);\r\n if (ecClass === undefined)\r\n return;\r\n\r\n await schema.deleteClass(ecClass.name);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.DeleteClass, new ClassId(this.schemaItemType, classKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Adds a CustomAttribute instance to the Class identified by the given SchemaItemKey\r\n * @param classKey The SchemaItemKey identifying the schema.\r\n * @param customAttribute The CustomAttribute instance to add.\r\n */\r\n public async addCustomAttribute(classKey: SchemaItemKey, customAttribute: CustomAttribute): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n mutableClass.addCustomAttribute(customAttribute);\r\n\r\n const diagnosticIterable = Rules.validateCustomAttributeInstance(mutableClass, customAttribute);\r\n\r\n const diagnostics: AnyDiagnostic[] = [];\r\n for await (const diagnostic of diagnosticIterable) {\r\n diagnostics.push(diagnostic);\r\n }\r\n\r\n if (diagnostics.length > 0) {\r\n this.removeCustomAttribute(mutableClass, customAttribute);\r\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, mutableClass), undefined, diagnostics);\r\n }\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToClass, new ClassId(this.schemaItemType, classKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Sets the name of the ECClass.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param name The new name of the class.\r\n * @throws ECObjectsError if `name` does not meet the criteria for a valid EC name\r\n */\r\n public async setName(classKey: SchemaItemKey, name: string): Promise<SchemaItemKey> {\r\n try {\r\n const schema = await this.getSchema(classKey.schemaKey);\r\n const ecClass = await schema.getItem<MutableClass>(name);\r\n if (ecClass !== undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNameAlreadyExists, new ClassId(this.schemaItemType, name, schema.schemaKey));\r\n\r\n const mutableClass = await this.getClass(classKey);\r\n\r\n const existingName = classKey.name;\r\n mutableClass.setName(name);\r\n\r\n // Must reset in schema item map\r\n await schema.deleteClass(existingName);\r\n schema.addItem(mutableClass);\r\n return mutableClass.key;\r\n } catch(e: any) {\r\n if (e instanceof ECObjectsError && e.errorNumber === ECObjectsStatus.InvalidECName) {\r\n throw new SchemaEditingError(ECEditingStatus.SetClassName, new ClassId(this.schemaItemType, classKey),\r\n new SchemaEditingError(ECEditingStatus.InvalidECName, new ClassId(this.schemaItemType, classKey)));\r\n }\r\n\r\n throw new SchemaEditingError(ECEditingStatus.SetClassName, new ClassId(this.schemaItemType, classKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Sets the base class of a SchemaItem.\r\n * @param itemKey The SchemaItemKey of the Item.\r\n * @param baseClassKey The SchemaItemKey of the base class. Specifying 'undefined' removes the base class.\r\n */\r\n public async setBaseClass(itemKey: SchemaItemKey, baseClassKey?: SchemaItemKey): Promise<void> {\r\n try {\r\n const classItem = await this.getSchemaItem<ECClass>(itemKey);\r\n if (!baseClassKey) {\r\n classItem.baseClass = undefined;\r\n return;\r\n }\r\n\r\n const baseClassSchema = !baseClassKey.schemaKey.matches(itemKey.schemaKey) ? await this.getSchema(baseClassKey.schemaKey) : classItem.schema as MutableSchema;\r\n const baseClassItem = await this.lookupSchemaItem<ECClass>(baseClassSchema, baseClassKey);\r\n if (classItem.baseClass !== undefined && !await baseClassItem.is(await classItem.baseClass))\r\n throw new SchemaEditingError(ECEditingStatus.InvalidBaseClass, new ClassId(this.schemaItemType, baseClassKey), undefined, undefined, `Base class ${baseClassKey.fullName} must derive from ${(await classItem.baseClass).fullName}.`);\r\n\r\n classItem.baseClass = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(baseClassKey, async () => baseClassItem);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.SetBaseClass, new ClassId(this.schemaItemType, itemKey), e);\r\n }\r\n }\r\n\r\n private async getClass(classKey: SchemaItemKey): Promise<MutableClass> {\r\n const schema = await this.getSchema(classKey.schemaKey);\r\n\r\n const ecClass = await schema.getItem<MutableClass>(classKey.name);\r\n if (ecClass === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new ClassId(this.schemaItemType, classKey));\r\n\r\n switch (ecClass.schemaItemType) {\r\n case SchemaItemType.EntityClass:\r\n case SchemaItemType.Mixin:\r\n case SchemaItemType.StructClass:\r\n case SchemaItemType.CustomAttributeClass:\r\n case SchemaItemType.RelationshipClass:\r\n break;\r\n default:\r\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new ClassId(this.schemaItemType, classKey));\r\n }\r\n\r\n return ecClass;\r\n }\r\n\r\n protected removeCustomAttribute(container: CustomAttributeContainerProps, customAttribute: CustomAttribute) {\r\n assert(container.customAttributes !== undefined);\r\n const map = container.customAttributes as Map<string, CustomAttribute>;\r\n map.delete(customAttribute.className);\r\n }\r\n\r\n private async findDerivedClasses(mutableClass: MutableClass): Promise<Array<MutableClass>>{\r\n const derivedClasses: Array<MutableClass> = [];\r\n const schemaItems = this.schemaEditor.schemaContext.getSchemaItems();\r\n let { value, done } = schemaItems.next();\r\n while (!done) {\r\n if (await value.is(mutableClass)) {\r\n if (!mutableClass.key.matches(value.key)) {\r\n derivedClasses.push(value);\r\n }\r\n }\r\n ({ value, done } = schemaItems.next());\r\n }\r\n\r\n return derivedClasses;\r\n }\r\n}\r\n"]}