@itwin/core-backend 5.1.0-dev.9 → 5.2.0-dev.2

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 (441) hide show
  1. package/CHANGELOG.md +117 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +1 -1
  3. package/lib/cjs/BackendHubAccess.js +1 -1
  4. package/lib/cjs/BackendHubAccess.js.map +1 -1
  5. package/lib/cjs/BisCoreSchema.d.ts.map +1 -1
  6. package/lib/cjs/BisCoreSchema.js +4 -2
  7. package/lib/cjs/BisCoreSchema.js.map +1 -1
  8. package/lib/cjs/BriefcaseManager.d.ts +10 -2
  9. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  10. package/lib/cjs/BriefcaseManager.js +16 -0
  11. package/lib/cjs/BriefcaseManager.js.map +1 -1
  12. package/lib/cjs/Category.d.ts +4 -4
  13. package/lib/cjs/Category.js +4 -4
  14. package/lib/cjs/Category.js.map +1 -1
  15. package/lib/cjs/ChangesetECAdaptor.d.ts +67 -8
  16. package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
  17. package/lib/cjs/ChangesetECAdaptor.js +248 -33
  18. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  19. package/lib/cjs/ClassRegistry.d.ts +9 -1
  20. package/lib/cjs/ClassRegistry.d.ts.map +1 -1
  21. package/lib/cjs/ClassRegistry.js +9 -1
  22. package/lib/cjs/ClassRegistry.js.map +1 -1
  23. package/lib/cjs/CloudSqlite.js +1 -1
  24. package/lib/cjs/CloudSqlite.js.map +1 -1
  25. package/lib/cjs/CodeSpecs.d.ts +1 -1
  26. package/lib/cjs/CodeSpecs.js +1 -1
  27. package/lib/cjs/CodeSpecs.js.map +1 -1
  28. package/lib/cjs/DisplayStyle.d.ts +4 -4
  29. package/lib/cjs/DisplayStyle.js +3 -3
  30. package/lib/cjs/DisplayStyle.js.map +1 -1
  31. package/lib/cjs/ECDb.d.ts +4 -4
  32. package/lib/cjs/ECDb.d.ts.map +1 -1
  33. package/lib/cjs/ECDb.js +4 -4
  34. package/lib/cjs/ECDb.js.map +1 -1
  35. package/lib/cjs/ECSqlStatement.d.ts +15 -6
  36. package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
  37. package/lib/cjs/ECSqlStatement.js +19 -4
  38. package/lib/cjs/ECSqlStatement.js.map +1 -1
  39. package/lib/cjs/Element.d.ts +54 -51
  40. package/lib/cjs/Element.d.ts.map +1 -1
  41. package/lib/cjs/Element.js +67 -52
  42. package/lib/cjs/Element.js.map +1 -1
  43. package/lib/cjs/ElementAspect.d.ts +8 -8
  44. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  45. package/lib/cjs/ElementAspect.js +8 -8
  46. package/lib/cjs/ElementAspect.js.map +1 -1
  47. package/lib/cjs/Entity.d.ts +10 -7
  48. package/lib/cjs/Entity.d.ts.map +1 -1
  49. package/lib/cjs/Entity.js +35 -13
  50. package/lib/cjs/Entity.js.map +1 -1
  51. package/lib/cjs/ExportGraphics.d.ts +54 -8
  52. package/lib/cjs/ExportGraphics.d.ts.map +1 -1
  53. package/lib/cjs/ExportGraphics.js +158 -59
  54. package/lib/cjs/ExportGraphics.js.map +1 -1
  55. package/lib/cjs/GeographicCRSServices.d.ts +6 -2
  56. package/lib/cjs/GeographicCRSServices.d.ts.map +1 -1
  57. package/lib/cjs/GeographicCRSServices.js +1 -1
  58. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  59. package/lib/cjs/IModelDb.d.ts +37 -26
  60. package/lib/cjs/IModelDb.d.ts.map +1 -1
  61. package/lib/cjs/IModelDb.js +124 -47
  62. package/lib/cjs/IModelDb.js.map +1 -1
  63. package/lib/cjs/IModelElementCloneContext.d.ts +1 -1
  64. package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -1
  65. package/lib/cjs/IModelElementCloneContext.js +1 -1
  66. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  67. package/lib/cjs/IModelHost.d.ts +2 -3
  68. package/lib/cjs/IModelHost.d.ts.map +1 -1
  69. package/lib/cjs/IModelHost.js +2 -3
  70. package/lib/cjs/IModelHost.js.map +1 -1
  71. package/lib/cjs/IModelIncrementalSchemaLocater.d.ts +36 -0
  72. package/lib/cjs/IModelIncrementalSchemaLocater.d.ts.map +1 -0
  73. package/lib/cjs/IModelIncrementalSchemaLocater.js +69 -0
  74. package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -0
  75. package/lib/cjs/LocalHub.d.ts.map +1 -1
  76. package/lib/cjs/LocalHub.js +6 -4
  77. package/lib/cjs/LocalHub.js.map +1 -1
  78. package/lib/cjs/Material.d.ts +4 -3
  79. package/lib/cjs/Material.d.ts.map +1 -1
  80. package/lib/cjs/Material.js +5 -5
  81. package/lib/cjs/Material.js.map +1 -1
  82. package/lib/cjs/Model.d.ts +22 -22
  83. package/lib/cjs/Model.js +22 -22
  84. package/lib/cjs/Model.js.map +1 -1
  85. package/lib/cjs/Relationship.d.ts +3 -0
  86. package/lib/cjs/Relationship.d.ts.map +1 -1
  87. package/lib/cjs/Relationship.js +15 -0
  88. package/lib/cjs/Relationship.js.map +1 -1
  89. package/lib/cjs/SQLiteDb.d.ts +1 -1
  90. package/lib/cjs/SQLiteDb.js +1 -1
  91. package/lib/cjs/SQLiteDb.js.map +1 -1
  92. package/lib/cjs/Schema.d.ts +25 -0
  93. package/lib/cjs/Schema.d.ts.map +1 -1
  94. package/lib/cjs/Schema.js +25 -0
  95. package/lib/cjs/Schema.js.map +1 -1
  96. package/lib/cjs/SqliteStatement.d.ts +1 -1
  97. package/lib/cjs/SqliteStatement.d.ts.map +1 -1
  98. package/lib/cjs/SqliteStatement.js +1 -1
  99. package/lib/cjs/SqliteStatement.js.map +1 -1
  100. package/lib/cjs/Texture.d.ts +1 -1
  101. package/lib/cjs/Texture.js +1 -1
  102. package/lib/cjs/Texture.js.map +1 -1
  103. package/lib/cjs/TxnManager.d.ts +4 -4
  104. package/lib/cjs/TxnManager.js +1 -1
  105. package/lib/cjs/TxnManager.js.map +1 -1
  106. package/lib/cjs/ViewDefinition.d.ts +40 -14
  107. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  108. package/lib/cjs/ViewDefinition.js +42 -14
  109. package/lib/cjs/ViewDefinition.js.map +1 -1
  110. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +61 -0
  111. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -0
  112. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +110 -0
  113. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -0
  114. package/lib/cjs/annotations/FrameGeometry.d.ts +51 -0
  115. package/lib/cjs/annotations/FrameGeometry.d.ts.map +1 -0
  116. package/lib/cjs/annotations/FrameGeometry.js +249 -0
  117. package/lib/cjs/annotations/FrameGeometry.js.map +1 -0
  118. package/lib/cjs/annotations/LeaderGeometry.d.ts +53 -0
  119. package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -0
  120. package/lib/cjs/annotations/LeaderGeometry.js +184 -0
  121. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -0
  122. package/lib/cjs/annotations/TextAnnotationElement.d.ts +204 -0
  123. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -0
  124. package/lib/cjs/annotations/TextAnnotationElement.js +411 -0
  125. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -0
  126. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +33 -0
  127. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -0
  128. package/lib/cjs/annotations/TextAnnotationGeometry.js +137 -0
  129. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -0
  130. package/lib/cjs/annotations/TextBlockGeometry.d.ts +16 -0
  131. package/lib/cjs/annotations/TextBlockGeometry.d.ts.map +1 -0
  132. package/lib/cjs/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +28 -70
  133. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -0
  134. package/lib/cjs/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +69 -22
  135. package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -0
  136. package/lib/cjs/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +174 -49
  137. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -0
  138. package/lib/cjs/core-backend.d.ts +7 -3
  139. package/lib/cjs/core-backend.d.ts.map +1 -1
  140. package/lib/cjs/core-backend.js +27 -6
  141. package/lib/cjs/core-backend.js.map +1 -1
  142. package/lib/cjs/internal/ElementLRUCache.d.ts +23 -0
  143. package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -1
  144. package/lib/cjs/internal/ElementLRUCache.js +167 -3
  145. package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
  146. package/lib/cjs/internal/Symbols.d.ts +1 -0
  147. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  148. package/lib/cjs/internal/Symbols.js +2 -1
  149. package/lib/cjs/internal/Symbols.js.map +1 -1
  150. package/lib/cjs/internal/annotations/fields.d.ts +22 -0
  151. package/lib/cjs/internal/annotations/fields.d.ts.map +1 -0
  152. package/lib/cjs/internal/annotations/fields.js +237 -0
  153. package/lib/cjs/internal/annotations/fields.js.map +1 -0
  154. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
  155. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +1 -1
  156. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  157. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
  158. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  159. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +1 -1
  160. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +1 -1
  161. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  162. package/lib/cjs/workspace/Workspace.d.ts +0 -1
  163. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  164. package/lib/cjs/workspace/Workspace.js.map +1 -1
  165. package/lib/esm/BackendHubAccess.d.ts +1 -1
  166. package/lib/esm/BackendHubAccess.js +1 -1
  167. package/lib/esm/BackendHubAccess.js.map +1 -1
  168. package/lib/esm/BisCoreSchema.d.ts.map +1 -1
  169. package/lib/esm/BisCoreSchema.js +4 -2
  170. package/lib/esm/BisCoreSchema.js.map +1 -1
  171. package/lib/esm/BriefcaseManager.d.ts +10 -2
  172. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  173. package/lib/esm/BriefcaseManager.js +17 -1
  174. package/lib/esm/BriefcaseManager.js.map +1 -1
  175. package/lib/esm/Category.d.ts +4 -4
  176. package/lib/esm/Category.js +4 -4
  177. package/lib/esm/Category.js.map +1 -1
  178. package/lib/esm/ChangesetECAdaptor.d.ts +67 -8
  179. package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
  180. package/lib/esm/ChangesetECAdaptor.js +248 -33
  181. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  182. package/lib/esm/ClassRegistry.d.ts +9 -1
  183. package/lib/esm/ClassRegistry.d.ts.map +1 -1
  184. package/lib/esm/ClassRegistry.js +9 -1
  185. package/lib/esm/ClassRegistry.js.map +1 -1
  186. package/lib/esm/CloudSqlite.js +1 -1
  187. package/lib/esm/CloudSqlite.js.map +1 -1
  188. package/lib/esm/CodeSpecs.d.ts +1 -1
  189. package/lib/esm/CodeSpecs.js +1 -1
  190. package/lib/esm/CodeSpecs.js.map +1 -1
  191. package/lib/esm/DisplayStyle.d.ts +4 -4
  192. package/lib/esm/DisplayStyle.js +3 -3
  193. package/lib/esm/DisplayStyle.js.map +1 -1
  194. package/lib/esm/ECDb.d.ts +4 -4
  195. package/lib/esm/ECDb.d.ts.map +1 -1
  196. package/lib/esm/ECDb.js +4 -4
  197. package/lib/esm/ECDb.js.map +1 -1
  198. package/lib/esm/ECSqlStatement.d.ts +15 -6
  199. package/lib/esm/ECSqlStatement.d.ts.map +1 -1
  200. package/lib/esm/ECSqlStatement.js +19 -4
  201. package/lib/esm/ECSqlStatement.js.map +1 -1
  202. package/lib/esm/Element.d.ts +54 -51
  203. package/lib/esm/Element.d.ts.map +1 -1
  204. package/lib/esm/Element.js +67 -52
  205. package/lib/esm/Element.js.map +1 -1
  206. package/lib/esm/ElementAspect.d.ts +8 -8
  207. package/lib/esm/ElementAspect.d.ts.map +1 -1
  208. package/lib/esm/ElementAspect.js +8 -8
  209. package/lib/esm/ElementAspect.js.map +1 -1
  210. package/lib/esm/Entity.d.ts +10 -7
  211. package/lib/esm/Entity.d.ts.map +1 -1
  212. package/lib/esm/Entity.js +36 -14
  213. package/lib/esm/Entity.js.map +1 -1
  214. package/lib/esm/ExportGraphics.d.ts +54 -8
  215. package/lib/esm/ExportGraphics.d.ts.map +1 -1
  216. package/lib/esm/ExportGraphics.js +156 -58
  217. package/lib/esm/ExportGraphics.js.map +1 -1
  218. package/lib/esm/GeographicCRSServices.d.ts +6 -2
  219. package/lib/esm/GeographicCRSServices.d.ts.map +1 -1
  220. package/lib/esm/GeographicCRSServices.js +1 -1
  221. package/lib/esm/GeographicCRSServices.js.map +1 -1
  222. package/lib/esm/IModelDb.d.ts +37 -26
  223. package/lib/esm/IModelDb.d.ts.map +1 -1
  224. package/lib/esm/IModelDb.js +128 -51
  225. package/lib/esm/IModelDb.js.map +1 -1
  226. package/lib/esm/IModelElementCloneContext.d.ts +1 -1
  227. package/lib/esm/IModelElementCloneContext.d.ts.map +1 -1
  228. package/lib/esm/IModelElementCloneContext.js +1 -1
  229. package/lib/esm/IModelElementCloneContext.js.map +1 -1
  230. package/lib/esm/IModelHost.d.ts +2 -3
  231. package/lib/esm/IModelHost.d.ts.map +1 -1
  232. package/lib/esm/IModelHost.js +2 -3
  233. package/lib/esm/IModelHost.js.map +1 -1
  234. package/lib/esm/IModelIncrementalSchemaLocater.d.ts +36 -0
  235. package/lib/esm/IModelIncrementalSchemaLocater.d.ts.map +1 -0
  236. package/lib/esm/IModelIncrementalSchemaLocater.js +65 -0
  237. package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -0
  238. package/lib/esm/LocalHub.d.ts.map +1 -1
  239. package/lib/esm/LocalHub.js +6 -4
  240. package/lib/esm/LocalHub.js.map +1 -1
  241. package/lib/esm/Material.d.ts +4 -3
  242. package/lib/esm/Material.d.ts.map +1 -1
  243. package/lib/esm/Material.js +5 -5
  244. package/lib/esm/Material.js.map +1 -1
  245. package/lib/esm/Model.d.ts +22 -22
  246. package/lib/esm/Model.js +22 -22
  247. package/lib/esm/Model.js.map +1 -1
  248. package/lib/esm/Relationship.d.ts +3 -0
  249. package/lib/esm/Relationship.d.ts.map +1 -1
  250. package/lib/esm/Relationship.js +15 -0
  251. package/lib/esm/Relationship.js.map +1 -1
  252. package/lib/esm/SQLiteDb.d.ts +1 -1
  253. package/lib/esm/SQLiteDb.js +1 -1
  254. package/lib/esm/SQLiteDb.js.map +1 -1
  255. package/lib/esm/Schema.d.ts +25 -0
  256. package/lib/esm/Schema.d.ts.map +1 -1
  257. package/lib/esm/Schema.js +25 -0
  258. package/lib/esm/Schema.js.map +1 -1
  259. package/lib/esm/SqliteStatement.d.ts +1 -1
  260. package/lib/esm/SqliteStatement.d.ts.map +1 -1
  261. package/lib/esm/SqliteStatement.js +1 -1
  262. package/lib/esm/SqliteStatement.js.map +1 -1
  263. package/lib/esm/Texture.d.ts +1 -1
  264. package/lib/esm/Texture.js +1 -1
  265. package/lib/esm/Texture.js.map +1 -1
  266. package/lib/esm/TxnManager.d.ts +4 -4
  267. package/lib/esm/TxnManager.js +1 -1
  268. package/lib/esm/TxnManager.js.map +1 -1
  269. package/lib/esm/ViewDefinition.d.ts +40 -14
  270. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  271. package/lib/esm/ViewDefinition.js +42 -14
  272. package/lib/esm/ViewDefinition.js.map +1 -1
  273. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +61 -0
  274. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -0
  275. package/lib/esm/annotations/ElementDrivesTextAnnotation.js +105 -0
  276. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -0
  277. package/lib/esm/annotations/FrameGeometry.d.ts +51 -0
  278. package/lib/esm/annotations/FrameGeometry.d.ts.map +1 -0
  279. package/lib/esm/annotations/FrameGeometry.js +244 -0
  280. package/lib/esm/annotations/FrameGeometry.js.map +1 -0
  281. package/lib/esm/annotations/LeaderGeometry.d.ts +53 -0
  282. package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -0
  283. package/lib/esm/annotations/LeaderGeometry.js +179 -0
  284. package/lib/esm/annotations/LeaderGeometry.js.map +1 -0
  285. package/lib/esm/annotations/TextAnnotationElement.d.ts +204 -0
  286. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -0
  287. package/lib/esm/annotations/TextAnnotationElement.js +405 -0
  288. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -0
  289. package/lib/esm/annotations/TextAnnotationGeometry.d.ts +33 -0
  290. package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -0
  291. package/lib/esm/annotations/TextAnnotationGeometry.js +134 -0
  292. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -0
  293. package/lib/esm/annotations/TextBlockGeometry.d.ts +16 -0
  294. package/lib/esm/annotations/TextBlockGeometry.d.ts.map +1 -0
  295. package/lib/esm/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +28 -70
  296. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -0
  297. package/lib/esm/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +69 -22
  298. package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -0
  299. package/lib/esm/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +172 -48
  300. package/lib/esm/annotations/TextBlockLayout.js.map +1 -0
  301. package/lib/esm/core-backend.d.ts +7 -3
  302. package/lib/esm/core-backend.d.ts.map +1 -1
  303. package/lib/esm/core-backend.js +27 -3
  304. package/lib/esm/core-backend.js.map +1 -1
  305. package/lib/esm/internal/ElementLRUCache.d.ts +23 -0
  306. package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -1
  307. package/lib/esm/internal/ElementLRUCache.js +165 -2
  308. package/lib/esm/internal/ElementLRUCache.js.map +1 -1
  309. package/lib/esm/internal/Symbols.d.ts +1 -0
  310. package/lib/esm/internal/Symbols.d.ts.map +1 -1
  311. package/lib/esm/internal/Symbols.js +1 -0
  312. package/lib/esm/internal/Symbols.js.map +1 -1
  313. package/lib/esm/internal/annotations/fields.d.ts +22 -0
  314. package/lib/esm/internal/annotations/fields.d.ts.map +1 -0
  315. package/lib/esm/internal/annotations/fields.js +231 -0
  316. package/lib/esm/internal/annotations/fields.js.map +1 -0
  317. package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
  318. package/lib/esm/rpc-impl/IModelReadRpcImpl.js +1 -1
  319. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  320. package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
  321. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  322. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.d.ts +1 -1
  323. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js +1 -1
  324. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  325. package/lib/esm/test/AnnotationTestUtils.d.ts +15 -0
  326. package/lib/esm/test/AnnotationTestUtils.d.ts.map +1 -0
  327. package/lib/esm/test/AnnotationTestUtils.js +41 -0
  328. package/lib/esm/test/AnnotationTestUtils.js.map +1 -0
  329. package/lib/esm/test/ElementLRUCache.test.js +224 -1
  330. package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
  331. package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
  332. package/lib/esm/test/IModelTestUtils.js +1 -0
  333. package/lib/esm/test/IModelTestUtils.js.map +1 -1
  334. package/lib/esm/test/TestUtils.d.ts +1 -1
  335. package/lib/esm/test/TestUtils.d.ts.map +1 -1
  336. package/lib/esm/test/TestUtils.js +1 -1
  337. package/lib/esm/test/TestUtils.js.map +1 -1
  338. package/lib/esm/test/annotations/Fields.test.d.ts +2 -0
  339. package/lib/esm/test/annotations/Fields.test.d.ts.map +1 -0
  340. package/lib/esm/test/annotations/Fields.test.js +576 -0
  341. package/lib/esm/test/annotations/Fields.test.js.map +1 -0
  342. package/lib/esm/test/annotations/FrameGeometry.test.d.ts +2 -0
  343. package/lib/esm/test/annotations/FrameGeometry.test.d.ts.map +1 -0
  344. package/lib/esm/test/annotations/FrameGeometry.test.js +86 -0
  345. package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -0
  346. package/lib/esm/test/annotations/LeaderGeometry.test.d.ts +2 -0
  347. package/lib/esm/test/annotations/LeaderGeometry.test.d.ts.map +1 -0
  348. package/lib/esm/test/annotations/LeaderGeometry.test.js +256 -0
  349. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -0
  350. package/lib/esm/test/annotations/TextAnnotation.test.js +269 -1047
  351. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  352. package/lib/esm/test/annotations/TextBlock.test.d.ts +2 -0
  353. package/lib/esm/test/annotations/TextBlock.test.d.ts.map +1 -0
  354. package/lib/esm/test/annotations/TextBlock.test.js +1199 -0
  355. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -0
  356. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.d.ts +60 -0
  357. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.d.ts.map +1 -0
  358. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js +69 -0
  359. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js.map +1 -0
  360. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts +1442 -0
  361. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts.map +1 -0
  362. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js +817 -0
  363. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -0
  364. package/lib/esm/test/ecdb/ConcurrentQuery.test.d.ts +2 -0
  365. package/lib/esm/test/ecdb/ConcurrentQuery.test.d.ts.map +1 -0
  366. package/lib/esm/test/ecdb/ConcurrentQuery.test.js +164 -0
  367. package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -0
  368. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +22 -32
  369. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
  370. package/lib/esm/test/ecdb/ECDb.test.js +29 -8
  371. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  372. package/lib/esm/test/ecdb/ECSqlQuery.test.js +0 -55
  373. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  374. package/lib/esm/test/ecdb/ECSqlStatement.test.js +192 -0
  375. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  376. package/lib/esm/test/hubaccess/ApplyChangeset.test.d.ts +2 -0
  377. package/lib/esm/test/hubaccess/ApplyChangeset.test.d.ts.map +1 -0
  378. package/lib/esm/test/hubaccess/ApplyChangeset.test.js +86 -0
  379. package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -0
  380. package/lib/esm/test/imodel/IModel.test.js +313 -5
  381. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  382. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.d.ts +2 -0
  383. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.d.ts.map +1 -0
  384. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js +343 -0
  385. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -0
  386. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.d.ts +2 -0
  387. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.d.ts.map +1 -0
  388. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +207 -0
  389. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -0
  390. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts +11 -0
  391. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts.map +1 -0
  392. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js +36 -0
  393. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js.map +1 -0
  394. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts +17 -0
  395. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts.map +1 -0
  396. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js +116 -0
  397. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js.map +1 -0
  398. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts +9 -0
  399. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts.map +1 -0
  400. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js +20 -0
  401. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +1 -0
  402. package/lib/esm/test/misc/GeoServices.test.js +36 -10
  403. package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
  404. package/lib/esm/test/schema/ClassRegistry.test.js +104 -2
  405. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  406. package/lib/esm/test/standalone/ChangesetReader.test.js +547 -136
  407. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  408. package/lib/esm/test/standalone/ExportGraphics.test.js +53 -1
  409. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  410. package/lib/esm/test/standalone/GeometryStream.test.js +49 -1
  411. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  412. package/lib/esm/test/standalone/IModelLimits.test.d.ts +2 -0
  413. package/lib/esm/test/standalone/IModelLimits.test.d.ts.map +1 -0
  414. package/lib/esm/test/standalone/IModelLimits.test.js +103 -0
  415. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -0
  416. package/lib/esm/test/standalone/RenderMaterialElement.test.js +24 -1
  417. package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
  418. package/lib/esm/test/standalone/SnapshotDb.test.js +19 -1
  419. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  420. package/lib/esm/workspace/Workspace.d.ts +0 -1
  421. package/lib/esm/workspace/Workspace.d.ts.map +1 -1
  422. package/lib/esm/workspace/Workspace.js.map +1 -1
  423. package/package.json +22 -16
  424. package/lib/cjs/TextAnnotationElement.d.ts +0 -54
  425. package/lib/cjs/TextAnnotationElement.d.ts.map +0 -1
  426. package/lib/cjs/TextAnnotationElement.js +0 -94
  427. package/lib/cjs/TextAnnotationElement.js.map +0 -1
  428. package/lib/cjs/TextAnnotationGeometry.d.ts +0 -32
  429. package/lib/cjs/TextAnnotationGeometry.d.ts.map +0 -1
  430. package/lib/cjs/TextAnnotationGeometry.js.map +0 -1
  431. package/lib/cjs/TextAnnotationLayout.d.ts.map +0 -1
  432. package/lib/cjs/TextAnnotationLayout.js.map +0 -1
  433. package/lib/esm/TextAnnotationElement.d.ts +0 -54
  434. package/lib/esm/TextAnnotationElement.d.ts.map +0 -1
  435. package/lib/esm/TextAnnotationElement.js +0 -89
  436. package/lib/esm/TextAnnotationElement.js.map +0 -1
  437. package/lib/esm/TextAnnotationGeometry.d.ts +0 -32
  438. package/lib/esm/TextAnnotationGeometry.d.ts.map +0 -1
  439. package/lib/esm/TextAnnotationGeometry.js.map +0 -1
  440. package/lib/esm/TextAnnotationLayout.d.ts.map +0 -1
  441. package/lib/esm/TextAnnotationLayout.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ApplyChangeset.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApplyChangeset.test.d.ts","sourceRoot":"","sources":["../../../../src/test/hubaccess/ApplyChangeset.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,86 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as chai from "chai";
6
+ import * as chaiAsPromised from "chai-as-promised";
7
+ import { HubWrappers, KnownTestLocations } from "..";
8
+ import { ChannelControl, IModelHost } from "../../core-backend";
9
+ import { HubMock } from "../../internal/HubMock";
10
+ chai.use(chaiAsPromised);
11
+ describe("apply changesets", function () {
12
+ before(async () => {
13
+ await IModelHost.startup();
14
+ });
15
+ it("Apply changeset with no local changes, should not create new local changes", async () => {
16
+ HubMock.startup("PullMergeMethod", KnownTestLocations.outputDir);
17
+ const iModelId = await HubMock.createNewIModel({ accessToken: "user1", iTwinId: HubMock.iTwinId, iModelName: "Test", description: "TestSubject" });
18
+ const b1 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: "user1", iTwinId: HubMock.iTwinId, iModelId, noLock: true });
19
+ b1.channels.addAllowedChannel(ChannelControl.sharedChannelName);
20
+ b1.saveChanges();
21
+ const b2 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: "user2", iTwinId: HubMock.iTwinId, iModelId, noLock: true });
22
+ b2.channels.addAllowedChannel(ChannelControl.sharedChannelName);
23
+ b2.saveChanges();
24
+ const b3 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: "user2", iTwinId: HubMock.iTwinId, iModelId, noLock: true });
25
+ b3.channels.addAllowedChannel(ChannelControl.sharedChannelName);
26
+ b3.saveChanges();
27
+ const schema1 = `<?xml version="1.0" encoding="UTF-8"?>
28
+ <ECSchema schemaName="TestDomain" alias="ts" version="01.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.1">
29
+ <ECSchemaReference name="BisCore" version="01.00" alias="bis"/>
30
+ <ECEntityClass typeName="a1">
31
+ <BaseClass>bis:GraphicalElement2d</BaseClass>
32
+ </ECEntityClass>
33
+ <ECEntityClass typeName="b1"> <BaseClass>a1</BaseClass> </ECEntityClass>
34
+ <ECEntityClass typeName="b2"> <BaseClass>a1</BaseClass> </ECEntityClass>
35
+ <ECEntityClass typeName="c1"> <BaseClass>b1</BaseClass> </ECEntityClass>
36
+ <ECEntityClass typeName="c2"> <BaseClass>b1</BaseClass> </ECEntityClass>
37
+ <ECEntityClass typeName="d1"> <BaseClass>b2</BaseClass> </ECEntityClass>
38
+ <ECEntityClass typeName="d2"> <BaseClass>b2</BaseClass> </ECEntityClass>
39
+ <ECEntityClass typeName="f1"> <BaseClass>d1</BaseClass> </ECEntityClass>
40
+ <ECEntityClass typeName="f2"> <BaseClass>d1</BaseClass> </ECEntityClass>
41
+ <ECEntityClass typeName="e1"> <BaseClass>d2</BaseClass> </ECEntityClass>
42
+ <ECEntityClass typeName="e2"> <BaseClass>d2</BaseClass> </ECEntityClass>
43
+ </ECSchema>`;
44
+ await b1.importSchemaStrings([schema1]);
45
+ b1.saveChanges("schema1");
46
+ chai.expect(b1.txns.hasPendingTxns).to.be.true;
47
+ await b1.pushChanges({ description: "schema1" });
48
+ chai.expect(b1.txns.hasPendingTxns).to.be.false;
49
+ chai.expect(b2.txns.hasPendingTxns).to.be.false;
50
+ await b2.pullChanges();
51
+ chai.expect(b2.txns.hasPendingTxns).to.be.false;
52
+ const schema2 = `<?xml version="1.0" encoding="UTF-8"?>
53
+ <ECSchema schemaName="TestDomain2" alias="ts1" version="01.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.1">
54
+ <ECSchemaReference name="BisCore" version="01.00" alias="bis"/>
55
+ <ECEntityClass typeName="a1">
56
+ <BaseClass>bis:GraphicalElement2d</BaseClass>
57
+ </ECEntityClass>
58
+ <ECEntityClass typeName="b1"> <BaseClass>a1</BaseClass> </ECEntityClass>
59
+ <ECEntityClass typeName="b2"> <BaseClass>a1</BaseClass> </ECEntityClass>
60
+ <ECEntityClass typeName="c1"> <BaseClass>b1</BaseClass> </ECEntityClass>
61
+ <ECEntityClass typeName="c2"> <BaseClass>b1</BaseClass> </ECEntityClass>
62
+ <ECEntityClass typeName="d1"> <BaseClass>b2</BaseClass> </ECEntityClass>
63
+ <ECEntityClass typeName="d2"> <BaseClass>b2</BaseClass> </ECEntityClass>
64
+ <ECEntityClass typeName="f1"> <BaseClass>d1</BaseClass> </ECEntityClass>
65
+ <ECEntityClass typeName="f2"> <BaseClass>d1</BaseClass> </ECEntityClass>
66
+ <ECEntityClass typeName="e1"> <BaseClass>d2</BaseClass> </ECEntityClass>
67
+ <ECEntityClass typeName="e2"> <BaseClass>d2</BaseClass> </ECEntityClass>
68
+ </ECSchema>`;
69
+ await b1.importSchemaStrings([schema2]);
70
+ b1.saveChanges("schema2");
71
+ chai.expect(b1.txns.hasPendingTxns).to.be.true;
72
+ await b1.pushChanges({ description: "schema2" });
73
+ chai.expect(b1.txns.hasPendingTxns).to.be.false;
74
+ chai.expect(b2.txns.hasPendingTxns).to.be.false;
75
+ await b2.pullChanges();
76
+ chai.expect(b2.txns.hasPendingTxns).to.be.false;
77
+ chai.expect(b3.txns.hasPendingTxns).to.be.false;
78
+ await b3.pullChanges();
79
+ chai.expect(b3.txns.hasPendingTxns).to.be.false;
80
+ b1.close();
81
+ b2.close();
82
+ b3.close();
83
+ HubMock.shutdown();
84
+ });
85
+ });
86
+ //# sourceMappingURL=ApplyChangeset.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApplyChangeset.test.js","sourceRoot":"","sources":["../../../../src/test/hubaccess/ApplyChangeset.test.ts"],"names":[],"mappings":"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","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\nimport * as chai from \"chai\";\nimport * as chaiAsPromised from \"chai-as-promised\";\nimport { HubWrappers, KnownTestLocations } from \"..\";\nimport { ChannelControl, IModelHost } from \"../../core-backend\";\nimport { HubMock } from \"../../internal/HubMock\";\nimport { Suite } from \"mocha\";\nchai.use(chaiAsPromised);\n\ndescribe(\"apply changesets\", function (this: Suite) {\n before(async () => {\n await IModelHost.startup();\n });\n\n it(\"Apply changeset with no local changes, should not create new local changes\", async () => {\n HubMock.startup(\"PullMergeMethod\", KnownTestLocations.outputDir);\n\n const iModelId = await HubMock.createNewIModel({ accessToken: \"user1\", iTwinId: HubMock.iTwinId, iModelName: \"Test\", description: \"TestSubject\" });\n\n const b1 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: \"user1\", iTwinId: HubMock.iTwinId, iModelId, noLock: true });\n b1.channels.addAllowedChannel(ChannelControl.sharedChannelName);\n b1.saveChanges();\n\n const b2 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: \"user2\", iTwinId: HubMock.iTwinId, iModelId, noLock: true });\n b2.channels.addAllowedChannel(ChannelControl.sharedChannelName);\n b2.saveChanges();\n\n const b3 = await HubWrappers.downloadAndOpenBriefcase({ accessToken: \"user2\", iTwinId: HubMock.iTwinId, iModelId, noLock: true });\n b3.channels.addAllowedChannel(ChannelControl.sharedChannelName);\n b3.saveChanges();\n\n const schema1 = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <ECSchema schemaName=\"TestDomain\" alias=\"ts\" version=\"01.00\" xmlns=\"http://www.bentley.com/schemas/Bentley.ECXML.3.1\">\n <ECSchemaReference name=\"BisCore\" version=\"01.00\" alias=\"bis\"/>\n <ECEntityClass typeName=\"a1\">\n <BaseClass>bis:GraphicalElement2d</BaseClass>\n </ECEntityClass>\n <ECEntityClass typeName=\"b1\"> <BaseClass>a1</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"b2\"> <BaseClass>a1</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"c1\"> <BaseClass>b1</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"c2\"> <BaseClass>b1</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"d1\"> <BaseClass>b2</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"d2\"> <BaseClass>b2</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"f1\"> <BaseClass>d1</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"f2\"> <BaseClass>d1</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"e1\"> <BaseClass>d2</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"e2\"> <BaseClass>d2</BaseClass> </ECEntityClass>\n </ECSchema>`;\n\n await b1.importSchemaStrings([schema1]);\n b1.saveChanges(\"schema1\");\n\n chai.expect(b1.txns.hasPendingTxns).to.be.true\n await b1.pushChanges({ description: \"schema1\" });\n chai.expect(b1.txns.hasPendingTxns).to.be.false\n\n chai.expect(b2.txns.hasPendingTxns).to.be.false\n await b2.pullChanges();\n chai.expect(b2.txns.hasPendingTxns).to.be.false;\n\n const schema2 = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <ECSchema schemaName=\"TestDomain2\" alias=\"ts1\" version=\"01.00\" xmlns=\"http://www.bentley.com/schemas/Bentley.ECXML.3.1\">\n <ECSchemaReference name=\"BisCore\" version=\"01.00\" alias=\"bis\"/>\n <ECEntityClass typeName=\"a1\">\n <BaseClass>bis:GraphicalElement2d</BaseClass>\n </ECEntityClass>\n <ECEntityClass typeName=\"b1\"> <BaseClass>a1</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"b2\"> <BaseClass>a1</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"c1\"> <BaseClass>b1</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"c2\"> <BaseClass>b1</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"d1\"> <BaseClass>b2</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"d2\"> <BaseClass>b2</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"f1\"> <BaseClass>d1</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"f2\"> <BaseClass>d1</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"e1\"> <BaseClass>d2</BaseClass> </ECEntityClass>\n <ECEntityClass typeName=\"e2\"> <BaseClass>d2</BaseClass> </ECEntityClass>\n </ECSchema>`;\n\n await b1.importSchemaStrings([schema2]);\n b1.saveChanges(\"schema2\");\n\n chai.expect(b1.txns.hasPendingTxns).to.be.true\n await b1.pushChanges({ description: \"schema2\" });\n chai.expect(b1.txns.hasPendingTxns).to.be.false;\n\n\n chai.expect(b2.txns.hasPendingTxns).to.be.false\n await b2.pullChanges();\n chai.expect(b2.txns.hasPendingTxns).to.be.false;\n\n\n chai.expect(b3.txns.hasPendingTxns).to.be.false\n await b3.pullChanges();\n chai.expect(b3.txns.hasPendingTxns).to.be.false;\n\n\n b1.close();\n b2.close();\n b3.close();\n HubMock.shutdown();\n });\n});\n"]}
@@ -62,7 +62,7 @@ import { DbResult, Guid, Id64, IModelStatus, Logger, OpenMode, ProcessDetector }
62
62
  import { BisCodeSpec, BriefcaseIdValue, Code, CodeScopeSpec, CodeSpec, ColorByName, ColorDef, DisplayStyleSettings, EcefLocation, FontMap, FontType, GeoCoordStatus, GeographicCRS, GeometryParams, GeometryStreamBuilder, ImageSourceFormat, IModel, IModelError, RelatedElement, RenderMode, SchemaState, SubCategoryAppearance, TextureMapping, TextureMapUnits, ViewFlags, } from "@itwin/core-common";
63
63
  import { Geometry, LineString3d, Loop, Matrix4d, Point3d, PolyfaceBuilder, Range3d, StrokeOptions, Transform, YawPitchRollAngles, } from "@itwin/core-geometry";
64
64
  import { V2CheckpointManager } from "../../CheckpointManager";
65
- import { _nativeDb, BisCoreSchema, Category, ClassRegistry, DefinitionContainer, DefinitionGroup, DefinitionGroupGroupsDefinitions, DefinitionModel, DefinitionPartition, DictionaryModel, DisplayStyle3d, DocumentPartition, DrawingGraphic, Element, ElementDrivesElement, ElementGroupsMembers, ElementOwnsChildElements, GeometricElement2d, GeometricElement3d, GeometricModel, GroupInformationPartition, IModelDb, IModelHost, IModelJsFs, InformationPartitionElement, InformationRecordElement, LinkPartition, Model, PhysicalElement, PhysicalModel, PhysicalObject, PhysicalPartition, RenderMaterialElement, SnapshotDb, SpatialCategory, SqliteValueType, StandaloneDb, SubCategory, Subject, Texture, } from "../../core-backend";
65
+ import { _nativeDb, BisCoreSchema, Category, ClassRegistry, DefinitionContainer, DefinitionGroup, DefinitionGroupGroupsDefinitions, DefinitionModel, DefinitionPartition, DictionaryModel, DisplayStyle3d, DocumentPartition, DrawingGraphic, Element, ElementDrivesElement, ElementGroupsMembers, ElementOwnsChildElements, GenericGraphicalType2d, GeometricElement2d, GeometricElement3d, GeometricModel, GroupInformationPartition, IModelDb, IModelHost, IModelJsFs, InformationPartitionElement, InformationRecordElement, LinkPartition, Model, PhysicalElement, PhysicalModel, PhysicalObject, PhysicalPartition, RenderMaterialElement, SnapshotDb, SpatialCategory, SqliteValueType, StandaloneDb, SubCategory, Subject, Texture, } from "../../core-backend";
66
66
  import { BriefcaseDb } from "../../IModelDb";
67
67
  import { HubMock } from "../../internal/HubMock";
68
68
  import { KnownTestLocations } from "../KnownTestLocations";
@@ -999,12 +999,70 @@ describe("iModel", () => {
999
999
  assert.equal(federationGuid.extendedTypeName, "BeGuid");
1000
1000
  }
1001
1001
  }
1002
+ it("should get metadata for a relationship", async () => {
1003
+ const imodelPath = IModelTestUtils.prepareOutputFile("IModel", "relationshipMetadata.bim");
1004
+ const imodel = SnapshotDb.createEmpty(imodelPath, { rootSubject: { name: "relationshipMetadata" } });
1005
+ const partitionId = imodel.elements.insertElement({
1006
+ classFullName: "BisCore:PhysicalPartition",
1007
+ model: IModel.repositoryModelId,
1008
+ parent: {
1009
+ relClassName: "BisCore:SubjectOwnsPartitionElements",
1010
+ id: IModel.rootSubjectId,
1011
+ },
1012
+ code: new Code({
1013
+ spec: imodel.codeSpecs.getByName(BisCodeSpec.informationPartitionElement).id,
1014
+ scope: IModel.rootSubjectId,
1015
+ value: "physical model",
1016
+ }),
1017
+ });
1018
+ for await (const row of imodel.createQueryReader(`SELECT * FROM bis.Element LIMIT ${1}`)) {
1019
+ const relId = imodel.relationships.insertInstance({
1020
+ classFullName: "BisCore:ElementHasLinks",
1021
+ sourceId: partitionId,
1022
+ targetId: row.ECInstanceId,
1023
+ });
1024
+ const relationship = imodel.relationships.getInstance("BisCore:ElementHasLinks", relId);
1025
+ const metadata = await relationship.getMetaData();
1026
+ assert.isDefined(metadata, "metadata should be defined");
1027
+ }
1028
+ imodel.close();
1029
+ });
1002
1030
  it("should get metadata for class", () => {
1003
1031
  const metaData = imodel1.schemaContext.getSchemaItemSync(Element.classFullName, EntityClass);
1004
1032
  assert.exists(metaData);
1005
1033
  if (metaData !== undefined)
1006
1034
  checkElementMetaData(metaData);
1007
1035
  });
1036
+ it("should iterate through metadata for a relationship", async () => {
1037
+ const imodelPath = IModelTestUtils.prepareOutputFile("IModel", "relationshipMetadata.bim");
1038
+ const imodel = SnapshotDb.createEmpty(imodelPath, { rootSubject: { name: "relationshipMetadata" } });
1039
+ const partitionId = imodel.elements.insertElement({
1040
+ classFullName: "BisCore:PhysicalPartition",
1041
+ model: IModel.repositoryModelId,
1042
+ parent: {
1043
+ relClassName: "BisCore:SubjectOwnsPartitionElements",
1044
+ id: IModel.rootSubjectId,
1045
+ },
1046
+ code: new Code({
1047
+ spec: imodel.codeSpecs.getByName(BisCodeSpec.informationPartitionElement).id,
1048
+ scope: IModel.rootSubjectId,
1049
+ value: "physical model",
1050
+ }),
1051
+ });
1052
+ for await (const row of imodel.createQueryReader(`SELECT * FROM bis.Element LIMIT ${1}`)) {
1053
+ const relId = imodel.relationships.insertInstance({
1054
+ classFullName: "BisCore:ElementHasLinks",
1055
+ sourceId: partitionId,
1056
+ targetId: row.ECInstanceId,
1057
+ });
1058
+ const relationship = imodel.relationships.getInstance("BisCore:ElementHasLinks", relId);
1059
+ relationship.forEach((propName, propMeta) => {
1060
+ assert.isDefined(propName, "Property name should be defined");
1061
+ assert.isDefined(propMeta, "Property metadata should be defined");
1062
+ });
1063
+ }
1064
+ imodel.close();
1065
+ });
1008
1066
  it("update the project extents", async () => {
1009
1067
  const originalExtents = imodel1.projectExtents;
1010
1068
  const newExtents = Range3d.create(originalExtents.low, originalExtents.high);
@@ -1301,12 +1359,15 @@ describe("iModel", () => {
1301
1359
  // Delete the model
1302
1360
  testImodel.models.deleteModel(newModelId);
1303
1361
  // Test insertModel error handling
1304
- assert.throws(() => {
1362
+ try {
1305
1363
  testImodel.models.insertModel({
1306
1364
  classFullName: DefinitionModel.classFullName,
1307
1365
  modeledElement: { id: "0x10000000bad" },
1308
1366
  });
1309
- }, IModelError);
1367
+ }
1368
+ catch (error) {
1369
+ assert.isTrue(error instanceof IModelError || error.iTwinErrorId !== undefined);
1370
+ }
1310
1371
  });
1311
1372
  it("should create model with custom relationship to modeled element", async () => {
1312
1373
  const testImodel = imodel1;
@@ -1605,6 +1666,33 @@ describe("iModel", () => {
1605
1666
  assert.isTrue(iModel2.ecefLocation !== undefined);
1606
1667
  iModel2.close();
1607
1668
  });
1669
+ describe("async coordinate conversions", () => {
1670
+ it("should output same number of points as input", async () => {
1671
+ const iModelCoords = [];
1672
+ const geoCoords = [];
1673
+ for (let numPts = 0; numPts < 3; numPts++) {
1674
+ const geoResponse = await imodel5.getGeoCoordinatesFromIModelCoordinates({ target: "WGS84", iModelCoords });
1675
+ expect(geoResponse.geoCoords.length).to.equal(numPts);
1676
+ const iModelResponse = await imodel5.getIModelCoordinatesFromGeoCoordinates({ source: "WGS84", geoCoords });
1677
+ expect(iModelResponse.iModelCoords.length).to.equal(numPts);
1678
+ iModelCoords.push(new Point3d());
1679
+ geoCoords.push(new Point3d());
1680
+ }
1681
+ });
1682
+ it("should always have fromCache = 0", async () => {
1683
+ const iModelCoords = [];
1684
+ const geoCoords = [];
1685
+ for (let numPts = 0; numPts < 3; numPts++) {
1686
+ const geoResponse = await imodel5.getGeoCoordinatesFromIModelCoordinates({ target: "WGS84", iModelCoords });
1687
+ expect(geoResponse.fromCache).to.equal(0);
1688
+ const iModelResponse = await imodel5.getIModelCoordinatesFromGeoCoordinates({ source: "WGS84", geoCoords });
1689
+ expect(iModelResponse.iModelCoords.length).to.equal(numPts);
1690
+ expect(iModelResponse.fromCache).to.equal(0);
1691
+ iModelCoords.push(new Point3d());
1692
+ geoCoords.push(new Point3d());
1693
+ }
1694
+ });
1695
+ });
1608
1696
  if (!ProcessDetector.isIOSAppBackend) {
1609
1697
  it("should be able to reproject with iModel coordinates to or from any other GeographicCRS", async () => {
1610
1698
  const convertTest = async (fileName, fileGCS, datum, inputCoord, outputCoord) => {
@@ -2086,10 +2174,41 @@ describe("iModel", () => {
2086
2174
  db.abandonChanges();
2087
2175
  db.close();
2088
2176
  });
2177
+ it("Cache cleared on abandonChanges", () => {
2178
+ const standaloneFile = IModelTestUtils.prepareOutputFile("IModel", "StandaloneReadWrite.bim");
2179
+ const db = StandaloneDb.createEmpty(standaloneFile, { rootSubject: { name: "Standalone" } });
2180
+ db.saveChanges();
2181
+ const code = Code.createEmpty();
2182
+ code.value = "foo";
2183
+ const props = {
2184
+ classFullName: GenericGraphicalType2d.classFullName,
2185
+ model: IModel.dictionaryId,
2186
+ code,
2187
+ };
2188
+ const id = db.elements.insertElement(props);
2189
+ const element1 = db.elements.getElementProps(id);
2190
+ db.abandonChanges();
2191
+ code.value = "bar";
2192
+ const props2 = {
2193
+ classFullName: GenericGraphicalType2d.classFullName,
2194
+ model: IModel.dictionaryId,
2195
+ code,
2196
+ };
2197
+ const id2 = db.elements.insertElement(props2);
2198
+ expect(id2).to.equal(id);
2199
+ const element2 = db.elements.getElementProps(id2);
2200
+ expect(element2).to.not.equal(element1);
2201
+ db.abandonChanges();
2202
+ db.close();
2203
+ });
2089
2204
  it("Standalone iModel properties", () => {
2090
2205
  const standaloneRootSubjectName = "Standalone";
2091
2206
  const standaloneFile1 = IModelTestUtils.prepareOutputFile("IModel", "Standalone1.bim");
2092
- let standaloneDb1 = StandaloneDb.createEmpty(standaloneFile1, { rootSubject: { name: standaloneRootSubjectName } });
2207
+ const ecefLocation = new EcefLocation({ origin: [1, 2, 3], orientation: { yaw: 0, pitch: 0, roll: 0 } });
2208
+ const geographicCoordinateSystem = {
2209
+ horizontalCRS: { id: "10TM115-27" },
2210
+ };
2211
+ let standaloneDb1 = StandaloneDb.createEmpty(standaloneFile1, { rootSubject: { name: standaloneRootSubjectName }, ecefLocation, geographicCoordinateSystem });
2093
2212
  assert.isTrue(standaloneDb1.isStandaloneDb());
2094
2213
  assert.isTrue(standaloneDb1.isStandalone);
2095
2214
  assert.isFalse(standaloneDb1.isReadonly, "Expect standalone iModels to be read-write during create");
@@ -2102,6 +2221,8 @@ describe("iModel", () => {
2102
2221
  assert.equal(standaloneDb1.iTwinId, Guid.empty);
2103
2222
  assert.strictEqual("", standaloneDb1.changeset.id);
2104
2223
  assert.strictEqual(0, standaloneDb1.changeset.index);
2224
+ assert.deepEqual(standaloneDb1.ecefLocation?.origin, ecefLocation.origin, "standalone ecefLocation should be set");
2225
+ assert.strictEqual(standaloneDb1.geographicCoordinateSystem?.horizontalCRS?.id, "10TM115-27", "standalone coordinate system should be set");
2105
2226
  assert.equal(standaloneDb1.openMode, OpenMode.ReadWrite);
2106
2227
  standaloneDb1.close();
2107
2228
  assert.isFalse(standaloneDb1.isOpen);
@@ -2119,7 +2240,11 @@ describe("iModel", () => {
2119
2240
  const snapshotFile2 = IModelTestUtils.prepareOutputFile("IModel", "Snapshot2.bim");
2120
2241
  const snapshotFile3 = IModelTestUtils.prepareOutputFile("IModel", "Snapshot3.bim");
2121
2242
  const imodel = await generateTestSnapshot("test_for_snapshot.bim", "test.bim");
2122
- let snapshotDb1 = SnapshotDb.createEmpty(snapshotFile1, { rootSubject: { name: snapshotRootSubjectName }, createClassViews: true });
2243
+ const ecefLocation = new EcefLocation({ origin: [1, 2, 3], orientation: { yaw: 0, pitch: 0, roll: 0 } });
2244
+ const geographicCoordinateSystem = {
2245
+ horizontalCRS: { id: "10TM115-27" },
2246
+ };
2247
+ let snapshotDb1 = SnapshotDb.createEmpty(snapshotFile1, { rootSubject: { name: snapshotRootSubjectName }, createClassViews: true, ecefLocation, geographicCoordinateSystem });
2123
2248
  let snapshotDb2 = SnapshotDb.createFrom(snapshotDb1, snapshotFile2);
2124
2249
  let snapshotDb3 = SnapshotDb.createFrom(imodel, snapshotFile3, { createClassViews: true });
2125
2250
  assert.isTrue(snapshotDb1.isSnapshotDb());
@@ -2156,6 +2281,8 @@ describe("iModel", () => {
2156
2281
  assert.isTrue(snapshotDb1.isOpen);
2157
2282
  assert.isTrue(snapshotDb2.isOpen);
2158
2283
  assert.isTrue(snapshotDb3.isOpen);
2284
+ assert.deepEqual(snapshotDb1.ecefLocation?.origin, ecefLocation.origin, "snapshot ecefLocation should be set");
2285
+ assert.strictEqual(snapshotDb1.geographicCoordinateSystem?.horizontalCRS?.id, "10TM115-27", "snapshot coordinate system should be set");
2159
2286
  snapshotDb1.close();
2160
2287
  snapshotDb2.close();
2161
2288
  snapshotDb3.close();
@@ -2587,6 +2714,32 @@ describe("iModel", () => {
2587
2714
  expect(categ3.code.value).to.equal(code3.trimmedCodeVal);
2588
2715
  imodel.close();
2589
2716
  });
2717
+ it("should throw iTwinErrors on element CRUD opertion fails", async () => {
2718
+ const code = Code.createEmpty();
2719
+ code.value = "foo";
2720
+ const props = {
2721
+ classFullName: GenericGraphicalType2d.classFullName,
2722
+ model: IModel.dictionaryId,
2723
+ code,
2724
+ };
2725
+ imodel1.elements.insertElement(props);
2726
+ expect(() => imodel1.elements.insertElement(props)).throws("Error inserting element [duplicate code]").to.have.property("iTwinErrorId");
2727
+ const updateProps = {
2728
+ id: Id64.fromString("0x111111"),
2729
+ classFullName: GenericGraphicalType2d.classFullName,
2730
+ model: IModel.dictionaryId,
2731
+ code,
2732
+ };
2733
+ expect(() => imodel1.elements.updateElement(updateProps)).throws(`Error updating element [missing id], id: ${updateProps.id}`).to.have.property("iTwinErrorId");
2734
+ expect(() => imodel1.elements.deleteElement(updateProps.id)).throws(`Error deleting element [missing id], id: ${updateProps.id}`).to.have.property("iTwinErrorId");
2735
+ expect(() => imodel1.models.insertModel({ classFullName: DefinitionModel.classFullName, modeledElement: { id: "0x10000000bad" } })).throws("Error inserting model [error=10004], class=BisCore:DefinitionModel").to.have.property("iTwinErrorId");
2736
+ expect(() => imodel1.models.updateModel({
2737
+ id: Id64.fromString("0x111111"),
2738
+ modeledElement: { id: Id64.fromString("0x111111") },
2739
+ classFullName: ""
2740
+ })).throws(`Error updating model [missing id], id: ${Id64.fromString("0x111111")}`).to.have.property("iTwinErrorId");
2741
+ expect(() => imodel1.models.deleteModel(Id64.fromString("0x111111"))).throws(`Error deleting model [missing id], id: ${Id64.fromString("0x111111")}`).to.have.property("iTwinErrorId");
2742
+ });
2590
2743
  it("throws NotFound when attempting to access element props after closing the iModel", () => {
2591
2744
  const imodelPath = IModelTestUtils.prepareOutputFile("IModel", "accessAfterClose.bim");
2592
2745
  const imodel = SnapshotDb.createEmpty(imodelPath, { rootSubject: { name: "accessAfterClose" } });
@@ -2622,5 +2775,160 @@ describe("iModel", () => {
2622
2775
  expect(() => imodel.relationships.insertInstance(props)).to.throw(`Failed to insert relationship [${imodelPath}]: rc=2067, constraint failed (BE_SQLITE_CONSTRAINT_UNIQUE)`);
2623
2776
  imodel.close();
2624
2777
  });
2778
+ function createElemProps(_imodel, modId, catId, className) {
2779
+ // Create props
2780
+ const elementProps = {
2781
+ classFullName: className,
2782
+ model: modId,
2783
+ category: catId,
2784
+ code: Code.createEmpty(),
2785
+ };
2786
+ return elementProps;
2787
+ }
2788
+ function insertElement(imodel, mId, cId, cName, propName) {
2789
+ const elementProps = createElemProps(imodel, mId, cId, cName);
2790
+ const geomElement = imodel.elements.createElement(elementProps);
2791
+ geomElement.name = propName; // Add a custom property to the element
2792
+ const id = imodel.elements.insertElement(geomElement.toJSON());
2793
+ assert.isTrue(Id64.isValidId64(id), "insert failed");
2794
+ return id;
2795
+ }
2796
+ function validateADrivesBRowCount(imodel, expectedRows) {
2797
+ const reader = IModelTestUtils.executeQuery(imodel, `select * from trs.ADrivesB`);
2798
+ assert.strictEqual(reader.length, expectedRows, `Expected ${expectedRows} rows in trs.ADrivesB table`);
2799
+ }
2800
+ function validateNavProp(imodel, expectedNavPropValue) {
2801
+ const reader = IModelTestUtils.executeQuery(imodel, `select NavPropChildB from trs.ChildA`);
2802
+ assert.strictEqual(reader.length, 1);
2803
+ assert.deepEqual(reader[0].navPropChildB, expectedNavPropValue, `Expected NavPropChildB to be "${expectedNavPropValue}"`);
2804
+ }
2805
+ it("Validate invalid relationship classes being inserted/updated", async () => {
2806
+ const imodelPath = IModelTestUtils.prepareOutputFile("IModel", "invalidRelationshipClass.bim");
2807
+ if (IModelJsFs.existsSync(imodelPath))
2808
+ IModelJsFs.unlinkSync(imodelPath);
2809
+ const testImodel = SnapshotDb.createEmpty(imodelPath, { rootSubject: { name: "invalidRelationshipClass" } });
2810
+ await testImodel.importSchemaStrings([
2811
+ `<?xml version="1.0" encoding="UTF-8"?>
2812
+ <ECSchema schemaName="TestRelationSchema" alias="trs" version="01.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.1">
2813
+ <ECSchemaReference name="BisCore" version="01.00" alias="bis"/>
2814
+ <ECEntityClass typeName="TestElement">
2815
+ <BaseClass>bis:PhysicalElement</BaseClass>
2816
+ <ECProperty propertyName="Name" typeName="string" />
2817
+ </ECEntityClass>
2818
+
2819
+ <ECEntityClass typeName="ChildA" >
2820
+ <BaseClass>TestElement</BaseClass>
2821
+ <ECNavigationProperty propertyName="NavPropChildB" relationshipName="ADrivesB" direction="Forward" readOnly="True">
2822
+ </ECNavigationProperty>
2823
+ </ECEntityClass>
2824
+
2825
+ <ECEntityClass typeName="ChildB" >
2826
+ <BaseClass>TestElement</BaseClass>
2827
+ </ECEntityClass>
2828
+
2829
+ <ECRelationshipClass typeName="ADrivesB" strengthDirection="Backward" strength="referencing" modifier="Sealed">
2830
+ <Source multiplicity="(0..*)" polymorphic="true" roleLabel="drives">
2831
+ <Class class="ChildA"/>
2832
+ </Source>
2833
+ <Target multiplicity="(0..1)" polymorphic="true" roleLabel="is driven by">
2834
+ <Class class="ChildB"/>
2835
+ </Target>
2836
+ </ECRelationshipClass>
2837
+
2838
+ <ECEntityClass typeName="ChildC">
2839
+ <BaseClass>TestElement</BaseClass>
2840
+ </ECEntityClass>
2841
+
2842
+ <ECEntityClass typeName="ChildD">
2843
+ <BaseClass>TestElement</BaseClass>
2844
+ </ECEntityClass>
2845
+
2846
+ <ECRelationshipClass typeName="CIsRelatedToD" strength="referencing" modifier="Sealed">
2847
+ <BaseClass>bis:ElementRefersToElements</BaseClass>
2848
+ <Source multiplicity="(0..*)" roleLabel="IsRelatedTo" polymorphic="true">
2849
+ <Class class="ChildC"/>
2850
+ </Source>
2851
+ <Target multiplicity="(0..*)" roleLabel="IsRelatedTo (Reversed)" polymorphic="true">
2852
+ <Class class="ChildD"/>
2853
+ </Target>
2854
+ </ECRelationshipClass>
2855
+ </ECSchema>`
2856
+ ]);
2857
+ // Enable ECSQL write validation and verify it's set
2858
+ const pragmaRows = IModelTestUtils.executeQuery(testImodel, `PRAGMA validate_ecsql_writes=true`);
2859
+ assert.exists(pragmaRows);
2860
+ assert.strictEqual(pragmaRows[0].validate_ecsql_writes, true);
2861
+ // Ensure ADrivesB table is empty before test
2862
+ validateADrivesBRowCount(testImodel, 0);
2863
+ // Create a physical model and spatial category if needed
2864
+ const [, newModelId] = IModelTestUtils.createAndInsertPhysicalPartitionAndModel(testImodel, Code.createEmpty(), true);
2865
+ let spatialCategoryId = SpatialCategory.queryCategoryIdByName(testImodel, IModel.dictionaryId, "MySpatialCategory");
2866
+ if (!spatialCategoryId) {
2867
+ spatialCategoryId = SpatialCategory.insert(testImodel, IModel.dictionaryId, "MySpatialCategory", new SubCategoryAppearance({ color: ColorDef.fromString("rgb(255,0,0)").toJSON() }));
2868
+ }
2869
+ // Insert a ChildB element to be referenced by ChildA
2870
+ const idB = insertElement(testImodel, newModelId, spatialCategoryId, "TestRelationSchema:ChildB", "ChildBElement");
2871
+ assert.isTrue(Id64.isValidId64(idB), "Insert ChildBElement failed");
2872
+ testImodel.saveChanges();
2873
+ // Prepare base props for ChildA
2874
+ const elementProps = createElemProps(testImodel, newModelId, spatialCategoryId, "TestRelationSchema:ChildA");
2875
+ // Test various relationship class names for navigation property
2876
+ const testCases = [
2877
+ { name: "trs:ADrivesB", shouldSucceed: true, expectedRows: 1 },
2878
+ { name: "trs.FakeClass", shouldSucceed: true, expectedRows: 0 },
2879
+ { name: "trs:ChildA", shouldSucceed: false, expectedRows: 0 },
2880
+ { name: "trs:ChildB", shouldSucceed: false, expectedRows: 0 },
2881
+ { name: "trs:CIsRelatedToD", shouldSucceed: false, expectedRows: 0 },
2882
+ ];
2883
+ for (const { name, shouldSucceed, expectedRows } of testCases) {
2884
+ const elemRef = new RelatedElement({ id: idB, relClassName: name });
2885
+ elementProps.navPropChildB = elemRef;
2886
+ elementProps.name = "ChildAElement";
2887
+ const geomElement = testImodel.elements.createElement(elementProps);
2888
+ let idA;
2889
+ try {
2890
+ idA = testImodel.elements.insertElement(geomElement.toJSON());
2891
+ if (shouldSucceed)
2892
+ assert.isTrue(Id64.isValidId64(idA), `Insert should have succeeded for ${name}.`);
2893
+ else
2894
+ assert.fail(`Insert should have failed for ${name}.`);
2895
+ }
2896
+ catch (err) {
2897
+ if (shouldSucceed)
2898
+ assert.fail(`Insert should have succeeded for ${name}. Error: ${err.message}`);
2899
+ // If should not succeed, error is expected
2900
+ }
2901
+ // Validate row count in ADrivesB table
2902
+ validateADrivesBRowCount(testImodel, expectedRows);
2903
+ // If insert succeeded, test update and delete scenarios
2904
+ if (expectedRows === 1 && idA !== undefined) {
2905
+ validateNavProp(testImodel, { id: idB, relClassName: "TestRelationSchema.ADrivesB" });
2906
+ const editElem = testImodel.elements.getElement(idA);
2907
+ editElem.navPropChildB = new RelatedElement({ id: idB, relClassName: "trs.FakeClass" });
2908
+ editElem.name = "ChildAElementUpdated";
2909
+ testImodel.elements.updateElement(editElem);
2910
+ validateADrivesBRowCount(testImodel, 1);
2911
+ validateNavProp(testImodel, { id: idB, relClassName: "TestRelationSchema.ADrivesB" });
2912
+ const editedElem = testImodel.elements.getElement(idA);
2913
+ assert.equal(editedElem.name, "ChildAElementUpdated", `Expected name to be "ChildAElementUpdated" after update, but got "${editedElem.name}"`);
2914
+ assert.strictEqual(editedElem.navPropChildB.relClassName, "TestRelationSchema.ADrivesB", `Expected navPropChildB to be "TestRelationSchema.ADrivesB" after update, but got "${editedElem.navPropChildB}"`);
2915
+ // Set the nav prop value to null
2916
+ editElem.name = "ChildAElementNulled";
2917
+ editElem.navPropChildB = null;
2918
+ testImodel.elements.updateElement(editElem);
2919
+ validateADrivesBRowCount(testImodel, 0);
2920
+ const nulledElem = testImodel.elements.getElement(idA);
2921
+ assert.equal(nulledElem.name, "ChildAElementNulled", `Expected name to be "ChildAElementNulled" after nulling, but got "${nulledElem.name}"`);
2922
+ assert.isUndefined(nulledElem.navPropChildB, `Expected navPropChildB to be undefined after nulling, but got "${nulledElem.navPropChildB}"`);
2923
+ if (shouldSucceed) {
2924
+ // Delete the element
2925
+ testImodel.elements.deleteElement(idA);
2926
+ assert.isUndefined(testImodel.elements.tryGetElement(idA), `Expected element with id ${idA} to be deleted, but it still exists.`);
2927
+ }
2928
+ }
2929
+ testImodel.abandonChanges();
2930
+ }
2931
+ testImodel.close();
2932
+ });
2625
2933
  });
2626
2934
  //# sourceMappingURL=IModel.test.js.map