@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":"Exception.js","sourceRoot":"","sources":["../../../src/Editing/Exception.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,gEAAuN;AAEvN,aAAa;AACb,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,oGAAyB,CAAA;IACzB,kGAAwB,CAAA;IACxB,oHAAiC,CAAA;IACjC,8EAAc,CAAA;IACd,4EAAa,CAAA;IACb,8EAAc,CAAA;IACd,kEAAQ,CAAA;IACR,4EAAa,CAAA;IACb,wEAAW,CAAA;IACX,wEAAW,CAAA;IACX,oFAAiB,CAAA;IACjB,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,KAAK,qBAAqB,CAAC,eAAe;YACnE,OAAO,IAAI,CAAC;QAEd,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAtOD,gDAsOC;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,IAAA,yCAAqB,EAAC,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,gEAAuN;AAEvN,aAAa;AACb,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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AAC","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"]}
@@ -63,7 +63,7 @@ class Formats extends SchemaItems_1.SchemaItems {
63
63
  return newFormat.key;
64
64
  }
65
65
  catch (e) {
66
- throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.SchemaItemId(this.schemaItemType, formatProps.name, schemaKey), e);
66
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.SchemaItemId(this.schemaItemType, formatProps.name ?? "Unknown", schemaKey), e);
67
67
  }
68
68
  }
69
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Formats.js","sourceRoot":"","sources":["../../../src/Editing/Formats.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAgK;AAIhK,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,OAAQ,SAAQ,yBAAW;IACtC,IAAuB,aAAa;QAClC,OAAO,0BAAM,CAAC;IAChB,CAAC;IAED,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,UAAsB,EAAE,YAAqB,EAAE,KAAuB;QAC5H,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,IAAI,CAA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CAAC,UAAU,CAAC,CAAC;YACpC,OAAO,SAAS,CAAC,GAAG,CAAC;QACvB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,sBAAsB,EAAE,IAAI,wBAAY,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,WAAkC;QACnF,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC;YAClJ,OAAO,SAAS,CAAC,GAAG,CAAC;QACvB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAClJ,CAAC;IACH,CAAC;CACF;AAtDD,0BAsDC","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 { DelayedPromiseWithProps, Format, InvertedUnit, SchemaItemFormatProps, SchemaItemKey, SchemaItemType, SchemaKey, Unit } from \"@itwin/ecschema-metadata\";\r\nimport { FormatType } from \"@itwin/core-quantity\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableFormat } from \"./Mutable/MutableFormat\";\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 Format.\r\n */\r\nexport class Formats extends SchemaItems {\r\n protected override get itemTypeClass(): typeof Format {\r\n return Format;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.Format, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, formatType: FormatType, displayLabel?: string, units?: SchemaItemKey[]): Promise<SchemaItemKey> {\r\n try {\r\n const newFormat = await this.createSchemaItem<Format>(schemaKey, this.schemaItemType, (schema) => schema.createFormat.bind(schema), name) as MutableFormat;\r\n\r\n if (units !== undefined) {\r\n for (const unit of units) {\r\n const unitItem = await this.schemaEditor.schemaContext.getSchemaItem(unit);\r\n if (!unitItem) {\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFoundInContext, new SchemaItemId(SchemaItemType.Unit, unit));\r\n }\r\n\r\n if (Unit.isUnit(unitItem) ) {\r\n newFormat.addUnit(new DelayedPromiseWithProps(unitItem.key, async () => unitItem));\r\n } else if (InvertedUnit.isInvertedUnit(unitItem) ) {\r\n newFormat.addUnit(new DelayedPromiseWithProps(unitItem.key, async () => unitItem));\r\n } else {\r\n throw new SchemaEditingError(ECEditingStatus.InvalidFormatUnitsSpecified, new SchemaItemId(unitItem.schemaItemType, unitItem.key));\r\n }\r\n }\r\n }\r\n\r\n if (displayLabel)\r\n newFormat.setDisplayLabel(displayLabel);\r\n\r\n // TODO: Handle the setting of format traits, separators, etc....\r\n newFormat.setFormatType(formatType);\r\n return newFormat.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 format through a SchemaItemFormatProps.\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, formatProps: SchemaItemFormatProps): Promise<SchemaItemKey> {\r\n try {\r\n const newFormat = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createFormat.bind(schema), formatProps);\r\n return newFormat.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, formatProps.name!, schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Formats.js","sourceRoot":"","sources":["../../../src/Editing/Formats.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAgK;AAIhK,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,OAAQ,SAAQ,yBAAW;IACtC,IAAuB,aAAa;QAClC,OAAO,0BAAM,CAAC;IAChB,CAAC;IAED,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,UAAsB,EAAE,YAAqB,EAAE,KAAuB;QAC5H,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAS,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAkB,CAAC;YAE3J,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;oBACzB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;oBAC3E,IAAI,CAAC,QAAQ,EAAE,CAAC;wBACd,MA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AC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC;YAClJ,OAAO,SAAS,CAAC,GAAG,CAAC;QACvB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,IAAI,IAAI,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9J,CAAC;IACH,CAAC;CACF;AAtDD,0BAsDC","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 { DelayedPromiseWithProps, Format, InvertedUnit, SchemaItemFormatProps, SchemaItemKey, SchemaItemType, SchemaKey, Unit } from \"@itwin/ecschema-metadata\";\r\nimport { FormatType } from \"@itwin/core-quantity\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableFormat } from \"./Mutable/MutableFormat\";\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 Format.\r\n */\r\nexport class Formats extends SchemaItems {\r\n protected override get itemTypeClass(): typeof Format {\r\n return Format;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.Format, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, formatType: FormatType, displayLabel?: string, units?: SchemaItemKey[]): Promise<SchemaItemKey> {\r\n try {\r\n const newFormat = await this.createSchemaItem<Format>(schemaKey, this.schemaItemType, (schema) => schema.createFormat.bind(schema), name) as MutableFormat;\r\n\r\n if (units !== undefined) {\r\n for (const unit of units) {\r\n const unitItem = await this.schemaEditor.schemaContext.getSchemaItem(unit);\r\n if (!unitItem) {\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFoundInContext, new SchemaItemId(SchemaItemType.Unit, unit));\r\n }\r\n\r\n if (Unit.isUnit(unitItem)) {\r\n newFormat.addUnit(new DelayedPromiseWithProps(unitItem.key, async () => unitItem));\r\n } else if (InvertedUnit.isInvertedUnit(unitItem)) {\r\n newFormat.addUnit(new DelayedPromiseWithProps(unitItem.key, async () => unitItem));\r\n } else {\r\n throw new SchemaEditingError(ECEditingStatus.InvalidFormatUnitsSpecified, new SchemaItemId(unitItem.schemaItemType, unitItem.key));\r\n }\r\n }\r\n }\r\n\r\n if (displayLabel)\r\n newFormat.setDisplayLabel(displayLabel);\r\n\r\n // TODO: Handle the setting of format traits, separators, etc....\r\n newFormat.setFormatType(formatType);\r\n return newFormat.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 format through a SchemaItemFormatProps.\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, formatProps: SchemaItemFormatProps): Promise<SchemaItemKey> {\r\n try {\r\n const newFormat = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createFormat.bind(schema), formatProps);\r\n return newFormat.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, formatProps.name ?? \"Unknown\", schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -44,7 +44,7 @@ class InvertedUnits extends SchemaItems_1.SchemaItems {
44
44
  return newUnit.key;
45
45
  }
46
46
  catch (e) {
47
- throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.SchemaItemId(this.schemaItemType, invertedUnitProps.name, schemaKey), e);
47
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.SchemaItemId(this.schemaItemType, invertedUnitProps.name ?? "Unknown", schemaKey), e);
48
48
  }
49
49
  }
50
50
  async setInvertsUnit(invertedUnitKey, invertsUnitKey) {
@@ -1 +1 @@
1
- {"version":3,"file":"InvertedUnits.js","sourceRoot":"","sources":["../../../src/Editing/InvertedUnits.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAGkC;AAElC,uEAAoE;AACpE,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,aAAc,SAAQ,yBAAW;IAC5C,IAAuB,aAAa;QAClC,OAAO,gCAAY,CAAC;IACtB,CAAC;IAED,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACnD,CAAC;IACM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,cAA6B,EAAE,aAA4B,EAAE,YAAqB;QACxI,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAe,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAwB,CAAC;YAE3K,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,wBAAI,CAAC,CAAC;YACnE,OAAO,CAAC,cAAc,CAAC,IAAI,2CAAuB,CAAsB,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC,WAAW,CAAC,CAAC,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GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,wBAAI,CAAC,CAAC;YACpE,YAAY,CAAC,cAAc,CAAC,IAAI,2CAAuB,CAAsB,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;QACzH,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,cAAc,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1H,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,eAA8B,EAAE,aAA4B;QACrF,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,yCAAmB,CAAC,CAAC;YACpF,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,8BAAU,CAAC,CAAC;YACvE,YAAY,CAAC,aAAa,CAAC,IAAI,2CAAuB,CAA4B,aAAa,EAAE,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;QAC5H,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,aAAa,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;QACzH,CAAC;IACH,CAAC;CACF;AAvDD,sCAuDC","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 DelayedPromiseWithProps, InvertedUnit, InvertedUnitProps, SchemaItemKey,\r\n SchemaItemType, SchemaKey, Unit, UnitSystem,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableInvertedUnit } from \"./Mutable/MutableInvertedUnit\";\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 Inverted Unit.\r\n */\r\nexport class InvertedUnits extends SchemaItems {\r\n protected override get itemTypeClass(): typeof InvertedUnit {\r\n return InvertedUnit;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.InvertedUnit, schemaEditor);\r\n }\r\n public async create(schemaKey: SchemaKey, name: string, invertsUnitKey: SchemaItemKey, unitSystemKey: SchemaItemKey, displayLabel?: string): Promise<SchemaItemKey> {\r\n try {\r\n const newUnit = await this.createSchemaItem<InvertedUnit>(schemaKey, this.schemaItemType, (schema) => schema.createInvertedUnit.bind(schema), name) as MutableInvertedUnit;\r\n\r\n const invertsUnit = await this.getSchemaItem(invertsUnitKey, Unit);\r\n newUnit.setInvertsUnit(new DelayedPromiseWithProps<SchemaItemKey, Unit>(invertsUnitKey, async () => invertsUnit));\r\n\r\n const unitSystem = await this.getSchemaItem(unitSystemKey, UnitSystem);\r\n newUnit.setUnitSystem(new DelayedPromiseWithProps<SchemaItemKey, UnitSystem>(unitSystemKey, async () => unitSystem));\r\n\r\n if (displayLabel)\r\n newUnit.setDisplayLabel(displayLabel);\r\n\r\n return newUnit.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 public async createFromProps(schemaKey: SchemaKey, invertedUnitProps: InvertedUnitProps): Promise<SchemaItemKey> {\r\n try {\r\n const newUnit = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createInvertedUnit.bind(schema), invertedUnitProps);\r\n return newUnit.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, invertedUnitProps.name!, schemaKey), e);\r\n }\r\n }\r\n\r\n public async setInvertsUnit(invertedUnitKey: SchemaItemKey, invertsUnitKey: SchemaItemKey): Promise<void> {\r\n try {\r\n const invertedUnit = await this.getSchemaItem(invertedUnitKey, MutableInvertedUnit);\r\n const invertsUnit = await this.getSchemaItem(invertedUnitKey, Unit);\r\n invertedUnit.setInvertsUnit(new DelayedPromiseWithProps<SchemaItemKey, Unit>(invertsUnitKey, async () => invertsUnit));\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.SetInvertsUnit, new SchemaItemId(this.schemaItemType, invertedUnitKey), e);\r\n }\r\n }\r\n\r\n public async setUnitSystem(invertedUnitKey: SchemaItemKey, unitSystemKey: SchemaItemKey): Promise<void> {\r\n try {\r\n const invertedUnit = await this.getSchemaItem(invertedUnitKey, MutableInvertedUnit);\r\n const unitSystem = await this.getSchemaItem(unitSystemKey, UnitSystem);\r\n invertedUnit.setUnitSystem(new DelayedPromiseWithProps<SchemaItemKey, UnitSystem>(unitSystemKey, async () => unitSystem));\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.SetUnitSystem, new SchemaItemId(this.schemaItemType, invertedUnitKey), e);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"InvertedUnits.js","sourceRoot":"","sources":["../../../src/Editing/InvertedUnits.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAGkC;AAElC,uEAAoE;AACpE,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,aAAc,SAAQ,yBAAW;IAC5C,IAAuB,aAAa;QAClC,OAAO,gCAAY,CAAC;IACtB,CAAC;IAED,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACnD,CAAC;IACM,KAAK,CAA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,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,aAAa,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;QACzH,CAAC;IACH,CAAC;CACF;AAvDD,sCAuDC","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 DelayedPromiseWithProps, InvertedUnit, InvertedUnitProps, SchemaItemKey,\r\n SchemaItemType, SchemaKey, Unit, UnitSystem,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableInvertedUnit } from \"./Mutable/MutableInvertedUnit\";\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 Inverted Unit.\r\n */\r\nexport class InvertedUnits extends SchemaItems {\r\n protected override get itemTypeClass(): typeof InvertedUnit {\r\n return InvertedUnit;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.InvertedUnit, schemaEditor);\r\n }\r\n public async create(schemaKey: SchemaKey, name: string, invertsUnitKey: SchemaItemKey, unitSystemKey: SchemaItemKey, displayLabel?: string): Promise<SchemaItemKey> {\r\n try {\r\n const newUnit = await this.createSchemaItem<InvertedUnit>(schemaKey, this.schemaItemType, (schema) => schema.createInvertedUnit.bind(schema), name) as MutableInvertedUnit;\r\n\r\n const invertsUnit = await this.getSchemaItem(invertsUnitKey, Unit);\r\n newUnit.setInvertsUnit(new DelayedPromiseWithProps<SchemaItemKey, Unit>(invertsUnitKey, async () => invertsUnit));\r\n\r\n const unitSystem = await this.getSchemaItem(unitSystemKey, UnitSystem);\r\n newUnit.setUnitSystem(new DelayedPromiseWithProps<SchemaItemKey, UnitSystem>(unitSystemKey, async () => unitSystem));\r\n\r\n if (displayLabel)\r\n newUnit.setDisplayLabel(displayLabel);\r\n\r\n return newUnit.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 public async createFromProps(schemaKey: SchemaKey, invertedUnitProps: InvertedUnitProps): Promise<SchemaItemKey> {\r\n try {\r\n const newUnit = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createInvertedUnit.bind(schema), invertedUnitProps);\r\n return newUnit.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, invertedUnitProps.name ?? \"Unknown\", schemaKey), e);\r\n }\r\n }\r\n\r\n public async setInvertsUnit(invertedUnitKey: SchemaItemKey, invertsUnitKey: SchemaItemKey): Promise<void> {\r\n try {\r\n const invertedUnit = await this.getSchemaItem(invertedUnitKey, MutableInvertedUnit);\r\n const invertsUnit = await this.getSchemaItem(invertedUnitKey, Unit);\r\n invertedUnit.setInvertsUnit(new DelayedPromiseWithProps<SchemaItemKey, Unit>(invertsUnitKey, async () => invertsUnit));\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.SetInvertsUnit, new SchemaItemId(this.schemaItemType, invertedUnitKey), e);\r\n }\r\n }\r\n\r\n public async setUnitSystem(invertedUnitKey: SchemaItemKey, unitSystemKey: SchemaItemKey): Promise<void> {\r\n try {\r\n const invertedUnit = await this.getSchemaItem(invertedUnitKey, MutableInvertedUnit);\r\n const unitSystem = await this.getSchemaItem(unitSystemKey, UnitSystem);\r\n invertedUnit.setUnitSystem(new DelayedPromiseWithProps<SchemaItemKey, UnitSystem>(unitSystemKey, async () => unitSystem));\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.SetUnitSystem, new SchemaItemId(this.schemaItemType, invertedUnitKey), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -50,7 +50,7 @@ class KindOfQuantities extends SchemaItems_1.SchemaItems {
50
50
  return koqItem.key;
51
51
  }
52
52
  catch (e) {
53
- throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.SchemaItemId(this.schemaItemType, koqProps.name, schemaKey), e);
53
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.SchemaItemId(this.schemaItemType, koqProps.name ?? "Unknown", schemaKey), e);
54
54
  }
55
55
  }
56
56
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"KindOfQuantities.js","sourceRoot":"","sources":["../../../src/Editing/KindOfQuantities.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAIkC;AAElC,2EAAwE;AACxE,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,yBAAW;IAC/C,IAAuB,aAAa;QAClC,OAAO,kCAAc,CAAC;IACxB,CAAC;IACD,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;IACrD,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,kBAAiC,EAAE,YAAqB;QAC9G,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAiB,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAA0B,CAAC;YACjL,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,kBAAkB,CAAC,C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M,EAAE,CAAC;YACf,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,uBAAuB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1H,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,oBAAoB,CAAC,MAAqB,EAAE,SAAkB,EAAE,kBAAyF;QACpK,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,0BAAM,CAAC,CAAC;YAC9D,OAAO,IAAI,kCAAc,CAAC,YAAY,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAAC;QACzE,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,oBAAoB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QACvH,CAAC;IACH,CAAC;CACF;AA/ED,4CA+EC","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 DelayedPromiseWithProps,\r\n Format, InvertedUnit, KindOfQuantity, KindOfQuantityProps, LazyLoadedInvertedUnit, LazyLoadedUnit, OverrideFormat,\r\n SchemaItemKey, SchemaItemType, SchemaKey, Unit,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableKindOfQuantity } from \"./Mutable/MutableKindOfQuantity\";\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 KindOfQuantity.\r\n */\r\nexport class KindOfQuantities extends SchemaItems {\r\n protected override get itemTypeClass(): typeof KindOfQuantity {\r\n return KindOfQuantity;\r\n }\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.KindOfQuantity, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, persistenceUnitKey: SchemaItemKey, displayLabel?: string): Promise<SchemaItemKey> {\r\n try {\r\n const koqItem = await this.createSchemaItem<KindOfQuantity>(schemaKey, this.schemaItemType, (schema) => schema.createKindOfQuantity.bind(schema), name) as MutableKindOfQuantity;\r\n const persistenceUnit = await koqItem.schema.lookupItem(persistenceUnitKey);\r\n if (persistenceUnit === undefined || (!Unit.isUnit(persistenceUnit) && !InvertedUnit.isInvertedUnit(persistenceUnit)))\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new SchemaItemId(SchemaItemType.Unit, persistenceUnitKey));\r\n\r\n if (Unit.isUnit(persistenceUnit)) {\r\n koqItem.setPersistenceUnit(new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit));\r\n }\r\n\r\n if (InvertedUnit.isInvertedUnit(persistenceUnit)) {\r\n koqItem.setPersistenceUnit(new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit));\r\n }\r\n\r\n if (displayLabel !== undefined) {\r\n koqItem.setDisplayLabel(displayLabel);\r\n }\r\n\r\n return koqItem.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 public async createFromProps(schemaKey: SchemaKey, koqProps: KindOfQuantityProps): Promise<SchemaItemKey> {\r\n try {\r\n const koqItem = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createKindOfQuantity.bind(schema), koqProps);\r\n return koqItem.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, koqProps.name!, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n *\r\n * @param koqKey A schemaItemKey of the editing KindOfQuantity.\r\n * @param format A schemaItemKey of a Format.\r\n * @param isDefault .is set to false when not explicitly passed.\r\n */\r\n public async addPresentationFormat(koqKey: SchemaItemKey, format: SchemaItemKey, isDefault: boolean = false): Promise<void> {\r\n try {\r\n const kindOfQuantity = await this.getSchemaItem(koqKey, MutableKindOfQuantity);\r\n const presentationFormat = await this.getSchemaItem(format, Format);\r\n kindOfQuantity.addPresentationFormat(new DelayedPromiseWithProps(presentationFormat.key, async () => presentationFormat), isDefault);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.AddPresentationUnit, new SchemaItemId(this.schemaItemType, koqKey), e);\r\n }\r\n }\r\n\r\n public async addPresentationOverrideFormat(koqKey: SchemaItemKey, overrideFormat: OverrideFormat, isDefault: boolean = false): Promise<void> {\r\n try {\r\n const kindOfQuantity = await this.getSchemaItem(koqKey, MutableKindOfQuantity);\r\n kindOfQuantity.addPresentationFormat(overrideFormat, isDefault);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.AddPresentationOverride, new SchemaItemId(this.schemaItemType, koqKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * @param parent A SchemaItemKey of the parent Format.\r\n * @param unitLabelOverrides The list of Unit (or InvertedUnit) and label overrides. The length of list should be equal to the number of units in the parent Format.\r\n */\r\n public async createFormatOverride(parent: SchemaItemKey, precision?: number, unitLabelOverrides?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): Promise<OverrideFormat> {\r\n try {\r\n const parentFormat = await this.getSchemaItem(parent, Format);\r\n return new OverrideFormat(parentFormat, precision, unitLabelOverrides);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateFormatOverride, new SchemaItemId(this.schemaItemType, parent), e);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"KindOfQuantities.js","sourceRoot":"","s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AC,2BAAe,CAAC,oBAAoB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QACvH,CAAC;IACH,CAAC;CACF;AA/ED,4CA+EC","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 DelayedPromiseWithProps,\r\n Format, InvertedUnit, KindOfQuantity, KindOfQuantityProps, LazyLoadedInvertedUnit, LazyLoadedUnit, OverrideFormat,\r\n SchemaItemKey, SchemaItemType, SchemaKey, Unit,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableKindOfQuantity } from \"./Mutable/MutableKindOfQuantity\";\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 KindOfQuantity.\r\n */\r\nexport class KindOfQuantities extends SchemaItems {\r\n protected override get itemTypeClass(): typeof KindOfQuantity {\r\n return KindOfQuantity;\r\n }\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.KindOfQuantity, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, persistenceUnitKey: SchemaItemKey, displayLabel?: string): Promise<SchemaItemKey> {\r\n try {\r\n const koqItem = await this.createSchemaItem<KindOfQuantity>(schemaKey, this.schemaItemType, (schema) => schema.createKindOfQuantity.bind(schema), name) as MutableKindOfQuantity;\r\n const persistenceUnit = await koqItem.schema.lookupItem(persistenceUnitKey);\r\n if (persistenceUnit === undefined || (!Unit.isUnit(persistenceUnit) && !InvertedUnit.isInvertedUnit(persistenceUnit)))\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new SchemaItemId(SchemaItemType.Unit, persistenceUnitKey));\r\n\r\n if (Unit.isUnit(persistenceUnit)) {\r\n koqItem.setPersistenceUnit(new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit));\r\n }\r\n\r\n if (InvertedUnit.isInvertedUnit(persistenceUnit)) {\r\n koqItem.setPersistenceUnit(new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit));\r\n }\r\n\r\n if (displayLabel !== undefined) {\r\n koqItem.setDisplayLabel(displayLabel);\r\n }\r\n\r\n return koqItem.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 public async createFromProps(schemaKey: SchemaKey, koqProps: KindOfQuantityProps): Promise<SchemaItemKey> {\r\n try {\r\n const koqItem = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createKindOfQuantity.bind(schema), koqProps);\r\n return koqItem.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, koqProps.name ?? \"Unknown\", schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n *\r\n * @param koqKey A schemaItemKey of the editing KindOfQuantity.\r\n * @param format A schemaItemKey of a Format.\r\n * @param isDefault .is set to false when not explicitly passed.\r\n */\r\n public async addPresentationFormat(koqKey: SchemaItemKey, format: SchemaItemKey, isDefault: boolean = false): Promise<void> {\r\n try {\r\n const kindOfQuantity = await this.getSchemaItem(koqKey, MutableKindOfQuantity);\r\n const presentationFormat = await this.getSchemaItem(format, Format);\r\n kindOfQuantity.addPresentationFormat(new DelayedPromiseWithProps(presentationFormat.key, async () => presentationFormat), isDefault);\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.AddPresentationUnit, new SchemaItemId(this.schemaItemType, koqKey), e);\r\n }\r\n }\r\n\r\n public async addPresentationOverrideFormat(koqKey: SchemaItemKey, overrideFormat: OverrideFormat, isDefault: boolean = false): Promise<void> {\r\n try {\r\n const kindOfQuantity = await this.getSchemaItem(koqKey, MutableKindOfQuantity);\r\n kindOfQuantity.addPresentationFormat(overrideFormat, isDefault);\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.AddPresentationOverride, new SchemaItemId(this.schemaItemType, koqKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * @param parent A SchemaItemKey of the parent Format.\r\n * @param unitLabelOverrides The list of Unit (or InvertedUnit) and label overrides. The length of list should be equal to the number of units in the parent Format.\r\n */\r\n public async createFormatOverride(parent: SchemaItemKey, precision?: number, unitLabelOverrides?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): Promise<OverrideFormat> {\r\n try {\r\n const parentFormat = await this.getSchemaItem(parent, Format);\r\n return new OverrideFormat(parentFormat, precision, unitLabelOverrides);\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateFormatOverride, new SchemaItemId(this.schemaItemType, parent), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -52,7 +52,7 @@ class Mixins extends ECClasses_1.ECClasses {
52
52
  return newClass.key;
53
53
  }
54
54
  catch (e) {
55
- throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.ClassId(this.schemaItemType, mixinProps.name, schemaKey), e);
55
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.ClassId(this.schemaItemType, mixinProps.name ?? "Unknown", schemaKey), e);
56
56
  }
57
57
  }
58
58
  async addMixin(entityKey, mixinKey) {
@@ -1 +1 @@
1
- {"version":3,"file":"Mixins.js","sourceRoot":"","sources":["../../../src/Editing/Mixins.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAGkC;AAElC,2CAAwC;AACxC,yDAAsD;AAEtD,6CAAoD;AAC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AC,CAAC;QACtE,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,wBAAwB,EAAE,IAAI,mBAAO,CAAC,kCAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QACzH,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,iCAAiC,CAAC,QAAuB,EAAE,eAAwC;QAC9G,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,2BAAY,CAAC,CAAC;YAC/D,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,wBAAwB,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,gBAAgB,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;YACzI,MAAM,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,iCAAiC,EAAE,IAAI,mBAAO,CAAC,kCAAc,CAAC,iBAAiB,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9I,CAAC;IACH,CAAC;CACF;AA5ED,wBA4EC","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 DelayedPromiseWithProps, EntityClass, Mixin, MixinProps, NavigationPropertyProps, RelationshipClass,\r\n SchemaItemKey, SchemaItemType, SchemaKey, StrengthDirection,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableMixin } from \"./Mutable/MutableMixin\";\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 Mixin.\r\n */\r\nexport class Mixins extends ECClasses {\r\n protected override get itemTypeClass(): typeof Mixin {\r\n return Mixin;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.Mixin, 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.Mixin, this.schemaEditor);\r\n\r\n public async create(schemaKey: SchemaKey, name: string, appliesTo: SchemaItemKey, displayLabel?: string, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createClass<Mixin>(schemaKey, this.schemaItemType, (schema) => schema.createMixinClass.bind(schema), name, baseClassKey) as MutableMixin;\r\n const newAppliesTo = await this.getSchemaItem(appliesTo, EntityClass);\r\n newClass.setAppliesTo(new DelayedPromiseWithProps<SchemaItemKey, EntityClass>(newAppliesTo.key, async () => newAppliesTo));\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 a MixinClass through a MixinProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param mixinProps a json object that will be used to populate the new MixinClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, mixinProps: MixinProps): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createMixinClass.bind(schema), mixinProps);\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, mixinProps.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, EntityClass);\r\n const mixin = await this.getSchemaItem(mixinKey, Mixin);\r\n (entity as MutableEntityClass).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(mixinKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<void> {\r\n try {\r\n const mixin = await this.getSchemaItem(mixinKey, MutableMixin);\r\n await mixin.createNavigationProperty(name, relationship, direction);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateNavigationProperty, new ClassId(SchemaItemType.Mixin, mixinKey), 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 Mixin 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 mixin = await this.getSchemaItem(classKey, MutableMixin);\r\n const property = await mixin.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.RelationshipClass, classKey), e);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Mixins.js","sourceRoot":"","sources":["../../../src/Editing/Mixins.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAGkC;AAElC,2CAAwC;AACxC,yDAAsD;A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AI,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QACtE,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,wBAAwB,EAAE,IAAI,mBAAO,CAAC,kCAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QACzH,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,iCAAiC,CAAC,QAAuB,EAAE,eAAwC;QAC9G,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,2BAAY,CAAC,CAAC;YAC/D,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,wBAAwB,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,gBAAgB,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;YACzI,MAAM,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,iCAAiC,EAAE,IAAI,mBAAO,CAAC,kCAAc,CAAC,iBAAiB,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9I,CAAC;IACH,CAAC;CACF;AA5ED,wBA4EC","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 DelayedPromiseWithProps, EntityClass, Mixin, MixinProps, NavigationPropertyProps, RelationshipClass,\r\n SchemaItemKey, SchemaItemType, SchemaKey, StrengthDirection,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableMixin } from \"./Mutable/MutableMixin\";\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 Mixin.\r\n */\r\nexport class Mixins extends ECClasses {\r\n protected override get itemTypeClass(): typeof Mixin {\r\n return Mixin;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.Mixin, 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.Mixin, this.schemaEditor);\r\n\r\n public async create(schemaKey: SchemaKey, name: string, appliesTo: SchemaItemKey, displayLabel?: string, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createClass<Mixin>(schemaKey, this.schemaItemType, (schema) => schema.createMixinClass.bind(schema), name, baseClassKey) as MutableMixin;\r\n const newAppliesTo = await this.getSchemaItem(appliesTo, EntityClass);\r\n newClass.setAppliesTo(new DelayedPromiseWithProps<SchemaItemKey, EntityClass>(newAppliesTo.key, async () => newAppliesTo));\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 a MixinClass through a MixinProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param mixinProps a json object that will be used to populate the new MixinClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, mixinProps: MixinProps): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createMixinClass.bind(schema), mixinProps);\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, mixinProps.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, EntityClass);\r\n const mixin = await this.getSchemaItem(mixinKey, Mixin);\r\n (entity as MutableEntityClass).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(mixinKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<void> {\r\n try {\r\n const mixin = await this.getSchemaItem(mixinKey, MutableMixin);\r\n await mixin.createNavigationProperty(name, relationship, direction);\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateNavigationProperty, new ClassId(SchemaItemType.Mixin, mixinKey), 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 Mixin 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 mixin = await this.getSchemaItem(classKey, MutableMixin);\r\n const property = await mixin.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.RelationshipClass, classKey), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -40,7 +40,7 @@ class Phenomena extends SchemaItems_1.SchemaItems {
40
40
  return newPhenomenon.key;
41
41
  }
42
42
  catch (e) {
43
- throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.SchemaItemId(this.schemaItemType, phenomenonProps.name, schemaKey), e);
43
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.SchemaItemId(this.schemaItemType, phenomenonProps.name ?? "Unknown", schemaKey), e);
44
44
  }
45
45
  }
46
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Phenomena.js","sourceRoot":"","sources":["../../../src/Editing/Phenomena.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAiH;AAGjH,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,SAAU,SAAQ,yBAAW;IACxC,IAAuB,aAAa;QAClC,OAAO,8BAAU,CAAC;IACpB,CAAC;IAED,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,UAAkB,EAAE,YAAqB;QAC/F,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAa,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAsB,CAAC;YAE3K,IAAI,YAAY;gBACd,aAAa,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YAE9C,MAAM,aAAa,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAE9C,OAAO,aAAa,CAAC,GAAG,CAAC;QAC3B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,sBAAsB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAClI,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,eAAgC;QACjF,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC,CAAC;YAC9J,OAAO,aAAa,CAAC,GAAG,CAAC;QAC3B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACtJ,CAAC;IACH,CAAC;CACF;AAhCD,8BAgCC","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 { Phenomenon, PhenomenonProps, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutablePhenomenon } from \"./Mutable/MutablePhenomenon\";\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 Phenomenon.\r\n */\r\nexport class Phenomena extends SchemaItems {\r\n protected override get itemTypeClass(): typeof Phenomenon {\r\n return Phenomenon;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.Phenomenon, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, definition: string, displayLabel?: string): Promise<SchemaItemKey> {\r\n try {\r\n const newPhenomenon = await this.createSchemaItem<Phenomenon>(schemaKey, this.schemaItemType, (schema) => schema.createPhenomenon.bind(schema), name) as MutablePhenomenon;\r\n\r\n if (displayLabel)\r\n newPhenomenon.setDisplayLabel(displayLabel);\r\n\r\n await newPhenomenon.setDefinition(definition);\r\n\r\n return newPhenomenon.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 public async createFromProps(schemaKey: SchemaKey, phenomenonProps: PhenomenonProps): Promise<SchemaItemKey> {\r\n try {\r\n const newPhenomenon = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createPhenomenon.bind(schema), phenomenonProps);\r\n return newPhenomenon.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, phenomenonProps.name!, schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Phenomena.js","sourceRoot":"","sources":["../../../src/Editing/Phenomena.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAiH;AAGjH,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,SAAU,SAAQ,yBAAW;IACxC,IAAuB,aAAa;QAClC,OAAO,8BAAU,CAAC;IACpB,CAAC;IAED,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,UAAkB,EAAE,YAAqB;QAC/F,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAa,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAsB,CAAC;YAE3K,IAAI,YAAY;gBACd,aAAa,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YAE9C,MAAM,aAAa,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAE9C,OAAO,aAAa,CAAC,GAAG,CAAC;QAC3B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,sBAAsB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAClI,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,eAAgC;QACjF,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC,CAAC;YAC9J,OAAO,aAAa,CAAC,GAAG,CAAC;QAC3B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,IAAI,IAAI,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAClK,CAAC;IACH,CAAC;CACF;AAhCD,8BAgCC","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 { Phenomenon, PhenomenonProps, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutablePhenomenon } from \"./Mutable/MutablePhenomenon\";\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 Phenomenon.\r\n */\r\nexport class Phenomena extends SchemaItems {\r\n protected override get itemTypeClass(): typeof Phenomenon {\r\n return Phenomenon;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.Phenomenon, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, definition: string, displayLabel?: string): Promise<SchemaItemKey> {\r\n try {\r\n const newPhenomenon = await this.createSchemaItem<Phenomenon>(schemaKey, this.schemaItemType, (schema) => schema.createPhenomenon.bind(schema), name) as MutablePhenomenon;\r\n\r\n if (displayLabel)\r\n newPhenomenon.setDisplayLabel(displayLabel);\r\n\r\n await newPhenomenon.setDefinition(definition);\r\n\r\n return newPhenomenon.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 public async createFromProps(schemaKey: SchemaKey, phenomenonProps: PhenomenonProps): Promise<SchemaItemKey> {\r\n try {\r\n const newPhenomenon = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createPhenomenon.bind(schema), phenomenonProps);\r\n return newPhenomenon.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, phenomenonProps.name ?? \"Unknown\", schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -41,7 +41,7 @@ class PropertyCategories extends SchemaItems_1.SchemaItems {
41
41
  return newPropCategory.key;
42
42
  }
43
43
  catch (e) {
44
- throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.SchemaItemId(this.schemaItemType, propertyCategoryProps.name, schemaKey), e);
44
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.SchemaItemId(this.schemaItemType, propertyCategoryProps.name ?? "Unknown", schemaKey), e);
45
45
  }
46
46
  }
47
47
  async setPriority(propCategoryKey, priority) {
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyCategories.js","sourceRoot":"","sources":["../../../src/Editing/PropertyCategories.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA6H;AAE7H,+EAA4E;AAC5E,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,yBAAW;IACjD,IAAuB,aAAa;QAClC,OAAO,oCAAgB,CAAC;IAC1B,CAAC;IAED,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,QAAgB,EAAE,YAAqB;QAC7F,IAAI,CAAC;YACH,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAmB,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAA4B,CAAC;YAC/L,eAAe,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YACtC,IAAI,YAAY;gBACd,eAAe,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YAEhD,OAAO,eAAe,CAAC,GAAG,CAAC;QAC7B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,sBAAsB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAClI,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,qBAA4C;QAC7F,IAAI,CAAC;YACH,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,qBAAqB,CAAC,CAAC;YAC5K,OAAO,eAAe,CAAC,GAAG,CAAC;QAC7B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,qBAAqB,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5J,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,eAA8B,EAAE,QAAgB;QACvE,IAAI,CAAC;YACH,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,iDAAuB,CAAC,CAAC;YAC5F,gBAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,2BAA2B,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;QACvI,CAAC;IACH,CAAC;CACF;AAvCD,gDAuCC","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 { PropertyCategory, PropertyCategoryProps, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutablePropertyCategory } from \"./Mutable/MutablePropertyCategory\";\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 Property Category.\r\n */\r\nexport class PropertyCategories extends SchemaItems {\r\n protected override get itemTypeClass(): typeof PropertyCategory {\r\n return PropertyCategory;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.PropertyCategory, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, priority: number, displayLabel?: string): Promise<SchemaItemKey> {\r\n try {\r\n const newPropCategory = await this.createSchemaItem<PropertyCategory>(schemaKey, this.schemaItemType, (schema) => schema.createPropertyCategory.bind(schema), name) as MutablePropertyCategory;\r\n newPropCategory.setPriority(priority);\r\n if (displayLabel)\r\n newPropCategory.setDisplayLabel(displayLabel);\r\n\r\n return newPropCategory.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 public async createFromProps(schemaKey: SchemaKey, propertyCategoryProps: PropertyCategoryProps): Promise<SchemaItemKey> {\r\n try {\r\n const newPropCategory = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createPropertyCategory.bind(schema), propertyCategoryProps);\r\n return newPropCategory.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, propertyCategoryProps.name!, schemaKey), e);\r\n }\r\n }\r\n\r\n public async setPriority(propCategoryKey: SchemaItemKey, priority: number): Promise<void> {\r\n try {\r\n const propertyCategory = await this.getSchemaItem(propCategoryKey, MutablePropertyCategory);\r\n propertyCategory.setPriority(priority);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.SetPropertyCategoryPriority, new SchemaItemId(this.schemaItemType, propCategoryKey), e);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"PropertyCategories.js","sourceRoot":"","sources":["../../../src/Editing/PropertyCategories.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA6H;AAE7H,+EAA4E;AAC5E,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,yBAAW;IACjD,IAAuB,aAAa;QAClC,OAAO,oCAAgB,CAAC;IAC1B,CAAC;IAED,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,QAAgB,EAAE,YAAqB;QAC7F,IAAI,CAAC;YACH,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAmB,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAA4B,CAAC;YAC/L,eAAe,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YACtC,IAAI,YAAY;gBACd,eAAe,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YAEhD,OAAO,eAAe,CAAC,GAAG,CAAC;QAC7B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,sBAAsB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAClI,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,qBAA4C;QAC7F,IAAI,CAAC;YACH,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,qBAAqB,CAAC,CAAC;YAC5K,OAAO,eAAe,CAAC,GAAG,CAAC;QAC7B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,qBAAqB,CAAC,IAAI,IAAI,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACxK,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,eAA8B,EAAE,QAAgB;QACvE,IAAI,CAAC;YACH,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,iDAAuB,CAAC,CAAC;YAC5F,gBAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,2BAA2B,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;QACvI,CAAC;IACH,CAAC;CACF;AAvCD,gDAuCC","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 { PropertyCategory, PropertyCategoryProps, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutablePropertyCategory } from \"./Mutable/MutablePropertyCategory\";\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 Property Category.\r\n */\r\nexport class PropertyCategories extends SchemaItems {\r\n protected override get itemTypeClass(): typeof PropertyCategory {\r\n return PropertyCategory;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.PropertyCategory, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, priority: number, displayLabel?: string): Promise<SchemaItemKey> {\r\n try {\r\n const newPropCategory = await this.createSchemaItem<PropertyCategory>(schemaKey, this.schemaItemType, (schema) => schema.createPropertyCategory.bind(schema), name) as MutablePropertyCategory;\r\n newPropCategory.setPriority(priority);\r\n if (displayLabel)\r\n newPropCategory.setDisplayLabel(displayLabel);\r\n\r\n return newPropCategory.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 public async createFromProps(schemaKey: SchemaKey, propertyCategoryProps: PropertyCategoryProps): Promise<SchemaItemKey> {\r\n try {\r\n const newPropCategory = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createPropertyCategory.bind(schema), propertyCategoryProps);\r\n return newPropCategory.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, propertyCategoryProps.name ?? \"Unknown\", schemaKey), e);\r\n }\r\n }\r\n\r\n public async setPriority(propCategoryKey: SchemaItemKey, priority: number): Promise<void> {\r\n try {\r\n const propertyCategory = await this.getSchemaItem(propCategoryKey, MutablePropertyCategory);\r\n propertyCategory.setPriority(priority);\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.SetPropertyCategoryPriority, new SchemaItemId(this.schemaItemType, propCategoryKey), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipClasses.d.ts","sourceRoot":"","sources":["../../../src/Editing/RelationshipClasses.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,eAAe,EAAoC,eAAe,EAAE,WAAW,EAAyC,KAAK,EAAE,uBAAuB,EACtJ,iBAAiB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,eAAe,EAAE,wBAAwB,EAAE,aAAa,EAC3H,SAAS,EAAE,iBAAiB,EAAE,YAAY,EAC3C,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAIpD;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,SAAS;IAChD,cAAuB,aAAa,IAAI,OAAO,iBAAiB,CAE/D;gBAEkB,YAAY,EAAE,mBAAmB;IAIpD;;OAEG;IACH,SAAgB,oBAAoB,uBAAoE;IAExG;;;;;;;;OAQG;IACU,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,YAAY,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAa9L;;;;OAIG;IACU,mBAAmB,CAAC,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAS/G;;;;OAIG;IACU,mBAAmB,CAAC,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAA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@ -86,7 +86,7 @@ class RelationshipClasses extends ECClasses_1.ECClasses {
86
86
  return newClass.key;
87
87
  }
88
88
  catch (e) {
89
- throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.ClassId(this.schemaItemType, relationshipProps.name, schemaKey), e);
89
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.ClassId(this.schemaItemType, relationshipProps.name ?? "Unknown", schemaKey), e);
90
90
  }
91
91
  }
92
92
  /**
@@ -101,6 +101,8 @@ class RelationshipClasses extends ECClasses_1.ECClasses {
101
101
  });
102
102
  const baseClass = relClass?.baseClass;
103
103
  await super.setBaseClass(itemKey, baseClassKey);
104
+ if (!relClass)
105
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SetBaseClass, new Exception_1.ClassId(ecschema_metadata_1.SchemaItemType.RelationshipClass, itemKey));
104
106
  try {
105
107
  await this.validate(relClass);
106
108
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipClasses.js","sourceRoot":"","sources":["../../../src/Editing/RelationshipClasses.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAIkC;AAElC,2CAAwC;AACxC,iFAA6G;AAC7G,+CAA+C;AAE/C,6CAAoD;AACpD,2CAAwH;AAGxH;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,qBAAS;IAChD,IAAuB,aAAa;QAClC,OAAO,qCAAiB,CAAC;IAC3B,CAAC;IAED,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACa,oBAAoB,GAAG,IAAI,iCAAoB,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAExG;;;;;;;;OAQG;IACI,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,QAAyB,E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,IAAI,8BAAkB,CAAC,2BAAe,CAAC,aAAa,EAAE,IAAI,mBAAO,CAAC,kCAAc,CAAC,iBAAiB,EAAE,eAAe,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;YACtJ,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,aAAa,EAAE,IAAI,oCAAwB,CAAC,wBAAwB,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;YAC9I,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAlPD,kDAkPC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Editing\r\n */\r\n\r\nimport {\r\n CustomAttribute, DelayedPromiseWithProps, ECClass, ECClassModifier, EntityClass, LazyLoadedRelationshipConstraintClass, Mixin, NavigationPropertyProps,\r\n RelationshipClass, RelationshipClassProps, RelationshipConstraint, RelationshipEnd, RelationshipMultiplicity, SchemaItemKey, SchemaItemType,\r\n SchemaKey, StrengthDirection, StrengthType,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableRelationshipClass, MutableRelationshipConstraint } from \"./Mutable/MutableRelationshipClass\";\r\nimport * as Rules from \"../Validation/ECRules\";\r\nimport { AnyDiagnostic, RelationshipConstraintDiagnostic, SchemaItemDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { NavigationProperties } from \"./Properties\";\r\nimport { ClassId, CustomAttributeId, ECEditingStatus, RelationshipConstraintId, SchemaEditingError } from \"./Exception\";\r\nimport { MutableClass } from \"./Mutable/MutableClass\";\r\n\r\n/**\r\n * @alpha\r\n * A class extending ECClasses allowing you to create schema items of type RelationshipClass.\r\n */\r\nexport class RelationshipClasses extends ECClasses {\r\n protected override get itemTypeClass(): typeof RelationshipClass {\r\n return RelationshipClass;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.RelationshipClass, 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(this.schemaItemType, this.schemaEditor);\r\n\r\n /**\r\n * Creates a RelationshipClass.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param name The name of the new class.\r\n * @param modifier The ECClassModifier of the new class.\r\n * @param strength The relationship StrengthType of the class.\r\n * @param StrengthDirection The relationship StrengthDirection of the class.\r\n * @param baseClassKey An optional SchemaItemKey that specifies the base relationship class.\r\n */\r\n public async create(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, strength: StrengthType, direction: StrengthDirection, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createClass<RelationshipClass>(schemaKey, this.schemaItemType, (schema) => schema.createRelationshipClass.bind(schema), name, baseClassKey, modifier) as MutableRelationshipClass;\r\n\r\n newClass.setStrength(strength);\r\n newClass.setStrengthDirection(direction);\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 * Sets the source RelationshipConstraint on the relationship.\r\n * @param relationshipKey The SchemaItemKey for the relationship.\r\n * @param source The RelationshipConstraint to add.\r\n */\r\n public async setSourceConstraint(relationshipKey: SchemaItemKey, source: RelationshipConstraint): Promise<void> {\r\n const relationship = await this.getSchemaItem(relationshipKey, MutableRelationshipClass)\r\n .catch((e) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetSourceConstraint, new ClassId(this.schemaItemType, relationshipKey), e);\r\n });\r\n\r\n relationship.setSourceConstraint(source);\r\n }\r\n\r\n /**\r\n * Sets the target RelationshipConstraint on the relationship.\r\n * @param relationshipKey The SchemaItemKey for the relationship.\r\n * @param target The RelationshipConstraint to add.\r\n */\r\n public async setTargetConstraint(relationshipKey: SchemaItemKey, target: RelationshipConstraint): Promise<void> {\r\n const relationship = await this.getSchemaItem(relationshipKey, MutableRelationshipClass)\r\n .catch((e) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetTargetConstraint, new ClassId(this.schemaItemType, relationshipKey), e);\r\n });\r\n\r\n relationship.setTargetConstraint(target);\r\n }\r\n\r\n /**\r\n * Creates a RelationshipClass through a RelationshipClassProps.\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, relationshipProps: RelationshipClassProps): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createRelationshipClass.bind(schema), relationshipProps);\r\n\r\n await newClass.source.fromJSON(relationshipProps.source);\r\n await newClass.target.fromJSON(relationshipProps.target);\r\n\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, relationshipProps.name!, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Sets the base class of a RelationshipClass.\r\n * @param relationshipKey The SchemaItemKey of the RelationshipClass.\r\n * @param baseClassKey The SchemaItemKey of the base class. Specifying 'undefined' removes the base class.\r\n */\r\n public override async setBaseClass(itemKey: SchemaItemKey, baseClassKey?: SchemaItemKey): Promise<void> {\r\n const relClass = await this.schemaEditor.schemaContext.getSchemaItem(itemKey, RelationshipClass)\r\n .catch((e) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetBaseClass, new ClassId(this.schemaItemType, itemKey), e);\r\n });\r\n const baseClass = relClass?.baseClass;\r\n\r\n await super.setBaseClass(itemKey, baseClassKey);\r\n\r\n try {\r\n await this.validate(relClass!);\r\n } catch(e: any) {\r\n await (relClass! as ECClass as MutableClass).setBaseClass(baseClass);\r\n throw new SchemaEditingError(ECEditingStatus.SetBaseClass, new ClassId(SchemaItemType.RelationshipClass, itemKey), e);\r\n }\r\n }\r\n\r\n public async createNavigationProperty(relationshipKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<void> {\r\n try {\r\n const relationshipClass = await this.getSchemaItem(relationshipKey, MutableRelationshipClass);\r\n await relationshipClass.createNavigationProperty(name, relationship, direction);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateNavigationProperty, new ClassId(SchemaItemType.RelationshipClass, relationshipKey), 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 Relationship 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(relationshipKey: SchemaItemKey, navigationProps: NavigationPropertyProps): Promise<void> {\r\n try {\r\n const relationshipClass = await this.getSchemaItem(relationshipKey, MutableRelationshipClass);\r\n const property = await relationshipClass.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.RelationshipClass, relationshipKey), e);\r\n }\r\n }\r\n\r\n public async setConstraintMultiplicity(constraint: RelationshipConstraint, multiplicity: RelationshipMultiplicity): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.setMultiplicity(multiplicity);\r\n }\r\n\r\n public async setConstraintPolymorphic(constraint: RelationshipConstraint, polymorphic: boolean): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.setPolymorphic(polymorphic);\r\n }\r\n\r\n public async setConstraintRelationshipEnd(constraint: RelationshipConstraint, relationshipEnd: RelationshipEnd): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.setRelationshipEnd(relationshipEnd);\r\n }\r\n\r\n public async setAbstractConstraint(constraint: RelationshipConstraint, abstractConstraint?: EntityClass | Mixin | RelationshipClass): Promise<void> {\r\n const existing: LazyLoadedRelationshipConstraintClass | undefined = constraint.abstractConstraint;\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n\r\n if (undefined === abstractConstraint) {\r\n mutableConstraint.setAbstractConstraint(undefined);\r\n } else {\r\n mutableConstraint.setAbstractConstraint(new DelayedPromiseWithProps(abstractConstraint.key, async () => abstractConstraint));\r\n }\r\n\r\n try {\r\n await this.validate(constraint.relationshipClass);\r\n } catch(e: any){\r\n mutableConstraint.setAbstractConstraint(existing);\r\n throw new SchemaEditingError(ECEditingStatus.SetAbstractConstraint, new RelationshipConstraintId(constraint), e);\r\n }\r\n\r\n try {\r\n await this.validate(constraint);\r\n } catch(e: any){\r\n mutableConstraint.setAbstractConstraint(existing);\r\n throw new SchemaEditingError(ECEditingStatus.SetAbstractConstraint, new RelationshipConstraintId(constraint), e);\r\n }\r\n }\r\n\r\n public async addConstraintClass(constraint: RelationshipConstraint, ecClass: EntityClass | Mixin | RelationshipClass): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.addClass(new DelayedPromiseWithProps(ecClass.key, async () => ecClass));\r\n\r\n try {\r\n await this.validate(constraint.relationshipClass);\r\n } catch(e: any){\r\n mutableConstraint.removeClass(new DelayedPromiseWithProps(ecClass.key, async () => ecClass));\r\n throw new SchemaEditingError(ECEditingStatus.AddConstraintClass, new RelationshipConstraintId(constraint), e);\r\n }\r\n\r\n try {\r\n await this.validate(constraint);\r\n } catch(e: any){\r\n mutableConstraint.removeClass(new DelayedPromiseWithProps(ecClass.key, async () => ecClass));\r\n throw new SchemaEditingError(ECEditingStatus.AddConstraintClass, new RelationshipConstraintId(constraint), e);\r\n }\r\n }\r\n\r\n public async removeConstraintClass(constraint: RelationshipConstraint, ecClass: EntityClass | Mixin | RelationshipClass): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.removeClass(new DelayedPromiseWithProps(ecClass.key, async () => ecClass));\r\n\r\n try{\r\n await this.validate(constraint);\r\n } catch(e: any) {\r\n mutableConstraint.addClass(new DelayedPromiseWithProps(ecClass.key, async () => ecClass));\r\n throw new SchemaEditingError(ECEditingStatus.RemoveConstraintClass, new RelationshipConstraintId(constraint), e);\r\n }\r\n }\r\n\r\n public async addCustomAttributeToConstraint(constraint: RelationshipConstraint, customAttribute: CustomAttribute): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.addCustomAttribute(customAttribute);\r\n\r\n const diagnosticIterable = Rules.validateCustomAttributeInstance(constraint, customAttribute);\r\n\r\n const diagnostics: AnyDiagnostic[] = [];\r\n for await (const diagnostic of diagnosticIterable) {\r\n diagnostics.push(diagnostic);\r\n }\r\n\r\n if (diagnostics.length > 0) {\r\n this.removeCustomAttribute(constraint, customAttribute);\r\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToConstraint, new RelationshipConstraintId(constraint),\r\n new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, constraint), undefined, diagnostics));\r\n }\r\n }\r\n\r\n private async validate(relationshipOrConstraint: RelationshipClass | RelationshipConstraint): Promise<void> {\r\n let diagnosticIterable: AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> | AsyncIterable<RelationshipConstraintDiagnostic<any[]>>;\r\n let relationshipKey: SchemaItemKey | string;\r\n\r\n if (relationshipOrConstraint instanceof RelationshipClass) {\r\n diagnosticIterable = Rules.validateRelationship(relationshipOrConstraint);\r\n relationshipKey = relationshipOrConstraint.key;\r\n } else {\r\n diagnosticIterable = Rules.validateRelationshipConstraint(relationshipOrConstraint);\r\n relationshipKey = relationshipOrConstraint.relationshipClass.key;\r\n }\r\n\r\n const diagnostics: AnyDiagnostic[] = [];\r\n for await (const diagnostic of diagnosticIterable) {\r\n diagnostics.push(diagnostic);\r\n }\r\n\r\n if (diagnostics.length > 0) {\r\n if (relationshipOrConstraint instanceof RelationshipClass) {\r\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new ClassId(SchemaItemType.RelationshipClass, relationshipKey), undefined, diagnostics);\r\n } else {\r\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new RelationshipConstraintId(relationshipOrConstraint), undefined, diagnostics);\r\n }\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"RelationshipClasses.js","sourceRoot":"","sources":["../../../src/Editing/RelationshipClasses.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAIkC;AAElC,2CAAwC;AACxC,iFAA6G;AAC7G,+CAA+C;AAE/C,6CAAoD;AACpD,2CAAwH;AAGxH;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,qBAAS;IAChD,IAAuB,aAAa;QAClC,OAAO,qCAAiB,CAAC;IAC3B,CAAC;IAED,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACa,oBAAoB,GAAG,IAAI,iCAAoB,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAExG;;;;;;;;OAQG;IACI,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,QAAyB,EAAE,QAAsB,EAAE,SAA4B,EAAE,YAA4B;QACnK,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAoB,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,CAA6B,CAAC;YAE9M,QAAQ,CA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AE,WAAW,CAAC,CAAC;YACtJ,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,aAAa,EAAE,IAAI,oCAAwB,CAAC,wBAAwB,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;YAC9I,CAAC;QACH,CAAC;IACH,CAAC;CACF;AArPD,kDAqPC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Editing\r\n */\r\n\r\nimport {\r\n CustomAttribute, DelayedPromiseWithProps, ECClass, ECClassModifier, EntityClass, LazyLoadedRelationshipConstraintClass, Mixin, NavigationPropertyProps,\r\n RelationshipClass, RelationshipClassProps, RelationshipConstraint, RelationshipEnd, RelationshipMultiplicity, SchemaItemKey, SchemaItemType,\r\n SchemaKey, StrengthDirection, StrengthType,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableRelationshipClass, MutableRelationshipConstraint } from \"./Mutable/MutableRelationshipClass\";\r\nimport * as Rules from \"../Validation/ECRules\";\r\nimport { AnyDiagnostic, RelationshipConstraintDiagnostic, SchemaItemDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { NavigationProperties } from \"./Properties\";\r\nimport { ClassId, CustomAttributeId, ECEditingStatus, RelationshipConstraintId, SchemaEditingError } from \"./Exception\";\r\nimport { MutableClass } from \"./Mutable/MutableClass\";\r\n\r\n/**\r\n * @alpha\r\n * A class extending ECClasses allowing you to create schema items of type RelationshipClass.\r\n */\r\nexport class RelationshipClasses extends ECClasses {\r\n protected override get itemTypeClass(): typeof RelationshipClass {\r\n return RelationshipClass;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.RelationshipClass, 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(this.schemaItemType, this.schemaEditor);\r\n\r\n /**\r\n * Creates a RelationshipClass.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param name The name of the new class.\r\n * @param modifier The ECClassModifier of the new class.\r\n * @param strength The relationship StrengthType of the class.\r\n * @param StrengthDirection The relationship StrengthDirection of the class.\r\n * @param baseClassKey An optional SchemaItemKey that specifies the base relationship class.\r\n */\r\n public async create(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, strength: StrengthType, direction: StrengthDirection, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createClass<RelationshipClass>(schemaKey, this.schemaItemType, (schema) => schema.createRelationshipClass.bind(schema), name, baseClassKey, modifier) as MutableRelationshipClass;\r\n\r\n newClass.setStrength(strength);\r\n newClass.setStrengthDirection(direction);\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 * Sets the source RelationshipConstraint on the relationship.\r\n * @param relationshipKey The SchemaItemKey for the relationship.\r\n * @param source The RelationshipConstraint to add.\r\n */\r\n public async setSourceConstraint(relationshipKey: SchemaItemKey, source: RelationshipConstraint): Promise<void> {\r\n const relationship = await this.getSchemaItem(relationshipKey, MutableRelationshipClass)\r\n .catch((e) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetSourceConstraint, new ClassId(this.schemaItemType, relationshipKey), e);\r\n });\r\n\r\n relationship.setSourceConstraint(source);\r\n }\r\n\r\n /**\r\n * Sets the target RelationshipConstraint on the relationship.\r\n * @param relationshipKey The SchemaItemKey for the relationship.\r\n * @param target The RelationshipConstraint to add.\r\n */\r\n public async setTargetConstraint(relationshipKey: SchemaItemKey, target: RelationshipConstraint): Promise<void> {\r\n const relationship = await this.getSchemaItem(relationshipKey, MutableRelationshipClass)\r\n .catch((e) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetTargetConstraint, new ClassId(this.schemaItemType, relationshipKey), e);\r\n });\r\n\r\n relationship.setTargetConstraint(target);\r\n }\r\n\r\n /**\r\n * Creates a RelationshipClass through a RelationshipClassProps.\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, relationshipProps: RelationshipClassProps): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createRelationshipClass.bind(schema), relationshipProps);\r\n\r\n await newClass.source.fromJSON(relationshipProps.source);\r\n await newClass.target.fromJSON(relationshipProps.target);\r\n\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, relationshipProps.name ?? \"Unknown\", schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Sets the base class of a RelationshipClass.\r\n * @param relationshipKey The SchemaItemKey of the RelationshipClass.\r\n * @param baseClassKey The SchemaItemKey of the base class. Specifying 'undefined' removes the base class.\r\n */\r\n public override async setBaseClass(itemKey: SchemaItemKey, baseClassKey?: SchemaItemKey): Promise<void> {\r\n const relClass = await this.schemaEditor.schemaContext.getSchemaItem(itemKey, RelationshipClass)\r\n .catch((e) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetBaseClass, new ClassId(this.schemaItemType, itemKey), e);\r\n });\r\n const baseClass = relClass?.baseClass;\r\n\r\n await super.setBaseClass(itemKey, baseClassKey);\r\n\r\n if (!relClass)\r\n throw new SchemaEditingError(ECEditingStatus.SetBaseClass, new ClassId(SchemaItemType.RelationshipClass, itemKey));\r\n\r\n try {\r\n await this.validate(relClass);\r\n } catch (e: any) {\r\n await (relClass as ECClass as MutableClass).setBaseClass(baseClass);\r\n throw new SchemaEditingError(ECEditingStatus.SetBaseClass, new ClassId(SchemaItemType.RelationshipClass, itemKey), e);\r\n }\r\n }\r\n\r\n public async createNavigationProperty(relationshipKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<void> {\r\n try {\r\n const relationshipClass = await this.getSchemaItem(relationshipKey, MutableRelationshipClass);\r\n await relationshipClass.createNavigationProperty(name, relationship, direction);\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateNavigationProperty, new ClassId(SchemaItemType.RelationshipClass, relationshipKey), 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 Relationship 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(relationshipKey: SchemaItemKey, navigationProps: NavigationPropertyProps): Promise<void> {\r\n try {\r\n const relationshipClass = await this.getSchemaItem(relationshipKey, MutableRelationshipClass);\r\n const property = await relationshipClass.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.RelationshipClass, relationshipKey), e);\r\n }\r\n }\r\n\r\n public async setConstraintMultiplicity(constraint: RelationshipConstraint, multiplicity: RelationshipMultiplicity): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.setMultiplicity(multiplicity);\r\n }\r\n\r\n public async setConstraintPolymorphic(constraint: RelationshipConstraint, polymorphic: boolean): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.setPolymorphic(polymorphic);\r\n }\r\n\r\n public async setConstraintRelationshipEnd(constraint: RelationshipConstraint, relationshipEnd: RelationshipEnd): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.setRelationshipEnd(relationshipEnd);\r\n }\r\n\r\n public async setAbstractConstraint(constraint: RelationshipConstraint, abstractConstraint?: EntityClass | Mixin | RelationshipClass): Promise<void> {\r\n const existing: LazyLoadedRelationshipConstraintClass | undefined = constraint.abstractConstraint;\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n\r\n if (undefined === abstractConstraint) {\r\n mutableConstraint.setAbstractConstraint(undefined);\r\n } else {\r\n mutableConstraint.setAbstractConstraint(new DelayedPromiseWithProps(abstractConstraint.key, async () => abstractConstraint));\r\n }\r\n\r\n try {\r\n await this.validate(constraint.relationshipClass);\r\n } catch (e: any) {\r\n mutableConstraint.setAbstractConstraint(existing);\r\n throw new SchemaEditingError(ECEditingStatus.SetAbstractConstraint, new RelationshipConstraintId(constraint), e);\r\n }\r\n\r\n try {\r\n await this.validate(constraint);\r\n } catch (e: any) {\r\n mutableConstraint.setAbstractConstraint(existing);\r\n throw new SchemaEditingError(ECEditingStatus.SetAbstractConstraint, new RelationshipConstraintId(constraint), e);\r\n }\r\n }\r\n\r\n public async addConstraintClass(constraint: RelationshipConstraint, ecClass: EntityClass | Mixin | RelationshipClass): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.addClass(new DelayedPromiseWithProps(ecClass.key, async () => ecClass));\r\n\r\n try {\r\n await this.validate(constraint.relationshipClass);\r\n } catch (e: any) {\r\n mutableConstraint.removeClass(new DelayedPromiseWithProps(ecClass.key, async () => ecClass));\r\n throw new SchemaEditingError(ECEditingStatus.AddConstraintClass, new RelationshipConstraintId(constraint), e);\r\n }\r\n\r\n try {\r\n await this.validate(constraint);\r\n } catch (e: any) {\r\n mutableConstraint.removeClass(new DelayedPromiseWithProps(ecClass.key, async () => ecClass));\r\n throw new SchemaEditingError(ECEditingStatus.AddConstraintClass, new RelationshipConstraintId(constraint), e);\r\n }\r\n }\r\n\r\n public async removeConstraintClass(constraint: RelationshipConstraint, ecClass: EntityClass | Mixin | RelationshipClass): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.removeClass(new DelayedPromiseWithProps(ecClass.key, async () => ecClass));\r\n\r\n try {\r\n await this.validate(constraint);\r\n } catch (e: any) {\r\n mutableConstraint.addClass(new DelayedPromiseWithProps(ecClass.key, async () => ecClass));\r\n throw new SchemaEditingError(ECEditingStatus.RemoveConstraintClass, new RelationshipConstraintId(constraint), e);\r\n }\r\n }\r\n\r\n public async addCustomAttributeToConstraint(constraint: RelationshipConstraint, customAttribute: CustomAttribute): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.addCustomAttribute(customAttribute);\r\n\r\n const diagnosticIterable = Rules.validateCustomAttributeInstance(constraint, customAttribute);\r\n\r\n const diagnostics: AnyDiagnostic[] = [];\r\n for await (const diagnostic of diagnosticIterable) {\r\n diagnostics.push(diagnostic);\r\n }\r\n\r\n if (diagnostics.length > 0) {\r\n this.removeCustomAttribute(constraint, customAttribute);\r\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToConstraint, new RelationshipConstraintId(constraint),\r\n new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, constraint), undefined, diagnostics));\r\n }\r\n }\r\n\r\n private async validate(relationshipOrConstraint: RelationshipClass | RelationshipConstraint): Promise<void> {\r\n let diagnosticIterable: AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> | AsyncIterable<RelationshipConstraintDiagnostic<any[]>>;\r\n let relationshipKey: SchemaItemKey | string;\r\n\r\n if (relationshipOrConstraint instanceof RelationshipClass) {\r\n diagnosticIterable = Rules.validateRelationship(relationshipOrConstraint);\r\n relationshipKey = relationshipOrConstraint.key;\r\n } else {\r\n diagnosticIterable = Rules.validateRelationshipConstraint(relationshipOrConstraint);\r\n relationshipKey = relationshipOrConstraint.relationshipClass.key;\r\n }\r\n\r\n const diagnostics: AnyDiagnostic[] = [];\r\n for await (const diagnostic of diagnosticIterable) {\r\n diagnostics.push(diagnostic);\r\n }\r\n\r\n if (diagnostics.length > 0) {\r\n if (relationshipOrConstraint instanceof RelationshipClass) {\r\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new ClassId(SchemaItemType.RelationshipClass, relationshipKey), undefined, diagnostics);\r\n } else {\r\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new RelationshipConstraintId(relationshipOrConstraint), undefined, diagnostics);\r\n }\r\n }\r\n }\r\n}\r\n"]}