@itwin/ecschema-editing 3.4.0-dev.9 → 3.5.0-dev.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/CHANGELOG.md +24 -1
  2. package/lib/cjs/Editing/Constants.d.ts +20 -20
  3. package/lib/cjs/Editing/Constants.d.ts.map +1 -1
  4. package/lib/cjs/Editing/Constants.js +60 -64
  5. package/lib/cjs/Editing/Constants.js.map +1 -1
  6. package/lib/cjs/Editing/CustomAttributes.d.ts +20 -20
  7. package/lib/cjs/Editing/CustomAttributes.d.ts.map +1 -1
  8. package/lib/cjs/Editing/CustomAttributes.js +59 -62
  9. package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
  10. package/lib/cjs/Editing/ECClasses.d.ts +54 -54
  11. package/lib/cjs/Editing/ECClasses.d.ts.map +1 -1
  12. package/lib/cjs/Editing/ECClasses.js +269 -269
  13. package/lib/cjs/Editing/ECClasses.js.map +1 -1
  14. package/lib/cjs/Editing/Editor.d.ts +112 -112
  15. package/lib/cjs/Editing/Editor.d.ts.map +1 -1
  16. package/lib/cjs/Editing/Editor.js +166 -166
  17. package/lib/cjs/Editing/Editor.js.map +1 -1
  18. package/lib/cjs/Editing/Entities.d.ts +25 -25
  19. package/lib/cjs/Editing/Entities.d.ts.map +1 -1
  20. package/lib/cjs/Editing/Entities.js +116 -124
  21. package/lib/cjs/Editing/Entities.js.map +1 -1
  22. package/lib/cjs/Editing/Enumerations.d.ts +21 -21
  23. package/lib/cjs/Editing/Enumerations.d.ts.map +1 -1
  24. package/lib/cjs/Editing/Enumerations.js +66 -76
  25. package/lib/cjs/Editing/Enumerations.js.map +1 -1
  26. package/lib/cjs/Editing/Formats.d.ts +21 -21
  27. package/lib/cjs/Editing/Formats.d.ts.map +1 -1
  28. package/lib/cjs/Editing/Formats.js +61 -63
  29. package/lib/cjs/Editing/Formats.js.map +1 -1
  30. package/lib/cjs/Editing/InvertedUnits.d.ts +17 -17
  31. package/lib/cjs/Editing/InvertedUnits.d.ts.map +1 -1
  32. package/lib/cjs/Editing/InvertedUnits.js +82 -85
  33. package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
  34. package/lib/cjs/Editing/KindOfQuantities.d.ts +28 -28
  35. package/lib/cjs/Editing/KindOfQuantities.d.ts.map +1 -1
  36. package/lib/cjs/Editing/KindOfQuantities.js +78 -79
  37. package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
  38. package/lib/cjs/Editing/Mixins.d.ts +22 -22
  39. package/lib/cjs/Editing/Mixins.d.ts.map +1 -1
  40. package/lib/cjs/Editing/Mixins.js +84 -88
  41. package/lib/cjs/Editing/Mixins.js.map +1 -1
  42. package/lib/cjs/Editing/Mutable/MutableCAClass.d.ts +9 -9
  43. package/lib/cjs/Editing/Mutable/MutableCAClass.js +15 -15
  44. package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
  45. package/lib/cjs/Editing/Mutable/MutableClass.d.ts +34 -34
  46. package/lib/cjs/Editing/Mutable/MutableClass.js +22 -22
  47. package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
  48. package/lib/cjs/Editing/Mutable/MutableConstant.d.ts +12 -12
  49. package/lib/cjs/Editing/Mutable/MutableConstant.js +15 -15
  50. package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
  51. package/lib/cjs/Editing/Mutable/MutableEntityClass.d.ts +15 -15
  52. package/lib/cjs/Editing/Mutable/MutableEntityClass.js +59 -59
  53. package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
  54. package/lib/cjs/Editing/Mutable/MutableEnumeration.d.ts +9 -9
  55. package/lib/cjs/Editing/Mutable/MutableEnumeration.js +14 -14
  56. package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
  57. package/lib/cjs/Editing/Mutable/MutableFormat.d.ts +18 -18
  58. package/lib/cjs/Editing/Mutable/MutableFormat.js +15 -15
  59. package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
  60. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.d.ts +10 -10
  61. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js +15 -15
  62. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
  63. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.d.ts +10 -10
  64. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js +15 -15
  65. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
  66. package/lib/cjs/Editing/Mutable/MutableMixin.d.ts +11 -11
  67. package/lib/cjs/Editing/Mutable/MutableMixin.js +15 -15
  68. package/lib/cjs/Editing/Mutable/MutableMixin.js.map +1 -1
  69. package/lib/cjs/Editing/Mutable/MutablePhenomenon.d.ts +9 -9
  70. package/lib/cjs/Editing/Mutable/MutablePhenomenon.js +15 -15
  71. package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
  72. package/lib/cjs/Editing/Mutable/MutableProperty.d.ts +8 -8
  73. package/lib/cjs/Editing/Mutable/MutableProperty.js +15 -15
  74. package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
  75. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.d.ts +9 -9
  76. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js +15 -15
  77. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
  78. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.d.ts +21 -21
  79. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js +24 -24
  80. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
  81. package/lib/cjs/Editing/Mutable/MutableSchema.d.ts +45 -45
  82. package/lib/cjs/Editing/Mutable/MutableSchema.js +17 -17
  83. package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
  84. package/lib/cjs/Editing/Mutable/MutableUnit.d.ts +11 -11
  85. package/lib/cjs/Editing/Mutable/MutableUnit.js +15 -15
  86. package/lib/cjs/Editing/Mutable/MutableUnit.js.map +1 -1
  87. package/lib/cjs/Editing/Mutable/MutableUnitSystem.d.ts +8 -8
  88. package/lib/cjs/Editing/Mutable/MutableUnitSystem.js +15 -15
  89. package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
  90. package/lib/cjs/Editing/Phenomena.d.ts +15 -15
  91. package/lib/cjs/Editing/Phenomena.d.ts.map +1 -1
  92. package/lib/cjs/Editing/Phenomena.js +44 -47
  93. package/lib/cjs/Editing/Phenomena.js.map +1 -1
  94. package/lib/cjs/Editing/PropertyCategories.d.ts +16 -16
  95. package/lib/cjs/Editing/PropertyCategories.d.ts.map +1 -1
  96. package/lib/cjs/Editing/PropertyCategories.js +51 -53
  97. package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
  98. package/lib/cjs/Editing/RelationshipClasses.d.ts +21 -21
  99. package/lib/cjs/Editing/RelationshipClasses.d.ts.map +1 -1
  100. package/lib/cjs/Editing/RelationshipClasses.js +68 -69
  101. package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
  102. package/lib/cjs/Editing/Structs.d.ts +19 -19
  103. package/lib/cjs/Editing/Structs.d.ts.map +1 -1
  104. package/lib/cjs/Editing/Structs.js +57 -60
  105. package/lib/cjs/Editing/Structs.js.map +1 -1
  106. package/lib/cjs/Editing/UnitSystems.d.ts +15 -15
  107. package/lib/cjs/Editing/UnitSystems.d.ts.map +1 -1
  108. package/lib/cjs/Editing/UnitSystems.js +41 -43
  109. package/lib/cjs/Editing/UnitSystems.js.map +1 -1
  110. package/lib/cjs/Editing/Units.d.ts +15 -15
  111. package/lib/cjs/Editing/Units.d.ts.map +1 -1
  112. package/lib/cjs/Editing/Units.js +58 -61
  113. package/lib/cjs/Editing/Units.js.map +1 -1
  114. package/lib/cjs/Validation/Diagnostic.d.ts +321 -321
  115. package/lib/cjs/Validation/Diagnostic.js +310 -310
  116. package/lib/cjs/Validation/Diagnostic.js.map +1 -1
  117. package/lib/cjs/Validation/DiagnosticReporter.d.ts +96 -96
  118. package/lib/cjs/Validation/DiagnosticReporter.d.ts.map +1 -1
  119. package/lib/cjs/Validation/DiagnosticReporter.js +106 -106
  120. package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
  121. package/lib/cjs/Validation/ECRules.d.ts +448 -438
  122. package/lib/cjs/Validation/ECRules.d.ts.map +1 -1
  123. package/lib/cjs/Validation/ECRules.js +593 -583
  124. package/lib/cjs/Validation/ECRules.js.map +1 -1
  125. package/lib/cjs/Validation/LoggingDiagnosticReporter.d.ts +13 -13
  126. package/lib/cjs/Validation/LoggingDiagnosticReporter.js +40 -40
  127. package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
  128. package/lib/cjs/Validation/RuleSuppressionSet.d.ts +59 -58
  129. package/lib/cjs/Validation/RuleSuppressionSet.d.ts.map +1 -1
  130. package/lib/cjs/Validation/RuleSuppressionSet.js +9 -9
  131. package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
  132. package/lib/cjs/Validation/Rules.d.ts +64 -64
  133. package/lib/cjs/Validation/Rules.js +9 -9
  134. package/lib/cjs/Validation/Rules.js.map +1 -1
  135. package/lib/cjs/Validation/SchemaChanges.d.ts +607 -607
  136. package/lib/cjs/Validation/SchemaChanges.js +1135 -1135
  137. package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
  138. package/lib/cjs/Validation/SchemaCompareDiagnostics.d.ts +422 -422
  139. package/lib/cjs/Validation/SchemaCompareDiagnostics.js +111 -111
  140. package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
  141. package/lib/cjs/Validation/SchemaCompareReporter.d.ts +11 -11
  142. package/lib/cjs/Validation/SchemaCompareReporter.js +9 -9
  143. package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
  144. package/lib/cjs/Validation/SchemaCompareResultDelegate.d.ts +236 -236
  145. package/lib/cjs/Validation/SchemaCompareResultDelegate.js +348 -348
  146. package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
  147. package/lib/cjs/Validation/SchemaCompareVisitor.d.ts +119 -119
  148. package/lib/cjs/Validation/SchemaCompareVisitor.js +206 -206
  149. package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
  150. package/lib/cjs/Validation/SchemaComparer.d.ts +171 -171
  151. package/lib/cjs/Validation/SchemaComparer.js +666 -666
  152. package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
  153. package/lib/cjs/Validation/SchemaValidater.d.ts +19 -19
  154. package/lib/cjs/Validation/SchemaValidater.js +61 -61
  155. package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
  156. package/lib/cjs/Validation/SchemaValidationVisitor.d.ts +170 -170
  157. package/lib/cjs/Validation/SchemaValidationVisitor.d.ts.map +1 -1
  158. package/lib/cjs/Validation/SchemaValidationVisitor.js +492 -490
  159. package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
  160. package/lib/cjs/Validation/SchemaWalker.d.ts +22 -22
  161. package/lib/cjs/Validation/SchemaWalker.js +51 -51
  162. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  163. package/lib/cjs/ecschema-editing.d.ts +33 -33
  164. package/lib/cjs/ecschema-editing.js +54 -54
  165. package/lib/cjs/ecschema-editing.js.map +1 -1
  166. package/package.json +11 -11
  167. package/public/locales/en/ECSchemaEditing.json +26 -26
package/CHANGELOG.md CHANGED
@@ -1,6 +1,29 @@
1
1
  # Change Log - @itwin/ecschema-editing
2
2
 
3
- This log was last generated on Tue, 09 Aug 2022 15:52:41 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 01 Sep 2022 14:37:22 GMT and should not be manually modified.
4
+
5
+ ## 3.3.2
6
+ Thu, 01 Sep 2022 14:37:22 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 3.3.1
11
+ Fri, 26 Aug 2022 15:40:02 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 3.3.0
16
+ Thu, 18 Aug 2022 19:08:02 GMT
17
+
18
+ ### Updates
19
+
20
+ - Added support for adding CustomAttributes to EC Classes and Properties.
21
+ - upgrade mocha to version 10.0.0
22
+
23
+ ## 3.2.9
24
+ Fri, 26 Aug 2022 14:21:40 GMT
25
+
26
+ _Version update only_
4
27
 
5
28
  ## 3.2.8
6
29
  Tue, 09 Aug 2022 15:52:41 GMT
@@ -1,21 +1,21 @@
1
- /** @packageDocumentation
2
- * @module Editing
3
- */
4
- import { ConstantProps, 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 Constant.
9
- */
10
- export declare class Constants {
11
- protected _schemaEditor: SchemaContextEditor;
12
- constructor(_schemaEditor: SchemaContextEditor);
13
- create(schemaKey: SchemaKey, name: string, phenomenon: SchemaItemKey, definition: string, displayLabel?: string, numerator?: number, denominator?: number): Promise<SchemaItemEditResults>;
14
- /**
15
- * Creates a Constant through a ConstantProps.
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, constantProps: ConstantProps): Promise<SchemaItemEditResults>;
20
- }
1
+ /** @packageDocumentation
2
+ * @module Editing
3
+ */
4
+ import { ConstantProps, 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 Constant.
9
+ */
10
+ export declare class Constants {
11
+ protected _schemaEditor: SchemaContextEditor;
12
+ constructor(_schemaEditor: SchemaContextEditor);
13
+ create(schemaKey: SchemaKey, name: string, phenomenon: SchemaItemKey, definition: string, displayLabel?: string, numerator?: number, denominator?: number): Promise<SchemaItemEditResults>;
14
+ /**
15
+ * Creates a Constant through a ConstantProps.
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, constantProps: ConstantProps): Promise<SchemaItemEditResults>;
20
+ }
21
21
  //# sourceMappingURL=Constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../../src/Editing/Constants.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAuC,aAAa,EAAkB,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACxI,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGtE;;;GAGG;AACH,qBAAa,SAAS;IACD,SAAS,CAAC,aAAa,EAAE,mBAAmB;gBAAlC,aAAa,EAAE,mBAAmB;IAElD,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAuBvM;;;;OAIG;IACU,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAajH"}
1
+ {"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../../src/Editing/Constants.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAuC,aAAa,EAAkB,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACxI,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGtE;;;GAGG;AACH,qBAAa,SAAS;IACD,SAAS,CAAC,aAAa,EAAE,mBAAmB;gBAAlC,aAAa,EAAE,mBAAmB;IAElD,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA6BvM;;;;OAIG;IACU,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAejH"}
@@ -1,65 +1,61 @@
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.Constants = 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 Constant.
15
- */
16
- class Constants {
17
- constructor(_schemaEditor) {
18
- this._schemaEditor = _schemaEditor;
19
- }
20
- async create(schemaKey, name, phenomenon, definition, displayLabel, numerator, denominator) {
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 newConstant = (await schema.createConstant(name));
25
- if (newConstant === undefined) {
26
- return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };
27
- }
28
- const newPhenomenon = (await this._schemaEditor.schemaContext.getSchemaItem(phenomenon));
29
- if (newPhenomenon === undefined || newPhenomenon.schemaItemType !== ecschema_metadata_1.SchemaItemType.Phenomenon) {
30
- return { errorMessage: `Unable to locate phenomenon ${phenomenon.name}` };
31
- }
32
- newConstant.setPhenomenon(new ecschema_metadata_1.DelayedPromiseWithProps(newPhenomenon.key, async () => newPhenomenon));
33
- newConstant.setDefinition(definition);
34
- if (numerator) {
35
- newConstant.setNumerator(numerator);
36
- }
37
- if (denominator) {
38
- newConstant.setDenominator(denominator);
39
- }
40
- if (displayLabel) {
41
- newConstant.setDisplayLabel(displayLabel);
42
- }
43
- return { itemKey: newConstant.key };
44
- }
45
- /**
46
- * Creates a Constant through a ConstantProps.
47
- * @param schemaKey a SchemaKey of the Schema that will house the new object.
48
- * @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.
49
- */
50
- async createFromProps(schemaKey, constantProps) {
51
- const schema = await this._schemaEditor.getSchema(schemaKey);
52
- if (schema === undefined)
53
- return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
54
- if (constantProps.name === undefined)
55
- return { errorMessage: `No name was supplied within props.` };
56
- const newConstant = (await schema.createConstant(constantProps.name));
57
- if (newConstant === undefined) {
58
- return { errorMessage: `Failed to create class ${constantProps.name} in schema ${schemaKey.toString(true)}.` };
59
- }
60
- await newConstant.fromJSON(constantProps);
61
- return { itemKey: newConstant.key };
62
- }
63
- }
64
- exports.Constants = Constants;
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.Constants = 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 Constant.
15
+ */
16
+ class Constants {
17
+ constructor(_schemaEditor) {
18
+ this._schemaEditor = _schemaEditor;
19
+ }
20
+ async create(schemaKey, name, phenomenon, definition, displayLabel, numerator, denominator) {
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 newConstant = (await schema.createConstant(name));
25
+ if (newConstant === undefined) {
26
+ return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };
27
+ }
28
+ const newPhenomenon = (await this._schemaEditor.schemaContext.getSchemaItem(phenomenon));
29
+ if (newPhenomenon === undefined || newPhenomenon.schemaItemType !== ecschema_metadata_1.SchemaItemType.Phenomenon) {
30
+ return { errorMessage: `Unable to locate phenomenon ${phenomenon.name}` };
31
+ }
32
+ newConstant.setPhenomenon(new ecschema_metadata_1.DelayedPromiseWithProps(newPhenomenon.key, async () => newPhenomenon));
33
+ newConstant.setDefinition(definition);
34
+ if (numerator)
35
+ newConstant.setNumerator(numerator);
36
+ if (denominator)
37
+ newConstant.setDenominator(denominator);
38
+ if (displayLabel)
39
+ newConstant.setDisplayLabel(displayLabel);
40
+ return { itemKey: newConstant.key };
41
+ }
42
+ /**
43
+ * Creates a Constant through a ConstantProps.
44
+ * @param schemaKey a SchemaKey of the Schema that will house the new object.
45
+ * @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.
46
+ */
47
+ async createFromProps(schemaKey, constantProps) {
48
+ const schema = await this._schemaEditor.getSchema(schemaKey);
49
+ if (schema === undefined)
50
+ return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
51
+ if (constantProps.name === undefined)
52
+ return { errorMessage: `No name was supplied within props.` };
53
+ const newConstant = (await schema.createConstant(constantProps.name));
54
+ if (newConstant === undefined)
55
+ return { errorMessage: `Failed to create class ${constantProps.name} in schema ${schemaKey.toString(true)}.` };
56
+ await newConstant.fromJSON(constantProps);
57
+ return { itemKey: newConstant.key };
58
+ }
59
+ }
60
+ exports.Constants = Constants;
65
61
  //# sourceMappingURL=Constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../src/Editing/Constants.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAwI;AAIxI;;;GAGG;AACH,MAAa,SAAS;IACpB,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAA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eAAe,CAAC,YAAY,CAAC,CAAC;SAAE;QAChE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,GAAG,EAAE,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,aAA4B;QAC7E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEjH,IAAI,aAAa,CAAC,IAAI,KAAK,SAAS;YAAE,OAAO,EAAE,YAAY,EAAE,oCAAoC,EAAE,CAAC;QACpG,MAAM,WAAW,GAAG,CAAC,MAAM,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;QACtE,IAAI,WAAW,KAAK,SAAS,EAAE;YAC7B,OAAO,EAAE,YAAY,EAAE,0BAA0B,aAAa,CAAC,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;SAChH;QAED,MAAM,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAC1C,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,GAAG,EAAE,CAAC;IACtC,CAAC;CACF;AA5CD,8BA4CC","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 { ConstantProps, DelayedPromiseWithProps, Phenomenon, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\r\nimport { MutableConstant } from \"./Mutable/MutableConstant\";\r\n\r\n/**\r\n * @alpha\r\n * A class allowing you to create schema items of type Constant.\r\n */\r\nexport class Constants {\r\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, phenomenon: SchemaItemKey, definition: string, displayLabel?: string, numerator?: number, denominator?: number): 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 newConstant = (await schema.createConstant(name)) as MutableConstant;\r\n if (newConstant === undefined) {\r\n return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };\r\n }\r\n\r\n const newPhenomenon = (await this._schemaEditor.schemaContext.getSchemaItem<Phenomenon>(phenomenon));\r\n if (newPhenomenon === undefined || newPhenomenon.schemaItemType !== SchemaItemType.Phenomenon) {\r\n return { errorMessage: `Unable to locate phenomenon ${phenomenon.name}` };\r\n }\r\n newConstant.setPhenomenon(new DelayedPromiseWithProps<SchemaItemKey, Phenomenon>(newPhenomenon.key, async () => newPhenomenon));\r\n newConstant.setDefinition(definition);\r\n\r\n if (numerator) { newConstant.setNumerator(numerator); }\r\n if (denominator) { newConstant.setDenominator(denominator); }\r\n if (displayLabel) { newConstant.setDisplayLabel(displayLabel); }\r\n return { itemKey: newConstant.key };\r\n }\r\n\r\n /**\r\n * Creates a Constant through a ConstantProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, constantProps: ConstantProps): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined) return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n if (constantProps.name === undefined) return { errorMessage: `No name was supplied within props.` };\r\n const newConstant = (await schema.createConstant(constantProps.name));\r\n if (newConstant === undefined) {\r\n return { errorMessage: `Failed to create class ${constantProps.name} in schema ${schemaKey.toString(true)}.` };\r\n }\r\n\r\n await newConstant.fromJSON(constantProps);\r\n return { itemKey: newConstant.key };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../src/Editing/Constants.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAwI;AAIxI;;;GAGG;AACH,MAAa,SAAS;IACpB,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAE7D,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,UAAyB,EAAE,UAAkB,EAAE,YAAqB,EAAE,SAAkB,EAAE,WAAoB;QACpK,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,WAAW,GAAG,CAAC,MAAM,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAoB,CAAC;QAC3E,IAAI,WAAW,KAAK,SAAS,EAAE;YAC7B,OAAO,EAAE,YAAY,EAAE,0BAA0B,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;SAClG;QAED,MAAM,aAAa,GAAG,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,aAAa,CAAa,UAAU,CAAC,CAAC,CAAC;QACrG,IAAI,aAAa,KAAK,SAAS,IAAI,aAAa,CAAC,cAAc,KAAK,kCAAc,CAAC,UAAU,EAAE;YAC7F,OAAO,EAAE,YAAY,EAAE,+BAA+B,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC;SAC3E;QACD,WAAW,CAAC,aAAa,CAAC,IAAI,2CAAuB,CAA4B,aAAa,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;QAChI,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAEtC,IAAI,SAAS;YACX,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAEtC,IAAI,WAAW;YACb,WAAW,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QAE1C,IAAI,YAAY;YACd,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QAE5C,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,GAAG,EAAE,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,aAA4B;QAC7E,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,aAAa,CAAC,IAAI,KAAK,SAAS;YAClC,OAAO,EAAE,YAAY,EAAE,oCAAoC,EAAE,CAAC;QAEhE,MAAM,WAAW,GAAG,CAAC,MAAM,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;QACtE,IAAI,WAAW,KAAK,SAAS;YAC3B,OAAO,EAAE,YAAY,EAAE,0BAA0B,aAAa,CAAC,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAEjH,MAAM,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAC1C,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,GAAG,EAAE,CAAC;IACtC,CAAC;CACF;AApDD,8BAoDC","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 { ConstantProps, DelayedPromiseWithProps, Phenomenon, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\nimport { MutableConstant } from \"./Mutable/MutableConstant\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type Constant.\n */\nexport class Constants {\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\n\n public async create(schemaKey: SchemaKey, name: string, phenomenon: SchemaItemKey, definition: string, displayLabel?: string, numerator?: number, denominator?: number): 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 newConstant = (await schema.createConstant(name)) as MutableConstant;\n if (newConstant === undefined) {\n return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };\n }\n\n const newPhenomenon = (await this._schemaEditor.schemaContext.getSchemaItem<Phenomenon>(phenomenon));\n if (newPhenomenon === undefined || newPhenomenon.schemaItemType !== SchemaItemType.Phenomenon) {\n return { errorMessage: `Unable to locate phenomenon ${phenomenon.name}` };\n }\n newConstant.setPhenomenon(new DelayedPromiseWithProps<SchemaItemKey, Phenomenon>(newPhenomenon.key, async () => newPhenomenon));\n newConstant.setDefinition(definition);\n\n if (numerator)\n newConstant.setNumerator(numerator);\n\n if (denominator)\n newConstant.setDenominator(denominator);\n\n if (displayLabel)\n newConstant.setDisplayLabel(displayLabel);\n\n return { itemKey: newConstant.key };\n }\n\n /**\n * Creates a Constant through a ConstantProps.\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, constantProps: ConstantProps): 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 (constantProps.name === undefined)\n return { errorMessage: `No name was supplied within props.` };\n\n const newConstant = (await schema.createConstant(constantProps.name));\n if (newConstant === undefined)\n return { errorMessage: `Failed to create class ${constantProps.name} in schema ${schemaKey.toString(true)}.` };\n\n await newConstant.fromJSON(constantProps);\n return { itemKey: newConstant.key };\n }\n}\n"]}
@@ -1,21 +1,21 @@
1
- /** @packageDocumentation
2
- * @module Editing
3
- */
4
- import { CustomAttributeClassProps, CustomAttributeContainerType, SchemaItemKey, SchemaKey } from "@itwin/ecschema-metadata";
5
- import { 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 CustomAttributeClass.
10
- */
11
- export declare class CustomAttributes extends ECClasses {
12
- constructor(_schemaEditor: SchemaContextEditor);
13
- create(schemaKey: SchemaKey, name: string, containerType: CustomAttributeContainerType, displayLabel?: string, baseClass?: SchemaItemKey): Promise<SchemaItemEditResults>;
14
- /**
15
- * Creates a CustomAttributeClass through a CustomAttributeClassProps.
16
- * @param schemaKey a SchemaKey of the Schema that will house the new object.
17
- * @param caProps a json object that will be used to populate the new CustomAttributeClass. Needs a name value passed in.
18
- */
19
- createFromProps(schemaKey: SchemaKey, caProps: CustomAttributeClassProps): Promise<SchemaItemEditResults>;
20
- }
1
+ /** @packageDocumentation
2
+ * @module Editing
3
+ */
4
+ import { CustomAttributeClassProps, CustomAttributeContainerType, SchemaItemKey, SchemaKey } from "@itwin/ecschema-metadata";
5
+ import { 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 CustomAttributeClass.
10
+ */
11
+ export declare class CustomAttributes extends ECClasses {
12
+ constructor(_schemaEditor: SchemaContextEditor);
13
+ create(schemaKey: SchemaKey, name: string, containerType: CustomAttributeContainerType, displayLabel?: string, baseClass?: SchemaItemKey): Promise<SchemaItemEditResults>;
14
+ /**
15
+ * Creates a CustomAttributeClass through a CustomAttributeClassProps.
16
+ * @param schemaKey a SchemaKey of the Schema that will house the new object.
17
+ * @param caProps a json object that will be used to populate the new CustomAttributeClass. Needs a name value passed in.
18
+ */
19
+ createFromProps(schemaKey: SchemaKey, caProps: CustomAttributeClassProps): Promise<SchemaItemEditResults>;
20
+ }
21
21
  //# sourceMappingURL=CustomAttributes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomAttributes.d.ts","sourceRoot":"","sources":["../../../src/Editing/CustomAttributes.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,yBAAyB,EAAE,4BAA4B,EACvD,aAAa,EAAkB,SAAS,EACzC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;gBAC1B,aAAa,EAAE,mBAAmB;IAIxC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,4BAA4B,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAsBtL;;;;OAIG;IACU,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAavH"}
1
+ {"version":3,"file":"CustomAttributes.d.ts","sourceRoot":"","sources":["../../../src/Editing/CustomAttributes.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,yBAAyB,EAAE,4BAA4B,EACvD,aAAa,EAAkB,SAAS,EACzC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;gBAC1B,aAAa,EAAE,mBAAmB;IAIxC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,4BAA4B,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA4BtL;;;;OAIG;IACU,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAgBvH"}
@@ -1,63 +1,60 @@
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.CustomAttributes = 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 CustomAttributeClass.
16
- */
17
- class CustomAttributes extends ECClasses_1.ECClasses {
18
- constructor(_schemaEditor) {
19
- super(_schemaEditor);
20
- }
21
- async create(schemaKey, name, containerType, displayLabel, baseClass) {
22
- const schema = await this._schemaEditor.getSchema(schemaKey);
23
- if (schema === undefined)
24
- return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
25
- const newClass = (await schema.createCustomAttributeClass(name));
26
- if (newClass === undefined) {
27
- return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };
28
- }
29
- if (baseClass !== undefined) {
30
- const baseClassItem = await schema.lookupItem(baseClass);
31
- if (baseClassItem === undefined)
32
- return { errorMessage: `Unable to locate base class ${baseClass.fullName} in schema ${schema.fullName}.` };
33
- if (baseClassItem.schemaItemType !== ecschema_metadata_1.SchemaItemType.CustomAttributeClass)
34
- return { errorMessage: `${baseClassItem.fullName} is not of type CustomAttribute Class.` };
35
- newClass.baseClass = new ecschema_metadata_1.DelayedPromiseWithProps(baseClass, async () => baseClassItem);
36
- }
37
- if (displayLabel) {
38
- newClass.setDisplayLabel(displayLabel);
39
- }
40
- newClass.setContainerType(containerType);
41
- return { itemKey: newClass.key };
42
- }
43
- /**
44
- * Creates a CustomAttributeClass through a CustomAttributeClassProps.
45
- * @param schemaKey a SchemaKey of the Schema that will house the new object.
46
- * @param caProps a json object that will be used to populate the new CustomAttributeClass. Needs a name value passed in.
47
- */
48
- async createFromProps(schemaKey, caProps) {
49
- const schema = await this._schemaEditor.getSchema(schemaKey);
50
- if (schema === undefined)
51
- return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
52
- if (caProps.name === undefined)
53
- return { errorMessage: `No name was supplied within props.` };
54
- const newClass = (await schema.createCustomAttributeClass(caProps.name));
55
- if (newClass === undefined) {
56
- return { errorMessage: `Failed to create class ${caProps.name} in schema ${schemaKey.toString(true)}.` };
57
- }
58
- await newClass.fromJSON(caProps);
59
- return { itemKey: newClass.key };
60
- }
61
- }
62
- exports.CustomAttributes = CustomAttributes;
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.CustomAttributes = 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 CustomAttributeClass.
16
+ */
17
+ class CustomAttributes extends ECClasses_1.ECClasses {
18
+ constructor(_schemaEditor) {
19
+ super(_schemaEditor);
20
+ }
21
+ async create(schemaKey, name, containerType, displayLabel, baseClass) {
22
+ const schema = await this._schemaEditor.getSchema(schemaKey);
23
+ if (schema === undefined)
24
+ return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
25
+ const newClass = (await schema.createCustomAttributeClass(name));
26
+ if (newClass === undefined)
27
+ return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };
28
+ if (baseClass !== undefined) {
29
+ const baseClassItem = await schema.lookupItem(baseClass);
30
+ if (baseClassItem === undefined)
31
+ return { errorMessage: `Unable to locate base class ${baseClass.fullName} in schema ${schema.fullName}.` };
32
+ if (baseClassItem.schemaItemType !== ecschema_metadata_1.SchemaItemType.CustomAttributeClass)
33
+ return { errorMessage: `${baseClassItem.fullName} is not of type CustomAttribute Class.` };
34
+ newClass.baseClass = new ecschema_metadata_1.DelayedPromiseWithProps(baseClass, async () => baseClassItem);
35
+ }
36
+ if (displayLabel)
37
+ newClass.setDisplayLabel(displayLabel);
38
+ newClass.setContainerType(containerType);
39
+ return { itemKey: newClass.key };
40
+ }
41
+ /**
42
+ * Creates a CustomAttributeClass through a CustomAttributeClassProps.
43
+ * @param schemaKey a SchemaKey of the Schema that will house the new object.
44
+ * @param caProps a json object that will be used to populate the new CustomAttributeClass. Needs a name value passed in.
45
+ */
46
+ async createFromProps(schemaKey, caProps) {
47
+ const schema = await this._schemaEditor.getSchema(schemaKey);
48
+ if (schema === undefined)
49
+ return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
50
+ if (caProps.name === undefined)
51
+ return { errorMessage: `No name was supplied within props.` };
52
+ const newClass = (await schema.createCustomAttributeClass(caProps.name));
53
+ if (newClass === undefined)
54
+ return { errorMessage: `Failed to create class ${caProps.name} in schema ${schemaKey.toString(true)}.` };
55
+ await newClass.fromJSON(caProps);
56
+ return { itemKey: newClass.key };
57
+ }
58
+ }
59
+ exports.CustomAttributes = CustomAttributes;
63
60
  //# sourceMappingURL=CustomAttributes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomAttributes.js","sourceRoot":"","sources":["../../../src/Editing/CustomAttributes.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAGkC;AAElC,2CAAwC;AAGxC;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,qBAAS;IAC7C,YAAmB,aAAkC;QACnD,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,aAA2C,EAAE,YAAqB,EAAE,SAAyB;QACnJ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEjH,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAmB,CAAC;QACnF,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,OAAO,EAAE,YAAY,EAAE,0BAA0B,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;SAClG;QAED,IAAI,SAAS,KAAK,SAAS,EAAE;YAC3B,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,UAAU,CAAU,SAAS,CAAC,CAAC;YAClE,IAAI,aAAa,KAAK,SAAS;gBAAE,OAAO,EAAE,YAAY,EAAE,+BAA+B,SAAS,CAAC,QAAQ,cAAc,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC;YAC5I,IAAI,aAAa,CAAC,cAAc,KAAK,kCAAc,CAAC,oBAAoB;gBAA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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 CustomAttributeClassProps, CustomAttributeContainerType, DelayedPromiseWithProps, ECClass,\r\n SchemaItemKey, SchemaItemType, SchemaKey,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableCAClass } from \"./Mutable/MutableCAClass\";\r\n\r\n/**\r\n * @alpha\r\n * A class extending ECClasses allowing you to create schema items of type CustomAttributeClass.\r\n */\r\nexport class CustomAttributes extends ECClasses {\r\n public constructor(_schemaEditor: SchemaContextEditor) {\r\n super(_schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, containerType: CustomAttributeContainerType, displayLabel?: string, baseClass?: SchemaItemKey): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined) return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n const newClass = (await schema.createCustomAttributeClass(name)) as MutableCAClass;\r\n if (newClass === undefined) {\r\n return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };\r\n }\r\n\r\n if (baseClass !== undefined) {\r\n const baseClassItem = await schema.lookupItem<ECClass>(baseClass);\r\n if (baseClassItem === undefined) return { errorMessage: `Unable to locate base class ${baseClass.fullName} in schema ${schema.fullName}.` };\r\n if (baseClassItem.schemaItemType !== SchemaItemType.CustomAttributeClass) return { errorMessage: `${baseClassItem.fullName} is not of type CustomAttribute Class.` };\r\n newClass.baseClass = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(baseClass, async () => baseClassItem);\r\n }\r\n if (displayLabel) { newClass.setDisplayLabel(displayLabel); }\r\n\r\n newClass.setContainerType(containerType);\r\n\r\n return { itemKey: newClass.key };\r\n }\r\n\r\n /**\r\n * Creates a CustomAttributeClass through a CustomAttributeClassProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param caProps a json object that will be used to populate the new CustomAttributeClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, caProps: CustomAttributeClassProps): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined) return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n if (caProps.name === undefined) return { errorMessage: `No name was supplied within props.` };\r\n const newClass = (await schema.createCustomAttributeClass(caProps.name)) as MutableCAClass;\r\n if (newClass === undefined) {\r\n return { errorMessage: `Failed to create class ${caProps.name} in schema ${schemaKey.toString(true)}.` };\r\n }\r\n await newClass.fromJSON(caProps);\r\n\r\n return { itemKey: newClass.key };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"CustomAttributes.js","sourceRoot":"","sources":["../../../src/Editing/CustomAttributes.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAGkC;AAElC,2CAAwC;AAGxC;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,qBAAS;IAC7C,YAAmB,aAAkC;QACnD,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,aAA2C,EAAE,YAAqB,EAAE,SAAyB;QACnJ,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,GAAG,CAAC,MAAM,MAAM,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAmB,CAAC;QACnF,IAAI,QAAQ,KAAK,SAA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O,CAAC,IAAI,CAAC,CAAmB,CAAC;QAC3F,IAAI,QAAQ,KAAK,SAAS;YACxB,OAAO,EAAE,YAAY,EAAE,0BAA0B,OAAO,CAAC,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAE3G,MAAM,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEjC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;IACnC,CAAC;CACF;AAtDD,4CAsDC","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 CustomAttributeClassProps, CustomAttributeContainerType, DelayedPromiseWithProps, ECClass,\n SchemaItemKey, SchemaItemType, SchemaKey,\n} from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\nimport { ECClasses } from \"./ECClasses\";\nimport { MutableCAClass } from \"./Mutable/MutableCAClass\";\n\n/**\n * @alpha\n * A class extending ECClasses allowing you to create schema items of type CustomAttributeClass.\n */\nexport class CustomAttributes extends ECClasses {\n public constructor(_schemaEditor: SchemaContextEditor) {\n super(_schemaEditor);\n }\n\n public async create(schemaKey: SchemaKey, name: string, containerType: CustomAttributeContainerType, displayLabel?: string, baseClass?: SchemaItemKey): 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 newClass = (await schema.createCustomAttributeClass(name)) as MutableCAClass;\n if (newClass === undefined)\n return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };\n\n if (baseClass !== undefined) {\n const baseClassItem = await schema.lookupItem<ECClass>(baseClass);\n if (baseClassItem === undefined)\n return { errorMessage: `Unable to locate base class ${baseClass.fullName} in schema ${schema.fullName}.` };\n\n if (baseClassItem.schemaItemType !== SchemaItemType.CustomAttributeClass)\n return { errorMessage: `${baseClassItem.fullName} is not of type CustomAttribute Class.` };\n\n newClass.baseClass = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(baseClass, async () => baseClassItem);\n }\n\n if (displayLabel)\n newClass.setDisplayLabel(displayLabel);\n\n newClass.setContainerType(containerType);\n\n return { itemKey: newClass.key };\n }\n\n /**\n * Creates a CustomAttributeClass through a CustomAttributeClassProps.\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\n * @param caProps a json object that will be used to populate the new CustomAttributeClass. Needs a name value passed in.\n */\n public async createFromProps(schemaKey: SchemaKey, caProps: CustomAttributeClassProps): 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 (caProps.name === undefined)\n return { errorMessage: `No name was supplied within props.` };\n\n const newClass = (await schema.createCustomAttributeClass(caProps.name)) as MutableCAClass;\n if (newClass === undefined)\n return { errorMessage: `Failed to create class ${caProps.name} in schema ${schemaKey.toString(true)}.` };\n\n await newClass.fromJSON(caProps);\n\n return { itemKey: newClass.key };\n }\n}\n"]}
@@ -1,55 +1,55 @@
1
- /** @packageDocumentation
2
- * @module Editing
3
- */
4
- import { CustomAttribute, Enumeration, EnumerationPropertyProps, PrimitiveArrayPropertyProps, PrimitivePropertyProps, PrimitiveType, SchemaItemKey, StructArrayPropertyProps, StructClass, StructPropertyProps } from "@itwin/ecschema-metadata";
5
- import { PropertyEditResults, SchemaContextEditor, SchemaItemEditResults } from "./Editor";
6
- /**
7
- * @alpha
8
- * Acts as a base class for schema class creation. Enables property creation.
9
- */
10
- export declare class ECClasses {
11
- protected _schemaEditor: SchemaContextEditor;
12
- protected constructor(_schemaEditor: SchemaContextEditor);
13
- /**
14
- * Creates a property on class identified by the given SchemaItemKey. This method restricts the
15
- * property type to primitives of type Double, String, DateTime and Integer.
16
- * @param classKey The SchemaItemKey of the class.
17
- * @param name The name of the new property.
18
- * @param type The PrimitiveType assigned to the new property.
19
- */
20
- createProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType, prefix: string): Promise<PropertyEditResults>;
21
- /**
22
- * Create a primitive property on class identified by the given SchemaItemKey.
23
- * @param classKey The SchemaItemKey of the class.
24
- * @param name The name of the new property.
25
- * @param type The PrimitiveType assigned to the new property.
26
- */
27
- createPrimitiveProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType): Promise<PropertyEditResults>;
28
- createPrimitivePropertyFromProps(classKey: SchemaItemKey, name: string, type: PrimitiveType, primitiveProps: PrimitivePropertyProps): Promise<PropertyEditResults>;
29
- createEnumerationProperty(classKey: SchemaItemKey, name: string, type: Enumeration): Promise<PropertyEditResults>;
30
- createEnumerationPropertyFromProps(classKey: SchemaItemKey, name: string, type: Enumeration, enumProps: EnumerationPropertyProps): Promise<PropertyEditResults>;
31
- createPrimitiveArrayProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType): Promise<PropertyEditResults>;
32
- createPrimitiveArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: PrimitiveType, primitiveProps: PrimitiveArrayPropertyProps): Promise<PropertyEditResults>;
33
- createStructProperty(classKey: SchemaItemKey, name: string, type: StructClass): Promise<PropertyEditResults>;
34
- createStructPropertyFromProps(classKey: SchemaItemKey, name: string, type: StructClass, structProps: StructPropertyProps): Promise<PropertyEditResults>;
35
- createStructArrayProperty(classKey: SchemaItemKey, name: string, type: StructClass): Promise<PropertyEditResults>;
36
- createStructArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: StructClass, structProps: StructArrayPropertyProps): Promise<PropertyEditResults>;
37
- deleteProperty(classKey: SchemaItemKey, name: string): Promise<PropertyEditResults>;
38
- delete(classKey: SchemaItemKey): Promise<SchemaItemEditResults>;
39
- /**
40
- * Adds a CustomAttribute instance to the Class identified by the given SchemaItemKey
41
- * @param classKey The SchemaItemKey identifying the schema.
42
- * @param customAttribute The CustomAttribute instance to add.
43
- */
44
- addCustomAttribute(classKey: SchemaItemKey, customAttribute: CustomAttribute): Promise<SchemaItemEditResults>;
45
- /**
46
- * Adds a CustomAttribute instance to the Property identified by the given SchemaItemKey and property name.
47
- * @param classKey The SchemaItemKey identifying the class.
48
- * @param propertyName The name of the property.
49
- * @param customAttribute The CustomAttribute instance to add.
50
- */
51
- addCustomAttributeToProperty(classKey: SchemaItemKey, propertyName: string, customAttribute: CustomAttribute): Promise<PropertyEditResults>;
52
- private getClass;
53
- private removeCustomAttribute;
54
- }
1
+ /** @packageDocumentation
2
+ * @module Editing
3
+ */
4
+ import { CustomAttribute, Enumeration, EnumerationPropertyProps, PrimitiveArrayPropertyProps, PrimitivePropertyProps, PrimitiveType, SchemaItemKey, StructArrayPropertyProps, StructClass, StructPropertyProps } from "@itwin/ecschema-metadata";
5
+ import { PropertyEditResults, SchemaContextEditor, SchemaItemEditResults } from "./Editor";
6
+ /**
7
+ * @alpha
8
+ * Acts as a base class for schema class creation. Enables property creation.
9
+ */
10
+ export declare class ECClasses {
11
+ protected _schemaEditor: SchemaContextEditor;
12
+ protected constructor(_schemaEditor: SchemaContextEditor);
13
+ /**
14
+ * Creates a property on class identified by the given SchemaItemKey. This method restricts the
15
+ * property type to primitives of type Double, String, DateTime and Integer.
16
+ * @param classKey The SchemaItemKey of the class.
17
+ * @param name The name of the new property.
18
+ * @param type The PrimitiveType assigned to the new property.
19
+ */
20
+ createProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType, prefix: string): Promise<PropertyEditResults>;
21
+ /**
22
+ * Create a primitive property on class identified by the given SchemaItemKey.
23
+ * @param classKey The SchemaItemKey of the class.
24
+ * @param name The name of the new property.
25
+ * @param type The PrimitiveType assigned to the new property.
26
+ */
27
+ createPrimitiveProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType): Promise<PropertyEditResults>;
28
+ createPrimitivePropertyFromProps(classKey: SchemaItemKey, name: string, type: PrimitiveType, primitiveProps: PrimitivePropertyProps): Promise<PropertyEditResults>;
29
+ createEnumerationProperty(classKey: SchemaItemKey, name: string, type: Enumeration): Promise<PropertyEditResults>;
30
+ createEnumerationPropertyFromProps(classKey: SchemaItemKey, name: string, type: Enumeration, enumProps: EnumerationPropertyProps): Promise<PropertyEditResults>;
31
+ createPrimitiveArrayProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType): Promise<PropertyEditResults>;
32
+ createPrimitiveArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: PrimitiveType, primitiveProps: PrimitiveArrayPropertyProps): Promise<PropertyEditResults>;
33
+ createStructProperty(classKey: SchemaItemKey, name: string, type: StructClass): Promise<PropertyEditResults>;
34
+ createStructPropertyFromProps(classKey: SchemaItemKey, name: string, type: StructClass, structProps: StructPropertyProps): Promise<PropertyEditResults>;
35
+ createStructArrayProperty(classKey: SchemaItemKey, name: string, type: StructClass): Promise<PropertyEditResults>;
36
+ createStructArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: StructClass, structProps: StructArrayPropertyProps): Promise<PropertyEditResults>;
37
+ deleteProperty(classKey: SchemaItemKey, name: string): Promise<PropertyEditResults>;
38
+ delete(classKey: SchemaItemKey): Promise<SchemaItemEditResults>;
39
+ /**
40
+ * Adds a CustomAttribute instance to the Class identified by the given SchemaItemKey
41
+ * @param classKey The SchemaItemKey identifying the schema.
42
+ * @param customAttribute The CustomAttribute instance to add.
43
+ */
44
+ addCustomAttribute(classKey: SchemaItemKey, customAttribute: CustomAttribute): Promise<SchemaItemEditResults>;
45
+ /**
46
+ * Adds a CustomAttribute instance to the Property identified by the given SchemaItemKey and property name.
47
+ * @param classKey The SchemaItemKey identifying the class.
48
+ * @param propertyName The name of the property.
49
+ * @param customAttribute The CustomAttribute instance to add.
50
+ */
51
+ addCustomAttributeToProperty(classKey: SchemaItemKey, propertyName: string, customAttribute: CustomAttribute): Promise<PropertyEditResults>;
52
+ private getClass;
53
+ private removeCustomAttribute;
54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