@itwin/core-backend 5.13.0-dev.9 → 5.14.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/lib/cjs/Category.d.ts +4 -4
  3. package/lib/cjs/Category.js.map +1 -1
  4. package/lib/cjs/ChangesetECAdaptor.d.ts +5 -0
  5. package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
  6. package/lib/cjs/ChangesetECAdaptor.js +13 -3
  7. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  8. package/lib/cjs/CodeSpecs.d.ts +3 -3
  9. package/lib/cjs/CodeSpecs.js.map +1 -1
  10. package/lib/cjs/DisplayStyle.d.ts +2 -2
  11. package/lib/cjs/DisplayStyle.js.map +1 -1
  12. package/lib/cjs/EditTxn.d.ts.map +1 -1
  13. package/lib/cjs/EditTxn.js +1 -0
  14. package/lib/cjs/EditTxn.js.map +1 -1
  15. package/lib/cjs/Element.d.ts +48 -12
  16. package/lib/cjs/Element.d.ts.map +1 -1
  17. package/lib/cjs/Element.js +120 -24
  18. package/lib/cjs/Element.js.map +1 -1
  19. package/lib/cjs/IModelDb.d.ts +30 -15
  20. package/lib/cjs/IModelDb.d.ts.map +1 -1
  21. package/lib/cjs/IModelDb.js +51 -15
  22. package/lib/cjs/IModelDb.js.map +1 -1
  23. package/lib/cjs/Model.d.ts +5 -5
  24. package/lib/cjs/Model.d.ts.map +1 -1
  25. package/lib/cjs/Model.js.map +1 -1
  26. package/lib/cjs/PropertyStore.js +1 -1
  27. package/lib/cjs/PropertyStore.js.map +1 -1
  28. package/lib/cjs/SchemaSync.d.ts +37 -9
  29. package/lib/cjs/SchemaSync.d.ts.map +1 -1
  30. package/lib/cjs/SchemaSync.js +125 -6
  31. package/lib/cjs/SchemaSync.js.map +1 -1
  32. package/lib/cjs/SynchronousChannel.d.ts +62 -0
  33. package/lib/cjs/SynchronousChannel.d.ts.map +1 -0
  34. package/lib/cjs/SynchronousChannel.js +11 -0
  35. package/lib/cjs/SynchronousChannel.js.map +1 -0
  36. package/lib/cjs/Texture.d.ts +1 -1
  37. package/lib/cjs/Texture.js.map +1 -1
  38. package/lib/cjs/TxnManager.d.ts +44 -4
  39. package/lib/cjs/TxnManager.d.ts.map +1 -1
  40. package/lib/cjs/TxnManager.js +72 -14
  41. package/lib/cjs/TxnManager.js.map +1 -1
  42. package/lib/cjs/ViewDefinition.d.ts +6 -6
  43. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  44. package/lib/cjs/ViewDefinition.js.map +1 -1
  45. package/lib/cjs/annotations/LeaderGeometry.d.ts +22 -7
  46. package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -1
  47. package/lib/cjs/annotations/LeaderGeometry.js +104 -36
  48. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
  49. package/lib/cjs/annotations/TextAnnotationElement.d.ts +1 -1
  50. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
  51. package/lib/cjs/annotations/TextAnnotationElement.js +25 -10
  52. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  53. package/lib/cjs/core-backend.d.ts +1 -0
  54. package/lib/cjs/core-backend.d.ts.map +1 -1
  55. package/lib/cjs/core-backend.js +1 -0
  56. package/lib/cjs/core-backend.js.map +1 -1
  57. package/lib/cjs/internal/IntegrityCheck.d.ts +22 -0
  58. package/lib/cjs/internal/IntegrityCheck.d.ts.map +1 -1
  59. package/lib/cjs/internal/IntegrityCheck.js +13 -0
  60. package/lib/cjs/internal/IntegrityCheck.js.map +1 -1
  61. package/lib/cjs/internal/NoReservations.d.ts +6 -0
  62. package/lib/cjs/internal/NoReservations.d.ts.map +1 -0
  63. package/lib/cjs/internal/NoReservations.js +21 -0
  64. package/lib/cjs/internal/NoReservations.js.map +1 -0
  65. package/lib/cjs/internal/SchemaSyncReservations.d.ts +4 -0
  66. package/lib/cjs/internal/SchemaSyncReservations.d.ts.map +1 -0
  67. package/lib/cjs/internal/SchemaSyncReservations.js +118 -0
  68. package/lib/cjs/internal/SchemaSyncReservations.js.map +1 -0
  69. package/lib/cjs/internal/Symbols.d.ts +1 -0
  70. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  71. package/lib/cjs/internal/Symbols.js +2 -1
  72. package/lib/cjs/internal/Symbols.js.map +1 -1
  73. package/lib/esm/Category.d.ts +4 -4
  74. package/lib/esm/Category.js.map +1 -1
  75. package/lib/esm/ChangesetECAdaptor.d.ts +5 -0
  76. package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
  77. package/lib/esm/ChangesetECAdaptor.js +13 -3
  78. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  79. package/lib/esm/CodeSpecs.d.ts +3 -3
  80. package/lib/esm/CodeSpecs.js.map +1 -1
  81. package/lib/esm/DisplayStyle.d.ts +2 -2
  82. package/lib/esm/DisplayStyle.js.map +1 -1
  83. package/lib/esm/EditTxn.d.ts.map +1 -1
  84. package/lib/esm/EditTxn.js +1 -0
  85. package/lib/esm/EditTxn.js.map +1 -1
  86. package/lib/esm/Element.d.ts +48 -12
  87. package/lib/esm/Element.d.ts.map +1 -1
  88. package/lib/esm/Element.js +121 -25
  89. package/lib/esm/Element.js.map +1 -1
  90. package/lib/esm/IModelDb.d.ts +30 -15
  91. package/lib/esm/IModelDb.d.ts.map +1 -1
  92. package/lib/esm/IModelDb.js +52 -16
  93. package/lib/esm/IModelDb.js.map +1 -1
  94. package/lib/esm/Model.d.ts +5 -5
  95. package/lib/esm/Model.d.ts.map +1 -1
  96. package/lib/esm/Model.js.map +1 -1
  97. package/lib/esm/PropertyStore.js +1 -1
  98. package/lib/esm/PropertyStore.js.map +1 -1
  99. package/lib/esm/SchemaSync.d.ts +37 -9
  100. package/lib/esm/SchemaSync.d.ts.map +1 -1
  101. package/lib/esm/SchemaSync.js +127 -8
  102. package/lib/esm/SchemaSync.js.map +1 -1
  103. package/lib/esm/SynchronousChannel.d.ts +62 -0
  104. package/lib/esm/SynchronousChannel.d.ts.map +1 -0
  105. package/lib/esm/SynchronousChannel.js +9 -0
  106. package/lib/esm/SynchronousChannel.js.map +1 -0
  107. package/lib/esm/Texture.d.ts +1 -1
  108. package/lib/esm/Texture.js.map +1 -1
  109. package/lib/esm/TxnManager.d.ts +44 -4
  110. package/lib/esm/TxnManager.d.ts.map +1 -1
  111. package/lib/esm/TxnManager.js +72 -14
  112. package/lib/esm/TxnManager.js.map +1 -1
  113. package/lib/esm/ViewDefinition.d.ts +6 -6
  114. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  115. package/lib/esm/ViewDefinition.js.map +1 -1
  116. package/lib/esm/annotations/LeaderGeometry.d.ts +22 -7
  117. package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -1
  118. package/lib/esm/annotations/LeaderGeometry.js +104 -36
  119. package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
  120. package/lib/esm/annotations/TextAnnotationElement.d.ts +1 -1
  121. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
  122. package/lib/esm/annotations/TextAnnotationElement.js +25 -10
  123. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  124. package/lib/esm/core-backend.d.ts +1 -0
  125. package/lib/esm/core-backend.d.ts.map +1 -1
  126. package/lib/esm/core-backend.js +1 -0
  127. package/lib/esm/core-backend.js.map +1 -1
  128. package/lib/esm/internal/IntegrityCheck.d.ts +22 -0
  129. package/lib/esm/internal/IntegrityCheck.d.ts.map +1 -1
  130. package/lib/esm/internal/IntegrityCheck.js +13 -0
  131. package/lib/esm/internal/IntegrityCheck.js.map +1 -1
  132. package/lib/esm/internal/NoReservations.d.ts +6 -0
  133. package/lib/esm/internal/NoReservations.d.ts.map +1 -0
  134. package/lib/esm/internal/NoReservations.js +18 -0
  135. package/lib/esm/internal/NoReservations.js.map +1 -0
  136. package/lib/esm/internal/SchemaSyncReservations.d.ts +4 -0
  137. package/lib/esm/internal/SchemaSyncReservations.d.ts.map +1 -0
  138. package/lib/esm/internal/SchemaSyncReservations.js +115 -0
  139. package/lib/esm/internal/SchemaSyncReservations.js.map +1 -0
  140. package/lib/esm/internal/Symbols.d.ts +1 -0
  141. package/lib/esm/internal/Symbols.d.ts.map +1 -1
  142. package/lib/esm/internal/Symbols.js +1 -0
  143. package/lib/esm/internal/Symbols.js.map +1 -1
  144. package/lib/esm/test/IModelTestUtils.d.ts +1 -1
  145. package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
  146. package/lib/esm/test/IModelTestUtils.js +8 -3
  147. package/lib/esm/test/IModelTestUtils.js.map +1 -1
  148. package/lib/esm/test/annotations/LeaderGeometry.test.js +178 -2
  149. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
  150. package/lib/esm/test/annotations/TextAnnotation.test.js +48 -18
  151. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  152. package/lib/esm/test/ecdb/ECSqlStatement.test.js +177 -0
  153. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  154. package/lib/esm/test/ecdb/QueryReaders.test.js +2 -16
  155. package/lib/esm/test/ecdb/QueryReaders.test.js.map +1 -1
  156. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js +2 -2
  157. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  158. package/lib/esm/test/element/ElementRoundTrip.test.js +80 -2
  159. package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
  160. package/lib/esm/test/imodel/IModelECSql.test.d.ts +2 -0
  161. package/lib/esm/test/imodel/IModelECSql.test.d.ts.map +1 -0
  162. package/lib/esm/test/imodel/IModelECSql.test.js +367 -0
  163. package/lib/esm/test/imodel/IModelECSql.test.js.map +1 -0
  164. package/lib/esm/test/imodel/IModelElements.test.d.ts +2 -0
  165. package/lib/esm/test/imodel/IModelElements.test.d.ts.map +1 -0
  166. package/lib/esm/test/imodel/IModelElements.test.js +969 -0
  167. package/lib/esm/test/imodel/IModelElements.test.js.map +1 -0
  168. package/lib/esm/test/imodel/IModelGeolocation.test.d.ts +2 -0
  169. package/lib/esm/test/imodel/IModelGeolocation.test.d.ts.map +1 -0
  170. package/lib/esm/test/imodel/IModelGeolocation.test.js +539 -0
  171. package/lib/esm/test/imodel/IModelGeolocation.test.js.map +1 -0
  172. package/lib/esm/test/imodel/IModelLifecycle.test.d.ts +2 -0
  173. package/lib/esm/test/imodel/IModelLifecycle.test.d.ts.map +1 -0
  174. package/lib/esm/test/imodel/IModelLifecycle.test.js +499 -0
  175. package/lib/esm/test/imodel/IModelLifecycle.test.js.map +1 -0
  176. package/lib/esm/test/imodel/IModelMetadata.test.d.ts +2 -0
  177. package/lib/esm/test/imodel/IModelMetadata.test.d.ts.map +1 -0
  178. package/lib/esm/test/imodel/IModelMetadata.test.js +274 -0
  179. package/lib/esm/test/imodel/IModelMetadata.test.js.map +1 -0
  180. package/lib/esm/test/imodel/IModelModels.test.d.ts +2 -0
  181. package/lib/esm/test/imodel/IModelModels.test.d.ts.map +1 -0
  182. package/lib/esm/test/imodel/IModelModels.test.js +357 -0
  183. package/lib/esm/test/imodel/IModelModels.test.js.map +1 -0
  184. package/lib/esm/test/imodel/IModelRelationships.test.d.ts +2 -0
  185. package/lib/esm/test/imodel/IModelRelationships.test.d.ts.map +1 -0
  186. package/lib/esm/test/imodel/IModelRelationships.test.js +407 -0
  187. package/lib/esm/test/imodel/IModelRelationships.test.js.map +1 -0
  188. package/lib/esm/test/imodel/IModelTestFixtures.d.ts +53 -0
  189. package/lib/esm/test/imodel/IModelTestFixtures.d.ts.map +1 -0
  190. package/lib/esm/test/imodel/IModelTestFixtures.js +107 -0
  191. package/lib/esm/test/imodel/IModelTestFixtures.js.map +1 -0
  192. package/lib/esm/test/imodel/IModelViews.test.d.ts +2 -0
  193. package/lib/esm/test/imodel/IModelViews.test.d.ts.map +1 -0
  194. package/lib/esm/test/imodel/IModelViews.test.js +199 -0
  195. package/lib/esm/test/imodel/IModelViews.test.js.map +1 -0
  196. package/lib/esm/test/index.d.ts +0 -1
  197. package/lib/esm/test/index.d.ts.map +1 -1
  198. package/lib/esm/test/index.js +0 -1
  199. package/lib/esm/test/index.js.map +1 -1
  200. package/lib/esm/test/standalone/ChangesetReader.test.js +8 -26
  201. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  202. package/lib/esm/test/standalone/DgnDomainMergeConflict.test.d.ts +2 -0
  203. package/lib/esm/test/standalone/DgnDomainMergeConflict.test.d.ts.map +1 -0
  204. package/lib/esm/test/standalone/DgnDomainMergeConflict.test.js +263 -0
  205. package/lib/esm/test/standalone/DgnDomainMergeConflict.test.js.map +1 -0
  206. package/lib/esm/test/standalone/GeometryStream.test.js +1 -3
  207. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  208. package/lib/esm/test/standalone/IModelWrite.test.d.ts.map +1 -1
  209. package/lib/esm/test/standalone/IModelWrite.test.js +78 -1
  210. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  211. package/lib/esm/test/standalone/IntegrityCheck.test.js +29 -10
  212. package/lib/esm/test/standalone/IntegrityCheck.test.js.map +1 -1
  213. package/lib/esm/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.js +23 -0
  214. package/lib/esm/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.js.map +1 -1
  215. package/lib/esm/test/standalone/SchemaSyncDb.test.d.ts +2 -0
  216. package/lib/esm/test/standalone/SchemaSyncDb.test.d.ts.map +1 -0
  217. package/lib/esm/test/standalone/SchemaSyncDb.test.js +221 -0
  218. package/lib/esm/test/standalone/SchemaSyncDb.test.js.map +1 -0
  219. package/lib/esm/test/standalone/SchemaSyncElementReservation.test.d.ts +2 -0
  220. package/lib/esm/test/standalone/SchemaSyncElementReservation.test.d.ts.map +1 -0
  221. package/lib/esm/test/standalone/SchemaSyncElementReservation.test.js +459 -0
  222. package/lib/esm/test/standalone/SchemaSyncElementReservation.test.js.map +1 -0
  223. package/lib/esm/test/standalone/SnapshotDb.test.js +1 -0
  224. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  225. package/lib/esm/test/standalone/TxnManager.test.js +108 -8
  226. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  227. package/package.json +14 -17
  228. package/lib/esm/test/RevisionUtility.d.ts +0 -33
  229. package/lib/esm/test/RevisionUtility.d.ts.map +0 -1
  230. package/lib/esm/test/RevisionUtility.js +0 -52
  231. package/lib/esm/test/RevisionUtility.js.map +0 -1
  232. package/lib/esm/test/imodel/IModel.test.d.ts +0 -2
  233. package/lib/esm/test/imodel/IModel.test.d.ts.map +0 -1
  234. package/lib/esm/test/imodel/IModel.test.js +0 -3277
  235. package/lib/esm/test/imodel/IModel.test.js.map +0 -1
@@ -0,0 +1,21 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.createNoOpReservations = createNoOpReservations;
8
+ const Symbols_1 = require("./Symbols");
9
+ /** A null-implementation of SynchronousChannel.Reservations for iModels that don't use SchemaSync-backed reservations. */
10
+ class NoReservations {
11
+ [Symbols_1._implementationProhibited] = undefined;
12
+ get isServerBased() { return false; }
13
+ [Symbols_1._close]() { }
14
+ [Symbols_1._onReservedElementInsert]() { }
15
+ needsElementReservation() { return false; }
16
+ async reserveElements() { }
17
+ }
18
+ function createNoOpReservations() {
19
+ return new NoReservations();
20
+ }
21
+ //# sourceMappingURL=NoReservations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoReservations.js","sourceRoot":"","sources":["../../../src/internal/NoReservations.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;AAmB/F,wDAEC;AAdD,uCAAwF;AAExF,0HAA0H;AAC1H,MAAM,cAAc;IACF,CAAC,mCAAyB,CAAC,GAAG,SAAS,CAAC;IACxD,IAAW,aAAa,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC;IACrC,CAAC,gBAAM,CAAC,KAAW,CAAC;IACpB,CAAC,kCAAwB,CAAC,KAAW,CAAC;IACtC,uBAAuB,KAAc,OAAO,KAAK,CAAC,CAAC,CAAC;IACpD,KAAK,CAAC,eAAe,KAAoB,CAAC;CAClD;AAED,SAAgB,sBAAsB;IACpC,OAAO,IAAI,cAAc,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport { SynchronousChannel } from \"../SynchronousChannel\";\r\nimport { _close, _implementationProhibited, _onReservedElementInsert } from \"./Symbols\";\r\n\r\n/** A null-implementation of SynchronousChannel.Reservations for iModels that don't use SchemaSync-backed reservations. */\r\nclass NoReservations implements SynchronousChannel.Reservations {\r\n public readonly [_implementationProhibited] = undefined;\r\n public get isServerBased() { return false; }\r\n public [_close](): void { }\r\n public [_onReservedElementInsert](): void { }\r\n public needsElementReservation(): boolean { return false; }\r\n public async reserveElements(): Promise<void> { }\r\n}\r\n\r\nexport function createNoOpReservations(): SynchronousChannel.Reservations {\r\n return new NoReservations();\r\n}\r\n"]}
@@ -0,0 +1,4 @@
1
+ import { IModelDb } from "../IModelDb";
2
+ import { SynchronousChannel } from "../SynchronousChannel";
3
+ export declare function createSchemaSyncReservations(iModel: IModelDb): Promise<SynchronousChannel.Reservations>;
4
+ //# sourceMappingURL=SchemaSyncReservations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaSyncReservations.d.ts","sourceRoot":"","sources":["../../../src/internal/SchemaSyncReservations.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAwB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AA6H3D,wBAAsB,4BAA4B,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAE7G"}
@@ -0,0 +1,118 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.createSchemaSyncReservations = createSchemaSyncReservations;
8
+ /** @packageDocumentation
9
+ * @module iModels
10
+ */
11
+ const core_bentley_1 = require("@itwin/core-bentley");
12
+ const core_common_1 = require("@itwin/core-common");
13
+ const SchemaSync_1 = require("../SchemaSync");
14
+ const Symbols_1 = require("./Symbols");
15
+ const Category_1 = require("../Category");
16
+ class SchemaSyncReservations {
17
+ [Symbols_1._implementationProhibited] = undefined;
18
+ get isServerBased() { return true; }
19
+ _iModel;
20
+ _schemaSync;
21
+ constructor(iModel, schemaSync) {
22
+ this._iModel = iModel;
23
+ this._schemaSync = schemaSync;
24
+ }
25
+ static async create(iModel) {
26
+ const schemaSync = await SchemaSync_1.SchemaSync.getCloudAccess(iModel);
27
+ schemaSync.synchronizeWithCloud();
28
+ return new SchemaSyncReservations(iModel, schemaSync);
29
+ }
30
+ [Symbols_1._close]() {
31
+ try {
32
+ this._schemaSync.close();
33
+ }
34
+ catch {
35
+ // best-effort cleanup; never throw out of close hooks
36
+ }
37
+ }
38
+ needsElementReservation(federationGuid) {
39
+ if (!SchemaSync_1.SchemaSync.isEnabled(this._iModel))
40
+ return false;
41
+ if (!core_bentley_1.Guid.isGuid(federationGuid))
42
+ core_common_1.ElementReservationError.throwError("invalid-reservation", { message: "Invalid federationGuid" });
43
+ return !this._schemaSync.reader.findReservedElement(federationGuid);
44
+ }
45
+ async reserveElements(args) {
46
+ const validated = this.validateProposedReservations(args);
47
+ await this._schemaSync.writeLocker.reserveElements(validated);
48
+ }
49
+ [Symbols_1._onReservedElementInsert](arg) {
50
+ if (!SchemaSync_1.SchemaSync.isEnabled(arg.iModel) || arg.iModel.holdsSchemaLock)
51
+ return;
52
+ const fedGuid = arg.props.federationGuid;
53
+ // The hook is only invoked for elements with an explicitly-set federationGuid (gated in Element.onInsert),
54
+ // but validate defensively.
55
+ if (fedGuid === undefined || !core_bentley_1.Guid.isGuid(fedGuid))
56
+ core_common_1.ElementReservationError.throwError("invalid-reservation", { message: "Element inserts require a valid federationGuid when SchemaSync is enabled" });
57
+ // It should be impossible for us to still have local changes, but check just in case,
58
+ // since we can't trust the contents of the SchemaSyncDb until they've been successfully pushed.
59
+ if (this._schemaSync.container.hasLocalChanges)
60
+ core_common_1.ElementReservationError.throwError("container-has-local-changes", { message: "Element inserts are not allowed when there are local changes in the SchemaSync container" });
61
+ const code = core_common_1.Code.fromJSON(arg.props.code);
62
+ const existing = this._schemaSync.reader.findReservedElement(fedGuid);
63
+ if (!existing) {
64
+ core_common_1.ElementReservationError.throwError("reservation-not-found", {
65
+ message: `No SchemaSync reservation found for element with federationGuid ${fedGuid} — include it in a SynchronousChannel.Reservations.reserveElements call before inserting`,
66
+ federationGuid: fedGuid,
67
+ });
68
+ }
69
+ const expectedClassId = arg.iModel[Symbols_1._nativeDb].classNameToId(arg.props.classFullName);
70
+ if (existing.ecClassId !== expectedClassId) {
71
+ core_common_1.ElementReservationError.throwError("reservation-conflict", {
72
+ message: `Element ${existing.federationGuid} reserved as a different class than the insert (${existing.ecClassId} vs ${expectedClassId})`,
73
+ federationGuid: existing.federationGuid,
74
+ });
75
+ }
76
+ if (!existing.code.equals(code))
77
+ core_common_1.ElementReservationError.throwError("reservation-conflict", {
78
+ message: `Element ${existing.federationGuid} insert uses a different Code than was reserved`,
79
+ federationGuid: existing.federationGuid,
80
+ });
81
+ arg.props.id = existing.elementId;
82
+ const options = arg.options ?? (arg.options = {});
83
+ options.forceUseId = true;
84
+ }
85
+ validateProposedReservations(args) {
86
+ const out = [];
87
+ const errors = [];
88
+ for (const props of args.elements) {
89
+ if (!props.federationGuid || !core_bentley_1.Guid.isGuid(props.federationGuid)) {
90
+ errors.push(`element reservation requires an explicit, valid federationGuid (got '${props.federationGuid ?? "<none>"}')`);
91
+ continue;
92
+ }
93
+ const code = props.code ? core_common_1.Code.fromJSON(props.code) : core_common_1.Code.createEmpty();
94
+ if (code.value && !core_common_1.Code.isValid(code)) {
95
+ errors.push(`(${props.federationGuid}): invalid code '${code.toString()}'`);
96
+ continue;
97
+ }
98
+ const ecClassId = this._iModel[Symbols_1._nativeDb].classNameToId(props.classFullName);
99
+ if (!core_bentley_1.Id64.isValidId64(ecClassId)) {
100
+ errors.push(`(${props.federationGuid}): unknown class '${props.classFullName}'`);
101
+ continue;
102
+ }
103
+ out.push({
104
+ federationGuid: props.federationGuid,
105
+ ecClassId,
106
+ code,
107
+ isCategory: props.classFullName === Category_1.Category.classFullName || this._iModel[Symbols_1._nativeDb].isSubClassOf(props.classFullName, Category_1.Category.classFullName),
108
+ });
109
+ }
110
+ if (errors.length > 0)
111
+ core_common_1.ElementReservationError.throwError("invalid-reservation", { message: `Invalid element(s) for reservation:\n ${errors.join("\n ")}` });
112
+ return out;
113
+ }
114
+ }
115
+ async function createSchemaSyncReservations(iModel) {
116
+ return SchemaSyncReservations.create(iModel);
117
+ }
118
+ //# sourceMappingURL=SchemaSyncReservations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaSyncReservations.js","sourceRoot":"","sources":["../../../src/internal/SchemaSyncReservations.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;AAuI/F,oEAEC;AAvID;;GAEG;AAEH,sDAA6D;AAC7D,oDAAmE;AAInE,8CAA2C;AAC3C,uCAAmG;AACnG,0CAAuC;AAEvC,MAAM,sBAAsB;IACV,CAAC,mCAAyB,CAAC,GAAG,SAAS,CAAC;IACxD,IAAW,aAAa,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IA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M,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAS,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAC7E,IAAI,CAAC,mBAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;gBACjC,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,cAAc,qBAAqB,KAAK,CAAC,aAAa,GAAG,CAAC,CAAC;gBACjF,SAAS;YACX,CAAC;YAED,GAAG,CAAC,IAAI,CAAC;gBACP,cAAc,EAAE,KAAK,CAAC,cAAc;gBACpC,SAAS;gBACT,IAAI;gBACJ,UAAU,EAAE,KAAK,CAAC,aAAa,KAAK,mBAAQ,CAAC,aAAa,IAAI,IAAI,CAAC,OAAO,CAAC,mBAAS,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,aAAa,EAAE,mBAAQ,CAAC,aAAa,CAAC;aAChJ,CAAC,CAAC;QACL,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;YACnB,qCAAuB,CAAC,UAAU,CAAC,qBAAqB,EAAE,EAAE,OAAO,EAAE,0CAA0C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QAE1I,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAEM,KAAK,UAAU,4BAA4B,CAAC,MAAgB;IACjE,OAAO,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport { Guid, GuidString, Id64 } from \"@itwin/core-bentley\";\r\nimport { Code, ElementReservationError } from \"@itwin/core-common\";\r\nimport { OnElementPropsArg } from \"../Element\";\r\nimport { IModelDb, InsertElementOptions } from \"../IModelDb\";\r\nimport { SynchronousChannel } from \"../SynchronousChannel\";\r\nimport { SchemaSync } from \"../SchemaSync\";\r\nimport { _close, _implementationProhibited, _nativeDb, _onReservedElementInsert } from \"./Symbols\";\r\nimport { Category } from \"../Category\";\r\n\r\nclass SchemaSyncReservations implements SynchronousChannel.Reservations {\r\n public readonly [_implementationProhibited] = undefined;\r\n public get isServerBased() { return true; }\r\n private readonly _iModel: IModelDb;\r\n private readonly _schemaSync: SchemaSync.CloudAccess;\r\n\r\n private constructor(iModel: IModelDb, schemaSync: SchemaSync.CloudAccess) {\r\n this._iModel = iModel;\r\n this._schemaSync = schemaSync;\r\n }\r\n\r\n public static async create(iModel: IModelDb): Promise<SchemaSyncReservations> {\r\n const schemaSync = await SchemaSync.getCloudAccess(iModel);\r\n schemaSync.synchronizeWithCloud();\r\n return new SchemaSyncReservations(iModel, schemaSync);\r\n }\r\n\r\n public [_close](): void {\r\n try {\r\n this._schemaSync.close();\r\n } catch {\r\n // best-effort cleanup; never throw out of close hooks\r\n }\r\n }\r\n\r\n public needsElementReservation(federationGuid: GuidString): boolean {\r\n if (!SchemaSync.isEnabled(this._iModel))\r\n return false;\r\n\r\n if (!Guid.isGuid(federationGuid))\r\n ElementReservationError.throwError(\"invalid-reservation\", { message: \"Invalid federationGuid\" });\r\n\r\n return !this._schemaSync.reader.findReservedElement(federationGuid);\r\n }\r\n\r\n public async reserveElements(args: SynchronousChannel.ReserveElementsArgs): Promise<void> {\r\n const validated = this.validateProposedReservations(args);\r\n await this._schemaSync.writeLocker.reserveElements(validated);\r\n }\r\n\r\n public [_onReservedElementInsert](arg: OnElementPropsArg): void {\r\n if (!SchemaSync.isEnabled(arg.iModel) || arg.iModel.holdsSchemaLock)\r\n return;\r\n\r\n const fedGuid = arg.props.federationGuid;\r\n // The hook is only invoked for elements with an explicitly-set federationGuid (gated in Element.onInsert),\r\n // but validate defensively.\r\n if (fedGuid === undefined || !Guid.isGuid(fedGuid))\r\n ElementReservationError.throwError(\"invalid-reservation\", { message: \"Element inserts require a valid federationGuid when SchemaSync is enabled\" });\r\n\r\n // It should be impossible for us to still have local changes, but check just in case,\r\n // since we can't trust the contents of the SchemaSyncDb until they've been successfully pushed.\r\n if (this._schemaSync.container.hasLocalChanges)\r\n ElementReservationError.throwError(\"container-has-local-changes\", { message: \"Element inserts are not allowed when there are local changes in the SchemaSync container\" });\r\n\r\n const code = Code.fromJSON(arg.props.code);\r\n\r\n const existing = this._schemaSync.reader.findReservedElement(fedGuid);\r\n if (!existing) {\r\n ElementReservationError.throwError(\"reservation-not-found\", {\r\n message: `No SchemaSync reservation found for element with federationGuid ${fedGuid} — include it in a SynchronousChannel.Reservations.reserveElements call before inserting`,\r\n federationGuid: fedGuid,\r\n });\r\n }\r\n\r\n const expectedClassId = arg.iModel[_nativeDb].classNameToId(arg.props.classFullName);\r\n if (existing.ecClassId !== expectedClassId) {\r\n ElementReservationError.throwError(\"reservation-conflict\", {\r\n message: `Element ${existing.federationGuid} reserved as a different class than the insert (${existing.ecClassId} vs ${expectedClassId})`,\r\n federationGuid: existing.federationGuid,\r\n });\r\n }\r\n\r\n if (!existing.code.equals(code))\r\n ElementReservationError.throwError(\"reservation-conflict\", {\r\n message: `Element ${existing.federationGuid} insert uses a different Code than was reserved`,\r\n federationGuid: existing.federationGuid,\r\n });\r\n\r\n arg.props.id = existing.elementId;\r\n const options = arg.options ?? (arg.options = {} as InsertElementOptions);\r\n options.forceUseId = true;\r\n }\r\n\r\n private validateProposedReservations(args: SynchronousChannel.ReserveElementsArgs): SchemaSync.ProposedElementReservation[] {\r\n const out: SchemaSync.ProposedElementReservation[] = [];\r\n const errors: string[] = [];\r\n for (const props of args.elements) {\r\n if (!props.federationGuid || !Guid.isGuid(props.federationGuid)) {\r\n errors.push(`element reservation requires an explicit, valid federationGuid (got '${props.federationGuid ?? \"<none>\"}')`);\r\n continue;\r\n }\r\n\r\n const code = props.code ? Code.fromJSON(props.code) : Code.createEmpty();\r\n if (code.value && !Code.isValid(code)) {\r\n errors.push(`(${props.federationGuid}): invalid code '${code.toString()}'`);\r\n continue;\r\n }\r\n\r\n const ecClassId = this._iModel[_nativeDb].classNameToId(props.classFullName);\r\n if (!Id64.isValidId64(ecClassId)) {\r\n errors.push(`(${props.federationGuid}): unknown class '${props.classFullName}'`);\r\n continue;\r\n }\r\n\r\n out.push({\r\n federationGuid: props.federationGuid,\r\n ecClassId,\r\n code,\r\n isCategory: props.classFullName === Category.classFullName || this._iModel[_nativeDb].isSubClassOf(props.classFullName, Category.classFullName),\r\n });\r\n }\r\n\r\n if (errors.length > 0)\r\n ElementReservationError.throwError(\"invalid-reservation\", { message: `Invalid element(s) for reservation:\\n ${errors.join(\"\\n \")}` });\r\n\r\n return out;\r\n }\r\n}\r\n\r\nexport async function createSchemaSyncReservations(iModel: IModelDb): Promise<SynchronousChannel.Reservations> {\r\n return SchemaSyncReservations.create(iModel);\r\n}\r\n"]}
@@ -23,4 +23,5 @@ export declare const _instanceKeyCache: unique symbol;
23
23
  /** @internal */
24
24
  export declare const _activeTxn: unique symbol;
25
25
  export declare const _resetIModelDb: unique symbol;
26
+ export declare const _onReservedElementInsert: unique symbol;
26
27
  //# sourceMappingURL=Symbols.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Symbols.d.ts","sourceRoot":"","sources":["../../../src/internal/Symbols.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,eAAO,MAAM,yBAAyB,eAAmG,CAAC;AAM1I,eAAO,MAAM,MAAM,eAA2B,CAAC;AAC/C,eAAO,MAAM,kBAAkB,eAAuC,CAAC;AACvE,eAAO,MAAM,UAAU,eAA+B,CAAC;AACvD,eAAO,MAAM,QAAQ,eAA6B,CAAC;AACnD,eAAO,MAAM,IAAI,eAAyB,CAAC;AAC3C,gBAAgB;AAChB,eAAO,MAAM,YAAY,eAAiC,CAAC;AAC3D,gBAAgB;AAChB,eAAO,MAAM,SAAS,eAA8B,CAAC;AACrD,eAAO,MAAM,gBAAgB,eAAqC,CAAC;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M,wBAAwB,eAA6C,CAAC"}
@@ -7,7 +7,7 @@
7
7
  * @module Workspace
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports._resetIModelDb = exports._activeTxn = exports._instanceKeyCache = exports._cache = exports._mockCheckpoint = exports._getHubAccess = exports._setHubAccess = exports._hubAccess = exports._verifyChannel = exports._releaseAllLocks = exports._nativeDb = exports._implicitTxn = exports._key = exports._getData = exports._faceProps = exports._elementWasCreated = exports._close = exports._implementationProhibited = void 0;
10
+ exports._onReservedElementInsert = exports._resetIModelDb = exports._activeTxn = exports._instanceKeyCache = exports._cache = exports._mockCheckpoint = exports._getHubAccess = exports._setHubAccess = exports._hubAccess = exports._verifyChannel = exports._releaseAllLocks = exports._nativeDb = exports._implicitTxn = exports._key = exports._getData = exports._faceProps = exports._elementWasCreated = exports._close = exports._implementationProhibited = void 0;
11
11
  exports._implementationProhibited = Symbol.for("Implementations of this interface can only be obtained from the containing package");
12
12
  function sym(name) {
13
13
  return `${name}_core-backend_INTERNAL_ONLY_DO_NOT_USE`;
@@ -33,4 +33,5 @@ exports._instanceKeyCache = Symbol.for(sym("instanceKeyCache"));
33
33
  /** @internal */
34
34
  exports._activeTxn = Symbol.for(sym("activeTxn"));
35
35
  exports._resetIModelDb = Symbol.for(sym("resetIModelDb"));
36
+ exports._onReservedElementInsert = Symbol.for(sym("onReservedElementInsert"));
36
37
  //# sourceMappingURL=Symbols.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Symbols.js","sourceRoot":"","sources":["../../../src/internal/Symbols.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEU,QAAA,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,oFAAoF,CAAC,CAAC;AAE1I,SAAS,GAAG,CAAC,IAAY;IACvB,OAAO,GAAG,IAAI,wCAAwC,CAAC;AACzD,CAAC;AAEY,QAAA,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CA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,kBAAkB,CAAC,CAAC,CAAC;AACrE,gBAAgB;AACH,QAAA,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;AAC1C,QAAA,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Workspace\r\n */\r\n\r\nexport const _implementationProhibited = Symbol.for(\"Implementations of this interface can only be obtained from the containing package\");\r\n\r\nfunction sym(name: string): string {\r\n return `${name}_core-backend_INTERNAL_ONLY_DO_NOT_USE`;\r\n}\r\n\r\nexport const _close = Symbol.for(sym(\"close\"));\r\nexport const _elementWasCreated = Symbol.for(sym(\"elementWasCreated\"));\r\nexport const _faceProps = Symbol.for(sym(\"faceProps\"));\r\nexport const _getData = Symbol.for(sym(\"getData\"));\r\nexport const _key = Symbol.for(sym(\"key\"));\r\n/** @internal */\r\nexport const _implicitTxn = Symbol.for(sym(\"implicitTxn\"));\r\n/** @internal */\r\nexport const _nativeDb = Symbol.for(sym(\"nativeDb\"));\r\nexport const _releaseAllLocks = Symbol.for(sym(\"releaseAllLocks\"));\r\nexport const _verifyChannel = Symbol.for(sym(\"verifyChannel\"));\r\n/** @internal */\r\nexport const _hubAccess = Symbol.for(sym(\"hubAccess\"));\r\nexport const _setHubAccess = Symbol.for(sym(\"setHubAccess\"));\r\nexport const _getHubAccess = Symbol.for(sym(\"getHubAccess\"));\r\nexport const _mockCheckpoint = Symbol.for(sym(\"mockCheckpoint\"));\r\nexport const _cache = Symbol.for(sym(\"cache\"));\r\nexport const _instanceKeyCache = Symbol.for(sym(\"instanceKeyCache\"));\r\n/** @internal */\r\nexport const _activeTxn = Symbol.for(sym(\"activeTxn\"));\r\nexport const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MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC;AAChD,QAAA,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC;AAChD,QAAA,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACpD,QAAA,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AAClC,QAAA,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC;AACrE,gBAAgB;AACH,QAAA,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;AAC1C,QAAA,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;AAClD,QAAA,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Workspace\r\n */\r\n\r\nexport const _implementationProhibited = Symbol.for(\"Implementations of this interface can only be obtained from the containing package\");\r\n\r\nfunction sym(name: string): string {\r\n return `${name}_core-backend_INTERNAL_ONLY_DO_NOT_USE`;\r\n}\r\n\r\nexport const _close = Symbol.for(sym(\"close\"));\r\nexport const _elementWasCreated = Symbol.for(sym(\"elementWasCreated\"));\r\nexport const _faceProps = Symbol.for(sym(\"faceProps\"));\r\nexport const _getData = Symbol.for(sym(\"getData\"));\r\nexport const _key = Symbol.for(sym(\"key\"));\r\n/** @internal */\r\nexport const _implicitTxn = Symbol.for(sym(\"implicitTxn\"));\r\n/** @internal */\r\nexport const _nativeDb = Symbol.for(sym(\"nativeDb\"));\r\nexport const _releaseAllLocks = Symbol.for(sym(\"releaseAllLocks\"));\r\nexport const _verifyChannel = Symbol.for(sym(\"verifyChannel\"));\r\n/** @internal */\r\nexport const _hubAccess = Symbol.for(sym(\"hubAccess\"));\r\nexport const _setHubAccess = Symbol.for(sym(\"setHubAccess\"));\r\nexport const _getHubAccess = Symbol.for(sym(\"getHubAccess\"));\r\nexport const _mockCheckpoint = Symbol.for(sym(\"mockCheckpoint\"));\r\nexport const _cache = Symbol.for(sym(\"cache\"));\r\nexport const _instanceKeyCache = Symbol.for(sym(\"instanceKeyCache\"));\r\n/** @internal */\r\nexport const _activeTxn = Symbol.for(sym(\"activeTxn\"));\r\nexport const _resetIModelDb = Symbol.for(sym(\"resetIModelDb\"));\r\nexport const _onReservedElementInsert = Symbol.for(sym(\"onReservedElementInsert\"));\r\n"]}
@@ -72,7 +72,7 @@ export declare class SubCategory extends DefinitionElement {
72
72
  static insert(txn: EditTxn, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;
73
73
  /**
74
74
  * Insert a new SubCategory
75
- * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use SubCategory.insert(txn, ...) instead.
75
+ * @deprecated in 5.9.0 - might be removed in next major version. Use SubCategory.insert(txn, ...) instead.
76
76
  */
77
77
  static insert(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;
78
78
  }
@@ -112,7 +112,7 @@ export declare class Category extends DefinitionElement {
112
112
  setDefaultAppearance(txn: EditTxn, props: SubCategoryAppearance.Props | SubCategoryAppearance): void;
113
113
  /**
114
114
  * Set the appearance of the default SubCategory for this Category
115
- * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use Category.setDefaultAppearance(txn, ...) instead.
115
+ * @deprecated in 5.9.0 - might be removed in next major version. Use Category.setDefaultAppearance(txn, ...) instead.
116
116
  */
117
117
  setDefaultAppearance(props: SubCategoryAppearance.Props | SubCategoryAppearance): void;
118
118
  }
@@ -154,7 +154,7 @@ export declare class DrawingCategory extends Category {
154
154
  static insert(txn: EditTxn, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;
155
155
  /**
156
156
  * Insert a new DrawingCategory
157
- * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use DrawingCategory.insert(txn, ...) instead.
157
+ * @deprecated in 5.9.0 - might be removed in next major version. Use DrawingCategory.insert(txn, ...) instead.
158
158
  */
159
159
  static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;
160
160
  }
@@ -196,7 +196,7 @@ export declare class SpatialCategory extends Category {
196
196
  static insert(txn: EditTxn, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;
197
197
  /**
198
198
  * Insert a new SpatialCategory
199
- * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use SpatialCategory.insert(txn, ...) instead.
199
+ * @deprecated in 5.9.0 - might be removed in next major version. Use SpatialCategory.insert(txn, ...) instead.
200
200
  */
201
201
  static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;
202
202
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Category.js","sourceRoot":"","sources":["../../src/Category.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,WAAW,EAAiB,IAAI,EAA0C,IAAI,EAAE,qBAAqB,GACtG,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OA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,GAAa,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,eAAe,CAAC,eAAe,EAAE,CAAC,CAAC;QACzF,OAAO,IAAI,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAChF,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,QAAkB,EAAE,iBAA6B,EAAE,IAAY;QAClF,MAAM,aAAa,GAAkB;YACnC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC;YACxD,SAAS,EAAE,KAAK;SACjB,CAAC;QACF,OAAO,IAAI,eAAe,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAkBM,MAAM,CAAC,MAAM,CAAC,OAA2B,EAAE,iBAA6B,EAAE,IAAY,EAAE,iBAAsE;QACnK,MAAM,GAAG,GAAG,OAAO,YAAY,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACzE,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;QAClE,QAAQ,CAAC,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACnC,QAAQ,CAAC,oBAAoB,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;QACtD,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;CACF","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 iModels\r\n */\r\n\r\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport {\r\n BisCodeSpec, CategoryProps, Code, CodeScopeProps, CodeSpec, ElementProps, Rank, SubCategoryAppearance, SubCategoryProps,\r\n} from \"@itwin/core-common\";\r\nimport { DefinitionElement } from \"./Element\";\r\nimport { EditTxn } from \"./EditTxn\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { CategoryOwnsSubCategories } from \"./NavigationRelationship\";\r\nimport { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from \"./Entity\";\r\nimport { _implicitTxn } from \"./internal/Symbols\";\r\n\r\n/** Defines the appearance for graphics in Geometric elements\r\n * @public @preview\r\n */\r\nexport class SubCategory extends DefinitionElement {\r\n public static override get className(): string { return \"SubCategory\"; }\r\n /** The Appearance parameters for this SubCategory */\r\n public appearance: SubCategoryAppearance;\r\n /** Optional description of this SubCategory. */\r\n public description?: string;\r\n\r\n protected constructor(props: SubCategoryProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.appearance = new SubCategoryAppearance(props.appearance);\r\n this.description = JsonUtils.asString(props.description);\r\n }\r\n\r\n /**\r\n * SubCategory custom HandledProps include 'description' and 'properties'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\r\n { propertyName: \"description\", source: \"Class\" },\r\n { propertyName: \"properties\", source: \"Class\" },\r\n ];\r\n\r\n /**\r\n * SubCategory deserializes 'description' and 'properties'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override deserialize(props: DeserializeEntityArgs): SubCategoryProps {\r\n const elProps = super.deserialize(props) as SubCategoryProps;\r\n elProps.description = JsonUtils.asString(props.row.description);\r\n if (props.row.properties !== '') {\r\n elProps.appearance = JSON.parse(props.row.properties) as SubCategoryAppearance.Props;\r\n } else {\r\n elProps.appearance = undefined;\r\n }\r\n return elProps;\r\n }\r\n\r\n /**\r\n * SubCategory serialize 'description' and 'properties'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override serialize(props: SubCategoryProps, iModel: IModelDb): ECSqlRow {\r\n const inst = super.serialize(props, iModel);\r\n if (props.description !== undefined) {\r\n inst.description = props.description;\r\n }\r\n if (props.appearance !== undefined) {\r\n inst.properties = JSON.stringify(props.appearance);\r\n }\r\n return inst;\r\n }\r\n\r\n public override toJSON(): SubCategoryProps {\r\n const val = super.toJSON() as SubCategoryProps;\r\n val.appearance = this.appearance.toJSON();\r\n if (this.description && this.description.length > 0)\r\n val.description = this.description;\r\n return val;\r\n }\r\n\r\n /** Get the SubCategory's name (its Code value). */\r\n public getSubCategoryName(): string { return this.code.value; }\r\n /** Get the Id of the SubCategory. */\r\n public getSubCategoryId(): Id64String { return this.id; }\r\n /** Get the Id of this SubCategory's parent Category. */\r\n public getCategoryId(): Id64String { return this.parent ? this.parent.id : Id64.invalid; }\r\n /** Check if this is the default SubCategory of its parent Category. */\r\n public get isDefaultSubCategory(): boolean { return IModelDb.getDefaultSubCategoryId(this.getCategoryId()) === this.getSubCategoryId(); }\r\n\r\n /** Create a Code for a SubCategory given a name that is meant to be unique within the scope of the specified parent Category.\r\n * @param iModel The IModel\r\n * @param parentCategoryId The Id of the parent Category that owns the SubCategory and provides the scope for its name.\r\n * @param codeValue The name of the SubCategory\r\n */\r\n public static createCode(iModel: IModelDb, parentCategoryId: CodeScopeProps, codeValue: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.subCategory);\r\n return new Code({ spec: codeSpec.id, scope: parentCategoryId, value: codeValue });\r\n }\r\n\r\n /** Create a new SubCategory\r\n * @param iModelDb The iModel\r\n * @param parentCategoryId Create the new SubCategory as a child of this [[Category]]\r\n * @param name The name of the SubCategory\r\n * @param appearance The appearance settings to use for this SubCategory\r\n * @returns The newly constructed SubCategory element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): SubCategory {\r\n if (appearance instanceof SubCategoryAppearance)\r\n appearance = appearance.toJSON();\r\n\r\n const parentCategory = iModelDb.elements.getElement<Category>(parentCategoryId);\r\n const subCategoryProps: SubCategoryProps = {\r\n classFullName: this.classFullName,\r\n model: parentCategory.model,\r\n parent: new CategoryOwnsSubCategories(parentCategoryId),\r\n code: this.createCode(iModelDb, parentCategoryId, name),\r\n appearance,\r\n };\r\n return new SubCategory(subCategoryProps, iModelDb);\r\n }\r\n\r\n /**\r\n * Insert a new SubCategory\r\n * @param txn The EditTxn to use\r\n * @param parentCategoryId Insert the new SubCategory as a child of this Category\r\n * @param name The name of the SubCategory\r\n * @param appearance The appearance settings to use for this SubCategory\r\n * @returns The Id of the newly inserted SubCategory element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n * @beta\r\n */\r\n public static insert(txn: EditTxn, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;\r\n /**\r\n * Insert a new SubCategory\r\n * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use SubCategory.insert(txn, ...) instead.\r\n */\r\n public static insert(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;\r\n public static insert(txnOrDb: EditTxn | IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\r\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\r\n const subCategory = this.create(txn.iModel, parentCategoryId, name, appearance);\r\n return subCategory.insert(txn);\r\n }\r\n}\r\n\r\n/** A Category element is the target of the `category` member of [[GeometricElement]].\r\n * @public @preview\r\n */\r\nexport class Category extends DefinitionElement {\r\n public static override get className(): string { return \"Category\"; }\r\n public rank: Rank = Rank.User;\r\n public description?: string;\r\n\r\n protected constructor(props: CategoryProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.rank = JsonUtils.asInt(props.rank);\r\n this.description = JsonUtils.asString(props.description);\r\n }\r\n\r\n /**\r\n * Category custom HandledProps include 'rank' and 'description'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\r\n { propertyName: \"rank\", source: \"Class\" },\r\n { propertyName: \"description\", source: \"Class\" },\r\n ];\r\n\r\n /**\r\n * Category deserializes 'rank' and 'description'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override deserialize(props: DeserializeEntityArgs): CategoryProps {\r\n const elProps = super.deserialize(props) as CategoryProps;\r\n elProps.description = JsonUtils.asString(props.row.description);\r\n elProps.rank = JsonUtils.asInt(props.row.rank);\r\n return elProps;\r\n }\r\n\r\n /**\r\n * Category serialize 'rank' and 'description'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override serialize(props: CategoryProps, iModel: IModelDb): ECSqlRow {\r\n const inst = super.serialize(props, iModel);\r\n if (undefined !== props.description) {\r\n inst.description = props.description;\r\n }\r\n inst.rank = props.rank;\r\n return inst;\r\n }\r\n public override toJSON(): CategoryProps {\r\n const val = super.toJSON() as CategoryProps;\r\n val.rank = this.rank;\r\n if (this.description && this.description.length > 0)\r\n val.description = this.description;\r\n return val;\r\n }\r\n\r\n /** Get the Id of the default SubCategory for this Category. */\r\n public myDefaultSubCategoryId(): Id64String { return IModelDb.getDefaultSubCategoryId(this.id); }\r\n\r\n /**\r\n * Set the appearance of the default SubCategory for this Category\r\n * @beta\r\n */\r\n public setDefaultAppearance(txn: EditTxn, props: SubCategoryAppearance.Props | SubCategoryAppearance): void;\r\n /**\r\n * Set the appearance of the default SubCategory for this Category\r\n * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use Category.setDefaultAppearance(txn, ...) instead.\r\n */\r\n public setDefaultAppearance(props: SubCategoryAppearance.Props | SubCategoryAppearance): void;\r\n public setDefaultAppearance(txnOrProps: EditTxn | SubCategoryAppearance.Props | SubCategoryAppearance, props?: SubCategoryAppearance.Props | SubCategoryAppearance): void {\r\n let txn: EditTxn;\r\n let appearance: SubCategoryAppearance.Props | SubCategoryAppearance;\r\n if (txnOrProps instanceof EditTxn) {\r\n txn = txnOrProps;\r\n if (props === undefined)\r\n throw new Error(\"Invalid argument\");\r\n appearance = props;\r\n } else {\r\n txn = this.iModel[_implicitTxn];\r\n appearance = txnOrProps;\r\n }\r\n if (appearance instanceof SubCategoryAppearance)\r\n appearance = appearance.toJSON();\r\n\r\n const subCat = this.iModel.elements.getElement<SubCategory>(this.myDefaultSubCategoryId());\r\n subCat.appearance = new SubCategoryAppearance(appearance);\r\n subCat.update(txn);\r\n }\r\n}\r\n\r\n/** Categorizes 2d GeometricElements.\r\n * @public @preview\r\n */\r\nexport class DrawingCategory extends Category {\r\n public static override get className(): string { return \"DrawingCategory\"; }\r\n\r\n protected constructor(opts: ElementProps, iModel: IModelDb) { super(opts, iModel); }\r\n\r\n /** Get the name of the CodeSpec that is used by DrawingCategory objects. */\r\n public static getCodeSpecName(): string { return BisCodeSpec.drawingCategory; }\r\n\r\n /** Looks up the CategoryId of a DrawingCategory by model and name */\r\n public static queryCategoryIdByName(iModel: IModelDb, scopeModelId: Id64String, categoryName: string): Id64String | undefined {\r\n const code: Code = DrawingCategory.createCode(iModel, scopeModelId, categoryName);\r\n return iModel.elements.queryElementIdByCode(code);\r\n }\r\n\r\n /** Create a Code for a DrawingCategory given a name that is meant to be unique within the scope of the specified DefinitionModel.\r\n * @param iModel The IModel\r\n * @param scopeModelId The Id of the DefinitionModel that contains the DrawingCategory and provides the scope for its name.\r\n * @param codeValue The name of the category\r\n * @return A drawing category Code\r\n */\r\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(DrawingCategory.getCodeSpecName());\r\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\r\n }\r\n\r\n /** Create a new DrawingCategory\r\n * @param iModelDb The iModel\r\n * @param definitionModelId The [[DefinitionModel]]\r\n * @param name The name of the DrawingCategory\r\n * @returns The newly constructed DrawingCategory element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): DrawingCategory {\r\n const categoryProps: CategoryProps = {\r\n classFullName: this.classFullName,\r\n model: definitionModelId,\r\n code: this.createCode(iModelDb, definitionModelId, name),\r\n isPrivate: false,\r\n };\r\n return new DrawingCategory(categoryProps, iModelDb);\r\n }\r\n\r\n /**\r\n * Insert a new DrawingCategory\r\n * @param txn The EditTxn to use\r\n * @param definitionModelId Insert the new DrawingCategory into this [[DefinitionModel]]\r\n * @param name The name of the DrawingCategory\r\n * @param defaultAppearance The appearance settings to use for the default SubCategory of this DrawingCategory\r\n * @returns The Id of the newly inserted DrawingCategory element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n * @beta\r\n */\r\n public static insert(txn: EditTxn, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;\r\n /**\r\n * Insert a new DrawingCategory\r\n * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use DrawingCategory.insert(txn, ...) instead.\r\n */\r\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;\r\n public static insert(txnOrDb: EditTxn | IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\r\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\r\n const category = this.create(txn.iModel, definitionModelId, name);\r\n category.id = category.insert(txn);\r\n category.setDefaultAppearance(txn, defaultAppearance);\r\n return category.id;\r\n }\r\n}\r\n\r\n/** Categorizes SpatialElements. See [how to create a SpatialCategory]($docs/learning/backend/CreateElements.md#SpatialCategory).\r\n * @public @preview\r\n */\r\nexport class SpatialCategory extends Category {\r\n public static override get className(): string { return \"SpatialCategory\"; }\r\n protected constructor(opts: ElementProps, iModel: IModelDb) { super(opts, iModel); }\r\n\r\n /** Get the name of the CodeSpec that is used by SpatialCategory objects. */\r\n public static getCodeSpecName(): string { return BisCodeSpec.spatialCategory; }\r\n\r\n /** Looks up the CategoryId of a SpatialCategory by model and name */\r\n public static queryCategoryIdByName(iModel: IModelDb, scopeModelId: Id64String, categoryName: string): Id64String | undefined {\r\n const code: Code = SpatialCategory.createCode(iModel, scopeModelId, categoryName);\r\n return iModel.elements.queryElementIdByCode(code);\r\n }\r\n\r\n /** Create a Code for a SpatialCategory given a name that is meant to be unique within the scope of the specified DefinitionModel.\r\n * @param iModel The IModel\r\n * @param scopeModelId The Id of the DefinitionModel that contains the SpatialCategory and provides the scope for its name.\r\n * @param codeValue The name of the category\r\n * @return A spatial category Code\r\n */\r\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(SpatialCategory.getCodeSpecName());\r\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\r\n }\r\n\r\n /** Create a new SpatialCategory\r\n * @param iModelDb The iModel\r\n * @param definitionModelId The [[DefinitionModel]]\r\n * @param name The name/CodeValue of the SpatialCategory\r\n * @returns The newly constructed SpatialCategory element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): SpatialCategory {\r\n const categoryProps: CategoryProps = {\r\n classFullName: this.classFullName,\r\n model: definitionModelId,\r\n code: this.createCode(iModelDb, definitionModelId, name),\r\n isPrivate: false,\r\n };\r\n return new SpatialCategory(categoryProps, iModelDb);\r\n }\r\n\r\n /**\r\n * Insert a new SpatialCategory\r\n * @param txn The EditTxn to use\r\n * @param definitionModelId Insert the new SpatialCategory into this DefinitionModel\r\n * @param name The name of the SpatialCategory\r\n * @param defaultAppearance The appearance settings to use for the default SubCategory of this SpatialCategory\r\n * @returns The Id of the newly inserted SpatialCategory element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n * @beta\r\n */\r\n public static insert(txn: EditTxn, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;\r\n /**\r\n * Insert a new SpatialCategory\r\n * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use SpatialCategory.insert(txn, ...) instead.\r\n */\r\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;\r\n public static insert(txnOrDb: EditTxn | IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\r\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\r\n const category = this.create(txn.iModel, definitionModelId, name);\r\n category.id = category.insert(txn);\r\n category.setDefaultAppearance(txn, defaultAppearance);\r\n return category.id;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Category.js","sourceRoot":"","sources":["../../src/Category.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,WAAW,EAAiB,IAAI,EAA0C,IAAI,EAAE,qBAAqB,GACtG,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IACzC,MAAM,KAAc,SAAS,KAAa,OAAO,aAAa,CAAC,CAAC,CAAC;IACxE,qDAAqD;IAC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kB,EAAE,iBAA6B,EAAE,IAAY;QAClF,MAAM,aAAa,GAAkB;YACnC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC;YACxD,SAAS,EAAE,KAAK;SACjB,CAAC;QACF,OAAO,IAAI,eAAe,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAkBM,MAAM,CAAC,MAAM,CAAC,OAA2B,EAAE,iBAA6B,EAAE,IAAY,EAAE,iBAAsE;QACnK,MAAM,GAAG,GAAG,OAAO,YAAY,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACzE,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;QAClE,QAAQ,CAAC,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACnC,QAAQ,CAAC,oBAAoB,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;QACtD,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;CACF","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 iModels\r\n */\r\n\r\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport {\r\n BisCodeSpec, CategoryProps, Code, CodeScopeProps, CodeSpec, ElementProps, Rank, SubCategoryAppearance, SubCategoryProps,\r\n} from \"@itwin/core-common\";\r\nimport { DefinitionElement } from \"./Element\";\r\nimport { EditTxn } from \"./EditTxn\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { CategoryOwnsSubCategories } from \"./NavigationRelationship\";\r\nimport { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from \"./Entity\";\r\nimport { _implicitTxn } from \"./internal/Symbols\";\r\n\r\n/** Defines the appearance for graphics in Geometric elements\r\n * @public @preview\r\n */\r\nexport class SubCategory extends DefinitionElement {\r\n public static override get className(): string { return \"SubCategory\"; }\r\n /** The Appearance parameters for this SubCategory */\r\n public appearance: SubCategoryAppearance;\r\n /** Optional description of this SubCategory. */\r\n public description?: string;\r\n\r\n protected constructor(props: SubCategoryProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.appearance = new SubCategoryAppearance(props.appearance);\r\n this.description = JsonUtils.asString(props.description);\r\n }\r\n\r\n /**\r\n * SubCategory custom HandledProps include 'description' and 'properties'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\r\n { propertyName: \"description\", source: \"Class\" },\r\n { propertyName: \"properties\", source: \"Class\" },\r\n ];\r\n\r\n /**\r\n * SubCategory deserializes 'description' and 'properties'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override deserialize(props: DeserializeEntityArgs): SubCategoryProps {\r\n const elProps = super.deserialize(props) as SubCategoryProps;\r\n elProps.description = JsonUtils.asString(props.row.description);\r\n if (props.row.properties !== '') {\r\n elProps.appearance = JSON.parse(props.row.properties) as SubCategoryAppearance.Props;\r\n } else {\r\n elProps.appearance = undefined;\r\n }\r\n return elProps;\r\n }\r\n\r\n /**\r\n * SubCategory serialize 'description' and 'properties'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override serialize(props: SubCategoryProps, iModel: IModelDb): ECSqlRow {\r\n const inst = super.serialize(props, iModel);\r\n if (props.description !== undefined) {\r\n inst.description = props.description;\r\n }\r\n if (props.appearance !== undefined) {\r\n inst.properties = JSON.stringify(props.appearance);\r\n }\r\n return inst;\r\n }\r\n\r\n public override toJSON(): SubCategoryProps {\r\n const val = super.toJSON() as SubCategoryProps;\r\n val.appearance = this.appearance.toJSON();\r\n if (this.description && this.description.length > 0)\r\n val.description = this.description;\r\n return val;\r\n }\r\n\r\n /** Get the SubCategory's name (its Code value). */\r\n public getSubCategoryName(): string { return this.code.value; }\r\n /** Get the Id of the SubCategory. */\r\n public getSubCategoryId(): Id64String { return this.id; }\r\n /** Get the Id of this SubCategory's parent Category. */\r\n public getCategoryId(): Id64String { return this.parent ? this.parent.id : Id64.invalid; }\r\n /** Check if this is the default SubCategory of its parent Category. */\r\n public get isDefaultSubCategory(): boolean { return IModelDb.getDefaultSubCategoryId(this.getCategoryId()) === this.getSubCategoryId(); }\r\n\r\n /** Create a Code for a SubCategory given a name that is meant to be unique within the scope of the specified parent Category.\r\n * @param iModel The IModel\r\n * @param parentCategoryId The Id of the parent Category that owns the SubCategory and provides the scope for its name.\r\n * @param codeValue The name of the SubCategory\r\n */\r\n public static createCode(iModel: IModelDb, parentCategoryId: CodeScopeProps, codeValue: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.subCategory);\r\n return new Code({ spec: codeSpec.id, scope: parentCategoryId, value: codeValue });\r\n }\r\n\r\n /** Create a new SubCategory\r\n * @param iModelDb The iModel\r\n * @param parentCategoryId Create the new SubCategory as a child of this [[Category]]\r\n * @param name The name of the SubCategory\r\n * @param appearance The appearance settings to use for this SubCategory\r\n * @returns The newly constructed SubCategory element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): SubCategory {\r\n if (appearance instanceof SubCategoryAppearance)\r\n appearance = appearance.toJSON();\r\n\r\n const parentCategory = iModelDb.elements.getElement<Category>(parentCategoryId);\r\n const subCategoryProps: SubCategoryProps = {\r\n classFullName: this.classFullName,\r\n model: parentCategory.model,\r\n parent: new CategoryOwnsSubCategories(parentCategoryId),\r\n code: this.createCode(iModelDb, parentCategoryId, name),\r\n appearance,\r\n };\r\n return new SubCategory(subCategoryProps, iModelDb);\r\n }\r\n\r\n /**\r\n * Insert a new SubCategory\r\n * @param txn The EditTxn to use\r\n * @param parentCategoryId Insert the new SubCategory as a child of this Category\r\n * @param name The name of the SubCategory\r\n * @param appearance The appearance settings to use for this SubCategory\r\n * @returns The Id of the newly inserted SubCategory element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n * @beta\r\n */\r\n public static insert(txn: EditTxn, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;\r\n /**\r\n * Insert a new SubCategory\r\n * @deprecated in 5.9.0 - might be removed in next major version. Use SubCategory.insert(txn, ...) instead.\r\n */\r\n public static insert(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;\r\n public static insert(txnOrDb: EditTxn | IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\r\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\r\n const subCategory = this.create(txn.iModel, parentCategoryId, name, appearance);\r\n return subCategory.insert(txn);\r\n }\r\n}\r\n\r\n/** A Category element is the target of the `category` member of [[GeometricElement]].\r\n * @public @preview\r\n */\r\nexport class Category extends DefinitionElement {\r\n public static override get className(): string { return \"Category\"; }\r\n public rank: Rank = Rank.User;\r\n public description?: string;\r\n\r\n protected constructor(props: CategoryProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.rank = JsonUtils.asInt(props.rank);\r\n this.description = JsonUtils.asString(props.description);\r\n }\r\n\r\n /**\r\n * Category custom HandledProps include 'rank' and 'description'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\r\n { propertyName: \"rank\", source: \"Class\" },\r\n { propertyName: \"description\", source: \"Class\" },\r\n ];\r\n\r\n /**\r\n * Category deserializes 'rank' and 'description'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override deserialize(props: DeserializeEntityArgs): CategoryProps {\r\n const elProps = super.deserialize(props) as CategoryProps;\r\n elProps.description = JsonUtils.asString(props.row.description);\r\n elProps.rank = JsonUtils.asInt(props.row.rank);\r\n return elProps;\r\n }\r\n\r\n /**\r\n * Category serialize 'rank' and 'description'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override serialize(props: CategoryProps, iModel: IModelDb): ECSqlRow {\r\n const inst = super.serialize(props, iModel);\r\n if (undefined !== props.description) {\r\n inst.description = props.description;\r\n }\r\n inst.rank = props.rank;\r\n return inst;\r\n }\r\n public override toJSON(): CategoryProps {\r\n const val = super.toJSON() as CategoryProps;\r\n val.rank = this.rank;\r\n if (this.description && this.description.length > 0)\r\n val.description = this.description;\r\n return val;\r\n }\r\n\r\n /** Get the Id of the default SubCategory for this Category. */\r\n public myDefaultSubCategoryId(): Id64String { return IModelDb.getDefaultSubCategoryId(this.id); }\r\n\r\n /**\r\n * Set the appearance of the default SubCategory for this Category\r\n * @beta\r\n */\r\n public setDefaultAppearance(txn: EditTxn, props: SubCategoryAppearance.Props | SubCategoryAppearance): void;\r\n /**\r\n * Set the appearance of the default SubCategory for this Category\r\n * @deprecated in 5.9.0 - might be removed in next major version. Use Category.setDefaultAppearance(txn, ...) instead.\r\n */\r\n public setDefaultAppearance(props: SubCategoryAppearance.Props | SubCategoryAppearance): void;\r\n public setDefaultAppearance(txnOrProps: EditTxn | SubCategoryAppearance.Props | SubCategoryAppearance, props?: SubCategoryAppearance.Props | SubCategoryAppearance): void {\r\n let txn: EditTxn;\r\n let appearance: SubCategoryAppearance.Props | SubCategoryAppearance;\r\n if (txnOrProps instanceof EditTxn) {\r\n txn = txnOrProps;\r\n if (props === undefined)\r\n throw new Error(\"Invalid argument\");\r\n appearance = props;\r\n } else {\r\n txn = this.iModel[_implicitTxn];\r\n appearance = txnOrProps;\r\n }\r\n if (appearance instanceof SubCategoryAppearance)\r\n appearance = appearance.toJSON();\r\n\r\n const subCat = this.iModel.elements.getElement<SubCategory>(this.myDefaultSubCategoryId());\r\n subCat.appearance = new SubCategoryAppearance(appearance);\r\n subCat.update(txn);\r\n }\r\n}\r\n\r\n/** Categorizes 2d GeometricElements.\r\n * @public @preview\r\n */\r\nexport class DrawingCategory extends Category {\r\n public static override get className(): string { return \"DrawingCategory\"; }\r\n\r\n protected constructor(opts: ElementProps, iModel: IModelDb) { super(opts, iModel); }\r\n\r\n /** Get the name of the CodeSpec that is used by DrawingCategory objects. */\r\n public static getCodeSpecName(): string { return BisCodeSpec.drawingCategory; }\r\n\r\n /** Looks up the CategoryId of a DrawingCategory by model and name */\r\n public static queryCategoryIdByName(iModel: IModelDb, scopeModelId: Id64String, categoryName: string): Id64String | undefined {\r\n const code: Code = DrawingCategory.createCode(iModel, scopeModelId, categoryName);\r\n return iModel.elements.queryElementIdByCode(code);\r\n }\r\n\r\n /** Create a Code for a DrawingCategory given a name that is meant to be unique within the scope of the specified DefinitionModel.\r\n * @param iModel The IModel\r\n * @param scopeModelId The Id of the DefinitionModel that contains the DrawingCategory and provides the scope for its name.\r\n * @param codeValue The name of the category\r\n * @return A drawing category Code\r\n */\r\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(DrawingCategory.getCodeSpecName());\r\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\r\n }\r\n\r\n /** Create a new DrawingCategory\r\n * @param iModelDb The iModel\r\n * @param definitionModelId The [[DefinitionModel]]\r\n * @param name The name of the DrawingCategory\r\n * @returns The newly constructed DrawingCategory element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): DrawingCategory {\r\n const categoryProps: CategoryProps = {\r\n classFullName: this.classFullName,\r\n model: definitionModelId,\r\n code: this.createCode(iModelDb, definitionModelId, name),\r\n isPrivate: false,\r\n };\r\n return new DrawingCategory(categoryProps, iModelDb);\r\n }\r\n\r\n /**\r\n * Insert a new DrawingCategory\r\n * @param txn The EditTxn to use\r\n * @param definitionModelId Insert the new DrawingCategory into this [[DefinitionModel]]\r\n * @param name The name of the DrawingCategory\r\n * @param defaultAppearance The appearance settings to use for the default SubCategory of this DrawingCategory\r\n * @returns The Id of the newly inserted DrawingCategory element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n * @beta\r\n */\r\n public static insert(txn: EditTxn, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;\r\n /**\r\n * Insert a new DrawingCategory\r\n * @deprecated in 5.9.0 - might be removed in next major version. Use DrawingCategory.insert(txn, ...) instead.\r\n */\r\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;\r\n public static insert(txnOrDb: EditTxn | IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\r\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\r\n const category = this.create(txn.iModel, definitionModelId, name);\r\n category.id = category.insert(txn);\r\n category.setDefaultAppearance(txn, defaultAppearance);\r\n return category.id;\r\n }\r\n}\r\n\r\n/** Categorizes SpatialElements. See [how to create a SpatialCategory]($docs/learning/backend/CreateElements.md#SpatialCategory).\r\n * @public @preview\r\n */\r\nexport class SpatialCategory extends Category {\r\n public static override get className(): string { return \"SpatialCategory\"; }\r\n protected constructor(opts: ElementProps, iModel: IModelDb) { super(opts, iModel); }\r\n\r\n /** Get the name of the CodeSpec that is used by SpatialCategory objects. */\r\n public static getCodeSpecName(): string { return BisCodeSpec.spatialCategory; }\r\n\r\n /** Looks up the CategoryId of a SpatialCategory by model and name */\r\n public static queryCategoryIdByName(iModel: IModelDb, scopeModelId: Id64String, categoryName: string): Id64String | undefined {\r\n const code: Code = SpatialCategory.createCode(iModel, scopeModelId, categoryName);\r\n return iModel.elements.queryElementIdByCode(code);\r\n }\r\n\r\n /** Create a Code for a SpatialCategory given a name that is meant to be unique within the scope of the specified DefinitionModel.\r\n * @param iModel The IModel\r\n * @param scopeModelId The Id of the DefinitionModel that contains the SpatialCategory and provides the scope for its name.\r\n * @param codeValue The name of the category\r\n * @return A spatial category Code\r\n */\r\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(SpatialCategory.getCodeSpecName());\r\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\r\n }\r\n\r\n /** Create a new SpatialCategory\r\n * @param iModelDb The iModel\r\n * @param definitionModelId The [[DefinitionModel]]\r\n * @param name The name/CodeValue of the SpatialCategory\r\n * @returns The newly constructed SpatialCategory element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): SpatialCategory {\r\n const categoryProps: CategoryProps = {\r\n classFullName: this.classFullName,\r\n model: definitionModelId,\r\n code: this.createCode(iModelDb, definitionModelId, name),\r\n isPrivate: false,\r\n };\r\n return new SpatialCategory(categoryProps, iModelDb);\r\n }\r\n\r\n /**\r\n * Insert a new SpatialCategory\r\n * @param txn The EditTxn to use\r\n * @param definitionModelId Insert the new SpatialCategory into this DefinitionModel\r\n * @param name The name of the SpatialCategory\r\n * @param defaultAppearance The appearance settings to use for the default SubCategory of this SpatialCategory\r\n * @returns The Id of the newly inserted SpatialCategory element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n * @beta\r\n */\r\n public static insert(txn: EditTxn, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;\r\n /**\r\n * Insert a new SpatialCategory\r\n * @deprecated in 5.9.0 - might be removed in next major version. Use SpatialCategory.insert(txn, ...) instead.\r\n */\r\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;\r\n public static insert(txnOrDb: EditTxn | IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\r\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\r\n const category = this.create(txn.iModel, definitionModelId, name);\r\n category.id = category.insert(txn);\r\n category.setDefaultAppearance(txn, defaultAppearance);\r\n return category.id;\r\n }\r\n}\r\n"]}
@@ -225,6 +225,11 @@ export declare class ChangesetECAdaptor implements Disposable {
225
225
  * @param accessString access string token separated by '.'.
226
226
  */
227
227
  private static setValue;
228
+ /**
229
+ * Determine if a property path segment could be used to reach the prototype chain.
230
+ * @param propertyName single segment of an access string.
231
+ */
232
+ private static isUnsafePropertyName;
228
233
  /**
229
234
  * Check if sqlite change table is a EC data table
230
235
  * @param tableName name of the table.
@@ -1 +1 @@
1
- {"version":3,"file":"ChangesetECAdaptor.d.ts","sourceRoot":"","sources":["../../src/ChangesetECAdaptor.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAA8B,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAgB,cAAc,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAyVvH;;;;KAIK;AACL,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8CAA8C;IAC9C,EAAE,EAAE,cAAc,CAAC;IACnB,mDAAmD;IACnD,KAAK,EAAE,gBAAgB,CAAC;IACxB,sFAAsF;IACtF,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,iEAAiE;IACjE,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAEhC,YAAY,EAAE,UAAU,CAAC;IAEzB,SA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OAGG;IACI,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IACpC;;;OAGG;IACI,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAEnC;;;;;OAKG;IACI,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB;IAMrD;;;;;OAKG;IACI,QAAQ,CAAC,EAAE,EAAE,cAAc,GAAG,kBAAkB;IAMvD;;;;;OAKG;IACI,WAAW,CAAC,aAAa,EAAE,MAAM,GAAG,kBAAkB;IAQ7D,OAAO,CAAC,gBAAgB;IAWxB;;;;;OAKG;gBACgC,MAAM,EAAE,qBAAqB,EAAkB,eAAe,UAAQ;IAOzG;;OAEG;IACI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;IAI/B;;OAEG;IACI,KAAK,IAAI,IAAI;IAIpB;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAYlC;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ;IAuBvB;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAInC;;;;OAIG;IACI,SAAS,CAAC,SAAS,EAAE,MAAM;IAIlC;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAWxB,qCAAqC;IACrC,IAAW,EAAE,mBAA6B;IAC1C,0DAA0D;IAC1D,IAAW,UAAU,YAAqC;IAC1D,yDAAyD;IACzD,IAAW,SAAS,YAAoC;IACxD,yDAAyD;IACzD,IAAW,SAAS,YAAoC;IAExD;;;OAGG;IACI,IAAI,IAAI,OAAO;IA4GtB;;;;;OAKG;IACH,OAAO,CAAC,2BAA2B;IAwBnC;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;CA6ClB"}
@@ -804,20 +804,30 @@ export class ChangesetECAdaptor {
804
804
  static setValue(targetObj, accessString, value) {
805
805
  let cursor = targetObj;
806
806
  const propPath = accessString.split(".");
807
+ // Validate every segment before mutating anything so a dangerous segment later in the path
808
+ // cannot leave partially written data behind.
807
809
  propPath.forEach((propertyName) => {
808
- if (propertyName === "__proto__")
809
- throw new Error("access string cannot container __proto__");
810
+ if (ChangesetECAdaptor.isUnsafePropertyName(propertyName))
811
+ throw new Error(`access string cannot contain ${propertyName}`);
810
812
  });
811
813
  const leafProp = propPath.splice(-1).shift();
812
814
  if (!leafProp)
813
815
  throw new Error("not access string was specified.");
814
816
  for (const elem of propPath) {
815
- if (typeof cursor[elem] === "undefined")
817
+ // Only follow own properties. Inherited members must never be traversed or mutated.
818
+ if (!Object.prototype.hasOwnProperty.call(cursor, elem) || typeof cursor[elem] === "undefined")
816
819
  cursor[elem] = {};
817
820
  cursor = cursor[elem];
818
821
  }
819
822
  cursor[leafProp] = value;
820
823
  }
824
+ /**
825
+ * Determine if a property path segment could be used to reach the prototype chain.
826
+ * @param propertyName single segment of an access string.
827
+ */
828
+ static isUnsafePropertyName(propertyName) {
829
+ return propertyName === "__proto__" || propertyName === "constructor" || propertyName === "prototype";
830
+ }
821
831
  /**
822
832
  * Check if sqlite change table is a EC data table
823
833
  * @param tableName name of the table.