@itwin/core-backend 5.10.0-dev.9 → 5.10.0

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 (278) hide show
  1. package/CHANGELOG.md +45 -1
  2. package/lib/cjs/BriefcaseManager.d.ts +8 -1
  3. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  4. package/lib/cjs/BriefcaseManager.js.map +1 -1
  5. package/lib/cjs/Category.d.ts +4 -4
  6. package/lib/cjs/Category.js.map +1 -1
  7. package/lib/cjs/ChangesetECAdaptor.d.ts +6 -6
  8. package/lib/cjs/ChangesetECAdaptor.js +4 -4
  9. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  10. package/lib/cjs/ChangesetReader.d.ts +84 -1
  11. package/lib/cjs/ChangesetReader.d.ts.map +1 -1
  12. package/lib/cjs/ChangesetReader.js +108 -12
  13. package/lib/cjs/ChangesetReader.js.map +1 -1
  14. package/lib/cjs/ClassRegistry.d.ts +3 -3
  15. package/lib/cjs/ClassRegistry.js +3 -3
  16. package/lib/cjs/ClassRegistry.js.map +1 -1
  17. package/lib/cjs/CodeSpecs.d.ts +3 -3
  18. package/lib/cjs/CodeSpecs.js.map +1 -1
  19. package/lib/cjs/DisplayStyle.d.ts +2 -2
  20. package/lib/cjs/DisplayStyle.js.map +1 -1
  21. package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
  22. package/lib/cjs/ECSqlStatement.js +4 -0
  23. package/lib/cjs/ECSqlStatement.js.map +1 -1
  24. package/lib/cjs/ECSqlSyncReader.d.ts.map +1 -1
  25. package/lib/cjs/ECSqlSyncReader.js +1 -0
  26. package/lib/cjs/ECSqlSyncReader.js.map +1 -1
  27. package/lib/cjs/Element.d.ts +16 -13
  28. package/lib/cjs/Element.d.ts.map +1 -1
  29. package/lib/cjs/Element.js +8 -5
  30. package/lib/cjs/Element.js.map +1 -1
  31. package/lib/cjs/ElementAspect.d.ts +1 -1
  32. package/lib/cjs/ElementAspect.js.map +1 -1
  33. package/lib/cjs/ElementTreeWalker.d.ts +5 -5
  34. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  35. package/lib/cjs/Entity.d.ts +13 -5
  36. package/lib/cjs/Entity.d.ts.map +1 -1
  37. package/lib/cjs/Entity.js +13 -5
  38. package/lib/cjs/Entity.js.map +1 -1
  39. package/lib/cjs/ExternalSource.d.ts +2 -2
  40. package/lib/cjs/ExternalSource.js.map +1 -1
  41. package/lib/cjs/IModelDb.d.ts +112 -40
  42. package/lib/cjs/IModelDb.d.ts.map +1 -1
  43. package/lib/cjs/IModelDb.js +215 -42
  44. package/lib/cjs/IModelDb.js.map +1 -1
  45. package/lib/cjs/LineStyle.d.ts +6 -6
  46. package/lib/cjs/LineStyle.js.map +1 -1
  47. package/lib/cjs/LocalHub.d.ts +6 -0
  48. package/lib/cjs/LocalHub.d.ts.map +1 -1
  49. package/lib/cjs/LocalHub.js +23 -0
  50. package/lib/cjs/LocalHub.js.map +1 -1
  51. package/lib/cjs/Material.d.ts +1 -1
  52. package/lib/cjs/Material.js.map +1 -1
  53. package/lib/cjs/Model.d.ts +6 -6
  54. package/lib/cjs/Model.js.map +1 -1
  55. package/lib/cjs/Relationship.d.ts +13 -11
  56. package/lib/cjs/Relationship.d.ts.map +1 -1
  57. package/lib/cjs/Relationship.js +9 -7
  58. package/lib/cjs/Relationship.js.map +1 -1
  59. package/lib/cjs/SheetIndex.d.ts +4 -4
  60. package/lib/cjs/SheetIndex.js.map +1 -1
  61. package/lib/cjs/Texture.d.ts +1 -1
  62. package/lib/cjs/Texture.js.map +1 -1
  63. package/lib/cjs/TxnManager.d.ts.map +1 -1
  64. package/lib/cjs/TxnManager.js +7 -0
  65. package/lib/cjs/TxnManager.js.map +1 -1
  66. package/lib/cjs/ViewDefinition.d.ts +6 -6
  67. package/lib/cjs/ViewDefinition.js.map +1 -1
  68. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
  69. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  70. package/lib/cjs/annotations/FrameGeometry.d.ts.map +1 -1
  71. package/lib/cjs/annotations/FrameGeometry.js +2 -3
  72. package/lib/cjs/annotations/FrameGeometry.js.map +1 -1
  73. package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +6 -2
  74. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +1 -0
  75. package/lib/cjs/domains/FunctionalElements.d.ts +1 -1
  76. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  77. package/lib/cjs/domains/GenericElements.d.ts +2 -2
  78. package/lib/cjs/domains/GenericElements.js.map +1 -1
  79. package/lib/cjs/internal/ChannelAdmin.d.ts +2 -2
  80. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  81. package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -1
  82. package/lib/cjs/internal/ElementLRUCache.js +23 -4
  83. package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
  84. package/lib/cjs/internal/HubMock.d.ts +24 -1
  85. package/lib/cjs/internal/HubMock.d.ts.map +1 -1
  86. package/lib/cjs/internal/HubMock.js +60 -39
  87. package/lib/cjs/internal/HubMock.js.map +1 -1
  88. package/lib/cjs/internal/ServerBasedLocks.d.ts +19 -1
  89. package/lib/cjs/internal/ServerBasedLocks.d.ts.map +1 -1
  90. package/lib/cjs/internal/ServerBasedLocks.js +55 -1
  91. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  92. package/lib/cjs/internal/cross-package.d.ts +1 -1
  93. package/lib/cjs/internal/cross-package.d.ts.map +1 -1
  94. package/lib/cjs/internal/cross-package.js +1 -2
  95. package/lib/cjs/internal/cross-package.js.map +1 -1
  96. package/lib/cjs/internal/workspace/SettingsSchemasImpl.d.ts.map +1 -1
  97. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js +55 -9
  98. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  99. package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
  100. package/lib/cjs/internal/workspace/WorkspaceImpl.js +7 -11
  101. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  102. package/lib/cjs/workspace/SettingsSchemas.d.ts +20 -3
  103. package/lib/cjs/workspace/SettingsSchemas.d.ts.map +1 -1
  104. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  105. package/lib/cjs/workspace/Workspace.d.ts +3 -1
  106. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  107. package/lib/cjs/workspace/Workspace.js.map +1 -1
  108. package/lib/esm/BriefcaseManager.d.ts +8 -1
  109. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  110. package/lib/esm/BriefcaseManager.js.map +1 -1
  111. package/lib/esm/Category.d.ts +4 -4
  112. package/lib/esm/Category.js.map +1 -1
  113. package/lib/esm/ChangesetECAdaptor.d.ts +6 -6
  114. package/lib/esm/ChangesetECAdaptor.js +4 -4
  115. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  116. package/lib/esm/ChangesetReader.d.ts +84 -1
  117. package/lib/esm/ChangesetReader.d.ts.map +1 -1
  118. package/lib/esm/ChangesetReader.js +108 -12
  119. package/lib/esm/ChangesetReader.js.map +1 -1
  120. package/lib/esm/ClassRegistry.d.ts +3 -3
  121. package/lib/esm/ClassRegistry.js +3 -3
  122. package/lib/esm/ClassRegistry.js.map +1 -1
  123. package/lib/esm/CodeSpecs.d.ts +3 -3
  124. package/lib/esm/CodeSpecs.js.map +1 -1
  125. package/lib/esm/DisplayStyle.d.ts +2 -2
  126. package/lib/esm/DisplayStyle.js.map +1 -1
  127. package/lib/esm/ECSqlStatement.d.ts.map +1 -1
  128. package/lib/esm/ECSqlStatement.js +4 -0
  129. package/lib/esm/ECSqlStatement.js.map +1 -1
  130. package/lib/esm/ECSqlSyncReader.d.ts.map +1 -1
  131. package/lib/esm/ECSqlSyncReader.js +1 -0
  132. package/lib/esm/ECSqlSyncReader.js.map +1 -1
  133. package/lib/esm/Element.d.ts +16 -13
  134. package/lib/esm/Element.d.ts.map +1 -1
  135. package/lib/esm/Element.js +8 -5
  136. package/lib/esm/Element.js.map +1 -1
  137. package/lib/esm/ElementAspect.d.ts +1 -1
  138. package/lib/esm/ElementAspect.js.map +1 -1
  139. package/lib/esm/ElementTreeWalker.d.ts +5 -5
  140. package/lib/esm/ElementTreeWalker.js.map +1 -1
  141. package/lib/esm/Entity.d.ts +13 -5
  142. package/lib/esm/Entity.d.ts.map +1 -1
  143. package/lib/esm/Entity.js +13 -5
  144. package/lib/esm/Entity.js.map +1 -1
  145. package/lib/esm/ExternalSource.d.ts +2 -2
  146. package/lib/esm/ExternalSource.js.map +1 -1
  147. package/lib/esm/IModelDb.d.ts +112 -40
  148. package/lib/esm/IModelDb.d.ts.map +1 -1
  149. package/lib/esm/IModelDb.js +216 -43
  150. package/lib/esm/IModelDb.js.map +1 -1
  151. package/lib/esm/LineStyle.d.ts +6 -6
  152. package/lib/esm/LineStyle.js.map +1 -1
  153. package/lib/esm/LocalHub.d.ts +6 -0
  154. package/lib/esm/LocalHub.d.ts.map +1 -1
  155. package/lib/esm/LocalHub.js +23 -0
  156. package/lib/esm/LocalHub.js.map +1 -1
  157. package/lib/esm/Material.d.ts +1 -1
  158. package/lib/esm/Material.js.map +1 -1
  159. package/lib/esm/Model.d.ts +6 -6
  160. package/lib/esm/Model.js.map +1 -1
  161. package/lib/esm/Relationship.d.ts +13 -11
  162. package/lib/esm/Relationship.d.ts.map +1 -1
  163. package/lib/esm/Relationship.js +9 -7
  164. package/lib/esm/Relationship.js.map +1 -1
  165. package/lib/esm/SheetIndex.d.ts +4 -4
  166. package/lib/esm/SheetIndex.js.map +1 -1
  167. package/lib/esm/Texture.d.ts +1 -1
  168. package/lib/esm/Texture.js.map +1 -1
  169. package/lib/esm/TxnManager.d.ts.map +1 -1
  170. package/lib/esm/TxnManager.js +7 -0
  171. package/lib/esm/TxnManager.js.map +1 -1
  172. package/lib/esm/ViewDefinition.d.ts +6 -6
  173. package/lib/esm/ViewDefinition.js.map +1 -1
  174. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
  175. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  176. package/lib/esm/annotations/FrameGeometry.d.ts.map +1 -1
  177. package/lib/esm/annotations/FrameGeometry.js +2 -3
  178. package/lib/esm/annotations/FrameGeometry.js.map +1 -1
  179. package/lib/esm/domains/FunctionalElements.d.ts +1 -1
  180. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  181. package/lib/esm/domains/GenericElements.d.ts +2 -2
  182. package/lib/esm/domains/GenericElements.js.map +1 -1
  183. package/lib/esm/internal/ChannelAdmin.d.ts +2 -2
  184. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  185. package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -1
  186. package/lib/esm/internal/ElementLRUCache.js +23 -4
  187. package/lib/esm/internal/ElementLRUCache.js.map +1 -1
  188. package/lib/esm/internal/HubMock.d.ts +24 -1
  189. package/lib/esm/internal/HubMock.d.ts.map +1 -1
  190. package/lib/esm/internal/HubMock.js +61 -40
  191. package/lib/esm/internal/HubMock.js.map +1 -1
  192. package/lib/esm/internal/ServerBasedLocks.d.ts +19 -1
  193. package/lib/esm/internal/ServerBasedLocks.d.ts.map +1 -1
  194. package/lib/esm/internal/ServerBasedLocks.js +55 -1
  195. package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
  196. package/lib/esm/internal/cross-package.d.ts +1 -1
  197. package/lib/esm/internal/cross-package.d.ts.map +1 -1
  198. package/lib/esm/internal/cross-package.js +1 -1
  199. package/lib/esm/internal/cross-package.js.map +1 -1
  200. package/lib/esm/internal/workspace/SettingsSchemasImpl.d.ts.map +1 -1
  201. package/lib/esm/internal/workspace/SettingsSchemasImpl.js +55 -9
  202. package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  203. package/lib/esm/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
  204. package/lib/esm/internal/workspace/WorkspaceImpl.js +7 -11
  205. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  206. package/lib/esm/test/ElementLRUCache.test.js +60 -0
  207. package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
  208. package/lib/esm/test/SchemaChangesetCanBeReversed.test.d.ts +2 -0
  209. package/lib/esm/test/SchemaChangesetCanBeReversed.test.d.ts.map +1 -0
  210. package/lib/esm/test/SchemaChangesetCanBeReversed.test.js +239 -0
  211. package/lib/esm/test/SchemaChangesetCanBeReversed.test.js.map +1 -0
  212. package/lib/esm/test/annotations/FrameGeometry.test.js +2 -1
  213. package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -1
  214. package/lib/esm/test/ecdb/CTE.test.js +1 -0
  215. package/lib/esm/test/ecdb/CTE.test.js.map +1 -1
  216. package/lib/esm/test/ecdb/ECSqlQuery.test.js +10 -2
  217. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  218. package/lib/esm/test/ecdb/ECSqlStatement.test.js +10 -0
  219. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  220. package/lib/esm/test/ecdb/ECSqlSyncReader.test.js +1 -0
  221. package/lib/esm/test/ecdb/ECSqlSyncReader.test.js.map +1 -1
  222. package/lib/esm/test/ecdb/QueryReaders.test.js +13 -0
  223. package/lib/esm/test/ecdb/QueryReaders.test.js.map +1 -1
  224. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js +1 -0
  225. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  226. package/lib/esm/test/element/DeleteDefinitionElements.test.js +6 -2
  227. package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
  228. package/lib/esm/test/element/ElementRoundTrip.test.js +5 -0
  229. package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
  230. package/lib/esm/test/element/ExcludedElements.test.js +1 -0
  231. package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
  232. package/lib/esm/test/hubaccess/ApplyChangeset.test.js +10 -0
  233. package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -1
  234. package/lib/esm/test/hubaccess/SemanticRebase.test.js +1 -0
  235. package/lib/esm/test/hubaccess/SemanticRebase.test.js.map +1 -1
  236. package/lib/esm/test/imodel/IModel.test.js +31 -0
  237. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  238. package/lib/esm/test/schema/ClassRegistry.test.js +3 -0
  239. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  240. package/lib/esm/test/schema/IModelSchemaContext.test.js +2 -0
  241. package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
  242. package/lib/esm/test/schema/SchemaViewHidden.test.d.ts +2 -0
  243. package/lib/esm/test/schema/SchemaViewHidden.test.d.ts.map +1 -0
  244. package/lib/esm/test/schema/SchemaViewHidden.test.js +275 -0
  245. package/lib/esm/test/schema/SchemaViewHidden.test.js.map +1 -0
  246. package/lib/esm/test/schema/SchemaViewKoQ.test.d.ts +2 -0
  247. package/lib/esm/test/schema/SchemaViewKoQ.test.d.ts.map +1 -0
  248. package/lib/esm/test/schema/SchemaViewKoQ.test.js +184 -0
  249. package/lib/esm/test/schema/SchemaViewKoQ.test.js.map +1 -0
  250. package/lib/esm/test/schema/SchemaViewLifecycle.test.d.ts +2 -0
  251. package/lib/esm/test/schema/SchemaViewLifecycle.test.d.ts.map +1 -0
  252. package/lib/esm/test/schema/SchemaViewLifecycle.test.js +141 -0
  253. package/lib/esm/test/schema/SchemaViewLifecycle.test.js.map +1 -0
  254. package/lib/esm/test/schema/SchemaViewValidation.test.d.ts +2 -0
  255. package/lib/esm/test/schema/SchemaViewValidation.test.d.ts.map +1 -0
  256. package/lib/esm/test/schema/SchemaViewValidation.test.js +475 -0
  257. package/lib/esm/test/schema/SchemaViewValidation.test.js.map +1 -0
  258. package/lib/esm/test/standalone/ChangesetReader.test.js +945 -337
  259. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  260. package/lib/esm/test/standalone/DeleteElements.test.js +45 -0
  261. package/lib/esm/test/standalone/DeleteElements.test.js.map +1 -1
  262. package/lib/esm/test/standalone/IModelWrite.test.js +6 -0
  263. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  264. package/lib/esm/test/standalone/ServerBasedLocks.test.js +62 -0
  265. package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
  266. package/lib/esm/test/standalone/Settings.test.js +2 -0
  267. package/lib/esm/test/standalone/Settings.test.js.map +1 -1
  268. package/lib/esm/test/standalone/SettingsSchemas.test.js +397 -0
  269. package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
  270. package/lib/esm/test/standalone/Workspace.test.js +23 -0
  271. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  272. package/lib/esm/workspace/SettingsSchemas.d.ts +20 -3
  273. package/lib/esm/workspace/SettingsSchemas.d.ts.map +1 -1
  274. package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
  275. package/lib/esm/workspace/Workspace.d.ts +3 -1
  276. package/lib/esm/workspace/Workspace.d.ts.map +1 -1
  277. package/lib/esm/workspace/Workspace.js.map +1 -1
  278. package/package.json +14 -14
@@ -165,6 +165,7 @@ class IModelDb extends core_common_1.IModel {
165
165
  _jsClassMap;
166
166
  _schemaMap;
167
167
  _schemaContext;
168
+ _schemasPromise;
168
169
  /** @deprecated in 5.0.0 - will not be removed until after 2026-06-13. Use [[fonts]]. */
169
170
  _fontMap; // eslint-disable-line @typescript-eslint/no-deprecated
170
171
  _fonts = (0, IModelDbFontsImpl_1.createIModelDbFonts)(this);
@@ -721,6 +722,7 @@ class IModelDb extends core_common_1.IModel {
721
722
  const where = [...parentCategories].join(",");
722
723
  const query = `SELECT ECInstanceId as id, Parent.Id as parentId, Properties as appearance FROM BisCore.SubCategory WHERE Parent.Id IN (${where})`;
723
724
  try {
725
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
724
726
  for await (const row of this.createQueryReader(query, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames })) {
725
727
  result.push(row.toRow());
726
728
  }
@@ -741,6 +743,7 @@ class IModelDb extends core_common_1.IModel {
741
743
  const where = [...categoryIds].join(",");
742
744
  const query = `SELECT ECInstanceId as id, Parent.Id as parentId, Properties as appearance FROM BisCore.SubCategory WHERE Parent.Id IN (${where})`;
743
745
  try {
746
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
744
747
  for await (const row of this.createQueryReader(query, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames })) {
745
748
  result.push(row.toRow());
746
749
  }
@@ -797,6 +800,11 @@ class IModelDb extends core_common_1.IModel {
797
800
  this._jsClassMap = undefined;
798
801
  this._schemaMap = undefined;
799
802
  this._schemaContext = undefined;
803
+ if (this._schemasPromise) {
804
+ const old = this._schemasPromise;
805
+ this._schemasPromise = undefined;
806
+ old.then((view) => view.markOutdated()).catch(() => { });
807
+ }
800
808
  this[Symbols_1._nativeDb].clearECDbCache();
801
809
  }
802
810
  this.elements[Symbols_1._cache].clear();
@@ -809,7 +817,7 @@ class IModelDb extends core_common_1.IModel {
809
817
  * ``` ts
810
818
  * [[include:IModelDb.updateProjectExtents]]
811
819
  * ```
812
- * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use EditTxn.updateProjectExtents instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
820
+ * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use EditTxn.updateProjectExtents instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
813
821
  */
814
822
  updateProjectExtents(newExtents) {
815
823
  this[Symbols_1._implicitTxn].updateProjectExtents(newExtents);
@@ -833,13 +841,13 @@ class IModelDb extends core_common_1.IModel {
833
841
  };
834
842
  }
835
843
  /** Update the [EcefLocation]($docs/learning/glossary#eceflocation) of this iModel.
836
- * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use EditTxn.updateEcefLocation instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
844
+ * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use EditTxn.updateEcefLocation instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
837
845
  */
838
846
  updateEcefLocation(ecef) {
839
847
  this[Symbols_1._implicitTxn].updateEcefLocation(ecef);
840
848
  }
841
849
  /** Update the IModelProps of this iModel in the database.
842
- * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use EditTxn.updateIModelProps instead, within an explicit EditTxn scope (or via withEditTxn).
850
+ * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use EditTxn.updateIModelProps instead, within an explicit EditTxn scope (or via withEditTxn).
843
851
  */
844
852
  updateIModelProps() {
845
853
  this[Symbols_1._implicitTxn].updateIModelProps();
@@ -848,7 +856,7 @@ class IModelDb extends core_common_1.IModel {
848
856
  this[Symbols_1._implicitTxn].saveChanges(descriptionOrArgs);
849
857
  }
850
858
  /** Abandon changes in memory that have not been saved as a Txn to this iModelDb.
851
- * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use EditTxn.abandonChanges instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
859
+ * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use EditTxn.abandonChanges instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
852
860
  */
853
861
  abandonChanges() {
854
862
  this[Symbols_1._implicitTxn].abandonChanges();
@@ -1237,7 +1245,7 @@ class IModelDb extends core_common_1.IModel {
1237
1245
  }
1238
1246
  /** The registry of entity metadata for this iModel.
1239
1247
  * @internal
1240
- * @deprecated in 5.0 - will not be removed until after 2026-06-13. Please use `schemaContext` from the `iModel` instead.
1248
+ * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `getSchemaView()` from the `iModel` instead.
1241
1249
  *
1242
1250
  * @example
1243
1251
  * ```typescript
@@ -1245,7 +1253,8 @@ class IModelDb extends core_common_1.IModel {
1245
1253
  * const classMetaData: EntityMetaData | undefined = iModel.classMetaDataRegistry.find("SchemaName:ClassName");
1246
1254
  *
1247
1255
  * // Replacement:
1248
- * const metaData: EntityClass | undefined = imodel.schemaContext.getSchemaItemSync("SchemaName.ClassName", EntityClass);
1256
+ * const view = await imodel.getSchemaView();
1257
+ * const cls = view.findClass("SchemaName:ClassName");
1249
1258
  * ```
1250
1259
  */
1251
1260
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -1272,7 +1281,11 @@ class IModelDb extends core_common_1.IModel {
1272
1281
  return this._schemaMap;
1273
1282
  }
1274
1283
  /**
1275
- * Gets the context that allows accessing the metadata (ecschema-metadata package) of this iModel
1284
+ * Gets the context that allows accessing the metadata (`@itwin/ecschema-metadata` package) of this iModel.
1285
+ *
1286
+ * For runtime read-only access - class/property iteration, IS-A checks, navigating relationships, KOQ lookups -
1287
+ * prefer [[getSchemaView]]. `schemaContext` remains the right choice when you need schema authoring
1288
+ * (via `@itwin/ecschema-editing`), custom-attribute deserialization, or the full ecschema-metadata object graph.
1276
1289
  * @public @preview
1277
1290
  */
1278
1291
  get schemaContext() {
@@ -1286,6 +1299,55 @@ class IModelDb extends core_common_1.IModel {
1286
1299
  }
1287
1300
  return this._schemaContext;
1288
1301
  }
1302
+ /** Get the schema view for this iModel. The view is built lazily on
1303
+ * first call by fetching compact binary schema data via `PRAGMA schema_view` through
1304
+ * the ConcurrentQuery thread pool. Subsequent calls return the cached view. Multiple
1305
+ * concurrent callers share a single in-flight build.
1306
+ *
1307
+ * The returned `SchemaView` is a lightweight, read-only, synchronous API for
1308
+ * navigating schema metadata - classes, properties, relationships, enumerations, etc.
1309
+ * It is the recommended default for runtime read-only metadata access and is significantly
1310
+ * faster and lower-memory than [[schemaContext]]. Use [[schemaContext]] for schema authoring,
1311
+ * custom-attribute deserialization, or anywhere you need the full ecschema-metadata object graph.
1312
+ * @beta
1313
+ */
1314
+ async getSchemaView() {
1315
+ if (this._schemasPromise) {
1316
+ const ctx = await this._schemasPromise;
1317
+ if (!ctx.isOutdated)
1318
+ return ctx;
1319
+ }
1320
+ // Capture the in-flight promise locally so the rejection handler only clears
1321
+ // `_schemasPromise` if it still points at this build. A concurrent invalidation +
1322
+ // re-fetch could otherwise replace the field before our hydrate fails, and a naive
1323
+ // `_schemasPromise = undefined` would clobber that newer reference.
1324
+ const inflight = this._hydrateSchemas();
1325
+ this._schemasPromise = inflight;
1326
+ inflight.catch(() => {
1327
+ if (this._schemasPromise === inflight)
1328
+ this._schemasPromise = undefined;
1329
+ });
1330
+ return inflight;
1331
+ }
1332
+ async _hydrateSchemas() {
1333
+ // PRAGMA returns exactly one row with format, formatVersion, data (binary), schemaToken.
1334
+ // Important: only call reader.next() once - do NOT use `for await` on PRAGMA results.
1335
+ // ConcurrentQuery wraps regular ECSQL in LIMIT/OFFSET for pagination but skips this for
1336
+ // PRAGMAs. If the serialized result exceeds the memory threshold, the response is marked
1337
+ // "Partial", and a `for await` loop would re-issue the same PRAGMA forever since PRAGMAs
1338
+ // don't support OFFSET-based pagination.
1339
+ // This implementation uses the non-pinned version of the pragma other than frontend - because backend
1340
+ // is always strictly coupled with the native code.
1341
+ const reader = this.createQueryReader("PRAGMA schema_view");
1342
+ const result = await reader.next();
1343
+ if (result.done)
1344
+ throw new core_common_1.IModelError(core_bentley_1.DbResult.BE_SQLITE_ERROR, "PRAGMA schema_view returned no rows");
1345
+ const data = result.value.data;
1346
+ const token = result.value.schemaToken;
1347
+ if (data === undefined || data === null)
1348
+ throw new core_common_1.IModelError(core_bentley_1.DbResult.BE_SQLITE_ERROR, "PRAGMA schema_view returned null data column");
1349
+ return ecschema_metadata_1.SchemaView.fromBinary(data, token ?? "");
1350
+ }
1289
1351
  /** Get the linkTableRelationships for this IModel */
1290
1352
  get relationships() {
1291
1353
  return this._relationships || (this._relationships = new Relationship_1.Relationships(this));
@@ -1360,7 +1422,7 @@ class IModelDb extends core_common_1.IModel {
1360
1422
  }
1361
1423
  /** Get metadata for a class. This method will load the metadata from the iModel into the cache as a side-effect, if necessary.
1362
1424
  * @throws [[IModelError]] if the metadata cannot be found nor loaded.
1363
- * @deprecated in 5.0 - will not be removed until after 2026-06-13. Please use `getSchemaItem` from `SchemaContext` class instead.
1425
+ * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `getSchemaView()` on the iModel and call `view.findClass(...)` instead.
1364
1426
  *
1365
1427
  * @example
1366
1428
  * * ```typescript
@@ -1368,7 +1430,8 @@ class IModelDb extends core_common_1.IModel {
1368
1430
  * const metaData: EntityMetaData = imodel.getMetaData("SchemaName:ClassName");
1369
1431
  *
1370
1432
  * // Replacement:
1371
- * const metaData: EntityClass | undefined = imodel.schemaContext.getSchemaItemSync("SchemaName", "ClassName", EntityClass);
1433
+ * const view = await imodel.getSchemaView();
1434
+ * const cls = view.findClass("SchemaName:ClassName");
1372
1435
  * ```
1373
1436
  */
1374
1437
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -1386,7 +1449,7 @@ class IModelDb extends core_common_1.IModel {
1386
1449
  return metadata;
1387
1450
  }
1388
1451
  /** Identical to [[getMetaData]], except it returns `undefined` instead of throwing an error if the metadata cannot be found nor loaded.
1389
- * @deprecated in 5.0 - will not be removed until after 2026-06-13. Please use `getSchemaItem` from `SchemaContext` class instead.
1452
+ * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `getSchemaView()` on the iModel and call `view.findClass(...)` instead.
1390
1453
  *
1391
1454
  * @example
1392
1455
  * * ```typescript
@@ -1394,7 +1457,8 @@ class IModelDb extends core_common_1.IModel {
1394
1457
  * const metaData: EntityMetaData | undefined = imodel.tryGetMetaData("SchemaName:ClassName");
1395
1458
  *
1396
1459
  * // Replacement:
1397
- * const metaData: EntityClass | undefined = imodel.schemaContext.getSchemaItemSync("SchemaName.ClassName", EntityClass);
1460
+ * const view = await imodel.getSchemaView();
1461
+ * const cls = view.findClass("SchemaName:ClassName");
1398
1462
  * ```
1399
1463
  */
1400
1464
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -1414,7 +1478,7 @@ class IModelDb extends core_common_1.IModel {
1414
1478
  * @param func The callback to be invoked on each property
1415
1479
  * @param includeCustom If true (default), include custom-handled properties in the iteration. Otherwise, skip custom-handled properties.
1416
1480
  * @note Custom-handled properties are core properties that have behavior enforced by C++ handlers.
1417
- * @deprecated in 5.0 - will not be removed until after 2026-06-13. Please use `forEachProperty` instead.
1481
+ * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `getSchemaView()` on the iModel and iterate `view.findClass(classFullName)?.getProperties()` instead.
1418
1482
  *
1419
1483
  * @example
1420
1484
  * ```typescript
@@ -1424,9 +1488,10 @@ class IModelDb extends core_common_1.IModel {
1424
1488
  * }, false);
1425
1489
  *
1426
1490
  * // Replacement:
1427
- * await IModelDb.forEachProperty(imodel, "TestDomain.TestDomainClass", true, (propName: string, property: Property) => {
1428
- * console.log(`Property name: ${propName}, Property type: ${property.propertyType}`);
1429
- * }, false);
1491
+ * const view = await imodel.getSchemaView();
1492
+ * for (const property of view.findClass("BisCore:Element")?.getProperties() ?? []) {
1493
+ * console.log(`Property name: ${property.name}, Kind: ${property.kind}`);
1494
+ * }
1430
1495
  * ```
1431
1496
  */
1432
1497
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -1440,7 +1505,7 @@ class IModelDb extends core_common_1.IModel {
1440
1505
  * @param func The callback to be invoked on each property
1441
1506
  * @param includeCustom If true (default), include custom-handled properties in the iteration. Otherwise, skip custom-handled properties.
1442
1507
  * @note Custom-handled properties are core properties that have behavior enforced by C++ handlers.
1443
- * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `forEachProperty` from `SchemaContext` class instead.
1508
+ * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `getSchemaView()` on the iModel and iterate `view.findClass(classFullName)?.getProperties()` instead.
1444
1509
  *
1445
1510
  * @example
1446
1511
  * ```typescript
@@ -1450,9 +1515,10 @@ class IModelDb extends core_common_1.IModel {
1450
1515
  * });
1451
1516
  *
1452
1517
  * // Replacement:
1453
- * imodel.schemaContext.forEachProperty("BisCore:Element", true, (propName: string, property: Property) => {
1454
- * console.log(`Property name: ${propName}, Property type: ${property.propertyType}`);
1455
- * });
1518
+ * const view = await imodel.getSchemaView();
1519
+ * for (const property of view.findClass("BisCore:Element")?.getProperties() ?? []) {
1520
+ * console.log(`Property name: ${property.name}, Kind: ${property.kind}`);
1521
+ * }
1456
1522
  * ```
1457
1523
  */
1458
1524
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -1576,7 +1642,7 @@ class IModelDb extends core_common_1.IModel {
1576
1642
  * @param prop the FilePropertyProps that describes the new property
1577
1643
  * @param value either a string or a blob to save as the file property
1578
1644
  * @note This method should not be called from {TxnManager.withIndirectTxnModeAsync} or {TxnManager.withIndirectTxnMode}.
1579
- * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use EditTxn.saveFileProperty instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
1645
+ * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use EditTxn.saveFileProperty instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
1580
1646
  */
1581
1647
  saveFileProperty(prop, strValue, blobVal) {
1582
1648
  this[Symbols_1._implicitTxn].saveFileProperty(prop, strValue, blobVal);
@@ -1584,7 +1650,7 @@ class IModelDb extends core_common_1.IModel {
1584
1650
  /** delete a "file property" from this iModel
1585
1651
  * @param prop the FilePropertyProps that describes the property
1586
1652
  * @note This method should not be called from {TxnManager.withIndirectTxnModeAsync} or {TxnManager.withIndirectTxnMode}.
1587
- * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use EditTxn.deleteFileProperty instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
1653
+ * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use EditTxn.deleteFileProperty instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
1588
1654
  */
1589
1655
  deleteFileProperty(prop) {
1590
1656
  this[Symbols_1._implicitTxn].deleteFileProperty(prop);
@@ -1792,14 +1858,14 @@ class IModelDb extends core_common_1.IModel {
1792
1858
  * @param dict The SettingDictionary object to stringify and save.
1793
1859
  * @note All saved `SettingDictionary`s are loaded into [[workspace.settings]] every time an iModel is opened.
1794
1860
  * @see [[Settings.addDictionary]] to register a dictionary for the current session only without persisting it.
1795
- * @beta @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use EditTxn.saveSettingDictionary instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
1861
+ * @beta @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use EditTxn.saveSettingDictionary instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
1796
1862
  */
1797
1863
  saveSettingDictionary(name, dict) {
1798
1864
  this[Symbols_1._implicitTxn].saveSettingDictionary(name, dict);
1799
1865
  }
1800
1866
  /** Delete a SettingDictionary, previously added with [[saveSettingDictionary]], from this iModel.
1801
1867
  * @param name The name of the dictionary to delete.
1802
- * @beta @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use EditTxn.deleteSettingDictionary instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
1868
+ * @beta @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use EditTxn.deleteSettingDictionary instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
1803
1869
  */
1804
1870
  deleteSettingDictionary(name) {
1805
1871
  this[Symbols_1._implicitTxn].deleteSettingDictionary(name);
@@ -2089,7 +2155,7 @@ function processSchemaWriteStatus(status) {
2089
2155
  * @param props The data for the new model.
2090
2156
  * @returns The newly inserted model's Id.
2091
2157
  * @throws [[IModelError]] if insertion fails.
2092
- * @deprecated in 5.1.9 - 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.
2158
+ * @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.
2093
2159
  */
2094
2160
  insertModel(props) {
2095
2161
  return this._iModel[Symbols_1._implicitTxn].insertModel(props);
@@ -2097,7 +2163,7 @@ function processSchemaWriteStatus(status) {
2097
2163
  /** Update an existing model.
2098
2164
  * @param props the properties of the model to change
2099
2165
  * @throws [[IModelError]] if update fails.
2100
- * @deprecated in 5.1.9 - 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.
2166
+ * @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.
2101
2167
  */
2102
2168
  updateModel(props) {
2103
2169
  this._iModel[Symbols_1._implicitTxn].updateModel(props);
@@ -2109,7 +2175,7 @@ function processSchemaWriteStatus(status) {
2109
2175
  * Cached [Tile]($frontend)s are only invalidated after the geometry guid of the model changes.
2110
2176
  * @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.
2111
2177
  * @throws [[IModelError]] if the update fails.
2112
- * @deprecated in 5.1.9 - 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.
2178
+ * @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.
2113
2179
  * @see [[TxnManager.onModelGeometryChanged]] for the event emitted in response to such a change.
2114
2180
  */
2115
2181
  updateGeometryGuid(modelId) {
@@ -2118,7 +2184,7 @@ function processSchemaWriteStatus(status) {
2118
2184
  /** Delete one or more existing models.
2119
2185
  * @param ids The Ids of the models to be deleted
2120
2186
  * @throws [[IModelError]] if deletion fails.
2121
- * @deprecated in 5.1.9 - 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.
2187
+ * @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.
2122
2188
  */
2123
2189
  deleteModel(ids) {
2124
2190
  this._iModel[Symbols_1._implicitTxn].deleteModel(ids);
@@ -2344,7 +2410,7 @@ function processSchemaWriteStatus(status) {
2344
2410
  * However when `elProps.federationGuid` is not present or undefined, a new Guid will be generated and stored on the resultant element. But
2345
2411
  * the value of `elProps.federationGuid` is *not* updated. Generally, it is best to re-read the element after inserting (e.g. via [[getElementProps]])
2346
2412
  * if you intend to continue working with it. That will ensure its values reflect the persistent state.
2347
- * @deprecated in 5.1.9 - 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.
2413
+ * @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.
2348
2414
  */
2349
2415
  insertElement(elProps, options) {
2350
2416
  return this._iModel[Symbols_1._implicitTxn].insertElement(elProps, options);
@@ -2359,7 +2425,7 @@ function processSchemaWriteStatus(status) {
2359
2425
  * @note The values of `classFullName` and `model` *may not be changed* by this method. Further, it will permute the `elProps` object by adding or
2360
2426
  * overwriting their values to the correct values.
2361
2427
  * @throws [[ITwinError]] if update fails.
2362
- * @deprecated in 5.1.9 - 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.
2428
+ * @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.
2363
2429
  */
2364
2430
  updateElement(elProps) {
2365
2431
  this._iModel[Symbols_1._implicitTxn].updateElement(elProps);
@@ -2368,11 +2434,23 @@ function processSchemaWriteStatus(status) {
2368
2434
  * @param ids The set of Ids of the element(s) to be deleted
2369
2435
  * @throws [[ITwinError]]
2370
2436
  * @see deleteDefinitionElements
2371
- * @deprecated in 5.1.9 - 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.
2437
+ * @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.
2372
2438
  */
2373
2439
  deleteElement(ids) {
2374
2440
  this._iModel[Symbols_1._implicitTxn].deleteElement(ids);
2375
2441
  }
2442
+ /**
2443
+ * Delete multiple elements from the iModel.
2444
+ * @param ids The ids of the elements to delete. All ids must be well-formed and valid [[Id64String]]s.
2445
+ * @param deleteOptions Options for the delete operation.
2446
+ * @returns A result object containing information about the deletion operation success and the element ids that failed to delete (if any).
2447
+ * @throws [[ITwinError]] if any of the supplied ids are not well-formed/valid [[Id64String]]s.
2448
+ * @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.
2449
+ * @beta
2450
+ */
2451
+ deleteElements(ids, deleteOptions) {
2452
+ return this._iModel[Symbols_1._implicitTxn].deleteElements(ids, deleteOptions);
2453
+ }
2376
2454
  /** DefinitionElements can only be deleted if it can be determined that they are not referenced by other Elements.
2377
2455
  * This *usage query* can be expensive since it may involve scanning the GeometryStreams of all GeometricElements.
2378
2456
  * Since [[deleteElement]] does not perform these additional checks, it fails in order to prevent potentially referenced DefinitionElements from being deleted.
@@ -2381,7 +2459,7 @@ function processSchemaWriteStatus(status) {
2381
2459
  * DefinitionElements rather than calling this method separately for each one. Ids that are not valid DefinitionElements will be ignored.
2382
2460
  * @returns An IdSet of the DefinitionElements that are used and were therefore not deleted.
2383
2461
  * @see deleteElement
2384
- * @deprecated in 5.1.9 - 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.
2462
+ * @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.
2385
2463
  */
2386
2464
  deleteDefinitionElements(definitionElementIds) {
2387
2465
  return this._iModel[Symbols_1._implicitTxn].deleteDefinitionElements(definitionElementIds);
@@ -2575,7 +2653,7 @@ function processSchemaWriteStatus(status) {
2575
2653
  * @returns the id of the newly inserted aspect.
2576
2654
  * @note Aspect Ids may collide with element Ids, so don't put both in a container like Set or Map
2577
2655
  * use [EntityReference]($common) for that instead.
2578
- * @deprecated in 5.1.9 - 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.
2656
+ * @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.
2579
2657
  */
2580
2658
  insertAspect(aspectProps) {
2581
2659
  return this._iModel[Symbols_1._implicitTxn].insertAspect(aspectProps);
@@ -2583,7 +2661,7 @@ function processSchemaWriteStatus(status) {
2583
2661
  /** Update an exist ElementAspect within the iModel.
2584
2662
  * @param aspectProps The properties to use to update the ElementAspect.
2585
2663
  * @throws [[IModelError]] if unable to update the ElementAspect.
2586
- * @deprecated in 5.1.9 - 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.
2664
+ * @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.
2587
2665
  */
2588
2666
  updateAspect(aspectProps) {
2589
2667
  this._iModel[Symbols_1._implicitTxn].updateAspect(aspectProps);
@@ -2591,7 +2669,7 @@ function processSchemaWriteStatus(status) {
2591
2669
  /** Delete one or more ElementAspects from this iModel.
2592
2670
  * @param aspectInstanceIds The set of instance Ids of the ElementAspect(s) to be deleted
2593
2671
  * @throws [[IModelError]] if unable to delete the ElementAspect.
2594
- * @deprecated in 5.1.9 - 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.
2672
+ * @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.
2595
2673
  */
2596
2674
  deleteAspect(aspectInstanceIds) {
2597
2675
  this._iModel[Symbols_1._implicitTxn].deleteAspect(aspectInstanceIds);
@@ -2638,7 +2716,7 @@ function processSchemaWriteStatus(status) {
2638
2716
  return this._viewStore;
2639
2717
  }
2640
2718
  /**
2641
- * @beta @deprecated in 5.1.9 - 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.
2719
+ * @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.
2642
2720
  */
2643
2721
  saveDefaultViewStore(arg) {
2644
2722
  this._iModel[Symbols_1._implicitTxn].saveDefaultViewStore(arg);
@@ -3327,7 +3405,63 @@ class BriefcaseDb extends IModelDb {
3327
3405
  async getAllChangesetHealthData() {
3328
3406
  return this[Symbols_1._nativeDb].getAllChangesetHealthData();
3329
3407
  }
3330
- /** Revert timeline changes and then push resulting changeset */
3408
+ /**
3409
+ * Whether file-based transactions are enabled for this briefcase.
3410
+ *
3411
+ * When enabled, transaction data is stored in separate temporary `.txn` files rather than in the
3412
+ * briefcase's internal transaction table. This avoids SQLite blob size limits and reduces memory
3413
+ * pressure for very large changesets, at the cost of additional disk I/O.
3414
+ * @see [[enableFileBasedTxns]] to enable, [[disableFileBasedTxns]] to disable.
3415
+ * @internal
3416
+ */
3417
+ get isFileBasedTxnsEnabled() {
3418
+ return this[Symbols_1._nativeDb].queryLocalValue("fileBasedTxns") === "1";
3419
+ }
3420
+ /**
3421
+ * Enable file-based transactions for this briefcase.
3422
+ * @throws IModelError with [[ChangeSetStatus.HasUncommittedChanges]] if there are unsaved changes.
3423
+ * @throws IModelError with [[ChangeSetStatus.HasLocalChanges]] if there are pending transactions.
3424
+ * @internal
3425
+ */
3426
+ enableFileBasedTxns() {
3427
+ this._setFileBasedTxnsSetting(true);
3428
+ }
3429
+ /**
3430
+ * Disable file-based transactions for this briefcase, reverting to the default storage mode
3431
+ * (transactions stored within the briefcase's internal transaction table).
3432
+ * @throws IModelError with [[ChangeSetStatus.HasUncommittedChanges]] if there are unsaved changes.
3433
+ * @throws IModelError with [[ChangeSetStatus.HasLocalChanges]] if there are pending transactions.
3434
+ * @internal
3435
+ */
3436
+ disableFileBasedTxns() {
3437
+ this._setFileBasedTxnsSetting(false);
3438
+ }
3439
+ _setFileBasedTxnsSetting(enabled) {
3440
+ if (this.isFileBasedTxnsEnabled === enabled)
3441
+ return;
3442
+ const nativeDb = this[Symbols_1._nativeDb];
3443
+ if (nativeDb.hasUnsavedChanges())
3444
+ throw new core_common_1.IModelError(core_bentley_1.ChangeSetStatus.HasUncommittedChanges, "Cannot change file-based transactions setting while there are unsaved changes");
3445
+ if (nativeDb.hasPendingTxns())
3446
+ throw new core_common_1.IModelError(core_bentley_1.ChangeSetStatus.HasLocalChanges, "Cannot change file-based transactions setting while there are pending transactions");
3447
+ if (enabled)
3448
+ nativeDb.saveLocalValue("fileBasedTxns", "1");
3449
+ else
3450
+ nativeDb.deleteLocalValue("fileBasedTxns");
3451
+ }
3452
+ /**
3453
+ * Revert timeline changes and push the resulting changeset.
3454
+ *
3455
+ * Pulls the latest changes, acquires the schema lock, reverts the inclusive range of
3456
+ * changesets `[toIndex..current]`, and pushes the revert as a new changeset. On failure,
3457
+ * follow the behavior specified by `arg.inCaseOfFailure`, which may discard local changes,
3458
+ * retain local changes, or delete the briefcase.
3459
+ *
3460
+ * @param arg - Arguments specifying the target changeset index, push options, access token, and failure handling behavior.
3461
+ * @throws IModelError with [[ChangeSetStatus.ApplyError]] if `toIndex` is not specified.
3462
+ * @throws IModelError with [[ChangeSetStatus.HasUncommittedChanges]] if there are unsaved changes.
3463
+ * @throws IModelError with [[ChangeSetStatus.HasLocalChanges]] if there are pending transactions.
3464
+ */
3331
3465
  async revertAndPushChanges(arg) {
3332
3466
  const nativeDb = this[Symbols_1._nativeDb];
3333
3467
  if (arg.toIndex === undefined) {
@@ -3359,11 +3493,14 @@ class BriefcaseDb extends IModelDb {
3359
3493
  if (nativeDb.schemaSyncEnabled()) {
3360
3494
  arg.skipSchemaChanges = true;
3361
3495
  }
3496
+ // The native side enables file-based txns during revert. Restore the original setting afterward.
3497
+ const wasFileBasedTxnsEnabled = this.isFileBasedTxnsEnabled;
3498
+ const preRevertIndex = this.changeset.index;
3362
3499
  try {
3363
3500
  await BriefcaseManager_1.BriefcaseManager.revertTimelineChanges(this, arg);
3364
- this[Symbols_1._nativeDb].saveChanges("Revert changes");
3501
+ nativeDb.saveChanges("Revert changes");
3365
3502
  if (!arg.description) {
3366
- arg.description = `Reverted changes from ${this.changeset.index} to ${arg.toIndex}${arg.skipSchemaChanges ? " (schema changes skipped)" : ""}`;
3503
+ arg.description = `Reverted changes from ${preRevertIndex} to ${arg.toIndex}${arg.skipSchemaChanges ? " (schema changes skipped)" : ""}`;
3367
3504
  }
3368
3505
  const pushArgs = {
3369
3506
  description: arg.description,
@@ -3378,13 +3515,49 @@ class BriefcaseDb extends IModelDb {
3378
3515
  this.clearCaches();
3379
3516
  }
3380
3517
  catch (err) {
3381
- if (!arg.retainLocks) {
3382
- await this.locks.releaseAllLocks();
3383
- throw err;
3518
+ const failureAction = arg.inCaseOfFailure ?? "revert";
3519
+ try {
3520
+ switch (failureAction) {
3521
+ case "revert":
3522
+ // Restore the briefcase to its pre-revert state: save any unsaved changes into txns,
3523
+ // reverse all txns, then delete them.
3524
+ nativeDb.saveChanges();
3525
+ if (nativeDb.hasPendingTxns())
3526
+ nativeDb.reverseAll();
3527
+ nativeDb.deleteAllTxns();
3528
+ break;
3529
+ case "delete":
3530
+ // Clear local changes first so lock release can succeed.
3531
+ nativeDb.abandonChanges();
3532
+ nativeDb.deleteAllTxns();
3533
+ if (!arg.retainLocks)
3534
+ await this.locks.releaseAllLocks();
3535
+ const filePath = this.pathName;
3536
+ this.close();
3537
+ await BriefcaseManager_1.BriefcaseManager.deleteBriefcaseFiles(filePath, arg.accessToken);
3538
+ break;
3539
+ case "retain":
3540
+ // Keep local changes as-is for caller inspection/recovery.
3541
+ nativeDb.saveChanges();
3542
+ break;
3543
+ }
3544
+ }
3545
+ catch (cleanupErr) {
3546
+ core_bentley_1.Logger.logError(loggerCategory, `Failed to clean up after revert error (action=${failureAction}): ${String(cleanupErr)}`);
3384
3547
  }
3548
+ if (!arg.retainLocks && this.isOpen) {
3549
+ try {
3550
+ await this.locks.releaseAllLocks();
3551
+ }
3552
+ catch (lockErr) {
3553
+ core_bentley_1.Logger.logError(loggerCategory, `Failed to release locks after revert failure (action=${failureAction}): ${String(lockErr)}`);
3554
+ }
3555
+ }
3556
+ throw err;
3385
3557
  }
3386
3558
  finally {
3387
- this[Symbols_1._nativeDb].abandonChanges();
3559
+ if (this.isOpen && !wasFileBasedTxnsEnabled && !nativeDb.hasPendingTxns() && !nativeDb.hasUnsavedChanges())
3560
+ this.disableFileBasedTxns();
3388
3561
  }
3389
3562
  }
3390
3563
  /**