@itwin/ecschema-editing 5.9.0-dev.8 → 5.10.0-dev.1

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 (98) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
  3. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +1 -0
  4. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
  5. package/lib/cjs/Editing/Constants.js +1 -1
  6. package/lib/cjs/Editing/Constants.js.map +1 -1
  7. package/lib/cjs/Editing/CustomAttributes.js +1 -1
  8. package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
  9. package/lib/cjs/Editing/Entities.js +1 -1
  10. package/lib/cjs/Editing/Entities.js.map +1 -1
  11. package/lib/cjs/Editing/Enumerations.js +1 -1
  12. package/lib/cjs/Editing/Enumerations.js.map +1 -1
  13. package/lib/cjs/Editing/Exception.js +2 -2
  14. package/lib/cjs/Editing/Exception.js.map +1 -1
  15. package/lib/cjs/Editing/Formats.js +1 -1
  16. package/lib/cjs/Editing/Formats.js.map +1 -1
  17. package/lib/cjs/Editing/InvertedUnits.js +1 -1
  18. package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
  19. package/lib/cjs/Editing/KindOfQuantities.js +1 -1
  20. package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
  21. package/lib/cjs/Editing/Mixins.js +1 -1
  22. package/lib/cjs/Editing/Mixins.js.map +1 -1
  23. package/lib/cjs/Editing/Phenomena.js +1 -1
  24. package/lib/cjs/Editing/Phenomena.js.map +1 -1
  25. package/lib/cjs/Editing/PropertyCategories.js +1 -1
  26. package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
  27. package/lib/cjs/Editing/RelationshipClasses.d.ts.map +1 -1
  28. package/lib/cjs/Editing/RelationshipClasses.js +3 -1
  29. package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
  30. package/lib/cjs/Editing/Structs.js +1 -1
  31. package/lib/cjs/Editing/Structs.js.map +1 -1
  32. package/lib/cjs/Editing/UnitSystems.js +1 -1
  33. package/lib/cjs/Editing/UnitSystems.js.map +1 -1
  34. package/lib/cjs/Editing/Units.js +1 -1
  35. package/lib/cjs/Editing/Units.js.map +1 -1
  36. package/lib/cjs/Merging/EnumerationMerger.d.ts.map +1 -1
  37. package/lib/cjs/Merging/EnumerationMerger.js +2 -1
  38. package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
  39. package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
  40. package/lib/cjs/Merging/SchemaReferenceMerger.js +1 -1
  41. package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
  42. package/lib/cjs/Validation/DiagnosticReporter.js +1 -1
  43. package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
  44. package/lib/cjs/Validation/ECRules.d.ts.map +1 -1
  45. package/lib/cjs/Validation/ECRules.js +4 -3
  46. package/lib/cjs/Validation/ECRules.js.map +1 -1
  47. package/lib/cjs/Validation/SchemaChanges.d.ts.map +1 -1
  48. package/lib/cjs/Validation/SchemaChanges.js +16 -16
  49. package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
  50. package/lib/esm/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
  51. package/lib/esm/Differencing/SchemaDiagnosticVisitor.js +1 -0
  52. package/lib/esm/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
  53. package/lib/esm/Editing/Constants.js +1 -1
  54. package/lib/esm/Editing/Constants.js.map +1 -1
  55. package/lib/esm/Editing/CustomAttributes.js +1 -1
  56. package/lib/esm/Editing/CustomAttributes.js.map +1 -1
  57. package/lib/esm/Editing/Entities.js +1 -1
  58. package/lib/esm/Editing/Entities.js.map +1 -1
  59. package/lib/esm/Editing/Enumerations.js +1 -1
  60. package/lib/esm/Editing/Enumerations.js.map +1 -1
  61. package/lib/esm/Editing/Exception.js +2 -2
  62. package/lib/esm/Editing/Exception.js.map +1 -1
  63. package/lib/esm/Editing/Formats.js +1 -1
  64. package/lib/esm/Editing/Formats.js.map +1 -1
  65. package/lib/esm/Editing/InvertedUnits.js +1 -1
  66. package/lib/esm/Editing/InvertedUnits.js.map +1 -1
  67. package/lib/esm/Editing/KindOfQuantities.js +1 -1
  68. package/lib/esm/Editing/KindOfQuantities.js.map +1 -1
  69. package/lib/esm/Editing/Mixins.js +1 -1
  70. package/lib/esm/Editing/Mixins.js.map +1 -1
  71. package/lib/esm/Editing/Phenomena.js +1 -1
  72. package/lib/esm/Editing/Phenomena.js.map +1 -1
  73. package/lib/esm/Editing/PropertyCategories.js +1 -1
  74. package/lib/esm/Editing/PropertyCategories.js.map +1 -1
  75. package/lib/esm/Editing/RelationshipClasses.d.ts.map +1 -1
  76. package/lib/esm/Editing/RelationshipClasses.js +3 -1
  77. package/lib/esm/Editing/RelationshipClasses.js.map +1 -1
  78. package/lib/esm/Editing/Structs.js +1 -1
  79. package/lib/esm/Editing/Structs.js.map +1 -1
  80. package/lib/esm/Editing/UnitSystems.js +1 -1
  81. package/lib/esm/Editing/UnitSystems.js.map +1 -1
  82. package/lib/esm/Editing/Units.js +1 -1
  83. package/lib/esm/Editing/Units.js.map +1 -1
  84. package/lib/esm/Merging/EnumerationMerger.d.ts.map +1 -1
  85. package/lib/esm/Merging/EnumerationMerger.js +2 -1
  86. package/lib/esm/Merging/EnumerationMerger.js.map +1 -1
  87. package/lib/esm/Merging/RelationshipClassMerger.js.map +1 -1
  88. package/lib/esm/Merging/SchemaReferenceMerger.js +1 -1
  89. package/lib/esm/Merging/SchemaReferenceMerger.js.map +1 -1
  90. package/lib/esm/Validation/DiagnosticReporter.js +1 -1
  91. package/lib/esm/Validation/DiagnosticReporter.js.map +1 -1
  92. package/lib/esm/Validation/ECRules.d.ts.map +1 -1
  93. package/lib/esm/Validation/ECRules.js +4 -3
  94. package/lib/esm/Validation/ECRules.js.map +1 -1
  95. package/lib/esm/Validation/SchemaChanges.d.ts.map +1 -1
  96. package/lib/esm/Validation/SchemaChanges.js +16 -16
  97. package/lib/esm/Validation/SchemaChanges.js.map +1 -1
  98. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaDiagnosticVisitor.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDiagnosticVisitor.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAEqE,QAAQ,EAClF,sBAAsB,EAA+B,MAAM,EAAE,UAAU,GACxE,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAcL,gBAAgB,GAEjB,MAAM,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,OAAO,uBAAuB;IAElB,iBAAiB,CAAsD;IACvE,qBAAqB,CAGX;IACV,yBAAyB,CAAqC;IAC9D,0BAA0B,CAAmC;IAE7E;QACE,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,yBAAyB,GAAG,EAAE,CAAC;QACpC,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC;IACvC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,UAAyB;QACpC,QAAQ,UAAU,CAAC,IAAI,EAAE,CAAC;YACxB,KAAK,kBAAkB,CAAC,WAAW;gBACjC,OAAO,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,CAAC;YAEvD,KAAK,kBAAkB,CAAC,sBAAsB;gBAC5C,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YACtD,KAAK,kBAAkB,CAAC,oBAAoB;gBAC1C,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YAEzD,KAAK,kBAAkB,CAAC,iBAAiB;gBACvC,OAAO,IAAI,CAAC,sBAAs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AE;gBACV,KAAK;aACN;SACF,CAAC,CAAC;IACL,CAAC;IAAA,CAAC;CACH;AAAA,CAAC;AAEF,SAAS,kBAAkB,CAAC,QAAkB,EAAE,YAAoB;IAClE,OAAO,CAAC,YAAY,KAAK,MAAM,CAAC;QAC9B,CAAC,QAAQ,CAAC,aAAa,EAAE,IAAI,YAAY,KAAK,aAAa,CAAC;QAC5D,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,YAAY,KAAK,eAAe,CAAC;QAC5D,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,YAAY,KAAK,aAAa,CAAC;QACvD,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,YAAY,KAAK,mBAAmB,CAAC,CAAC;AACtE,CAAC","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 Differencing\r\n */\r\n\r\nimport type { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { SchemaCompareCodes } from \"../Validation/SchemaCompareDiagnostics\";\r\nimport {\r\n AnyEnumerator, AnyPropertyProps, AnySchemaItem, CustomAttribute, ECClass,\r\n Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, OverrideFormat, Property, PropertyProps,\r\n RelationshipConstraint, RelationshipConstraintProps, Schema, SchemaItem, Unit,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport {\r\n type AnyClassItemDifference,\r\n type AnySchemaItemDifference,\r\n type AnySchemaItemPathDifference,\r\n type ClassPropertyDifference,\r\n type CustomAttributeDifference,\r\n type DifferenceType,\r\n type EntityClassMixinDifference,\r\n type EnumeratorDifference,\r\n type FormatUnitDifference,\r\n type KindOfQuantityPresentationFormatDifference,\r\n type RelationshipConstraintClassDifference,\r\n type RelationshipConstraintDifference,\r\n type SchemaDifference,\r\n SchemaOtherTypes,\r\n type SchemaReferenceDifference,\r\n} from \"./SchemaDifference\";\r\n\r\n/**\r\n * The SchemaDiagnosticVisitor is a visitor implementation for diagnostic entries\r\n * from the schema comparer api. Depending on the diagnostic code, the difference\r\n * result is build together.\r\n * @internal\r\n */\r\nexport class SchemaDiagnosticVisitor {\r\n\r\n public readonly schemaDifferences: Array<SchemaDifference | SchemaReferenceDifference>;\r\n public readonly schemaItemDifferences: Array<AnySchemaItemDifference\r\n | EntityClassMixinDifference\r\n | KindOfQuantityPresentationFormatDifference\r\n | FormatUnitDifference>;\r\n public readonly schemaItemPathDifferences: Array<AnySchemaItemPathDifference>;\r\n public readonly customAttributeDifferences: Array<CustomAttributeDifference>;\r\n\r\n constructor() {\r\n this.schemaDifferences = [];\r\n this.schemaItemDifferences = [];\r\n this.schemaItemPathDifferences = [];\r\n this.customAttributeDifferences = [];\r\n }\r\n\r\n /**\r\n * Visitor function to process the schema change diagnostic object.\r\n * @internal\r\n */\r\n public visit(diagnostic: AnyDiagnostic) {\r\n switch (diagnostic.code) {\r\n case SchemaCompareCodes.SchemaDelta:\r\n return this.visitChangedSchemaProperties(diagnostic);\r\n\r\n case SchemaCompareCodes.SchemaReferenceMissing:\r\n return this.visitSchemaReference(diagnostic, \"add\");\r\n case SchemaCompareCodes.SchemaReferenceDelta:\r\n return this.visitSchemaReference(diagnostic, \"modify\");\r\n\r\n case SchemaCompareCodes.SchemaItemMissing:\r\n return this.visitMissingSchemaItem(diagnostic);\r\n\r\n case SchemaCompareCodes.SchemaItemDelta:\r\n case SchemaCompareCodes.ClassDelta:\r\n case SchemaCompareCodes.ConstantDelta:\r\n case SchemaCompareCodes.CustomAttributeClassDelta:\r\n case SchemaCompareCodes.FormatDelta:\r\n case SchemaCompareCodes.InvertedUnitDelta:\r\n case SchemaCompareCodes.KoqDelta:\r\n case SchemaCompareCodes.MixinDelta:\r\n case SchemaCompareCodes.PhenomenonDelta:\r\n case SchemaCompareCodes.PropertyCategoryDelta:\r\n case SchemaCompareCodes.RelationshipDelta:\r\n case SchemaCompareCodes.UnitDelta:\r\n case SchemaCompareCodes.EnumerationDelta:\r\n return this.visitChangedSchemaItem(diagnostic);\r\n\r\n case SchemaCompareCodes.EnumeratorDelta:\r\n return this.visitChangedEnumerator(diagnostic);\r\n case SchemaCompareCodes.EnumeratorMissing:\r\n return this.visitMissingEnumerator(diagnostic);\r\n\r\n case SchemaCompareCodes.BaseClassDelta:\r\n return this.visitMissingBaseClass(diagnostic);\r\n case SchemaCompareCodes.EntityMixinMissing:\r\n return this.visitMissingMixinOnClass(diagnostic);\r\n case SchemaCompareCodes.PropertyDelta:\r\n return this.visitChangedProperty(diagnostic);\r\n case SchemaCompareCodes.PropertyMissing:\r\n return this.visitMissingProperty(diagnostic);\r\n\r\n case SchemaCompareCodes.RelationshipConstraintClassMissing:\r\n return this.visitMissingRelationshipConstraintClass(diagnostic);\r\n case SchemaCompareCodes.RelationshipConstraintDelta:\r\n return this.visitChangedRelationshipConstraint(diagnostic);\r\n\r\n case SchemaCompareCodes.CustomAttributeInstanceClassMissing:\r\n return this.visitMissingCustomAttributeInstance(diagnostic);\r\n\r\n case SchemaCompareCodes.PresentationUnitMissing:\r\n return this.visitMissingPresentationUnit(diagnostic);\r\n\r\n case SchemaCompareCodes.FormatUnitMissing:\r\n return this.visitMissingFormatUnit(diagnostic);\r\n case SchemaCompareCodes.UnitLabelOverrideDelta:\r\n return this.visitChangedFormatUnitLabel(diagnostic);\r\n }\r\n return;\r\n }\r\n\r\n private visitChangedSchemaProperties(diagnostic: AnyDiagnostic) {\r\n let modifyEntry = this.schemaDifferences.find((entry): entry is SchemaDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Schema;\r\n });\r\n\r\n let hasChanges = false;\r\n let addEntry = false;\r\n if (modifyEntry === undefined) {\r\n addEntry = true;\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.Schema,\r\n difference: {},\r\n };\r\n }\r\n\r\n // Only label and description are taken from the source schema. If the schema name or alias\r\n // differs, those are ignored for now.\r\n const [propertyName, propertyValue] = diagnostic.messageArgs as [string, any];\r\n if (propertyName === \"label\") {\r\n modifyEntry.difference.label = propertyValue;\r\n hasChanges = true;\r\n }\r\n if (propertyName === \"description\") {\r\n modifyEntry.difference.description = propertyValue;\r\n hasChanges = true;\r\n }\r\n\r\n if (addEntry && hasChanges) {\r\n this.schemaDifferences.push(modifyEntry);\r\n }\r\n }\r\n\r\n private visitMissingSchemaItem(diagnostic: AnyDiagnostic) {\r\n const schemaItem = diagnostic.ecDefinition as AnySchemaItem;\r\n\r\n this.schemaItemDifferences.push({\r\n changeType: \"add\",\r\n schemaType: schemaItem.schemaItemType,\r\n itemName: schemaItem.name,\r\n difference: schemaItem.toJSON(),\r\n });\r\n }\r\n\r\n private visitChangedSchemaItem(diagnostic: AnyDiagnostic) {\r\n const schemaItem = diagnostic.ecDefinition as AnySchemaItem;\r\n const [propertyName, sourceValue, _targetValue] = diagnostic.messageArgs as [string, unknown, unknown];\r\n if (propertyName === \"schemaItemType\") {\r\n // If the schema item type is different, the whole item is added as \"new\" item. The\r\n // difference validator will then figure whether there is a conflict with items of\r\n // of the same name.\r\n return this.visitMissingSchemaItem(diagnostic);\r\n }\r\n\r\n if (sourceValue === undefined) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is AnySchemaItemDifference => {\r\n return entry.changeType === \"modify\" && entry.itemName === schemaItem.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: schemaItem.schemaItemType,\r\n itemName: schemaItem.name,\r\n difference: {},\r\n } as AnySchemaItemDifference;\r\n this.schemaItemDifferences.push(modifyEntry);\r\n }\r\n\r\n // TODO: Since propertyName is type of string, the compiler complains about accepting\r\n // an unspecific string as property indexer. Casted to any as short term fix but that\r\n // needs to be handled better in future.\r\n (modifyEntry.difference as any)[propertyName] = sourceValue;\r\n }\r\n\r\n private visitMissingEnumerator(diagnostic: AnyDiagnostic) {\r\n const enumeration = diagnostic.ecDefinition as Enumeration;\r\n const [enumerator] = diagnostic.messageArgs as [AnyEnumerator];\r\n this.schemaItemPathDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.Enumerator,\r\n itemName: enumeration.name,\r\n path: \"$enumerators\",\r\n difference: enumerator,\r\n });\r\n }\r\n\r\n private lookupEnumeratorEntry(changeType: DifferenceType, item: string, enumeratorName: string) {\r\n return this.schemaItemPathDifferences.find((change) => {\r\n return change.changeType === changeType\r\n && change.schemaType === SchemaOtherTypes.Enumerator\r\n && change.itemName === item\r\n && change.path === \"$enumerators\"\r\n && change.difference.name === enumeratorName;\r\n });\r\n }\r\n\r\n private visitChangedEnumerator(diagnostic: AnyDiagnostic) {\r\n const enumeration = diagnostic.ecDefinition as Enumeration;\r\n const [enumerator, propertyName, sourceValue] = diagnostic.messageArgs as [AnyEnumerator, keyof AnyEnumerator, any];\r\n if (this.lookupEnumeratorEntry(\"add\", enumeration.name, enumerator.name)) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is EnumeratorDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Enumerator && entry.itemName === enumeration.name && entry.path === enumerator.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.Enumerator,\r\n itemName: enumeration.name,\r\n path: enumerator.name,\r\n difference: {},\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n if (sourceValue !== undefined) {\r\n modifyEntry.difference[propertyName] = sourceValue;\r\n }\r\n }\r\n\r\n private visitMissingProperty(diagnostic: AnyDiagnostic) {\r\n const property = diagnostic.ecDefinition as Property;\r\n this.schemaItemPathDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.Property,\r\n itemName: property.class.name,\r\n path: property.name,\r\n difference: property.toJSON() as AnyPropertyProps,\r\n });\r\n }\r\n\r\n private visitChangedProperty(diagnostic: AnyDiagnostic) {\r\n const property = diagnostic.ecDefinition as Property;\r\n const [propertyName, sourceValue] = diagnostic.messageArgs as [keyof PropertyProps, any, any];\r\n\r\n if (isPropertyTypeName(property, propertyName)) {\r\n return this.visitMissingProperty(diagnostic);\r\n }\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is ClassPropertyDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Property && entry.itemName === property.class.name && entry.path === property.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.Property,\r\n itemName: property.class.name,\r\n path: property.name,\r\n difference: {},\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n if (propertyName !== \"name\") {\r\n modifyEntry.difference[propertyName] = sourceValue;\r\n }\r\n }\r\n\r\n private visitMissingBaseClass(diagnostic: AnyDiagnostic) {\r\n const ecClass = diagnostic.ecDefinition as ECClass;\r\n const [sourceBaseClass] = diagnostic.messageArgs as [ECClass, ECClass];\r\n\r\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is AnyClassItemDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === ecClass.schemaItemType && entry.itemName === ecClass.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: ecClass.schemaItemType,\r\n itemName: ecClass.name,\r\n difference: {},\r\n } as AnyClassItemDifference;\r\n this.schemaItemDifferences.push(modifyEntry);\r\n }\r\n\r\n modifyEntry.difference.baseClass = sourceBaseClass !== undefined ? sourceBaseClass.fullName : undefined;\r\n }\r\n\r\n private visitMissingMixinOnClass(diagnostic: AnyDiagnostic) {\r\n const ecClass = diagnostic.ecDefinition as ECClass;\r\n const [mixin] = diagnostic.messageArgs as [Mixin];\r\n\r\n let addEntry = this.schemaItemDifferences.find((entry): entry is EntityClassMixinDifference => {\r\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.EntityClassMixin && entry.itemName === ecClass.name;\r\n });\r\n\r\n if (addEntry === undefined) {\r\n addEntry = {\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.EntityClassMixin,\r\n itemName: ecClass.name,\r\n difference: [],\r\n };\r\n this.schemaItemDifferences.push(addEntry);\r\n }\r\n addEntry.difference.push(mixin.fullName);\r\n }\r\n\r\n private visitMissingRelationshipConstraintClass(diagnostic: AnyDiagnostic) {\r\n const constraint = diagnostic.ecDefinition as RelationshipConstraint;\r\n const className = constraint.relationshipClass.name;\r\n const constraintPath = constraint.isSource ? \"$source\" : \"$target\";\r\n\r\n let addEntry = this.schemaItemPathDifferences.find((entry): entry is RelationshipConstraintClassDifference => {\r\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.RelationshipConstraintClass, entry.itemName === className && entry.path === constraintPath;\r\n });\r\n\r\n if (!addEntry) {\r\n addEntry = {\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.RelationshipConstraintClass,\r\n itemName: className,\r\n path: constraintPath,\r\n difference: [],\r\n };\r\n this.schemaItemPathDifferences.push(addEntry);\r\n }\r\n\r\n const [constraintClass] = diagnostic.messageArgs as [ECClass];\r\n addEntry.difference.push(constraintClass.fullName);\r\n }\r\n\r\n private visitChangedRelationshipConstraint(diagnostic: AnyDiagnostic) {\r\n const constraint = diagnostic.ecDefinition as RelationshipConstraint;\r\n const className = constraint.relationshipClass.name;\r\n const constraintPath = constraint.isSource ? \"$source\" : \"$target\";\r\n if (this.schemaItemDifferences.find((entry) => entry.changeType === \"add\" && entry.itemName === className)) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is RelationshipConstraintDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.RelationshipConstraint && entry.itemName === className && entry.path === constraintPath;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.RelationshipConstraint,\r\n itemName: className,\r\n path: constraintPath,\r\n difference: {},\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n const [propertyName, propertyValue] = diagnostic.messageArgs as [keyof RelationshipConstraintProps, any];\r\n if (propertyName === \"abstractConstraint\" && propertyValue !== undefined) {\r\n modifyEntry.difference.abstractConstraint = propertyValue;\r\n }\r\n if (propertyName === \"multiplicity\" && propertyValue !== undefined) {\r\n modifyEntry.difference.multiplicity = propertyValue;\r\n }\r\n if (propertyName === \"polymorphic\" && propertyValue !== undefined) {\r\n modifyEntry.difference.polymorphic = propertyValue;\r\n }\r\n if (propertyName === \"roleLabel\" && propertyValue !== undefined) {\r\n modifyEntry.difference.roleLabel = propertyValue;\r\n }\r\n }\r\n\r\n private visitSchemaReference(diagnostic: AnyDiagnostic, changeType: DifferenceType) {\r\n const [referencedSchema] = diagnostic.messageArgs as [Schema];\r\n this.schemaDifferences.push({\r\n changeType,\r\n schemaType: SchemaOtherTypes.SchemaReference,\r\n difference: {\r\n name: referencedSchema.name,\r\n version: referencedSchema.schemaKey.version.toString(),\r\n },\r\n });\r\n }\r\n\r\n private visitMissingCustomAttributeInstance(diagnostic: AnyDiagnostic) {\r\n const [customAttribute] = diagnostic.messageArgs as [CustomAttribute];\r\n const ecType = diagnostic.ecDefinition;\r\n if (Schema.isSchema(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"Schema\",\r\n difference: customAttribute,\r\n });\r\n }\r\n\r\n if (SchemaItem.isSchemaItem(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"SchemaItem\",\r\n itemName: ecType.name,\r\n difference: customAttribute,\r\n });\r\n }\r\n\r\n if (Property.isProperty(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"Property\",\r\n itemName: ecType.class.name,\r\n path: ecType.name,\r\n difference: customAttribute,\r\n });\r\n }\r\n\r\n if (RelationshipConstraint.isRelationshipConstraint(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"RelationshipConstraint\",\r\n itemName: ecType.relationshipClass.name,\r\n path: ecType.isSource ? \"$source\" : \"$target\",\r\n difference: customAttribute,\r\n });\r\n }\r\n return;\r\n }\r\n\r\n private visitMissingPresentationUnit(diagnostic: AnyDiagnostic) {\r\n const koq = diagnostic.ecDefinition as KindOfQuantity;\r\n const [presentationFormat] = diagnostic.messageArgs as [Format | OverrideFormat];\r\n\r\n let addEntry = this.schemaItemDifferences.find((entry): entry is KindOfQuantityPresentationFormatDifference => {\r\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.KindOfQuantityPresentationFormat\r\n && entry.itemName === koq.name;\r\n });\r\n\r\n if (addEntry === undefined) {\r\n addEntry = {\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.KindOfQuantityPresentationFormat,\r\n itemName: koq.name,\r\n difference: [],\r\n };\r\n this.schemaItemDifferences.push(addEntry);\r\n }\r\n addEntry.difference.push(presentationFormat.fullName);\r\n }\r\n\r\n private visitMissingFormatUnit(diagnostic: AnyDiagnostic) {\r\n const format = diagnostic.ecDefinition as Format;\r\n\r\n for (let index = this.schemaItemPathDifferences.length-1; index>=0; index--) {\r\n const entry = this.schemaItemPathDifferences[index];\r\n if (entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.FormatUnitLabel && entry.itemName === format.name) {\r\n this.schemaItemPathDifferences.splice(index, 1);\r\n }\r\n }\r\n\r\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is FormatUnitDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.FormatUnit\r\n && entry.itemName === format.name;\r\n });\r\n\r\n if (modifyEntry === undefined && format.units) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.FormatUnit,\r\n itemName: format.name,\r\n difference: [],\r\n };\r\n\r\n for (const [unit, label] of format.units) {\r\n modifyEntry.difference.push({\r\n name: unit.fullName,\r\n label,\r\n });\r\n };\r\n\r\n this.schemaItemDifferences.push(modifyEntry);\r\n }\r\n }\r\n\r\n private visitChangedFormatUnitLabel(diagnostic: AnyDiagnostic) {\r\n const format = diagnostic.ecDefinition as Format;\r\n\r\n if (this.schemaItemDifferences.find((entry): entry is FormatUnitDifference => { return entry.changeType === \"modify\"\r\n && entry.schemaType === SchemaOtherTypes.FormatUnit && entry.itemName === format.name})) {\r\n return;\r\n }\r\n\r\n const [unit, label] = diagnostic.messageArgs as [Unit | InvertedUnit, string | undefined];\r\n this.schemaItemPathDifferences.push({\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.FormatUnitLabel,\r\n itemName: format.name,\r\n path: unit.fullName,\r\n difference: {\r\n label,\r\n },\r\n });\r\n };\r\n};\r\n\r\nfunction isPropertyTypeName(property: Property, propertyName: string) {\r\n return (propertyName === \"type\") ||\r\n (property.isEnumeration() && propertyName === \"enumeration\") ||\r\n (property.isPrimitive() && propertyName === \"primitiveType\") ||\r\n (property.isStruct() && propertyName === \"structClass\") ||\r\n (property.isNavigation() && propertyName === \"relationshipClass\");\r\n}\r\n"]}
1
+ {"version":3,"file":"SchemaDiagnosticVisitor.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDiagnosticVisitor.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAEqE,QAAQ,EAClF,sBAAsB,EAA+B,MAAM,EAAE,UAAU,GACxE,MAAM,0BA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QACvD,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,YAAY,KAAK,mBAAmB,CAAC,CAAC;AACtE,CAAC","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 Differencing\r\n */\r\n\r\nimport type { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { SchemaCompareCodes } from \"../Validation/SchemaCompareDiagnostics\";\r\nimport {\r\n AnyEnumerator, AnyPropertyProps, AnySchemaItem, CustomAttribute, ECClass,\r\n Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, OverrideFormat, Property, PropertyProps,\r\n RelationshipConstraint, RelationshipConstraintProps, Schema, SchemaItem, Unit,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport {\r\n type AnyClassItemDifference,\r\n type AnySchemaItemDifference,\r\n type AnySchemaItemPathDifference,\r\n type ClassPropertyDifference,\r\n type CustomAttributeDifference,\r\n type DifferenceType,\r\n type EntityClassMixinDifference,\r\n type EnumeratorDifference,\r\n type FormatUnitDifference,\r\n type KindOfQuantityPresentationFormatDifference,\r\n type RelationshipConstraintClassDifference,\r\n type RelationshipConstraintDifference,\r\n type SchemaDifference,\r\n SchemaOtherTypes,\r\n type SchemaReferenceDifference,\r\n} from \"./SchemaDifference\";\r\n\r\n/**\r\n * The SchemaDiagnosticVisitor is a visitor implementation for diagnostic entries\r\n * from the schema comparer api. Depending on the diagnostic code, the difference\r\n * result is build together.\r\n * @internal\r\n */\r\nexport class SchemaDiagnosticVisitor {\r\n\r\n public readonly schemaDifferences: Array<SchemaDifference | SchemaReferenceDifference>;\r\n public readonly schemaItemDifferences: Array<AnySchemaItemDifference\r\n | EntityClassMixinDifference\r\n | KindOfQuantityPresentationFormatDifference\r\n | FormatUnitDifference>;\r\n public readonly schemaItemPathDifferences: Array<AnySchemaItemPathDifference>;\r\n public readonly customAttributeDifferences: Array<CustomAttributeDifference>;\r\n\r\n constructor() {\r\n this.schemaDifferences = [];\r\n this.schemaItemDifferences = [];\r\n this.schemaItemPathDifferences = [];\r\n this.customAttributeDifferences = [];\r\n }\r\n\r\n /**\r\n * Visitor function to process the schema change diagnostic object.\r\n * @internal\r\n */\r\n public visit(diagnostic: AnyDiagnostic) {\r\n switch (diagnostic.code) {\r\n case SchemaCompareCodes.SchemaDelta:\r\n return this.visitChangedSchemaProperties(diagnostic);\r\n\r\n case SchemaCompareCodes.SchemaReferenceMissing:\r\n return this.visitSchemaReference(diagnostic, \"add\");\r\n case SchemaCompareCodes.SchemaReferenceDelta:\r\n return this.visitSchemaReference(diagnostic, \"modify\");\r\n\r\n case SchemaCompareCodes.SchemaItemMissing:\r\n return this.visitMissingSchemaItem(diagnostic);\r\n\r\n case SchemaCompareCodes.SchemaItemDelta:\r\n case SchemaCompareCodes.ClassDelta:\r\n case SchemaCompareCodes.ConstantDelta:\r\n case SchemaCompareCodes.CustomAttributeClassDelta:\r\n case SchemaCompareCodes.FormatDelta:\r\n case SchemaCompareCodes.InvertedUnitDelta:\r\n case SchemaCompareCodes.KoqDelta:\r\n case SchemaCompareCodes.MixinDelta:\r\n case SchemaCompareCodes.PhenomenonDelta:\r\n case SchemaCompareCodes.PropertyCategoryDelta:\r\n case SchemaCompareCodes.RelationshipDelta:\r\n case SchemaCompareCodes.UnitDelta:\r\n case SchemaCompareCodes.EnumerationDelta:\r\n return this.visitChangedSchemaItem(diagnostic);\r\n\r\n case SchemaCompareCodes.EnumeratorDelta:\r\n return this.visitChangedEnumerator(diagnostic);\r\n case SchemaCompareCodes.EnumeratorMissing:\r\n return this.visitMissingEnumerator(diagnostic);\r\n\r\n case SchemaCompareCodes.BaseClassDelta:\r\n return this.visitMissingBaseClass(diagnostic);\r\n case SchemaCompareCodes.EntityMixinMissing:\r\n return this.visitMissingMixinOnClass(diagnostic);\r\n case SchemaCompareCodes.PropertyDelta:\r\n return this.visitChangedProperty(diagnostic);\r\n case SchemaCompareCodes.PropertyMissing:\r\n return this.visitMissingProperty(diagnostic);\r\n\r\n case SchemaCompareCodes.RelationshipConstraintClassMissing:\r\n return this.visitMissingRelationshipConstraintClass(diagnostic);\r\n case SchemaCompareCodes.RelationshipConstraintDelta:\r\n return this.visitChangedRelationshipConstraint(diagnostic);\r\n\r\n case SchemaCompareCodes.CustomAttributeInstanceClassMissing:\r\n return this.visitMissingCustomAttributeInstance(diagnostic);\r\n\r\n case SchemaCompareCodes.PresentationUnitMissing:\r\n return this.visitMissingPresentationUnit(diagnostic);\r\n\r\n case SchemaCompareCodes.FormatUnitMissing:\r\n return this.visitMissingFormatUnit(diagnostic);\r\n case SchemaCompareCodes.UnitLabelOverrideDelta:\r\n return this.visitChangedFormatUnitLabel(diagnostic);\r\n }\r\n return;\r\n }\r\n\r\n private visitChangedSchemaProperties(diagnostic: AnyDiagnostic) {\r\n let modifyEntry = this.schemaDifferences.find((entry): entry is SchemaDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Schema;\r\n });\r\n\r\n let hasChanges = false;\r\n let addEntry = false;\r\n if (modifyEntry === undefined) {\r\n addEntry = true;\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.Schema,\r\n difference: {},\r\n };\r\n }\r\n\r\n // Only label and description are taken from the source schema. If the schema name or alias\r\n // differs, those are ignored for now.\r\n const [propertyName, propertyValue] = diagnostic.messageArgs as [string, any];\r\n if (propertyName === \"label\") {\r\n modifyEntry.difference.label = propertyValue;\r\n hasChanges = true;\r\n }\r\n if (propertyName === \"description\") {\r\n modifyEntry.difference.description = propertyValue;\r\n hasChanges = true;\r\n }\r\n\r\n if (addEntry && hasChanges) {\r\n this.schemaDifferences.push(modifyEntry);\r\n }\r\n }\r\n\r\n private visitMissingSchemaItem(diagnostic: AnyDiagnostic) {\r\n const schemaItem = diagnostic.ecDefinition as AnySchemaItem;\r\n\r\n this.schemaItemDifferences.push({\r\n changeType: \"add\",\r\n schemaType: schemaItem.schemaItemType,\r\n itemName: schemaItem.name,\r\n difference: schemaItem.toJSON(),\r\n });\r\n }\r\n\r\n private visitChangedSchemaItem(diagnostic: AnyDiagnostic) {\r\n const schemaItem = diagnostic.ecDefinition as AnySchemaItem;\r\n const [propertyName, sourceValue, _targetValue] = diagnostic.messageArgs as [string, unknown, unknown];\r\n if (propertyName === \"schemaItemType\") {\r\n // If the schema item type is different, the whole item is added as \"new\" item. The\r\n // difference validator will then figure whether there is a conflict with items of\r\n // of the same name.\r\n return this.visitMissingSchemaItem(diagnostic);\r\n }\r\n\r\n if (sourceValue === undefined) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is AnySchemaItemDifference => {\r\n return entry.changeType === \"modify\" && entry.itemName === schemaItem.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: schemaItem.schemaItemType,\r\n itemName: schemaItem.name,\r\n difference: {},\r\n } as AnySchemaItemDifference;\r\n this.schemaItemDifferences.push(modifyEntry);\r\n }\r\n\r\n // TODO: Since propertyName is type of string, the compiler complains about accepting\r\n // an unspecific string as property indexer. Casted to any as short term fix but that\r\n // needs to be handled better in future.\r\n (modifyEntry.difference as any)[propertyName] = sourceValue;\r\n }\r\n\r\n private visitMissingEnumerator(diagnostic: AnyDiagnostic) {\r\n const enumeration = diagnostic.ecDefinition as Enumeration;\r\n const [enumerator] = diagnostic.messageArgs as [AnyEnumerator];\r\n this.schemaItemPathDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.Enumerator,\r\n itemName: enumeration.name,\r\n path: \"$enumerators\",\r\n difference: enumerator,\r\n });\r\n }\r\n\r\n private lookupEnumeratorEntry(changeType: DifferenceType, item: string, enumeratorName: string) {\r\n return this.schemaItemPathDifferences.find((change) => {\r\n return change.changeType === changeType\r\n && change.schemaType === SchemaOtherTypes.Enumerator\r\n && change.itemName === item\r\n && change.path === \"$enumerators\"\r\n && change.difference.name === enumeratorName;\r\n });\r\n }\r\n\r\n private visitChangedEnumerator(diagnostic: AnyDiagnostic) {\r\n const enumeration = diagnostic.ecDefinition as Enumeration;\r\n const [enumerator, propertyName, sourceValue] = diagnostic.messageArgs as [AnyEnumerator, keyof AnyEnumerator, any];\r\n if (this.lookupEnumeratorEntry(\"add\", enumeration.name, enumerator.name)) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is EnumeratorDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Enumerator && entry.itemName === enumeration.name && entry.path === enumerator.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.Enumerator,\r\n itemName: enumeration.name,\r\n path: enumerator.name,\r\n difference: {},\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n if (sourceValue !== undefined) {\r\n modifyEntry.difference[propertyName] = sourceValue;\r\n }\r\n }\r\n\r\n private visitMissingProperty(diagnostic: AnyDiagnostic) {\r\n const property = diagnostic.ecDefinition as Property;\r\n this.schemaItemPathDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.Property,\r\n itemName: property.class.name,\r\n path: property.name,\r\n difference: property.toJSON() as AnyPropertyProps,\r\n });\r\n }\r\n\r\n private visitChangedProperty(diagnostic: AnyDiagnostic) {\r\n const property = diagnostic.ecDefinition as Property;\r\n const [propertyName, sourceValue] = diagnostic.messageArgs as [keyof PropertyProps, any, any];\r\n\r\n if (isPropertyTypeName(property, propertyName)) {\r\n return this.visitMissingProperty(diagnostic);\r\n }\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is ClassPropertyDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Property && entry.itemName === property.class.name && entry.path === property.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.Property,\r\n itemName: property.class.name,\r\n path: property.name,\r\n difference: {},\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n if (propertyName !== \"name\") {\r\n modifyEntry.difference[propertyName] = sourceValue;\r\n }\r\n }\r\n\r\n private visitMissingBaseClass(diagnostic: AnyDiagnostic) {\r\n const ecClass = diagnostic.ecDefinition as ECClass;\r\n const [sourceBaseClass] = diagnostic.messageArgs as [ECClass, ECClass];\r\n\r\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is AnyClassItemDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === ecClass.schemaItemType && entry.itemName === ecClass.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: ecClass.schemaItemType,\r\n itemName: ecClass.name,\r\n difference: {},\r\n } as AnyClassItemDifference;\r\n this.schemaItemDifferences.push(modifyEntry);\r\n }\r\n\r\n modifyEntry.difference.baseClass = sourceBaseClass !== undefined ? sourceBaseClass.fullName : undefined;\r\n }\r\n\r\n private visitMissingMixinOnClass(diagnostic: AnyDiagnostic) {\r\n const ecClass = diagnostic.ecDefinition as ECClass;\r\n const [mixin] = diagnostic.messageArgs as [Mixin];\r\n\r\n let addEntry = this.schemaItemDifferences.find((entry): entry is EntityClassMixinDifference => {\r\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.EntityClassMixin && entry.itemName === ecClass.name;\r\n });\r\n\r\n if (addEntry === undefined) {\r\n addEntry = {\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.EntityClassMixin,\r\n itemName: ecClass.name,\r\n difference: [],\r\n };\r\n this.schemaItemDifferences.push(addEntry);\r\n }\r\n addEntry.difference.push(mixin.fullName);\r\n }\r\n\r\n private visitMissingRelationshipConstraintClass(diagnostic: AnyDiagnostic) {\r\n const constraint = diagnostic.ecDefinition as RelationshipConstraint;\r\n const className = constraint.relationshipClass.name;\r\n const constraintPath = constraint.isSource ? \"$source\" : \"$target\";\r\n\r\n let addEntry = this.schemaItemPathDifferences.find((entry): entry is RelationshipConstraintClassDifference => {\r\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.RelationshipConstraintClass, entry.itemName === className && entry.path === constraintPath;\r\n });\r\n\r\n if (!addEntry) {\r\n addEntry = {\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.RelationshipConstraintClass,\r\n itemName: className,\r\n path: constraintPath,\r\n difference: [],\r\n };\r\n this.schemaItemPathDifferences.push(addEntry);\r\n }\r\n\r\n const [constraintClass] = diagnostic.messageArgs as [ECClass];\r\n addEntry.difference.push(constraintClass.fullName);\r\n }\r\n\r\n private visitChangedRelationshipConstraint(diagnostic: AnyDiagnostic) {\r\n const constraint = diagnostic.ecDefinition as RelationshipConstraint;\r\n const className = constraint.relationshipClass.name;\r\n const constraintPath = constraint.isSource ? \"$source\" : \"$target\";\r\n if (this.schemaItemDifferences.find((entry) => entry.changeType === \"add\" && entry.itemName === className)) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is RelationshipConstraintDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.RelationshipConstraint && entry.itemName === className && entry.path === constraintPath;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.RelationshipConstraint,\r\n itemName: className,\r\n path: constraintPath,\r\n difference: {},\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n const [propertyName, propertyValue] = diagnostic.messageArgs as [keyof RelationshipConstraintProps, any];\r\n if (propertyName === \"abstractConstraint\" && propertyValue !== undefined) {\r\n modifyEntry.difference.abstractConstraint = propertyValue;\r\n }\r\n if (propertyName === \"multiplicity\" && propertyValue !== undefined) {\r\n modifyEntry.difference.multiplicity = propertyValue;\r\n }\r\n if (propertyName === \"polymorphic\" && propertyValue !== undefined) {\r\n modifyEntry.difference.polymorphic = propertyValue;\r\n }\r\n if (propertyName === \"roleLabel\" && propertyValue !== undefined) {\r\n modifyEntry.difference.roleLabel = propertyValue;\r\n }\r\n }\r\n\r\n private visitSchemaReference(diagnostic: AnyDiagnostic, changeType: DifferenceType) {\r\n const [referencedSchema] = diagnostic.messageArgs as [Schema];\r\n this.schemaDifferences.push({\r\n changeType,\r\n schemaType: SchemaOtherTypes.SchemaReference,\r\n difference: {\r\n name: referencedSchema.name,\r\n version: referencedSchema.schemaKey.version.toString(),\r\n },\r\n });\r\n }\r\n\r\n private visitMissingCustomAttributeInstance(diagnostic: AnyDiagnostic) {\r\n const [customAttribute] = diagnostic.messageArgs as [CustomAttribute];\r\n const ecType = diagnostic.ecDefinition;\r\n if (Schema.isSchema(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"Schema\",\r\n difference: customAttribute,\r\n });\r\n }\r\n\r\n if (SchemaItem.isSchemaItem(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"SchemaItem\",\r\n itemName: ecType.name,\r\n difference: customAttribute,\r\n });\r\n }\r\n\r\n if (Property.isProperty(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"Property\",\r\n itemName: ecType.class.name,\r\n path: ecType.name,\r\n difference: customAttribute,\r\n });\r\n }\r\n\r\n if (RelationshipConstraint.isRelationshipConstraint(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"RelationshipConstraint\",\r\n itemName: ecType.relationshipClass.name,\r\n path: ecType.isSource ? \"$source\" : \"$target\",\r\n difference: customAttribute,\r\n });\r\n }\r\n return;\r\n }\r\n\r\n private visitMissingPresentationUnit(diagnostic: AnyDiagnostic) {\r\n const koq = diagnostic.ecDefinition as KindOfQuantity;\r\n const [presentationFormat] = diagnostic.messageArgs as [Format | OverrideFormat];\r\n\r\n let addEntry = this.schemaItemDifferences.find((entry): entry is KindOfQuantityPresentationFormatDifference => {\r\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.KindOfQuantityPresentationFormat\r\n && entry.itemName === koq.name;\r\n });\r\n\r\n if (addEntry === undefined) {\r\n addEntry = {\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.KindOfQuantityPresentationFormat,\r\n itemName: koq.name,\r\n difference: [],\r\n };\r\n this.schemaItemDifferences.push(addEntry);\r\n }\r\n addEntry.difference.push(presentationFormat.fullName);\r\n }\r\n\r\n private visitMissingFormatUnit(diagnostic: AnyDiagnostic) {\r\n const format = diagnostic.ecDefinition as Format;\r\n\r\n for (let index = this.schemaItemPathDifferences.length-1; index>=0; index--) {\r\n const entry = this.schemaItemPathDifferences[index];\r\n if (entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.FormatUnitLabel && entry.itemName === format.name) {\r\n this.schemaItemPathDifferences.splice(index, 1);\r\n }\r\n }\r\n\r\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is FormatUnitDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.FormatUnit\r\n && entry.itemName === format.name;\r\n });\r\n\r\n if (modifyEntry === undefined && format.units) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.FormatUnit,\r\n itemName: format.name,\r\n difference: [],\r\n };\r\n\r\n for (const [unit, label] of format.units) {\r\n modifyEntry.difference.push({\r\n name: unit.fullName,\r\n label,\r\n });\r\n };\r\n\r\n this.schemaItemDifferences.push(modifyEntry);\r\n }\r\n }\r\n\r\n private visitChangedFormatUnitLabel(diagnostic: AnyDiagnostic) {\r\n const format = diagnostic.ecDefinition as Format;\r\n\r\n if (this.schemaItemDifferences.find((entry): entry is FormatUnitDifference => { return entry.changeType === \"modify\"\r\n && entry.schemaType === SchemaOtherTypes.FormatUnit && entry.itemName === format.name})) {\r\n return;\r\n }\r\n\r\n const [unit, label] = diagnostic.messageArgs as [Unit | InvertedUnit, string | undefined];\r\n this.schemaItemPathDifferences.push({\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.FormatUnitLabel,\r\n itemName: format.name,\r\n path: unit.fullName,\r\n difference: {\r\n label,\r\n },\r\n });\r\n };\r\n};\r\n\r\nfunction isPropertyTypeName(property: Property, propertyName: string) {\r\n return (propertyName === \"type\") ||\r\n (property.isEnumeration() && propertyName === \"enumeration\") ||\r\n (property.isPrimitive() && propertyName === \"primitiveType\") ||\r\n (property.isStruct() && propertyName === \"structClass\") ||\r\n (property.isNavigation() && propertyName === \"relationshipClass\");\r\n}\r\n"]}
@@ -48,7 +48,7 @@ export class Constants extends SchemaItems {
48
48
  return newConstant.key;
49
49
  }
50
50
  catch (e) {
51
- throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, constantProps.name, schemaKey), e);
51
+ throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, constantProps.name ?? "Unknown", schemaKey), e);
52
52
  }
53
53
  }
54
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../src/Editing/Constants.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAiB,uBAAuB,EAAE,UAAU,EAAiB,cAAc,EAAa,MAAM,0BAA0B,CAAC;AAGlJ,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,WAAW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,EAAE,CAAC,CAAC,CAAC;QAClI,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,aAA4B;QAC7E,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,CAAC;YACxJ,OAAO,WAAW,CAAC,GAAG,CAAC;QACzB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,yBAAyB,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACpJ,CAAC;IACH,CAAC;CACF","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 { Constant, ConstantProps, DelayedPromiseWithProps, Phenomenon, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableConstant } from \"./Mutable/MutableConstant\";\r\nimport { ECEditingStatus, SchemaEditingError, SchemaItemId } from \"./Exception\";\r\nimport { SchemaItems } from \"./SchemaItems\";\r\n\r\n/**\r\n * @alpha\r\n * A class allowing you to create schema items of type Constant.\r\n */\r\nexport class Constants extends SchemaItems {\r\n protected override get itemTypeClass(): typeof Constant {\r\n return Constant;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.Constant, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, phenomenon: SchemaItemKey, definition: string, displayLabel?: string, numerator?: number, denominator?: number): Promise<SchemaItemKey> {\r\n try {\r\n const newConstant = await this.createSchemaItem<Constant>(schemaKey, this.schemaItemType, (schema) => schema.createConstant.bind(schema), name) as MutableConstant;\r\n\r\n const newPhenomenon = (await this.getSchemaItem(phenomenon, Phenomenon));\r\n newConstant.setPhenomenon(new DelayedPromiseWithProps<SchemaItemKey, Phenomenon>(newPhenomenon.key, async () => newPhenomenon));\r\n\r\n newConstant.setDefinition(definition);\r\n\r\n if (numerator)\r\n newConstant.setNumerator(numerator);\r\n\r\n if (denominator)\r\n newConstant.setDenominator(denominator);\r\n\r\n if (displayLabel)\r\n newConstant.setDisplayLabel(displayLabel);\r\n\r\n return newConstant.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a Constant through a ConstantProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, constantProps: ConstantProps): Promise<SchemaItemKey> {\r\n try {\r\n const newConstant = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createConstant.bind(schema), constantProps);\r\n return newConstant.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, constantProps.name!, schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../src/Editing/Constants.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAiB,uBAAuB,EAAE,UAAU,EAAiB,cAAc,EAAa,MAAM,0BAA0B,CAAC;AAGlJ,OAAO,EAAE,eA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AAsB,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAClI,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,aAA4B;QAC7E,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,CAAC;YACxJ,OAAO,WAAW,CAAC,GAAG,CAAC;QACzB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,yBAAyB,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,IAAI,IAAI,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAChK,CAAC;IACH,CAAC;CACF","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 { Constant, ConstantProps, DelayedPromiseWithProps, Phenomenon, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableConstant } from \"./Mutable/MutableConstant\";\r\nimport { ECEditingStatus, SchemaEditingError, SchemaItemId } from \"./Exception\";\r\nimport { SchemaItems } from \"./SchemaItems\";\r\n\r\n/**\r\n * @alpha\r\n * A class allowing you to create schema items of type Constant.\r\n */\r\nexport class Constants extends SchemaItems {\r\n protected override get itemTypeClass(): typeof Constant {\r\n return Constant;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.Constant, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, phenomenon: SchemaItemKey, definition: string, displayLabel?: string, numerator?: number, denominator?: number): Promise<SchemaItemKey> {\r\n try {\r\n const newConstant = await this.createSchemaItem<Constant>(schemaKey, this.schemaItemType, (schema) => schema.createConstant.bind(schema), name) as MutableConstant;\r\n\r\n const newPhenomenon = (await this.getSchemaItem(phenomenon, Phenomenon));\r\n newConstant.setPhenomenon(new DelayedPromiseWithProps<SchemaItemKey, Phenomenon>(newPhenomenon.key, async () => newPhenomenon));\r\n\r\n newConstant.setDefinition(definition);\r\n\r\n if (numerator)\r\n newConstant.setNumerator(numerator);\r\n\r\n if (denominator)\r\n newConstant.setDenominator(denominator);\r\n\r\n if (displayLabel)\r\n newConstant.setDisplayLabel(displayLabel);\r\n\r\n return newConstant.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a Constant through a ConstantProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, constantProps: ConstantProps): Promise<SchemaItemKey> {\r\n try {\r\n const newConstant = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createConstant.bind(schema), constantProps);\r\n return newConstant.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, constantProps.name ?? \"Unknown\", schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -42,7 +42,7 @@ export class CustomAttributes extends ECClasses {
42
42
  return newClass.key;
43
43
  }
44
44
  catch (e) {
45
- throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, caProps.name, schemaKey), e);
45
+ throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, caProps.name ?? "Unknown", schemaKey), e);
46
46
  }
47
47
  }
48
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CustomAttributes.js","sourceRoot":"","sources":["../../../src/Editing/CustomAttributes.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EACL,oBAAoB,EAEL,cAAc,GAC9B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE3E;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAC7C,YAAmB,YAAiC;QAClD,KAAK,CAAC,cAAc,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC;IAC3D,CAAC;IAED,IAAuB,aAAa;QAClC,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,SAAuC,EAAE,YAAqB,EAAE,YAA4B;QAClJ,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAuB,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,YAAY,CAAmB,CAAC;YAEhM,IAAI,YAAY;gBACd,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YAEzC,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;YACjC,OAAO,QAAQ,CAAC,GAAG,CAAC;QACtB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,sBAAsB,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7H,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,OAAkC;QACnF,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;YAC3J,OAAO,QAAQ,CAAC,GAAG,CAAC;QACtB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,yBAAyB,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACzI,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Editing\r\n */\r\n\r\nimport {\r\n CustomAttributeClass,\r\n CustomAttributeClassProps, CustomAttributeContainerType,\r\n SchemaItemKey, SchemaItemType, SchemaKey,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableCAClass } from \"./Mutable/MutableCAClass\";\r\nimport { ClassId, ECEditingStatus, SchemaEditingError } from \"./Exception\";\r\n\r\n/**\r\n * @alpha\r\n * A class extending ECClasses allowing you to create schema items of type CustomAttributeClass.\r\n */\r\nexport class CustomAttributes extends ECClasses {\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.CustomAttributeClass, schemaEditor);\r\n }\r\n\r\n protected override get itemTypeClass(): typeof CustomAttributeClass {\r\n return CustomAttributeClass;\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, appliesTo: CustomAttributeContainerType, displayLabel?: string, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createClass<CustomAttributeClass>(schemaKey, this.schemaItemType, (schema) => schema.createCustomAttributeClass.bind(schema), name, baseClassKey) as MutableCAClass;\r\n\r\n if (displayLabel)\r\n newClass.setDisplayLabel(displayLabel);\r\n\r\n newClass.setAppliesTo(appliesTo);\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new ClassId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a CustomAttributeClass through a CustomAttributeClassProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param caProps a json object that will be used to populate the new CustomAttributeClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, caProps: CustomAttributeClassProps): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createCustomAttributeClass.bind(schema), caProps);\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, caProps.name!, schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"CustomAttributes.js","sourceRoot":"","sources":["../../../src/Editing/CustomAttributes.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EACL,oBAAoB,EAEL,cAAc,GAC9B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,OAA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AC3J,OAAO,QAAQ,CAAC,GAAG,CAAC;QACtB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,yBAAyB,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,IAAI,IAAI,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACrJ,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Editing\r\n */\r\n\r\nimport {\r\n CustomAttributeClass,\r\n CustomAttributeClassProps, CustomAttributeContainerType,\r\n SchemaItemKey, SchemaItemType, SchemaKey,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableCAClass } from \"./Mutable/MutableCAClass\";\r\nimport { ClassId, ECEditingStatus, SchemaEditingError } from \"./Exception\";\r\n\r\n/**\r\n * @alpha\r\n * A class extending ECClasses allowing you to create schema items of type CustomAttributeClass.\r\n */\r\nexport class CustomAttributes extends ECClasses {\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.CustomAttributeClass, schemaEditor);\r\n }\r\n\r\n protected override get itemTypeClass(): typeof CustomAttributeClass {\r\n return CustomAttributeClass;\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, appliesTo: CustomAttributeContainerType, displayLabel?: string, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createClass<CustomAttributeClass>(schemaKey, this.schemaItemType, (schema) => schema.createCustomAttributeClass.bind(schema), name, baseClassKey) as MutableCAClass;\r\n\r\n if (displayLabel)\r\n newClass.setDisplayLabel(displayLabel);\r\n\r\n newClass.setAppliesTo(appliesTo);\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new ClassId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a CustomAttributeClass through a CustomAttributeClassProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param caProps a json object that will be used to populate the new CustomAttributeClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, caProps: CustomAttributeClassProps): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createCustomAttributeClass.bind(schema), caProps);\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, caProps.name ?? \"Unknown\", schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -85,7 +85,7 @@ export class Entities extends ECClasses {
85
85
  return newClass.key;
86
86
  }
87
87
  catch (e) {
88
- throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, entityProps.name, schemaKey), e);
88
+ throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, entityProps.name ?? "Unknown", schemaKey), e);
89
89
  }
90
90
  }
91
91
  async addMixin(entityKey, mixinKey) {
@@ -1 +1 @@
1
- {"version":3,"file":"Entities.js","sourceRoot":"","sources":["../../../src/Editing/Entities.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EACY,WAAW,EAC5B,KAAK,EAA6D,cAAc,GACjF,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC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OAAO,CAAC,cAAc,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACtI,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,iCAAiC,CAAC,QAAuB,EAAE,eAAwC;QAC9G,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;YACtE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,gBAAgB,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;YAC1I,MAAM,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,iCAAiC,EAAE,IAAI,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QACxI,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Editing\r\n */\r\n\r\nimport {\r\n ECClassModifier, EntityClass, EntityClassProps,\r\n Mixin, NavigationPropertyProps, RelationshipClass, SchemaItemKey, SchemaItemType, SchemaKey, StrengthDirection,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableEntityClass } from \"./Mutable/MutableEntityClass\";\r\nimport { NavigationProperties } from \"./Properties\";\r\nimport { ClassId, ECEditingStatus, SchemaEditingError } from \"./Exception\";\r\n\r\n/**\r\n * @alpha\r\n * A class extending ECClasses allowing you to create schema items of type EntityClass.\r\n */\r\nexport class Entities extends ECClasses {\r\n protected override get itemTypeClass(): typeof EntityClass {\r\n return EntityClass;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.EntityClass, schemaEditor);\r\n }\r\n\r\n /**\r\n * Allows access for editing of NavigationProperty attributes.\r\n */\r\n public readonly navigationProperties = new NavigationProperties(SchemaItemType.EntityClass, this.schemaEditor);\r\n\r\n public async createElement(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, baseClassKey: SchemaItemKey, displayLabel?: string, mixins?: Mixin[]): Promise<SchemaItemKey> {\r\n try {\r\n const baseClass = await this.getSchemaItem(baseClassKey, EntityClass);\r\n if (!(await (baseClass).is(\"Element\", \"BisCore\"))) {\r\n throw new SchemaEditingError(ECEditingStatus.BaseClassIsNotElement, new ClassId(this.schemaItemType, baseClassKey));\r\n }\r\n } catch(e: any){\r\n throw new SchemaEditingError(ECEditingStatus.CreateElement, new ClassId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n\r\n return this.create(schemaKey, name, modifier, displayLabel, baseClassKey, mixins);\r\n }\r\n\r\n public async createElementUniqueAspect(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, baseClassKey: SchemaItemKey, displayLabel?: string, mixins?: Mixin[]): Promise<SchemaItemKey> {\r\n try {\r\n const baseClass = await this.getSchemaItem(baseClassKey, EntityClass);\r\n if (!(await (baseClass).is(\"ElementUniqueAspect\", \"BisCore\"))) {\r\n throw new SchemaEditingError(ECEditingStatus.BaseClassIsNotElementUniqueAspect, new ClassId(this.schemaItemType, baseClassKey));\r\n }\r\n } catch(e: any){\r\n throw new SchemaEditingError(ECEditingStatus.CreateElement, new ClassId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n\r\n return this.create(schemaKey, name, modifier, displayLabel, baseClassKey, mixins);\r\n }\r\n\r\n public async createElementMultiAspect(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, baseClassKey: SchemaItemKey, displayLabel?: string, mixins?: Mixin[]): Promise<SchemaItemKey> {\r\n try {\r\n const baseClass = await this.getSchemaItem(baseClassKey, EntityClass);\r\n if (!(await (baseClass).is(\"ElementMultiAspect\", \"BisCore\"))) {\r\n throw new SchemaEditingError(ECEditingStatus.BaseClassIsNotElementMultiAspect, new ClassId(this.schemaItemType, baseClassKey));\r\n }\r\n } catch(e: any){\r\n throw new SchemaEditingError(ECEditingStatus.CreateElement, new ClassId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n\r\n return this.create(schemaKey, name, modifier, displayLabel, baseClassKey, mixins);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, displayLabel?: string, baseClassKey?: SchemaItemKey, mixins?: Mixin[]): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createClass<EntityClass>(schemaKey, this.schemaItemType, (schema) => schema.createEntityClass.bind(schema), name, baseClassKey, modifier) as MutableEntityClass;\r\n\r\n if (mixins !== undefined)\r\n mixins.forEach((m) => newClass.addMixin(m));\r\n\r\n if (displayLabel)\r\n newClass.setDisplayLabel(displayLabel);\r\n\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new ClassId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Creates an EntityClass through an EntityClassProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param entityProps a json object that will be used to populate the new EntityClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, entityProps: EntityClassProps): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createEntityClass.bind(schema), entityProps);\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, entityProps.name!, schemaKey), e);\r\n }\r\n }\r\n\r\n public async addMixin(entityKey: SchemaItemKey, mixinKey: SchemaItemKey): Promise<void> {\r\n try {\r\n const entity = await this.getSchemaItem(entityKey, MutableEntityClass);\r\n const mixin = await this.getSchemaItem(mixinKey, Mixin);\r\n entity.addMixin(mixin);\r\n } catch(e: any){\r\n throw new SchemaEditingError(ECEditingStatus.AddMixin, new ClassId(SchemaItemType.EntityClass, entityKey), e);\r\n }\r\n }\r\n\r\n public async createNavigationProperty(entityKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<void> {\r\n try {\r\n const entity = await this.getSchemaItem(entityKey, MutableEntityClass);\r\n await entity.createNavigationProperty(name, relationship, direction);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateNavigationProperty, new ClassId(SchemaItemType.RelationshipClass, entityKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a Navigation Property through a NavigationPropertyProps.\r\n * @param classKey a SchemaItemKey of the Entity Class that will house the new property.\r\n * @param navigationProps a json object that will be used to populate the new Navigation Property.\r\n */\r\n public async createNavigationPropertyFromProps(classKey: SchemaItemKey, navigationProps: NavigationPropertyProps): Promise<void> {\r\n try {\r\n const entity = await this.getSchemaItem(classKey, MutableEntityClass);\r\n const property = await entity.createNavigationProperty(navigationProps.name, navigationProps.relationshipName, navigationProps.direction);\r\n await property.fromJSON(navigationProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateNavigationPropertyFromProps, new ClassId(SchemaItemType.EntityClass, classKey), e);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Entities.js","sourceRoot":"","sources":["../../../src/Editing/Entities.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EACY,WAAW,EAC5B,KAAK,EAA6D,cAAc,GACjF,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,oB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AI,kBAAkB,CAAC,eAAe,CAAC,wBAAwB,EAAE,IAAI,OAAO,CAAC,cAAc,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACtI,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,iCAAiC,CAAC,QAAuB,EAAE,eAAwC;QAC9G,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;YACtE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,gBAAgB,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;YAC1I,MAAM,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,iCAAiC,EAAE,IAAI,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QACxI,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Editing\r\n */\r\n\r\nimport {\r\n ECClassModifier, EntityClass, EntityClassProps,\r\n Mixin, NavigationPropertyProps, RelationshipClass, SchemaItemKey, SchemaItemType, SchemaKey, StrengthDirection,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableEntityClass } from \"./Mutable/MutableEntityClass\";\r\nimport { NavigationProperties } from \"./Properties\";\r\nimport { ClassId, ECEditingStatus, SchemaEditingError } from \"./Exception\";\r\n\r\n/**\r\n * @alpha\r\n * A class extending ECClasses allowing you to create schema items of type EntityClass.\r\n */\r\nexport class Entities extends ECClasses {\r\n protected override get itemTypeClass(): typeof EntityClass {\r\n return EntityClass;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.EntityClass, schemaEditor);\r\n }\r\n\r\n /**\r\n * Allows access for editing of NavigationProperty attributes.\r\n */\r\n public readonly navigationProperties = new NavigationProperties(SchemaItemType.EntityClass, this.schemaEditor);\r\n\r\n public async createElement(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, baseClassKey: SchemaItemKey, displayLabel?: string, mixins?: Mixin[]): Promise<SchemaItemKey> {\r\n try {\r\n const baseClass = await this.getSchemaItem(baseClassKey, EntityClass);\r\n if (!(await (baseClass).is(\"Element\", \"BisCore\"))) {\r\n throw new SchemaEditingError(ECEditingStatus.BaseClassIsNotElement, new ClassId(this.schemaItemType, baseClassKey));\r\n }\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateElement, new ClassId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n\r\n return this.create(schemaKey, name, modifier, displayLabel, baseClassKey, mixins);\r\n }\r\n\r\n public async createElementUniqueAspect(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, baseClassKey: SchemaItemKey, displayLabel?: string, mixins?: Mixin[]): Promise<SchemaItemKey> {\r\n try {\r\n const baseClass = await this.getSchemaItem(baseClassKey, EntityClass);\r\n if (!(await (baseClass).is(\"ElementUniqueAspect\", \"BisCore\"))) {\r\n throw new SchemaEditingError(ECEditingStatus.BaseClassIsNotElementUniqueAspect, new ClassId(this.schemaItemType, baseClassKey));\r\n }\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateElement, new ClassId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n\r\n return this.create(schemaKey, name, modifier, displayLabel, baseClassKey, mixins);\r\n }\r\n\r\n public async createElementMultiAspect(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, baseClassKey: SchemaItemKey, displayLabel?: string, mixins?: Mixin[]): Promise<SchemaItemKey> {\r\n try {\r\n const baseClass = await this.getSchemaItem(baseClassKey, EntityClass);\r\n if (!(await (baseClass).is(\"ElementMultiAspect\", \"BisCore\"))) {\r\n throw new SchemaEditingError(ECEditingStatus.BaseClassIsNotElementMultiAspect, new ClassId(this.schemaItemType, baseClassKey));\r\n }\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateElement, new ClassId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n\r\n return this.create(schemaKey, name, modifier, displayLabel, baseClassKey, mixins);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, displayLabel?: string, baseClassKey?: SchemaItemKey, mixins?: Mixin[]): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createClass<EntityClass>(schemaKey, this.schemaItemType, (schema) => schema.createEntityClass.bind(schema), name, baseClassKey, modifier) as MutableEntityClass;\r\n\r\n if (mixins !== undefined)\r\n mixins.forEach((m) => newClass.addMixin(m));\r\n\r\n if (displayLabel)\r\n newClass.setDisplayLabel(displayLabel);\r\n\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new ClassId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Creates an EntityClass through an EntityClassProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param entityProps a json object that will be used to populate the new EntityClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, entityProps: EntityClassProps): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createEntityClass.bind(schema), entityProps);\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, entityProps.name ?? \"Unknown\", schemaKey), e);\r\n }\r\n }\r\n\r\n public async addMixin(entityKey: SchemaItemKey, mixinKey: SchemaItemKey): Promise<void> {\r\n try {\r\n const entity = await this.getSchemaItem(entityKey, MutableEntityClass);\r\n const mixin = await this.getSchemaItem(mixinKey, Mixin);\r\n entity.addMixin(mixin);\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.AddMixin, new ClassId(SchemaItemType.EntityClass, entityKey), e);\r\n }\r\n }\r\n\r\n public async createNavigationProperty(entityKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<void> {\r\n try {\r\n const entity = await this.getSchemaItem(entityKey, MutableEntityClass);\r\n await entity.createNavigationProperty(name, relationship, direction);\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateNavigationProperty, new ClassId(SchemaItemType.RelationshipClass, entityKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a Navigation Property through a NavigationPropertyProps.\r\n * @param classKey a SchemaItemKey of the Entity Class that will house the new property.\r\n * @param navigationProps a json object that will be used to populate the new Navigation Property.\r\n */\r\n public async createNavigationPropertyFromProps(classKey: SchemaItemKey, navigationProps: NavigationPropertyProps): Promise<void> {\r\n try {\r\n const entity = await this.getSchemaItem(classKey, MutableEntityClass);\r\n const property = await entity.createNavigationProperty(navigationProps.name, navigationProps.relationshipName, navigationProps.direction);\r\n await property.fromJSON(navigationProps);\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateNavigationPropertyFromProps, new ClassId(SchemaItemType.EntityClass, classKey), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -46,7 +46,7 @@ export class Enumerations extends SchemaItems {
46
46
  return newEnum.key;
47
47
  }
48
48
  catch (e) {
49
- throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, enumProps.name, schemaKey), e);
49
+ throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, enumProps.name ?? "Unknown", schemaKey), e);
50
50
  }
51
51
  }
52
52
  async addEnumerator(enumerationKey, enumerator) {
@@ -1 +1 @@
1
- {"version":3,"file":"Enumerations.js","sourceRoot":"","sources":["../../../src/Editing/Enumerations.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAiB,WAAW,EAAkD,cAAc,EAAa,MAAM,0BAA0B,CAAC;AAGjJ,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C,IAAuB,aAAa;QAClC,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,YAAmB,YAAiC;QAClD,KAAK,CAAC,cAAc,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAClD,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,IAAkD,EAAE,YAAqB,EAAE,QAAkB,EAAE,WAA6B;QAClL,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAc,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAuB,CAAC;YAE9K,IAAI,SAAS,KAAK,QAAQ;gBACxB,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAEhC,IAAI,SAAS,KAAK,WAAW;gBAC3B,KAAK,MAAM,UAAU,IAAI,WAAW;oBAClC,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;YAEtD,IAAI,YAAY;gBACd,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC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AC;YACnE,IAAI,UAAU,KAAK,SAAS;gBAC1B,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,sBAAsB,EAAE,IAAI,YAAY,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC;YAErH,UAAgC,CAAC,WAAW,GAAG,WAAW,CAAC;QAC9D,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,kBAAkB,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7H,CAAC;IACH,CAAC;CACF","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 { AnyEnumerator, Enumeration, EnumerationProps, PrimitiveType, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableEnumeration } from \"./Mutable/MutableEnumeration\";\r\nimport { ECEditingStatus, EnumeratorId, SchemaEditingError, SchemaItemId } from \"./Exception\";\r\nimport { SchemaItems } from \"./SchemaItems\";\r\n\r\ntype MutableEnumerator = {\r\n -readonly [P in keyof AnyEnumerator]: AnyEnumerator[P]\r\n};\r\n\r\n/**\r\n * @alpha\r\n * A class allowing you to create schema items of type Enumeration.\r\n */\r\nexport class Enumerations extends SchemaItems {\r\n protected override get itemTypeClass(): typeof Enumeration {\r\n return Enumeration;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.Enumeration, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, type: PrimitiveType.Integer | PrimitiveType.String, displayLabel?: string, isStrict?: boolean, enumerators?: AnyEnumerator[]): Promise<SchemaItemKey> {\r\n try {\r\n const newEnum = await this.createSchemaItem<Enumeration>(schemaKey, this.schemaItemType, (schema) => schema.createEnumeration.bind(schema), name, type) as MutableEnumeration;\r\n\r\n if (undefined !== isStrict)\r\n newEnum.setIsStrict(isStrict);\r\n\r\n if (undefined !== enumerators)\r\n for (const enumerator of enumerators)\r\n await this.addEnumerator(newEnum.key, enumerator);\r\n\r\n if (displayLabel)\r\n newEnum.setDisplayLabel(displayLabel);\r\n\r\n return newEnum.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Creates an Enumeration through an EnumeratorProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, enumProps: EnumerationProps): Promise<SchemaItemKey> {\r\n try {\r\n const newEnum = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createEnumeration.bind(schema), enumProps);\r\n return newEnum.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, enumProps.name!, schemaKey), e);\r\n }\r\n }\r\n\r\n public async addEnumerator(enumerationKey: SchemaItemKey, enumerator: AnyEnumerator): Promise<void> {\r\n try {\r\n const enumeration = await this.getSchemaItem(enumerationKey, Enumeration);\r\n\r\n if (enumeration.isInt && typeof (enumerator.value) !== \"number\")\r\n throw new SchemaEditingError(ECEditingStatus.InvalidEnumeratorType, new EnumeratorId(enumerator, enumeration));\r\n\r\n if (enumeration.isString && typeof (enumerator.value) !== \"string\")\r\n throw new SchemaEditingError(ECEditingStatus.InvalidEnumeratorType, new EnumeratorId(enumerator, enumeration));\r\n\r\n (enumeration as MutableEnumeration).addEnumerator(enumerator);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.AddEnumerator, new SchemaItemId(this.schemaItemType, enumerationKey), e);\r\n }\r\n }\r\n\r\n public async setEnumeratorLabel(enumerationKey: SchemaItemKey, enumeratorName: string, label: string | undefined): Promise<void> {\r\n try {\r\n const enumeration = await this.getSchemaItem(enumerationKey, Enumeration);\r\n\r\n const enumerator = enumeration.getEnumeratorByName(enumeratorName);\r\n if (enumerator === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.EnumeratorDoesNotExist, new EnumeratorId(enumeratorName, enumeration));\r\n\r\n (enumerator as MutableEnumerator).label = label;\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.SetEnumeratorLabel, new SchemaItemId(this.schemaItemType, enumerationKey), e);\r\n }\r\n }\r\n\r\n public async setEnumeratorDescription(enumerationKey: SchemaItemKey, enumeratorName: string, description: string | undefined): Promise<void> {\r\n try {\r\n const enumeration = await this.getSchemaItem(enumerationKey, Enumeration);\r\n\r\n const enumerator = enumeration.getEnumeratorByName(enumeratorName);\r\n if (enumerator === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.EnumeratorDoesNotExist, new EnumeratorId(enumeratorName, enumeration));\r\n\r\n (enumerator as MutableEnumerator).description = description;\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.SetEnumeratorLabel, new SchemaItemId(this.schemaItemType, enumerationKey), e);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Enumerations.js","sourceRoot":"","sources":["../../../src/Editing/Enumerations.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAiB,WAAW,EAAkD,cAAc,EAAa,MAAM,0BAA0B,CAAC;AAGjJ,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,WA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* 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 { AnyEnumerator, Enumeration, EnumerationProps, PrimitiveType, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableEnumeration } from \"./Mutable/MutableEnumeration\";\r\nimport { ECEditingStatus, EnumeratorId, SchemaEditingError, SchemaItemId } from \"./Exception\";\r\nimport { SchemaItems } from \"./SchemaItems\";\r\n\r\ntype MutableEnumerator = {\r\n -readonly [P in keyof AnyEnumerator]: AnyEnumerator[P]\r\n};\r\n\r\n/**\r\n * @alpha\r\n * A class allowing you to create schema items of type Enumeration.\r\n */\r\nexport class Enumerations extends SchemaItems {\r\n protected override get itemTypeClass(): typeof Enumeration {\r\n return Enumeration;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.Enumeration, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, type: PrimitiveType.Integer | PrimitiveType.String, displayLabel?: string, isStrict?: boolean, enumerators?: AnyEnumerator[]): Promise<SchemaItemKey> {\r\n try {\r\n const newEnum = await this.createSchemaItem<Enumeration>(schemaKey, this.schemaItemType, (schema) => schema.createEnumeration.bind(schema), name, type) as MutableEnumeration;\r\n\r\n if (undefined !== isStrict)\r\n newEnum.setIsStrict(isStrict);\r\n\r\n if (undefined !== enumerators)\r\n for (const enumerator of enumerators)\r\n await this.addEnumerator(newEnum.key, enumerator);\r\n\r\n if (displayLabel)\r\n newEnum.setDisplayLabel(displayLabel);\r\n\r\n return newEnum.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Creates an Enumeration through an EnumeratorProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, enumProps: EnumerationProps): Promise<SchemaItemKey> {\r\n try {\r\n const newEnum = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createEnumeration.bind(schema), enumProps);\r\n return newEnum.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, enumProps.name ?? \"Unknown\", schemaKey), e);\r\n }\r\n }\r\n\r\n public async addEnumerator(enumerationKey: SchemaItemKey, enumerator: AnyEnumerator): Promise<void> {\r\n try {\r\n const enumeration = await this.getSchemaItem(enumerationKey, Enumeration);\r\n\r\n if (enumeration.isInt && typeof (enumerator.value) !== \"number\")\r\n throw new SchemaEditingError(ECEditingStatus.InvalidEnumeratorType, new EnumeratorId(enumerator, enumeration));\r\n\r\n if (enumeration.isString && typeof (enumerator.value) !== \"string\")\r\n throw new SchemaEditingError(ECEditingStatus.InvalidEnumeratorType, new EnumeratorId(enumerator, enumeration));\r\n\r\n (enumeration as MutableEnumeration).addEnumerator(enumerator);\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.AddEnumerator, new SchemaItemId(this.schemaItemType, enumerationKey), e);\r\n }\r\n }\r\n\r\n public async setEnumeratorLabel(enumerationKey: SchemaItemKey, enumeratorName: string, label: string | undefined): Promise<void> {\r\n try {\r\n const enumeration = await this.getSchemaItem(enumerationKey, Enumeration);\r\n\r\n const enumerator = enumeration.getEnumeratorByName(enumeratorName);\r\n if (enumerator === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.EnumeratorDoesNotExist, new EnumeratorId(enumeratorName, enumeration));\r\n\r\n (enumerator as MutableEnumerator).label = label;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.SetEnumeratorLabel, new SchemaItemId(this.schemaItemType, enumerationKey), e);\r\n }\r\n }\r\n\r\n public async setEnumeratorDescription(enumerationKey: SchemaItemKey, enumeratorName: string, description: string | undefined): Promise<void> {\r\n try {\r\n const enumeration = await this.getSchemaItem(enumerationKey, Enumeration);\r\n\r\n const enumerator = enumeration.getEnumeratorByName(enumeratorName);\r\n if (enumerator === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.EnumeratorDoesNotExist, new EnumeratorId(enumeratorName, enumeration));\r\n\r\n (enumerator as MutableEnumerator).description = description;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.SetEnumeratorLabel, new SchemaItemId(this.schemaItemType, enumerationKey), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -265,8 +265,8 @@ export class SchemaEditingError extends Error {
265
265
  this.identifier = identifier;
266
266
  this.innerError = innerError;
267
267
  this._ruleViolations = ruleViolations;
268
- this._schemaKey = identifier.schemaKey,
269
- this.generateMessage();
268
+ this._schemaKey = identifier.schemaKey;
269
+ this.generateMessage();
270
270
  }
271
271
  /**
272
272
  * Gets the SchemaId instance.
@@ -1 +1 @@
1
- {"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/Editing/Exception.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAA6D,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAA0B,aAAa,EAA6B,MAAM,0BAA0B,CAAC;AAEvN,aAAa;AACb,MAAM,CAAN,IAAY,eAmFX;AAnFD,WAAY,eAAe;IACzB,4FAA+B,CAAA;IAC/B,2DAAW,CAAA;IACX,4EAAyC,CAAA;IACzC,8EAAc,CAAA;IACd,sFAAkB,CAAA;IAClB,wGAA2B,CAAA;IAC3B,4FAAqB,CAAA;IACrB,kFAAgB,CAAA;IAChB,wFAAmB,CAAA;IACnB,4FAAqB,CAAA;IACrB,oHAAiC,CAAA;IACjC,kHAAgC,CAAA;IAChC,sGAA0B,CAAA;IAC1B,4FAAqB,CAAA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AAqB,CAAC,oBAAoB,CAAC;YAChD,KAAK,qBAAqB,CAAC,eAAe,CAAC;YAC3C,KAAK,qBAAqB,CAAC,gCAAgC;gBACzD,OAAO,0BAA0B,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,+BAA+B,IAAI,CAAC,UAAU,CAAC,cAAc,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC;YAC7J,KAAK,qBAAqB,CAAC,kBAAkB;gBAC3C,OAAO,0BAA0B,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,+BAA+B,IAAI,CAAC,UAAU,CAAC,cAAc,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,CAAC;YACjK;gBACE,MAAM,IAAI,KAAK,CAAE,qBAAqB,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAEO,sBAAsB,CAAC,UAAyB;QACtD,IAAI,UAAU,CAAC,cAAc,KAAK,qBAAqB,CAAC,oBAAoB;YAC1E,UAAU,CAAC,cAAc,KAAK,qBAAqB,CAAC,eAAe;YACnE,OAAO,IAAI,CAAC;QAEd,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,SAAS,iBAAiB,CAAC,WAAwB,EAAE,UAAkC;IACrF,IAAI,OAAM,CAAC,UAAU,CAAC,KAAK,QAAQ,EAAE,CAAC;QACpC,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC/E,CAAC;IAED,OAAO,OAAM,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;AAClE,CAAC","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 { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { AnyEnumerator, CustomAttributeContainerProps, Enumeration, PrimitiveType, 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 InvalidECName,\r\n InvalidSchemaAlias,\r\n InvalidFormatUnitsSpecified,\r\n SchemaAliasAlreadyExists,\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 SetKindOfQuantity,\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 SetSchemaAlias\r\n}\r\n\r\n/**\r\n * A type that constrains the possible error types handled by SchemaEditingError\r\n * @alpha\r\n */\r\nexport type AnyEditingError = SchemaEditingError | Error;\r\n\r\n/**\r\n * Defines the possible property type names.\r\n * @alpha\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\n/**\r\n * Defines the possible schema type identifiers.\r\n * @alpha\r\n */\r\nexport enum SchemaTypeIdentifiers {\r\n SchemaIdentifier = \"Schema\",\r\n SchemaItemIdentifier = \"SchemaItem\",\r\n ClassIdentifier = \"Class\",\r\n PropertyIdentifier = \"Property\",\r\n EnumeratorIdentifier = \"Enumerator\",\r\n CustomAttributeIdentifier = \"CustomAttribute\",\r\n RelationshipConstraintIdentifier = \"RelationshipConstraint\"\r\n}\r\n\r\n/**\r\n * Type that constrains SchemaItemType enum to those used by EC Class types.\r\n * @alpha\r\n */\r\nexport type ECClassSchemaItems = SchemaItemType.EntityClass | SchemaItemType.StructClass | SchemaItemType.RelationshipClass | SchemaItemType.Mixin | SchemaItemType.CustomAttributeClass;\r\n\r\n/**\r\n * Type that defines the possible SchemaTypeIdentifiers for SchemaItemId classes.\r\n * @alpha\r\n */\r\nexport type AnySchemaItemTypeIdentifier = SchemaTypeIdentifiers.SchemaItemIdentifier | SchemaTypeIdentifiers.ClassIdentifier;\r\n\r\n/**\r\n * Type that encompasses all ISchemaTypeIdentifier interfaces\r\n * @alpha\r\n */\r\nexport type AnyIdentifier = ISchemaIdentifier | ISchemaItemIdentifier | IClassIdentifier | IPropertyIdentifier | ICustomAttributeIdentifier | IRelationshipConstraintIdentifier | IEnumeratorIdentifier;\r\n\r\n/**\r\n * A base interface that defines what is needed to identity any schema type.\r\n * @alpha\r\n */\r\nexport interface ISchemaTypeIdentifier {\r\n readonly name: string;\r\n readonly schemaKey: SchemaKey;\r\n readonly typeIdentifier: SchemaTypeIdentifiers;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify a Schema.\r\n * @alpha\r\n */\r\nexport interface ISchemaIdentifier extends ISchemaTypeIdentifier {\r\n readonly typeIdentifier: SchemaTypeIdentifiers.SchemaIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify a SchemaItem.\r\n * @alpha\r\n */\r\nexport interface ISchemaItemIdentifier extends ISchemaTypeIdentifier {\r\n readonly schemaItemType: SchemaItemType;\r\n readonly schemaItemKey: SchemaItemKey;\r\n readonly typeIdentifier: AnySchemaItemTypeIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify an EC Class.\r\n * @alpha\r\n */\r\nexport interface IClassIdentifier extends ISchemaTypeIdentifier {\r\n readonly schemaItemType: ECClassSchemaItems;\r\n readonly schemaItemKey: SchemaItemKey;\r\n readonly typeIdentifier: SchemaTypeIdentifiers.ClassIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify an EC Property.\r\n * @alpha\r\n */\r\nexport interface IPropertyIdentifier extends ISchemaTypeIdentifier {\r\n readonly fullName: string;\r\n readonly ecClass: ClassId;\r\n readonly typeName?: PropertyTypeName;\r\n readonly typeIdentifier: SchemaTypeIdentifiers.PropertyIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify an Enumerator.\r\n * @alpha\r\n */\r\ninterface IEnumeratorIdentifier extends ISchemaTypeIdentifier {\r\n readonly enumeratorType: string;\r\n readonly enumeration: SchemaItemKey;\r\n readonly enumerationType: string;\r\n readonly typeIdentifier: SchemaTypeIdentifiers.EnumeratorIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify a CustomAttribute.\r\n * @alpha\r\n */\r\nexport interface ICustomAttributeIdentifier extends ISchemaTypeIdentifier {\r\n readonly containerFullName: string;\r\n readonly typeIdentifier: SchemaTypeIdentifiers.CustomAttributeIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify a RelationshipConstraint.\r\n * @alpha\r\n */\r\nexport interface IRelationshipConstraintIdentifier extends ISchemaTypeIdentifier {\r\n readonly relationshipKey: SchemaItemKey;\r\n readonly typeIdentifier: SchemaTypeIdentifiers.RelationshipConstraintIdentifier;\r\n}\r\n\r\n/**\r\n * An ISchemaIdentifier implementation to identify Schemas\r\n * @alpha\r\n */\r\nexport class SchemaId implements ISchemaIdentifier {\r\n public readonly typeIdentifier = SchemaTypeIdentifiers.SchemaIdentifier;\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\n/**\r\n * An ISchemItemIdentifier implementation to identify SchemaItems\r\n * @alpha\r\n */\r\nexport class SchemaItemId implements ISchemaItemIdentifier {\r\n public readonly typeIdentifier: AnySchemaItemTypeIdentifier;\r\n public readonly name: string;\r\n public readonly schemaKey: SchemaKey;\r\n public readonly schemaItemType: SchemaItemType;\r\n public readonly schemaItemKey: SchemaItemKey;\r\n\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.schemaItemType = schemaItemType;\r\n this.name = this.schemaItemKey.fullName;\r\n this.typeIdentifier = SchemaTypeIdentifiers.SchemaItemIdentifier;\r\n }\r\n}\r\n\r\n/**\r\n * An IClassIdentifier implementation to identify Class instances.\r\n * @alpha\r\n */\r\nexport class ClassId extends SchemaItemId implements IClassIdentifier {\r\n public override readonly typeIdentifier = SchemaTypeIdentifiers.ClassIdentifier;\r\n public override readonly schemaItemType: ECClassSchemaItems;\r\n constructor(schemaItemType: ECClassSchemaItems, schemaItemKeyOrName: SchemaItemKey | string, schemaKey?: SchemaKey) {\r\n super(schemaItemType, schemaItemKeyOrName, schemaKey);\r\n this.schemaItemType = schemaItemType;\r\n }\r\n}\r\n\r\n/**\r\n * An IPropertyIdentifier implementation to identify Property instances.\r\n * @alpha\r\n */\r\nexport class PropertyId implements IPropertyIdentifier {\r\n public readonly typeIdentifier = SchemaTypeIdentifiers.PropertyIdentifier;\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\n/**\r\n * An IEnumeratorIdentifier implementation to identify Enumerator instances.\r\n * @alpha\r\n */\r\nexport class EnumeratorId implements IEnumeratorIdentifier{\r\n public readonly typeIdentifier = SchemaTypeIdentifiers.EnumeratorIdentifier;\r\n public readonly enumeration: SchemaItemKey;\r\n public readonly enumerationType: string;\r\n public readonly enumeratorType: string;\r\n public readonly name: string;\r\n public readonly schemaKey: SchemaKey;\r\n\r\n constructor(enumerator: AnyEnumerator | string, enumeration: Enumeration) {\r\n this.enumeration = enumeration.key;\r\n this.enumerationType = enumeration.type ? primitiveTypeToString(enumeration.type): \"string\";\r\n this.enumeratorType = getEnumeratorType(enumeration ?? PrimitiveType.String, enumerator);\r\n this.name = typeof(enumerator) === \"string\" ? enumerator : enumerator.name;\r\n this.schemaKey = enumeration.schema.schemaKey;\r\n }\r\n}\r\n\r\n/**\r\n * An ICustomAttributeIdentifier implementation to identify CustomAttribute instances.\r\n * @alpha\r\n */\r\nexport class CustomAttributeId implements ICustomAttributeIdentifier {\r\n public readonly typeIdentifier = SchemaTypeIdentifiers.CustomAttributeIdentifier;\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\n/**\r\n * An IRelationshipConstraintIdentifier implementation to identify RelationshipConstraints.\r\n * @alpha\r\n */\r\nexport class RelationshipConstraintId implements IRelationshipConstraintIdentifier {\r\n public readonly typeIdentifier = SchemaTypeIdentifiers.RelationshipConstraintIdentifier;\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.isSource ? \"Source\" : \"Target\";\r\n this.relationshipKey = constraint.relationshipClass.key;\r\n this.schemaKey = this.relationshipKey.schemaKey;\r\n }\r\n}\r\n\r\n/**\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 * @alpha\r\n */\r\nexport class SchemaEditingError extends Error {\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 readonly errorNumber: ECEditingStatus, public readonly identifier: AnyIdentifier, public readonly innerError?: AnyEditingError, ruleViolations?: AnyDiagnostic[], message?: string) {\r\n super(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 private get _schemaId(): SchemaId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.SchemaIdentifier)\r\n throw new Error(\"identifier is not a SchemaId.\");\r\n return this.identifier as SchemaId;\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 private get _schemaItemId(): SchemaItemId {\r\n if (this.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 private get _classId(): ClassId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.ClassIdentifier)\r\n throw new Error(\"identifier is not a ClassId.\");\r\n return this.identifier as ClassId;\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 private get _propertyId(): PropertyId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.PropertyIdentifier)\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 EnumeratorId instance.\r\n * @throws Error if the identifier is not an instance of EnumeratorId.\r\n */\r\n private get _enumeratorId(): EnumeratorId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.EnumeratorIdentifier)\r\n throw new Error(\"identifier is not a EnumerationId.\");\r\n return this.identifier as EnumeratorId;\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 private get _customAttributeId(): CustomAttributeId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.CustomAttributeIdentifier)\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 private get _relationshipConstraintId(): RelationshipConstraintId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.RelationshipConstraintIdentifier)\r\n throw new Error(\"identifier is not a RelationshipConstraintId.\");\r\n return this.identifier;\r\n }\r\n\r\n /** Gets rule violations that were reported during validation. Returns an array of [[AnyDiagnostic]] if\r\n * the errorNumber is ECEditingStatus.RuleViolation, otherwise undefined.\r\n */\r\n public get ruleViolations(): AnyDiagnostic[] | undefined {\r\n return this._ruleViolations;\r\n }\r\n\r\n /**\r\n * Returns a readable string containing the ECEditingStatus along with the error message. Any\r\n * innerError will also be appended.\r\n * @returns\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 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.schemaItemType} ${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.schemaItemType} ${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.schemaItemType}.`;\r\n return;\r\n case ECEditingStatus.SchemaItemNameNotSpecified:\r\n this.message = `Could not create a new ${this._schemaItemId.schemaItemType} 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.schemaItemType} ${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._enumeratorId.enumeration.fullName} has type ${this._enumeratorId.enumerationType}, while Enumerator ${this._enumeratorId.name} has type ${this._enumeratorId.enumeratorType}.`;\r\n return;\r\n case ECEditingStatus.EnumeratorDoesNotExist:\r\n this.message = `Enumerator ${this._enumeratorId.name} does not exists in Enumeration ${this._enumeratorId.enumeration.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 case ECEditingStatus.InvalidSchemaAlias:\r\n this.message = `Could not set the alias for schema ${this._schemaKey.name} because the specified alias is not a valid ECName.`;\r\n return;\r\n default:\r\n this.message = this._createTaskErrorMessage();\r\n }\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 _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 switch (this.identifier.typeIdentifier) {\r\n case SchemaTypeIdentifiers.SchemaIdentifier:\r\n return `Rule violations occurred from Schema ${this._schemaId.name}: ${violations}`;\r\n case SchemaTypeIdentifiers.SchemaItemIdentifier:\r\n return `Rule violations occurred from ${this._schemaItemId.schemaItemType} ${this._schemaItemId.name}: ${violations}`;\r\n case SchemaTypeIdentifiers.ClassIdentifier:\r\n return `Rule violations occurred from ${this._schemaItemId.schemaItemType} ${this._schemaItemId.name}: ${violations}`;\r\n case SchemaTypeIdentifiers.CustomAttributeIdentifier:\r\n return `Rule violations occurred from CustomAttribute ${this._customAttributeId.name}, container ${this._customAttributeId.containerFullName}: ${violations}`;\r\n case SchemaTypeIdentifiers.RelationshipConstraintIdentifier:\r\n return `Rule violations occurred from ${this._relationshipConstraintId.name} constraint of RelationshipClass ${this._relationshipConstraintId.relationshipKey.fullName}: ${violations}`;\r\n default:\r\n throw new Error (\"Invalid identifier.\");\r\n }\r\n }\r\n\r\n private _createTaskErrorMessage() {\r\n // Make sure we have an inner error or else it is not a task error\r\n if (!this.innerError)\r\n return \"\";\r\n\r\n switch (this.identifier.typeIdentifier) {\r\n case SchemaTypeIdentifiers.SchemaIdentifier:\r\n case SchemaTypeIdentifiers.SchemaItemIdentifier:\r\n case SchemaTypeIdentifiers.ClassIdentifier:\r\n case SchemaTypeIdentifiers.RelationshipConstraintIdentifier:\r\n return `While performing task '${ECEditingStatus[this.errorNumber]}' an error occurred editing ${this.identifier.typeIdentifier} ${this.identifier.name}.`;\r\n case SchemaTypeIdentifiers.PropertyIdentifier:\r\n return `While performing task '${ECEditingStatus[this.errorNumber]}' an error occurred editing ${this.identifier.typeIdentifier} ${this.identifier.fullName}.`;\r\n default:\r\n throw new Error (\"Invalid identifier.\");\r\n }\r\n }\r\n\r\n private isSchemaItemIdentifier(identifier: AnyIdentifier) {\r\n if (identifier.typeIdentifier !== SchemaTypeIdentifiers.SchemaItemIdentifier &&\r\n identifier.typeIdentifier !== SchemaTypeIdentifiers.ClassIdentifier)\r\n return true;\r\n\r\n return false;\r\n }\r\n}\r\n\r\nfunction getEnumeratorType(enumeration: Enumeration, enumerator: AnyEnumerator | string) {\r\n if (typeof(enumerator) === \"string\") {\r\n return enumeration.type ? primitiveTypeToString(enumeration.type) : \"string\";\r\n }\r\n\r\n return typeof(enumerator.value) === \"string\" ? \"string\" : \"int\";\r\n}\r\n"]}
1
+ {"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/Editing/Exception.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAA6D,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAA0B,aAAa,EAA6B,MAAM,0BAA0B,CAAC;AAEvN,aAAa;AACb,MAAM,CAAN,IAAY,eAmFX;AAnFD,WAAY,eAAe;IACzB,4FAA+B,CAAA;IAC/B,2DAAW,CAAA;IACX,4EAAyC,CAAA;IACzC,8EAAc,CAAA;IACd,sFAAkB,CAAA;IAClB,wGAA2B,CAAA;IAC3B,4FAAqB,CAAA;IACrB,kFAAgB,CAAA;IAChB,wFAAmB,CAAA;IACnB,4FAAqB,CAAA;IACrB,oHAAiC,CAAA;IACjC,kHAAgC,CAAA;IAChC,sGAA0B,CAAA;IAC1B,4FAAqB,CAAA;IACrB,wGAA2B,CAAA;IAC3B,4FAAqB,CAAA;IACrB,kFAAgB,CAAA;IAChB,8FAAsB,CAAA;IACtB,4EAAa,CAAA;IACb,sFAAkB,CAAA;IAClB,wGAA2B,CAAA;IAC3B,kGAAwB,CAAA;IACxB,eAAe;IACf,8FAAsB,CAAA;IACtB,oGAAyB,CAAA;IACzB,4EAAa,CAAA;IACb,oGAAyB,CAAA;IACzB,kGAAwB,CAAA;IACxB,0EAAY,CAAA;IACZ,wFAAmB,CAAA;IACnB,wFAAmB,CAAA;IACnB,sFAAkB,CAAA;IAClB,4FAAqB,CAAA;IACrB,4FAAqB,CAAA;IACrB,8GAA8B,CAAA;IAC9B,0GAA4B,CAAA;IAC5B,o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AM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAEO,sBAAsB,CAAC,UAAyB;QACtD,IAAI,UAAU,CAAC,cAAc,KAAK,qBAAqB,CAAC,oBAAoB;YAC1E,UAAU,CAAC,cAAc,KAAK,qBAAqB,CAAC,eAAe;YACnE,OAAO,IAAI,CAAC;QAEd,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,SAAS,iBAAiB,CAAC,WAAwB,EAAE,UAAkC;IACrF,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK,QAAQ,EAAE,CAAC;QACrC,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC/E,CAAC;IAED,OAAO,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;AACnE,CAAC","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 { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { AnyEnumerator, CustomAttributeContainerProps, Enumeration, PrimitiveType, 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 InvalidECName,\r\n InvalidSchemaAlias,\r\n InvalidFormatUnitsSpecified,\r\n SchemaAliasAlreadyExists,\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 SetKindOfQuantity,\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 SetSchemaAlias\r\n}\r\n\r\n/**\r\n * A type that constrains the possible error types handled by SchemaEditingError\r\n * @alpha\r\n */\r\nexport type AnyEditingError = SchemaEditingError | Error;\r\n\r\n/**\r\n * Defines the possible property type names.\r\n * @alpha\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\n/**\r\n * Defines the possible schema type identifiers.\r\n * @alpha\r\n */\r\nexport enum SchemaTypeIdentifiers {\r\n SchemaIdentifier = \"Schema\",\r\n SchemaItemIdentifier = \"SchemaItem\",\r\n ClassIdentifier = \"Class\",\r\n PropertyIdentifier = \"Property\",\r\n EnumeratorIdentifier = \"Enumerator\",\r\n CustomAttributeIdentifier = \"CustomAttribute\",\r\n RelationshipConstraintIdentifier = \"RelationshipConstraint\"\r\n}\r\n\r\n/**\r\n * Type that constrains SchemaItemType enum to those used by EC Class types.\r\n * @alpha\r\n */\r\nexport type ECClassSchemaItems = SchemaItemType.EntityClass | SchemaItemType.StructClass | SchemaItemType.RelationshipClass | SchemaItemType.Mixin | SchemaItemType.CustomAttributeClass;\r\n\r\n/**\r\n * Type that defines the possible SchemaTypeIdentifiers for SchemaItemId classes.\r\n * @alpha\r\n */\r\nexport type AnySchemaItemTypeIdentifier = SchemaTypeIdentifiers.SchemaItemIdentifier | SchemaTypeIdentifiers.ClassIdentifier;\r\n\r\n/**\r\n * Type that encompasses all ISchemaTypeIdentifier interfaces\r\n * @alpha\r\n */\r\nexport type AnyIdentifier = ISchemaIdentifier | ISchemaItemIdentifier | IClassIdentifier | IPropertyIdentifier | ICustomAttributeIdentifier | IRelationshipConstraintIdentifier | IEnumeratorIdentifier;\r\n\r\n/**\r\n * A base interface that defines what is needed to identity any schema type.\r\n * @alpha\r\n */\r\nexport interface ISchemaTypeIdentifier {\r\n readonly name: string;\r\n readonly schemaKey: SchemaKey;\r\n readonly typeIdentifier: SchemaTypeIdentifiers;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify a Schema.\r\n * @alpha\r\n */\r\nexport interface ISchemaIdentifier extends ISchemaTypeIdentifier {\r\n readonly typeIdentifier: SchemaTypeIdentifiers.SchemaIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify a SchemaItem.\r\n * @alpha\r\n */\r\nexport interface ISchemaItemIdentifier extends ISchemaTypeIdentifier {\r\n readonly schemaItemType: SchemaItemType;\r\n readonly schemaItemKey: SchemaItemKey;\r\n readonly typeIdentifier: AnySchemaItemTypeIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify an EC Class.\r\n * @alpha\r\n */\r\nexport interface IClassIdentifier extends ISchemaTypeIdentifier {\r\n readonly schemaItemType: ECClassSchemaItems;\r\n readonly schemaItemKey: SchemaItemKey;\r\n readonly typeIdentifier: SchemaTypeIdentifiers.ClassIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify an EC Property.\r\n * @alpha\r\n */\r\nexport interface IPropertyIdentifier extends ISchemaTypeIdentifier {\r\n readonly fullName: string;\r\n readonly ecClass: ClassId;\r\n readonly typeName?: PropertyTypeName;\r\n readonly typeIdentifier: SchemaTypeIdentifiers.PropertyIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify an Enumerator.\r\n * @alpha\r\n */\r\ninterface IEnumeratorIdentifier extends ISchemaTypeIdentifier {\r\n readonly enumeratorType: string;\r\n readonly enumeration: SchemaItemKey;\r\n readonly enumerationType: string;\r\n readonly typeIdentifier: SchemaTypeIdentifiers.EnumeratorIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify a CustomAttribute.\r\n * @alpha\r\n */\r\nexport interface ICustomAttributeIdentifier extends ISchemaTypeIdentifier {\r\n readonly containerFullName: string;\r\n readonly typeIdentifier: SchemaTypeIdentifiers.CustomAttributeIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify a RelationshipConstraint.\r\n * @alpha\r\n */\r\nexport interface IRelationshipConstraintIdentifier extends ISchemaTypeIdentifier {\r\n readonly relationshipKey: SchemaItemKey;\r\n readonly typeIdentifier: SchemaTypeIdentifiers.RelationshipConstraintIdentifier;\r\n}\r\n\r\n/**\r\n * An ISchemaIdentifier implementation to identify Schemas\r\n * @alpha\r\n */\r\nexport class SchemaId implements ISchemaIdentifier {\r\n public readonly typeIdentifier = SchemaTypeIdentifiers.SchemaIdentifier;\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\n/**\r\n * An ISchemItemIdentifier implementation to identify SchemaItems\r\n * @alpha\r\n */\r\nexport class SchemaItemId implements ISchemaItemIdentifier {\r\n public readonly typeIdentifier: AnySchemaItemTypeIdentifier;\r\n public readonly name: string;\r\n public readonly schemaKey: SchemaKey;\r\n public readonly schemaItemType: SchemaItemType;\r\n public readonly schemaItemKey: SchemaItemKey;\r\n\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.schemaItemType = schemaItemType;\r\n this.name = this.schemaItemKey.fullName;\r\n this.typeIdentifier = SchemaTypeIdentifiers.SchemaItemIdentifier;\r\n }\r\n}\r\n\r\n/**\r\n * An IClassIdentifier implementation to identify Class instances.\r\n * @alpha\r\n */\r\nexport class ClassId extends SchemaItemId implements IClassIdentifier {\r\n public override readonly typeIdentifier = SchemaTypeIdentifiers.ClassIdentifier;\r\n public override readonly schemaItemType: ECClassSchemaItems;\r\n constructor(schemaItemType: ECClassSchemaItems, schemaItemKeyOrName: SchemaItemKey | string, schemaKey?: SchemaKey) {\r\n super(schemaItemType, schemaItemKeyOrName, schemaKey);\r\n this.schemaItemType = schemaItemType;\r\n }\r\n}\r\n\r\n/**\r\n * An IPropertyIdentifier implementation to identify Property instances.\r\n * @alpha\r\n */\r\nexport class PropertyId implements IPropertyIdentifier {\r\n public readonly typeIdentifier = SchemaTypeIdentifiers.PropertyIdentifier;\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\n/**\r\n * An IEnumeratorIdentifier implementation to identify Enumerator instances.\r\n * @alpha\r\n */\r\nexport class EnumeratorId implements IEnumeratorIdentifier {\r\n public readonly typeIdentifier = SchemaTypeIdentifiers.EnumeratorIdentifier;\r\n public readonly enumeration: SchemaItemKey;\r\n public readonly enumerationType: string;\r\n public readonly enumeratorType: string;\r\n public readonly name: string;\r\n public readonly schemaKey: SchemaKey;\r\n\r\n constructor(enumerator: AnyEnumerator | string, enumeration: Enumeration) {\r\n this.enumeration = enumeration.key;\r\n this.enumerationType = enumeration.type ? primitiveTypeToString(enumeration.type) : \"string\";\r\n this.enumeratorType = getEnumeratorType(enumeration ?? PrimitiveType.String, enumerator);\r\n this.name = typeof (enumerator) === \"string\" ? enumerator : enumerator.name;\r\n this.schemaKey = enumeration.schema.schemaKey;\r\n }\r\n}\r\n\r\n/**\r\n * An ICustomAttributeIdentifier implementation to identify CustomAttribute instances.\r\n * @alpha\r\n */\r\nexport class CustomAttributeId implements ICustomAttributeIdentifier {\r\n public readonly typeIdentifier = SchemaTypeIdentifiers.CustomAttributeIdentifier;\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\n/**\r\n * An IRelationshipConstraintIdentifier implementation to identify RelationshipConstraints.\r\n * @alpha\r\n */\r\nexport class RelationshipConstraintId implements IRelationshipConstraintIdentifier {\r\n public readonly typeIdentifier = SchemaTypeIdentifiers.RelationshipConstraintIdentifier;\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.isSource ? \"Source\" : \"Target\";\r\n this.relationshipKey = constraint.relationshipClass.key;\r\n this.schemaKey = this.relationshipKey.schemaKey;\r\n }\r\n}\r\n\r\n/**\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 * @alpha\r\n */\r\nexport class SchemaEditingError extends Error {\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 readonly errorNumber: ECEditingStatus, public readonly identifier: AnyIdentifier, public readonly innerError?: AnyEditingError, ruleViolations?: AnyDiagnostic[], message?: string) {\r\n super(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 private get _schemaId(): SchemaId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.SchemaIdentifier)\r\n throw new Error(\"identifier is not a SchemaId.\");\r\n return this.identifier;\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 private get _schemaItemId(): SchemaItemId {\r\n if (this.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 private get _classId(): ClassId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.ClassIdentifier)\r\n throw new Error(\"identifier is not a ClassId.\");\r\n return this.identifier as ClassId;\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 private get _propertyId(): PropertyId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.PropertyIdentifier)\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 EnumeratorId instance.\r\n * @throws Error if the identifier is not an instance of EnumeratorId.\r\n */\r\n private get _enumeratorId(): EnumeratorId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.EnumeratorIdentifier)\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 private get _customAttributeId(): CustomAttributeId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.CustomAttributeIdentifier)\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 private get _relationshipConstraintId(): RelationshipConstraintId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.RelationshipConstraintIdentifier)\r\n throw new Error(\"identifier is not a RelationshipConstraintId.\");\r\n return this.identifier;\r\n }\r\n\r\n /** Gets rule violations that were reported during validation. Returns an array of [[AnyDiagnostic]] if\r\n * the errorNumber is ECEditingStatus.RuleViolation, otherwise undefined.\r\n */\r\n public get ruleViolations(): AnyDiagnostic[] | undefined {\r\n return this._ruleViolations;\r\n }\r\n\r\n /**\r\n * Returns a readable string containing the ECEditingStatus along with the error message. Any\r\n * innerError will also be appended.\r\n * @returns\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 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.schemaItemType} ${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.schemaItemType} ${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.schemaItemType}.`;\r\n return;\r\n case ECEditingStatus.SchemaItemNameNotSpecified:\r\n this.message = `Could not create a new ${this._schemaItemId.schemaItemType} 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.schemaItemType} ${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._enumeratorId.enumeration.fullName} has type ${this._enumeratorId.enumerationType}, while Enumerator ${this._enumeratorId.name} has type ${this._enumeratorId.enumeratorType}.`;\r\n return;\r\n case ECEditingStatus.EnumeratorDoesNotExist:\r\n this.message = `Enumerator ${this._enumeratorId.name} does not exists in Enumeration ${this._enumeratorId.enumeration.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 case ECEditingStatus.InvalidSchemaAlias:\r\n this.message = `Could not set the alias for schema ${this._schemaKey.name} because the specified alias is not a valid ECName.`;\r\n return;\r\n default:\r\n this.message = this._createTaskErrorMessage();\r\n }\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 _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 switch (this.identifier.typeIdentifier) {\r\n case SchemaTypeIdentifiers.SchemaIdentifier:\r\n return `Rule violations occurred from Schema ${this._schemaId.name}: ${violations}`;\r\n case SchemaTypeIdentifiers.SchemaItemIdentifier:\r\n return `Rule violations occurred from ${this._schemaItemId.schemaItemType} ${this._schemaItemId.name}: ${violations}`;\r\n case SchemaTypeIdentifiers.ClassIdentifier:\r\n return `Rule violations occurred from ${this._schemaItemId.schemaItemType} ${this._schemaItemId.name}: ${violations}`;\r\n case SchemaTypeIdentifiers.CustomAttributeIdentifier:\r\n return `Rule violations occurred from CustomAttribute ${this._customAttributeId.name}, container ${this._customAttributeId.containerFullName}: ${violations}`;\r\n case SchemaTypeIdentifiers.RelationshipConstraintIdentifier:\r\n return `Rule violations occurred from ${this._relationshipConstraintId.name} constraint of RelationshipClass ${this._relationshipConstraintId.relationshipKey.fullName}: ${violations}`;\r\n default:\r\n throw new Error(\"Invalid identifier.\");\r\n }\r\n }\r\n\r\n private _createTaskErrorMessage() {\r\n // Make sure we have an inner error or else it is not a task error\r\n if (!this.innerError)\r\n return \"\";\r\n\r\n switch (this.identifier.typeIdentifier) {\r\n case SchemaTypeIdentifiers.SchemaIdentifier:\r\n case SchemaTypeIdentifiers.SchemaItemIdentifier:\r\n case SchemaTypeIdentifiers.ClassIdentifier:\r\n case SchemaTypeIdentifiers.RelationshipConstraintIdentifier:\r\n return `While performing task '${ECEditingStatus[this.errorNumber]}' an error occurred editing ${this.identifier.typeIdentifier} ${this.identifier.name}.`;\r\n case SchemaTypeIdentifiers.PropertyIdentifier:\r\n return `While performing task '${ECEditingStatus[this.errorNumber]}' an error occurred editing ${this.identifier.typeIdentifier} ${this.identifier.fullName}.`;\r\n default:\r\n throw new Error(\"Invalid identifier.\");\r\n }\r\n }\r\n\r\n private isSchemaItemIdentifier(identifier: AnyIdentifier) {\r\n if (identifier.typeIdentifier !== SchemaTypeIdentifiers.SchemaItemIdentifier &&\r\n identifier.typeIdentifier !== SchemaTypeIdentifiers.ClassIdentifier)\r\n return true;\r\n\r\n return false;\r\n }\r\n}\r\n\r\nfunction getEnumeratorType(enumeration: Enumeration, enumerator: AnyEnumerator | string) {\r\n if (typeof (enumerator) === \"string\") {\r\n return enumeration.type ? primitiveTypeToString(enumeration.type) : \"string\";\r\n }\r\n\r\n return typeof (enumerator.value) === \"string\" ? \"string\" : \"int\";\r\n}\r\n"]}
@@ -60,7 +60,7 @@ export class Formats extends SchemaItems {
60
60
  return newFormat.key;
61
61
  }
62
62
  catch (e) {
63
- throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, formatProps.name, schemaKey), e);
63
+ throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, formatProps.name ?? "Unknown", schemaKey), e);
64
64
  }
65
65
  }
66
66
  }