@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.
- package/CHANGELOG.md +18 -1
- package/lib/cjs/Differencing/Errors.d.ts +19 -0
- package/lib/cjs/Differencing/Errors.d.ts.map +1 -0
- package/lib/cjs/Differencing/Errors.js +24 -0
- package/lib/cjs/Differencing/Errors.js.map +1 -0
- package/lib/cjs/Differencing/SchemaConflicts.d.ts +0 -14
- package/lib/cjs/Differencing/SchemaConflicts.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaConflicts.js +1 -14
- package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts +4 -4
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +31 -31
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifference.d.ts +1 -1
- package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDifference.js +6 -6
- package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
- package/lib/cjs/Editing/Constants.d.ts +6 -6
- package/lib/cjs/Editing/Constants.d.ts.map +1 -1
- package/lib/cjs/Editing/Constants.js +26 -31
- package/lib/cjs/Editing/Constants.js.map +1 -1
- package/lib/cjs/Editing/CustomAttributes.d.ts +3 -3
- package/lib/cjs/Editing/CustomAttributes.d.ts.map +1 -1
- package/lib/cjs/Editing/CustomAttributes.js +18 -28
- package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
- package/lib/cjs/Editing/ECClasses.d.ts +24 -23
- package/lib/cjs/Editing/ECClasses.d.ts.map +1 -1
- package/lib/cjs/Editing/ECClasses.js +126 -156
- package/lib/cjs/Editing/ECClasses.js.map +1 -1
- package/lib/cjs/Editing/Editor.d.ts +10 -31
- package/lib/cjs/Editing/Editor.d.ts.map +1 -1
- package/lib/cjs/Editing/Editor.js +59 -43
- package/lib/cjs/Editing/Editor.js.map +1 -1
- package/lib/cjs/Editing/Entities.d.ts +9 -9
- package/lib/cjs/Editing/Entities.d.ts.map +1 -1
- package/lib/cjs/Editing/Entities.js +65 -85
- package/lib/cjs/Editing/Entities.js.map +1 -1
- package/lib/cjs/Editing/Enumerations.d.ts +6 -6
- package/lib/cjs/Editing/Enumerations.d.ts.map +1 -1
- package/lib/cjs/Editing/Enumerations.js +57 -55
- package/lib/cjs/Editing/Enumerations.js.map +1 -1
- package/lib/cjs/Editing/Exception.d.ts +257 -0
- package/lib/cjs/Editing/Exception.d.ts.map +1 -0
- package/lib/cjs/Editing/Exception.js +426 -0
- package/lib/cjs/Editing/Exception.js.map +1 -0
- package/lib/cjs/Editing/Formats.d.ts +6 -6
- package/lib/cjs/Editing/Formats.d.ts.map +1 -1
- package/lib/cjs/Editing/Formats.js +28 -33
- package/lib/cjs/Editing/Formats.js.map +1 -1
- package/lib/cjs/Editing/InvertedUnits.d.ts +6 -6
- package/lib/cjs/Editing/InvertedUnits.d.ts.map +1 -1
- package/lib/cjs/Editing/InvertedUnits.js +41 -56
- package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
- package/lib/cjs/Editing/KindOfQuantities.d.ts +6 -6
- package/lib/cjs/Editing/KindOfQuantities.d.ts.map +1 -1
- package/lib/cjs/Editing/KindOfQuantities.js +50 -57
- package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
- package/lib/cjs/Editing/Mixins.d.ts +5 -5
- package/lib/cjs/Editing/Mixins.d.ts.map +1 -1
- package/lib/cjs/Editing/Mixins.js +43 -58
- package/lib/cjs/Editing/Mixins.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableArrayProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableEntityClass.d.ts +1 -5
- package/lib/cjs/Editing/Mutable/MutableEntityClass.d.ts.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableEntityClass.js +1 -45
- package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableMixin.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableNavigationProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableStructProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableUnit.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
- package/lib/cjs/Editing/Phenomena.d.ts +7 -7
- package/lib/cjs/Editing/Phenomena.d.ts.map +1 -1
- package/lib/cjs/Editing/Phenomena.js +23 -23
- package/lib/cjs/Editing/Phenomena.js.map +1 -1
- package/lib/cjs/Editing/Properties.d.ts +7 -6
- package/lib/cjs/Editing/Properties.d.ts.map +1 -1
- package/lib/cjs/Editing/Properties.js +99 -46
- package/lib/cjs/Editing/Properties.js.map +1 -1
- package/lib/cjs/Editing/PropertyCategories.d.ts +6 -6
- package/lib/cjs/Editing/PropertyCategories.d.ts.map +1 -1
- package/lib/cjs/Editing/PropertyCategories.js +29 -27
- package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
- package/lib/cjs/Editing/RelationshipClasses.d.ts +15 -17
- package/lib/cjs/Editing/RelationshipClasses.d.ts.map +1 -1
- package/lib/cjs/Editing/RelationshipClasses.js +97 -101
- package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
- package/lib/cjs/Editing/SchemaItems.d.ts +13 -5
- package/lib/cjs/Editing/SchemaItems.d.ts.map +1 -1
- package/lib/cjs/Editing/SchemaItems.js +58 -6
- package/lib/cjs/Editing/SchemaItems.js.map +1 -1
- package/lib/cjs/Editing/Structs.d.ts +3 -3
- package/lib/cjs/Editing/Structs.d.ts.map +1 -1
- package/lib/cjs/Editing/Structs.js +17 -27
- package/lib/cjs/Editing/Structs.js.map +1 -1
- package/lib/cjs/Editing/UnitSystems.d.ts +7 -7
- package/lib/cjs/Editing/UnitSystems.d.ts.map +1 -1
- package/lib/cjs/Editing/UnitSystems.js +22 -20
- package/lib/cjs/Editing/UnitSystems.js.map +1 -1
- package/lib/cjs/Editing/Units.d.ts +6 -6
- package/lib/cjs/Editing/Units.d.ts.map +1 -1
- package/lib/cjs/Editing/Units.js +26 -35
- package/lib/cjs/Editing/Units.js.map +1 -1
- package/lib/cjs/Merging/CAClassMerger.js +2 -2
- package/lib/cjs/Merging/CAClassMerger.js.map +1 -1
- package/lib/cjs/Merging/ClassMerger.d.ts +1 -2
- package/lib/cjs/Merging/ClassMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/ClassMerger.js +15 -39
- package/lib/cjs/Merging/ClassMerger.js.map +1 -1
- package/lib/cjs/Merging/ConstantMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/ConstantMerger.js +2 -3
- package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
- package/lib/cjs/Merging/CustomAttributeMerger.d.ts +4 -5
- package/lib/cjs/Merging/CustomAttributeMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/CustomAttributeMerger.js +8 -18
- package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
- package/lib/cjs/Merging/EntityClassMerger.d.ts +1 -2
- package/lib/cjs/Merging/EntityClassMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/EntityClassMerger.js +3 -10
- package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
- package/lib/cjs/Merging/EnumerationMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/EnumerationMerger.js +8 -10
- package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
- package/lib/cjs/Merging/KindOfQuantityMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/KindOfQuantityMerger.js +2 -3
- package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
- package/lib/cjs/Merging/MixinMerger.js +2 -2
- package/lib/cjs/Merging/MixinMerger.js.map +1 -1
- package/lib/cjs/Merging/PhenomenonMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/PhenomenonMerger.js +1 -2
- package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
- package/lib/cjs/Merging/PropertyCategoryMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/PropertyCategoryMerger.js +1 -2
- package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -1
- package/lib/cjs/Merging/PropertyMerger.d.ts +2 -3
- package/lib/cjs/Merging/PropertyMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/PropertyMerger.js +21 -42
- package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
- package/lib/cjs/Merging/RelationshipClassMerger.d.ts +5 -3
- package/lib/cjs/Merging/RelationshipClassMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/RelationshipClassMerger.js +35 -33
- package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaItemMerger.d.ts +3 -4
- package/lib/cjs/Merging/SchemaItemMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/SchemaItemMerger.js +3 -2
- package/lib/cjs/Merging/SchemaItemMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/SchemaMerger.js +8 -14
- package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
- package/lib/cjs/Merging/UnitSystemMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/UnitSystemMerger.js +1 -2
- package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -1
- package/lib/cjs/Validation/Diagnostic.js.map +1 -1
- package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
- package/lib/cjs/Validation/ECRules.js.map +1 -1
- package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
- package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
- package/lib/cjs/Validation/Rules.js.map +1 -1
- package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
- package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
- package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
- package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-editing.d.ts +1 -0
- package/lib/cjs/ecschema-editing.d.ts.map +1 -1
- package/lib/cjs/ecschema-editing.js +1 -0
- package/lib/cjs/ecschema-editing.js.map +1 -1
- package/package.json +9 -9
- package/public/locales/en/ECSchemaEditing.json +26 -26
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Editing
|
|
8
|
+
*/
|
|
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");
|
|
12
|
+
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
13
|
+
/** @alpha */
|
|
14
|
+
var ECEditingStatus;
|
|
15
|
+
(function (ECEditingStatus) {
|
|
16
|
+
ECEditingStatus[ECEditingStatus["EC_EDITING_ERROR_BASE"] = 196608] = "EC_EDITING_ERROR_BASE";
|
|
17
|
+
ECEditingStatus[ECEditingStatus["Unknown"] = 0] = "Unknown";
|
|
18
|
+
ECEditingStatus[ECEditingStatus["RuleViolation"] = 196609] = "RuleViolation";
|
|
19
|
+
ECEditingStatus[ECEditingStatus["SchemaNotFound"] = 196610] = "SchemaNotFound";
|
|
20
|
+
ECEditingStatus[ECEditingStatus["SchemaItemNotFound"] = 196611] = "SchemaItemNotFound";
|
|
21
|
+
ECEditingStatus[ECEditingStatus["SchemaItemNotFoundInContext"] = 196612] = "SchemaItemNotFoundInContext";
|
|
22
|
+
ECEditingStatus[ECEditingStatus["PropertyAlreadyExists"] = 196613] = "PropertyAlreadyExists";
|
|
23
|
+
ECEditingStatus[ECEditingStatus["PropertyNotFound"] = 196614] = "PropertyNotFound";
|
|
24
|
+
ECEditingStatus[ECEditingStatus["InvalidPropertyType"] = 196615] = "InvalidPropertyType";
|
|
25
|
+
ECEditingStatus[ECEditingStatus["BaseClassIsNotElement"] = 196616] = "BaseClassIsNotElement";
|
|
26
|
+
ECEditingStatus[ECEditingStatus["BaseClassIsNotElementUniqueAspect"] = 196617] = "BaseClassIsNotElementUniqueAspect";
|
|
27
|
+
ECEditingStatus[ECEditingStatus["BaseClassIsNotElementMultiAspect"] = 196618] = "BaseClassIsNotElementMultiAspect";
|
|
28
|
+
ECEditingStatus[ECEditingStatus["SchemaItemNameNotSpecified"] = 196619] = "SchemaItemNameNotSpecified";
|
|
29
|
+
ECEditingStatus[ECEditingStatus["InvalidSchemaItemType"] = 196620] = "InvalidSchemaItemType";
|
|
30
|
+
ECEditingStatus[ECEditingStatus["SchemaItemNameAlreadyExists"] = 196621] = "SchemaItemNameAlreadyExists";
|
|
31
|
+
ECEditingStatus[ECEditingStatus["InvalidEnumeratorType"] = 196622] = "InvalidEnumeratorType";
|
|
32
|
+
ECEditingStatus[ECEditingStatus["InvalidBaseClass"] = 196623] = "InvalidBaseClass";
|
|
33
|
+
ECEditingStatus[ECEditingStatus["EnumeratorDoesNotExist"] = 196624] = "EnumeratorDoesNotExist";
|
|
34
|
+
ECEditingStatus[ECEditingStatus["InvalidStrengthDirection"] = 196625] = "InvalidStrengthDirection";
|
|
35
|
+
ECEditingStatus[ECEditingStatus["InvalidECName"] = 196626] = "InvalidECName";
|
|
36
|
+
ECEditingStatus[ECEditingStatus["InvalidFormatUnitsSpecified"] = 196627] = "InvalidFormatUnitsSpecified";
|
|
37
|
+
// 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";
|
|
95
|
+
})(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 = {}));
|
|
104
|
+
var PropertyTypeName;
|
|
105
|
+
(function (PropertyTypeName) {
|
|
106
|
+
PropertyTypeName["ArrayProperty"] = "ArrayProperty";
|
|
107
|
+
PropertyTypeName["PrimitiveProperty"] = "PrimitiveProperty";
|
|
108
|
+
PropertyTypeName["EnumerationProperty"] = "EnumerationProperty";
|
|
109
|
+
PropertyTypeName["NavigationProperty"] = "NavigationProperty";
|
|
110
|
+
PropertyTypeName["StructProperty"] = "StructProperty";
|
|
111
|
+
})(PropertyTypeName || (exports.PropertyTypeName = PropertyTypeName = {}));
|
|
112
|
+
class SchemaId {
|
|
113
|
+
constructor(schemaKey) {
|
|
114
|
+
this.name = schemaKey.name;
|
|
115
|
+
this.schemaKey = schemaKey;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.SchemaId = SchemaId;
|
|
119
|
+
class SchemaItemId {
|
|
120
|
+
constructor(schemaItemType, schemaItemKeyOrName, schemaKey) {
|
|
121
|
+
if (typeof (schemaItemKeyOrName) === "string") {
|
|
122
|
+
if (!schemaKey)
|
|
123
|
+
throw new Error("schemaKey if required if the specified schemaItem the name of the schema item.");
|
|
124
|
+
this.schemaKey = schemaKey;
|
|
125
|
+
this.schemaItemKey = new ecschema_metadata_1.SchemaItemKey(schemaItemKeyOrName, schemaKey);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
this.schemaKey = schemaItemKeyOrName.schemaKey;
|
|
129
|
+
this.schemaItemKey = schemaItemKeyOrName;
|
|
130
|
+
}
|
|
131
|
+
this.type = schemaItemType;
|
|
132
|
+
this.name = this.schemaItemKey.fullName;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
exports.SchemaItemId = SchemaItemId;
|
|
136
|
+
class ClassId extends SchemaItemId {
|
|
137
|
+
constructor(schemaItemType, schemaItemKeyOrName, schemaKey) {
|
|
138
|
+
super(schemaItemType, schemaItemKeyOrName, schemaKey);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.ClassId = ClassId;
|
|
142
|
+
class PropertyId {
|
|
143
|
+
constructor(schemaItemType, classKey, property, typeName) {
|
|
144
|
+
this.name = property instanceof ecschema_metadata_1.Property ? property.name : property;
|
|
145
|
+
this.fullName = property instanceof ecschema_metadata_1.Property ? property.fullName : `${classKey.name}.${property}`;
|
|
146
|
+
this.ecClass = new ClassId(schemaItemType, classKey);
|
|
147
|
+
this.schemaKey = classKey.schemaKey;
|
|
148
|
+
this.typeName = typeName;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
exports.PropertyId = PropertyId;
|
|
152
|
+
class EnumerationId extends SchemaItemId {
|
|
153
|
+
constructor(enumeration, enumerator) {
|
|
154
|
+
super(ecschema_metadata_1.SchemaItemType.Enumeration, enumeration.key);
|
|
155
|
+
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";
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
exports.EnumerationId = EnumerationId;
|
|
166
|
+
class CustomAttributeId {
|
|
167
|
+
constructor(name, container) {
|
|
168
|
+
this.name = name;
|
|
169
|
+
this.schemaKey = container.schema.schemaKey;
|
|
170
|
+
this.containerFullName = container.fullName;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.CustomAttributeId = CustomAttributeId;
|
|
174
|
+
class RelationshipConstraintId {
|
|
175
|
+
constructor(constraint) {
|
|
176
|
+
this.name = constraint.fullName;
|
|
177
|
+
this.relationshipKey = constraint.relationshipClass.key;
|
|
178
|
+
this.schemaKey = this.relationshipKey.schemaKey;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
exports.RelationshipConstraintId = RelationshipConstraintId;
|
|
182
|
+
/**
|
|
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
|
+
* An exception class for the ecschema-editing API. Contains identifiers for schema types involved in the
|
|
248
|
+
* exception. An example being SchemaItemId which contains the name of the SchemaItem, SchemaItemKey, SchemaItemType, etc.
|
|
249
|
+
* Typically will contain an innerError of type SchemaEditingError containing the identifier of the schema item that
|
|
250
|
+
* caused the exception. The containing error instance will identify the method called (identified by the errorNumber)
|
|
251
|
+
* and the identifier of the schema item being modified/created.
|
|
252
|
+
*/
|
|
253
|
+
class SchemaEditingError extends core_bentley_1.BentleyError {
|
|
254
|
+
/**
|
|
255
|
+
* Constructs a new SchemaEditingError instance.
|
|
256
|
+
* @param errorNumber The unique ECEditingStatus code identifying the error.
|
|
257
|
+
* @param identifier The identifier instance containing information about the EC object involved with the exception.
|
|
258
|
+
* @param innerError The SchemaEditingError containing the identifier of the EC object that caused the initial exception.
|
|
259
|
+
* @param ruleViolations Will contain EC rule violations of type [[AnyDiagnostic]] for exceptions with the error code ECEditingStatus.RuleViolation.
|
|
260
|
+
* @param message Optional error message. Most messages on automatically generated by this class based on the ECEditingStatus code.
|
|
261
|
+
*/
|
|
262
|
+
constructor(errorNumber, identifier, innerError, ruleViolations, message) {
|
|
263
|
+
super(errorNumber, message);
|
|
264
|
+
this.errorNumber = errorNumber;
|
|
265
|
+
this.identifier = identifier;
|
|
266
|
+
this.innerError = innerError;
|
|
267
|
+
this._ruleViolations = ruleViolations;
|
|
268
|
+
this._schemaKey = identifier.schemaKey,
|
|
269
|
+
this.generateMessage();
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Gets the SchemaId instance.
|
|
273
|
+
* @throws Error if the identifier is not an instance of SchemaId.
|
|
274
|
+
*/
|
|
275
|
+
get schemaId() {
|
|
276
|
+
if (!isSchemaIdentifier(this.identifier))
|
|
277
|
+
throw new Error("identifier is not a SchemaId.");
|
|
278
|
+
return this.identifier;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Gets the SchemaItemId instance.
|
|
282
|
+
* @throws Error if the identifier is not an instance of SchemaItemId.
|
|
283
|
+
*/
|
|
284
|
+
get schemaItemId() {
|
|
285
|
+
if (!isSchemaItemIdentifier(this.identifier))
|
|
286
|
+
throw new Error("identifier is not a SchemaItemId.");
|
|
287
|
+
return this.identifier;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Gets the ClassId instance.
|
|
291
|
+
* @throws Error if the identifier is not an instance of ClassId.
|
|
292
|
+
*/
|
|
293
|
+
get classId() {
|
|
294
|
+
if (!isClassIdentifier(this.identifier))
|
|
295
|
+
throw new Error("identifier is not a ClassId.");
|
|
296
|
+
return this.identifier;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Gets the PropertyId instance.
|
|
300
|
+
* @throws Error if the identifier is not an instance of PropertyId.
|
|
301
|
+
*/
|
|
302
|
+
get propertyId() {
|
|
303
|
+
if (!isPropertyIdentifier(this.identifier))
|
|
304
|
+
throw new Error("identifier is not a PropertyId.");
|
|
305
|
+
return this.identifier;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Gets the EnumerationId instance.
|
|
309
|
+
* @throws Error if the identifier is not an instance of EnumerationId.
|
|
310
|
+
*/
|
|
311
|
+
get enumerationId() {
|
|
312
|
+
if (!isEnumerationIdentifier(this.identifier))
|
|
313
|
+
throw new Error("identifier is not a EnumerationId.");
|
|
314
|
+
return this.identifier;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Gets the CustomAttributeId instance.
|
|
318
|
+
* @throws Error if the identifier is not an instance of CustomAttributeId.
|
|
319
|
+
*/
|
|
320
|
+
get customAttributeId() {
|
|
321
|
+
if (!isCustomAttributeIdentifier(this.identifier))
|
|
322
|
+
throw new Error("identifier is not a CustomAttributeId.");
|
|
323
|
+
return this.identifier;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Gets the RelationshipConstraintId instance.
|
|
327
|
+
* @throws Error if the identifier is not an instance of RelationshipConstraintId.
|
|
328
|
+
*/
|
|
329
|
+
get relationshipConstraintId() {
|
|
330
|
+
if (!isRelationshipConstraintIdentifier(this.identifier))
|
|
331
|
+
throw new Error("identifier is not a RelationshipConstraintId.");
|
|
332
|
+
return this.identifier;
|
|
333
|
+
}
|
|
334
|
+
get ruleViolations() {
|
|
335
|
+
return this._ruleViolations;
|
|
336
|
+
}
|
|
337
|
+
toDebugString() {
|
|
338
|
+
let innerMessage = "";
|
|
339
|
+
if (this.innerError) {
|
|
340
|
+
if (this.innerError instanceof SchemaEditingError)
|
|
341
|
+
innerMessage = `: Inner error: ${this.innerError.toDebugString()}`;
|
|
342
|
+
else
|
|
343
|
+
innerMessage = `: Inner error: ${this.innerError.message}`;
|
|
344
|
+
}
|
|
345
|
+
return this._appendMessage(`ECEditingStatus.${ECEditingStatus[this.errorNumber]}`) + innerMessage;
|
|
346
|
+
}
|
|
347
|
+
_appendMessage(e) {
|
|
348
|
+
return this.message ? `${e}: ${this.message}` : e;
|
|
349
|
+
}
|
|
350
|
+
generateMessage() {
|
|
351
|
+
if (this.message)
|
|
352
|
+
return;
|
|
353
|
+
switch (this.errorNumber) {
|
|
354
|
+
case ECEditingStatus.SchemaNotFound:
|
|
355
|
+
this.message = `Schema Key ${this._schemaKey.toString(true)} could not be found in the context.`;
|
|
356
|
+
return;
|
|
357
|
+
case ECEditingStatus.SchemaItemNotFound:
|
|
358
|
+
this.message = `${this.schemaItemId.type} ${this.schemaItemId.name} could not be found in the schema ${this._schemaKey.name}.`;
|
|
359
|
+
return;
|
|
360
|
+
case ECEditingStatus.SchemaItemNotFoundInContext:
|
|
361
|
+
this.message = `${this.schemaItemId.type} ${this.schemaItemId.name} could not be found in the schema context.`;
|
|
362
|
+
return;
|
|
363
|
+
case ECEditingStatus.InvalidSchemaItemType:
|
|
364
|
+
this.message = `Expected ${this.schemaItemId.name} to be of type ${this.schemaItemId.type}.`;
|
|
365
|
+
return;
|
|
366
|
+
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.`;
|
|
368
|
+
return;
|
|
369
|
+
case ECEditingStatus.SchemaItemNameAlreadyExists:
|
|
370
|
+
this.message = `${this.schemaItemId.type} ${this.schemaItemId.name} already exists in the schema ${this._schemaKey.name}.`;
|
|
371
|
+
return;
|
|
372
|
+
case ECEditingStatus.RuleViolation:
|
|
373
|
+
this.message = this.getRuleViolationMessage();
|
|
374
|
+
return;
|
|
375
|
+
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}.`;
|
|
377
|
+
return;
|
|
378
|
+
case ECEditingStatus.PropertyAlreadyExists:
|
|
379
|
+
this.message = `An ECProperty with the name ${this.propertyId.name} already exists in the class ${this.propertyId.ecClass.name}.`;
|
|
380
|
+
return;
|
|
381
|
+
case ECEditingStatus.InvalidPropertyType:
|
|
382
|
+
this.message = `Expected property ${this.propertyId.name} to be of type ${this.propertyId.typeName}.`;
|
|
383
|
+
return;
|
|
384
|
+
case ECEditingStatus.BaseClassIsNotElement:
|
|
385
|
+
this.message = `Expected base class ${this.schemaItemId.name} to derive from BisCore.Element.`;
|
|
386
|
+
return;
|
|
387
|
+
case ECEditingStatus.BaseClassIsNotElementUniqueAspect:
|
|
388
|
+
this.message = `Expected base class ${this.schemaItemId.name} to derive from BisCore.ElementUniqueAspect.`;
|
|
389
|
+
return;
|
|
390
|
+
case ECEditingStatus.BaseClassIsNotElementMultiAspect:
|
|
391
|
+
this.message = `Expected base class ${this.schemaItemId.name} to derive from BisCore.ElementMultiAspect.`;
|
|
392
|
+
return;
|
|
393
|
+
case ECEditingStatus.InvalidFormatUnitsSpecified:
|
|
394
|
+
this.message = `The specified Format unit ${this.schemaItemId.name} is not of type Unit or InvertedUnit`;
|
|
395
|
+
return;
|
|
396
|
+
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}.`;
|
|
398
|
+
return;
|
|
399
|
+
case ECEditingStatus.EnumeratorDoesNotExist:
|
|
400
|
+
this.message = `Enumerator ${this.enumerationId.enumeratorName} does not exists in Enumeration ${this.enumerationId.name}.`;
|
|
401
|
+
return;
|
|
402
|
+
case ECEditingStatus.InvalidECName:
|
|
403
|
+
this.message = `Could not rename class ${this.schemaItemId.name} because the specified name is not a valid ECName.`;
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
getRuleViolationMessage() {
|
|
408
|
+
if (!this._ruleViolations)
|
|
409
|
+
return "";
|
|
410
|
+
let violations = "";
|
|
411
|
+
for (const diagnostic of this._ruleViolations) {
|
|
412
|
+
violations += `${diagnostic.code}: ${diagnostic.messageText}\r\n`;
|
|
413
|
+
}
|
|
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.");
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
exports.SchemaEditingError = SchemaEditingError;
|
|
426
|
+
//# sourceMappingURL=Exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/Editing/Exception.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAmD;AAEnD,gEAAwM;AA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AAG,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,WAAW,MAAM,CAAC;QACpE,CAAC;QAED,IAAI,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC;YACrC,OAAO,wCAAwC,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAErF,IAAI,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC;YACzC,OAAO,iCAAiC,IAAI,CAAC,YAAY,CAAC,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAE5G,IAAI,2BAA2B,CAAC,IAAI,CAAC,UAAU,CAAC;YAC9C,OAAO,iDAAiD,IAAI,CAAC,iBAAiB,CAAC,IAAI,eAAe,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;QAE9J,IAAI,kCAAkC,CAAC,IAAI,CAAC,UAAU,CAAC;YACrD,OAAO,4CAA4C,IAAI,CAAC,wBAAwB,CAAC,IAAI,yBAAyB,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;QAExL,MAAM,IAAI,KAAK,CAAE,sEAAsE,CAAC,CAAC;IAC3F,CAAC;CACF;AA9LD,gDA8LC","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 { BentleyError } from \"@itwin/core-bentley\";\r\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { AnyEnumerator, CustomAttributeContainerProps, Enumeration, primitiveTypeToString, Property, RelationshipConstraint, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\n\r\n/** @alpha */\r\nexport enum ECEditingStatus {\r\n EC_EDITING_ERROR_BASE = 0x30000,\r\n Unknown = 0,\r\n RuleViolation = EC_EDITING_ERROR_BASE + 1,\r\n SchemaNotFound,\r\n SchemaItemNotFound,\r\n SchemaItemNotFoundInContext,\r\n PropertyAlreadyExists,\r\n PropertyNotFound,\r\n InvalidPropertyType,\r\n BaseClassIsNotElement,\r\n BaseClassIsNotElementUniqueAspect,\r\n BaseClassIsNotElementMultiAspect,\r\n SchemaItemNameNotSpecified,\r\n InvalidSchemaItemType,\r\n SchemaItemNameAlreadyExists,\r\n InvalidEnumeratorType,\r\n InvalidBaseClass,\r\n EnumeratorDoesNotExist,\r\n InvalidStrengthDirection,\r\n InvalidECName,\r\n InvalidFormatUnitsSpecified,\r\n // Outer Errors\r\n CreateSchemaItemFailed,\r\n CreateSchemaItemFromProps,\r\n CreateElement,\r\n CreateElementUniqueAspect,\r\n CreateElementMultiAspect,\r\n SetBaseClass,\r\n SetSourceConstraint,\r\n SetTargetConstraint,\r\n AddConstraintClass,\r\n RemoveConstraintClass,\r\n SetAbstractConstraint,\r\n AddCustomAttributeToConstraint,\r\n AddCustomAttributeToProperty,\r\n AddCustomAttributeToClass,\r\n CreateNavigationProperty,\r\n CreateNavigationPropertyFromProps,\r\n SetInvertsUnit,\r\n SetUnitSystem,\r\n SetDescription,\r\n SetLabel,\r\n SetIsReadOnly,\r\n SetPriority,\r\n SetCategory,\r\n SetMinOccurs,\r\n SetMaxOccurs,\r\n SetExtendedTypeName,\r\n SetMinLength,\r\n SetMaxLength,\r\n SetMinValue,\r\n SetMaxValue,\r\n SetPropertyName,\r\n AddMixin,\r\n AddEnumerator,\r\n SetEnumeratorLabel,\r\n SetEnumeratorDescription,\r\n AddPresentationUnit,\r\n AddPresentationOverride,\r\n CreateFormatOverride,\r\n SetPropertyCategoryPriority,\r\n CreatePrimitiveProperty,\r\n CreatePrimitivePropertyFromProps,\r\n CreateEnumerationProperty,\r\n CreateEnumerationPropertyFromProps,\r\n CreatePrimitiveArrayProperty,\r\n CreatePrimitiveArrayPropertyFromProps,\r\n CreateEnumerationArrayProperty,\r\n CreateEnumerationArrayPropertyFromProps,\r\n CreateStructProperty,\r\n CreateStructPropertyFromProps,\r\n CreateStructArrayProperty,\r\n CreateStructArrayPropertyFromProps,\r\n DeleteProperty,\r\n DeleteClass,\r\n SetClassName,\r\n AddSchemaReference,\r\n SetSchemaVersion,\r\n IncrementSchemaMinorVersion,\r\n}\r\n\r\nexport type AnyEditingError = SchemaEditingError | Error;\r\n\r\nexport enum TaskType {\r\n Add,\r\n Create,\r\n Update,\r\n Change,\r\n Delete\r\n}\r\n\r\nexport enum PropertyTypeName {\r\n ArrayProperty = \"ArrayProperty\",\r\n PrimitiveProperty = \"PrimitiveProperty\",\r\n EnumerationProperty = \"EnumerationProperty\",\r\n NavigationProperty = \"NavigationProperty\",\r\n StructProperty = \"StructProperty\"\r\n}\r\n\r\ntype ECClassSchemaItems = SchemaItemType.EntityClass | SchemaItemType.StructClass | SchemaItemType.RelationshipClass | SchemaItemType.Mixin | SchemaItemType.CustomAttributeClass;\r\n\r\nexport interface SchemaTypeIdentifier {\r\n name: string;\r\n}\r\n\r\nexport class SchemaId implements SchemaTypeIdentifier {\r\n public readonly name: string;\r\n public readonly schemaKey: SchemaKey;\r\n constructor(schemaKey: SchemaKey) {\r\n this.name = schemaKey.name;\r\n this.schemaKey = schemaKey;\r\n }\r\n}\r\n\r\nexport class SchemaItemId implements SchemaTypeIdentifier {\r\n public readonly name: string;\r\n public readonly type: SchemaItemType;\r\n public readonly schemaKey: SchemaKey;\r\n public readonly schemaItemKey: SchemaItemKey;\r\n constructor(schemaItemType: SchemaItemType, schemaItemKeyOrName: SchemaItemKey | string, schemaKey?: SchemaKey) {\r\n if (typeof(schemaItemKeyOrName) === \"string\") {\r\n if (!schemaKey)\r\n throw new Error(\"schemaKey if required if the specified schemaItem the name of the schema item.\");\r\n\r\n this.schemaKey = schemaKey!;\r\n this.schemaItemKey = new SchemaItemKey(schemaItemKeyOrName, schemaKey);\r\n } else {\r\n this.schemaKey = schemaItemKeyOrName.schemaKey;\r\n this.schemaItemKey = schemaItemKeyOrName;\r\n }\r\n\r\n this.type = schemaItemType;\r\n this.name = this.schemaItemKey.fullName;\r\n }\r\n}\r\n\r\nexport class ClassId extends SchemaItemId {\r\n constructor(schemaItemType: ECClassSchemaItems, schemaItemKeyOrName: SchemaItemKey | string, schemaKey?: SchemaKey) {\r\n super(schemaItemType, schemaItemKeyOrName, schemaKey);\r\n }\r\n}\r\n\r\nexport class PropertyId implements SchemaTypeIdentifier {\r\n public readonly name: string;\r\n public readonly fullName: string;\r\n public readonly ecClass: ClassId;\r\n public readonly schemaKey: SchemaKey;\r\n public readonly typeName?: PropertyTypeName;\r\n\r\n constructor(schemaItemType: ECClassSchemaItems, classKey: SchemaItemKey, property: Property | string, typeName?: PropertyTypeName) {\r\n this.name = property instanceof Property ? property.name : property;\r\n this.fullName = property instanceof Property ? property.fullName : `${classKey.name}.${property}`;\r\n this.ecClass = new ClassId(schemaItemType, classKey);\r\n this.schemaKey = classKey.schemaKey;\r\n this.typeName = typeName;\r\n }\r\n}\r\n\r\nexport class EnumerationId extends SchemaItemId {\r\n public readonly enumerationType: string;\r\n public readonly enumeratorName: string;\r\n public readonly enumeratorType: string;\r\n constructor(enumeration: Enumeration, enumerator: AnyEnumerator | string) {\r\n super(SchemaItemType.Enumeration, enumeration.key);\r\n this.enumerationType = enumeration.type ? primitiveTypeToString(enumeration.type) : \"string\";\r\n this.enumeratorName = typeof(enumerator) === \"string\" ? enumerator : enumerator.name;\r\n this.enumeratorType = this.getEnumeratorType(enumeration, enumerator);\r\n }\r\n\r\n private getEnumeratorType(enumeration: Enumeration, enumerator: AnyEnumerator | string) {\r\n if (typeof(enumerator) === \"string\")\r\n return enumeration.isString ? \"string\" : \"int\";\r\n\r\n return typeof(enumerator.value) === \"string\" ? \"string\" : \"int\";\r\n }\r\n}\r\n\r\nexport class CustomAttributeId implements SchemaTypeIdentifier {\r\n public readonly name: string;\r\n public readonly schemaKey: SchemaKey;\r\n public readonly containerFullName: string;\r\n constructor(name: string, container: CustomAttributeContainerProps) {\r\n this.name = name;\r\n this.schemaKey = container.schema.schemaKey;\r\n this.containerFullName = container.fullName;\r\n }\r\n}\r\n\r\nexport class RelationshipConstraintId implements SchemaTypeIdentifier {\r\n public readonly name: string;\r\n public readonly relationshipKey: SchemaItemKey;\r\n public readonly schemaKey: SchemaKey;\r\n constructor(constraint: RelationshipConstraint) {\r\n this.name = constraint.fullName;\r\n this.relationshipKey = constraint.relationshipClass.key;\r\n this.schemaKey = this.relationshipKey.schemaKey;\r\n }\r\n}\r\n\r\ntype AnyIdentifier = SchemaId | PropertyId | CustomAttributeId | RelationshipConstraintId | EnumerationId;\r\n\r\n/**\r\n * Indicates if the given identifier is a SchemaId instance.\r\n * @param identifier The identifier to check.\r\n * @returns true if the identifier is the correct type.\r\n */\r\nexport function isSchemaIdentifier(identifier: AnyIdentifier): identifier is SchemaId {\r\n return identifier instanceof SchemaId;\r\n}\r\n\r\n/**\r\n * Indicates if the given identifier is a SchemaId instance.\r\n * @param identifier The identifier to check.\r\n * @returns true if the identifier is the correct type.\r\n */\r\nexport function isSchemaItemIdentifier(identifier: AnyIdentifier): identifier is SchemaItemId {\r\n return identifier instanceof SchemaItemId;\r\n}\r\n\r\n/**\r\n * Indicates if the given identifier is a ClassId instance.\r\n * @param identifier The identifier to check.\r\n * @returns true if the identifier is the correct type.\r\n */\r\nexport function isClassIdentifier(identifier: AnyIdentifier): identifier is ClassId {\r\n return identifier instanceof ClassId;\r\n}\r\n\r\n/**\r\n * Indicates if the given identifier is a PropertyId instance.\r\n * @param identifier The identifier to check.\r\n * @returns true if the identifier is the correct type.\r\n */\r\nexport function isPropertyIdentifier(identifier: AnyIdentifier): identifier is PropertyId {\r\n return identifier instanceof PropertyId;\r\n}\r\n\r\n/**\r\n * Indicates if the given identifier is a EnumerationId instance.\r\n * @param identifier The identifier to check.\r\n * @returns true if the identifier is the correct type.\r\n */\r\nexport function isEnumerationIdentifier(identifier: AnyIdentifier): identifier is EnumerationId {\r\n return identifier instanceof EnumerationId;\r\n}\r\n\r\n/**\r\n * Indicates if the given identifier is a CustomAttributeId instance.\r\n * @param identifier The identifier to check.\r\n * @returns true if the identifier is the correct type.\r\n */\r\nexport function isCustomAttributeIdentifier(identifier: AnyIdentifier): identifier is CustomAttributeId {\r\n return identifier instanceof CustomAttributeId;\r\n}\r\n\r\n/**\r\n * Indicates if the given identifier is a RelationshipConstraintId instance.\r\n * @param identifier The identifier to check.\r\n * @returns true if the identifier is the correct type.\r\n */\r\nexport function isRelationshipConstraintIdentifier(identifier: AnyIdentifier): identifier is RelationshipConstraintId {\r\n return identifier instanceof RelationshipConstraintId;\r\n}\r\n\r\n/**\r\n * @internal\r\n * An exception class for the ecschema-editing API. Contains identifiers for schema types involved in the\r\n * exception. An example being SchemaItemId which contains the name of the SchemaItem, SchemaItemKey, SchemaItemType, etc.\r\n * Typically will contain an innerError of type SchemaEditingError containing the identifier of the schema item that\r\n * caused the exception. The containing error instance will identify the method called (identified by the errorNumber)\r\n * and the identifier of the schema item being modified/created.\r\n */\r\nexport class SchemaEditingError extends BentleyError {\r\n private _ruleViolations?: AnyDiagnostic[];\r\n private _schemaKey: SchemaKey;\r\n\r\n /**\r\n * Constructs a new SchemaEditingError instance.\r\n * @param errorNumber The unique ECEditingStatus code identifying the error.\r\n * @param identifier The identifier instance containing information about the EC object involved with the exception.\r\n * @param innerError The SchemaEditingError containing the identifier of the EC object that caused the initial exception.\r\n * @param ruleViolations Will contain EC rule violations of type [[AnyDiagnostic]] for exceptions with the error code ECEditingStatus.RuleViolation.\r\n * @param message Optional error message. Most messages on automatically generated by this class based on the ECEditingStatus code.\r\n */\r\n public constructor(public override readonly errorNumber: number, public readonly identifier: AnyIdentifier, public readonly innerError?: AnyEditingError, ruleViolations?: AnyDiagnostic[], message?: string) {\r\n super(errorNumber, message);\r\n this._ruleViolations = ruleViolations;\r\n this._schemaKey = identifier.schemaKey,\r\n this.generateMessage();\r\n }\r\n\r\n /**\r\n * Gets the SchemaId instance.\r\n * @throws Error if the identifier is not an instance of SchemaId.\r\n */\r\n public get schemaId(): SchemaId {\r\n if (!isSchemaIdentifier(this.identifier))\r\n throw new Error(\"identifier is not a SchemaId.\");\r\n return this.identifier as SchemaItemId;\r\n }\r\n\r\n /**\r\n * Gets the SchemaItemId instance.\r\n * @throws Error if the identifier is not an instance of SchemaItemId.\r\n */\r\n public get schemaItemId(): SchemaItemId {\r\n if (!isSchemaItemIdentifier(this.identifier))\r\n throw new Error(\"identifier is not a SchemaItemId.\");\r\n return this.identifier as SchemaItemId;\r\n }\r\n\r\n /**\r\n * Gets the ClassId instance.\r\n * @throws Error if the identifier is not an instance of ClassId.\r\n */\r\n public get classId(): ClassId {\r\n if (!isClassIdentifier(this.identifier))\r\n throw new Error(\"identifier is not a ClassId.\");\r\n return this.identifier;\r\n }\r\n\r\n /**\r\n * Gets the PropertyId instance.\r\n * @throws Error if the identifier is not an instance of PropertyId.\r\n */\r\n public get propertyId(): PropertyId {\r\n if (!isPropertyIdentifier(this.identifier))\r\n throw new Error(\"identifier is not a PropertyId.\");\r\n return this.identifier;\r\n }\r\n\r\n /**\r\n * Gets the EnumerationId instance.\r\n * @throws Error if the identifier is not an instance of EnumerationId.\r\n */\r\n public get enumerationId(): EnumerationId {\r\n if (!isEnumerationIdentifier(this.identifier))\r\n throw new Error(\"identifier is not a EnumerationId.\");\r\n return this.identifier;\r\n }\r\n\r\n /**\r\n * Gets the CustomAttributeId instance.\r\n * @throws Error if the identifier is not an instance of CustomAttributeId.\r\n */\r\n public get customAttributeId(): CustomAttributeId {\r\n if (!isCustomAttributeIdentifier(this.identifier))\r\n throw new Error(\"identifier is not a CustomAttributeId.\");\r\n return this.identifier;\r\n }\r\n\r\n /**\r\n * Gets the RelationshipConstraintId instance.\r\n * @throws Error if the identifier is not an instance of RelationshipConstraintId.\r\n */\r\n public get relationshipConstraintId(): RelationshipConstraintId {\r\n if (!isRelationshipConstraintIdentifier(this.identifier))\r\n throw new Error(\"identifier is not a RelationshipConstraintId.\");\r\n return this.identifier;\r\n }\r\n\r\n public get ruleViolations(): AnyDiagnostic[] | undefined {\r\n return this._ruleViolations;\r\n }\r\n\r\n public toDebugString(): string {\r\n let innerMessage = \"\";\r\n if (this.innerError) {\r\n if (this.innerError instanceof SchemaEditingError)\r\n innerMessage = `: Inner error: ${this.innerError.toDebugString()}`;\r\n else\r\n innerMessage = `: Inner error: ${this.innerError.message}`;\r\n }\r\n return this._appendMessage(`ECEditingStatus.${ECEditingStatus[this.errorNumber]}`) + innerMessage;\r\n }\r\n\r\n private _appendMessage(e: string) {\r\n return this.message ? `${e}: ${this.message}` : e;\r\n }\r\n\r\n private generateMessage() {\r\n if (this.message)\r\n return;\r\n\r\n switch(this.errorNumber) {\r\n case ECEditingStatus.SchemaNotFound:\r\n this.message = `Schema Key ${this._schemaKey.toString(true)} could not be found in the context.`;\r\n return;\r\n case ECEditingStatus.SchemaItemNotFound:\r\n this.message = `${this.schemaItemId.type} ${this.schemaItemId.name} could not be found in the schema ${this._schemaKey.name}.`;\r\n return;\r\n case ECEditingStatus.SchemaItemNotFoundInContext:\r\n this.message = `${this.schemaItemId.type} ${this.schemaItemId.name} could not be found in the schema context.`;\r\n return;\r\n case ECEditingStatus.InvalidSchemaItemType:\r\n this.message = `Expected ${this.schemaItemId.name} to be of type ${this.schemaItemId.type}.`;\r\n return;\r\n case ECEditingStatus.SchemaItemNameNotSpecified:\r\n this.message = `Could not create a new ${this.schemaItemId.type} in schema ${this._schemaKey.name}. No name was supplied within props.`;\r\n return;\r\n case ECEditingStatus.SchemaItemNameAlreadyExists:\r\n this.message = `${this.schemaItemId.type} ${this.schemaItemId.name} already exists in the schema ${this._schemaKey.name}.`;\r\n return;\r\n case ECEditingStatus.RuleViolation:\r\n this.message = this.getRuleViolationMessage();\r\n return;\r\n case ECEditingStatus.PropertyNotFound:\r\n this.message = `An ECProperty with the name ${this.propertyId.name} could not be found in the class ${this.propertyId.ecClass.name}.`;\r\n return;\r\n case ECEditingStatus.PropertyAlreadyExists:\r\n this.message = `An ECProperty with the name ${this.propertyId.name} already exists in the class ${this.propertyId.ecClass.name}.`;\r\n return;\r\n case ECEditingStatus.InvalidPropertyType:\r\n this.message = `Expected property ${this.propertyId.name} to be of type ${this.propertyId.typeName}.`;\r\n return;\r\n case ECEditingStatus.BaseClassIsNotElement:\r\n this.message = `Expected base class ${this.schemaItemId.name} to derive from BisCore.Element.`;\r\n return;\r\n case ECEditingStatus.BaseClassIsNotElementUniqueAspect:\r\n this.message = `Expected base class ${this.schemaItemId.name} to derive from BisCore.ElementUniqueAspect.`;\r\n return;\r\n case ECEditingStatus.BaseClassIsNotElementMultiAspect:\r\n this.message = `Expected base class ${this.schemaItemId.name} to derive from BisCore.ElementMultiAspect.`;\r\n return;\r\n case ECEditingStatus.InvalidFormatUnitsSpecified:\r\n this.message = `The specified Format unit ${this.schemaItemId.name} is not of type Unit or InvertedUnit`;\r\n return;\r\n case ECEditingStatus.InvalidEnumeratorType:\r\n this.message = `The Enumeration ${this.enumerationId.name} has type ${this.enumerationId.enumerationType}, while Enumerator ${this.enumerationId.enumeratorName} has type ${this.enumerationId.enumeratorType}.`;\r\n return;\r\n case ECEditingStatus.EnumeratorDoesNotExist:\r\n this.message = `Enumerator ${this.enumerationId.enumeratorName} does not exists in Enumeration ${this.enumerationId.name}.`;\r\n return;\r\n case ECEditingStatus.InvalidECName:\r\n this.message = `Could not rename class ${this.schemaItemId.name} because the specified name is not a valid ECName.`;\r\n return;\r\n }\r\n }\r\n\r\n private getRuleViolationMessage(): string {\r\n if (!this._ruleViolations)\r\n return \"\";\r\n\r\n let violations = \"\";\r\n for (const diagnostic of this._ruleViolations) {\r\n violations += `${diagnostic.code}: ${diagnostic.messageText}\\r\\n`;\r\n }\r\n\r\n if (isSchemaIdentifier(this.identifier))\r\n return `Rule violations occurred from Schema ${this.schemaId.name}: ${violations}`;\r\n\r\n if (isSchemaItemIdentifier(this.identifier))\r\n return `Rule violations occurred from ${this.schemaItemId.type} ${this.schemaItemId.name}: ${violations}`;\r\n\r\n if (isCustomAttributeIdentifier(this.identifier))\r\n return `Rule violations occurred from CustomAttribute ${this.customAttributeId.name}, container ${this.customAttributeId.containerFullName}: ${violations}`;\r\n\r\n if (isRelationshipConstraintIdentifier(this.identifier))\r\n return `Rule violations occurred from constraint ${this.relationshipConstraintId.name} of RelationshipClass ${this.relationshipConstraintId.relationshipKey.fullName}: ${violations}`;\r\n\r\n throw new Error (\"Could not generate rule violation message due to invalid identifier.\");\r\n }\r\n}\r\n"]}
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { SchemaItemFormatProps, SchemaItemKey, SchemaKey } from "@itwin/ecschema-metadata";
|
|
5
5
|
import { FormatType } from "@itwin/core-quantity";
|
|
6
|
-
import { SchemaContextEditor
|
|
6
|
+
import { SchemaContextEditor } from "./Editor";
|
|
7
|
+
import { SchemaItems } from "./SchemaItems";
|
|
7
8
|
/**
|
|
8
9
|
* @alpha
|
|
9
10
|
* A class allowing you to create schema items of type Format.
|
|
10
11
|
*/
|
|
11
|
-
export declare class Formats {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
create(schemaKey: SchemaKey, name: string, formatType: FormatType, displayLabel?: string, units?: SchemaItemKey[]): Promise<SchemaItemEditResults>;
|
|
12
|
+
export declare class Formats extends SchemaItems {
|
|
13
|
+
constructor(schemaEditor: SchemaContextEditor);
|
|
14
|
+
create(schemaKey: SchemaKey, name: string, formatType: FormatType, displayLabel?: string, units?: SchemaItemKey[]): Promise<SchemaItemKey>;
|
|
15
15
|
/**
|
|
16
16
|
* Creates a format through a SchemaItemFormatProps.
|
|
17
17
|
* @param schemaKey a SchemaKey of the Schema that will house the new object.
|
|
18
18
|
* @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.
|
|
19
19
|
*/
|
|
20
|
-
createFromProps(schemaKey: SchemaKey, formatProps: SchemaItemFormatProps): Promise<
|
|
20
|
+
createFromProps(schemaKey: SchemaKey, formatProps: SchemaItemFormatProps): Promise<SchemaItemKey>;
|
|
21
21
|
}
|
|
22
22
|
//# sourceMappingURL=Formats.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Formats.d.ts","sourceRoot":"","sources":["../../../src/Editing/Formats.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"Formats.d.ts","sourceRoot":"","sources":["../../../src/Editing/Formats.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAoC,qBAAqB,EAAE,aAAa,EAAkB,SAAS,EAAQ,MAAM,0BAA0B,CAAC;AACnJ,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,qBAAa,OAAQ,SAAQ,WAAW;gBACnB,YAAY,EAAE,mBAAmB;IAIvC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IA0BvJ;;;;OAIG;IACU,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC;CAQ/G"}
|
|
@@ -9,38 +9,36 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.Formats = void 0;
|
|
11
11
|
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
12
|
+
const Exception_1 = require("./Exception");
|
|
13
|
+
const SchemaItems_1 = require("./SchemaItems");
|
|
12
14
|
/**
|
|
13
15
|
* @alpha
|
|
14
16
|
* A class allowing you to create schema items of type Format.
|
|
15
17
|
*/
|
|
16
|
-
class Formats {
|
|
17
|
-
constructor(
|
|
18
|
-
|
|
18
|
+
class Formats extends SchemaItems_1.SchemaItems {
|
|
19
|
+
constructor(schemaEditor) {
|
|
20
|
+
super(ecschema_metadata_1.SchemaItemType.Format, schemaEditor);
|
|
19
21
|
}
|
|
20
22
|
async create(schemaKey, name, formatType, displayLabel, units) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
for (const unit of units) {
|
|
30
|
-
const unitItem = await this._schemaEditor.schemaContext.getSchemaItem(unit);
|
|
31
|
-
if (unitItem === undefined) {
|
|
32
|
-
return { errorMessage: `Failed to locate unit ${unit.name} in Schema Context.` };
|
|
23
|
+
try {
|
|
24
|
+
const newFormat = await this.createSchemaItem(schemaKey, this.schemaItemType, (schema) => schema.createFormat.bind(schema), name);
|
|
25
|
+
if (units !== undefined) {
|
|
26
|
+
for (const unit of units) {
|
|
27
|
+
const unitItem = await this.getSchemaItem(unit, null);
|
|
28
|
+
if (unitItem.schemaItemType !== ecschema_metadata_1.SchemaItemType.Unit && unitItem.schemaItemType !== ecschema_metadata_1.SchemaItemType.InvertedUnit)
|
|
29
|
+
throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.InvalidFormatUnitsSpecified, new Exception_1.SchemaItemId(unitItem.schemaItemType, unitItem.key));
|
|
30
|
+
newFormat.addUnit(unitItem);
|
|
33
31
|
}
|
|
34
|
-
if (unitItem.schemaItemType !== ecschema_metadata_1.SchemaItemType.Unit && unitItem.schemaItemType !== ecschema_metadata_1.SchemaItemType.InvertedUnit)
|
|
35
|
-
return { errorMessage: `${unitItem.fullName} is not of type Unit or InvertedUnit.` };
|
|
36
|
-
newFormat.addUnit(unitItem);
|
|
37
32
|
}
|
|
33
|
+
if (displayLabel)
|
|
34
|
+
newFormat.setDisplayLabel(displayLabel);
|
|
35
|
+
// TODO: Handle the setting of format traits, separators, etc....
|
|
36
|
+
newFormat.setFormatType(formatType);
|
|
37
|
+
return newFormat.key;
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFailed, new Exception_1.SchemaItemId(this.schemaItemType, name, schemaKey), e);
|
|
38
41
|
}
|
|
39
|
-
if (displayLabel)
|
|
40
|
-
newFormat.setDisplayLabel(displayLabel);
|
|
41
|
-
// TODO: Handle the setting of format traits, separators, etc....
|
|
42
|
-
newFormat.setFormatType(formatType);
|
|
43
|
-
return { itemKey: newFormat.key };
|
|
44
42
|
}
|
|
45
43
|
/**
|
|
46
44
|
* Creates a format through a SchemaItemFormatProps.
|
|
@@ -48,16 +46,13 @@ class Formats {
|
|
|
48
46
|
* @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.
|
|
49
47
|
*/
|
|
50
48
|
async createFromProps(schemaKey, formatProps) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return { errorMessage: `Failed to create class ${formatProps.name} in schema ${schemaKey.toString(true)}.` };
|
|
59
|
-
await newFormat.fromJSON(formatProps);
|
|
60
|
-
return { itemKey: newFormat.key };
|
|
49
|
+
try {
|
|
50
|
+
const newFormat = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createFormat.bind(schema), formatProps);
|
|
51
|
+
return newFormat.key;
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.SchemaItemId(this.schemaItemType, formatProps.name, schemaKey), e);
|
|
55
|
+
}
|
|
61
56
|
}
|
|
62
57
|
}
|
|
63
58
|
exports.Formats = Formats;
|