@itwin/core-backend 5.13.0-dev.2 → 5.13.0-dev.21

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 (654) hide show
  1. package/CHANGELOG.md +50 -1
  2. package/lib/cjs/BackendHubAccess.js.map +1 -1
  3. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  4. package/lib/cjs/BisCoreSchema.js.map +1 -1
  5. package/lib/cjs/BlobContainerService.js.map +1 -1
  6. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  7. package/lib/cjs/BriefcaseManager.js +11 -5
  8. package/lib/cjs/BriefcaseManager.js.map +1 -1
  9. package/lib/cjs/CatalogDb.js.map +1 -1
  10. package/lib/cjs/Category.d.ts +4 -4
  11. package/lib/cjs/Category.js.map +1 -1
  12. package/lib/cjs/ChangeSummaryManager.js +2 -2
  13. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  14. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  15. package/lib/cjs/ChangesetECAdaptor.d.ts +5 -0
  16. package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
  17. package/lib/cjs/ChangesetECAdaptor.js +261 -251
  18. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  19. package/lib/cjs/ChangesetReader.js +3 -3
  20. package/lib/cjs/ChangesetReader.js.map +1 -1
  21. package/lib/cjs/ChangesetReaderTypes.js.map +1 -1
  22. package/lib/cjs/ChannelControl.js.map +1 -1
  23. package/lib/cjs/CheckpointManager.d.ts +3 -0
  24. package/lib/cjs/CheckpointManager.d.ts.map +1 -1
  25. package/lib/cjs/CheckpointManager.js +8 -2
  26. package/lib/cjs/CheckpointManager.js.map +1 -1
  27. package/lib/cjs/ClassRegistry.js +10 -10
  28. package/lib/cjs/ClassRegistry.js.map +1 -1
  29. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  30. package/lib/cjs/CloudSqlite.js +28 -10
  31. package/lib/cjs/CloudSqlite.js.map +1 -1
  32. package/lib/cjs/CodeService.js.map +1 -1
  33. package/lib/cjs/CodeSpecs.d.ts +3 -3
  34. package/lib/cjs/CodeSpecs.js.map +1 -1
  35. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  36. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  37. package/lib/cjs/DevTools.js.map +1 -1
  38. package/lib/cjs/DisplayStyle.d.ts +2 -2
  39. package/lib/cjs/DisplayStyle.js.map +1 -1
  40. package/lib/cjs/ECDb.d.ts.map +1 -1
  41. package/lib/cjs/ECDb.js +1 -0
  42. package/lib/cjs/ECDb.js.map +1 -1
  43. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  44. package/lib/cjs/ECSqlRowExecutor.js.map +1 -1
  45. package/lib/cjs/ECSqlStatement.js.map +1 -1
  46. package/lib/cjs/ECSqlSyncReader.js.map +1 -1
  47. package/lib/cjs/EditTxn.d.ts.map +1 -1
  48. package/lib/cjs/EditTxn.js +1 -0
  49. package/lib/cjs/EditTxn.js.map +1 -1
  50. package/lib/cjs/Element.d.ts +48 -12
  51. package/lib/cjs/Element.d.ts.map +1 -1
  52. package/lib/cjs/Element.js +120 -24
  53. package/lib/cjs/Element.js.map +1 -1
  54. package/lib/cjs/ElementAspect.js.map +1 -1
  55. package/lib/cjs/ElementGraphics.js.map +1 -1
  56. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  57. package/lib/cjs/Entity.js.map +1 -1
  58. package/lib/cjs/EntityReferences.js +2 -2
  59. package/lib/cjs/EntityReferences.js.map +1 -1
  60. package/lib/cjs/ExportGraphics.js.map +1 -1
  61. package/lib/cjs/ExternalSource.js.map +1 -1
  62. package/lib/cjs/FontFile.js.map +1 -1
  63. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  64. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  65. package/lib/cjs/GeometrySummary.js +47 -47
  66. package/lib/cjs/GeometrySummary.js.map +1 -1
  67. package/lib/cjs/IModelDb.d.ts +118 -30
  68. package/lib/cjs/IModelDb.d.ts.map +1 -1
  69. package/lib/cjs/IModelDb.js +325 -115
  70. package/lib/cjs/IModelDb.js.map +1 -1
  71. package/lib/cjs/IModelDbFonts.js.map +1 -1
  72. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  73. package/lib/cjs/IModelHost.d.ts.map +1 -1
  74. package/lib/cjs/IModelHost.js +3 -0
  75. package/lib/cjs/IModelHost.js.map +1 -1
  76. package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -1
  77. package/lib/cjs/IModelJsFs.js.map +1 -1
  78. package/lib/cjs/ImageSourceConversion.js.map +1 -1
  79. package/lib/cjs/IpcHost.js.map +1 -1
  80. package/lib/cjs/LineStyle.js.map +1 -1
  81. package/lib/cjs/LocalHub.js +1 -1
  82. package/lib/cjs/LocalHub.js.map +1 -1
  83. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  84. package/lib/cjs/LockControl.js.map +1 -1
  85. package/lib/cjs/Material.js.map +1 -1
  86. package/lib/cjs/Model.d.ts +5 -5
  87. package/lib/cjs/Model.d.ts.map +1 -1
  88. package/lib/cjs/Model.js.map +1 -1
  89. package/lib/cjs/NativeAppStorage.js.map +1 -1
  90. package/lib/cjs/NativeHost.js.map +1 -1
  91. package/lib/cjs/NavigationRelationship.js.map +1 -1
  92. package/lib/cjs/PartialChangeUnifier.js +7 -7
  93. package/lib/cjs/PartialChangeUnifier.js.map +1 -1
  94. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  95. package/lib/cjs/PropertyStore.js +1 -1
  96. package/lib/cjs/PropertyStore.js.map +1 -1
  97. package/lib/cjs/Relationship.js.map +1 -1
  98. package/lib/cjs/RpcBackend.js.map +1 -1
  99. package/lib/cjs/SQLiteDb.js.map +1 -1
  100. package/lib/cjs/Schema.js.map +1 -1
  101. package/lib/cjs/SchemaSync.d.ts +158 -22
  102. package/lib/cjs/SchemaSync.d.ts.map +1 -1
  103. package/lib/cjs/SchemaSync.js +417 -76
  104. package/lib/cjs/SchemaSync.js.map +1 -1
  105. package/lib/cjs/SchemaUtils.js.map +1 -1
  106. package/lib/cjs/SheetIndex.js.map +1 -1
  107. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  108. package/lib/cjs/SqliteStatement.js.map +1 -1
  109. package/lib/cjs/StashManager.js.map +1 -1
  110. package/lib/cjs/SynchronousChannel.d.ts +62 -0
  111. package/lib/cjs/SynchronousChannel.d.ts.map +1 -0
  112. package/lib/cjs/SynchronousChannel.js +11 -0
  113. package/lib/cjs/SynchronousChannel.js.map +1 -0
  114. package/lib/cjs/Texture.d.ts +1 -1
  115. package/lib/cjs/Texture.js.map +1 -1
  116. package/lib/cjs/TileStorage.js.map +1 -1
  117. package/lib/cjs/TxnManager.d.ts +44 -4
  118. package/lib/cjs/TxnManager.d.ts.map +1 -1
  119. package/lib/cjs/TxnManager.js +74 -19
  120. package/lib/cjs/TxnManager.js.map +1 -1
  121. package/lib/cjs/ViewDefinition.d.ts +6 -6
  122. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  123. package/lib/cjs/ViewDefinition.js.map +1 -1
  124. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  125. package/lib/cjs/ViewStore.js.map +1 -1
  126. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  127. package/lib/cjs/annotations/FrameGeometry.js.map +1 -1
  128. package/lib/cjs/annotations/LeaderGeometry.d.ts +22 -7
  129. package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -1
  130. package/lib/cjs/annotations/LeaderGeometry.js +104 -36
  131. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
  132. package/lib/cjs/annotations/TextAnnotationElement.d.ts +1 -1
  133. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
  134. package/lib/cjs/annotations/TextAnnotationElement.js +25 -10
  135. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  136. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
  137. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -1
  138. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -1
  139. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  140. package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +36 -36
  141. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +28 -28
  142. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
  143. package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
  144. package/lib/cjs/core-backend.d.ts +1 -0
  145. package/lib/cjs/core-backend.d.ts.map +1 -1
  146. package/lib/cjs/core-backend.js +1 -0
  147. package/lib/cjs/core-backend.js.map +1 -1
  148. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  149. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  150. package/lib/cjs/domains/GenericElements.js.map +1 -1
  151. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  152. package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
  153. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  154. package/lib/cjs/internal/ECSqlInstanceReshaper.js.map +1 -1
  155. package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
  156. package/lib/cjs/internal/FontFileImpl.js.map +1 -1
  157. package/lib/cjs/internal/HubMock.js.map +1 -1
  158. package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -1
  159. package/lib/cjs/internal/IntegrityCheck.d.ts +22 -0
  160. package/lib/cjs/internal/IntegrityCheck.d.ts.map +1 -1
  161. package/lib/cjs/internal/IntegrityCheck.js +13 -0
  162. package/lib/cjs/internal/IntegrityCheck.js.map +1 -1
  163. package/lib/cjs/internal/NativePlatform.js.map +1 -1
  164. package/lib/cjs/internal/NoLocks.js.map +1 -1
  165. package/lib/cjs/internal/NoReservations.d.ts +6 -0
  166. package/lib/cjs/internal/NoReservations.d.ts.map +1 -0
  167. package/lib/cjs/internal/NoReservations.js +21 -0
  168. package/lib/cjs/internal/NoReservations.js.map +1 -0
  169. package/lib/cjs/internal/OnlineStatus.js.map +1 -1
  170. package/lib/cjs/internal/SchemaSyncReservations.d.ts +4 -0
  171. package/lib/cjs/internal/SchemaSyncReservations.d.ts.map +1 -0
  172. package/lib/cjs/internal/SchemaSyncReservations.js +128 -0
  173. package/lib/cjs/internal/SchemaSyncReservations.js.map +1 -0
  174. package/lib/cjs/internal/ServerBasedLocks.js +33 -33
  175. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  176. package/lib/cjs/internal/Symbols.d.ts +1 -0
  177. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  178. package/lib/cjs/internal/Symbols.js +2 -1
  179. package/lib/cjs/internal/Symbols.js.map +1 -1
  180. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  181. package/lib/cjs/internal/cross-package.js.map +1 -1
  182. package/lib/cjs/internal/workspace/SettingsEditorImpl.js.map +1 -1
  183. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  184. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  185. package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
  186. package/lib/cjs/internal/workspace/WorkspaceImpl.js +7 -2
  187. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  188. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  189. package/lib/cjs/rpc/multipart.js.map +1 -1
  190. package/lib/cjs/rpc/tracing.js.map +1 -1
  191. package/lib/cjs/rpc/web/logging.js.map +1 -1
  192. package/lib/cjs/rpc/web/request.js.map +1 -1
  193. package/lib/cjs/rpc/web/response.js.map +1 -1
  194. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  195. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  196. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  197. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  198. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  199. package/lib/cjs/workspace/Settings.js.map +1 -1
  200. package/lib/cjs/workspace/SettingsDb.js.map +1 -1
  201. package/lib/cjs/workspace/SettingsEditor.js.map +1 -1
  202. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  203. package/lib/cjs/workspace/Workspace.js.map +1 -1
  204. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
  205. package/lib/esm/BackendHubAccess.js.map +1 -1
  206. package/lib/esm/BackendLoggerCategory.js.map +1 -1
  207. package/lib/esm/BisCoreSchema.js.map +1 -1
  208. package/lib/esm/BlobContainerService.js.map +1 -1
  209. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  210. package/lib/esm/BriefcaseManager.js +11 -5
  211. package/lib/esm/BriefcaseManager.js.map +1 -1
  212. package/lib/esm/CatalogDb.js.map +1 -1
  213. package/lib/esm/Category.d.ts +4 -4
  214. package/lib/esm/Category.js.map +1 -1
  215. package/lib/esm/ChangeSummaryManager.js +2 -2
  216. package/lib/esm/ChangeSummaryManager.js.map +1 -1
  217. package/lib/esm/ChangedElementsDb.js.map +1 -1
  218. package/lib/esm/ChangesetECAdaptor.d.ts +5 -0
  219. package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
  220. package/lib/esm/ChangesetECAdaptor.js +261 -251
  221. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  222. package/lib/esm/ChangesetReader.js +3 -3
  223. package/lib/esm/ChangesetReader.js.map +1 -1
  224. package/lib/esm/ChangesetReaderTypes.js.map +1 -1
  225. package/lib/esm/ChannelControl.js.map +1 -1
  226. package/lib/esm/CheckpointManager.d.ts +3 -0
  227. package/lib/esm/CheckpointManager.d.ts.map +1 -1
  228. package/lib/esm/CheckpointManager.js +8 -2
  229. package/lib/esm/CheckpointManager.js.map +1 -1
  230. package/lib/esm/ClassRegistry.js +6 -6
  231. package/lib/esm/ClassRegistry.js.map +1 -1
  232. package/lib/esm/CloudSqlite.d.ts.map +1 -1
  233. package/lib/esm/CloudSqlite.js +29 -11
  234. package/lib/esm/CloudSqlite.js.map +1 -1
  235. package/lib/esm/CodeService.js.map +1 -1
  236. package/lib/esm/CodeSpecs.d.ts +3 -3
  237. package/lib/esm/CodeSpecs.js.map +1 -1
  238. package/lib/esm/ConcurrentQuery.js.map +1 -1
  239. package/lib/esm/CustomViewState3dCreator.js.map +1 -1
  240. package/lib/esm/DevTools.js.map +1 -1
  241. package/lib/esm/DisplayStyle.d.ts +2 -2
  242. package/lib/esm/DisplayStyle.js.map +1 -1
  243. package/lib/esm/ECDb.d.ts.map +1 -1
  244. package/lib/esm/ECDb.js +1 -0
  245. package/lib/esm/ECDb.js.map +1 -1
  246. package/lib/esm/ECSchemaXmlContext.js.map +1 -1
  247. package/lib/esm/ECSqlRowExecutor.js.map +1 -1
  248. package/lib/esm/ECSqlStatement.js.map +1 -1
  249. package/lib/esm/ECSqlSyncReader.js.map +1 -1
  250. package/lib/esm/EditTxn.d.ts.map +1 -1
  251. package/lib/esm/EditTxn.js +1 -0
  252. package/lib/esm/EditTxn.js.map +1 -1
  253. package/lib/esm/Element.d.ts +48 -12
  254. package/lib/esm/Element.d.ts.map +1 -1
  255. package/lib/esm/Element.js +121 -25
  256. package/lib/esm/Element.js.map +1 -1
  257. package/lib/esm/ElementAspect.js.map +1 -1
  258. package/lib/esm/ElementGraphics.js.map +1 -1
  259. package/lib/esm/ElementTreeWalker.js.map +1 -1
  260. package/lib/esm/Entity.js.map +1 -1
  261. package/lib/esm/EntityReferences.js +1 -1
  262. package/lib/esm/EntityReferences.js.map +1 -1
  263. package/lib/esm/ExportGraphics.js.map +1 -1
  264. package/lib/esm/ExternalSource.js.map +1 -1
  265. package/lib/esm/FontFile.js.map +1 -1
  266. package/lib/esm/GeoCoordConfig.js.map +1 -1
  267. package/lib/esm/GeographicCRSServices.js.map +1 -1
  268. package/lib/esm/GeometrySummary.js +47 -47
  269. package/lib/esm/GeometrySummary.js.map +1 -1
  270. package/lib/esm/IModelDb.d.ts +118 -30
  271. package/lib/esm/IModelDb.d.ts.map +1 -1
  272. package/lib/esm/IModelDb.js +327 -117
  273. package/lib/esm/IModelDb.js.map +1 -1
  274. package/lib/esm/IModelDbFonts.js.map +1 -1
  275. package/lib/esm/IModelElementCloneContext.js.map +1 -1
  276. package/lib/esm/IModelHost.d.ts.map +1 -1
  277. package/lib/esm/IModelHost.js +3 -0
  278. package/lib/esm/IModelHost.js.map +1 -1
  279. package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -1
  280. package/lib/esm/IModelJsFs.js.map +1 -1
  281. package/lib/esm/ImageSourceConversion.js.map +1 -1
  282. package/lib/esm/IpcHost.js.map +1 -1
  283. package/lib/esm/LineStyle.js.map +1 -1
  284. package/lib/esm/LocalHub.js +1 -1
  285. package/lib/esm/LocalHub.js.map +1 -1
  286. package/lib/esm/LocalhostIpcHost.js.map +1 -1
  287. package/lib/esm/LockControl.js.map +1 -1
  288. package/lib/esm/Material.js.map +1 -1
  289. package/lib/esm/Model.d.ts +5 -5
  290. package/lib/esm/Model.d.ts.map +1 -1
  291. package/lib/esm/Model.js.map +1 -1
  292. package/lib/esm/NativeAppStorage.js.map +1 -1
  293. package/lib/esm/NativeHost.js.map +1 -1
  294. package/lib/esm/NavigationRelationship.js.map +1 -1
  295. package/lib/esm/PartialChangeUnifier.js +7 -7
  296. package/lib/esm/PartialChangeUnifier.js.map +1 -1
  297. package/lib/esm/PromiseMemoizer.js.map +1 -1
  298. package/lib/esm/PropertyStore.js +1 -1
  299. package/lib/esm/PropertyStore.js.map +1 -1
  300. package/lib/esm/Relationship.js.map +1 -1
  301. package/lib/esm/RpcBackend.js.map +1 -1
  302. package/lib/esm/SQLiteDb.js.map +1 -1
  303. package/lib/esm/Schema.js.map +1 -1
  304. package/lib/esm/SchemaSync.d.ts +158 -22
  305. package/lib/esm/SchemaSync.d.ts.map +1 -1
  306. package/lib/esm/SchemaSync.js +419 -78
  307. package/lib/esm/SchemaSync.js.map +1 -1
  308. package/lib/esm/SchemaUtils.js.map +1 -1
  309. package/lib/esm/SheetIndex.js.map +1 -1
  310. package/lib/esm/SqliteChangesetReader.js.map +1 -1
  311. package/lib/esm/SqliteStatement.js.map +1 -1
  312. package/lib/esm/StashManager.js.map +1 -1
  313. package/lib/esm/SynchronousChannel.d.ts +62 -0
  314. package/lib/esm/SynchronousChannel.d.ts.map +1 -0
  315. package/lib/esm/SynchronousChannel.js +9 -0
  316. package/lib/esm/SynchronousChannel.js.map +1 -0
  317. package/lib/esm/Texture.d.ts +1 -1
  318. package/lib/esm/Texture.js.map +1 -1
  319. package/lib/esm/TileStorage.js.map +1 -1
  320. package/lib/esm/TxnManager.d.ts +44 -4
  321. package/lib/esm/TxnManager.d.ts.map +1 -1
  322. package/lib/esm/TxnManager.js +74 -19
  323. package/lib/esm/TxnManager.js.map +1 -1
  324. package/lib/esm/ViewDefinition.d.ts +6 -6
  325. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  326. package/lib/esm/ViewDefinition.js.map +1 -1
  327. package/lib/esm/ViewStateHydrator.js.map +1 -1
  328. package/lib/esm/ViewStore.js.map +1 -1
  329. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  330. package/lib/esm/annotations/FrameGeometry.js.map +1 -1
  331. package/lib/esm/annotations/LeaderGeometry.d.ts +22 -7
  332. package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -1
  333. package/lib/esm/annotations/LeaderGeometry.js +104 -36
  334. package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
  335. package/lib/esm/annotations/TextAnnotationElement.d.ts +1 -1
  336. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
  337. package/lib/esm/annotations/TextAnnotationElement.js +25 -10
  338. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  339. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
  340. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -1
  341. package/lib/esm/annotations/TextBlockLayout.js.map +1 -1
  342. package/lib/esm/core-backend.d.ts +1 -0
  343. package/lib/esm/core-backend.d.ts.map +1 -1
  344. package/lib/esm/core-backend.js +1 -0
  345. package/lib/esm/core-backend.js.map +1 -1
  346. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  347. package/lib/esm/domains/FunctionalSchema.js.map +1 -1
  348. package/lib/esm/domains/GenericElements.js.map +1 -1
  349. package/lib/esm/domains/GenericSchema.js.map +1 -1
  350. package/lib/esm/internal/ChangesetConflictArgs.js.map +1 -1
  351. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  352. package/lib/esm/internal/ECSqlInstanceReshaper.js.map +1 -1
  353. package/lib/esm/internal/ElementLRUCache.js.map +1 -1
  354. package/lib/esm/internal/FontFileImpl.js.map +1 -1
  355. package/lib/esm/internal/HubMock.js.map +1 -1
  356. package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -1
  357. package/lib/esm/internal/IntegrityCheck.d.ts +22 -0
  358. package/lib/esm/internal/IntegrityCheck.d.ts.map +1 -1
  359. package/lib/esm/internal/IntegrityCheck.js +13 -0
  360. package/lib/esm/internal/IntegrityCheck.js.map +1 -1
  361. package/lib/esm/internal/NativePlatform.js.map +1 -1
  362. package/lib/esm/internal/NoLocks.js.map +1 -1
  363. package/lib/esm/internal/NoReservations.d.ts +6 -0
  364. package/lib/esm/internal/NoReservations.d.ts.map +1 -0
  365. package/lib/esm/internal/NoReservations.js +18 -0
  366. package/lib/esm/internal/NoReservations.js.map +1 -0
  367. package/lib/esm/internal/OnlineStatus.js.map +1 -1
  368. package/lib/esm/internal/SchemaSyncReservations.d.ts +4 -0
  369. package/lib/esm/internal/SchemaSyncReservations.d.ts.map +1 -0
  370. package/lib/esm/internal/SchemaSyncReservations.js +125 -0
  371. package/lib/esm/internal/SchemaSyncReservations.js.map +1 -0
  372. package/lib/esm/internal/ServerBasedLocks.js +33 -33
  373. package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
  374. package/lib/esm/internal/Symbols.d.ts +1 -0
  375. package/lib/esm/internal/Symbols.d.ts.map +1 -1
  376. package/lib/esm/internal/Symbols.js +1 -0
  377. package/lib/esm/internal/Symbols.js.map +1 -1
  378. package/lib/esm/internal/annotations/fields.js.map +1 -1
  379. package/lib/esm/internal/cross-package.js.map +1 -1
  380. package/lib/esm/internal/workspace/SettingsEditorImpl.js.map +1 -1
  381. package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
  382. package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  383. package/lib/esm/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
  384. package/lib/esm/internal/workspace/WorkspaceImpl.js +7 -2
  385. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  386. package/lib/esm/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  387. package/lib/esm/rpc/multipart.js.map +1 -1
  388. package/lib/esm/rpc/tracing.js.map +1 -1
  389. package/lib/esm/rpc/web/logging.js.map +1 -1
  390. package/lib/esm/rpc/web/request.js.map +1 -1
  391. package/lib/esm/rpc/web/response.js.map +1 -1
  392. package/lib/esm/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  393. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  394. package/lib/esm/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  395. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  396. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  397. package/lib/esm/test/AdvancedEqual.js.map +1 -1
  398. package/lib/esm/test/AnnotationTestUtils.js.map +1 -1
  399. package/lib/esm/test/AttachDb.test.js +11 -11
  400. package/lib/esm/test/AttachDb.test.js.map +1 -1
  401. package/lib/esm/test/ElementDrivesElement.test.js +23 -23
  402. package/lib/esm/test/ElementDrivesElement.test.js.map +1 -1
  403. package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
  404. package/lib/esm/test/GeometryTestUtil.js.map +1 -1
  405. package/lib/esm/test/IModelHost.test.js.map +1 -1
  406. package/lib/esm/test/IModelTestUtils.d.ts +1 -1
  407. package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
  408. package/lib/esm/test/IModelTestUtils.js +8 -3
  409. package/lib/esm/test/IModelTestUtils.js.map +1 -1
  410. package/lib/esm/test/ImageSourceConversion.test.js.map +1 -1
  411. package/lib/esm/test/IpcHost.test.js.map +1 -1
  412. package/lib/esm/test/KnownTestLocations.js.map +1 -1
  413. package/lib/esm/test/PrintElementTree.js.map +1 -1
  414. package/lib/esm/test/PropertyDb.test.js.map +1 -1
  415. package/lib/esm/test/SchemaChangesetCanBeReversed.test.js +51 -51
  416. package/lib/esm/test/SchemaChangesetCanBeReversed.test.js.map +1 -1
  417. package/lib/esm/test/SchemaUtils.test.js +25 -25
  418. package/lib/esm/test/SchemaUtils.test.js.map +1 -1
  419. package/lib/esm/test/SequentialLogMatcher.js.map +1 -1
  420. package/lib/esm/test/SquashSchemaAndDataChanges.test.js +129 -129
  421. package/lib/esm/test/SquashSchemaAndDataChanges.test.js.map +1 -1
  422. package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
  423. package/lib/esm/test/TestEditTxn.js.map +1 -1
  424. package/lib/esm/test/TestUtils.js.map +1 -1
  425. package/lib/esm/test/annotations/Fields.test.js +53 -53
  426. package/lib/esm/test/annotations/Fields.test.js.map +1 -1
  427. package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -1
  428. package/lib/esm/test/annotations/LeaderGeometry.test.js +178 -2
  429. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
  430. package/lib/esm/test/annotations/TextAnnotation.test.js +48 -18
  431. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  432. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
  433. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js.map +1 -1
  434. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
  435. package/lib/esm/test/categories/Category.test.js.map +1 -1
  436. package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
  437. package/lib/esm/test/ecdb/CTE.test.js +88 -88
  438. package/lib/esm/test/ecdb/CTE.test.js.map +1 -1
  439. package/lib/esm/test/ecdb/ConcurrentQuery.test.js +19 -19
  440. package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -1
  441. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +15 -15
  442. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
  443. package/lib/esm/test/ecdb/ECDb.test.js +72 -72
  444. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  445. package/lib/esm/test/ecdb/ECDbTestHelper.js.map +1 -1
  446. package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -1
  447. package/lib/esm/test/ecdb/ECSqlAst.test.js +65 -65
  448. package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
  449. package/lib/esm/test/ecdb/ECSqlQuery.test.js +4 -4
  450. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  451. package/lib/esm/test/ecdb/ECSqlStatement.test.js +509 -332
  452. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  453. package/lib/esm/test/ecdb/ECSqlSyncReader.test.js +4 -4
  454. package/lib/esm/test/ecdb/ECSqlSyncReader.test.js.map +1 -1
  455. package/lib/esm/test/ecdb/QueryReaders.test.js +33 -47
  456. package/lib/esm/test/ecdb/QueryReaders.test.js.map +1 -1
  457. package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
  458. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
  459. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +21 -21
  460. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
  461. package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
  462. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js +2 -2
  463. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  464. package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
  465. package/lib/esm/test/element/ElementAspect.test.js +176 -24
  466. package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
  467. package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
  468. package/lib/esm/test/element/ElementRoundTrip.test.js +224 -141
  469. package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
  470. package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
  471. package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
  472. package/lib/esm/test/element/NullStructArray.test.js +13 -13
  473. package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
  474. package/lib/esm/test/element/ProjectInformationRecord.test.js.map +1 -1
  475. package/lib/esm/test/element/SheetInformationAspect.test.js.map +1 -1
  476. package/lib/esm/test/element/UrlLink.test.js.map +1 -1
  477. package/lib/esm/test/example-code/EditTxn.test.d.ts +2 -0
  478. package/lib/esm/test/example-code/EditTxn.test.d.ts.map +1 -0
  479. package/lib/esm/test/example-code/EditTxn.test.js +47 -0
  480. package/lib/esm/test/example-code/EditTxn.test.js.map +1 -0
  481. package/lib/esm/test/font/FontFile.test.js.map +1 -1
  482. package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
  483. package/lib/esm/test/hubaccess/ApplyChangeset.test.js +32 -32
  484. package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -1
  485. package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
  486. package/lib/esm/test/hubaccess/CheckpointManager.test.js +43 -1
  487. package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
  488. package/lib/esm/test/hubaccess/CodeSwap.test.js.map +1 -1
  489. package/lib/esm/test/hubaccess/Rebase.test.js +59 -57
  490. package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
  491. package/lib/esm/test/hubaccess/SemanticRebase.test.js +374 -373
  492. package/lib/esm/test/hubaccess/SemanticRebase.test.js.map +1 -1
  493. package/lib/esm/test/hubaccess/SemanticRebaseTestUtils.d.ts +3 -0
  494. package/lib/esm/test/hubaccess/SemanticRebaseTestUtils.d.ts.map +1 -0
  495. package/lib/esm/test/hubaccess/SemanticRebaseTestUtils.js +15 -0
  496. package/lib/esm/test/hubaccess/SemanticRebaseTestUtils.js.map +1 -0
  497. package/lib/esm/test/imageData.js.map +1 -1
  498. package/lib/esm/test/imodel/Code.test.js.map +1 -1
  499. package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
  500. package/lib/esm/test/imodel/GetTextureImage.test.js.map +1 -1
  501. package/lib/esm/test/imodel/IModelECSql.test.d.ts +2 -0
  502. package/lib/esm/test/imodel/IModelECSql.test.d.ts.map +1 -0
  503. package/lib/esm/test/imodel/IModelECSql.test.js +367 -0
  504. package/lib/esm/test/imodel/IModelECSql.test.js.map +1 -0
  505. package/lib/esm/test/imodel/IModelElements.test.d.ts +2 -0
  506. package/lib/esm/test/imodel/IModelElements.test.d.ts.map +1 -0
  507. package/lib/esm/test/imodel/IModelElements.test.js +969 -0
  508. package/lib/esm/test/imodel/IModelElements.test.js.map +1 -0
  509. package/lib/esm/test/imodel/IModelGeolocation.test.d.ts +2 -0
  510. package/lib/esm/test/imodel/IModelGeolocation.test.d.ts.map +1 -0
  511. package/lib/esm/test/imodel/IModelGeolocation.test.js +539 -0
  512. package/lib/esm/test/imodel/IModelGeolocation.test.js.map +1 -0
  513. package/lib/esm/test/imodel/IModelLifecycle.test.d.ts +2 -0
  514. package/lib/esm/test/imodel/IModelLifecycle.test.d.ts.map +1 -0
  515. package/lib/esm/test/imodel/IModelLifecycle.test.js +499 -0
  516. package/lib/esm/test/imodel/IModelLifecycle.test.js.map +1 -0
  517. package/lib/esm/test/imodel/IModelMetadata.test.d.ts +2 -0
  518. package/lib/esm/test/imodel/IModelMetadata.test.d.ts.map +1 -0
  519. package/lib/esm/test/imodel/IModelMetadata.test.js +274 -0
  520. package/lib/esm/test/imodel/IModelMetadata.test.js.map +1 -0
  521. package/lib/esm/test/imodel/IModelModels.test.d.ts +2 -0
  522. package/lib/esm/test/imodel/IModelModels.test.d.ts.map +1 -0
  523. package/lib/esm/test/imodel/IModelModels.test.js +357 -0
  524. package/lib/esm/test/imodel/IModelModels.test.js.map +1 -0
  525. package/lib/esm/test/imodel/IModelRelationships.test.d.ts +2 -0
  526. package/lib/esm/test/imodel/IModelRelationships.test.d.ts.map +1 -0
  527. package/lib/esm/test/imodel/IModelRelationships.test.js +407 -0
  528. package/lib/esm/test/imodel/IModelRelationships.test.js.map +1 -0
  529. package/lib/esm/test/imodel/IModelTestFixtures.d.ts +53 -0
  530. package/lib/esm/test/imodel/IModelTestFixtures.d.ts.map +1 -0
  531. package/lib/esm/test/imodel/IModelTestFixtures.js +107 -0
  532. package/lib/esm/test/imodel/IModelTestFixtures.js.map +1 -0
  533. package/lib/esm/test/imodel/IModelViews.test.d.ts +2 -0
  534. package/lib/esm/test/imodel/IModelViews.test.d.ts.map +1 -0
  535. package/lib/esm/test/imodel/IModelViews.test.js +199 -0
  536. package/lib/esm/test/imodel/IModelViews.test.js.map +1 -0
  537. package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
  538. package/lib/esm/test/imodel/SchemaXmlImport.test.js +21 -21
  539. package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
  540. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
  541. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
  542. package/lib/esm/test/incrementalSchemaLocater/TestContext.js.map +1 -1
  543. package/lib/esm/test/index.d.ts +0 -1
  544. package/lib/esm/test/index.d.ts.map +1 -1
  545. package/lib/esm/test/index.js +0 -1
  546. package/lib/esm/test/index.js.map +1 -1
  547. package/lib/esm/test/internal/ECSqlInstanceReshaper.test.js +32 -32
  548. package/lib/esm/test/internal/ECSqlInstanceReshaper.test.js.map +1 -1
  549. package/lib/esm/test/misc/DevTools.test.js.map +1 -1
  550. package/lib/esm/test/misc/EntitySubClasses.test.js.map +1 -1
  551. package/lib/esm/test/misc/PromiseMemoizer.test.js.map +1 -1
  552. package/lib/esm/test/native/DgnDbWorker.test.js.map +1 -1
  553. package/lib/esm/test/rpc/response.test.js.map +1 -1
  554. package/lib/esm/test/schema/ClassRegistry.test.js +99 -99
  555. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  556. package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
  557. package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
  558. package/lib/esm/test/schema/IModelSchemaContext.test.js +9 -9
  559. package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
  560. package/lib/esm/test/schema/SchemaImportCallbacks.test.js +19 -19
  561. package/lib/esm/test/schema/SchemaImportCallbacks.test.js.map +1 -1
  562. package/lib/esm/test/schema/SchemaViewFragmentLoading.test.js +21 -21
  563. package/lib/esm/test/schema/SchemaViewFragmentLoading.test.js.map +1 -1
  564. package/lib/esm/test/schema/SchemaViewHidden.test.js +109 -109
  565. package/lib/esm/test/schema/SchemaViewHidden.test.js.map +1 -1
  566. package/lib/esm/test/schema/SchemaViewKoQ.test.js +13 -13
  567. package/lib/esm/test/schema/SchemaViewKoQ.test.js.map +1 -1
  568. package/lib/esm/test/schema/SchemaViewLifecycle.test.js +15 -15
  569. package/lib/esm/test/schema/SchemaViewLifecycle.test.js.map +1 -1
  570. package/lib/esm/test/schema/SchemaViewValidation.test.js +8 -8
  571. package/lib/esm/test/schema/SchemaViewValidation.test.js.map +1 -1
  572. package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
  573. package/lib/esm/test/standalone/ChangeElementParentModel.test.js.map +1 -1
  574. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  575. package/lib/esm/test/standalone/ChangesetReader.test.js +321 -339
  576. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  577. package/lib/esm/test/standalone/CloudSqlite.test.js +73 -0
  578. package/lib/esm/test/standalone/CloudSqlite.test.js.map +1 -1
  579. package/lib/esm/test/standalone/CustomViewState3dCreator.test.js.map +1 -1
  580. package/lib/esm/test/standalone/DeleteElements.test.js.map +1 -1
  581. package/lib/esm/test/standalone/DgnDomainMergeConflict.test.d.ts +2 -0
  582. package/lib/esm/test/standalone/DgnDomainMergeConflict.test.d.ts.map +1 -0
  583. package/lib/esm/test/standalone/DgnDomainMergeConflict.test.js +263 -0
  584. package/lib/esm/test/standalone/DgnDomainMergeConflict.test.js.map +1 -0
  585. package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
  586. package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
  587. package/lib/esm/test/standalone/EditTxn.test.js.map +1 -1
  588. package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
  589. package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
  590. package/lib/esm/test/standalone/ExportGraphics.test.js +14 -14
  591. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  592. package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
  593. package/lib/esm/test/standalone/GeometryStream.test.js +1 -3
  594. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  595. package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
  596. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -1
  597. package/lib/esm/test/standalone/IModelWrite.test.d.ts.map +1 -1
  598. package/lib/esm/test/standalone/IModelWrite.test.js +105 -28
  599. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  600. package/lib/esm/test/standalone/ITwinWorkspace.test.js.map +1 -1
  601. package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
  602. package/lib/esm/test/standalone/IntegrityCheck.test.js +29 -10
  603. package/lib/esm/test/standalone/IntegrityCheck.test.js.map +1 -1
  604. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  605. package/lib/esm/test/standalone/NativeAppStorage.test.js.map +1 -1
  606. package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
  607. package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
  608. package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
  609. package/lib/esm/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.js +158 -135
  610. package/lib/esm/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.js.map +1 -1
  611. package/lib/esm/test/standalone/SchemaSyncDb.test.d.ts +2 -0
  612. package/lib/esm/test/standalone/SchemaSyncDb.test.d.ts.map +1 -0
  613. package/lib/esm/test/standalone/SchemaSyncDb.test.js +201 -0
  614. package/lib/esm/test/standalone/SchemaSyncDb.test.js.map +1 -0
  615. package/lib/esm/test/standalone/SchemaSyncElementReservation.test.d.ts +2 -0
  616. package/lib/esm/test/standalone/SchemaSyncElementReservation.test.d.ts.map +1 -0
  617. package/lib/esm/test/standalone/SchemaSyncElementReservation.test.js +460 -0
  618. package/lib/esm/test/standalone/SchemaSyncElementReservation.test.js.map +1 -0
  619. package/lib/esm/test/standalone/SchemaUtils.test.js.map +1 -1
  620. package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
  621. package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
  622. package/lib/esm/test/standalone/Setting.test.js.map +1 -1
  623. package/lib/esm/test/standalone/Settings.test.js.map +1 -1
  624. package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
  625. package/lib/esm/test/standalone/SnapshotDb.test.js +1 -0
  626. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  627. package/lib/esm/test/standalone/StandaloneDb.test.js +20 -20
  628. package/lib/esm/test/standalone/StandaloneDb.test.js.map +1 -1
  629. package/lib/esm/test/standalone/Texture.test.js.map +1 -1
  630. package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
  631. package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
  632. package/lib/esm/test/standalone/TxnManager.test.js +108 -8
  633. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  634. package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
  635. package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -1
  636. package/lib/esm/test/standalone/Workspace.test.js +52 -0
  637. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  638. package/lib/esm/test/standalone/iModelDb.test.js.map +1 -1
  639. package/lib/esm/test/workspace/SettingsDb.test.js.map +1 -1
  640. package/lib/esm/workspace/Settings.js.map +1 -1
  641. package/lib/esm/workspace/SettingsDb.js.map +1 -1
  642. package/lib/esm/workspace/SettingsEditor.js.map +1 -1
  643. package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
  644. package/lib/esm/workspace/Workspace.js.map +1 -1
  645. package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
  646. package/package.json +19 -23
  647. package/lib/esm/test/RevisionUtility.d.ts +0 -33
  648. package/lib/esm/test/RevisionUtility.d.ts.map +0 -1
  649. package/lib/esm/test/RevisionUtility.js +0 -52
  650. package/lib/esm/test/RevisionUtility.js.map +0 -1
  651. package/lib/esm/test/imodel/IModel.test.d.ts +0 -2
  652. package/lib/esm/test/imodel/IModel.test.d.ts.map +0 -1
  653. package/lib/esm/test/imodel/IModel.test.js +0 -3279
  654. package/lib/esm/test/imodel/IModel.test.js.map +0 -1
@@ -48,7 +48,9 @@ const WorkspaceImpl_1 = require("./internal/workspace/WorkspaceImpl");
48
48
  const SettingsImpl_1 = require("./internal/workspace/SettingsImpl");
49
49
  const NativePlatform_1 = require("./internal/NativePlatform");
50
50
  const NoLocks_1 = require("./internal/NoLocks");
51
+ const NoReservations_1 = require("./internal/NoReservations");
51
52
  const IModelDbFontsImpl_1 = require("./internal/IModelDbFontsImpl");
53
+ const SchemaSyncReservations_1 = require("./internal/SchemaSyncReservations");
52
54
  const Symbols_1 = require("./internal/Symbols");
53
55
  const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
54
56
  const Schema_1 = require("./Schema");
@@ -178,6 +180,8 @@ class IModelDb extends core_common_1.IModel {
178
180
  /** @internal */
179
181
  _locks = (0, NoLocks_1.createNoOpLockControl)();
180
182
  /** @internal */
183
+ _reservations = (0, NoReservations_1.createNoOpReservations)();
184
+ /** @internal */
181
185
  _codeService;
182
186
  /**
183
187
  * The always-available implicit transaction for this iModel.
@@ -188,12 +192,16 @@ class IModelDb extends core_common_1.IModel {
188
192
  [Symbols_1._implicitTxn];
189
193
  /** @internal */
190
194
  [Symbols_1._activeTxn];
191
- /** Returns the active [[EditTxn]] if one is current, otherwise the implicit transaction.
192
- * Use this inside element and relationship callbacks that may be invoked either during an explicit transaction or
193
- * during indirect change processing.
194
- * @note This method is a temporary workaround until [[OnElementArg]] (and related callback arg types) are updated
195
- * to carry the transaction directly in a future PR.
196
- * @internal
195
+ /** Returns the transaction to use for additional edits from an element, model, or aspect callback.
196
+ * In callbacks whose arguments provide an [[IModelDb]] but no transaction, obtain this transaction through
197
+ * `arg.iModel.getIndirectTxn()` and pass it to APIs that accept an [[EditTxn]].
198
+ *
199
+ * If an explicit transaction is active, this returns that transaction. Otherwise, it returns the implicit transaction
200
+ * used by legacy write paths. Callbacks that receive an `indirectEditTxn` argument should use that transaction directly.
201
+ *
202
+ * @note The operation that invoked the callback owns the transaction. Callback implementations must not invoke transaction
203
+ * lifecycle methods such as [[EditTxn.start]], [[EditTxn.end]], [[EditTxn.saveChanges]], [[EditTxn.abandonChanges]], or [[EditTxn.onClose]].
204
+ * @beta
197
205
  */
198
206
  getIndirectTxn() {
199
207
  return this[Symbols_1._activeTxn] ?? this[Symbols_1._implicitTxn];
@@ -202,6 +210,16 @@ class IModelDb extends core_common_1.IModel {
202
210
  get codeService() { return this._codeService; }
203
211
  /** The [[LockControl]] that orchestrates [concurrent editing]($docs/learning/backend/ConcurrencyControl.md) of this iModel. */
204
212
  get locks() { return this._locks; } // eslint-disable-line @typescript-eslint/no-non-null-assertion
213
+ /** @beta The [[SynchronousChannel.Reservations]] that orchestrates [concurrent editing]($docs/learning/backend/ConcurrencyControl.md) of this iModel. */
214
+ get reservations() { return this._reservations; } // eslint-disable-line @typescript-eslint/no-non-null-assertion
215
+ /** @internal */
216
+ async initializeSharedElementReservations() {
217
+ this._reservations?.[Symbols_1._close]();
218
+ if (SchemaSync_1.SchemaSync.isEnabled(this))
219
+ this._reservations = await (0, SchemaSyncReservations_1.createSchemaSyncReservations)(this);
220
+ else
221
+ this._reservations = (0, NoReservations_1.createNoOpReservations)();
222
+ }
205
223
  /** Provides methods for interacting with [font-related information]($docs/learning/backend/Fonts.md) stored in this iModel.
206
224
  * @beta
207
225
  */
@@ -302,7 +320,9 @@ class IModelDb extends core_common_1.IModel {
302
320
  db[Symbols_1._nativeDb].abandonChanges();
303
321
  db.close();
304
322
  }
305
- catch { }
323
+ catch {
324
+ return;
325
+ }
306
326
  });
307
327
  });
308
328
  }
@@ -359,18 +379,29 @@ class IModelDb extends core_common_1.IModel {
359
379
  this.optimize();
360
380
  IModelDb._openDbs.delete(this._fileKey);
361
381
  this._workspace?.close();
382
+ this.views[Symbols_1._close]();
362
383
  this.locks[Symbols_1._close]();
363
384
  this._locks = undefined;
385
+ this.reservations[Symbols_1._close]();
386
+ this._reservations = undefined;
364
387
  this._codeService?.close();
365
388
  this._codeService = undefined;
366
389
  this[Symbols_1._nativeDb].closeFile();
367
390
  }
391
+ /**
392
+ * Save any unsaved schema changes in this iModel.
393
+ * @internal
394
+ */
368
395
  saveSchemaChanges(args) {
369
396
  if (!this[Symbols_1._nativeDb].hasUnsavedChanges())
370
397
  return;
371
398
  const saveArgs = typeof args === "string" ? { description: args } : args;
372
399
  saveArgs === undefined ? this[Symbols_1._nativeDb].saveChanges() : this[Symbols_1._nativeDb].saveChanges(JSON.stringify(saveArgs));
373
400
  }
401
+ /**
402
+ * Abandon any unsaved schema changes in this iModel.
403
+ * @internal
404
+ */
374
405
  abandonSchemaChanges() {
375
406
  if (!this[Symbols_1._nativeDb].hasUnsavedChanges())
376
407
  return;
@@ -917,7 +948,7 @@ class IModelDb extends core_common_1.IModel {
917
948
  async dropSchemas(schemaNames) {
918
949
  if (schemaNames.length === 0)
919
950
  return;
920
- if (this[Symbols_1._nativeDb].schemaSyncEnabled())
951
+ if (SchemaSync_1.SchemaSync.isEnabled(this))
921
952
  throw new core_common_1.IModelError(core_bentley_1.DbResult.BE_SQLITE_ERROR, "Cannot drop schemas when schema sync is enabled");
922
953
  if (this[Symbols_1._nativeDb].hasUnsavedChanges())
923
954
  throw new core_common_1.IModelError(core_bentley_1.ChangeSetStatus.HasUncommittedChanges, "Cannot drop schemas with unsaved changes");
@@ -1003,26 +1034,34 @@ class IModelDb extends core_common_1.IModel {
1003
1034
  this.cleanupSnapshot(context.resources);
1004
1035
  }
1005
1036
  }
1006
- /** Shared implementation for importing schemas from file or string. */
1007
- async importSchemasInternal(schemas, options, nativeImportOp) {
1008
- // BriefcaseDb-specific validation checks
1009
- if (this.isBriefcaseDb()) {
1010
- if (this.txns.rebaser.isRebasing) {
1011
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "Cannot import schemas while rebasing");
1012
- }
1013
- if (this.txns.isIndirectChanges) {
1014
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "Cannot import schemas while in an indirect change scope");
1015
- }
1016
- // Additional checks when semantic rebase is enabled
1017
- if (IModelHost_1.IModelHost.useSemanticRebase) {
1018
- if (this[Symbols_1._nativeDb].hasUnsavedChanges()) {
1019
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "Cannot import schemas with unsaved changes when useSemanticRebase flag is on");
1020
- }
1021
- if (this[Symbols_1._nativeDb].schemaSyncEnabled()) {
1022
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "Cannot import schemas when schema sync is enabled and also useSemanticRebase flag is on");
1023
- }
1037
+ /** Refuse a schema import this briefcase is in no state to run. Shared by [[importSchemas]] and
1038
+ * [[BriefcaseDb.upgradeSchemas]], which reach the native importer by different routes.
1039
+ * @internal
1040
+ */
1041
+ assertCanImportSchemas() {
1042
+ if (!this.isBriefcaseDb())
1043
+ return;
1044
+ if (this.txns.rebaser.isRebasing) {
1045
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "Cannot import schemas while rebasing");
1046
+ }
1047
+ if (this.txns.isIndirectChanges) {
1048
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "Cannot import schemas while in an indirect change scope");
1049
+ }
1050
+ // Additional checks when semantic rebase is enabled
1051
+ if (IModelHost_1.IModelHost.useSemanticRebase) {
1052
+ if (this[Symbols_1._nativeDb].hasUnsavedChanges()) {
1053
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "Cannot import schemas with unsaved changes when useSemanticRebase flag is on");
1054
+ }
1055
+ if (SchemaSync_1.SchemaSync.isEnabled(this)) {
1056
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "Cannot import schemas when schema sync is enabled and also useSemanticRebase flag is on");
1024
1057
  }
1025
1058
  }
1059
+ }
1060
+ /** Shared implementation for importing schemas from file or string.
1061
+ * @internal
1062
+ */
1063
+ async importSchemasInternal(schemas, options, nativeImportOp) {
1064
+ this.assertCanImportSchemas();
1026
1065
  if (options?.channelUpgrade) {
1027
1066
  const channelUpgrade = options.channelUpgrade;
1028
1067
  try {
@@ -1040,30 +1079,52 @@ class IModelDb extends core_common_1.IModel {
1040
1079
  if (options?.schemaImportCallbacks?.preSchemaImportCallback)
1041
1080
  preSchemaImportCallbackResult = await this.preSchemaImportCallback(options.schemaImportCallbacks, { iModel: this, data: options.data, schemaData: schemas });
1042
1081
  const maybeCustomNativeContext = options?.ecSchemaXmlContext?.nativeContext;
1043
- if (this[Symbols_1._nativeDb].schemaSyncEnabled()) {
1044
- await SchemaSync_1.SchemaSync.withLockedAccess(this, { openMode: core_bentley_1.OpenMode.Readonly, operationName: "schema sync" }, async (syncAccess) => {
1045
- const schemaSyncDbUri = syncAccess.getUri();
1046
- this.saveSchemaChanges();
1047
- try {
1048
- nativeImportOp(schemas, { schemaLockHeld: false, ecSchemaXmlContext: maybeCustomNativeContext, schemaSyncDbUri });
1049
- }
1050
- catch (outerErr) {
1051
- if (core_bentley_1.DbResult.BE_SQLITE_ERROR_DataTransformRequired === outerErr.errorNumber) {
1052
- this.abandonSchemaChanges();
1053
- if (this[Symbols_1._nativeDb].getITwinId() !== core_bentley_1.Guid.empty)
1054
- await this.acquireSchemaLock();
1055
- try {
1056
- nativeImportOp(schemas, { schemaLockHeld: true, ecSchemaXmlContext: maybeCustomNativeContext, schemaSyncDbUri });
1057
- }
1058
- catch (innerErr) {
1059
- throw new core_common_1.IModelError(innerErr.errorNumber, innerErr.message);
1060
- }
1082
+ if (SchemaSync_1.SchemaSync.isEnabled(this)) {
1083
+ // The shared lock lets concurrent updates through while blocking anyone taking the exclusive lock for an upgrade.
1084
+ if (this[Symbols_1._nativeDb].getITwinId() !== core_bentley_1.Guid.empty)
1085
+ await this.locks.acquireLocks({ shared: core_common_1.IModel.repositoryModelId });
1086
+ // The native import adopts rows from the attached SchemaSyncDb. Attach and detach commit
1087
+ // implicitly, so abandoning changes cannot undo the adoption. A later failure must roll the
1088
+ // briefcase back before those ec_ rows can be pushed.
1089
+ let txnBeforeAdopt;
1090
+ // Set once the caller's own work is committed. Getting a token or the container write lock happens
1091
+ // before that, and abandonSchemaChanges discards every unsaved change rather than only this import's,
1092
+ // so abandoning on a failure from that window would throw away work the import never touched.
1093
+ let callerChangesSaved = false;
1094
+ try {
1095
+ await SchemaSync_1.SchemaSync.withLockedAccess(this, { openMode: core_bentley_1.OpenMode.Readonly, operationName: "schema sync" }, async (syncAccess) => {
1096
+ const schemaSyncDbUri = syncAccess.getUri();
1097
+ this.saveSchemaChanges();
1098
+ callerChangesSaved = true;
1099
+ // After saveSchemaChanges, so rolling back cannot reach the caller's own work.
1100
+ if (this.isBriefcaseDb())
1101
+ txnBeforeAdopt = this.txns.getCurrentTxnId();
1102
+ try {
1103
+ nativeImportOp(schemas, { schemaLockHeld: false, ecSchemaXmlContext: maybeCustomNativeContext, schemaSyncDbUri });
1061
1104
  }
1062
- else {
1063
- throw new core_common_1.IModelError(outerErr.errorNumber, outerErr.message);
1105
+ catch (err) {
1106
+ if (SchemaSync_1.SchemaSync.requiresUpgrade(err))
1107
+ throw new core_common_1.IModelError(err.errorNumber, `${err.message} - this schema change needs the upgrade path. Use BriefcaseDb.upgradeSchemas, which takes the exclusive schema lock and pushes the result.`);
1108
+ throw new core_common_1.IModelError(err.errorNumber, err.message);
1064
1109
  }
1110
+ });
1111
+ }
1112
+ catch (err) {
1113
+ if (callerChangesSaved)
1114
+ this.abandonSchemaChanges();
1115
+ if (this.isBriefcaseDb() && undefined !== txnBeforeAdopt && this.txns.getCurrentTxnId() !== txnBeforeAdopt) {
1116
+ // Saving the adopt's txn started a new undo session, because schema changes are kept out of the
1117
+ // user's undo stack, so this reverses across that boundary. The changes themselves reverse like
1118
+ // any other - a rebase does it to every local txn on every pull. It does not reverse DDL: a table
1119
+ // or column the adopt created stays behind with no ec_ row describing it, which is the state a
1120
+ // briefcase already tolerates, and the next successful import finds the table up to date and
1121
+ // carries on. Cancel rather than reverse, so the rows cannot come back through undo either.
1122
+ const status = this[Symbols_1._nativeDb].cancelTo(txnBeforeAdopt, true);
1123
+ if (core_bentley_1.IModelStatus.Success !== status)
1124
+ core_bentley_1.Logger.logError(loggerCategory, `Failed to roll back the adopted schema rows after a failed import: ${core_bentley_1.IModelStatus[status] ?? status}`);
1065
1125
  }
1066
- });
1126
+ throw err;
1127
+ }
1067
1128
  }
1068
1129
  else {
1069
1130
  const nativeImportOptions = {
@@ -2173,7 +2234,7 @@ function processSchemaWriteStatus(status) {
2173
2234
  * @param props The data for the new model.
2174
2235
  * @returns The newly inserted model's Id.
2175
2236
  * @throws [[IModelError]] if insertion fails.
2176
- * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use EditTxn.insertModel instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2237
+ * @deprecated in 5.9.0 - might be removed in next major version. Use EditTxn.insertModel instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2177
2238
  */
2178
2239
  insertModel(props) {
2179
2240
  return this._iModel[Symbols_1._implicitTxn].insertModel(props);
@@ -2181,7 +2242,7 @@ function processSchemaWriteStatus(status) {
2181
2242
  /** Update an existing model.
2182
2243
  * @param props the properties of the model to change
2183
2244
  * @throws [[IModelError]] if update fails.
2184
- * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use EditTxn.updateModel instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2245
+ * @deprecated in 5.9.0 - might be removed in next major version. Use EditTxn.updateModel instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2185
2246
  */
2186
2247
  updateModel(props) {
2187
2248
  this._iModel[Symbols_1._implicitTxn].updateModel(props);
@@ -2193,7 +2254,7 @@ function processSchemaWriteStatus(status) {
2193
2254
  * Cached [Tile]($frontend)s are only invalidated after the geometry guid of the model changes.
2194
2255
  * @note This will throw IModelError with [IModelStatus.VersionTooOld]($core-bentley) if a version of the BisCore schema older than 1.0.11 is present in the iModel.
2195
2256
  * @throws [[IModelError]] if the update fails.
2196
- * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use EditTxn.updateGeometryGuid instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2257
+ * @deprecated in 5.9.0 - might be removed in next major version. Use EditTxn.updateGeometryGuid instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2197
2258
  * @see [[TxnManager.onModelGeometryChanged]] for the event emitted in response to such a change.
2198
2259
  */
2199
2260
  updateGeometryGuid(modelId) {
@@ -2202,7 +2263,7 @@ function processSchemaWriteStatus(status) {
2202
2263
  /** Delete one or more existing models.
2203
2264
  * @param ids The Ids of the models to be deleted
2204
2265
  * @throws [[IModelError]] if deletion fails.
2205
- * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use EditTxn.deleteModel instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2266
+ * @deprecated in 5.9.0 - might be removed in next major version. Use EditTxn.deleteModel instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2206
2267
  */
2207
2268
  deleteModel(ids) {
2208
2269
  this._iModel[Symbols_1._implicitTxn].deleteModel(ids);
@@ -2426,7 +2487,7 @@ function processSchemaWriteStatus(status) {
2426
2487
  * However when `elProps.federationGuid` is not present or undefined, a new Guid will be generated and stored on the resultant element. But
2427
2488
  * the value of `elProps.federationGuid` is *not* updated. Generally, it is best to re-read the element after inserting (e.g. via [[getElementProps]])
2428
2489
  * if you intend to continue working with it. That will ensure its values reflect the persistent state.
2429
- * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use EditTxn.insertElement instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2490
+ * @deprecated in 5.9.0 - might be removed in next major version. Use EditTxn.insertElement instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2430
2491
  */
2431
2492
  insertElement(elProps, options) {
2432
2493
  return this._iModel[Symbols_1._implicitTxn].insertElement(elProps, options);
@@ -2441,7 +2502,7 @@ function processSchemaWriteStatus(status) {
2441
2502
  * @note The values of `classFullName` and `model` *may not be changed* by this method. Further, it will permute the `elProps` object by adding or
2442
2503
  * overwriting their values to the correct values.
2443
2504
  * @throws [[ITwinError]] if update fails.
2444
- * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use EditTxn.updateElement instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2505
+ * @deprecated in 5.9.0 - might be removed in next major version. Use EditTxn.updateElement instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2445
2506
  */
2446
2507
  updateElement(elProps) {
2447
2508
  this._iModel[Symbols_1._implicitTxn].updateElement(elProps);
@@ -2450,7 +2511,7 @@ function processSchemaWriteStatus(status) {
2450
2511
  * @param ids The set of Ids of the element(s) to be deleted
2451
2512
  * @throws [[ITwinError]]
2452
2513
  * @see deleteDefinitionElements
2453
- * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use EditTxn.deleteElement instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2514
+ * @deprecated in 5.9.0 - might be removed in next major version. Use EditTxn.deleteElement instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2454
2515
  */
2455
2516
  deleteElement(ids) {
2456
2517
  this._iModel[Symbols_1._implicitTxn].deleteElement(ids);
@@ -2461,7 +2522,7 @@ function processSchemaWriteStatus(status) {
2461
2522
  * @param deleteOptions Options for the delete operation.
2462
2523
  * @returns A result object containing information about the deletion operation success and the element ids that failed to delete (if any).
2463
2524
  * @throws [[ITwinError]] if any of the supplied ids are not well-formed/valid [[Id64String]]s.
2464
- * @deprecated in 5.1.9 - will not be removed until after 2026-08-15. Use EditTxn.deleteElements instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2525
+ * @deprecated in 5.1.9 - might be removed in next major version. Use EditTxn.deleteElements instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2465
2526
  * @beta
2466
2527
  */
2467
2528
  deleteElements(ids, deleteOptions) {
@@ -2475,7 +2536,7 @@ function processSchemaWriteStatus(status) {
2475
2536
  * DefinitionElements rather than calling this method separately for each one. Ids that are not valid DefinitionElements will be ignored.
2476
2537
  * @returns An IdSet of the DefinitionElements that are used and were therefore not deleted.
2477
2538
  * @see deleteElement
2478
- * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use EditTxn.deleteDefinitionElements instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2539
+ * @deprecated in 5.9.0 - might be removed in next major version. Use EditTxn.deleteDefinitionElements instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2479
2540
  */
2480
2541
  deleteDefinitionElements(definitionElementIds) {
2481
2542
  return this._iModel[Symbols_1._implicitTxn].deleteDefinitionElements(definitionElementIds);
@@ -2578,21 +2639,27 @@ function processSchemaWriteStatus(status) {
2578
2639
  return this._queryAspect(aspectInstanceId, aspectClassFullName);
2579
2640
  }
2580
2641
  static classMap = new Map();
2642
+ getAspectPropsFromInstanceQuery(rawInstance) {
2643
+ const parsedRow = typeof rawInstance === "string" ? JSON.parse(rawInstance, core_common_1.Base64EncodedString.reviver) : rawInstance;
2644
+ if (!core_bentley_1.JsonUtils.isObject(parsedRow))
2645
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "Expected an ElementAspect instance query to return an object");
2646
+ const row = {};
2647
+ for (const [key, value] of Object.entries(parsedRow)) {
2648
+ const ecPropertyName = key.length === 0 ? key : key[0].toUpperCase() + key.substring(1);
2649
+ row[core_common_1.ECJsNames.toJsName(ecPropertyName)] = value;
2650
+ }
2651
+ const className = row.className;
2652
+ if (typeof className !== "string")
2653
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "Expected an ElementAspect instance query to return a className");
2654
+ row.classFullName = className.replace(".", ":"); // add in property required by EntityProps
2655
+ delete row.className; // clear property from SELECT $ that we don't want in the final instance
2656
+ return row;
2657
+ }
2581
2658
  runInstanceQuery(sql, elementId, excludedClassFullNames) {
2582
2659
  return this._iModel.withQueryReader(sql, (reader) => {
2583
2660
  const aspects = [];
2584
2661
  for (const queryRow of reader) {
2585
- const row = {};
2586
- const rawInstance = queryRow[0];
2587
- const parsedRow = typeof rawInstance === "string" ? JSON.parse(rawInstance) : rawInstance;
2588
- // eslint-disable-next-line guard-for-in
2589
- for (const key in parsedRow) {
2590
- const jsName = core_common_1.ECJsNames.toJsName(key[0].toUpperCase() + key.substring(1));
2591
- Object.defineProperty(row, jsName, { enumerable: true, configurable: true, writable: true, value: parsedRow[key] });
2592
- }
2593
- const aspectProps = row;
2594
- aspectProps.classFullName = aspectProps.className.replace(".", ":"); // add in property required by EntityProps
2595
- aspectProps.className = undefined; // clear property from SELECT $ that we don't want in the final instance
2662
+ const aspectProps = this.getAspectPropsFromInstanceQuery(queryRow[0]);
2596
2663
  if ((undefined === excludedClassFullNames) || !excludedClassFullNames.has(aspectProps.classFullName))
2597
2664
  aspects.push(this._iModel.constructEntity(aspectProps));
2598
2665
  }
@@ -2607,9 +2674,9 @@ function processSchemaWriteStatus(status) {
2607
2674
  */
2608
2675
  getAspects(elementId, aspectClassFullName, excludedClassFullNames) {
2609
2676
  if (aspectClassFullName === undefined) {
2610
- const allAspects = this.runInstanceQuery(`SELECT $ FROM (
2611
- SELECT ECInstanceId, ECClassId FROM Bis.ElementMultiAspect WHERE Element.Id = :elementId
2612
- UNION ALL
2677
+ const allAspects = this.runInstanceQuery(`SELECT $ FROM (
2678
+ SELECT ECInstanceId, ECClassId FROM Bis.ElementMultiAspect WHERE Element.Id = :elementId
2679
+ UNION ALL
2613
2680
  SELECT ECInstanceId, ECClassId FROM Bis.ElementUniqueAspect WHERE Element.Id = :elementId) OPTIONS USE_JS_PROP_NAMES DO_NOT_TRUNCATE_BLOB`, elementId, excludedClassFullNames);
2614
2681
  if (allAspects.length === 0)
2615
2682
  core_bentley_1.Logger.logInfo(BackendLoggerCategory_1.BackendLoggerCategory.ECDb, `No aspects found for class ${aspectClassFullName} and element ${elementId}`);
@@ -2628,7 +2695,7 @@ function processSchemaWriteStatus(status) {
2628
2695
  let classIdList = IModelDb.Elements.classMap.get(aspectClassFullName);
2629
2696
  if (classIdList === undefined) {
2630
2697
  const classIds = [];
2631
- const sql = `select SourceECInstanceId from meta.ClassHasAllBaseClasses where TargetECInstanceId = (select ECInstanceId from meta.ECClassDef where Name=:className
2698
+ const sql = `select SourceECInstanceId from meta.ClassHasAllBaseClasses where TargetECInstanceId = (select ECInstanceId from meta.ECClassDef where Name=:className
2632
2699
  and Schema.Id = (select ECInstanceId from meta.ECSchemaDef where Name=:schemaName)) and SourceECInstanceId != TargetECInstanceId`;
2633
2700
  this._iModel.withQueryReader(sql, (reader) => {
2634
2701
  for (const row of reader) {
@@ -2647,22 +2714,72 @@ function processSchemaWriteStatus(status) {
2647
2714
  return [];
2648
2715
  }
2649
2716
  // Execute an instance query to retrieve all aspects from all the derived classes
2650
- const aspects = this.runInstanceQuery(`SELECT $ FROM (
2651
- SELECT ECInstanceId, ECClassId FROM Bis.ElementMultiAspect WHERE Element.Id = :elementId AND ECClassId IN (${classIdList})
2652
- UNION ALL
2653
- SELECT ECInstanceId, ECClassId FROM Bis.ElementUniqueAspect WHERE Element.Id = :elementId AND ECClassId IN (${classIdList})
2717
+ const aspects = this.runInstanceQuery(`SELECT $ FROM (
2718
+ SELECT ECInstanceId, ECClassId FROM Bis.ElementMultiAspect WHERE Element.Id = :elementId AND ECClassId IN (${classIdList})
2719
+ UNION ALL
2720
+ SELECT ECInstanceId, ECClassId FROM Bis.ElementUniqueAspect WHERE Element.Id = :elementId AND ECClassId IN (${classIdList})
2654
2721
  ) OPTIONS USE_JS_PROP_NAMES DO_NOT_TRUNCATE_BLOB`, elementId, excludedClassFullNames);
2655
2722
  if (aspects.length === 0)
2656
2723
  core_bentley_1.Logger.logInfo(BackendLoggerCategory_1.BackendLoggerCategory.ECDb, `No aspects found for class ${aspectClassFullName} and element ${elementId}`);
2657
2724
  return aspects;
2658
2725
  }
2726
+ /** Stream the [[ElementAspect]] instances owned by a set of elements.
2727
+ *
2728
+ * Use this method instead of calling [[getAspects]] repeatedly when reading aspects for multiple elements or when the result may be large. The query reads all requested owners together and yields each aspect without buffering the complete result set. For a single element with a small result, [[getAspects]] provides a simpler synchronous API.
2729
+ *
2730
+ * The order is unspecified unless [[QueryAspectOptions.groupByOwner]] is true.
2731
+ * @param options Defines the element Ids, class filters, result ordering, and query connection.
2732
+ * @returns An async iterator over the matching aspects.
2733
+ * @beta
2734
+ */
2735
+ async *queryAspects(options) {
2736
+ const elementIds = core_bentley_1.Id64.toIdSet(options.elementIds);
2737
+ if (elementIds.size === 0)
2738
+ return;
2739
+ const params = new core_common_1.QueryBinder().bindIdSet("elementIds", elementIds);
2740
+ const classFilter = options.aspectClassFullName === undefined ? "" : `AND aspect.ECClassId IN (
2741
+ SELECT SourceECInstanceId FROM meta.ClassHasAllBaseClasses
2742
+ WHERE TargetECInstanceId=ec_classid(:aspectClassFullName)
2743
+ )`;
2744
+ if (options.aspectClassFullName !== undefined)
2745
+ params.bindString("aspectClassFullName", options.aspectClassFullName.replace(".", ":"));
2746
+ const excludedClassIds = [];
2747
+ let excludedClassIndex = 0;
2748
+ for (const classFullName of options.excludedAspectClassFullNames ?? []) {
2749
+ const parameterName = `excludedAspectClass${excludedClassIndex++}`;
2750
+ excludedClassIds.push(`ec_classid(:${parameterName})`);
2751
+ params.bindString(parameterName, classFullName.replace(".", ":"));
2752
+ }
2753
+ const excludedClassFilter = excludedClassIds.length === 0 ? "" : `AND aspect.ECClassId NOT IN (
2754
+ SELECT ECInstanceId FROM meta.ECClassDef WHERE ECInstanceId IN (${excludedClassIds.join(",")})
2755
+ )`;
2756
+ const orderBy = options.groupByOwner
2757
+ ? "ORDER BY OwnerId, AspectKind, ECClassId, ECInstanceId"
2758
+ : "";
2759
+ const sql = `WITH OwnerIds AS (SELECT id FROM IdSet(:elementIds))
2760
+ SELECT $ FROM (
2761
+ SELECT aspect.ECInstanceId, aspect.ECClassId, aspect.Element.Id AS OwnerId, 0 AS AspectKind
2762
+ FROM OwnerIds owners
2763
+ CROSS JOIN Bis.ElementMultiAspect aspect ON aspect.Element.Id=owners.id
2764
+ WHERE TRUE ${classFilter} ${excludedClassFilter}
2765
+ UNION ALL
2766
+ SELECT aspect.ECInstanceId, aspect.ECClassId, aspect.Element.Id AS OwnerId, 1 AS AspectKind
2767
+ FROM OwnerIds owners
2768
+ CROSS JOIN Bis.ElementUniqueAspect aspect ON aspect.Element.Id=owners.id
2769
+ WHERE TRUE ${classFilter} ${excludedClassFilter}
2770
+ ) ${orderBy}
2771
+ OPTIONS USE_JS_PROP_NAMES DO_NOT_TRUNCATE_BLOB`;
2772
+ const reader = this._iModel.createQueryReader(sql, params, { usePrimaryConn: options.usePrimaryConn });
2773
+ for await (const queryRow of reader)
2774
+ yield this._iModel.constructEntity(this.getAspectPropsFromInstanceQuery(queryRow[0]));
2775
+ }
2659
2776
  /** Insert a new ElementAspect into the iModel.
2660
2777
  * @param aspectProps The properties of the new ElementAspect.
2661
2778
  * @throws [[IModelError]] if unable to insert the ElementAspect.
2662
2779
  * @returns the id of the newly inserted aspect.
2663
2780
  * @note Aspect Ids may collide with element Ids, so don't put both in a container like Set or Map
2664
2781
  * use [EntityReference]($common) for that instead.
2665
- * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use EditTxn.insertAspect instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2782
+ * @deprecated in 5.9.0 - might be removed in next major version. Use EditTxn.insertAspect instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2666
2783
  */
2667
2784
  insertAspect(aspectProps) {
2668
2785
  return this._iModel[Symbols_1._implicitTxn].insertAspect(aspectProps);
@@ -2670,7 +2787,7 @@ function processSchemaWriteStatus(status) {
2670
2787
  /** Update an exist ElementAspect within the iModel.
2671
2788
  * @param aspectProps The properties to use to update the ElementAspect.
2672
2789
  * @throws [[IModelError]] if unable to update the ElementAspect.
2673
- * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use EditTxn.updateAspect instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2790
+ * @deprecated in 5.9.0 - might be removed in next major version. Use EditTxn.updateAspect instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2674
2791
  */
2675
2792
  updateAspect(aspectProps) {
2676
2793
  this._iModel[Symbols_1._implicitTxn].updateAspect(aspectProps);
@@ -2678,7 +2795,7 @@ function processSchemaWriteStatus(status) {
2678
2795
  /** Delete one or more ElementAspects from this iModel.
2679
2796
  * @param aspectInstanceIds The set of instance Ids of the ElementAspect(s) to be deleted
2680
2797
  * @throws [[IModelError]] if unable to delete the ElementAspect.
2681
- * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use EditTxn.deleteAspect instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2798
+ * @deprecated in 5.9.0 - might be removed in next major version. Use EditTxn.deleteAspect instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2682
2799
  */
2683
2800
  deleteAspect(aspectInstanceIds) {
2684
2801
  this._iModel[Symbols_1._implicitTxn].deleteAspect(aspectInstanceIds);
@@ -2687,7 +2804,7 @@ function processSchemaWriteStatus(status) {
2687
2804
  * @param props The properties specifying the element to reparent and its new parent.
2688
2805
  * @throws [[ITwinError]] if the operation fails.
2689
2806
  * @beta
2690
- * @deprecated in 5.11.0 - will not be removed until after 2026-08-04. Use EditTxn.changeElementParent instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2807
+ * @deprecated in 5.11.0 - might be removed in next major version. Use EditTxn.changeElementParent instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2691
2808
  */
2692
2809
  changeElementParent(props) {
2693
2810
  this._iModel[Symbols_1._implicitTxn].changeElementParent(props);
@@ -2696,7 +2813,7 @@ function processSchemaWriteStatus(status) {
2696
2813
  * @param props The properties specifying the element to move and its new model.
2697
2814
  * @throws [[ITwinError]] if the operation fails.
2698
2815
  * @beta
2699
- * @deprecated in 5.11.0 - will not be removed until after 2026-08-04. Use EditTxn.changeElementModel instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2816
+ * @deprecated in 5.11.0 - might be removed in next major version. Use EditTxn.changeElementModel instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2700
2817
  */
2701
2818
  changeElementModel(props) {
2702
2819
  this._iModel[Symbols_1._implicitTxn].changeElementModel(props);
@@ -2715,15 +2832,27 @@ function processSchemaWriteStatus(status) {
2715
2832
  static viewStoreProperty = { namespace: "itwinjs", name: "DefaultViewStore" };
2716
2833
  _viewStore;
2717
2834
  get hasViewStore() { return undefined !== this._viewStore; }
2718
- /** @beta */
2835
+ /** The [[ViewStore.CloudAccess]] for this iModel.
2836
+ * @note The iModel owns its ViewStore (whether assigned via this setter or created by [[accessViewStore]]): it is closed when the iModel is closed.
2837
+ * @beta
2838
+ */
2719
2839
  get viewStore() {
2720
2840
  if (undefined === this._viewStore)
2721
2841
  throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "No ViewStore available");
2722
2842
  return this._viewStore;
2723
2843
  }
2724
2844
  set viewStore(viewStore) {
2845
+ if (this._viewStore !== undefined && this._viewStore !== viewStore)
2846
+ this._viewStore.close();
2725
2847
  this._viewStore = viewStore;
2726
2848
  }
2849
+ /** Close the ViewStore for this iModel, if one is open. Called when the iModel is closed.
2850
+ * @internal
2851
+ */
2852
+ [Symbols_1._close]() {
2853
+ this._viewStore?.close();
2854
+ this._viewStore = undefined;
2855
+ }
2727
2856
  /** @beta */
2728
2857
  async accessViewStore(args) {
2729
2858
  let props = args.props;
@@ -2743,7 +2872,7 @@ function processSchemaWriteStatus(status) {
2743
2872
  return this._viewStore;
2744
2873
  }
2745
2874
  /**
2746
- * @beta @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use EditTxn.saveDefaultViewStore instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2875
+ * @beta @deprecated in 5.9.0 - might be removed in next major version. Use EditTxn.saveDefaultViewStore instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
2747
2876
  */
2748
2877
  saveDefaultViewStore(arg) {
2749
2878
  this._iModel[Symbols_1._implicitTxn].saveDefaultViewStore(arg);
@@ -2761,7 +2890,9 @@ function processSchemaWriteStatus(status) {
2761
2890
  try {
2762
2891
  props.push(imodel.elements.getElementProps(id));
2763
2892
  }
2764
- catch { }
2893
+ catch {
2894
+ return;
2895
+ }
2765
2896
  });
2766
2897
  return props;
2767
2898
  }
@@ -2784,7 +2915,9 @@ function processSchemaWriteStatus(status) {
2784
2915
  break;
2785
2916
  }
2786
2917
  }
2787
- catch { }
2918
+ catch {
2919
+ continue;
2920
+ }
2788
2921
  }
2789
2922
  return finished;
2790
2923
  }
@@ -2994,9 +3127,6 @@ class BriefcaseDb extends IModelDb {
2994
3127
  get isBriefcase() { return true; }
2995
3128
  /* the BriefcaseId of the briefcase opened with this BriefcaseDb */
2996
3129
  briefcaseId;
2997
- _skipSyncSchemasOnPullAndPush;
2998
- /** @internal */
2999
- get skipSyncSchemasOnPullAndPush() { return this._skipSyncSchemasOnPullAndPush ?? false; }
3000
3130
  /**
3001
3131
  * Event raised just before a BriefcaseDb is opened. Supplies the arguments that will be used to open the BriefcaseDb.
3002
3132
  * Throw an exception to stop the open.
@@ -3079,6 +3209,8 @@ class BriefcaseDb extends IModelDb {
3079
3209
  }
3080
3210
  constructor(args) {
3081
3211
  super({ ...args, changeset: args.nativeDb.getCurrentChangeset() });
3212
+ // Native invokes this private callback dynamically through the object registered by IModelDb.
3213
+ void this.onChangesetConflict;
3082
3214
  this._openMode = args.openMode;
3083
3215
  this.briefcaseId = args.briefcaseId;
3084
3216
  this.makeLockControl();
@@ -3091,26 +3223,33 @@ class BriefcaseDb extends IModelDb {
3091
3223
  wasChanges = nativeDb.hasPendingTxns();
3092
3224
  nativeDb.closeFile();
3093
3225
  };
3094
- const isSchemaSyncEnabled = await withBriefcaseDb(briefcase, async (db) => {
3095
- await SchemaSync_1.SchemaSync.pull(db);
3096
- return db[Symbols_1._nativeDb].schemaSyncEnabled();
3097
- });
3098
- if (isSchemaSyncEnabled) {
3226
+ const push = async () => {
3227
+ if (wasChanges)
3228
+ await withBriefcaseDb(briefcase, async (db) => db.pushChanges({ ...briefcase, description, retainLocks: true }));
3229
+ };
3230
+ // Asked of the closed file, so an iModel without schema sync never gets opened for this.
3231
+ if (SchemaSync_1.SchemaSync.isEnabled(briefcase)) {
3232
+ await withBriefcaseDb(briefcase, async (db) => SchemaSync_1.SchemaSync.updateDbSchema(db));
3099
3233
  await SchemaSync_1.SchemaSync.withLockedAccess(briefcase, { openMode: core_bentley_1.OpenMode.Readonly, operationName: "schema sync" }, async (syncAccess) => {
3100
3234
  const schemaSyncDbUri = syncAccess.getUri();
3101
3235
  executeUpgrade();
3236
+ // Overwriting advances the SchemaSync data version, so a no-op upgrade must not call it.
3237
+ if (!wasChanges)
3238
+ return;
3102
3239
  await withBriefcaseDb(briefcase, async (db) => {
3103
- db[Symbols_1._nativeDb].schemaSyncPush(schemaSyncDbUri);
3240
+ db[Symbols_1._nativeDb].schemaSyncOverwrite(schemaSyncDbUri);
3104
3241
  db[Symbols_1._nativeDb].saveChanges();
3105
3242
  });
3106
- syncAccess.synchronizeWithCloud();
3243
+ // Publish the sync db before the changeset while retaining both locks.
3244
+ syncAccess.closeDb();
3245
+ await syncAccess.container.uploadChanges();
3246
+ await push();
3107
3247
  });
3108
3248
  }
3109
3249
  else {
3110
3250
  executeUpgrade();
3251
+ await push();
3111
3252
  }
3112
- if (wasChanges)
3113
- await withBriefcaseDb(briefcase, async (db) => db.pushChanges({ ...briefcase, description, retainLocks: true }));
3114
3253
  }
3115
3254
  /** Upgrades the schemas in the iModel based on the current version of the software. Follows a sequence of operations -
3116
3255
  * * Acquires a schema lock to prevent other users from making any other changes while upgrade is happening
@@ -3130,6 +3269,22 @@ class BriefcaseDb extends IModelDb {
3130
3269
  // - push changes
3131
3270
  // - release schema lock
3132
3271
  // good thing computers are fast. Fortunately upgrading should be rare (and the push time will dominate anyway.) Don't try to optimize any of this away.
3272
+ // schemaSyncOverwrite can discard unpushed imports, so hold the exclusive lock across both upgrades.
3273
+ if (SchemaSync_1.SchemaSync.isEnabled(briefcase)) {
3274
+ try {
3275
+ await withBriefcaseDb(briefcase, async (db) => {
3276
+ if (!db.locks.isServerBased)
3277
+ throw new core_common_1.IModelError(core_bentley_1.DbResult.BE_SQLITE_ERROR, "Cannot upgrade schemas with SchemaSync without server-based locking");
3278
+ await db.acquireSchemaLock();
3279
+ });
3280
+ await this.doUpgrade(briefcase, { profile: core_common_1.ProfileOptions.Upgrade, schemaLockHeld: true }, "Upgraded profile");
3281
+ await this.doUpgrade(briefcase, { domain: core_common_1.DomainOptions.Upgrade, schemaLockHeld: true }, "Upgraded domain schemas");
3282
+ }
3283
+ finally {
3284
+ await withBriefcaseDb(briefcase, async (db) => db.locks[Symbols_1._releaseAllLocks]());
3285
+ }
3286
+ return;
3287
+ }
3133
3288
  try {
3134
3289
  await this.doUpgrade(briefcase, { profile: core_common_1.ProfileOptions.Upgrade }, "Upgraded profile");
3135
3290
  }
@@ -3194,6 +3349,7 @@ class BriefcaseDb extends IModelDb {
3194
3349
  }
3195
3350
  // load all of the settings from workspaces
3196
3351
  await briefcaseDb.loadWorkspaceSettings();
3352
+ await briefcaseDb.initializeSharedElementReservations();
3197
3353
  if (openMode === core_bentley_1.OpenMode.ReadWrite && CodeService_1.CodeService.createForIModel) {
3198
3354
  try {
3199
3355
  briefcaseDb._codeService = await CodeService_1.CodeService.createForIModel(briefcaseDb);
@@ -3249,6 +3405,18 @@ class BriefcaseDb extends IModelDb {
3249
3405
  return "foreign key";
3250
3406
  }
3251
3407
  };
3408
+ // `dgn_Domain` holds one bookkeeping row per BIS domain present in the briefcase. The row is
3409
+ // created automatically as soon as the domain's schema is imported, so merging a changeset
3410
+ // that registers a domain inserts a row that was just created locally. Both rows describe the
3411
+ // same domain and the incoming one is authoritative, so this duplicate insert is never fatal.
3412
+ // Only a primary key collision on an insert is benign - an update or delete whose "before"
3413
+ // values do not match (`DbConflictCause.Data`) describes a real divergence and must not be
3414
+ // silently discarded here.
3415
+ if (args.tableName === "dgn_Domain" && args.cause === core_bentley_1.DbConflictCause.Conflict && args.opcode === core_bentley_1.DbOpcode.Insert) {
3416
+ core_bentley_1.Logger.logWarning(category, `${interpretConflictCause(args.cause)} conflict on dgn_Domain - resolved by replacing the existing row with the incoming row`);
3417
+ args.dump();
3418
+ return core_bentley_1.DbConflictResolution.Replace;
3419
+ }
3252
3420
  if (args.cause === core_bentley_1.DbConflictCause.Data && !args.indirect) {
3253
3421
  /*
3254
3422
  * From SQLite Docs CHANGESET_DATA as the second argument
@@ -3417,10 +3585,12 @@ class BriefcaseDb extends IModelDb {
3417
3585
  async pullChanges(arg) {
3418
3586
  await this.executeWritable(async () => {
3419
3587
  await BriefcaseManager_1.BriefcaseManager.pullAndApplyChangesets(this, arg ?? {});
3420
- if (!this.skipSyncSchemasOnPullAndPush)
3421
- await SchemaSync_1.SchemaSync.pull(this);
3588
+ SchemaSync_1.SchemaSync.updateDbSchema(this);
3422
3589
  this.initializeIModelDb("pullMerge");
3423
3590
  });
3591
+ // If this pull enabled or disabled SchemaSync for this briefcase, its reservations must now be re-initialized
3592
+ if (this.reservations.isServerBased !== SchemaSync_1.SchemaSync.isEnabled(this))
3593
+ await this.initializeSharedElementReservations();
3424
3594
  this.txns._onChangesPulled(this.changeset);
3425
3595
  }
3426
3596
  async enableChangesetStatTracking() {
@@ -3500,24 +3670,10 @@ class BriefcaseDb extends IModelDb {
3500
3670
  if (nativeDb.hasPendingTxns()) {
3501
3671
  throw new core_common_1.IModelError(core_bentley_1.ChangeSetStatus.HasLocalChanges, "Cannot revert with pending txns");
3502
3672
  }
3503
- const skipSchemaSyncPull = async (func) => {
3504
- if (nativeDb.schemaSyncEnabled()) {
3505
- this._skipSyncSchemasOnPullAndPush = true;
3506
- try {
3507
- return await func();
3508
- }
3509
- finally {
3510
- this._skipSyncSchemasOnPullAndPush = undefined;
3511
- }
3512
- }
3513
- else {
3514
- return func();
3515
- }
3516
- };
3517
3673
  this.clearCaches();
3518
- await skipSchemaSyncPull(async () => this.pullChanges({ ...arg, toIndex: undefined }));
3674
+ await this.pullChanges({ ...arg, toIndex: undefined });
3519
3675
  await this.acquireSchemaLock();
3520
- if (nativeDb.schemaSyncEnabled()) {
3676
+ if (SchemaSync_1.SchemaSync.isEnabled(this)) {
3521
3677
  arg.skipSchemaChanges = true;
3522
3678
  }
3523
3679
  // The native side enables file-based txns during revert. Restore the original setting afterward.
@@ -3538,7 +3694,7 @@ class BriefcaseDb extends IModelDb {
3538
3694
  pushRetryDelay: arg.pushRetryDelay,
3539
3695
  retainLocks: arg.retainLocks,
3540
3696
  };
3541
- await skipSchemaSyncPull(async () => this.pushChanges(pushArgs));
3697
+ await this.pushChanges(pushArgs);
3542
3698
  this.clearCaches();
3543
3699
  }
3544
3700
  catch (err) {
@@ -3609,9 +3765,62 @@ class BriefcaseDb extends IModelDb {
3609
3765
  await BriefcaseManager_1.BriefcaseManager.pullMergePush(this, arg);
3610
3766
  this.initializeIModelDb("pullMerge");
3611
3767
  });
3768
+ // If this pull enabled or disabled SchemaSync for this briefcase, its reservations must now be re-initialized
3769
+ if (this.reservations.isServerBased !== SchemaSync_1.SchemaSync.isEnabled(this))
3770
+ await this.initializeSharedElementReservations();
3612
3771
  this.txns._onChangesPushed(this.changeset);
3613
3772
  BriefcaseManager_1.BriefcaseManager.deleteRebaseFolders(this);
3614
3773
  }
3774
+ /** Import schemas while allowing changes that move or delete data.
3775
+ *
3776
+ * Takes the exclusive schema lock, requires the briefcase to be at the timeline tip, imports, updates the sync db, and pushes the result.
3777
+ * @note The briefcase must have no local changes.
3778
+ * @see [[BriefcaseDb.upgradeSchemas]] (static) for upgrading the software's profile and domain schemas.
3779
+ * @alpha
3780
+ */
3781
+ async upgradeSchemas(schemaFileNames, arg) {
3782
+ return this.upgradeSchemasInternal(schemaFileNames, arg, (schemas, importOptions) => this[Symbols_1._nativeDb].importSchemas(schemas, importOptions));
3783
+ }
3784
+ /** The [[importSchemaStrings]] counterpart of [[upgradeSchemas]].
3785
+ * @alpha
3786
+ */
3787
+ async upgradeSchemaStrings(serializedXmlSchemas, arg) {
3788
+ return this.upgradeSchemasInternal(serializedXmlSchemas, arg, (schemas, importOptions) => this[Symbols_1._nativeDb].importXmlSchemas(schemas, importOptions));
3789
+ }
3790
+ async upgradeSchemasInternal(schemas, arg, nativeImportOp) {
3791
+ if (schemas.length === 0)
3792
+ return;
3793
+ this.assertCanImportSchemas();
3794
+ if (this[Symbols_1._nativeDb].hasUnsavedChanges() || this.txns.hasLocalChanges)
3795
+ throw new core_common_1.IModelError(core_bentley_1.ChangeSetStatus.HasLocalChanges, "Cannot upgrade schemas while there are local changes");
3796
+ if (SchemaSync_1.SchemaSync.isEnabled(this) && !this.locks.isServerBased)
3797
+ throw new core_common_1.IModelError(core_bentley_1.DbResult.BE_SQLITE_ERROR, "Cannot upgrade schemas with SchemaSync without server-based locking");
3798
+ await this.acquireSchemaLock();
3799
+ await this.pullChanges({ accessToken: arg.accessToken });
3800
+ if (!SchemaSync_1.SchemaSync.isEnabled(this)) {
3801
+ await this.importSchemasInternal(schemas, { ecSchemaXmlContext: arg.ecSchemaXmlContext }, nativeImportOp);
3802
+ await this.pushChanges(arg);
3803
+ return;
3804
+ }
3805
+ await SchemaSync_1.SchemaSync.withLockedAccess(this, { openMode: core_bentley_1.OpenMode.Readonly, operationName: "schema upgrade" }, async (syncAccess) => {
3806
+ this.saveSchemaChanges();
3807
+ try {
3808
+ nativeImportOp(schemas, {
3809
+ schemaLockHeld: true,
3810
+ ecSchemaXmlContext: arg.ecSchemaXmlContext?.nativeContext,
3811
+ schemaSyncDbUri: syncAccess.getUri(),
3812
+ });
3813
+ }
3814
+ catch (err) {
3815
+ this.abandonSchemaChanges();
3816
+ throw new core_common_1.IModelError(err.errorNumber, err.message);
3817
+ }
3818
+ this.clearCaches();
3819
+ syncAccess.closeDb();
3820
+ await syncAccess.container.uploadChanges();
3821
+ await this.pushChanges(arg);
3822
+ });
3823
+ }
3615
3824
  close(options) {
3616
3825
  if (this.isBriefcase && this.isOpen && !this.isReadonly && this.txns.rebaser.inProgress()) {
3617
3826
  this[Symbols_1._nativeDb].abandonChanges();
@@ -3784,6 +3993,7 @@ class SnapshotDb extends IModelDb {
3784
3993
  const key = CheckpointManager_1.CheckpointManager.getKey(checkpoint);
3785
3994
  const db = SnapshotDb.openFile(dbName, { key, container });
3786
3995
  await db.loadWorkspaceSettings();
3996
+ await db.initializeSharedElementReservations();
3787
3997
  return db;
3788
3998
  }
3789
3999
  /** @internal */