@itwin/ecschema-editing 3.4.0 → 3.4.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.
- package/CHANGELOG.md +6 -1
- package/lib/cjs/Editing/Constants.d.ts +20 -20
- package/lib/cjs/Editing/Constants.js +60 -60
- package/lib/cjs/Editing/Constants.js.map +1 -1
- package/lib/cjs/Editing/CustomAttributes.d.ts +20 -20
- package/lib/cjs/Editing/CustomAttributes.js +59 -59
- package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
- package/lib/cjs/Editing/ECClasses.d.ts +54 -54
- package/lib/cjs/Editing/ECClasses.js +269 -269
- package/lib/cjs/Editing/ECClasses.js.map +1 -1
- package/lib/cjs/Editing/Editor.d.ts +112 -112
- package/lib/cjs/Editing/Editor.js +166 -166
- package/lib/cjs/Editing/Editor.js.map +1 -1
- package/lib/cjs/Editing/Entities.d.ts +25 -25
- package/lib/cjs/Editing/Entities.js +116 -116
- package/lib/cjs/Editing/Entities.js.map +1 -1
- package/lib/cjs/Editing/Enumerations.d.ts +21 -21
- package/lib/cjs/Editing/Enumerations.js +66 -66
- package/lib/cjs/Editing/Enumerations.js.map +1 -1
- package/lib/cjs/Editing/Formats.d.ts +21 -21
- package/lib/cjs/Editing/Formats.js +61 -61
- package/lib/cjs/Editing/Formats.js.map +1 -1
- package/lib/cjs/Editing/InvertedUnits.d.ts +17 -17
- package/lib/cjs/Editing/InvertedUnits.js +82 -82
- package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
- package/lib/cjs/Editing/KindOfQuantities.d.ts +28 -28
- package/lib/cjs/Editing/KindOfQuantities.js +78 -78
- package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
- package/lib/cjs/Editing/Mixins.d.ts +22 -22
- package/lib/cjs/Editing/Mixins.js +84 -84
- package/lib/cjs/Editing/Mixins.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableCAClass.d.ts +9 -9
- package/lib/cjs/Editing/Mutable/MutableCAClass.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableClass.d.ts +34 -34
- package/lib/cjs/Editing/Mutable/MutableClass.js +22 -22
- package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableConstant.d.ts +12 -12
- package/lib/cjs/Editing/Mutable/MutableConstant.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableEntityClass.d.ts +15 -15
- package/lib/cjs/Editing/Mutable/MutableEntityClass.js +59 -59
- package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableEnumeration.d.ts +9 -9
- package/lib/cjs/Editing/Mutable/MutableEnumeration.js +14 -14
- package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableFormat.d.ts +18 -18
- package/lib/cjs/Editing/Mutable/MutableFormat.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableInvertedUnit.d.ts +10 -10
- package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.d.ts +10 -10
- package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableMixin.d.ts +11 -11
- package/lib/cjs/Editing/Mutable/MutableMixin.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableMixin.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutablePhenomenon.d.ts +9 -9
- package/lib/cjs/Editing/Mutable/MutablePhenomenon.js +15 -15
- package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableProperty.d.ts +8 -8
- package/lib/cjs/Editing/Mutable/MutableProperty.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutablePropertyCategory.d.ts +9 -9
- package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js +15 -15
- package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableRelationshipClass.d.ts +21 -21
- package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js +24 -24
- package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableSchema.d.ts +45 -45
- package/lib/cjs/Editing/Mutable/MutableSchema.js +17 -17
- package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableUnit.d.ts +11 -11
- package/lib/cjs/Editing/Mutable/MutableUnit.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableUnit.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableUnitSystem.d.ts +8 -8
- package/lib/cjs/Editing/Mutable/MutableUnitSystem.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
- package/lib/cjs/Editing/Phenomena.d.ts +15 -15
- package/lib/cjs/Editing/Phenomena.js +44 -44
- package/lib/cjs/Editing/Phenomena.js.map +1 -1
- package/lib/cjs/Editing/PropertyCategories.d.ts +16 -16
- package/lib/cjs/Editing/PropertyCategories.js +51 -51
- package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
- package/lib/cjs/Editing/RelationshipClasses.d.ts +21 -21
- package/lib/cjs/Editing/RelationshipClasses.js +68 -68
- package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
- package/lib/cjs/Editing/Structs.d.ts +19 -19
- package/lib/cjs/Editing/Structs.js +57 -57
- package/lib/cjs/Editing/Structs.js.map +1 -1
- package/lib/cjs/Editing/UnitSystems.d.ts +15 -15
- package/lib/cjs/Editing/UnitSystems.js +41 -41
- package/lib/cjs/Editing/UnitSystems.js.map +1 -1
- package/lib/cjs/Editing/Units.d.ts +15 -15
- package/lib/cjs/Editing/Units.js +58 -58
- package/lib/cjs/Editing/Units.js.map +1 -1
- package/lib/cjs/Validation/Diagnostic.d.ts +321 -321
- package/lib/cjs/Validation/Diagnostic.js +310 -310
- package/lib/cjs/Validation/Diagnostic.js.map +1 -1
- package/lib/cjs/Validation/DiagnosticReporter.d.ts +96 -96
- package/lib/cjs/Validation/DiagnosticReporter.js +106 -106
- package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
- package/lib/cjs/Validation/ECRules.d.ts +448 -448
- package/lib/cjs/Validation/ECRules.js +593 -593
- package/lib/cjs/Validation/ECRules.js.map +1 -1
- package/lib/cjs/Validation/LoggingDiagnosticReporter.d.ts +13 -13
- package/lib/cjs/Validation/LoggingDiagnosticReporter.js +40 -40
- package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
- package/lib/cjs/Validation/RuleSuppressionSet.d.ts +59 -59
- package/lib/cjs/Validation/RuleSuppressionSet.js +9 -9
- package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
- package/lib/cjs/Validation/Rules.d.ts +64 -64
- package/lib/cjs/Validation/Rules.js +9 -9
- package/lib/cjs/Validation/Rules.js.map +1 -1
- package/lib/cjs/Validation/SchemaChanges.d.ts +607 -607
- package/lib/cjs/Validation/SchemaChanges.js +1135 -1135
- package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareDiagnostics.d.ts +422 -422
- package/lib/cjs/Validation/SchemaCompareDiagnostics.js +111 -111
- package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareReporter.d.ts +11 -11
- package/lib/cjs/Validation/SchemaCompareReporter.js +9 -9
- package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareResultDelegate.d.ts +236 -236
- package/lib/cjs/Validation/SchemaCompareResultDelegate.js +348 -348
- package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareVisitor.d.ts +119 -119
- package/lib/cjs/Validation/SchemaCompareVisitor.js +206 -206
- package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
- package/lib/cjs/Validation/SchemaComparer.d.ts +171 -171
- package/lib/cjs/Validation/SchemaComparer.js +666 -666
- package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
- package/lib/cjs/Validation/SchemaValidater.d.ts +19 -19
- package/lib/cjs/Validation/SchemaValidater.js +61 -61
- package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
- package/lib/cjs/Validation/SchemaValidationVisitor.d.ts +170 -170
- package/lib/cjs/Validation/SchemaValidationVisitor.js +492 -492
- package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.d.ts +22 -22
- package/lib/cjs/Validation/SchemaWalker.js +51 -51
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-editing.d.ts +33 -33
- package/lib/cjs/ecschema-editing.js +54 -54
- package/lib/cjs/ecschema-editing.js.map +1 -1
- package/package.json +10 -10
- package/public/locales/en/ECSchemaEditing.json +26 -26
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MutableUnitSystem = 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
|
-
* Used for schema editing.
|
|
12
|
-
*/
|
|
13
|
-
class MutableUnitSystem extends ecschema_metadata_1.UnitSystem {
|
|
14
|
-
}
|
|
15
|
-
exports.MutableUnitSystem = MutableUnitSystem;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MutableUnitSystem = 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
|
+
* Used for schema editing.
|
|
12
|
+
*/
|
|
13
|
+
class MutableUnitSystem extends ecschema_metadata_1.UnitSystem {
|
|
14
|
+
}
|
|
15
|
+
exports.MutableUnitSystem = MutableUnitSystem;
|
|
16
16
|
//# sourceMappingURL=MutableUnitSystem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutableUnitSystem.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableUnitSystem.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAsD;AAEtD;;;GAGG;AACH,MAAsB,iBAAkB,SAAQ,8BAAU;CAEzD;AAFD,8CAEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"MutableUnitSystem.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableUnitSystem.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAsD;AAEtD;;;GAGG;AACH,MAAsB,iBAAkB,SAAQ,8BAAU;CAEzD;AAFD,8CAEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { UnitSystem } from \"@itwin/ecschema-metadata\";\n\n/**\n * @internal\n * Used for schema editing.\n */\nexport abstract class MutableUnitSystem extends UnitSystem {\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module Editing
|
|
3
|
-
*/
|
|
4
|
-
import { PhenomenonProps, SchemaKey } from "@itwin/ecschema-metadata";
|
|
5
|
-
import { SchemaContextEditor, SchemaItemEditResults } from "./Editor";
|
|
6
|
-
/**
|
|
7
|
-
* @alpha
|
|
8
|
-
* A class allowing you to create schema items of type Phenomenon.
|
|
9
|
-
*/
|
|
10
|
-
export declare class Phenomena {
|
|
11
|
-
protected _schemaEditor: SchemaContextEditor;
|
|
12
|
-
constructor(_schemaEditor: SchemaContextEditor);
|
|
13
|
-
create(schemaKey: SchemaKey, name: string, definition: string, displayLabel?: string): Promise<SchemaItemEditResults>;
|
|
14
|
-
createFromProps(schemaKey: SchemaKey, phenomenonProps: PhenomenonProps): Promise<SchemaItemEditResults>;
|
|
15
|
-
}
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Editing
|
|
3
|
+
*/
|
|
4
|
+
import { PhenomenonProps, SchemaKey } from "@itwin/ecschema-metadata";
|
|
5
|
+
import { SchemaContextEditor, SchemaItemEditResults } from "./Editor";
|
|
6
|
+
/**
|
|
7
|
+
* @alpha
|
|
8
|
+
* A class allowing you to create schema items of type Phenomenon.
|
|
9
|
+
*/
|
|
10
|
+
export declare class Phenomena {
|
|
11
|
+
protected _schemaEditor: SchemaContextEditor;
|
|
12
|
+
constructor(_schemaEditor: SchemaContextEditor);
|
|
13
|
+
create(schemaKey: SchemaKey, name: string, definition: string, displayLabel?: string): Promise<SchemaItemEditResults>;
|
|
14
|
+
createFromProps(schemaKey: SchemaKey, phenomenonProps: PhenomenonProps): Promise<SchemaItemEditResults>;
|
|
15
|
+
}
|
|
16
16
|
//# sourceMappingURL=Phenomena.d.ts.map
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module Editing
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.Phenomena = void 0;
|
|
11
|
-
/**
|
|
12
|
-
* @alpha
|
|
13
|
-
* A class allowing you to create schema items of type Phenomenon.
|
|
14
|
-
*/
|
|
15
|
-
class Phenomena {
|
|
16
|
-
constructor(_schemaEditor) {
|
|
17
|
-
this._schemaEditor = _schemaEditor;
|
|
18
|
-
}
|
|
19
|
-
async create(schemaKey, name, definition, displayLabel) {
|
|
20
|
-
const schema = await this._schemaEditor.getSchema(schemaKey);
|
|
21
|
-
if (schema === undefined)
|
|
22
|
-
return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
|
|
23
|
-
const newPhenomenon = (await schema.createPhenomenon(name));
|
|
24
|
-
if (newPhenomenon === undefined)
|
|
25
|
-
return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };
|
|
26
|
-
if (displayLabel)
|
|
27
|
-
newPhenomenon.setDisplayLabel(displayLabel);
|
|
28
|
-
await newPhenomenon.setDefinition(definition);
|
|
29
|
-
return { itemKey: newPhenomenon.key };
|
|
30
|
-
}
|
|
31
|
-
async createFromProps(schemaKey, phenomenonProps) {
|
|
32
|
-
const schema = await this._schemaEditor.getSchema(schemaKey);
|
|
33
|
-
if (schema === undefined)
|
|
34
|
-
return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
|
|
35
|
-
if (phenomenonProps.name === undefined)
|
|
36
|
-
return { errorMessage: `No name was supplied within props.` };
|
|
37
|
-
const newPhenomenon = (await schema.createPhenomenon(phenomenonProps.name));
|
|
38
|
-
if (newPhenomenon === undefined)
|
|
39
|
-
return { errorMessage: `Failed to create class ${phenomenonProps.name} in schema ${schemaKey.toString(true)}.` };
|
|
40
|
-
await newPhenomenon.fromJSON(phenomenonProps);
|
|
41
|
-
return { itemKey: newPhenomenon.key };
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.Phenomena = Phenomena;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Editing
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.Phenomena = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* @alpha
|
|
13
|
+
* A class allowing you to create schema items of type Phenomenon.
|
|
14
|
+
*/
|
|
15
|
+
class Phenomena {
|
|
16
|
+
constructor(_schemaEditor) {
|
|
17
|
+
this._schemaEditor = _schemaEditor;
|
|
18
|
+
}
|
|
19
|
+
async create(schemaKey, name, definition, displayLabel) {
|
|
20
|
+
const schema = await this._schemaEditor.getSchema(schemaKey);
|
|
21
|
+
if (schema === undefined)
|
|
22
|
+
return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
|
|
23
|
+
const newPhenomenon = (await schema.createPhenomenon(name));
|
|
24
|
+
if (newPhenomenon === undefined)
|
|
25
|
+
return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };
|
|
26
|
+
if (displayLabel)
|
|
27
|
+
newPhenomenon.setDisplayLabel(displayLabel);
|
|
28
|
+
await newPhenomenon.setDefinition(definition);
|
|
29
|
+
return { itemKey: newPhenomenon.key };
|
|
30
|
+
}
|
|
31
|
+
async createFromProps(schemaKey, phenomenonProps) {
|
|
32
|
+
const schema = await this._schemaEditor.getSchema(schemaKey);
|
|
33
|
+
if (schema === undefined)
|
|
34
|
+
return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
|
|
35
|
+
if (phenomenonProps.name === undefined)
|
|
36
|
+
return { errorMessage: `No name was supplied within props.` };
|
|
37
|
+
const newPhenomenon = (await schema.createPhenomenon(phenomenonProps.name));
|
|
38
|
+
if (newPhenomenon === undefined)
|
|
39
|
+
return { errorMessage: `Failed to create class ${phenomenonProps.name} in schema ${schemaKey.toString(true)}.` };
|
|
40
|
+
await newPhenomenon.fromJSON(phenomenonProps);
|
|
41
|
+
return { itemKey: newPhenomenon.key };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.Phenomena = Phenomena;
|
|
45
45
|
//# sourceMappingURL=Phenomena.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Phenomena.js","sourceRoot":"","sources":["../../../src/Editing/Phenomena.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAMH;;;GAGG;AACH,MAAa,SAAS;IACpB,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAE7D,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,UAAkB,EAAE,YAAqB;QAC/F,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,aAAa,GAAG,CAAC,MAAM,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAsB,CAAC;QACjF,IAAI,aAAa,KAAK,SAAS;YAC7B,OAAO,EAAE,YAAY,EAAE,0BAA0B,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAEnG,IAAI,YAAY;YACd,aAAa,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QAE9C,MAAM,aAAa,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAE9C,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;IACxC,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,eAAgC;QACjF,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,IAAI,eAAe,CAAC,IAAI,KAAK,SAAS;YACpC,OAAO,EAAE,YAAY,EAAE,oCAAoC,EAAE,CAAC;QAEhE,MAAM,aAAa,GAAG,CAAC,MAAM,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5E,IAAI,aAAa,KAAK,SAAS;YAC7B,OAAO,EAAE,YAAY,EAAE,0BAA0B,eAAe,CAAC,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAEnH,MAAM,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC9C,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;IACxC,CAAC;CACF;AAnCD,8BAmCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"Phenomena.js","sourceRoot":"","sources":["../../../src/Editing/Phenomena.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAMH;;;GAGG;AACH,MAAa,SAAS;IACpB,YAA6B,aAAkC;QAAlC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;YAC7B,OAAO,EAAE,YAAY,EAAE,0BAA0B,eAAe,CAAC,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAEnH,MAAM,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC9C,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;IACxC,CAAC;CACF;AAnCD,8BAmCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { PhenomenonProps, SchemaKey } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\nimport { MutablePhenomenon } from \"./Mutable/MutablePhenomenon\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type Phenomenon.\n */\nexport class Phenomena {\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\n\n public async create(schemaKey: SchemaKey, name: string, definition: string, displayLabel?: string): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n const newPhenomenon = (await schema.createPhenomenon(name)) as MutablePhenomenon;\n if (newPhenomenon === undefined)\n return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };\n\n if (displayLabel)\n newPhenomenon.setDisplayLabel(displayLabel);\n\n await newPhenomenon.setDefinition(definition);\n\n return { itemKey: newPhenomenon.key };\n }\n\n public async createFromProps(schemaKey: SchemaKey, phenomenonProps: PhenomenonProps): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n if (phenomenonProps.name === undefined)\n return { errorMessage: `No name was supplied within props.` };\n\n const newPhenomenon = (await schema.createPhenomenon(phenomenonProps.name));\n if (newPhenomenon === undefined)\n return { errorMessage: `Failed to create class ${phenomenonProps.name} in schema ${schemaKey.toString(true)}.` };\n\n await newPhenomenon.fromJSON(phenomenonProps);\n return { itemKey: newPhenomenon.key };\n }\n}\n"]}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module Editing
|
|
3
|
-
*/
|
|
4
|
-
import { PropertyCategoryProps, SchemaItemKey, SchemaKey } from "@itwin/ecschema-metadata";
|
|
5
|
-
import { SchemaContextEditor, SchemaItemEditResults } from "./Editor";
|
|
6
|
-
/**
|
|
7
|
-
* @alpha
|
|
8
|
-
* A class allowing you to create schema items of type Property Category.
|
|
9
|
-
*/
|
|
10
|
-
export declare class PropertyCategories {
|
|
11
|
-
protected _schemaEditor: SchemaContextEditor;
|
|
12
|
-
constructor(_schemaEditor: SchemaContextEditor);
|
|
13
|
-
create(schemaKey: SchemaKey, name: string, priority: number, displayLabel?: string): Promise<SchemaItemEditResults>;
|
|
14
|
-
createFromProps(schemaKey: SchemaKey, propertyCategoryProps: PropertyCategoryProps): Promise<SchemaItemEditResults>;
|
|
15
|
-
setPriority(propCategoryKey: SchemaItemKey, priority: number): Promise<void>;
|
|
16
|
-
}
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Editing
|
|
3
|
+
*/
|
|
4
|
+
import { PropertyCategoryProps, SchemaItemKey, SchemaKey } from "@itwin/ecschema-metadata";
|
|
5
|
+
import { SchemaContextEditor, SchemaItemEditResults } from "./Editor";
|
|
6
|
+
/**
|
|
7
|
+
* @alpha
|
|
8
|
+
* A class allowing you to create schema items of type Property Category.
|
|
9
|
+
*/
|
|
10
|
+
export declare class PropertyCategories {
|
|
11
|
+
protected _schemaEditor: SchemaContextEditor;
|
|
12
|
+
constructor(_schemaEditor: SchemaContextEditor);
|
|
13
|
+
create(schemaKey: SchemaKey, name: string, priority: number, displayLabel?: string): Promise<SchemaItemEditResults>;
|
|
14
|
+
createFromProps(schemaKey: SchemaKey, propertyCategoryProps: PropertyCategoryProps): Promise<SchemaItemEditResults>;
|
|
15
|
+
setPriority(propCategoryKey: SchemaItemKey, priority: number): Promise<void>;
|
|
16
|
+
}
|
|
17
17
|
//# sourceMappingURL=PropertyCategories.d.ts.map
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module Editing
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.PropertyCategories = void 0;
|
|
11
|
-
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
12
|
-
/**
|
|
13
|
-
* @alpha
|
|
14
|
-
* A class allowing you to create schema items of type Property Category.
|
|
15
|
-
*/
|
|
16
|
-
class PropertyCategories {
|
|
17
|
-
constructor(_schemaEditor) {
|
|
18
|
-
this._schemaEditor = _schemaEditor;
|
|
19
|
-
}
|
|
20
|
-
async create(schemaKey, name, priority, displayLabel) {
|
|
21
|
-
const schema = await this._schemaEditor.getSchema(schemaKey);
|
|
22
|
-
if (schema === undefined)
|
|
23
|
-
return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
|
|
24
|
-
const newPropCategory = (await schema.createPropertyCategory(name));
|
|
25
|
-
newPropCategory.setPriority(priority);
|
|
26
|
-
if (displayLabel)
|
|
27
|
-
newPropCategory.setDisplayLabel(displayLabel);
|
|
28
|
-
return { itemKey: newPropCategory.key };
|
|
29
|
-
}
|
|
30
|
-
async createFromProps(schemaKey, propertyCategoryProps) {
|
|
31
|
-
const schema = await this._schemaEditor.getSchema(schemaKey);
|
|
32
|
-
if (schema === undefined)
|
|
33
|
-
return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
|
|
34
|
-
if (propertyCategoryProps.name === undefined)
|
|
35
|
-
return { errorMessage: `No name was supplied within props.` };
|
|
36
|
-
const newPropCategory = (await schema.createPropertyCategory(propertyCategoryProps.name));
|
|
37
|
-
if (newPropCategory === undefined)
|
|
38
|
-
return { errorMessage: `Failed to create class ${propertyCategoryProps.name} in schema ${schemaKey.toString(true)}.` };
|
|
39
|
-
await newPropCategory.fromJSON(propertyCategoryProps);
|
|
40
|
-
return { itemKey: newPropCategory.key };
|
|
41
|
-
}
|
|
42
|
-
async setPriority(propCategoryKey, priority) {
|
|
43
|
-
const propertyCategory = (await this._schemaEditor.schemaContext.getSchemaItem(propCategoryKey));
|
|
44
|
-
if (propertyCategory === undefined)
|
|
45
|
-
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Property Category ${propCategoryKey.fullName} not found in schema context.`);
|
|
46
|
-
if (propertyCategory.schemaItemType !== ecschema_metadata_1.SchemaItemType.PropertyCategory)
|
|
47
|
-
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${propCategoryKey.fullName} to be of type Property Category.`);
|
|
48
|
-
propertyCategory.setPriority(priority);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.PropertyCategories = PropertyCategories;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Editing
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.PropertyCategories = void 0;
|
|
11
|
+
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
12
|
+
/**
|
|
13
|
+
* @alpha
|
|
14
|
+
* A class allowing you to create schema items of type Property Category.
|
|
15
|
+
*/
|
|
16
|
+
class PropertyCategories {
|
|
17
|
+
constructor(_schemaEditor) {
|
|
18
|
+
this._schemaEditor = _schemaEditor;
|
|
19
|
+
}
|
|
20
|
+
async create(schemaKey, name, priority, displayLabel) {
|
|
21
|
+
const schema = await this._schemaEditor.getSchema(schemaKey);
|
|
22
|
+
if (schema === undefined)
|
|
23
|
+
return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
|
|
24
|
+
const newPropCategory = (await schema.createPropertyCategory(name));
|
|
25
|
+
newPropCategory.setPriority(priority);
|
|
26
|
+
if (displayLabel)
|
|
27
|
+
newPropCategory.setDisplayLabel(displayLabel);
|
|
28
|
+
return { itemKey: newPropCategory.key };
|
|
29
|
+
}
|
|
30
|
+
async createFromProps(schemaKey, propertyCategoryProps) {
|
|
31
|
+
const schema = await this._schemaEditor.getSchema(schemaKey);
|
|
32
|
+
if (schema === undefined)
|
|
33
|
+
return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
|
|
34
|
+
if (propertyCategoryProps.name === undefined)
|
|
35
|
+
return { errorMessage: `No name was supplied within props.` };
|
|
36
|
+
const newPropCategory = (await schema.createPropertyCategory(propertyCategoryProps.name));
|
|
37
|
+
if (newPropCategory === undefined)
|
|
38
|
+
return { errorMessage: `Failed to create class ${propertyCategoryProps.name} in schema ${schemaKey.toString(true)}.` };
|
|
39
|
+
await newPropCategory.fromJSON(propertyCategoryProps);
|
|
40
|
+
return { itemKey: newPropCategory.key };
|
|
41
|
+
}
|
|
42
|
+
async setPriority(propCategoryKey, priority) {
|
|
43
|
+
const propertyCategory = (await this._schemaEditor.schemaContext.getSchemaItem(propCategoryKey));
|
|
44
|
+
if (propertyCategory === undefined)
|
|
45
|
+
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Property Category ${propCategoryKey.fullName} not found in schema context.`);
|
|
46
|
+
if (propertyCategory.schemaItemType !== ecschema_metadata_1.SchemaItemType.PropertyCategory)
|
|
47
|
+
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${propCategoryKey.fullName} to be of type Property Category.`);
|
|
48
|
+
propertyCategory.setPriority(priority);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.PropertyCategories = PropertyCategories;
|
|
52
52
|
//# sourceMappingURL=PropertyCategories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyCategories.js","sourceRoot":"","sources":["../../../src/Editing/PropertyCategories.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA4I;AAI5I;;;GAGG;AACH,MAAa,kBAAkB;IAC7B,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAC7D,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,QAAgB,EAAE,YAAqB;QAC7F,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,eAAe,GAAG,CAAC,MAAM,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAA4B,CAAC;QAC/F,eAAe,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACtC,IAAI,YAAY;YACd,eAAe,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QAEhD,OAAO,EAAE,OAAO,EAAE,eAAe,CAAC,GAAG,EAAE,CAAC;IAC1C,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,qBAA4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;AA1CD,gDA0CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"PropertyCategories.js","sourceRoot":"","sources":["../../../src/Editing/PropertyCategories.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA4I;AAI5I;;;GAGG;AACH,MAAa,kBAAkB;IAC7B,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAC7D,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,QAAgB,EAAE,YAAqB;QAC7F,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,eAAe,GAAG,CAAC,MAAM,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAA4B,CAAC;QAC/F,eAAe,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACtC,IAAI,YAAY;YACd,eAAe,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QAEhD,OAAO,EAAE,OAAO,EAAE,eAAe,CAAC,GAAG,EAAE,CAAC;IAC1C,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,qBAA4C;QAC7F,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,IAAI,qBAAqB,CAAC,IAAI,KAAK,SAAS;YAC1C,OAAO,EAAE,YAAY,EAAE,oCAAoC,EAAE,CAAC;QAEhE,MAAM,eAAe,GAAG,CAAC,MAAM,MAAM,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAA4B,CAAC;QACrH,IAAI,eAAe,KAAK,SAAS;YAC/B,OAAO,EAAE,YAAY,EAAE,0BAA0B,qBAAqB,CAAC,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAEzH,MAAM,eAAe,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;QACtD,OAAO,EAAE,OAAO,EAAE,eAAe,CAAC,GAAG,EAAE,CAAC;IAC1C,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,eAA8B,EAAE,QAAgB;QACvE,MAAM,gBAAgB,GAAG,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,aAAa,CAA0B,eAAe,CAAC,CAAC,CAAC;QAE1H,IAAI,gBAAgB,KAAK,SAAS;YAChC,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,aAAa,EAAE,qBAAqB,eAAe,CAAC,QAAQ,+BAA+B,CAAC,CAAC;QAExI,IAAI,gBAAgB,CAAC,cAAc,KAAK,kCAAc,CAAC,gBAAgB;YACrE,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,qBAAqB,EAAE,YAAY,eAAe,CAAC,QAAQ,mCAAmC,CAAC,CAAC;QAE3I,gBAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;CACF;AA1CD,gDA0CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { ECObjectsError, ECObjectsStatus, PropertyCategoryProps, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\nimport { MutablePropertyCategory } from \"./Mutable/MutablePropertyCategory\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type Property Category.\n */\nexport class PropertyCategories {\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\n public async create(schemaKey: SchemaKey, name: string, priority: number, displayLabel?: string): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n const newPropCategory = (await schema.createPropertyCategory(name)) as MutablePropertyCategory;\n newPropCategory.setPriority(priority);\n if (displayLabel)\n newPropCategory.setDisplayLabel(displayLabel);\n\n return { itemKey: newPropCategory.key };\n }\n\n public async createFromProps(schemaKey: SchemaKey, propertyCategoryProps: PropertyCategoryProps): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n if (propertyCategoryProps.name === undefined)\n return { errorMessage: `No name was supplied within props.` };\n\n const newPropCategory = (await schema.createPropertyCategory(propertyCategoryProps.name)) as MutablePropertyCategory;\n if (newPropCategory === undefined)\n return { errorMessage: `Failed to create class ${propertyCategoryProps.name} in schema ${schemaKey.toString(true)}.` };\n\n await newPropCategory.fromJSON(propertyCategoryProps);\n return { itemKey: newPropCategory.key };\n }\n\n public async setPriority(propCategoryKey: SchemaItemKey, priority: number): Promise<void> {\n const propertyCategory = (await this._schemaEditor.schemaContext.getSchemaItem<MutablePropertyCategory>(propCategoryKey));\n\n if (propertyCategory === undefined)\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Property Category ${propCategoryKey.fullName} not found in schema context.`);\n\n if (propertyCategory.schemaItemType !== SchemaItemType.PropertyCategory)\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${propCategoryKey.fullName} to be of type Property Category.`);\n\n propertyCategory.setPriority(priority);\n }\n}\n"]}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module Editing
|
|
3
|
-
*/
|
|
4
|
-
import { RelationshipClass, RelationshipClassProps, SchemaItemKey, SchemaKey, StrengthDirection } from "@itwin/ecschema-metadata";
|
|
5
|
-
import { PropertyEditResults, SchemaContextEditor, SchemaItemEditResults } from "./Editor";
|
|
6
|
-
import { ECClasses } from "./ECClasses";
|
|
7
|
-
/**
|
|
8
|
-
* @alpha
|
|
9
|
-
* A class extending ECClasses allowing you to create schema items of type RelationshipClass.
|
|
10
|
-
* Can only create RelationshipClass objects using RelationshipClassProps for now.
|
|
11
|
-
*/
|
|
12
|
-
export declare class RelationshipClasses extends ECClasses {
|
|
13
|
-
constructor(_schemaEditor: SchemaContextEditor);
|
|
14
|
-
/**
|
|
15
|
-
* Creates a RelationshipClass through a RelationshipClassProps.
|
|
16
|
-
* @param schemaKey a SchemaKey of the Schema that will house the new object.
|
|
17
|
-
* @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.
|
|
18
|
-
*/
|
|
19
|
-
createFromProps(schemaKey: SchemaKey, relationshipProps: RelationshipClassProps): Promise<SchemaItemEditResults>;
|
|
20
|
-
createNavigationProperty(relationshipKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<PropertyEditResults>;
|
|
21
|
-
}
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Editing
|
|
3
|
+
*/
|
|
4
|
+
import { RelationshipClass, RelationshipClassProps, SchemaItemKey, SchemaKey, StrengthDirection } from "@itwin/ecschema-metadata";
|
|
5
|
+
import { PropertyEditResults, SchemaContextEditor, SchemaItemEditResults } from "./Editor";
|
|
6
|
+
import { ECClasses } from "./ECClasses";
|
|
7
|
+
/**
|
|
8
|
+
* @alpha
|
|
9
|
+
* A class extending ECClasses allowing you to create schema items of type RelationshipClass.
|
|
10
|
+
* Can only create RelationshipClass objects using RelationshipClassProps for now.
|
|
11
|
+
*/
|
|
12
|
+
export declare class RelationshipClasses extends ECClasses {
|
|
13
|
+
constructor(_schemaEditor: SchemaContextEditor);
|
|
14
|
+
/**
|
|
15
|
+
* Creates a RelationshipClass through a RelationshipClassProps.
|
|
16
|
+
* @param schemaKey a SchemaKey of the Schema that will house the new object.
|
|
17
|
+
* @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.
|
|
18
|
+
*/
|
|
19
|
+
createFromProps(schemaKey: SchemaKey, relationshipProps: RelationshipClassProps): Promise<SchemaItemEditResults>;
|
|
20
|
+
createNavigationProperty(relationshipKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<PropertyEditResults>;
|
|
21
|
+
}
|
|
22
22
|
//# sourceMappingURL=RelationshipClasses.d.ts.map
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module Editing
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.RelationshipClasses = void 0;
|
|
11
|
-
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
12
|
-
const ECClasses_1 = require("./ECClasses");
|
|
13
|
-
/**
|
|
14
|
-
* @alpha
|
|
15
|
-
* A class extending ECClasses allowing you to create schema items of type RelationshipClass.
|
|
16
|
-
* Can only create RelationshipClass objects using RelationshipClassProps for now.
|
|
17
|
-
*/
|
|
18
|
-
class RelationshipClasses extends ECClasses_1.ECClasses {
|
|
19
|
-
constructor(_schemaEditor) {
|
|
20
|
-
super(_schemaEditor);
|
|
21
|
-
}
|
|
22
|
-
// // TODO: Add relationshipConstraint, multiplicity arguments.
|
|
23
|
-
// // Note: This method is not done yet, there's a lot of arguments.
|
|
24
|
-
// public async create(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, strength: StrengthType, direction: StrengthDirection, sourceMultiplicity: RelationshipMultiplicity, targetMultiplicity: RelationshipMultiplicity, baseClass?: SchemaItemKey) {
|
|
25
|
-
// const schema = await this._schemaEditor.getSchema(schemaKey);
|
|
26
|
-
// if (schema === undefined) return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
|
|
27
|
-
// const newClass = (await schema.createRelationshipClass(name, modifier)) as MutableRelationshipClass;
|
|
28
|
-
// if (newClass === undefined) {
|
|
29
|
-
// return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };
|
|
30
|
-
// }
|
|
31
|
-
// if (baseClass !== undefined) {
|
|
32
|
-
// const baseClassItem = await schema.lookupItem(baseClass) as RelationshipClass;
|
|
33
|
-
// newClass.baseClass = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(baseClass, async () => baseClassItem);
|
|
34
|
-
// }
|
|
35
|
-
// newClass.setStrength(strength);
|
|
36
|
-
// newClass.setStrengthDirection(direction);
|
|
37
|
-
// return { itemKey: newClass.key };
|
|
38
|
-
// }
|
|
39
|
-
/**
|
|
40
|
-
* Creates a RelationshipClass through a RelationshipClassProps.
|
|
41
|
-
* @param schemaKey a SchemaKey of the Schema that will house the new object.
|
|
42
|
-
* @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.
|
|
43
|
-
*/
|
|
44
|
-
async createFromProps(schemaKey, relationshipProps) {
|
|
45
|
-
const schema = await this._schemaEditor.getSchema(schemaKey);
|
|
46
|
-
if (schema === undefined)
|
|
47
|
-
return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
|
|
48
|
-
if (relationshipProps.name === undefined)
|
|
49
|
-
return { errorMessage: `No name was supplied within props.` };
|
|
50
|
-
const newClass = (await schema.createRelationshipClass(relationshipProps.name));
|
|
51
|
-
if (newClass === undefined)
|
|
52
|
-
return { errorMessage: `Failed to create class ${relationshipProps.name} in schema ${schemaKey.toString(true)}.` };
|
|
53
|
-
await newClass.fromJSON(relationshipProps);
|
|
54
|
-
await newClass.source.fromJSON(relationshipProps.source);
|
|
55
|
-
await newClass.target.fromJSON(relationshipProps.target);
|
|
56
|
-
return { itemKey: newClass.key };
|
|
57
|
-
}
|
|
58
|
-
async createNavigationProperty(relationshipKey, name, relationship, direction) {
|
|
59
|
-
const relationshipClass = (await this._schemaEditor.schemaContext.getSchemaItem(relationshipKey));
|
|
60
|
-
if (relationshipClass === undefined)
|
|
61
|
-
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Relationship Class ${relationshipKey.fullName} not found in schema context.`);
|
|
62
|
-
if (relationshipClass.schemaItemType !== ecschema_metadata_1.SchemaItemType.RelationshipClass)
|
|
63
|
-
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${relationshipKey.fullName} to be of type Relationship Class.`);
|
|
64
|
-
await relationshipClass.createNavigationProperty(name, relationship, direction);
|
|
65
|
-
return { itemKey: relationshipKey, propertyName: name };
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.RelationshipClasses = RelationshipClasses;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Editing
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.RelationshipClasses = void 0;
|
|
11
|
+
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
12
|
+
const ECClasses_1 = require("./ECClasses");
|
|
13
|
+
/**
|
|
14
|
+
* @alpha
|
|
15
|
+
* A class extending ECClasses allowing you to create schema items of type RelationshipClass.
|
|
16
|
+
* Can only create RelationshipClass objects using RelationshipClassProps for now.
|
|
17
|
+
*/
|
|
18
|
+
class RelationshipClasses extends ECClasses_1.ECClasses {
|
|
19
|
+
constructor(_schemaEditor) {
|
|
20
|
+
super(_schemaEditor);
|
|
21
|
+
}
|
|
22
|
+
// // TODO: Add relationshipConstraint, multiplicity arguments.
|
|
23
|
+
// // Note: This method is not done yet, there's a lot of arguments.
|
|
24
|
+
// public async create(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, strength: StrengthType, direction: StrengthDirection, sourceMultiplicity: RelationshipMultiplicity, targetMultiplicity: RelationshipMultiplicity, baseClass?: SchemaItemKey) {
|
|
25
|
+
// const schema = await this._schemaEditor.getSchema(schemaKey);
|
|
26
|
+
// if (schema === undefined) return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
|
|
27
|
+
// const newClass = (await schema.createRelationshipClass(name, modifier)) as MutableRelationshipClass;
|
|
28
|
+
// if (newClass === undefined) {
|
|
29
|
+
// return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };
|
|
30
|
+
// }
|
|
31
|
+
// if (baseClass !== undefined) {
|
|
32
|
+
// const baseClassItem = await schema.lookupItem(baseClass) as RelationshipClass;
|
|
33
|
+
// newClass.baseClass = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(baseClass, async () => baseClassItem);
|
|
34
|
+
// }
|
|
35
|
+
// newClass.setStrength(strength);
|
|
36
|
+
// newClass.setStrengthDirection(direction);
|
|
37
|
+
// return { itemKey: newClass.key };
|
|
38
|
+
// }
|
|
39
|
+
/**
|
|
40
|
+
* Creates a RelationshipClass through a RelationshipClassProps.
|
|
41
|
+
* @param schemaKey a SchemaKey of the Schema that will house the new object.
|
|
42
|
+
* @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.
|
|
43
|
+
*/
|
|
44
|
+
async createFromProps(schemaKey, relationshipProps) {
|
|
45
|
+
const schema = await this._schemaEditor.getSchema(schemaKey);
|
|
46
|
+
if (schema === undefined)
|
|
47
|
+
return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
|
|
48
|
+
if (relationshipProps.name === undefined)
|
|
49
|
+
return { errorMessage: `No name was supplied within props.` };
|
|
50
|
+
const newClass = (await schema.createRelationshipClass(relationshipProps.name));
|
|
51
|
+
if (newClass === undefined)
|
|
52
|
+
return { errorMessage: `Failed to create class ${relationshipProps.name} in schema ${schemaKey.toString(true)}.` };
|
|
53
|
+
await newClass.fromJSON(relationshipProps);
|
|
54
|
+
await newClass.source.fromJSON(relationshipProps.source);
|
|
55
|
+
await newClass.target.fromJSON(relationshipProps.target);
|
|
56
|
+
return { itemKey: newClass.key };
|
|
57
|
+
}
|
|
58
|
+
async createNavigationProperty(relationshipKey, name, relationship, direction) {
|
|
59
|
+
const relationshipClass = (await this._schemaEditor.schemaContext.getSchemaItem(relationshipKey));
|
|
60
|
+
if (relationshipClass === undefined)
|
|
61
|
+
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Relationship Class ${relationshipKey.fullName} not found in schema context.`);
|
|
62
|
+
if (relationshipClass.schemaItemType !== ecschema_metadata_1.SchemaItemType.RelationshipClass)
|
|
63
|
+
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${relationshipKey.fullName} to be of type Relationship Class.`);
|
|
64
|
+
await relationshipClass.createNavigationProperty(name, relationship, direction);
|
|
65
|
+
return { itemKey: relationshipKey, propertyName: name };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.RelationshipClasses = RelationshipClasses;
|
|
69
69
|
//# sourceMappingURL=RelationshipClasses.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationshipClasses.js","sourceRoot":"","sources":["../../../src/Editing/RelationshipClasses.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAGkC;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;QAEzD,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;IACnC,CAAC;IAEM,KAAK,CAAC,wBAAwB,CAAC,eAA8B,EAAE,IAAY,EAAE,YAAwC,EAAE,SAAqC;QACjK,MAAM,iBAAiB,GAAG,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,aAAa,CAA2B,eAAe,CAAC,CAAC,CAAC;QAE5H,IAAI,iBAAiB,KAAK,SAAS;YACjC,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,aAAa,EAAE,sBAAsB,eAAe,CAAC,QAAQ,+BAA+B,CAAC,CAAC;QAEzI,IAAI,iBAAiB,CAAC,cAAc,KAAK,kCAAc,CAAC,iBAAiB;YACvE,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,qBAAqB,EAAE,YAAY,eAAe,CAAC,QAAQ,oCAAoC,CAAC,CAAC;QAE5I,MAAM,iBAAiB,CAAC,wBAAwB,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAChF,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IAC1D,CAAC;CACF;AA9DD,kDA8DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"RelationshipClasses.js","sourceRoot":"","sources":["../../../src/Editing/RelationshipClasses.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAGkC;AAElC,2CAAwC;AAGxC;;;;GAIG;AACH,MAAa,mBAAoB,SAAQ,qBAAS;IAChD,YAAmB,aAAkC;QACnD,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAED,+DAA+D;IAC/D,oEAAoE;IACpE,oQAAoQ;IACpQ,kEAAkE;IAClE,sHAAsH;IAEtH,yGAAyG;IACzG,kCAAkC;IAClC,wGAAwG;IACxG,MAAM;IAEN,mCAAmC;IACnC,qFAAqF;IACr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S;YACjC,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,aAAa,EAAE,sBAAsB,eAAe,CAAC,QAAQ,+BAA+B,CAAC,CAAC;QAEzI,IAAI,iBAAiB,CAAC,cAAc,KAAK,kCAAc,CAAC,iBAAiB;YACvE,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,qBAAqB,EAAE,YAAY,eAAe,CAAC,QAAQ,oCAAoC,CAAC,CAAC;QAE5I,MAAM,iBAAiB,CAAC,wBAAwB,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAChF,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IAC1D,CAAC;CACF;AA9DD,kDA8DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport {\n ECObjectsError, ECObjectsStatus, RelationshipClass, RelationshipClassProps, SchemaItemKey, SchemaItemType,\n SchemaKey, StrengthDirection,\n} from \"@itwin/ecschema-metadata\";\nimport { PropertyEditResults, SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\nimport { ECClasses } from \"./ECClasses\";\nimport { MutableRelationshipClass } from \"./Mutable/MutableRelationshipClass\";\n\n/**\n * @alpha\n * A class extending ECClasses allowing you to create schema items of type RelationshipClass.\n * Can only create RelationshipClass objects using RelationshipClassProps for now.\n */\nexport class RelationshipClasses extends ECClasses {\n public constructor(_schemaEditor: SchemaContextEditor) {\n super(_schemaEditor);\n }\n\n // // TODO: Add relationshipConstraint, multiplicity arguments.\n // // Note: This method is not done yet, there's a lot of arguments.\n // public async create(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, strength: StrengthType, direction: StrengthDirection, sourceMultiplicity: RelationshipMultiplicity, targetMultiplicity: RelationshipMultiplicity, baseClass?: SchemaItemKey) {\n // const schema = await this._schemaEditor.getSchema(schemaKey);\n // if (schema === undefined) return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n // const newClass = (await schema.createRelationshipClass(name, modifier)) as MutableRelationshipClass;\n // if (newClass === undefined) {\n // return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };\n // }\n\n // if (baseClass !== undefined) {\n // const baseClassItem = await schema.lookupItem(baseClass) as RelationshipClass;\n // newClass.baseClass = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(baseClass, async () => baseClassItem);\n // }\n // newClass.setStrength(strength);\n // newClass.setStrengthDirection(direction);\n\n // return { itemKey: newClass.key };\n // }\n\n /**\n * Creates a RelationshipClass through a RelationshipClassProps.\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\n * @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.\n */\n public async createFromProps(schemaKey: SchemaKey, relationshipProps: RelationshipClassProps): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n if (relationshipProps.name === undefined)\n return { errorMessage: `No name was supplied within props.` };\n\n const newClass = (await schema.createRelationshipClass(relationshipProps.name)) as MutableRelationshipClass;\n if (newClass === undefined)\n return { errorMessage: `Failed to create class ${relationshipProps.name} in schema ${schemaKey.toString(true)}.` };\n\n await newClass.fromJSON(relationshipProps);\n await newClass.source.fromJSON(relationshipProps.source);\n await newClass.target.fromJSON(relationshipProps.target);\n\n return { itemKey: newClass.key };\n }\n\n public async createNavigationProperty(relationshipKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<PropertyEditResults> {\n const relationshipClass = (await this._schemaEditor.schemaContext.getSchemaItem<MutableRelationshipClass>(relationshipKey));\n\n if (relationshipClass === undefined)\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Relationship Class ${relationshipKey.fullName} not found in schema context.`);\n\n if (relationshipClass.schemaItemType !== SchemaItemType.RelationshipClass)\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${relationshipKey.fullName} to be of type Relationship Class.`);\n\n await relationshipClass.createNavigationProperty(name, relationship, direction);\n return { itemKey: relationshipKey, propertyName: name };\n }\n}\n"]}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module Editing
|
|
3
|
-
*/
|
|
4
|
-
import { SchemaItemKey, SchemaKey, StructClassProps } from "@itwin/ecschema-metadata";
|
|
5
|
-
import { SchemaContextEditor, SchemaItemEditResults } from "./Editor";
|
|
6
|
-
import { ECClasses } from "./ECClasses";
|
|
7
|
-
/**
|
|
8
|
-
* @alpha A class extending ECClasses allowing you to create schema items of type StructClass.
|
|
9
|
-
*/
|
|
10
|
-
export declare class Structs extends ECClasses {
|
|
11
|
-
constructor(_schemaEditor: SchemaContextEditor);
|
|
12
|
-
create(schemaKey: SchemaKey, name: string, displayLabel?: string, baseClass?: SchemaItemKey): Promise<SchemaItemEditResults>;
|
|
13
|
-
/**
|
|
14
|
-
* Creates a StructClass through a StructClassProps.
|
|
15
|
-
* @param schemaKey a SchemaKey of the Schema that will house the new object.
|
|
16
|
-
* @param structProps a json object that will be used to populate the new StructClass. Needs a name value passed in.
|
|
17
|
-
*/
|
|
18
|
-
createFromProps(schemaKey: SchemaKey, structProps: StructClassProps): Promise<SchemaItemEditResults>;
|
|
19
|
-
}
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Editing
|
|
3
|
+
*/
|
|
4
|
+
import { SchemaItemKey, SchemaKey, StructClassProps } from "@itwin/ecschema-metadata";
|
|
5
|
+
import { SchemaContextEditor, SchemaItemEditResults } from "./Editor";
|
|
6
|
+
import { ECClasses } from "./ECClasses";
|
|
7
|
+
/**
|
|
8
|
+
* @alpha A class extending ECClasses allowing you to create schema items of type StructClass.
|
|
9
|
+
*/
|
|
10
|
+
export declare class Structs extends ECClasses {
|
|
11
|
+
constructor(_schemaEditor: SchemaContextEditor);
|
|
12
|
+
create(schemaKey: SchemaKey, name: string, displayLabel?: string, baseClass?: SchemaItemKey): Promise<SchemaItemEditResults>;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a StructClass through a StructClassProps.
|
|
15
|
+
* @param schemaKey a SchemaKey of the Schema that will house the new object.
|
|
16
|
+
* @param structProps a json object that will be used to populate the new StructClass. Needs a name value passed in.
|
|
17
|
+
*/
|
|
18
|
+
createFromProps(schemaKey: SchemaKey, structProps: StructClassProps): Promise<SchemaItemEditResults>;
|
|
19
|
+
}
|
|
20
20
|
//# sourceMappingURL=Structs.d.ts.map
|