@itwin/ecschema-editing 3.4.0-dev.43 → 3.4.0-dev.44

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 (146) hide show
  1. package/lib/cjs/Editing/Constants.d.ts +20 -20
  2. package/lib/cjs/Editing/Constants.js +64 -64
  3. package/lib/cjs/Editing/Constants.js.map +1 -1
  4. package/lib/cjs/Editing/CustomAttributes.d.ts +20 -20
  5. package/lib/cjs/Editing/CustomAttributes.js +62 -62
  6. package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
  7. package/lib/cjs/Editing/ECClasses.d.ts +54 -54
  8. package/lib/cjs/Editing/ECClasses.js +269 -269
  9. package/lib/cjs/Editing/ECClasses.js.map +1 -1
  10. package/lib/cjs/Editing/Editor.d.ts +112 -112
  11. package/lib/cjs/Editing/Editor.js +166 -166
  12. package/lib/cjs/Editing/Editor.js.map +1 -1
  13. package/lib/cjs/Editing/Entities.d.ts +25 -25
  14. package/lib/cjs/Editing/Entities.js +124 -124
  15. package/lib/cjs/Editing/Entities.js.map +1 -1
  16. package/lib/cjs/Editing/Enumerations.d.ts +21 -21
  17. package/lib/cjs/Editing/Enumerations.js +76 -76
  18. package/lib/cjs/Editing/Enumerations.js.map +1 -1
  19. package/lib/cjs/Editing/Formats.d.ts +21 -21
  20. package/lib/cjs/Editing/Formats.js +63 -63
  21. package/lib/cjs/Editing/Formats.js.map +1 -1
  22. package/lib/cjs/Editing/InvertedUnits.d.ts +17 -17
  23. package/lib/cjs/Editing/InvertedUnits.js +85 -85
  24. package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
  25. package/lib/cjs/Editing/KindOfQuantities.d.ts +28 -28
  26. package/lib/cjs/Editing/KindOfQuantities.js +79 -79
  27. package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
  28. package/lib/cjs/Editing/Mixins.d.ts +22 -22
  29. package/lib/cjs/Editing/Mixins.js +88 -88
  30. package/lib/cjs/Editing/Mixins.js.map +1 -1
  31. package/lib/cjs/Editing/Mutable/MutableCAClass.d.ts +9 -9
  32. package/lib/cjs/Editing/Mutable/MutableCAClass.js +15 -15
  33. package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
  34. package/lib/cjs/Editing/Mutable/MutableClass.d.ts +34 -34
  35. package/lib/cjs/Editing/Mutable/MutableClass.js +22 -22
  36. package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
  37. package/lib/cjs/Editing/Mutable/MutableConstant.d.ts +12 -12
  38. package/lib/cjs/Editing/Mutable/MutableConstant.js +15 -15
  39. package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
  40. package/lib/cjs/Editing/Mutable/MutableEntityClass.d.ts +15 -15
  41. package/lib/cjs/Editing/Mutable/MutableEntityClass.js +59 -59
  42. package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
  43. package/lib/cjs/Editing/Mutable/MutableEnumeration.d.ts +9 -9
  44. package/lib/cjs/Editing/Mutable/MutableEnumeration.js +14 -14
  45. package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
  46. package/lib/cjs/Editing/Mutable/MutableFormat.d.ts +18 -18
  47. package/lib/cjs/Editing/Mutable/MutableFormat.js +15 -15
  48. package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
  49. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.d.ts +10 -10
  50. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js +15 -15
  51. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
  52. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.d.ts +10 -10
  53. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js +15 -15
  54. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
  55. package/lib/cjs/Editing/Mutable/MutableMixin.d.ts +11 -11
  56. package/lib/cjs/Editing/Mutable/MutableMixin.js +15 -15
  57. package/lib/cjs/Editing/Mutable/MutableMixin.js.map +1 -1
  58. package/lib/cjs/Editing/Mutable/MutablePhenomenon.d.ts +9 -9
  59. package/lib/cjs/Editing/Mutable/MutablePhenomenon.js +15 -15
  60. package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
  61. package/lib/cjs/Editing/Mutable/MutableProperty.d.ts +8 -8
  62. package/lib/cjs/Editing/Mutable/MutableProperty.js +15 -15
  63. package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
  64. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.d.ts +9 -9
  65. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js +15 -15
  66. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
  67. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.d.ts +21 -21
  68. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js +24 -24
  69. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
  70. package/lib/cjs/Editing/Mutable/MutableSchema.d.ts +45 -45
  71. package/lib/cjs/Editing/Mutable/MutableSchema.js +17 -17
  72. package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
  73. package/lib/cjs/Editing/Mutable/MutableUnit.d.ts +11 -11
  74. package/lib/cjs/Editing/Mutable/MutableUnit.js +15 -15
  75. package/lib/cjs/Editing/Mutable/MutableUnit.js.map +1 -1
  76. package/lib/cjs/Editing/Mutable/MutableUnitSystem.d.ts +8 -8
  77. package/lib/cjs/Editing/Mutable/MutableUnitSystem.js +15 -15
  78. package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
  79. package/lib/cjs/Editing/Phenomena.d.ts +15 -15
  80. package/lib/cjs/Editing/Phenomena.js +47 -47
  81. package/lib/cjs/Editing/Phenomena.js.map +1 -1
  82. package/lib/cjs/Editing/PropertyCategories.d.ts +16 -16
  83. package/lib/cjs/Editing/PropertyCategories.js +53 -53
  84. package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
  85. package/lib/cjs/Editing/RelationshipClasses.d.ts +21 -21
  86. package/lib/cjs/Editing/RelationshipClasses.js +69 -69
  87. package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
  88. package/lib/cjs/Editing/Structs.d.ts +19 -19
  89. package/lib/cjs/Editing/Structs.js +60 -60
  90. package/lib/cjs/Editing/Structs.js.map +1 -1
  91. package/lib/cjs/Editing/UnitSystems.d.ts +15 -15
  92. package/lib/cjs/Editing/UnitSystems.js +43 -43
  93. package/lib/cjs/Editing/UnitSystems.js.map +1 -1
  94. package/lib/cjs/Editing/Units.d.ts +15 -15
  95. package/lib/cjs/Editing/Units.js +61 -61
  96. package/lib/cjs/Editing/Units.js.map +1 -1
  97. package/lib/cjs/Validation/Diagnostic.d.ts +321 -321
  98. package/lib/cjs/Validation/Diagnostic.js +310 -310
  99. package/lib/cjs/Validation/Diagnostic.js.map +1 -1
  100. package/lib/cjs/Validation/DiagnosticReporter.d.ts +96 -96
  101. package/lib/cjs/Validation/DiagnosticReporter.js +106 -106
  102. package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
  103. package/lib/cjs/Validation/ECRules.d.ts +438 -438
  104. package/lib/cjs/Validation/ECRules.js +583 -583
  105. package/lib/cjs/Validation/ECRules.js.map +1 -1
  106. package/lib/cjs/Validation/LoggingDiagnosticReporter.d.ts +13 -13
  107. package/lib/cjs/Validation/LoggingDiagnosticReporter.js +40 -40
  108. package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
  109. package/lib/cjs/Validation/RuleSuppressionSet.d.ts +58 -58
  110. package/lib/cjs/Validation/RuleSuppressionSet.js +9 -9
  111. package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
  112. package/lib/cjs/Validation/Rules.d.ts +64 -64
  113. package/lib/cjs/Validation/Rules.js +9 -9
  114. package/lib/cjs/Validation/Rules.js.map +1 -1
  115. package/lib/cjs/Validation/SchemaChanges.d.ts +607 -607
  116. package/lib/cjs/Validation/SchemaChanges.js +1135 -1135
  117. package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
  118. package/lib/cjs/Validation/SchemaCompareDiagnostics.d.ts +422 -422
  119. package/lib/cjs/Validation/SchemaCompareDiagnostics.js +111 -111
  120. package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
  121. package/lib/cjs/Validation/SchemaCompareReporter.d.ts +11 -11
  122. package/lib/cjs/Validation/SchemaCompareReporter.js +9 -9
  123. package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
  124. package/lib/cjs/Validation/SchemaCompareResultDelegate.d.ts +236 -236
  125. package/lib/cjs/Validation/SchemaCompareResultDelegate.js +348 -348
  126. package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
  127. package/lib/cjs/Validation/SchemaCompareVisitor.d.ts +119 -119
  128. package/lib/cjs/Validation/SchemaCompareVisitor.js +206 -206
  129. package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
  130. package/lib/cjs/Validation/SchemaComparer.d.ts +171 -171
  131. package/lib/cjs/Validation/SchemaComparer.js +666 -666
  132. package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
  133. package/lib/cjs/Validation/SchemaValidater.d.ts +19 -19
  134. package/lib/cjs/Validation/SchemaValidater.js +61 -61
  135. package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
  136. package/lib/cjs/Validation/SchemaValidationVisitor.d.ts +170 -170
  137. package/lib/cjs/Validation/SchemaValidationVisitor.js +490 -490
  138. package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
  139. package/lib/cjs/Validation/SchemaWalker.d.ts +22 -22
  140. package/lib/cjs/Validation/SchemaWalker.js +51 -51
  141. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  142. package/lib/cjs/ecschema-editing.d.ts +33 -33
  143. package/lib/cjs/ecschema-editing.js +54 -54
  144. package/lib/cjs/ecschema-editing.js.map +1 -1
  145. package/package.json +11 -11
  146. package/public/locales/en/ECSchemaEditing.json +26 -26
@@ -1,80 +1,80 @@
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.KindOfQuantities = 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 KindOfQuantity.
15
- */
16
- class KindOfQuantities {
17
- constructor(_schemaEditor) {
18
- this._schemaEditor = _schemaEditor;
19
- }
20
- async createFromProps(schemaKey, koqProps) {
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
- if (koqProps.name === undefined)
25
- return { errorMessage: `No name was supplied within props.` };
26
- const newKoQ = (await schema.createKindOfQuantity(koqProps.name));
27
- if (newKoQ === undefined) {
28
- return { errorMessage: `Failed to create class ${koqProps.name} in schema ${schemaKey.toString(true)}.` };
29
- }
30
- await newKoQ.fromJSON(koqProps);
31
- return { itemKey: newKoQ.key };
32
- }
33
- /**
34
- *
35
- * @param koqKey A schemaItemKey of the editing KindOfQuantity.
36
- * @param format A schemaItemKey of a Format.
37
- * @param isDefault .is set to false when not explicitly passed.
38
- */
39
- async addPresentationFormat(koqKey, format, isDefault = false) {
40
- const kindOfQuantity = (await this._schemaEditor.schemaContext.getSchemaItem(koqKey));
41
- if (kindOfQuantity === undefined)
42
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Entity Class ${koqKey.fullName} not found in schema context.`);
43
- if (kindOfQuantity.schemaItemType !== ecschema_metadata_1.SchemaItemType.KindOfQuantity)
44
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${koqKey.fullName} to be of type Kind Of Quantity.`);
45
- const presentationFormat = await (this._schemaEditor.schemaContext.getSchemaItem(format));
46
- if (undefined === presentationFormat)
47
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidECJson, `Unable to locate format '${format.fullName}' for the presentation unit on KindOfQuantity ${koqKey.fullName}.`);
48
- if (presentationFormat.schemaItemType !== ecschema_metadata_1.SchemaItemType.Format)
49
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${presentationFormat.fullName} to be of type Format.`);
50
- kindOfQuantity.addPresentationFormat(presentationFormat, isDefault);
51
- }
52
- async addPresentationOverrideFormat(koqKey, overrideFormat, isDefault = false) {
53
- const kindOfQuantity = (await this._schemaEditor.schemaContext.getSchemaItem(koqKey));
54
- if (kindOfQuantity === undefined)
55
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Entity Class ${koqKey.fullName} not found in schema context.`);
56
- if (kindOfQuantity.schemaItemType !== ecschema_metadata_1.SchemaItemType.KindOfQuantity)
57
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${koqKey.fullName} to be of type Kind Of Quantity.`);
58
- kindOfQuantity.addPresentationFormat(overrideFormat, isDefault);
59
- }
60
- /**
61
- * @param koqKey A schemaItemKey of the editing KindOfQuantity.
62
- * @param parent A SchemaItemKey of the parent Format.
63
- * @param unitLabelOverrides The list of Unit (or InvertedUnit) and label overrides. The length of list should be equal to the number of units in the parent Format.
64
- */
65
- async createFormatOverride(koqKey, parent, precision, unitLabelOverrides) {
66
- const kindOfQuantity = (await this._schemaEditor.schemaContext.getSchemaItem(koqKey));
67
- if (kindOfQuantity === undefined)
68
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Entity Class ${koqKey.fullName} not found in schema context.`);
69
- if (kindOfQuantity.schemaItemType !== ecschema_metadata_1.SchemaItemType.KindOfQuantity)
70
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${koqKey.fullName} to be of type Kind Of Quantity.`);
71
- const parentFormat = await (this._schemaEditor.schemaContext.getSchemaItem(parent));
72
- if (undefined === parentFormat)
73
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidECJson, `Unable to locate format '${parent.fullName}' for the presentation unit on KindOfQuantity ${koqKey.fullName}.`);
74
- if (parentFormat.schemaItemType !== ecschema_metadata_1.SchemaItemType.Format)
75
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${parentFormat.fullName} to be of type Format.`);
76
- return new ecschema_metadata_1.OverrideFormat(parentFormat, precision, unitLabelOverrides);
77
- }
78
- }
79
- exports.KindOfQuantities = KindOfQuantities;
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.KindOfQuantities = 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 KindOfQuantity.
15
+ */
16
+ class KindOfQuantities {
17
+ constructor(_schemaEditor) {
18
+ this._schemaEditor = _schemaEditor;
19
+ }
20
+ async createFromProps(schemaKey, koqProps) {
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
+ if (koqProps.name === undefined)
25
+ return { errorMessage: `No name was supplied within props.` };
26
+ const newKoQ = (await schema.createKindOfQuantity(koqProps.name));
27
+ if (newKoQ === undefined) {
28
+ return { errorMessage: `Failed to create class ${koqProps.name} in schema ${schemaKey.toString(true)}.` };
29
+ }
30
+ await newKoQ.fromJSON(koqProps);
31
+ return { itemKey: newKoQ.key };
32
+ }
33
+ /**
34
+ *
35
+ * @param koqKey A schemaItemKey of the editing KindOfQuantity.
36
+ * @param format A schemaItemKey of a Format.
37
+ * @param isDefault .is set to false when not explicitly passed.
38
+ */
39
+ async addPresentationFormat(koqKey, format, isDefault = false) {
40
+ const kindOfQuantity = (await this._schemaEditor.schemaContext.getSchemaItem(koqKey));
41
+ if (kindOfQuantity === undefined)
42
+ throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Entity Class ${koqKey.fullName} not found in schema context.`);
43
+ if (kindOfQuantity.schemaItemType !== ecschema_metadata_1.SchemaItemType.KindOfQuantity)
44
+ throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${koqKey.fullName} to be of type Kind Of Quantity.`);
45
+ const presentationFormat = await (this._schemaEditor.schemaContext.getSchemaItem(format));
46
+ if (undefined === presentationFormat)
47
+ throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidECJson, `Unable to locate format '${format.fullName}' for the presentation unit on KindOfQuantity ${koqKey.fullName}.`);
48
+ if (presentationFormat.schemaItemType !== ecschema_metadata_1.SchemaItemType.Format)
49
+ throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${presentationFormat.fullName} to be of type Format.`);
50
+ kindOfQuantity.addPresentationFormat(presentationFormat, isDefault);
51
+ }
52
+ async addPresentationOverrideFormat(koqKey, overrideFormat, isDefault = false) {
53
+ const kindOfQuantity = (await this._schemaEditor.schemaContext.getSchemaItem(koqKey));
54
+ if (kindOfQuantity === undefined)
55
+ throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Entity Class ${koqKey.fullName} not found in schema context.`);
56
+ if (kindOfQuantity.schemaItemType !== ecschema_metadata_1.SchemaItemType.KindOfQuantity)
57
+ throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${koqKey.fullName} to be of type Kind Of Quantity.`);
58
+ kindOfQuantity.addPresentationFormat(overrideFormat, isDefault);
59
+ }
60
+ /**
61
+ * @param koqKey A schemaItemKey of the editing KindOfQuantity.
62
+ * @param parent A SchemaItemKey of the parent Format.
63
+ * @param unitLabelOverrides The list of Unit (or InvertedUnit) and label overrides. The length of list should be equal to the number of units in the parent Format.
64
+ */
65
+ async createFormatOverride(koqKey, parent, precision, unitLabelOverrides) {
66
+ const kindOfQuantity = (await this._schemaEditor.schemaContext.getSchemaItem(koqKey));
67
+ if (kindOfQuantity === undefined)
68
+ throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Entity Class ${koqKey.fullName} not found in schema context.`);
69
+ if (kindOfQuantity.schemaItemType !== ecschema_metadata_1.SchemaItemType.KindOfQuantity)
70
+ throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${koqKey.fullName} to be of type Kind Of Quantity.`);
71
+ const parentFormat = await (this._schemaEditor.schemaContext.getSchemaItem(parent));
72
+ if (undefined === parentFormat)
73
+ throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidECJson, `Unable to locate format '${parent.fullName}' for the presentation unit on KindOfQuantity ${koqKey.fullName}.`);
74
+ if (parentFormat.schemaItemType !== ecschema_metadata_1.SchemaItemType.Format)
75
+ throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${parentFormat.fullName} to be of type Format.`);
76
+ return new ecschema_metadata_1.OverrideFormat(parentFormat, precision, unitLabelOverrides);
77
+ }
78
+ }
79
+ exports.KindOfQuantities = KindOfQuantities;
80
80
  //# sourceMappingURL=KindOfQuantities.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"KindOfQuantities.js","sourceRoot":"","sources":["../../../src/Editing/KindOfQuantities.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAGkC;AAIlC;;;GAGG;AACH,MAAa,gBAAgB;IAC3B,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAC7D,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,QAA6B;QAC9E,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,QAAQ,CAAC,IAAI,KAAK,SAAS;YAAE,OAAO,EAAE,YAAY,EAAE,oCAAoC,EAAE,CAAC;QAC/F,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,oBAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAA0B,CAAC;QAC3F,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,OAAO,EAAE,YAAY,EAAE,0BAA0B,QAAQ,CAAC,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;SAC3G;QAED,MAAM,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAChC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,qBAAqB,CAAC,MAAqB,EAAE,MAAqB,EAAE,YAAqB,KAAK;QACzG,MAAM,cAAc,GAAG,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,aAAa,CAAwB,MAAM,CAA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* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Editing\r\n */\r\n\r\nimport {\r\n ECObjectsError, ECObjectsStatus, Format, InvertedUnit, KindOfQuantityProps, OverrideFormat,\r\n SchemaItemKey, SchemaItemType, SchemaKey, Unit,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\r\nimport { MutableKindOfQuantity } from \"./Mutable/MutableKindOfQuantity\";\r\n\r\n/**\r\n * @alpha\r\n * A class allowing you to create schema items of type KindOfQuantity.\r\n */\r\nexport class KindOfQuantities {\r\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\r\n public async createFromProps(schemaKey: SchemaKey, koqProps: KindOfQuantityProps): 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 (koqProps.name === undefined) return { errorMessage: `No name was supplied within props.` };\r\n const newKoQ = (await schema.createKindOfQuantity(koqProps.name)) as MutableKindOfQuantity;\r\n if (newKoQ === undefined) {\r\n return { errorMessage: `Failed to create class ${koqProps.name} in schema ${schemaKey.toString(true)}.` };\r\n }\r\n\r\n await newKoQ.fromJSON(koqProps);\r\n return { itemKey: newKoQ.key };\r\n }\r\n\r\n /**\r\n *\r\n * @param koqKey A schemaItemKey of the editing KindOfQuantity.\r\n * @param format A schemaItemKey of a Format.\r\n * @param isDefault .is set to false when not explicitly passed.\r\n */\r\n public async addPresentationFormat(koqKey: SchemaItemKey, format: SchemaItemKey, isDefault: boolean = false): Promise<void> {\r\n const kindOfQuantity = (await this._schemaEditor.schemaContext.getSchemaItem<MutableKindOfQuantity>(koqKey));\r\n\r\n if (kindOfQuantity === undefined) throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Entity Class ${koqKey.fullName} not found in schema context.`);\r\n if (kindOfQuantity.schemaItemType !== SchemaItemType.KindOfQuantity) throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${koqKey.fullName} to be of type Kind Of Quantity.`);\r\n\r\n const presentationFormat = await (this._schemaEditor.schemaContext.getSchemaItem<Format>(format));\r\n if (undefined === presentationFormat)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate format '${format.fullName}' for the presentation unit on KindOfQuantity ${koqKey.fullName}.`);\r\n if (presentationFormat.schemaItemType !== SchemaItemType.Format) throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${presentationFormat.fullName} to be of type Format.`);\r\n\r\n kindOfQuantity.addPresentationFormat(presentationFormat, isDefault);\r\n }\r\n\r\n public async addPresentationOverrideFormat(koqKey: SchemaItemKey, overrideFormat: OverrideFormat, isDefault: boolean = false): Promise<void> {\r\n const kindOfQuantity = (await this._schemaEditor.schemaContext.getSchemaItem<MutableKindOfQuantity>(koqKey));\r\n\r\n if (kindOfQuantity === undefined) throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Entity Class ${koqKey.fullName} not found in schema context.`);\r\n if (kindOfQuantity.schemaItemType !== SchemaItemType.KindOfQuantity) throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${koqKey.fullName} to be of type Kind Of Quantity.`);\r\n\r\n kindOfQuantity.addPresentationFormat(overrideFormat, isDefault);\r\n }\r\n\r\n /**\r\n * @param koqKey A schemaItemKey of the editing KindOfQuantity.\r\n * @param parent A SchemaItemKey of the parent Format.\r\n * @param unitLabelOverrides The list of Unit (or InvertedUnit) and label overrides. The length of list should be equal to the number of units in the parent Format.\r\n */\r\n public async createFormatOverride(koqKey: SchemaItemKey, parent: SchemaItemKey, precision?: number, unitLabelOverrides?: Array<[Unit | InvertedUnit, string | undefined]>): Promise<OverrideFormat> {\r\n const kindOfQuantity = (await this._schemaEditor.schemaContext.getSchemaItem<MutableKindOfQuantity>(koqKey));\r\n\r\n if (kindOfQuantity === undefined) throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Entity Class ${koqKey.fullName} not found in schema context.`);\r\n if (kindOfQuantity.schemaItemType !== SchemaItemType.KindOfQuantity) throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${koqKey.fullName} to be of type Kind Of Quantity.`);\r\n\r\n const parentFormat = await (this._schemaEditor.schemaContext.getSchemaItem<Format>(parent));\r\n if (undefined === parentFormat)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate format '${parent.fullName}' for the presentation unit on KindOfQuantity ${koqKey.fullName}.`);\r\n if (parentFormat.schemaItemType !== SchemaItemType.Format) throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${parentFormat.fullName} to be of type Format.`);\r\n\r\n return new OverrideFormat(parentFormat, precision, unitLabelOverrides);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"KindOfQuantities.js","sourceRoot":"","sources":["../../../src/Editing/KindOfQuantities.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAGkC;AAIlC;;;GAGG;AACH,MAAa,gBAAgB;IAC3B,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAC7D,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,QAA6B;QAC9E,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,QAAQ,CAAC,IAAI,KAAK,SAAS;YAAE,OAAO,EAAE,YAAY,EAAE,oCAAoC,EAAE,CAAC;QAC/F,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,oBAAoB,CAAC,QAAQ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aAAa,CAAS,MAAM,CAAC,CAAC,CAAC;QAC5F,IAAI,SAAS,KAAK,YAAY;YAC5B,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,aAAa,EAAE,4BAA4B,MAAM,CAAC,QAAQ,iDAAiD,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC;QAC1K,IAAI,YAAY,CAAC,cAAc,KAAK,kCAAc,CAAC,MAAM;YAAE,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,qBAAqB,EAAE,YAAY,YAAY,CAAC,QAAQ,wBAAwB,CAAC,CAAC;QAEtL,OAAO,IAAI,kCAAc,CAAC,YAAY,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAAC;IACzE,CAAC;CACF;AA/DD,4CA+DC","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, Format, InvertedUnit, KindOfQuantityProps, OverrideFormat,\n SchemaItemKey, SchemaItemType, SchemaKey, Unit,\n} from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\nimport { MutableKindOfQuantity } from \"./Mutable/MutableKindOfQuantity\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type KindOfQuantity.\n */\nexport class KindOfQuantities {\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\n public async createFromProps(schemaKey: SchemaKey, koqProps: KindOfQuantityProps): Promise<SchemaItemEditResults> {\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 if (koqProps.name === undefined) return { errorMessage: `No name was supplied within props.` };\n const newKoQ = (await schema.createKindOfQuantity(koqProps.name)) as MutableKindOfQuantity;\n if (newKoQ === undefined) {\n return { errorMessage: `Failed to create class ${koqProps.name} in schema ${schemaKey.toString(true)}.` };\n }\n\n await newKoQ.fromJSON(koqProps);\n return { itemKey: newKoQ.key };\n }\n\n /**\n *\n * @param koqKey A schemaItemKey of the editing KindOfQuantity.\n * @param format A schemaItemKey of a Format.\n * @param isDefault .is set to false when not explicitly passed.\n */\n public async addPresentationFormat(koqKey: SchemaItemKey, format: SchemaItemKey, isDefault: boolean = false): Promise<void> {\n const kindOfQuantity = (await this._schemaEditor.schemaContext.getSchemaItem<MutableKindOfQuantity>(koqKey));\n\n if (kindOfQuantity === undefined) throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Entity Class ${koqKey.fullName} not found in schema context.`);\n if (kindOfQuantity.schemaItemType !== SchemaItemType.KindOfQuantity) throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${koqKey.fullName} to be of type Kind Of Quantity.`);\n\n const presentationFormat = await (this._schemaEditor.schemaContext.getSchemaItem<Format>(format));\n if (undefined === presentationFormat)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate format '${format.fullName}' for the presentation unit on KindOfQuantity ${koqKey.fullName}.`);\n if (presentationFormat.schemaItemType !== SchemaItemType.Format) throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${presentationFormat.fullName} to be of type Format.`);\n\n kindOfQuantity.addPresentationFormat(presentationFormat, isDefault);\n }\n\n public async addPresentationOverrideFormat(koqKey: SchemaItemKey, overrideFormat: OverrideFormat, isDefault: boolean = false): Promise<void> {\n const kindOfQuantity = (await this._schemaEditor.schemaContext.getSchemaItem<MutableKindOfQuantity>(koqKey));\n\n if (kindOfQuantity === undefined) throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Entity Class ${koqKey.fullName} not found in schema context.`);\n if (kindOfQuantity.schemaItemType !== SchemaItemType.KindOfQuantity) throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${koqKey.fullName} to be of type Kind Of Quantity.`);\n\n kindOfQuantity.addPresentationFormat(overrideFormat, isDefault);\n }\n\n /**\n * @param koqKey A schemaItemKey of the editing KindOfQuantity.\n * @param parent A SchemaItemKey of the parent Format.\n * @param unitLabelOverrides The list of Unit (or InvertedUnit) and label overrides. The length of list should be equal to the number of units in the parent Format.\n */\n public async createFormatOverride(koqKey: SchemaItemKey, parent: SchemaItemKey, precision?: number, unitLabelOverrides?: Array<[Unit | InvertedUnit, string | undefined]>): Promise<OverrideFormat> {\n const kindOfQuantity = (await this._schemaEditor.schemaContext.getSchemaItem<MutableKindOfQuantity>(koqKey));\n\n if (kindOfQuantity === undefined) throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Entity Class ${koqKey.fullName} not found in schema context.`);\n if (kindOfQuantity.schemaItemType !== SchemaItemType.KindOfQuantity) throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${koqKey.fullName} to be of type Kind Of Quantity.`);\n\n const parentFormat = await (this._schemaEditor.schemaContext.getSchemaItem<Format>(parent));\n if (undefined === parentFormat)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate format '${parent.fullName}' for the presentation unit on KindOfQuantity ${koqKey.fullName}.`);\n if (parentFormat.schemaItemType !== SchemaItemType.Format) throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${parentFormat.fullName} to be of type Format.`);\n\n return new OverrideFormat(parentFormat, precision, unitLabelOverrides);\n }\n}\n"]}
@@ -1,23 +1,23 @@
1
- /** @packageDocumentation
2
- * @module Editing
3
- */
4
- import { MixinProps, RelationshipClass, 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 Mixin.
10
- */
11
- export declare class Mixins extends ECClasses {
12
- constructor(_schemaEditor: SchemaContextEditor);
13
- create(schemaKey: SchemaKey, name: string, appliesTo: SchemaItemKey, displayLabel?: string, baseClass?: SchemaItemKey): Promise<SchemaItemEditResults>;
14
- /**
15
- * Creates a MixinClass through a MixinProps.
16
- * @param schemaKey a SchemaKey of the Schema that will house the new object.
17
- * @param mixinProps a json object that will be used to populate the new MixinClass. Needs a name value passed in.
18
- */
19
- createFromProps(schemaKey: SchemaKey, mixinProps: MixinProps): Promise<SchemaItemEditResults>;
20
- addMixin(entityKey: SchemaItemKey, mixinKey: SchemaItemKey): Promise<void>;
21
- createNavigationProperty(mixinKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<PropertyEditResults>;
22
- }
1
+ /** @packageDocumentation
2
+ * @module Editing
3
+ */
4
+ import { MixinProps, RelationshipClass, 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 Mixin.
10
+ */
11
+ export declare class Mixins extends ECClasses {
12
+ constructor(_schemaEditor: SchemaContextEditor);
13
+ create(schemaKey: SchemaKey, name: string, appliesTo: SchemaItemKey, displayLabel?: string, baseClass?: SchemaItemKey): Promise<SchemaItemEditResults>;
14
+ /**
15
+ * Creates a MixinClass through a MixinProps.
16
+ * @param schemaKey a SchemaKey of the Schema that will house the new object.
17
+ * @param mixinProps a json object that will be used to populate the new MixinClass. Needs a name value passed in.
18
+ */
19
+ createFromProps(schemaKey: SchemaKey, mixinProps: MixinProps): Promise<SchemaItemEditResults>;
20
+ addMixin(entityKey: SchemaItemKey, mixinKey: SchemaItemKey): Promise<void>;
21
+ createNavigationProperty(mixinKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<PropertyEditResults>;
22
+ }
23
23
  //# sourceMappingURL=Mixins.d.ts.map
@@ -1,89 +1,89 @@
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.Mixins = 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 Mixin.
16
- */
17
- class Mixins extends ECClasses_1.ECClasses {
18
- constructor(_schemaEditor) {
19
- super(_schemaEditor);
20
- }
21
- async create(schemaKey, name, appliesTo, 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.createMixinClass(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.Mixin)
34
- return { errorMessage: `${baseClassItem.fullName} is not of type Mixin.` };
35
- newClass.baseClass = new ecschema_metadata_1.DelayedPromiseWithProps(baseClass, async () => baseClassItem);
36
- }
37
- const newAppliesTo = (await this._schemaEditor.schemaContext.getSchemaItem(appliesTo));
38
- if (newAppliesTo === undefined || newAppliesTo.schemaItemType !== ecschema_metadata_1.SchemaItemType.EntityClass) {
39
- return { errorMessage: `Failed to locate the appliedTo entity class ${appliesTo.name}.` };
40
- }
41
- newClass.setAppliesTo(new ecschema_metadata_1.DelayedPromiseWithProps(newAppliesTo.key, async () => newAppliesTo));
42
- if (displayLabel) {
43
- newClass.setDisplayLabel(displayLabel);
44
- }
45
- return { itemKey: newClass.key };
46
- }
47
- /**
48
- * Creates a MixinClass through a MixinProps.
49
- * @param schemaKey a SchemaKey of the Schema that will house the new object.
50
- * @param mixinProps a json object that will be used to populate the new MixinClass. Needs a name value passed in.
51
- */
52
- async createFromProps(schemaKey, mixinProps) {
53
- const schema = await this._schemaEditor.getSchema(schemaKey);
54
- if (schema === undefined)
55
- return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
56
- if (mixinProps.name === undefined)
57
- return { errorMessage: `No name was supplied within props.` };
58
- const newClass = (await schema.createMixinClass(mixinProps.name));
59
- if (newClass === undefined) {
60
- return { errorMessage: `Failed to create class ${mixinProps.name} in schema ${schemaKey.toString(true)}.` };
61
- }
62
- await newClass.fromJSON(mixinProps);
63
- return { itemKey: newClass.key };
64
- }
65
- async addMixin(entityKey, mixinKey) {
66
- const entity = (await this._schemaEditor.schemaContext.getSchemaItem(entityKey));
67
- const mixin = (await this._schemaEditor.schemaContext.getSchemaItem(mixinKey));
68
- if (entity === undefined)
69
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Entity Class ${entityKey.fullName} not found in schema context.`);
70
- if (mixin === undefined)
71
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Mixin Class ${mixinKey.fullName} not found in schema context.`);
72
- if (entity.schemaItemType !== ecschema_metadata_1.SchemaItemType.EntityClass)
73
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${entityKey.fullName} to be of type Entity Class.`);
74
- if (mixin.schemaItemType !== ecschema_metadata_1.SchemaItemType.Mixin)
75
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${mixinKey.fullName} to be of type Mixin.`);
76
- entity.addMixin(mixin);
77
- }
78
- async createNavigationProperty(mixinKey, name, relationship, direction) {
79
- const mixin = (await this._schemaEditor.schemaContext.getSchemaItem(mixinKey));
80
- if (mixin === undefined)
81
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Mixin Class ${mixinKey.fullName} not found in schema context.`);
82
- if (mixin.schemaItemType !== ecschema_metadata_1.SchemaItemType.Mixin)
83
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${mixinKey.fullName} to be of type Mixin.`);
84
- await mixin.createNavigationProperty(name, relationship, direction);
85
- return { itemKey: mixinKey, propertyName: name };
86
- }
87
- }
88
- exports.Mixins = Mixins;
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.Mixins = 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 Mixin.
16
+ */
17
+ class Mixins extends ECClasses_1.ECClasses {
18
+ constructor(_schemaEditor) {
19
+ super(_schemaEditor);
20
+ }
21
+ async create(schemaKey, name, appliesTo, 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.createMixinClass(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.Mixin)
34
+ return { errorMessage: `${baseClassItem.fullName} is not of type Mixin.` };
35
+ newClass.baseClass = new ecschema_metadata_1.DelayedPromiseWithProps(baseClass, async () => baseClassItem);
36
+ }
37
+ const newAppliesTo = (await this._schemaEditor.schemaContext.getSchemaItem(appliesTo));
38
+ if (newAppliesTo === undefined || newAppliesTo.schemaItemType !== ecschema_metadata_1.SchemaItemType.EntityClass) {
39
+ return { errorMessage: `Failed to locate the appliedTo entity class ${appliesTo.name}.` };
40
+ }
41
+ newClass.setAppliesTo(new ecschema_metadata_1.DelayedPromiseWithProps(newAppliesTo.key, async () => newAppliesTo));
42
+ if (displayLabel) {
43
+ newClass.setDisplayLabel(displayLabel);
44
+ }
45
+ return { itemKey: newClass.key };
46
+ }
47
+ /**
48
+ * Creates a MixinClass through a MixinProps.
49
+ * @param schemaKey a SchemaKey of the Schema that will house the new object.
50
+ * @param mixinProps a json object that will be used to populate the new MixinClass. Needs a name value passed in.
51
+ */
52
+ async createFromProps(schemaKey, mixinProps) {
53
+ const schema = await this._schemaEditor.getSchema(schemaKey);
54
+ if (schema === undefined)
55
+ return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
56
+ if (mixinProps.name === undefined)
57
+ return { errorMessage: `No name was supplied within props.` };
58
+ const newClass = (await schema.createMixinClass(mixinProps.name));
59
+ if (newClass === undefined) {
60
+ return { errorMessage: `Failed to create class ${mixinProps.name} in schema ${schemaKey.toString(true)}.` };
61
+ }
62
+ await newClass.fromJSON(mixinProps);
63
+ return { itemKey: newClass.key };
64
+ }
65
+ async addMixin(entityKey, mixinKey) {
66
+ const entity = (await this._schemaEditor.schemaContext.getSchemaItem(entityKey));
67
+ const mixin = (await this._schemaEditor.schemaContext.getSchemaItem(mixinKey));
68
+ if (entity === undefined)
69
+ throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Entity Class ${entityKey.fullName} not found in schema context.`);
70
+ if (mixin === undefined)
71
+ throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Mixin Class ${mixinKey.fullName} not found in schema context.`);
72
+ if (entity.schemaItemType !== ecschema_metadata_1.SchemaItemType.EntityClass)
73
+ throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${entityKey.fullName} to be of type Entity Class.`);
74
+ if (mixin.schemaItemType !== ecschema_metadata_1.SchemaItemType.Mixin)
75
+ throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${mixinKey.fullName} to be of type Mixin.`);
76
+ entity.addMixin(mixin);
77
+ }
78
+ async createNavigationProperty(mixinKey, name, relationship, direction) {
79
+ const mixin = (await this._schemaEditor.schemaContext.getSchemaItem(mixinKey));
80
+ if (mixin === undefined)
81
+ throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Mixin Class ${mixinKey.fullName} not found in schema context.`);
82
+ if (mixin.schemaItemType !== ecschema_metadata_1.SchemaItemType.Mixin)
83
+ throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidSchemaItemType, `Expected ${mixinKey.fullName} to be of type Mixin.`);
84
+ await mixin.createNavigationProperty(name, relationship, direction);
85
+ return { itemKey: mixinKey, propertyName: name };
86
+ }
87
+ }
88
+ exports.Mixins = Mixins;
89
89
  //# sourceMappingURL=Mixins.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Mixins.js","sourceRoot":"","sources":["../../../src/Editing/Mixins.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAGkC;AAElC,2CAAwC;AAIxC;;;GAGG;AACH,MAAa,MAAO,SAAQ,qBAAS;IACnC,YAAmB,aAAkC;QACnD,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAA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AC,qBAAqB,EAAE,YAAY,QAAQ,CAAC,QAAQ,uBAAuB,CAAC,CAAC;QAEzK,MAAM,KAAK,CAAC,wBAAwB,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QACpE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IACnD,CAAC;CACF;AAvED,wBAuEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Editing\r\n */\r\n\r\nimport {\r\n DelayedPromiseWithProps, ECObjectsError, ECObjectsStatus, EntityClass, Mixin, MixinProps, RelationshipClass,\r\n SchemaItemKey, SchemaItemType, SchemaKey, StrengthDirection,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { PropertyEditResults, SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableMixin } from \"./Mutable/MutableMixin\";\r\nimport { MutableEntityClass } from \"./Mutable/MutableEntityClass\";\r\n\r\n/**\r\n * @alpha\r\n * A class extending ECClasses allowing you to create schema items of type Mixin.\r\n */\r\nexport class Mixins extends ECClasses {\r\n public constructor(_schemaEditor: SchemaContextEditor) {\r\n super(_schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, appliesTo: SchemaItemKey, displayLabel?: string, baseClass?: SchemaItemKey): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined) return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n const newClass = ((await schema.createMixinClass(name)) as MutableMixin);\r\n if (newClass === undefined) {\r\n return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };\r\n }\r\n\r\n if (baseClass !== undefined) {\r\n const baseClassItem = await schema.lookupItem<Mixin>(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.Mixin) return { errorMessage: `${baseClassItem.fullName} is not of type Mixin.` };\r\n newClass.baseClass = new DelayedPromiseWithProps<SchemaItemKey, Mixin>(baseClass, async () => baseClassItem);\r\n }\r\n\r\n const newAppliesTo = (await this._schemaEditor.schemaContext.getSchemaItem<EntityClass>(appliesTo));\r\n if (newAppliesTo === undefined || newAppliesTo.schemaItemType !== SchemaItemType.EntityClass) { return { errorMessage: `Failed to locate the appliedTo entity class ${appliesTo.name}.` }; }\r\n newClass.setAppliesTo(new DelayedPromiseWithProps<SchemaItemKey, EntityClass>(newAppliesTo.key, async () => newAppliesTo));\r\n\r\n if (displayLabel) { newClass.setDisplayLabel(displayLabel); }\r\n\r\n return { itemKey: newClass.key };\r\n }\r\n\r\n /**\r\n * Creates a MixinClass through a MixinProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param mixinProps a json object that will be used to populate the new MixinClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, mixinProps: MixinProps): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined) return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n if (mixinProps.name === undefined) return { errorMessage: `No name was supplied within props.` };\r\n const newClass = (await schema.createMixinClass(mixinProps.name)) as MutableMixin;\r\n if (newClass === undefined) {\r\n return { errorMessage: `Failed to create class ${mixinProps.name} in schema ${schemaKey.toString(true)}.` };\r\n }\r\n\r\n await newClass.fromJSON(mixinProps);\r\n\r\n return { itemKey: newClass.key };\r\n }\r\n\r\n public async addMixin(entityKey: SchemaItemKey, mixinKey: SchemaItemKey): Promise<void> {\r\n const entity = (await this._schemaEditor.schemaContext.getSchemaItem<MutableEntityClass>(entityKey));\r\n const mixin = (await this._schemaEditor.schemaContext.getSchemaItem<Mixin>(mixinKey));\r\n\r\n if (entity === undefined) throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Entity Class ${entityKey.fullName} not found in schema context.`);\r\n if (mixin === undefined) throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Mixin Class ${mixinKey.fullName} not found in schema context.`);\r\n if (entity.schemaItemType !== SchemaItemType.EntityClass) throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${entityKey.fullName} to be of type Entity Class.`);\r\n if (mixin.schemaItemType !== SchemaItemType.Mixin) throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${mixinKey.fullName} to be of type Mixin.`);\r\n\r\n entity.addMixin(mixin);\r\n }\r\n\r\n public async createNavigationProperty(mixinKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<PropertyEditResults> {\r\n const mixin = (await this._schemaEditor.schemaContext.getSchemaItem<MutableMixin>(mixinKey));\r\n\r\n if (mixin === undefined) throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Mixin Class ${mixinKey.fullName} not found in schema context.`);\r\n if (mixin.schemaItemType !== SchemaItemType.Mixin) throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${mixinKey.fullName} to be of type Mixin.`);\r\n\r\n await mixin.createNavigationProperty(name, relationship, direction);\r\n return { itemKey: mixinKey, propertyName: name };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Mixins.js","sourceRoot":"","sources":["../../../src/Editing/Mixins.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAGkC;AAElC,2CAAwC;AAIxC;;;GAGG;AACH,MAAa,MAAO,SAAQ,qBAAS;IACnC,YAAmB,aAAkC;QACnD,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,SAAwB,E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AEzK,MAAM,KAAK,CAAC,wBAAwB,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QACpE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IACnD,CAAC;CACF;AAvED,wBAuEC","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 DelayedPromiseWithProps, ECObjectsError, ECObjectsStatus, EntityClass, Mixin, MixinProps, RelationshipClass,\n SchemaItemKey, SchemaItemType, SchemaKey, StrengthDirection,\n} from \"@itwin/ecschema-metadata\";\nimport { PropertyEditResults, SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\nimport { ECClasses } from \"./ECClasses\";\nimport { MutableMixin } from \"./Mutable/MutableMixin\";\nimport { MutableEntityClass } from \"./Mutable/MutableEntityClass\";\n\n/**\n * @alpha\n * A class extending ECClasses allowing you to create schema items of type Mixin.\n */\nexport class Mixins extends ECClasses {\n public constructor(_schemaEditor: SchemaContextEditor) {\n super(_schemaEditor);\n }\n\n public async create(schemaKey: SchemaKey, name: string, appliesTo: SchemaItemKey, displayLabel?: string, baseClass?: SchemaItemKey): Promise<SchemaItemEditResults> {\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.createMixinClass(name)) as MutableMixin);\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<Mixin>(baseClass);\n if (baseClassItem === undefined) return { errorMessage: `Unable to locate base class ${baseClass.fullName} in schema ${schema.fullName}.` };\n if (baseClassItem.schemaItemType !== SchemaItemType.Mixin) return { errorMessage: `${baseClassItem.fullName} is not of type Mixin.` };\n newClass.baseClass = new DelayedPromiseWithProps<SchemaItemKey, Mixin>(baseClass, async () => baseClassItem);\n }\n\n const newAppliesTo = (await this._schemaEditor.schemaContext.getSchemaItem<EntityClass>(appliesTo));\n if (newAppliesTo === undefined || newAppliesTo.schemaItemType !== SchemaItemType.EntityClass) { return { errorMessage: `Failed to locate the appliedTo entity class ${appliesTo.name}.` }; }\n newClass.setAppliesTo(new DelayedPromiseWithProps<SchemaItemKey, EntityClass>(newAppliesTo.key, async () => newAppliesTo));\n\n if (displayLabel) { newClass.setDisplayLabel(displayLabel); }\n\n return { itemKey: newClass.key };\n }\n\n /**\n * Creates a MixinClass through a MixinProps.\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\n * @param mixinProps a json object that will be used to populate the new MixinClass. Needs a name value passed in.\n */\n public async createFromProps(schemaKey: SchemaKey, mixinProps: MixinProps): Promise<SchemaItemEditResults> {\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 if (mixinProps.name === undefined) return { errorMessage: `No name was supplied within props.` };\n const newClass = (await schema.createMixinClass(mixinProps.name)) as MutableMixin;\n if (newClass === undefined) {\n return { errorMessage: `Failed to create class ${mixinProps.name} in schema ${schemaKey.toString(true)}.` };\n }\n\n await newClass.fromJSON(mixinProps);\n\n return { itemKey: newClass.key };\n }\n\n public async addMixin(entityKey: SchemaItemKey, mixinKey: SchemaItemKey): Promise<void> {\n const entity = (await this._schemaEditor.schemaContext.getSchemaItem<MutableEntityClass>(entityKey));\n const mixin = (await this._schemaEditor.schemaContext.getSchemaItem<Mixin>(mixinKey));\n\n if (entity === undefined) throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Entity Class ${entityKey.fullName} not found in schema context.`);\n if (mixin === undefined) throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Mixin Class ${mixinKey.fullName} not found in schema context.`);\n if (entity.schemaItemType !== SchemaItemType.EntityClass) throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${entityKey.fullName} to be of type Entity Class.`);\n if (mixin.schemaItemType !== SchemaItemType.Mixin) throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${mixinKey.fullName} to be of type Mixin.`);\n\n entity.addMixin(mixin);\n }\n\n public async createNavigationProperty(mixinKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<PropertyEditResults> {\n const mixin = (await this._schemaEditor.schemaContext.getSchemaItem<MutableMixin>(mixinKey));\n\n if (mixin === undefined) throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Mixin Class ${mixinKey.fullName} not found in schema context.`);\n if (mixin.schemaItemType !== SchemaItemType.Mixin) throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${mixinKey.fullName} to be of type Mixin.`);\n\n await mixin.createNavigationProperty(name, relationship, direction);\n return { itemKey: mixinKey, propertyName: name };\n }\n}\n"]}
@@ -1,10 +1,10 @@
1
- import { CustomAttributeClass, CustomAttributeContainerType } from "@itwin/ecschema-metadata";
2
- /**
3
- * @internal
4
- * An abstract class used for Schema editing.
5
- */
6
- export declare abstract class MutableCAClass extends CustomAttributeClass {
7
- abstract setContainerType(containerType: CustomAttributeContainerType): void;
8
- abstract setDisplayLabel(displayLabel: string): void;
9
- }
1
+ import { CustomAttributeClass, CustomAttributeContainerType } from "@itwin/ecschema-metadata";
2
+ /**
3
+ * @internal
4
+ * An abstract class used for Schema editing.
5
+ */
6
+ export declare abstract class MutableCAClass extends CustomAttributeClass {
7
+ abstract setContainerType(containerType: CustomAttributeContainerType): void;
8
+ abstract setDisplayLabel(displayLabel: string): void;
9
+ }
10
10
  //# sourceMappingURL=MutableCAClass.d.ts.map
@@ -1,16 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MutableCAClass = void 0;
4
- /*---------------------------------------------------------------------------------------------
5
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
- * See LICENSE.md in the project root for license terms and full copyright notice.
7
- *--------------------------------------------------------------------------------------------*/
8
- const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
9
- /**
10
- * @internal
11
- * An abstract class used for Schema editing.
12
- */
13
- class MutableCAClass extends ecschema_metadata_1.CustomAttributeClass {
14
- }
15
- exports.MutableCAClass = MutableCAClass;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MutableCAClass = void 0;
4
+ /*---------------------------------------------------------------------------------------------
5
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
+ * See LICENSE.md in the project root for license terms and full copyright notice.
7
+ *--------------------------------------------------------------------------------------------*/
8
+ const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
9
+ /**
10
+ * @internal
11
+ * An abstract class used for Schema editing.
12
+ */
13
+ class MutableCAClass extends ecschema_metadata_1.CustomAttributeClass {
14
+ }
15
+ exports.MutableCAClass = MutableCAClass;
16
16
  //# sourceMappingURL=MutableCAClass.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MutableCAClass.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableCAClass.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAA8F;AAE9F;;;GAGG;AACH,MAAsB,cAAe,SAAQ,wCAAoB;CAGhE;AAHD,wCAGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { CustomAttributeClass, CustomAttributeContainerType } from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for Schema editing.\r\n */\r\nexport abstract class MutableCAClass extends CustomAttributeClass {\r\n public abstract override setContainerType(containerType: CustomAttributeContainerType): void;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"MutableCAClass.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableCAClass.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAA8F;AAE9F;;;GAGG;AACH,MAAsB,cAAe,SAAQ,wCAAoB;CAGhE;AAHD,wCAGC","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 { CustomAttributeClass, CustomAttributeContainerType } from \"@itwin/ecschema-metadata\";\n\n/**\n * @internal\n * An abstract class used for Schema editing.\n */\nexport abstract class MutableCAClass extends CustomAttributeClass {\n public abstract override setContainerType(containerType: CustomAttributeContainerType): void;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
@@ -1,35 +1,35 @@
1
- import { CustomAttribute, ECClass, ECClassModifier, Enumeration, EnumerationArrayProperty, EnumerationProperty, PrimitiveArrayProperty, PrimitiveProperty, PrimitiveType, Property, StructArrayProperty, StructClass, StructProperty } from "@itwin/ecschema-metadata";
2
- /**
3
- * @internal
4
- * An abstract class used for schema editing.
5
- */
6
- export declare abstract class MutableStructClass extends StructClass {
7
- abstract setDisplayLabel(displayLabel: string): void;
8
- }
9
- /**
10
- * Hackish approach that works like a "friend class" so we can access protected members without making them public.
11
- * @internal
12
- */
13
- export declare abstract class MutableClass extends ECClass {
14
- abstract addCustomAttribute(customAttribute: CustomAttribute): void;
15
- abstract setModifier(modifier: ECClassModifier): void;
16
- abstract createPrimitiveProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveProperty>;
17
- abstract createPrimitiveProperty(name: string, primitiveType: Enumeration): Promise<EnumerationProperty>;
18
- abstract createPrimitiveProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property>;
19
- abstract createPrimitivePropertySync(name: string, primitiveType: PrimitiveType): PrimitiveProperty;
20
- abstract createPrimitivePropertySync(name: string, primitiveType: Enumeration): EnumerationProperty;
21
- abstract createPrimitivePropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property;
22
- abstract createPrimitiveArrayProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveArrayProperty>;
23
- abstract createPrimitiveArrayProperty(name: string, primitiveType: Enumeration): Promise<EnumerationArrayProperty>;
24
- abstract createPrimitiveArrayProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property>;
25
- abstract createPrimitiveArrayPropertySync(name: string, primitiveType: PrimitiveType): PrimitiveArrayProperty;
26
- abstract createPrimitiveArrayPropertySync(name: string, primitiveType: Enumeration): EnumerationArrayProperty;
27
- abstract createPrimitiveArrayPropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property;
28
- abstract createStructProperty(name: string, structType: string | StructClass): Promise<StructProperty>;
29
- abstract createStructPropertySync(name: string, structType: string | StructClass): StructProperty;
30
- abstract createStructArrayProperty(name: string, structType: string | StructClass): Promise<StructArrayProperty>;
31
- abstract createStructArrayPropertySync(name: string, structType: string | StructClass): StructArrayProperty;
32
- abstract deleteProperty(name: string): Promise<void>;
33
- abstract deletePropertySync(name: string): void;
34
- }
1
+ import { CustomAttribute, ECClass, ECClassModifier, Enumeration, EnumerationArrayProperty, EnumerationProperty, PrimitiveArrayProperty, PrimitiveProperty, PrimitiveType, Property, StructArrayProperty, StructClass, StructProperty } from "@itwin/ecschema-metadata";
2
+ /**
3
+ * @internal
4
+ * An abstract class used for schema editing.
5
+ */
6
+ export declare abstract class MutableStructClass extends StructClass {
7
+ abstract setDisplayLabel(displayLabel: string): void;
8
+ }
9
+ /**
10
+ * Hackish approach that works like a "friend class" so we can access protected members without making them public.
11
+ * @internal
12
+ */
13
+ export declare abstract class MutableClass extends ECClass {
14
+ abstract addCustomAttribute(customAttribute: CustomAttribute): void;
15
+ abstract setModifier(modifier: ECClassModifier): void;
16
+ abstract createPrimitiveProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveProperty>;
17
+ abstract createPrimitiveProperty(name: string, primitiveType: Enumeration): Promise<EnumerationProperty>;
18
+ abstract createPrimitiveProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property>;
19
+ abstract createPrimitivePropertySync(name: string, primitiveType: PrimitiveType): PrimitiveProperty;
20
+ abstract createPrimitivePropertySync(name: string, primitiveType: Enumeration): EnumerationProperty;
21
+ abstract createPrimitivePropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property;
22
+ abstract createPrimitiveArrayProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveArrayProperty>;
23
+ abstract createPrimitiveArrayProperty(name: string, primitiveType: Enumeration): Promise<EnumerationArrayProperty>;
24
+ abstract createPrimitiveArrayProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property>;
25
+ abstract createPrimitiveArrayPropertySync(name: string, primitiveType: PrimitiveType): PrimitiveArrayProperty;
26
+ abstract createPrimitiveArrayPropertySync(name: string, primitiveType: Enumeration): EnumerationArrayProperty;
27
+ abstract createPrimitiveArrayPropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property;
28
+ abstract createStructProperty(name: string, structType: string | StructClass): Promise<StructProperty>;
29
+ abstract createStructPropertySync(name: string, structType: string | StructClass): StructProperty;
30
+ abstract createStructArrayProperty(name: string, structType: string | StructClass): Promise<StructArrayProperty>;
31
+ abstract createStructArrayPropertySync(name: string, structType: string | StructClass): StructArrayProperty;
32
+ abstract deleteProperty(name: string): Promise<void>;
33
+ abstract deletePropertySync(name: string): void;
34
+ }
35
35
  //# sourceMappingURL=MutableClass.d.ts.map