@itwin/ecschema-editing 4.8.0-dev.3 → 4.8.0-dev.31

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 (135) hide show
  1. package/CHANGELOG.md +43 -1
  2. package/lib/cjs/Differencing/Errors.js.map +1 -1
  3. package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
  4. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts +1 -0
  5. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
  6. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +23 -11
  7. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
  8. package/lib/cjs/Differencing/SchemaDifference.d.ts +10 -119
  9. package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
  10. package/lib/cjs/Differencing/SchemaDifference.js +28 -198
  11. package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
  12. package/lib/cjs/Differencing/Utils.d.ts +100 -0
  13. package/lib/cjs/Differencing/Utils.d.ts.map +1 -0
  14. package/lib/cjs/Differencing/Utils.js +165 -0
  15. package/lib/cjs/Differencing/Utils.js.map +1 -0
  16. package/lib/cjs/Editing/Constants.js.map +1 -1
  17. package/lib/cjs/Editing/CustomAttributes.d.ts +1 -1
  18. package/lib/cjs/Editing/CustomAttributes.d.ts.map +1 -1
  19. package/lib/cjs/Editing/CustomAttributes.js +2 -2
  20. package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
  21. package/lib/cjs/Editing/ECClasses.d.ts +0 -7
  22. package/lib/cjs/Editing/ECClasses.d.ts.map +1 -1
  23. package/lib/cjs/Editing/ECClasses.js +0 -27
  24. package/lib/cjs/Editing/ECClasses.js.map +1 -1
  25. package/lib/cjs/Editing/Editor.d.ts +19 -3
  26. package/lib/cjs/Editing/Editor.d.ts.map +1 -1
  27. package/lib/cjs/Editing/Editor.js +48 -3
  28. package/lib/cjs/Editing/Editor.js.map +1 -1
  29. package/lib/cjs/Editing/Entities.js.map +1 -1
  30. package/lib/cjs/Editing/Enumerations.js +4 -4
  31. package/lib/cjs/Editing/Enumerations.js.map +1 -1
  32. package/lib/cjs/Editing/Exception.d.ts +237 -140
  33. package/lib/cjs/Editing/Exception.d.ts.map +1 -1
  34. package/lib/cjs/Editing/Exception.js +216 -196
  35. package/lib/cjs/Editing/Exception.js.map +1 -1
  36. package/lib/cjs/Editing/Formats.d.ts.map +1 -1
  37. package/lib/cjs/Editing/Formats.js +4 -1
  38. package/lib/cjs/Editing/Formats.js.map +1 -1
  39. package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
  40. package/lib/cjs/Editing/KindOfQuantities.d.ts.map +1 -1
  41. package/lib/cjs/Editing/KindOfQuantities.js +3 -1
  42. package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
  43. package/lib/cjs/Editing/Mixins.js.map +1 -1
  44. package/lib/cjs/Editing/Mutable/MutableArrayProperty.js.map +1 -1
  45. package/lib/cjs/Editing/Mutable/MutableCAClass.d.ts +1 -1
  46. package/lib/cjs/Editing/Mutable/MutableCAClass.d.ts.map +1 -1
  47. package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
  48. package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
  49. package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
  50. package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
  51. package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
  52. package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
  53. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
  54. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
  55. package/lib/cjs/Editing/Mutable/MutableMixin.js.map +1 -1
  56. package/lib/cjs/Editing/Mutable/MutableNavigationProperty.js.map +1 -1
  57. package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
  58. package/lib/cjs/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -1
  59. package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
  60. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
  61. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
  62. package/lib/cjs/Editing/Mutable/MutableSchema.d.ts +2 -0
  63. package/lib/cjs/Editing/Mutable/MutableSchema.d.ts.map +1 -1
  64. package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
  65. package/lib/cjs/Editing/Mutable/MutableSchemaItem.d.ts +11 -0
  66. package/lib/cjs/Editing/Mutable/MutableSchemaItem.d.ts.map +1 -0
  67. package/lib/cjs/Editing/Mutable/MutableSchemaItem.js +16 -0
  68. package/lib/cjs/Editing/Mutable/MutableSchemaItem.js.map +1 -0
  69. package/lib/cjs/Editing/Mutable/MutableStructProperty.js.map +1 -1
  70. package/lib/cjs/Editing/Mutable/MutableUnit.js.map +1 -1
  71. package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
  72. package/lib/cjs/Editing/Phenomena.js.map +1 -1
  73. package/lib/cjs/Editing/Properties.d.ts +1 -4
  74. package/lib/cjs/Editing/Properties.d.ts.map +1 -1
  75. package/lib/cjs/Editing/Properties.js +4 -5
  76. package/lib/cjs/Editing/Properties.js.map +1 -1
  77. package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
  78. package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
  79. package/lib/cjs/Editing/SchemaItems.d.ts +21 -2
  80. package/lib/cjs/Editing/SchemaItems.d.ts.map +1 -1
  81. package/lib/cjs/Editing/SchemaItems.js +55 -24
  82. package/lib/cjs/Editing/SchemaItems.js.map +1 -1
  83. package/lib/cjs/Editing/Structs.js.map +1 -1
  84. package/lib/cjs/Editing/UnitSystems.js.map +1 -1
  85. package/lib/cjs/Editing/Units.js.map +1 -1
  86. package/lib/cjs/Merging/CAClassMerger.js +2 -2
  87. package/lib/cjs/Merging/CAClassMerger.js.map +1 -1
  88. package/lib/cjs/Merging/ClassMerger.d.ts.map +1 -1
  89. package/lib/cjs/Merging/ClassMerger.js +10 -10
  90. package/lib/cjs/Merging/ClassMerger.js.map +1 -1
  91. package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
  92. package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
  93. package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
  94. package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
  95. package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
  96. package/lib/cjs/Merging/MixinMerger.js.map +1 -1
  97. package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
  98. package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -1
  99. package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
  100. package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
  101. package/lib/cjs/Merging/SchemaItemMerger.d.ts +4 -4
  102. package/lib/cjs/Merging/SchemaItemMerger.d.ts.map +1 -1
  103. package/lib/cjs/Merging/SchemaItemMerger.js +18 -18
  104. package/lib/cjs/Merging/SchemaItemMerger.js.map +1 -1
  105. package/lib/cjs/Merging/SchemaMerger.d.ts +7 -7
  106. package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
  107. package/lib/cjs/Merging/SchemaMerger.js +32 -31
  108. package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
  109. package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
  110. package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -1
  111. package/lib/cjs/Validation/Diagnostic.js.map +1 -1
  112. package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
  113. package/lib/cjs/Validation/ECRules.js.map +1 -1
  114. package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
  115. package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
  116. package/lib/cjs/Validation/Rules.js.map +1 -1
  117. package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
  118. package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
  119. package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
  120. package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
  121. package/lib/cjs/Validation/SchemaCompareVisitor.d.ts.map +1 -1
  122. package/lib/cjs/Validation/SchemaCompareVisitor.js +25 -14
  123. package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
  124. package/lib/cjs/Validation/SchemaComparer.d.ts.map +1 -1
  125. package/lib/cjs/Validation/SchemaComparer.js +36 -13
  126. package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
  127. package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
  128. package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
  129. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  130. package/lib/cjs/ecschema-editing.d.ts +3 -1
  131. package/lib/cjs/ecschema-editing.d.ts.map +1 -1
  132. package/lib/cjs/ecschema-editing.js +4 -2
  133. package/lib/cjs/ecschema-editing.js.map +1 -1
  134. package/package.json +9 -9
  135. package/public/locales/en/ECSchemaEditing.json +26 -26
@@ -7,8 +7,7 @@
7
7
  * @module Editing
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.SchemaEditingError = exports.isRelationshipConstraintIdentifier = exports.isCustomAttributeIdentifier = exports.isEnumerationIdentifier = exports.isPropertyIdentifier = exports.isClassIdentifier = exports.isSchemaItemIdentifier = exports.isSchemaIdentifier = exports.RelationshipConstraintId = exports.CustomAttributeId = exports.EnumerationId = exports.PropertyId = exports.ClassId = exports.SchemaItemId = exports.SchemaId = exports.PropertyTypeName = exports.TaskType = exports.ECEditingStatus = void 0;
11
- const core_bentley_1 = require("@itwin/core-bentley");
10
+ exports.SchemaEditingError = exports.RelationshipConstraintId = exports.CustomAttributeId = exports.EnumeratorId = exports.PropertyId = exports.ClassId = exports.SchemaItemId = exports.SchemaId = exports.SchemaTypeIdentifiers = exports.PropertyTypeName = exports.ECEditingStatus = void 0;
12
11
  const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
13
12
  /** @alpha */
14
13
  var ECEditingStatus;
@@ -31,76 +30,71 @@ var ECEditingStatus;
31
30
  ECEditingStatus[ECEditingStatus["InvalidEnumeratorType"] = 196622] = "InvalidEnumeratorType";
32
31
  ECEditingStatus[ECEditingStatus["InvalidBaseClass"] = 196623] = "InvalidBaseClass";
33
32
  ECEditingStatus[ECEditingStatus["EnumeratorDoesNotExist"] = 196624] = "EnumeratorDoesNotExist";
34
- ECEditingStatus[ECEditingStatus["InvalidStrengthDirection"] = 196625] = "InvalidStrengthDirection";
35
- ECEditingStatus[ECEditingStatus["InvalidECName"] = 196626] = "InvalidECName";
36
- ECEditingStatus[ECEditingStatus["InvalidFormatUnitsSpecified"] = 196627] = "InvalidFormatUnitsSpecified";
33
+ ECEditingStatus[ECEditingStatus["InvalidECName"] = 196625] = "InvalidECName";
34
+ ECEditingStatus[ECEditingStatus["InvalidFormatUnitsSpecified"] = 196626] = "InvalidFormatUnitsSpecified";
37
35
  // Outer Errors
38
- ECEditingStatus[ECEditingStatus["CreateSchemaItemFailed"] = 196628] = "CreateSchemaItemFailed";
39
- ECEditingStatus[ECEditingStatus["CreateSchemaItemFromProps"] = 196629] = "CreateSchemaItemFromProps";
40
- ECEditingStatus[ECEditingStatus["CreateElement"] = 196630] = "CreateElement";
41
- ECEditingStatus[ECEditingStatus["CreateElementUniqueAspect"] = 196631] = "CreateElementUniqueAspect";
42
- ECEditingStatus[ECEditingStatus["CreateElementMultiAspect"] = 196632] = "CreateElementMultiAspect";
43
- ECEditingStatus[ECEditingStatus["SetBaseClass"] = 196633] = "SetBaseClass";
44
- ECEditingStatus[ECEditingStatus["SetSourceConstraint"] = 196634] = "SetSourceConstraint";
45
- ECEditingStatus[ECEditingStatus["SetTargetConstraint"] = 196635] = "SetTargetConstraint";
46
- ECEditingStatus[ECEditingStatus["AddConstraintClass"] = 196636] = "AddConstraintClass";
47
- ECEditingStatus[ECEditingStatus["RemoveConstraintClass"] = 196637] = "RemoveConstraintClass";
48
- ECEditingStatus[ECEditingStatus["SetAbstractConstraint"] = 196638] = "SetAbstractConstraint";
49
- ECEditingStatus[ECEditingStatus["AddCustomAttributeToConstraint"] = 196639] = "AddCustomAttributeToConstraint";
50
- ECEditingStatus[ECEditingStatus["AddCustomAttributeToProperty"] = 196640] = "AddCustomAttributeToProperty";
51
- ECEditingStatus[ECEditingStatus["AddCustomAttributeToClass"] = 196641] = "AddCustomAttributeToClass";
52
- ECEditingStatus[ECEditingStatus["CreateNavigationProperty"] = 196642] = "CreateNavigationProperty";
53
- ECEditingStatus[ECEditingStatus["CreateNavigationPropertyFromProps"] = 196643] = "CreateNavigationPropertyFromProps";
54
- ECEditingStatus[ECEditingStatus["SetInvertsUnit"] = 196644] = "SetInvertsUnit";
55
- ECEditingStatus[ECEditingStatus["SetUnitSystem"] = 196645] = "SetUnitSystem";
56
- ECEditingStatus[ECEditingStatus["SetDescription"] = 196646] = "SetDescription";
57
- ECEditingStatus[ECEditingStatus["SetLabel"] = 196647] = "SetLabel";
58
- ECEditingStatus[ECEditingStatus["SetIsReadOnly"] = 196648] = "SetIsReadOnly";
59
- ECEditingStatus[ECEditingStatus["SetPriority"] = 196649] = "SetPriority";
60
- ECEditingStatus[ECEditingStatus["SetCategory"] = 196650] = "SetCategory";
61
- ECEditingStatus[ECEditingStatus["SetMinOccurs"] = 196651] = "SetMinOccurs";
62
- ECEditingStatus[ECEditingStatus["SetMaxOccurs"] = 196652] = "SetMaxOccurs";
63
- ECEditingStatus[ECEditingStatus["SetExtendedTypeName"] = 196653] = "SetExtendedTypeName";
64
- ECEditingStatus[ECEditingStatus["SetMinLength"] = 196654] = "SetMinLength";
65
- ECEditingStatus[ECEditingStatus["SetMaxLength"] = 196655] = "SetMaxLength";
66
- ECEditingStatus[ECEditingStatus["SetMinValue"] = 196656] = "SetMinValue";
67
- ECEditingStatus[ECEditingStatus["SetMaxValue"] = 196657] = "SetMaxValue";
68
- ECEditingStatus[ECEditingStatus["SetPropertyName"] = 196658] = "SetPropertyName";
69
- ECEditingStatus[ECEditingStatus["AddMixin"] = 196659] = "AddMixin";
70
- ECEditingStatus[ECEditingStatus["AddEnumerator"] = 196660] = "AddEnumerator";
71
- ECEditingStatus[ECEditingStatus["SetEnumeratorLabel"] = 196661] = "SetEnumeratorLabel";
72
- ECEditingStatus[ECEditingStatus["SetEnumeratorDescription"] = 196662] = "SetEnumeratorDescription";
73
- ECEditingStatus[ECEditingStatus["AddPresentationUnit"] = 196663] = "AddPresentationUnit";
74
- ECEditingStatus[ECEditingStatus["AddPresentationOverride"] = 196664] = "AddPresentationOverride";
75
- ECEditingStatus[ECEditingStatus["CreateFormatOverride"] = 196665] = "CreateFormatOverride";
76
- ECEditingStatus[ECEditingStatus["SetPropertyCategoryPriority"] = 196666] = "SetPropertyCategoryPriority";
77
- ECEditingStatus[ECEditingStatus["CreatePrimitiveProperty"] = 196667] = "CreatePrimitiveProperty";
78
- ECEditingStatus[ECEditingStatus["CreatePrimitivePropertyFromProps"] = 196668] = "CreatePrimitivePropertyFromProps";
79
- ECEditingStatus[ECEditingStatus["CreateEnumerationProperty"] = 196669] = "CreateEnumerationProperty";
80
- ECEditingStatus[ECEditingStatus["CreateEnumerationPropertyFromProps"] = 196670] = "CreateEnumerationPropertyFromProps";
81
- ECEditingStatus[ECEditingStatus["CreatePrimitiveArrayProperty"] = 196671] = "CreatePrimitiveArrayProperty";
82
- ECEditingStatus[ECEditingStatus["CreatePrimitiveArrayPropertyFromProps"] = 196672] = "CreatePrimitiveArrayPropertyFromProps";
83
- ECEditingStatus[ECEditingStatus["CreateEnumerationArrayProperty"] = 196673] = "CreateEnumerationArrayProperty";
84
- ECEditingStatus[ECEditingStatus["CreateEnumerationArrayPropertyFromProps"] = 196674] = "CreateEnumerationArrayPropertyFromProps";
85
- ECEditingStatus[ECEditingStatus["CreateStructProperty"] = 196675] = "CreateStructProperty";
86
- ECEditingStatus[ECEditingStatus["CreateStructPropertyFromProps"] = 196676] = "CreateStructPropertyFromProps";
87
- ECEditingStatus[ECEditingStatus["CreateStructArrayProperty"] = 196677] = "CreateStructArrayProperty";
88
- ECEditingStatus[ECEditingStatus["CreateStructArrayPropertyFromProps"] = 196678] = "CreateStructArrayPropertyFromProps";
89
- ECEditingStatus[ECEditingStatus["DeleteProperty"] = 196679] = "DeleteProperty";
90
- ECEditingStatus[ECEditingStatus["DeleteClass"] = 196680] = "DeleteClass";
91
- ECEditingStatus[ECEditingStatus["SetClassName"] = 196681] = "SetClassName";
92
- ECEditingStatus[ECEditingStatus["AddSchemaReference"] = 196682] = "AddSchemaReference";
93
- ECEditingStatus[ECEditingStatus["SetSchemaVersion"] = 196683] = "SetSchemaVersion";
94
- ECEditingStatus[ECEditingStatus["IncrementSchemaMinorVersion"] = 196684] = "IncrementSchemaMinorVersion";
36
+ ECEditingStatus[ECEditingStatus["CreateSchemaItemFailed"] = 196627] = "CreateSchemaItemFailed";
37
+ ECEditingStatus[ECEditingStatus["CreateSchemaItemFromProps"] = 196628] = "CreateSchemaItemFromProps";
38
+ ECEditingStatus[ECEditingStatus["CreateElement"] = 196629] = "CreateElement";
39
+ ECEditingStatus[ECEditingStatus["CreateElementUniqueAspect"] = 196630] = "CreateElementUniqueAspect";
40
+ ECEditingStatus[ECEditingStatus["CreateElementMultiAspect"] = 196631] = "CreateElementMultiAspect";
41
+ ECEditingStatus[ECEditingStatus["SetBaseClass"] = 196632] = "SetBaseClass";
42
+ ECEditingStatus[ECEditingStatus["SetSourceConstraint"] = 196633] = "SetSourceConstraint";
43
+ ECEditingStatus[ECEditingStatus["SetTargetConstraint"] = 196634] = "SetTargetConstraint";
44
+ ECEditingStatus[ECEditingStatus["AddConstraintClass"] = 196635] = "AddConstraintClass";
45
+ ECEditingStatus[ECEditingStatus["RemoveConstraintClass"] = 196636] = "RemoveConstraintClass";
46
+ ECEditingStatus[ECEditingStatus["SetAbstractConstraint"] = 196637] = "SetAbstractConstraint";
47
+ ECEditingStatus[ECEditingStatus["AddCustomAttributeToConstraint"] = 196638] = "AddCustomAttributeToConstraint";
48
+ ECEditingStatus[ECEditingStatus["AddCustomAttributeToProperty"] = 196639] = "AddCustomAttributeToProperty";
49
+ ECEditingStatus[ECEditingStatus["AddCustomAttributeToClass"] = 196640] = "AddCustomAttributeToClass";
50
+ ECEditingStatus[ECEditingStatus["CreateNavigationProperty"] = 196641] = "CreateNavigationProperty";
51
+ ECEditingStatus[ECEditingStatus["CreateNavigationPropertyFromProps"] = 196642] = "CreateNavigationPropertyFromProps";
52
+ ECEditingStatus[ECEditingStatus["SetInvertsUnit"] = 196643] = "SetInvertsUnit";
53
+ ECEditingStatus[ECEditingStatus["SetUnitSystem"] = 196644] = "SetUnitSystem";
54
+ ECEditingStatus[ECEditingStatus["SetDescription"] = 196645] = "SetDescription";
55
+ ECEditingStatus[ECEditingStatus["SetLabel"] = 196646] = "SetLabel";
56
+ ECEditingStatus[ECEditingStatus["SetIsReadOnly"] = 196647] = "SetIsReadOnly";
57
+ ECEditingStatus[ECEditingStatus["SetPriority"] = 196648] = "SetPriority";
58
+ ECEditingStatus[ECEditingStatus["SetCategory"] = 196649] = "SetCategory";
59
+ ECEditingStatus[ECEditingStatus["SetMinOccurs"] = 196650] = "SetMinOccurs";
60
+ ECEditingStatus[ECEditingStatus["SetMaxOccurs"] = 196651] = "SetMaxOccurs";
61
+ ECEditingStatus[ECEditingStatus["SetExtendedTypeName"] = 196652] = "SetExtendedTypeName";
62
+ ECEditingStatus[ECEditingStatus["SetMinLength"] = 196653] = "SetMinLength";
63
+ ECEditingStatus[ECEditingStatus["SetMaxLength"] = 196654] = "SetMaxLength";
64
+ ECEditingStatus[ECEditingStatus["SetMinValue"] = 196655] = "SetMinValue";
65
+ ECEditingStatus[ECEditingStatus["SetMaxValue"] = 196656] = "SetMaxValue";
66
+ ECEditingStatus[ECEditingStatus["SetPropertyName"] = 196657] = "SetPropertyName";
67
+ ECEditingStatus[ECEditingStatus["AddMixin"] = 196658] = "AddMixin";
68
+ ECEditingStatus[ECEditingStatus["AddEnumerator"] = 196659] = "AddEnumerator";
69
+ ECEditingStatus[ECEditingStatus["SetEnumeratorLabel"] = 196660] = "SetEnumeratorLabel";
70
+ ECEditingStatus[ECEditingStatus["SetEnumeratorDescription"] = 196661] = "SetEnumeratorDescription";
71
+ ECEditingStatus[ECEditingStatus["AddPresentationUnit"] = 196662] = "AddPresentationUnit";
72
+ ECEditingStatus[ECEditingStatus["AddPresentationOverride"] = 196663] = "AddPresentationOverride";
73
+ ECEditingStatus[ECEditingStatus["CreateFormatOverride"] = 196664] = "CreateFormatOverride";
74
+ ECEditingStatus[ECEditingStatus["SetPropertyCategoryPriority"] = 196665] = "SetPropertyCategoryPriority";
75
+ ECEditingStatus[ECEditingStatus["CreatePrimitiveProperty"] = 196666] = "CreatePrimitiveProperty";
76
+ ECEditingStatus[ECEditingStatus["CreatePrimitivePropertyFromProps"] = 196667] = "CreatePrimitivePropertyFromProps";
77
+ ECEditingStatus[ECEditingStatus["CreateEnumerationProperty"] = 196668] = "CreateEnumerationProperty";
78
+ ECEditingStatus[ECEditingStatus["CreateEnumerationPropertyFromProps"] = 196669] = "CreateEnumerationPropertyFromProps";
79
+ ECEditingStatus[ECEditingStatus["CreatePrimitiveArrayProperty"] = 196670] = "CreatePrimitiveArrayProperty";
80
+ ECEditingStatus[ECEditingStatus["CreatePrimitiveArrayPropertyFromProps"] = 196671] = "CreatePrimitiveArrayPropertyFromProps";
81
+ ECEditingStatus[ECEditingStatus["CreateEnumerationArrayProperty"] = 196672] = "CreateEnumerationArrayProperty";
82
+ ECEditingStatus[ECEditingStatus["CreateEnumerationArrayPropertyFromProps"] = 196673] = "CreateEnumerationArrayPropertyFromProps";
83
+ ECEditingStatus[ECEditingStatus["CreateStructProperty"] = 196674] = "CreateStructProperty";
84
+ ECEditingStatus[ECEditingStatus["CreateStructPropertyFromProps"] = 196675] = "CreateStructPropertyFromProps";
85
+ ECEditingStatus[ECEditingStatus["CreateStructArrayProperty"] = 196676] = "CreateStructArrayProperty";
86
+ ECEditingStatus[ECEditingStatus["CreateStructArrayPropertyFromProps"] = 196677] = "CreateStructArrayPropertyFromProps";
87
+ ECEditingStatus[ECEditingStatus["DeleteProperty"] = 196678] = "DeleteProperty";
88
+ ECEditingStatus[ECEditingStatus["DeleteClass"] = 196679] = "DeleteClass";
89
+ ECEditingStatus[ECEditingStatus["SetClassName"] = 196680] = "SetClassName";
90
+ ECEditingStatus[ECEditingStatus["AddSchemaReference"] = 196681] = "AddSchemaReference";
91
+ ECEditingStatus[ECEditingStatus["SetSchemaVersion"] = 196682] = "SetSchemaVersion";
92
+ ECEditingStatus[ECEditingStatus["IncrementSchemaMinorVersion"] = 196683] = "IncrementSchemaMinorVersion";
95
93
  })(ECEditingStatus || (exports.ECEditingStatus = ECEditingStatus = {}));
96
- var TaskType;
97
- (function (TaskType) {
98
- TaskType[TaskType["Add"] = 0] = "Add";
99
- TaskType[TaskType["Create"] = 1] = "Create";
100
- TaskType[TaskType["Update"] = 2] = "Update";
101
- TaskType[TaskType["Change"] = 3] = "Change";
102
- TaskType[TaskType["Delete"] = 4] = "Delete";
103
- })(TaskType || (exports.TaskType = TaskType = {}));
94
+ /**
95
+ * Defines the possible property type names.
96
+ * @alpha
97
+ */
104
98
  var PropertyTypeName;
105
99
  (function (PropertyTypeName) {
106
100
  PropertyTypeName["ArrayProperty"] = "ArrayProperty";
@@ -109,13 +103,36 @@ var PropertyTypeName;
109
103
  PropertyTypeName["NavigationProperty"] = "NavigationProperty";
110
104
  PropertyTypeName["StructProperty"] = "StructProperty";
111
105
  })(PropertyTypeName || (exports.PropertyTypeName = PropertyTypeName = {}));
106
+ /**
107
+ * Defines the possible schema type identifiers.
108
+ * @alpha
109
+ */
110
+ var SchemaTypeIdentifiers;
111
+ (function (SchemaTypeIdentifiers) {
112
+ SchemaTypeIdentifiers["SchemaIdentifier"] = "Schema";
113
+ SchemaTypeIdentifiers["SchemaItemIdentifier"] = "SchemaItem";
114
+ SchemaTypeIdentifiers["ClassIdentifier"] = "Class";
115
+ SchemaTypeIdentifiers["PropertyIdentifier"] = "Property";
116
+ SchemaTypeIdentifiers["EnumeratorIdentifier"] = "Enumerator";
117
+ SchemaTypeIdentifiers["CustomAttributeIdentifier"] = "CustomAttribute";
118
+ SchemaTypeIdentifiers["RelationshipConstraintIdentifier"] = "RelationshipConstraint";
119
+ })(SchemaTypeIdentifiers || (exports.SchemaTypeIdentifiers = SchemaTypeIdentifiers = {}));
120
+ /**
121
+ * An ISchemaIdentifier implementation to identify Schemas
122
+ * @alpha
123
+ */
112
124
  class SchemaId {
113
125
  constructor(schemaKey) {
126
+ this.typeIdentifier = SchemaTypeIdentifiers.SchemaIdentifier;
114
127
  this.name = schemaKey.name;
115
128
  this.schemaKey = schemaKey;
116
129
  }
117
130
  }
118
131
  exports.SchemaId = SchemaId;
132
+ /**
133
+ * An ISchemItemIdentifier implementation to identify SchemaItems
134
+ * @alpha
135
+ */
119
136
  class SchemaItemId {
120
137
  constructor(schemaItemType, schemaItemKeyOrName, schemaKey) {
121
138
  if (typeof (schemaItemKeyOrName) === "string") {
@@ -128,19 +145,31 @@ class SchemaItemId {
128
145
  this.schemaKey = schemaItemKeyOrName.schemaKey;
129
146
  this.schemaItemKey = schemaItemKeyOrName;
130
147
  }
131
- this.type = schemaItemType;
148
+ this.schemaItemType = schemaItemType;
132
149
  this.name = this.schemaItemKey.fullName;
150
+ this.typeIdentifier = SchemaTypeIdentifiers.SchemaItemIdentifier;
133
151
  }
134
152
  }
135
153
  exports.SchemaItemId = SchemaItemId;
154
+ /**
155
+ * An IClassIdentifier implementation to identify Class instances.
156
+ * @alpha
157
+ */
136
158
  class ClassId extends SchemaItemId {
137
159
  constructor(schemaItemType, schemaItemKeyOrName, schemaKey) {
138
160
  super(schemaItemType, schemaItemKeyOrName, schemaKey);
161
+ this.typeIdentifier = SchemaTypeIdentifiers.ClassIdentifier;
162
+ this.schemaItemType = schemaItemType;
139
163
  }
140
164
  }
141
165
  exports.ClassId = ClassId;
166
+ /**
167
+ * An IPropertyIdentifier implementation to identify Property instances.
168
+ * @alpha
169
+ */
142
170
  class PropertyId {
143
171
  constructor(schemaItemType, classKey, property, typeName) {
172
+ this.typeIdentifier = SchemaTypeIdentifiers.PropertyIdentifier;
144
173
  this.name = property instanceof ecschema_metadata_1.Property ? property.name : property;
145
174
  this.fullName = property instanceof ecschema_metadata_1.Property ? property.fullName : `${classKey.name}.${property}`;
146
175
  this.ecClass = new ClassId(schemaItemType, classKey);
@@ -149,108 +178,56 @@ class PropertyId {
149
178
  }
150
179
  }
151
180
  exports.PropertyId = PropertyId;
152
- class EnumerationId extends SchemaItemId {
153
- constructor(enumeration, enumerator) {
154
- super(ecschema_metadata_1.SchemaItemType.Enumeration, enumeration.key);
181
+ /**
182
+ * An IEnumeratorIdentifier implementation to identify Enumerator instances.
183
+ * @alpha
184
+ */
185
+ class EnumeratorId {
186
+ constructor(enumerator, enumeration) {
187
+ this.typeIdentifier = SchemaTypeIdentifiers.EnumeratorIdentifier;
188
+ this.enumeration = enumeration.key;
155
189
  this.enumerationType = enumeration.type ? (0, ecschema_metadata_1.primitiveTypeToString)(enumeration.type) : "string";
156
- this.enumeratorName = typeof (enumerator) === "string" ? enumerator : enumerator.name;
157
- this.enumeratorType = this.getEnumeratorType(enumeration, enumerator);
158
- }
159
- getEnumeratorType(enumeration, enumerator) {
160
- if (typeof (enumerator) === "string")
161
- return enumeration.isString ? "string" : "int";
162
- return typeof (enumerator.value) === "string" ? "string" : "int";
190
+ this.enumeratorType = getEnumeratorType(enumeration ?? ecschema_metadata_1.PrimitiveType.String, enumerator);
191
+ this.name = typeof (enumerator) === "string" ? enumerator : enumerator.name;
192
+ this.schemaKey = enumeration.schema.schemaKey;
163
193
  }
164
194
  }
165
- exports.EnumerationId = EnumerationId;
195
+ exports.EnumeratorId = EnumeratorId;
196
+ /**
197
+ * An ICustomAttributeIdentifier implementation to identify CustomAttribute instances.
198
+ * @alpha
199
+ */
166
200
  class CustomAttributeId {
167
201
  constructor(name, container) {
202
+ this.typeIdentifier = SchemaTypeIdentifiers.CustomAttributeIdentifier;
168
203
  this.name = name;
169
204
  this.schemaKey = container.schema.schemaKey;
170
205
  this.containerFullName = container.fullName;
171
206
  }
172
207
  }
173
208
  exports.CustomAttributeId = CustomAttributeId;
209
+ /**
210
+ * An IRelationshipConstraintIdentifier implementation to identify RelationshipConstraints.
211
+ * @alpha
212
+ */
174
213
  class RelationshipConstraintId {
175
214
  constructor(constraint) {
176
- this.name = constraint.fullName;
215
+ this.typeIdentifier = SchemaTypeIdentifiers.RelationshipConstraintIdentifier;
216
+ this.name = constraint.isSource ? "Source" : "Target";
177
217
  this.relationshipKey = constraint.relationshipClass.key;
178
218
  this.schemaKey = this.relationshipKey.schemaKey;
179
219
  }
180
220
  }
181
221
  exports.RelationshipConstraintId = RelationshipConstraintId;
182
222
  /**
183
- * Indicates if the given identifier is a SchemaId instance.
184
- * @param identifier The identifier to check.
185
- * @returns true if the identifier is the correct type.
186
- */
187
- function isSchemaIdentifier(identifier) {
188
- return identifier instanceof SchemaId;
189
- }
190
- exports.isSchemaIdentifier = isSchemaIdentifier;
191
- /**
192
- * Indicates if the given identifier is a SchemaId instance.
193
- * @param identifier The identifier to check.
194
- * @returns true if the identifier is the correct type.
195
- */
196
- function isSchemaItemIdentifier(identifier) {
197
- return identifier instanceof SchemaItemId;
198
- }
199
- exports.isSchemaItemIdentifier = isSchemaItemIdentifier;
200
- /**
201
- * Indicates if the given identifier is a ClassId instance.
202
- * @param identifier The identifier to check.
203
- * @returns true if the identifier is the correct type.
204
- */
205
- function isClassIdentifier(identifier) {
206
- return identifier instanceof ClassId;
207
- }
208
- exports.isClassIdentifier = isClassIdentifier;
209
- /**
210
- * Indicates if the given identifier is a PropertyId instance.
211
- * @param identifier The identifier to check.
212
- * @returns true if the identifier is the correct type.
213
- */
214
- function isPropertyIdentifier(identifier) {
215
- return identifier instanceof PropertyId;
216
- }
217
- exports.isPropertyIdentifier = isPropertyIdentifier;
218
- /**
219
- * Indicates if the given identifier is a EnumerationId instance.
220
- * @param identifier The identifier to check.
221
- * @returns true if the identifier is the correct type.
222
- */
223
- function isEnumerationIdentifier(identifier) {
224
- return identifier instanceof EnumerationId;
225
- }
226
- exports.isEnumerationIdentifier = isEnumerationIdentifier;
227
- /**
228
- * Indicates if the given identifier is a CustomAttributeId instance.
229
- * @param identifier The identifier to check.
230
- * @returns true if the identifier is the correct type.
231
- */
232
- function isCustomAttributeIdentifier(identifier) {
233
- return identifier instanceof CustomAttributeId;
234
- }
235
- exports.isCustomAttributeIdentifier = isCustomAttributeIdentifier;
236
- /**
237
- * Indicates if the given identifier is a RelationshipConstraintId instance.
238
- * @param identifier The identifier to check.
239
- * @returns true if the identifier is the correct type.
240
- */
241
- function isRelationshipConstraintIdentifier(identifier) {
242
- return identifier instanceof RelationshipConstraintId;
243
- }
244
- exports.isRelationshipConstraintIdentifier = isRelationshipConstraintIdentifier;
245
- /**
246
- * @internal
247
223
  * An exception class for the ecschema-editing API. Contains identifiers for schema types involved in the
248
224
  * exception. An example being SchemaItemId which contains the name of the SchemaItem, SchemaItemKey, SchemaItemType, etc.
249
225
  * Typically will contain an innerError of type SchemaEditingError containing the identifier of the schema item that
250
226
  * caused the exception. The containing error instance will identify the method called (identified by the errorNumber)
251
227
  * and the identifier of the schema item being modified/created.
228
+ * @alpha
252
229
  */
253
- class SchemaEditingError extends core_bentley_1.BentleyError {
230
+ class SchemaEditingError extends Error {
254
231
  /**
255
232
  * Constructs a new SchemaEditingError instance.
256
233
  * @param errorNumber The unique ECEditingStatus code identifying the error.
@@ -260,7 +237,7 @@ class SchemaEditingError extends core_bentley_1.BentleyError {
260
237
  * @param message Optional error message. Most messages on automatically generated by this class based on the ECEditingStatus code.
261
238
  */
262
239
  constructor(errorNumber, identifier, innerError, ruleViolations, message) {
263
- super(errorNumber, message);
240
+ super(message);
264
241
  this.errorNumber = errorNumber;
265
242
  this.identifier = identifier;
266
243
  this.innerError = innerError;
@@ -272,8 +249,8 @@ class SchemaEditingError extends core_bentley_1.BentleyError {
272
249
  * Gets the SchemaId instance.
273
250
  * @throws Error if the identifier is not an instance of SchemaId.
274
251
  */
275
- get schemaId() {
276
- if (!isSchemaIdentifier(this.identifier))
252
+ get _schemaId() {
253
+ if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.SchemaIdentifier)
277
254
  throw new Error("identifier is not a SchemaId.");
278
255
  return this.identifier;
279
256
  }
@@ -281,8 +258,8 @@ class SchemaEditingError extends core_bentley_1.BentleyError {
281
258
  * Gets the SchemaItemId instance.
282
259
  * @throws Error if the identifier is not an instance of SchemaItemId.
283
260
  */
284
- get schemaItemId() {
285
- if (!isSchemaItemIdentifier(this.identifier))
261
+ get _schemaItemId() {
262
+ if (this.isSchemaItemIdentifier(this.identifier))
286
263
  throw new Error("identifier is not a SchemaItemId.");
287
264
  return this.identifier;
288
265
  }
@@ -290,8 +267,8 @@ class SchemaEditingError extends core_bentley_1.BentleyError {
290
267
  * Gets the ClassId instance.
291
268
  * @throws Error if the identifier is not an instance of ClassId.
292
269
  */
293
- get classId() {
294
- if (!isClassIdentifier(this.identifier))
270
+ get _classId() {
271
+ if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.ClassIdentifier)
295
272
  throw new Error("identifier is not a ClassId.");
296
273
  return this.identifier;
297
274
  }
@@ -299,17 +276,17 @@ class SchemaEditingError extends core_bentley_1.BentleyError {
299
276
  * Gets the PropertyId instance.
300
277
  * @throws Error if the identifier is not an instance of PropertyId.
301
278
  */
302
- get propertyId() {
303
- if (!isPropertyIdentifier(this.identifier))
279
+ get _propertyId() {
280
+ if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.PropertyIdentifier)
304
281
  throw new Error("identifier is not a PropertyId.");
305
282
  return this.identifier;
306
283
  }
307
284
  /**
308
- * Gets the EnumerationId instance.
309
- * @throws Error if the identifier is not an instance of EnumerationId.
285
+ * Gets the EnumeratorId instance.
286
+ * @throws Error if the identifier is not an instance of EnumeratorId.
310
287
  */
311
- get enumerationId() {
312
- if (!isEnumerationIdentifier(this.identifier))
288
+ get _enumeratorId() {
289
+ if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.EnumeratorIdentifier)
313
290
  throw new Error("identifier is not a EnumerationId.");
314
291
  return this.identifier;
315
292
  }
@@ -317,8 +294,8 @@ class SchemaEditingError extends core_bentley_1.BentleyError {
317
294
  * Gets the CustomAttributeId instance.
318
295
  * @throws Error if the identifier is not an instance of CustomAttributeId.
319
296
  */
320
- get customAttributeId() {
321
- if (!isCustomAttributeIdentifier(this.identifier))
297
+ get _customAttributeId() {
298
+ if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.CustomAttributeIdentifier)
322
299
  throw new Error("identifier is not a CustomAttributeId.");
323
300
  return this.identifier;
324
301
  }
@@ -326,27 +303,32 @@ class SchemaEditingError extends core_bentley_1.BentleyError {
326
303
  * Gets the RelationshipConstraintId instance.
327
304
  * @throws Error if the identifier is not an instance of RelationshipConstraintId.
328
305
  */
329
- get relationshipConstraintId() {
330
- if (!isRelationshipConstraintIdentifier(this.identifier))
306
+ get _relationshipConstraintId() {
307
+ if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.RelationshipConstraintIdentifier)
331
308
  throw new Error("identifier is not a RelationshipConstraintId.");
332
309
  return this.identifier;
333
310
  }
311
+ /** Gets rule violations that were reported during validation. Returns an array of [[AnyDiagnostic]] if
312
+ * the errorNumber is ECEditingStatus.RuleViolation, otherwise undefined.
313
+ */
334
314
  get ruleViolations() {
335
315
  return this._ruleViolations;
336
316
  }
317
+ /**
318
+ * Returns a readable string containing the ECEditingStatus along with the error message. Any
319
+ * innerError will also be appended.
320
+ * @returns
321
+ */
337
322
  toDebugString() {
338
323
  let innerMessage = "";
339
324
  if (this.innerError) {
340
325
  if (this.innerError instanceof SchemaEditingError)
341
- innerMessage = `: Inner error: ${this.innerError.toDebugString()}`;
326
+ innerMessage = ` Inner error: ${this.innerError.toDebugString()}`;
342
327
  else
343
- innerMessage = `: Inner error: ${this.innerError.message}`;
328
+ innerMessage = ` Inner error: ${this.innerError.message}`;
344
329
  }
345
330
  return this._appendMessage(`ECEditingStatus.${ECEditingStatus[this.errorNumber]}`) + innerMessage;
346
331
  }
347
- _appendMessage(e) {
348
- return this.message ? `${e}: ${this.message}` : e;
349
- }
350
332
  generateMessage() {
351
333
  if (this.message)
352
334
  return;
@@ -355,72 +337,110 @@ class SchemaEditingError extends core_bentley_1.BentleyError {
355
337
  this.message = `Schema Key ${this._schemaKey.toString(true)} could not be found in the context.`;
356
338
  return;
357
339
  case ECEditingStatus.SchemaItemNotFound:
358
- this.message = `${this.schemaItemId.type} ${this.schemaItemId.name} could not be found in the schema ${this._schemaKey.name}.`;
340
+ this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} could not be found in the schema ${this._schemaKey.name}.`;
359
341
  return;
360
342
  case ECEditingStatus.SchemaItemNotFoundInContext:
361
- this.message = `${this.schemaItemId.type} ${this.schemaItemId.name} could not be found in the schema context.`;
343
+ this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} could not be found in the schema context.`;
362
344
  return;
363
345
  case ECEditingStatus.InvalidSchemaItemType:
364
- this.message = `Expected ${this.schemaItemId.name} to be of type ${this.schemaItemId.type}.`;
346
+ this.message = `Expected ${this._schemaItemId.name} to be of type ${this._schemaItemId.schemaItemType}.`;
365
347
  return;
366
348
  case ECEditingStatus.SchemaItemNameNotSpecified:
367
- this.message = `Could not create a new ${this.schemaItemId.type} in schema ${this._schemaKey.name}. No name was supplied within props.`;
349
+ this.message = `Could not create a new ${this._schemaItemId.schemaItemType} in schema ${this._schemaKey.name}. No name was supplied within props.`;
368
350
  return;
369
351
  case ECEditingStatus.SchemaItemNameAlreadyExists:
370
- this.message = `${this.schemaItemId.type} ${this.schemaItemId.name} already exists in the schema ${this._schemaKey.name}.`;
352
+ this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} already exists in the schema ${this._schemaKey.name}.`;
371
353
  return;
372
354
  case ECEditingStatus.RuleViolation:
373
- this.message = this.getRuleViolationMessage();
355
+ this.message = this._getRuleViolationMessage();
374
356
  return;
375
357
  case ECEditingStatus.PropertyNotFound:
376
- this.message = `An ECProperty with the name ${this.propertyId.name} could not be found in the class ${this.propertyId.ecClass.name}.`;
358
+ this.message = `An ECProperty with the name ${this._propertyId.name} could not be found in the class ${this._propertyId.ecClass.name}.`;
377
359
  return;
378
360
  case ECEditingStatus.PropertyAlreadyExists:
379
- this.message = `An ECProperty with the name ${this.propertyId.name} already exists in the class ${this.propertyId.ecClass.name}.`;
361
+ this.message = `An ECProperty with the name ${this._propertyId.name} already exists in the class ${this._propertyId.ecClass.name}.`;
380
362
  return;
381
363
  case ECEditingStatus.InvalidPropertyType:
382
- this.message = `Expected property ${this.propertyId.name} to be of type ${this.propertyId.typeName}.`;
364
+ this.message = `Expected property ${this._propertyId.name} to be of type ${this._propertyId.typeName}.`;
383
365
  return;
384
366
  case ECEditingStatus.BaseClassIsNotElement:
385
- this.message = `Expected base class ${this.schemaItemId.name} to derive from BisCore.Element.`;
367
+ this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.Element.`;
386
368
  return;
387
369
  case ECEditingStatus.BaseClassIsNotElementUniqueAspect:
388
- this.message = `Expected base class ${this.schemaItemId.name} to derive from BisCore.ElementUniqueAspect.`;
370
+ this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.ElementUniqueAspect.`;
389
371
  return;
390
372
  case ECEditingStatus.BaseClassIsNotElementMultiAspect:
391
- this.message = `Expected base class ${this.schemaItemId.name} to derive from BisCore.ElementMultiAspect.`;
373
+ this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.ElementMultiAspect.`;
392
374
  return;
393
375
  case ECEditingStatus.InvalidFormatUnitsSpecified:
394
- this.message = `The specified Format unit ${this.schemaItemId.name} is not of type Unit or InvertedUnit`;
376
+ this.message = `The specified Format unit ${this._schemaItemId.name} is not of type Unit or InvertedUnit`;
395
377
  return;
396
378
  case ECEditingStatus.InvalidEnumeratorType:
397
- this.message = `The Enumeration ${this.enumerationId.name} has type ${this.enumerationId.enumerationType}, while Enumerator ${this.enumerationId.enumeratorName} has type ${this.enumerationId.enumeratorType}.`;
379
+ this.message = `The Enumeration ${this._enumeratorId.enumeration.fullName} has type ${this._enumeratorId.enumerationType}, while Enumerator ${this._enumeratorId.name} has type ${this._enumeratorId.enumeratorType}.`;
398
380
  return;
399
381
  case ECEditingStatus.EnumeratorDoesNotExist:
400
- this.message = `Enumerator ${this.enumerationId.enumeratorName} does not exists in Enumeration ${this.enumerationId.name}.`;
382
+ this.message = `Enumerator ${this._enumeratorId.name} does not exists in Enumeration ${this._enumeratorId.enumeration.name}.`;
401
383
  return;
402
384
  case ECEditingStatus.InvalidECName:
403
- this.message = `Could not rename class ${this.schemaItemId.name} because the specified name is not a valid ECName.`;
385
+ this.message = `Could not rename class ${this._schemaItemId.name} because the specified name is not a valid ECName.`;
404
386
  return;
387
+ default:
388
+ this.message = this._createTaskErrorMessage();
405
389
  }
406
390
  }
407
- getRuleViolationMessage() {
391
+ _appendMessage(e) {
392
+ return this.message ? `${e}: ${this.message}` : e;
393
+ }
394
+ _getRuleViolationMessage() {
408
395
  if (!this._ruleViolations)
409
396
  return "";
410
397
  let violations = "";
411
398
  for (const diagnostic of this._ruleViolations) {
412
399
  violations += `${diagnostic.code}: ${diagnostic.messageText}\r\n`;
413
400
  }
414
- if (isSchemaIdentifier(this.identifier))
415
- return `Rule violations occurred from Schema ${this.schemaId.name}: ${violations}`;
416
- if (isSchemaItemIdentifier(this.identifier))
417
- return `Rule violations occurred from ${this.schemaItemId.type} ${this.schemaItemId.name}: ${violations}`;
418
- if (isCustomAttributeIdentifier(this.identifier))
419
- return `Rule violations occurred from CustomAttribute ${this.customAttributeId.name}, container ${this.customAttributeId.containerFullName}: ${violations}`;
420
- if (isRelationshipConstraintIdentifier(this.identifier))
421
- return `Rule violations occurred from constraint ${this.relationshipConstraintId.name} of RelationshipClass ${this.relationshipConstraintId.relationshipKey.fullName}: ${violations}`;
422
- throw new Error("Could not generate rule violation message due to invalid identifier.");
401
+ switch (this.identifier.typeIdentifier) {
402
+ case SchemaTypeIdentifiers.SchemaIdentifier:
403
+ return `Rule violations occurred from Schema ${this._schemaId.name}: ${violations}`;
404
+ case SchemaTypeIdentifiers.SchemaItemIdentifier:
405
+ return `Rule violations occurred from ${this._schemaItemId.schemaItemType} ${this._schemaItemId.name}: ${violations}`;
406
+ case SchemaTypeIdentifiers.ClassIdentifier:
407
+ return `Rule violations occurred from ${this._schemaItemId.schemaItemType} ${this._schemaItemId.name}: ${violations}`;
408
+ case SchemaTypeIdentifiers.CustomAttributeIdentifier:
409
+ return `Rule violations occurred from CustomAttribute ${this._customAttributeId.name}, container ${this._customAttributeId.containerFullName}: ${violations}`;
410
+ case SchemaTypeIdentifiers.RelationshipConstraintIdentifier:
411
+ return `Rule violations occurred from ${this._relationshipConstraintId.name} constraint of RelationshipClass ${this._relationshipConstraintId.relationshipKey.fullName}: ${violations}`;
412
+ default:
413
+ throw new Error("Invalid identifier.");
414
+ }
415
+ }
416
+ _createTaskErrorMessage() {
417
+ // Make sure we have an inner error or else it is not a task error
418
+ if (!this.innerError)
419
+ return "";
420
+ switch (this.identifier.typeIdentifier) {
421
+ case SchemaTypeIdentifiers.SchemaIdentifier:
422
+ case SchemaTypeIdentifiers.SchemaItemIdentifier:
423
+ case SchemaTypeIdentifiers.ClassIdentifier:
424
+ case SchemaTypeIdentifiers.RelationshipConstraintIdentifier:
425
+ return `While performing task '${ECEditingStatus[this.errorNumber]}' an error occurred editing ${this.identifier.typeIdentifier} ${this.identifier.name}.`;
426
+ case SchemaTypeIdentifiers.PropertyIdentifier:
427
+ return `While performing task '${ECEditingStatus[this.errorNumber]}' an error occurred editing ${this.identifier.typeIdentifier} ${this.identifier.fullName}.`;
428
+ default:
429
+ throw new Error("Invalid identifier.");
430
+ }
431
+ }
432
+ isSchemaItemIdentifier(identifier) {
433
+ if (identifier.typeIdentifier !== SchemaTypeIdentifiers.SchemaItemIdentifier &&
434
+ identifier.typeIdentifier !== SchemaTypeIdentifiers.ClassIdentifier)
435
+ return true;
436
+ return false;
423
437
  }
424
438
  }
425
439
  exports.SchemaEditingError = SchemaEditingError;
440
+ function getEnumeratorType(enumeration, enumerator) {
441
+ if (typeof (enumerator) === "string") {
442
+ return enumeration.type ? (0, ecschema_metadata_1.primitiveTypeToString)(enumeration.type) : "string";
443
+ }
444
+ return typeof (enumerator.value) === "string" ? "string" : "int";
445
+ }
426
446
  //# sourceMappingURL=Exception.js.map