@itwin/ecschema-editing 4.6.0-dev.9 → 4.7.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -1
- package/lib/cjs/Differencing/SchemaConflicts.d.ts +14 -0
- package/lib/cjs/Differencing/SchemaConflicts.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaConflicts.js +15 -2
- package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +0 -52
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifference.d.ts +2 -2
- package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDifference.js +3 -3
- package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
- package/lib/cjs/Editing/Constants.js.map +1 -1
- package/lib/cjs/Editing/CustomAttributes.d.ts +1 -1
- package/lib/cjs/Editing/CustomAttributes.d.ts.map +1 -1
- package/lib/cjs/Editing/CustomAttributes.js +2 -2
- package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
- package/lib/cjs/Editing/ECClasses.d.ts +29 -23
- package/lib/cjs/Editing/ECClasses.d.ts.map +1 -1
- package/lib/cjs/Editing/ECClasses.js +51 -95
- package/lib/cjs/Editing/ECClasses.js.map +1 -1
- package/lib/cjs/Editing/Editor.js.map +1 -1
- package/lib/cjs/Editing/Entities.d.ts +6 -7
- package/lib/cjs/Editing/Entities.d.ts.map +1 -1
- package/lib/cjs/Editing/Entities.js +7 -27
- package/lib/cjs/Editing/Entities.js.map +1 -1
- package/lib/cjs/Editing/Formats.js.map +1 -1
- package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
- package/lib/cjs/Editing/Mixins.d.ts +6 -2
- package/lib/cjs/Editing/Mixins.d.ts.map +1 -1
- package/lib/cjs/Editing/Mixins.js +7 -22
- package/lib/cjs/Editing/Mixins.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableEntityClass.js +2 -2
- package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableNavigationProperty.d.ts +8 -0
- package/lib/cjs/Editing/Mutable/MutableNavigationProperty.d.ts.map +1 -0
- package/lib/cjs/Editing/Mutable/MutableNavigationProperty.js +16 -0
- package/lib/cjs/Editing/Mutable/MutableNavigationProperty.js.map +1 -0
- package/lib/cjs/Editing/Mutable/MutableStructProperty.d.ts +8 -0
- package/lib/cjs/Editing/Mutable/MutableStructProperty.d.ts.map +1 -0
- package/lib/cjs/Editing/Mutable/MutableStructProperty.js +16 -0
- package/lib/cjs/Editing/Mutable/MutableStructProperty.js.map +1 -0
- package/lib/cjs/Editing/Properties.d.ts +201 -0
- package/lib/cjs/Editing/Properties.d.ts.map +1 -0
- package/lib/cjs/Editing/Properties.js +349 -0
- package/lib/cjs/Editing/Properties.js.map +1 -0
- package/lib/cjs/Editing/RelationshipClasses.d.ts +12 -1
- package/lib/cjs/Editing/RelationshipClasses.d.ts.map +1 -1
- package/lib/cjs/Editing/RelationshipClasses.js +26 -3
- package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
- package/lib/cjs/Editing/Structs.d.ts +1 -1
- package/lib/cjs/Editing/Structs.d.ts.map +1 -1
- package/lib/cjs/Editing/Structs.js +2 -2
- package/lib/cjs/Editing/Structs.js.map +1 -1
- package/lib/cjs/Merging/CAClassMerger.js.map +1 -1
- package/lib/cjs/Merging/ClassMerger.js +7 -16
- package/lib/cjs/Merging/ClassMerger.js.map +1 -1
- package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
- package/lib/cjs/Merging/CustomAttributeMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/CustomAttributeMerger.js +6 -1
- package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
- package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
- package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
- package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
- package/lib/cjs/Merging/MixinMerger.js.map +1 -1
- package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
- package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -1
- package/lib/cjs/Merging/PropertyMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/PropertyMerger.js +54 -23
- package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
- package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaItemMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaMerger.d.ts +1 -1
- package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/SchemaMerger.js +12 -8
- package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
- package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -1
- package/lib/cjs/Validation/Diagnostic.d.ts +2 -2
- package/lib/cjs/Validation/Diagnostic.d.ts.map +1 -1
- package/lib/cjs/Validation/Diagnostic.js +4 -4
- package/lib/cjs/Validation/Diagnostic.js.map +1 -1
- package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
- package/lib/cjs/Validation/ECRules.d.ts +35 -35
- package/lib/cjs/Validation/ECRules.d.ts.map +1 -1
- package/lib/cjs/Validation/ECRules.js.map +1 -1
- package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
- package/lib/cjs/Validation/SchemaChanges.d.ts +38 -6
- package/lib/cjs/Validation/SchemaChanges.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaChanges.js +97 -27
- package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareVisitor.js +4 -3
- package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
- package/lib/cjs/Validation/SchemaComparer.d.ts +1 -0
- package/lib/cjs/Validation/SchemaComparer.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaComparer.js +238 -260
- package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
- package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-editing.d.ts +2 -0
- package/lib/cjs/ecschema-editing.d.ts.map +1 -1
- package/lib/cjs/ecschema-editing.js +2 -0
- package/lib/cjs/ecschema-editing.js.map +1 -1
- package/package.json +11 -11
|
@@ -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;AAIxC;;;GAGG;AACH,MAAa,MAAO,SAAQ,qBAAS;IACnC,YAAmB,aAAkC;QACnD,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,SAAwB,EAAE,YAAqB,EAAE,SAAyB;QAChI,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEzF,MAAM,QAAQ,GAAI,CAAC,MAAM,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAkB,CAAC;QACzE,IAAI,QAAQ,KAAK,SAAS;YACxB,OAAO,EAAE,YAAY,EAAE,0BAA0B,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAEnG,IAA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AQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;SACrG;QAED,MAAM,aAAa,GAAG,MAAM,eAAe,CAAC,UAAU,CAAQ,YAAY,CAAC,CAAC;QAC5E,IAAI,aAAa,KAAK,SAAS;YAC7B,OAAO,EAAE,YAAY,EAAE,+BAA+B,YAAY,CAAC,QAAQ,cAAc,eAAe,CAAC,QAAQ,GAAG,EAAE,CAAC;QAEzH,IAAI,aAAa,CAAC,cAAc,KAAK,kCAAc,CAAC,KAAK;YACvD,OAAO,EAAE,YAAY,EAAE,GAAG,aAAa,CAAC,QAAQ,8BAA8B,EAAE,CAAC;QAEnF,KAAK,CAAC,SAAS,GAAG,IAAI,2CAAuB,CAAuB,YAAY,EAAE,KAAK,IAAI,EAAE,CAAC,aAAa,CAAC,CAAC;QAC7G,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IAC/B,CAAC;CACF;AAvID,wBAuIC","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, ECObjectsError, ECObjectsStatus, EntityClass, Mixin, MixinProps, NavigationPropertyProps, RelationshipClass,\r\n SchemaItemKey, SchemaItemType, SchemaKey, StrengthDirection,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { PropertyEditResults, SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableMixin } from \"./Mutable/MutableMixin\";\r\nimport { MutableEntityClass } from \"./Mutable/MutableEntityClass\";\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 public constructor(_schemaEditor: SchemaContextEditor) {\r\n super(_schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, appliesTo: SchemaItemKey, displayLabel?: string, baseClass?: SchemaItemKey): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n const newClass = ((await schema.createMixinClass(name)) as MutableMixin);\r\n if (newClass === undefined)\r\n return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };\r\n\r\n if (baseClass !== undefined) {\r\n const baseClassItem = await schema.lookupItem<Mixin>(baseClass);\r\n if (baseClassItem === undefined)\r\n return { errorMessage: `Unable to locate base class ${baseClass.fullName} in schema ${schema.fullName}.` };\r\n\r\n if (baseClassItem.schemaItemType !== SchemaItemType.Mixin)\r\n return { errorMessage: `${baseClassItem.fullName} is not of type Mixin.` };\r\n\r\n newClass.baseClass = new DelayedPromiseWithProps<SchemaItemKey, Mixin>(baseClass, async () => baseClassItem);\r\n }\r\n\r\n const newAppliesTo = (await this._schemaEditor.schemaContext.getSchemaItem<EntityClass>(appliesTo));\r\n if (newAppliesTo === undefined || newAppliesTo.schemaItemType !== SchemaItemType.EntityClass)\r\n return { errorMessage: `Failed to locate the appliedTo entity class ${appliesTo.name}.` };\r\n\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 { itemKey: newClass.key };\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<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n if (mixinProps.name === undefined)\r\n return { errorMessage: `No name was supplied within props.` };\r\n\r\n const newClass = (await schema.createMixinClass(mixinProps.name)) as MutableMixin;\r\n if (newClass === undefined)\r\n return { errorMessage: `Failed to create class ${mixinProps.name} in schema ${schemaKey.toString(true)}.` };\r\n\r\n await newClass.fromJSON(mixinProps);\r\n return { itemKey: newClass.key };\r\n }\r\n\r\n public async addMixin(entityKey: SchemaItemKey, mixinKey: SchemaItemKey): Promise<void> {\r\n const entity = (await this._schemaEditor.schemaContext.getSchemaItem<MutableEntityClass>(entityKey));\r\n const mixin = (await this._schemaEditor.schemaContext.getSchemaItem<Mixin>(mixinKey));\r\n\r\n if (entity === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Entity Class ${entityKey.fullName} not found in schema context.`);\r\n\r\n if (mixin === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Mixin Class ${mixinKey.fullName} not found in schema context.`);\r\n\r\n if (entity.schemaItemType !== SchemaItemType.EntityClass)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${entityKey.fullName} to be of type Entity Class.`);\r\n\r\n if (mixin.schemaItemType !== SchemaItemType.Mixin)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${mixinKey.fullName} to be of type Mixin.`);\r\n\r\n entity.addMixin(mixin);\r\n }\r\n\r\n public async createNavigationProperty(mixinKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<PropertyEditResults> {\r\n const mixin = (await this._schemaEditor.schemaContext.getSchemaItem<MutableMixin>(mixinKey));\r\n\r\n if (mixin === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Mixin Class ${mixinKey.fullName} not found in schema context.`);\r\n\r\n if (mixin.schemaItemType !== SchemaItemType.Mixin)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${mixinKey.fullName} to be of type Mixin.`);\r\n\r\n await mixin.createNavigationProperty(name, relationship, direction);\r\n return { itemKey: mixinKey, propertyName: name };\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<PropertyEditResults> {\r\n const mixin = await this._schemaEditor.schemaContext.getSchemaItem<MutableMixin>(classKey);\r\n if (mixin === undefined)\r\n return { itemKey: classKey, propertyName: navigationProps.name, errorMessage: `Mixin ${classKey.fullName} not found in schema context.`};\r\n\r\n if (mixin.schemaItemType !== SchemaItemType.Mixin)\r\n return { itemKey: classKey, propertyName: navigationProps.name, errorMessage: `Expected ${classKey.fullName} to be of type Mixin.`};\r\n\r\n const navigationProperty = await mixin.createNavigationProperty(navigationProps.name, navigationProps.relationshipName, navigationProps.direction);\r\n await navigationProperty.fromJSON(navigationProps);\r\n\r\n return { itemKey: classKey, propertyName: navigationProps.name };\r\n }\r\n\r\n public async setMixinBaseClass(mixinKey: SchemaItemKey, baseClassKey?: SchemaItemKey): Promise<SchemaItemEditResults>{\r\n const mixin = (await this._schemaEditor.schemaContext.getSchemaItem<MutableMixin>(mixinKey));\r\n\r\n if (mixin === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Mixin Class ${mixinKey.fullName} not found in schema context.`);\r\n\r\n if (baseClassKey === undefined) {\r\n mixin.baseClass = undefined;\r\n return { itemKey: mixinKey };\r\n }\r\n\r\n const baseClassSchema = !baseClassKey.schemaKey.matches(mixinKey.schemaKey) ? await this._schemaEditor.getSchema(baseClassKey.schemaKey) : mixin.schema;\r\n if (baseClassSchema === undefined) {\r\n return { errorMessage: `Schema Key ${baseClassKey.schemaKey.toString(true)} not found in context` };\r\n }\r\n\r\n const baseClassItem = await baseClassSchema.lookupItem<Mixin>(baseClassKey);\r\n if (baseClassItem === undefined)\r\n return { errorMessage: `Unable to locate base class ${baseClassKey.fullName} in schema ${baseClassSchema.fullName}.` };\r\n\r\n if (baseClassItem.schemaItemType !== SchemaItemType.Mixin)\r\n return { errorMessage: `${baseClassItem.fullName} is not of type Mixin Class.` };\r\n\r\n mixin.baseClass = new DelayedPromiseWithProps<SchemaItemKey, Mixin>(baseClassKey, async () => baseClassItem);\r\n return { itemKey: mixinKey };\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;AAGxC,6CAAoD;AAEpD;;;GAGG;AACH,MAAa,MAAO,SAAQ,qBAAS;IACnC,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAG5C;;WAEG;QACa,yBAAoB,GAAG,IAAI,iCAAoB,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IALzG,CAAC;IAOM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,SAAwB,EAAE,YAAqB,EAAE,SAAyB;QAChI,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEzF,MAAM,QAAQ,GAAI,CAAC,MAAM,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAkB,CAAC;QACzE,IAAI,QAAQ,KAAK,SAAS;YACxB,OAAO,EAAE,YAAY,EAAE,0BAA0B,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAE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AAC;QAE3I,IAAI,KAAK,CAAC,cAAc,KAAK,kCAAc,CAAC,KAAK;YAC/C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,QAAQ,CAAC,QAAQ,uBAAuB,EAAC,CAAC;QAEtI,MAAM,kBAAkB,GAAI,MAAM,KAAK,CAAC,wBAAwB,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,gBAAgB,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;QACpJ,MAAM,kBAAkB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAEnD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,CAAC,IAAI,EAAE,CAAC;IACnE,CAAC;CACF;AAjHD,wBAiHC","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, ECObjectsError, ECObjectsStatus, EntityClass, Mixin, MixinProps, NavigationPropertyProps, RelationshipClass,\r\n SchemaItemKey, SchemaItemType, SchemaKey, StrengthDirection,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { PropertyEditResults, SchemaContextEditor, SchemaItemEditResults } 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\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 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(this.schemaItemType, this._schemaEditor);\r\n\r\n public async create(schemaKey: SchemaKey, name: string, appliesTo: SchemaItemKey, displayLabel?: string, baseClass?: SchemaItemKey): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n const newClass = ((await schema.createMixinClass(name)) as MutableMixin);\r\n if (newClass === undefined)\r\n return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };\r\n\r\n if (baseClass !== undefined) {\r\n const baseClassItem = await schema.lookupItem<Mixin>(baseClass);\r\n if (baseClassItem === undefined)\r\n return { errorMessage: `Unable to locate base class ${baseClass.fullName} in schema ${schema.fullName}.` };\r\n\r\n if (baseClassItem.schemaItemType !== SchemaItemType.Mixin)\r\n return { errorMessage: `${baseClassItem.fullName} is not of type Mixin.` };\r\n\r\n newClass.baseClass = new DelayedPromiseWithProps<SchemaItemKey, Mixin>(baseClass, async () => baseClassItem);\r\n }\r\n\r\n const newAppliesTo = (await this._schemaEditor.schemaContext.getSchemaItem<EntityClass>(appliesTo));\r\n if (newAppliesTo === undefined || newAppliesTo.schemaItemType !== SchemaItemType.EntityClass)\r\n return { errorMessage: `Failed to locate the appliedTo entity class ${appliesTo.name}.` };\r\n\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 { itemKey: newClass.key };\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<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n if (mixinProps.name === undefined)\r\n return { errorMessage: `No name was supplied within props.` };\r\n\r\n const newClass = (await schema.createMixinClass(mixinProps.name)) as MutableMixin;\r\n if (newClass === undefined)\r\n return { errorMessage: `Failed to create class ${mixinProps.name} in schema ${schemaKey.toString(true)}.` };\r\n\r\n await newClass.fromJSON(mixinProps);\r\n return { itemKey: newClass.key };\r\n }\r\n\r\n public async addMixin(entityKey: SchemaItemKey, mixinKey: SchemaItemKey): Promise<void> {\r\n const entity = (await this._schemaEditor.schemaContext.getSchemaItem<MutableEntityClass>(entityKey));\r\n const mixin = (await this._schemaEditor.schemaContext.getSchemaItem<Mixin>(mixinKey));\r\n\r\n if (entity === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Entity Class ${entityKey.fullName} not found in schema context.`);\r\n\r\n if (mixin === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Mixin Class ${mixinKey.fullName} not found in schema context.`);\r\n\r\n if (entity.schemaItemType !== SchemaItemType.EntityClass)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${entityKey.fullName} to be of type Entity Class.`);\r\n\r\n if (mixin.schemaItemType !== SchemaItemType.Mixin)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${mixinKey.fullName} to be of type Mixin.`);\r\n\r\n entity.addMixin(mixin);\r\n }\r\n\r\n public async createNavigationProperty(mixinKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<PropertyEditResults> {\r\n const mixin = (await this._schemaEditor.schemaContext.getSchemaItem<MutableMixin>(mixinKey));\r\n\r\n if (mixin === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Mixin Class ${mixinKey.fullName} not found in schema context.`);\r\n\r\n if (mixin.schemaItemType !== SchemaItemType.Mixin)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${mixinKey.fullName} to be of type Mixin.`);\r\n\r\n await mixin.createNavigationProperty(name, relationship, direction);\r\n return { itemKey: mixinKey, propertyName: name };\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<PropertyEditResults> {\r\n const mixin = await this._schemaEditor.schemaContext.getSchemaItem<MutableMixin>(classKey);\r\n if (mixin === undefined)\r\n return { itemKey: classKey, propertyName: navigationProps.name, errorMessage: `Mixin ${classKey.fullName} not found in schema context.`};\r\n\r\n if (mixin.schemaItemType !== SchemaItemType.Mixin)\r\n return { itemKey: classKey, propertyName: navigationProps.name, errorMessage: `Expected ${classKey.fullName} to be of type Mixin.`};\r\n\r\n const navigationProperty = await mixin.createNavigationProperty(navigationProps.name, navigationProps.relationshipName, navigationProps.direction);\r\n await navigationProperty.fromJSON(navigationProps);\r\n\r\n return { itemKey: classKey, propertyName: navigationProps.name };\r\n }\r\n}\r\n"]}
|
|
@@ -24,7 +24,7 @@ async function createNavigationProperty(ecClass, name, relationship, direction)
|
|
|
24
24
|
else
|
|
25
25
|
resolvedRelationship = relationship;
|
|
26
26
|
if (!resolvedRelationship)
|
|
27
|
-
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`);
|
|
27
|
+
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string
|
|
28
28
|
if (typeof (direction) === "string") {
|
|
29
29
|
const tmpDirection = (0, ecschema_metadata_1.parseStrengthDirection)(direction);
|
|
30
30
|
if (undefined === tmpDirection)
|
|
@@ -46,7 +46,7 @@ function createNavigationPropertySync(ecClass, name, relationship, direction) {
|
|
|
46
46
|
else
|
|
47
47
|
resolvedRelationship = relationship;
|
|
48
48
|
if (!resolvedRelationship)
|
|
49
|
-
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`);
|
|
49
|
+
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string
|
|
50
50
|
if (typeof (direction) === "string") {
|
|
51
51
|
const tmpDirection = (0, ecschema_metadata_1.parseStrengthDirection)(direction);
|
|
52
52
|
if (undefined === tmpDirection)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutableEntityClass.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableEntityClass.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAGkC;AAElC;;;GAGG;AACH,MAAsB,kBAAmB,SAAQ,+BAAW;CAK3D;AALD,gDAKC;AAED,gBAAgB;AACT,KAAK,UAAU,wBAAwB,CAAC,OAAgB,EAAE,IAAY,EAAE,YAAwC,EAAE,SAAqC;IAC5J,IAAI,MAAM,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC;QACjC,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,iBAAiB,EAAE,+BAA+B,IAAI,gCAAgC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;IAElJ,IAAI,oBAAmD,CAAC;IACxD,IAAI,OAAO,CAAC,YAAY,CAAC,KAAK,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"MutableEntityClass.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableEntityClass.ts"],"names":[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,CAAC;AAtBD,4DAsBC;AAED,gBAAgB;AAChB,SAAgB,4BAA4B,CAAC,OAAgB,EAAE,IAAY,EAAE,YAAwC,EAAE,SAAqC;IAC1J,IAAI,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC;QAC/B,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,iBAAiB,EAAE,+BAA+B,IAAI,gCAAgC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;IAElJ,IAAI,oBAAmD,CAAC;IACxD,IAAI,OAAO,CAAC,YAAY,CAAC,KAAK,QAAQ,EAAE,CAAC;QACvC,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAoB,YAAY,CAAC,CAAC;IACxF,CAAC;;QACC,oBAAoB,GAAG,YAAY,CAAC;IAEtC,IAAI,CAAC,oBAAoB;QACvB,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,WAAW,EAAE,mCAAmC,YAAY,8CAA8C,CAAC,CAAC,CAAC,2DAA2D;IAEnN,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,YAAY,GAAG,IAAA,0CAAsB,EAAC,SAAS,CAAC,CAAC;QACvD,IAAI,SAAS,KAAK,YAAY;YAC5B,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,wBAAwB,EAAE,mCAAmC,SAAS,qCAAqC,CAAC,CAAC;QACxJ,SAAS,GAAG,YAAY,CAAC;IAC3B,CAAC;IAED,MAAM,gBAAgB,GAAG,IAAI,2CAAuB,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,oBAAqB,CAAC,CAAC;IAClH,OAAO,IAAI,sCAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;AAC5E,CAAC;AAtBD,oEAsBC","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\nimport {\r\n DelayedPromiseWithProps, ECClass, ECObjectsError, ECObjectsStatus, EntityClass, Mixin, NavigationProperty,\r\n parseStrengthDirection, RelationshipClass, StrengthDirection,\r\n} from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\n * @internal\r\n */\r\nexport abstract class MutableEntityClass extends EntityClass {\r\n public abstract override addMixin(mixin: Mixin): any;\r\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\r\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n\r\n/** @internal */\r\nexport async function createNavigationProperty(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\r\n if (await ecClass.getProperty(name))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\r\n\r\n let resolvedRelationship: RelationshipClass | undefined;\r\n if (typeof (relationship) === \"string\") {\r\n resolvedRelationship = await ecClass.schema.lookupItem<RelationshipClass>(relationship);\r\n } else\r\n resolvedRelationship = relationship;\r\n\r\n if (!resolvedRelationship)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\r\n\r\n if (typeof (direction) === \"string\") {\r\n const tmpDirection = parseStrengthDirection(direction);\r\n if (undefined === tmpDirection)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\r\n direction = tmpDirection;\r\n }\r\n\r\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship!);\r\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\r\n}\r\n\r\n/** @internal */\r\nexport function createNavigationPropertySync(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\r\n if (ecClass.getPropertySync(name))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\r\n\r\n let resolvedRelationship: RelationshipClass | undefined;\r\n if (typeof (relationship) === \"string\") {\r\n resolvedRelationship = ecClass.schema.lookupItemSync<RelationshipClass>(relationship);\r\n } else\r\n resolvedRelationship = relationship;\r\n\r\n if (!resolvedRelationship)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\r\n\r\n if (typeof (direction) === \"string\") {\r\n const tmpDirection = parseStrengthDirection(direction);\r\n if (undefined === tmpDirection)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\r\n direction = tmpDirection;\r\n }\r\n\r\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship!);\r\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\r\n}\r\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NavigationProperty } from "@itwin/ecschema-metadata";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* An abstract class used for schema editing.
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class MutableNavigationProperty extends NavigationProperty {
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=MutableNavigationProperty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MutableNavigationProperty.d.ts","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableNavigationProperty.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;;GAGG;AACH,8BAAsB,yBAA0B,SAAQ,kBAAkB;CACzE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MutableNavigationProperty = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
* An abstract class used for schema editing.
|
|
12
|
+
*/
|
|
13
|
+
class MutableNavigationProperty extends ecschema_metadata_1.NavigationProperty {
|
|
14
|
+
}
|
|
15
|
+
exports.MutableNavigationProperty = MutableNavigationProperty;
|
|
16
|
+
//# sourceMappingURL=MutableNavigationProperty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MutableNavigationProperty.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableNavigationProperty.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAA8D;AAE9D;;;GAGG;AACH,MAAsB,yBAA0B,SAAQ,sCAAkB;CACzE;AADD,8DACC","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\nimport { NavigationProperty } from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableNavigationProperty extends NavigationProperty {\r\n}\r\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StructProperty } from "@itwin/ecschema-metadata";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* An abstract class used for schema editing.
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class MutableStructProperty extends StructProperty {
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=MutableStructProperty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MutableStructProperty.d.ts","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableStructProperty.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D;;;GAGG;AACH,8BAAsB,qBAAsB,SAAQ,cAAc;CACjE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MutableStructProperty = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
* An abstract class used for schema editing.
|
|
12
|
+
*/
|
|
13
|
+
class MutableStructProperty extends ecschema_metadata_1.StructProperty {
|
|
14
|
+
}
|
|
15
|
+
exports.MutableStructProperty = MutableStructProperty;
|
|
16
|
+
//# sourceMappingURL=MutableStructProperty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MutableStructProperty.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableStructProperty.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAA0D;AAE1D;;;GAGG;AACH,MAAsB,qBAAsB,SAAQ,kCAAc;CACjE;AADD,sDACC","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\nimport { StructProperty } from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableStructProperty extends StructProperty {\r\n}\r\n"]}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { CustomAttribute, SchemaItemKey } from "@itwin/ecschema-metadata";
|
|
2
|
+
import { SchemaContextEditor } from "./Editor";
|
|
3
|
+
import { MutableArrayProperty } from "./Mutable/MutableArrayProperty";
|
|
4
|
+
import { MutableProperty } from "./Mutable/MutableProperty";
|
|
5
|
+
import { MutablePrimitiveOrEnumPropertyBase } from "./Mutable/MutablePrimitiveOrEnumProperty";
|
|
6
|
+
import { MutableStructProperty } from "./Mutable/MutableStructProperty";
|
|
7
|
+
import { MutableNavigationProperty } from "./Mutable/MutableNavigationProperty";
|
|
8
|
+
import { ECClassSchemaItems } from "./ECClasses";
|
|
9
|
+
type MutablePropertyType = MutableProperty | MutableArrayProperty | MutablePrimitiveOrEnumPropertyBase | MutableNavigationProperty | MutableStructProperty;
|
|
10
|
+
/**
|
|
11
|
+
* @alpha
|
|
12
|
+
* A class allowing editing of attributes of the base Property class.
|
|
13
|
+
*/
|
|
14
|
+
export declare class Properties {
|
|
15
|
+
protected ecClassType: ECClassSchemaItems;
|
|
16
|
+
protected _schemaEditor: SchemaContextEditor;
|
|
17
|
+
constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor);
|
|
18
|
+
setName(classKey: SchemaItemKey, propertyName: string, newPropertyName: string): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Sets the property description.
|
|
21
|
+
* @param classKey The SchemaItemKey of the class.
|
|
22
|
+
* @param propertyName The name of the property.
|
|
23
|
+
* @param description The new description to set.
|
|
24
|
+
*/
|
|
25
|
+
setDescription(classKey: SchemaItemKey, propertyName: string, description: string): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Sets the property label.
|
|
28
|
+
* @param classKey The SchemaItemKey of the class.
|
|
29
|
+
* @param propertyName The name of the property.
|
|
30
|
+
* @param label The new label to set.
|
|
31
|
+
*/
|
|
32
|
+
setLabel(classKey: SchemaItemKey, propertyName: string, label: string): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Sets the property isReadOnly attribute.
|
|
35
|
+
* @param classKey The SchemaItemKey of the class.
|
|
36
|
+
* @param propertyName The name of the property.
|
|
37
|
+
* @param isReadOnly The new isReadOnly value.
|
|
38
|
+
*/
|
|
39
|
+
setIsReadOnly(classKey: SchemaItemKey, propertyName: string, isReadOnly: boolean): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Sets the property priority.
|
|
42
|
+
* @param classKey The SchemaItemKey of the class.
|
|
43
|
+
* @param propertyName The name of the property.
|
|
44
|
+
* @param priority The new priority.
|
|
45
|
+
*/
|
|
46
|
+
setPriority(classKey: SchemaItemKey, propertyName: string, priority: number): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Sets the property category.
|
|
49
|
+
* @param classKey The SchemaItemKey of the class.
|
|
50
|
+
* @param propertyName The name of the property.
|
|
51
|
+
* @param categoryKey The SchemaItemKey of the property category.
|
|
52
|
+
*/
|
|
53
|
+
setCategory(classKey: SchemaItemKey, propertyName: string, categoryKey: SchemaItemKey): Promise<{
|
|
54
|
+
errorMessage: string;
|
|
55
|
+
itemKey?: undefined;
|
|
56
|
+
propertyName?: undefined;
|
|
57
|
+
} | {
|
|
58
|
+
itemKey: SchemaItemKey;
|
|
59
|
+
propertyName: string;
|
|
60
|
+
errorMessage?: undefined;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Adds a CustomAttribute instance to the Property identified by the given SchemaItemKey and property name.
|
|
64
|
+
* @param classKey The SchemaItemKey identifying the class.
|
|
65
|
+
* @param propertyName The name of the property.
|
|
66
|
+
* @param customAttribute The CustomAttribute instance to add.
|
|
67
|
+
*/
|
|
68
|
+
addCustomAttribute(classKey: SchemaItemKey, propertyName: string, customAttribute: CustomAttribute): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Gets the property with the specified name from the class identified by the given key.
|
|
71
|
+
* @param classKey The SchemaItemKey of the class.
|
|
72
|
+
* @param propertyName The name of the property to retrieve.
|
|
73
|
+
*/
|
|
74
|
+
protected getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T>;
|
|
75
|
+
private findDerivedClasses;
|
|
76
|
+
private getClass;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @alpha
|
|
80
|
+
* A class extending Properties allowing editing of attributes of PrimitiveArrayProperty,
|
|
81
|
+
* EnumerationArrayProperty and StructArrayProperty.
|
|
82
|
+
*/
|
|
83
|
+
export declare class ArrayProperties extends Properties {
|
|
84
|
+
constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor);
|
|
85
|
+
/**
|
|
86
|
+
* Sets the array property minOccurs attribute.
|
|
87
|
+
* @param classKey The SchemaItemKey of the class.
|
|
88
|
+
* @param propertyName The name of the property.
|
|
89
|
+
* @param minOccurs The new minOccurs value.
|
|
90
|
+
*/
|
|
91
|
+
setMinOccurs(classKey: SchemaItemKey, propertyName: string, minOccurs: number): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Sets the array property maxOccurs attribute.
|
|
94
|
+
* @param classKey The SchemaItemKey of the class.
|
|
95
|
+
* @param propertyName The name of the property.
|
|
96
|
+
* @param maxOccurs The new maxOccurs value.
|
|
97
|
+
*/
|
|
98
|
+
setMaxOccurs(classKey: SchemaItemKey, propertyName: string, maxOccurs: number): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Override to validate that the found property is an ArrayProperty.
|
|
101
|
+
* @param classKey The SchemaItemKey of the class.
|
|
102
|
+
* @param propertyName The name of the property.
|
|
103
|
+
*/
|
|
104
|
+
protected getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* @alpha
|
|
108
|
+
* A class extending Properties allowing editing of attributes of PrimitiveProperty and EnumerationProperty.
|
|
109
|
+
*/
|
|
110
|
+
declare class PrimitiveOrEnumProperties extends Properties {
|
|
111
|
+
constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor);
|
|
112
|
+
/**
|
|
113
|
+
* Sets the extendTypeName attribute value.
|
|
114
|
+
* @param classKey The SchemaItemKey of the class.
|
|
115
|
+
* @param propertyName The name of the property.
|
|
116
|
+
* @param extendTypeName The extended type name of the property.
|
|
117
|
+
*/
|
|
118
|
+
setExtendedTypeName(classKey: SchemaItemKey, propertyName: string, extendedTypeName: string): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Sets the minLength attribute value.
|
|
121
|
+
* @param classKey The SchemaItemKey of the class.
|
|
122
|
+
* @param propertyName The name of the property.
|
|
123
|
+
* @param minLength The minimum length of the property.
|
|
124
|
+
*/
|
|
125
|
+
setMinLength(classKey: SchemaItemKey, propertyName: string, minLength: number): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Sets the maxLength attribute value.
|
|
128
|
+
* @param classKey The SchemaItemKey of the class.
|
|
129
|
+
* @param propertyName The name of the property.
|
|
130
|
+
* @param maxLength The maximum length of the property.
|
|
131
|
+
*/
|
|
132
|
+
setMaxLength(classKey: SchemaItemKey, propertyName: string, maxLength: number): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Sets the minValue attribute value.
|
|
135
|
+
* @param classKey The SchemaItemKey of the class.
|
|
136
|
+
* @param propertyName The name of the property.
|
|
137
|
+
* @param minValue The minimum value of the property.
|
|
138
|
+
*/
|
|
139
|
+
setMinValue(classKey: SchemaItemKey, propertyName: string, minValue: number): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Sets the maxValue attribute value.
|
|
142
|
+
* @param classKey The SchemaItemKey of the class.
|
|
143
|
+
* @param propertyName The name of the property.
|
|
144
|
+
* @param maxValue The maximum value of the property.
|
|
145
|
+
*/
|
|
146
|
+
setMaxValue(classKey: SchemaItemKey, propertyName: string, maxValue: number): Promise<void>;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @alpha
|
|
150
|
+
* A class extending Properties allowing editing of PrimitiveProperty attributes.
|
|
151
|
+
*/
|
|
152
|
+
export declare class PrimitiveProperties extends PrimitiveOrEnumProperties {
|
|
153
|
+
constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor);
|
|
154
|
+
/**
|
|
155
|
+
* Override to validate that the found property is a PrimitiveProperty.
|
|
156
|
+
* @param classKey The SchemaItemKey of the class.
|
|
157
|
+
* @param propertyName The name of the property.
|
|
158
|
+
*/
|
|
159
|
+
protected getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T>;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* @alpha
|
|
163
|
+
* A class extending Properties allowing editing of EnumerationProperty attributes.
|
|
164
|
+
*/
|
|
165
|
+
export declare class EnumerationProperties extends PrimitiveOrEnumProperties {
|
|
166
|
+
constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor);
|
|
167
|
+
/**
|
|
168
|
+
* Override to validate that the found property is a EnumerationProperty.
|
|
169
|
+
* @param classKey The SchemaItemKey of the class.
|
|
170
|
+
* @param propertyName The name of the property.
|
|
171
|
+
*/
|
|
172
|
+
protected getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T>;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* @alpha
|
|
176
|
+
* A class extending Properties allowing editing of NavigationProperties attributes.
|
|
177
|
+
*/
|
|
178
|
+
export declare class NavigationProperties extends Properties {
|
|
179
|
+
constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor);
|
|
180
|
+
/**
|
|
181
|
+
* Override to validate that the found property is a NavigationProperty.
|
|
182
|
+
* @param classKey The SchemaItemKey of the class.
|
|
183
|
+
* @param propertyName The name of the property.
|
|
184
|
+
*/
|
|
185
|
+
protected getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T>;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* @alpha
|
|
189
|
+
* A class extending Properties allowing editing of StructProperty attributes.
|
|
190
|
+
*/
|
|
191
|
+
export declare class StructProperties extends Properties {
|
|
192
|
+
constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor);
|
|
193
|
+
/**
|
|
194
|
+
* Override to validate that the found property is a StructProperty.
|
|
195
|
+
* @param classKey The SchemaItemKey of the class.
|
|
196
|
+
* @param propertyName The name of the property.
|
|
197
|
+
*/
|
|
198
|
+
protected getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T>;
|
|
199
|
+
}
|
|
200
|
+
export {};
|
|
201
|
+
//# sourceMappingURL=Properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Properties.d.ts","sourceRoot":"","sources":["../../../src/Editing/Properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAEJ,aAAa,EAAkC,MAAM,0BAA0B,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,kCAAkC,EAAE,MAAM,0CAA0C,CAAC;AAE9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,KAAK,mBAAmB,GAAG,eAAe,GAAG,oBAAoB,GAAG,kC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