@itwin/core-backend 5.10.0-dev.15 → 5.10.0-dev.18

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 (446) hide show
  1. package/lib/cjs/BackendHubAccess.js.map +1 -1
  2. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  3. package/lib/cjs/BisCoreSchema.js.map +1 -1
  4. package/lib/cjs/BlobContainerService.js.map +1 -1
  5. package/lib/cjs/BriefcaseManager.js.map +1 -1
  6. package/lib/cjs/CatalogDb.js.map +1 -1
  7. package/lib/cjs/Category.js.map +1 -1
  8. package/lib/cjs/ChangeSummaryManager.js +2 -2
  9. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  10. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  11. package/lib/cjs/ChangesetECAdaptor.js +248 -248
  12. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  13. package/lib/cjs/ChangesetReader.d.ts +84 -1
  14. package/lib/cjs/ChangesetReader.d.ts.map +1 -1
  15. package/lib/cjs/ChangesetReader.js +108 -12
  16. package/lib/cjs/ChangesetReader.js.map +1 -1
  17. package/lib/cjs/ChangesetReaderTypes.js.map +1 -1
  18. package/lib/cjs/ChannelControl.js.map +1 -1
  19. package/lib/cjs/CheckpointManager.js.map +1 -1
  20. package/lib/cjs/ClassRegistry.js +5 -5
  21. package/lib/cjs/ClassRegistry.js.map +1 -1
  22. package/lib/cjs/CloudSqlite.js.map +1 -1
  23. package/lib/cjs/CodeService.js.map +1 -1
  24. package/lib/cjs/CodeSpecs.js.map +1 -1
  25. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  26. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  27. package/lib/cjs/DevTools.js.map +1 -1
  28. package/lib/cjs/DisplayStyle.js.map +1 -1
  29. package/lib/cjs/ECDb.js.map +1 -1
  30. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  31. package/lib/cjs/ECSqlRowExecutor.js.map +1 -1
  32. package/lib/cjs/ECSqlStatement.js.map +1 -1
  33. package/lib/cjs/ECSqlSyncReader.js.map +1 -1
  34. package/lib/cjs/EditTxn.js.map +1 -1
  35. package/lib/cjs/Element.js.map +1 -1
  36. package/lib/cjs/ElementAspect.js.map +1 -1
  37. package/lib/cjs/ElementGraphics.js.map +1 -1
  38. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  39. package/lib/cjs/Entity.js.map +1 -1
  40. package/lib/cjs/EntityReferences.js.map +1 -1
  41. package/lib/cjs/ExportGraphics.js.map +1 -1
  42. package/lib/cjs/ExternalSource.js.map +1 -1
  43. package/lib/cjs/FontFile.js.map +1 -1
  44. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  45. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  46. package/lib/cjs/GeometrySummary.js +47 -47
  47. package/lib/cjs/GeometrySummary.js.map +1 -1
  48. package/lib/cjs/IModelDb.js +8 -8
  49. package/lib/cjs/IModelDb.js.map +1 -1
  50. package/lib/cjs/IModelDbFonts.js.map +1 -1
  51. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  52. package/lib/cjs/IModelHost.js.map +1 -1
  53. package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -1
  54. package/lib/cjs/IModelJsFs.js.map +1 -1
  55. package/lib/cjs/ImageSourceConversion.js.map +1 -1
  56. package/lib/cjs/IpcHost.js.map +1 -1
  57. package/lib/cjs/LineStyle.js.map +1 -1
  58. package/lib/cjs/LocalHub.js +1 -1
  59. package/lib/cjs/LocalHub.js.map +1 -1
  60. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  61. package/lib/cjs/LockControl.js.map +1 -1
  62. package/lib/cjs/Material.js.map +1 -1
  63. package/lib/cjs/Model.js.map +1 -1
  64. package/lib/cjs/NativeAppStorage.js.map +1 -1
  65. package/lib/cjs/NativeHost.js.map +1 -1
  66. package/lib/cjs/NavigationRelationship.js.map +1 -1
  67. package/lib/cjs/PartialChangeUnifier.js +7 -7
  68. package/lib/cjs/PartialChangeUnifier.js.map +1 -1
  69. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  70. package/lib/cjs/PropertyStore.js.map +1 -1
  71. package/lib/cjs/Relationship.js.map +1 -1
  72. package/lib/cjs/RpcBackend.js.map +1 -1
  73. package/lib/cjs/SQLiteDb.js.map +1 -1
  74. package/lib/cjs/Schema.js.map +1 -1
  75. package/lib/cjs/SchemaSync.js.map +1 -1
  76. package/lib/cjs/SchemaUtils.js.map +1 -1
  77. package/lib/cjs/SheetIndex.js.map +1 -1
  78. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  79. package/lib/cjs/SqliteStatement.js.map +1 -1
  80. package/lib/cjs/StashManager.js.map +1 -1
  81. package/lib/cjs/Texture.js.map +1 -1
  82. package/lib/cjs/TileStorage.js.map +1 -1
  83. package/lib/cjs/TxnManager.d.ts.map +1 -1
  84. package/lib/cjs/TxnManager.js +7 -0
  85. package/lib/cjs/TxnManager.js.map +1 -1
  86. package/lib/cjs/ViewDefinition.js.map +1 -1
  87. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  88. package/lib/cjs/ViewStore.js.map +1 -1
  89. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  90. package/lib/cjs/annotations/FrameGeometry.js.map +1 -1
  91. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
  92. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  93. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
  94. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -1
  95. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -1
  96. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  97. package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +36 -32
  98. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +28 -27
  99. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
  100. package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
  101. package/lib/cjs/core-backend.js.map +1 -1
  102. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  103. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  104. package/lib/cjs/domains/GenericElements.js.map +1 -1
  105. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  106. package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
  107. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  108. package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
  109. package/lib/cjs/internal/FontFileImpl.js.map +1 -1
  110. package/lib/cjs/internal/HubMock.js.map +1 -1
  111. package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -1
  112. package/lib/cjs/internal/IntegrityCheck.js.map +1 -1
  113. package/lib/cjs/internal/NativePlatform.js.map +1 -1
  114. package/lib/cjs/internal/NoLocks.js.map +1 -1
  115. package/lib/cjs/internal/OnlineStatus.js.map +1 -1
  116. package/lib/cjs/internal/ServerBasedLocks.js +33 -33
  117. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  118. package/lib/cjs/internal/Symbols.js.map +1 -1
  119. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  120. package/lib/cjs/internal/cross-package.js.map +1 -1
  121. package/lib/cjs/internal/workspace/SettingsEditorImpl.js.map +1 -1
  122. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  123. package/lib/cjs/internal/workspace/SettingsSchemasImpl.d.ts.map +1 -1
  124. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js +1 -0
  125. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  126. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  127. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  128. package/lib/cjs/rpc/multipart.js.map +1 -1
  129. package/lib/cjs/rpc/tracing.js.map +1 -1
  130. package/lib/cjs/rpc/web/logging.js.map +1 -1
  131. package/lib/cjs/rpc/web/request.js.map +1 -1
  132. package/lib/cjs/rpc/web/response.js.map +1 -1
  133. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  134. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  135. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  136. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  137. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  138. package/lib/cjs/workspace/Settings.js.map +1 -1
  139. package/lib/cjs/workspace/SettingsDb.js.map +1 -1
  140. package/lib/cjs/workspace/SettingsEditor.js.map +1 -1
  141. package/lib/cjs/workspace/SettingsSchemas.d.ts +5 -2
  142. package/lib/cjs/workspace/SettingsSchemas.d.ts.map +1 -1
  143. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  144. package/lib/cjs/workspace/Workspace.js.map +1 -1
  145. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
  146. package/lib/esm/BackendHubAccess.js.map +1 -1
  147. package/lib/esm/BackendLoggerCategory.js.map +1 -1
  148. package/lib/esm/BisCoreSchema.js.map +1 -1
  149. package/lib/esm/BlobContainerService.js.map +1 -1
  150. package/lib/esm/BriefcaseManager.js.map +1 -1
  151. package/lib/esm/CatalogDb.js.map +1 -1
  152. package/lib/esm/Category.js.map +1 -1
  153. package/lib/esm/ChangeSummaryManager.js +2 -2
  154. package/lib/esm/ChangeSummaryManager.js.map +1 -1
  155. package/lib/esm/ChangedElementsDb.js.map +1 -1
  156. package/lib/esm/ChangesetECAdaptor.js +248 -248
  157. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  158. package/lib/esm/ChangesetReader.d.ts +84 -1
  159. package/lib/esm/ChangesetReader.d.ts.map +1 -1
  160. package/lib/esm/ChangesetReader.js +108 -12
  161. package/lib/esm/ChangesetReader.js.map +1 -1
  162. package/lib/esm/ChangesetReaderTypes.js.map +1 -1
  163. package/lib/esm/ChannelControl.js.map +1 -1
  164. package/lib/esm/CheckpointManager.js.map +1 -1
  165. package/lib/esm/ClassRegistry.js +5 -5
  166. package/lib/esm/ClassRegistry.js.map +1 -1
  167. package/lib/esm/CloudSqlite.js.map +1 -1
  168. package/lib/esm/CodeService.js.map +1 -1
  169. package/lib/esm/CodeSpecs.js.map +1 -1
  170. package/lib/esm/ConcurrentQuery.js.map +1 -1
  171. package/lib/esm/CustomViewState3dCreator.js.map +1 -1
  172. package/lib/esm/DevTools.js.map +1 -1
  173. package/lib/esm/DisplayStyle.js.map +1 -1
  174. package/lib/esm/ECDb.js.map +1 -1
  175. package/lib/esm/ECSchemaXmlContext.js.map +1 -1
  176. package/lib/esm/ECSqlRowExecutor.js.map +1 -1
  177. package/lib/esm/ECSqlStatement.js.map +1 -1
  178. package/lib/esm/ECSqlSyncReader.js.map +1 -1
  179. package/lib/esm/EditTxn.js.map +1 -1
  180. package/lib/esm/Element.js.map +1 -1
  181. package/lib/esm/ElementAspect.js.map +1 -1
  182. package/lib/esm/ElementGraphics.js.map +1 -1
  183. package/lib/esm/ElementTreeWalker.js.map +1 -1
  184. package/lib/esm/Entity.js.map +1 -1
  185. package/lib/esm/EntityReferences.js.map +1 -1
  186. package/lib/esm/ExportGraphics.js.map +1 -1
  187. package/lib/esm/ExternalSource.js.map +1 -1
  188. package/lib/esm/FontFile.js.map +1 -1
  189. package/lib/esm/GeoCoordConfig.js.map +1 -1
  190. package/lib/esm/GeographicCRSServices.js.map +1 -1
  191. package/lib/esm/GeometrySummary.js +47 -47
  192. package/lib/esm/GeometrySummary.js.map +1 -1
  193. package/lib/esm/IModelDb.js +8 -8
  194. package/lib/esm/IModelDb.js.map +1 -1
  195. package/lib/esm/IModelDbFonts.js.map +1 -1
  196. package/lib/esm/IModelElementCloneContext.js.map +1 -1
  197. package/lib/esm/IModelHost.js.map +1 -1
  198. package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -1
  199. package/lib/esm/IModelJsFs.js.map +1 -1
  200. package/lib/esm/ImageSourceConversion.js.map +1 -1
  201. package/lib/esm/IpcHost.js.map +1 -1
  202. package/lib/esm/LineStyle.js.map +1 -1
  203. package/lib/esm/LocalHub.js +1 -1
  204. package/lib/esm/LocalHub.js.map +1 -1
  205. package/lib/esm/LocalhostIpcHost.js.map +1 -1
  206. package/lib/esm/LockControl.js.map +1 -1
  207. package/lib/esm/Material.js.map +1 -1
  208. package/lib/esm/Model.js.map +1 -1
  209. package/lib/esm/NativeAppStorage.js.map +1 -1
  210. package/lib/esm/NativeHost.js.map +1 -1
  211. package/lib/esm/NavigationRelationship.js.map +1 -1
  212. package/lib/esm/PartialChangeUnifier.js +7 -7
  213. package/lib/esm/PartialChangeUnifier.js.map +1 -1
  214. package/lib/esm/PromiseMemoizer.js.map +1 -1
  215. package/lib/esm/PropertyStore.js.map +1 -1
  216. package/lib/esm/Relationship.js.map +1 -1
  217. package/lib/esm/RpcBackend.js.map +1 -1
  218. package/lib/esm/SQLiteDb.js.map +1 -1
  219. package/lib/esm/Schema.js.map +1 -1
  220. package/lib/esm/SchemaSync.js.map +1 -1
  221. package/lib/esm/SchemaUtils.js.map +1 -1
  222. package/lib/esm/SheetIndex.js.map +1 -1
  223. package/lib/esm/SqliteChangesetReader.js.map +1 -1
  224. package/lib/esm/SqliteStatement.js.map +1 -1
  225. package/lib/esm/StashManager.js.map +1 -1
  226. package/lib/esm/Texture.js.map +1 -1
  227. package/lib/esm/TileStorage.js.map +1 -1
  228. package/lib/esm/TxnManager.d.ts.map +1 -1
  229. package/lib/esm/TxnManager.js +7 -0
  230. package/lib/esm/TxnManager.js.map +1 -1
  231. package/lib/esm/ViewDefinition.js.map +1 -1
  232. package/lib/esm/ViewStateHydrator.js.map +1 -1
  233. package/lib/esm/ViewStore.js.map +1 -1
  234. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  235. package/lib/esm/annotations/FrameGeometry.js.map +1 -1
  236. package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
  237. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  238. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
  239. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -1
  240. package/lib/esm/annotations/TextBlockLayout.js.map +1 -1
  241. package/lib/esm/core-backend.js.map +1 -1
  242. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  243. package/lib/esm/domains/FunctionalSchema.js.map +1 -1
  244. package/lib/esm/domains/GenericElements.js.map +1 -1
  245. package/lib/esm/domains/GenericSchema.js.map +1 -1
  246. package/lib/esm/internal/ChangesetConflictArgs.js.map +1 -1
  247. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  248. package/lib/esm/internal/ElementLRUCache.js.map +1 -1
  249. package/lib/esm/internal/FontFileImpl.js.map +1 -1
  250. package/lib/esm/internal/HubMock.js.map +1 -1
  251. package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -1
  252. package/lib/esm/internal/IntegrityCheck.js.map +1 -1
  253. package/lib/esm/internal/NativePlatform.js.map +1 -1
  254. package/lib/esm/internal/NoLocks.js.map +1 -1
  255. package/lib/esm/internal/OnlineStatus.js.map +1 -1
  256. package/lib/esm/internal/ServerBasedLocks.js +33 -33
  257. package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
  258. package/lib/esm/internal/Symbols.js.map +1 -1
  259. package/lib/esm/internal/annotations/fields.js.map +1 -1
  260. package/lib/esm/internal/cross-package.js.map +1 -1
  261. package/lib/esm/internal/workspace/SettingsEditorImpl.js.map +1 -1
  262. package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
  263. package/lib/esm/internal/workspace/SettingsSchemasImpl.d.ts.map +1 -1
  264. package/lib/esm/internal/workspace/SettingsSchemasImpl.js +1 -0
  265. package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  266. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  267. package/lib/esm/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  268. package/lib/esm/rpc/multipart.js.map +1 -1
  269. package/lib/esm/rpc/tracing.js.map +1 -1
  270. package/lib/esm/rpc/web/logging.js.map +1 -1
  271. package/lib/esm/rpc/web/request.js.map +1 -1
  272. package/lib/esm/rpc/web/response.js.map +1 -1
  273. package/lib/esm/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  274. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  275. package/lib/esm/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  276. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  277. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  278. package/lib/esm/test/AdvancedEqual.js.map +1 -1
  279. package/lib/esm/test/AnnotationTestUtils.js.map +1 -1
  280. package/lib/esm/test/AttachDb.test.js +11 -11
  281. package/lib/esm/test/AttachDb.test.js.map +1 -1
  282. package/lib/esm/test/ElementDrivesElement.test.js +23 -23
  283. package/lib/esm/test/ElementDrivesElement.test.js.map +1 -1
  284. package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
  285. package/lib/esm/test/GeometryTestUtil.js.map +1 -1
  286. package/lib/esm/test/IModelHost.test.js.map +1 -1
  287. package/lib/esm/test/IModelTestUtils.js.map +1 -1
  288. package/lib/esm/test/ImageSourceConversion.test.js.map +1 -1
  289. package/lib/esm/test/IpcHost.test.js.map +1 -1
  290. package/lib/esm/test/KnownTestLocations.js.map +1 -1
  291. package/lib/esm/test/PrintElementTree.js.map +1 -1
  292. package/lib/esm/test/PropertyDb.test.js.map +1 -1
  293. package/lib/esm/test/RevisionUtility.js.map +1 -1
  294. package/lib/esm/test/SchemaChangesetCanBeReversed.test.js +51 -51
  295. package/lib/esm/test/SchemaChangesetCanBeReversed.test.js.map +1 -1
  296. package/lib/esm/test/SchemaUtils.test.js +25 -25
  297. package/lib/esm/test/SchemaUtils.test.js.map +1 -1
  298. package/lib/esm/test/SequentialLogMatcher.js.map +1 -1
  299. package/lib/esm/test/SquashSchemaAndDataChanges.test.js +129 -129
  300. package/lib/esm/test/SquashSchemaAndDataChanges.test.js.map +1 -1
  301. package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
  302. package/lib/esm/test/TestEditTxn.js.map +1 -1
  303. package/lib/esm/test/TestUtils.js.map +1 -1
  304. package/lib/esm/test/annotations/Fields.test.js +53 -53
  305. package/lib/esm/test/annotations/Fields.test.js.map +1 -1
  306. package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -1
  307. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
  308. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  309. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
  310. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js.map +1 -1
  311. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
  312. package/lib/esm/test/categories/Category.test.js.map +1 -1
  313. package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
  314. package/lib/esm/test/ecdb/CTE.test.js +88 -88
  315. package/lib/esm/test/ecdb/CTE.test.js.map +1 -1
  316. package/lib/esm/test/ecdb/ConcurrentQuery.test.js +19 -19
  317. package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -1
  318. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +15 -15
  319. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
  320. package/lib/esm/test/ecdb/ECDb.test.js +72 -72
  321. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  322. package/lib/esm/test/ecdb/ECDbTestHelper.js.map +1 -1
  323. package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -1
  324. package/lib/esm/test/ecdb/ECSqlAst.test.js +65 -65
  325. package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
  326. package/lib/esm/test/ecdb/ECSqlQuery.test.js +4 -4
  327. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  328. package/lib/esm/test/ecdb/ECSqlStatement.test.js +332 -332
  329. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  330. package/lib/esm/test/ecdb/ECSqlSyncReader.test.js.map +1 -1
  331. package/lib/esm/test/ecdb/QueryReaders.test.js +31 -31
  332. package/lib/esm/test/ecdb/QueryReaders.test.js.map +1 -1
  333. package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
  334. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
  335. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +21 -21
  336. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
  337. package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
  338. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  339. package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
  340. package/lib/esm/test/element/ElementAspect.test.js +22 -22
  341. package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
  342. package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
  343. package/lib/esm/test/element/ElementRoundTrip.test.js +139 -139
  344. package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
  345. package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
  346. package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
  347. package/lib/esm/test/element/NullStructArray.test.js +13 -13
  348. package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
  349. package/lib/esm/test/element/ProjectInformationRecord.test.js.map +1 -1
  350. package/lib/esm/test/element/SheetInformationAspect.test.js.map +1 -1
  351. package/lib/esm/test/element/UrlLink.test.js.map +1 -1
  352. package/lib/esm/test/font/FontFile.test.js.map +1 -1
  353. package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
  354. package/lib/esm/test/hubaccess/ApplyChangeset.test.js +32 -32
  355. package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -1
  356. package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
  357. package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
  358. package/lib/esm/test/hubaccess/Rebase.test.js +56 -56
  359. package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
  360. package/lib/esm/test/hubaccess/SemanticRebase.test.js +345 -345
  361. package/lib/esm/test/hubaccess/SemanticRebase.test.js.map +1 -1
  362. package/lib/esm/test/imageData.js.map +1 -1
  363. package/lib/esm/test/imodel/Code.test.js.map +1 -1
  364. package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
  365. package/lib/esm/test/imodel/GetTextureImage.test.js.map +1 -1
  366. package/lib/esm/test/imodel/IModel.test.js +44 -44
  367. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  368. package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
  369. package/lib/esm/test/imodel/SchemaXmlImport.test.js +21 -21
  370. package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
  371. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
  372. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
  373. package/lib/esm/test/incrementalSchemaLocater/TestContext.js.map +1 -1
  374. package/lib/esm/test/index.js.map +1 -1
  375. package/lib/esm/test/misc/DevTools.test.js.map +1 -1
  376. package/lib/esm/test/misc/EntitySubClasses.test.js.map +1 -1
  377. package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
  378. package/lib/esm/test/misc/PromiseMemoizer.test.js.map +1 -1
  379. package/lib/esm/test/native/DgnDbWorker.test.js.map +1 -1
  380. package/lib/esm/test/rpc/response.test.js.map +1 -1
  381. package/lib/esm/test/schema/ClassRegistry.test.js +99 -99
  382. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  383. package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
  384. package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
  385. package/lib/esm/test/schema/IModelSchemaContext.test.js +9 -9
  386. package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
  387. package/lib/esm/test/schema/SchemaImportCallbacks.test.js +19 -19
  388. package/lib/esm/test/schema/SchemaImportCallbacks.test.js.map +1 -1
  389. package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
  390. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  391. package/lib/esm/test/standalone/ChangesetReader.test.js +1191 -583
  392. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  393. package/lib/esm/test/standalone/CustomViewState3dCreator.test.js.map +1 -1
  394. package/lib/esm/test/standalone/DeleteElements.test.js.map +1 -1
  395. package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
  396. package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
  397. package/lib/esm/test/standalone/EditTxn.test.js.map +1 -1
  398. package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
  399. package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
  400. package/lib/esm/test/standalone/ExportGraphics.test.js +14 -14
  401. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  402. package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
  403. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  404. package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
  405. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -1
  406. package/lib/esm/test/standalone/IModelWrite.test.js +27 -27
  407. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  408. package/lib/esm/test/standalone/ITwinWorkspace.test.js.map +1 -1
  409. package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
  410. package/lib/esm/test/standalone/IntegrityCheck.test.js.map +1 -1
  411. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  412. package/lib/esm/test/standalone/NativeAppStorage.test.js.map +1 -1
  413. package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
  414. package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
  415. package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
  416. package/lib/esm/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.js +135 -135
  417. package/lib/esm/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.js.map +1 -1
  418. package/lib/esm/test/standalone/SchemaUtils.test.js.map +1 -1
  419. package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
  420. package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
  421. package/lib/esm/test/standalone/Setting.test.js.map +1 -1
  422. package/lib/esm/test/standalone/Settings.test.js +2 -0
  423. package/lib/esm/test/standalone/Settings.test.js.map +1 -1
  424. package/lib/esm/test/standalone/SettingsSchemas.test.js +15 -0
  425. package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
  426. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  427. package/lib/esm/test/standalone/StandaloneDb.test.js +20 -20
  428. package/lib/esm/test/standalone/StandaloneDb.test.js.map +1 -1
  429. package/lib/esm/test/standalone/Texture.test.js.map +1 -1
  430. package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
  431. package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
  432. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  433. package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
  434. package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -1
  435. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  436. package/lib/esm/test/standalone/iModelDb.test.js.map +1 -1
  437. package/lib/esm/test/workspace/SettingsDb.test.js.map +1 -1
  438. package/lib/esm/workspace/Settings.js.map +1 -1
  439. package/lib/esm/workspace/SettingsDb.js.map +1 -1
  440. package/lib/esm/workspace/SettingsEditor.js.map +1 -1
  441. package/lib/esm/workspace/SettingsSchemas.d.ts +5 -2
  442. package/lib/esm/workspace/SettingsSchemas.d.ts.map +1 -1
  443. package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
  444. package/lib/esm/workspace/Workspace.js.map +1 -1
  445. package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
  446. package/package.json +14 -14
@@ -29,6 +29,7 @@ import { PropertyFilter } from "./ChangesetReaderTypes";
29
29
  * @beta
30
30
  */
31
31
  export class ChangesetReader {
32
+ static defaultSpillThresholdInBytes = 50 * 1024 * 1024; // 50 MiB
32
33
  _nativeReader = new IModelNative.platform.ChangesetReader();
33
34
  // Internal options — keep ECClassId as raw Id so the unifier can use it as-is.
34
35
  _rowOptions;
@@ -43,6 +44,7 @@ export class ChangesetReader {
43
44
  /**
44
45
  * `true` when the current row belongs to an EC-mapped table.
45
46
  * Valid only after a successful call to [[step]].
47
+ * @throws [[IModelError]] if called before a successful [[step]] call.
46
48
  * @beta
47
49
  */
48
50
  get isECTable() {
@@ -53,6 +55,7 @@ export class ChangesetReader {
53
55
  /**
54
56
  * Name of the SQLite table for the current change row.
55
57
  * Valid only after a successful call to [[step]].
58
+ * @throws [[IModelError]] if called before a successful [[step]] call.
56
59
  * @beta
57
60
  */
58
61
  get tableName() {
@@ -63,6 +66,7 @@ export class ChangesetReader {
63
66
  /**
64
67
  * `true` when the current change was applied indirectly
65
68
  * Valid only after a successful call to [[step]].
69
+ * @throws [[IModelError]] if called before a successful [[step]] call.
66
70
  * @beta
67
71
  */
68
72
  get isIndirectChange() {
@@ -105,6 +109,7 @@ export class ChangesetReader {
105
109
  * @param args.invert When `true`, invert all operations (Insert↔Delete).
106
110
  * @param args.valueOptions Row adaptor options controlling how EC property values are formatted.
107
111
  * @param args.propFilter Controls which properties are included. Defaults to `All`.
112
+ * @throws if the native layer fails to open the file.
108
113
  * @beta
109
114
  */
110
115
  static openFile(args) {
@@ -116,7 +121,7 @@ export class ChangesetReader {
116
121
  reader._nativeReader.openFile(args.db[_nativeDb], args.fileName, args.invert ?? false, reader._propFilter);
117
122
  }
118
123
  catch (e) {
119
- reader.close();
124
+ reader.handleCloseErrorWhileOpening(e);
120
125
  throw e;
121
126
  }
122
127
  return reader;
@@ -127,20 +132,26 @@ export class ChangesetReader {
127
132
  * @param args.db Database with schema at or ahead of the last changeset.
128
133
  * @param args.valueOptions Row adaptor options controlling how EC property values are formatted.
129
134
  * @param args.propFilter Controls which properties are included. Defaults to `All`.
135
+ * @param args.spillThresholdInBytes When the total size of the changeset data in the change group exceeds this threshold (in bytes),
136
+ * the reader writes the data to a temporary file on disk and streams it from there instead of buffering everything in memory.
137
+ * This keeps peak memory usage bounded, making the API suitable for processing large changeset groups under low-memory conditions.
138
+ * Defaults to 50 MiB.
139
+ * @throws if `changesetFiles` is empty, or if the native layer fails to open
140
+ * the group.
130
141
  * @beta
131
142
  */
132
143
  static openGroup(args) {
133
144
  if (args.changesetFiles.length === 0)
134
- throw new Error("changesetFiles must contain at least one file.");
145
+ throw new IModelError(IModelStatus.BadArg, "changesetFiles must contain at least one file.");
135
146
  const reader = new ChangesetReader(args.db);
136
147
  reader._rowOptions = args.rowOptions;
137
148
  const propFilter = args.propFilter ?? PropertyFilter.All;
138
149
  reader._propFilter = propFilter;
139
150
  try {
140
- reader._nativeReader.openGroup(args.db[_nativeDb], args.changesetFiles, args.invert ?? false, reader._propFilter);
151
+ reader._nativeReader.openGroup(args.db[_nativeDb], args.changesetFiles, args.invert ?? false, reader._propFilter, args.spillThresholdInBytes ?? this.defaultSpillThresholdInBytes);
141
152
  }
142
153
  catch (e) {
143
- reader.close();
154
+ reader.handleCloseErrorWhileOpening(e);
144
155
  throw e;
145
156
  }
146
157
  return reader;
@@ -151,6 +162,12 @@ export class ChangesetReader {
151
162
  * @param args.includeInMemoryChanges Also include in-memory (not yet saved to disk) changes.
152
163
  * @param args.valueOptions Row adaptor options controlling how EC property values are formatted.
153
164
  * @param args.propFilter Controls which properties are included. Defaults to `All`.
165
+ * @param args.spillThresholdInBytes When the total size of all local un-pushed saved changes exceeds this threshold (in bytes),
166
+ * the reader writes the data to a temporary file on disk and streams it from there instead of buffering everything in memory.
167
+ * This keeps peak memory usage bounded, making the API suitable for iModels with large local change backlogs under low-memory conditions.
168
+ * Defaults to 50 MiB.
169
+ * @throws if the native layer
170
+ * fails to open the local changes.
154
171
  * @beta
155
172
  */
156
173
  static openLocalChanges(args) {
@@ -159,10 +176,10 @@ export class ChangesetReader {
159
176
  const propFilter = args.propFilter ?? PropertyFilter.All;
160
177
  reader._propFilter = propFilter;
161
178
  try {
162
- reader._nativeReader.openLocalChanges(args.db[_nativeDb], args.includeInMemoryChanges ?? false, args.invert ?? false, reader._propFilter);
179
+ reader._nativeReader.openLocalChanges(args.db[_nativeDb], args.includeInMemoryChanges ?? false, args.invert ?? false, reader._propFilter, args.spillThresholdInBytes ?? this.defaultSpillThresholdInBytes);
163
180
  }
164
181
  catch (e) {
165
- reader.close();
182
+ reader.handleCloseErrorWhileOpening(e);
166
183
  throw e;
167
184
  }
168
185
  return reader;
@@ -172,6 +189,11 @@ export class ChangesetReader {
172
189
  * @param args.db Must be an [IModelDb]($backend).
173
190
  * @param args.valueOptions Row adaptor options controlling how EC property values are formatted.
174
191
  * @param args.propFilter Controls which properties are included. Defaults to `All`.
192
+ * @param args.spillThresholdInBytes When the total size of the in-memory (unsaved) change data exceeds this threshold (in bytes),
193
+ * the reader writes the data to a temporary file on disk and streams it from there instead of buffering everything in memory.
194
+ * This keeps peak memory usage bounded, making the API suitable for large in-memory transactions under low-memory conditions.
195
+ * Defaults to 50 MiB.
196
+ * @throws if the native layer encounters an error while opening the in-memory changes.
175
197
  * @beta
176
198
  */
177
199
  static openInMemoryChanges(args) {
@@ -180,10 +202,10 @@ export class ChangesetReader {
180
202
  const propFilter = args.propFilter ?? PropertyFilter.All;
181
203
  reader._propFilter = propFilter;
182
204
  try {
183
- reader._nativeReader.openInMemoryChanges(args.db[_nativeDb], args.invert ?? false, reader._propFilter);
205
+ reader._nativeReader.openInMemoryChanges(args.db[_nativeDb], args.invert ?? false, reader._propFilter, args.spillThresholdInBytes ?? this.defaultSpillThresholdInBytes);
184
206
  }
185
207
  catch (e) {
186
- reader.close();
208
+ reader.handleCloseErrorWhileOpening(e);
187
209
  throw e;
188
210
  }
189
211
  return reader;
@@ -194,22 +216,40 @@ export class ChangesetReader {
194
216
  * @param args.txnId The id of the saved transaction to read.
195
217
  * @param args.valueOptions Row adaptor options controlling how EC property values are formatted.
196
218
  * @param args.propFilter Controls which properties are included. Defaults to `All`.
219
+ * @param args.spillThresholdInBytes When the total size of the transaction's change data exceeds this threshold (in bytes),
220
+ * the reader writes the data to a temporary file on disk and streams it from there instead of buffering everything in memory.
221
+ * This keeps peak memory usage bounded, making the API suitable for large transactions under low-memory conditions.
222
+ * Defaults to 50 MiB.
223
+ * @throws if `txnId` is not found, or
224
+ * the native layer fails to open the transaction data.
197
225
  * @beta
198
226
  */
199
227
  static openTxn(args) {
200
228
  const reader = new ChangesetReader(args.db);
201
- reader._rowOptions = args.rowOptions ?? {};
229
+ reader._rowOptions = args.rowOptions;
202
230
  const propFilter = args.propFilter ?? PropertyFilter.All;
203
231
  reader._propFilter = propFilter;
204
232
  try {
205
- reader._nativeReader.openTxn(args.db[_nativeDb], args.txnId, args.invert ?? false, reader._propFilter);
233
+ reader._nativeReader.openTxn(args.db[_nativeDb], args.txnId, args.invert ?? false, reader._propFilter, args.spillThresholdInBytes ?? this.defaultSpillThresholdInBytes);
206
234
  }
207
235
  catch (e) {
208
- reader.close();
236
+ reader.handleCloseErrorWhileOpening(e);
209
237
  throw e;
210
238
  }
211
239
  return reader;
212
240
  }
241
+ /** Handle errors that occur while auto closing the reader if there is also an error while opening the reader */
242
+ handleCloseErrorWhileOpening(e) {
243
+ try {
244
+ this.close();
245
+ }
246
+ catch (closeError) {
247
+ throw new IModelError(IModelStatus.BadArg, `Failed to open ChangesetReader with error ${e instanceof Error ? e.message : String(e)}.
248
+ Additionally, that triggered an automatic closure of the reader
249
+ releasing native resources which also failed with failure ${closeError instanceof Error ? closeError.message : String(closeError)}.
250
+ Check native error logs for more details.`);
251
+ }
252
+ }
213
253
  // ---------------------------------------------------------------------------
214
254
  // Filtering
215
255
  // ---------------------------------------------------------------------------
@@ -218,6 +258,7 @@ export class ChangesetReader {
218
258
  * That means the rows for changes from other tables will be skipped entirely and won't be visible through the reader.
219
259
  * @param tableNames SQLite table names to include.
220
260
  * Note: Table names must be provided in the correct case for proper filtering.
261
+ * @throws [[IModelError]] if the native layer encounters an error while setting the filter.
221
262
  * @beta
222
263
  */
223
264
  setTableNameFilters(tableNames) {
@@ -227,6 +268,7 @@ export class ChangesetReader {
227
268
  * Restrict iteration to changes with the given operation types.
228
269
  * That means the rows for changes with other operation types will be skipped entirely and won't be visible through the reader.
229
270
  * @param ops Operations to include.
271
+ * @throws [[IModelError]] if the native layer encounters an error while setting the filter.
230
272
  * @beta
231
273
  */
232
274
  setOpCodeFilters(ops) {
@@ -237,6 +279,7 @@ export class ChangesetReader {
237
279
  * That means the rows for changes from other EC classes will be skipped entirely and won't be visible through the reader.
238
280
  * @param classNames EC class names to include. The classNames should be in the full name format(i.e. "SchemaName:ClassName").
239
281
  * Note: Schema names and class names must be provided in the correct case for proper filtering. Derived classes are not automatically included, so they must be specified explicitly if needed.
282
+ * @throws if the native layer encounters an error while setting the filter.
240
283
  * @beta
241
284
  */
242
285
  setClassNameFilters(classNames) {
@@ -244,6 +287,7 @@ export class ChangesetReader {
244
287
  }
245
288
  /**
246
289
  * Remove the table-name filters
290
+ * @throws if the native layer encounters an error.
247
291
  * @beta
248
292
  */
249
293
  clearTableNameFilters() {
@@ -251,6 +295,7 @@ export class ChangesetReader {
251
295
  }
252
296
  /**
253
297
  * Remove the op-code filters
298
+ * @throws if the native layer encounters an error.
254
299
  * @beta
255
300
  */
256
301
  clearOpCodeFilters() {
@@ -258,17 +303,61 @@ export class ChangesetReader {
258
303
  }
259
304
  /**
260
305
  * Remove the class-name filters
306
+ * @throws if the native layer encounters an error.
261
307
  * @beta
262
308
  */
263
309
  clearClassNameFilters() {
264
310
  this._nativeReader.clearClassNameFilters();
265
311
  }
266
312
  // ---------------------------------------------------------------------------
313
+ // Strict mode
314
+ // ---------------------------------------------------------------------------
315
+ /**
316
+ * Enable strict mode on the reader.
317
+ *
318
+ * Strict mode affects how the reader handles a **column-count mismatch** between a change
319
+ * record and the corresponding live database table. Such a mismatch can occur when columns
320
+ * have been added to a table after the changeset was created.
321
+ *
322
+ * When strict mode is **enabled**: if the number of columns recorded in a change row differs
323
+ * from the number of columns currently present in the live table, the reader throws an error
324
+ * instead of processing that row.
325
+ *
326
+ * Use strict mode when you need to be certain that every change row is interpreted against
327
+ * exactly the schema that was in effect when the changeset was written.
328
+ *
329
+ * @see [[disableStrictMode]] — the default (lenient) behaviour.
330
+ * @throws if the native layer encounters an error.
331
+ * @beta
332
+ */
333
+ enableStrictMode() {
334
+ this._nativeReader.enableStrictMode();
335
+ }
336
+ /**
337
+ * Disable strict mode on the reader (this is the default).
338
+ *
339
+ * When strict mode is **disabled**: if the number of columns recorded in a change row differs
340
+ * from the number of columns currently present in the live table, the reader takes the
341
+ * **minimum** of the two column counts and proceeds normally with that subset. This is safe
342
+ * because SQLite only ever appends new columns at the end of a table and never removes them —
343
+ * so older change records simply lack the trailing columns that were added later, and those
344
+ * missing columns are silently ignored.
345
+ *
346
+ * @see [[enableStrictMode]] — throw on column-count mismatches instead.
347
+ * @throws if the native layer encounters an error.
348
+ * @beta
349
+ */
350
+ disableStrictMode() {
351
+ this._nativeReader.disableStrictMode();
352
+ }
353
+ // ---------------------------------------------------------------------------
267
354
  // Iteration
268
355
  // ---------------------------------------------------------------------------
269
356
  /**
270
357
  * Advance to the next change and populate `inserted` and/or `deleted`.
271
358
  * @returns `true` while positioned on a valid change; `false` when the stream is exhausted.
359
+ * @throws if the native layer encounters an error while reading or decoding
360
+ * the next change.
272
361
  * @beta
273
362
  */
274
363
  step() {
@@ -333,6 +422,7 @@ export class ChangesetReader {
333
422
  /**
334
423
  * SQLite opcode of the current change.
335
424
  * Valid only after a successful call to [[step]].
425
+ * @throws [[IModelError]] if called before a successful [[step]] call.
336
426
  * @beta
337
427
  */
338
428
  get op() {
@@ -345,6 +435,10 @@ export class ChangesetReader {
345
435
  // ---------------------------------------------------------------------------
346
436
  /**
347
437
  * Close the reader and release all native resources.
438
+ *
439
+ * @throws if the native layer encounters an error during cleanup. Native resources
440
+ * are not fully released when this throws — check the native error
441
+ * logs for details.
348
442
  * @beta
349
443
  */
350
444
  close() {
@@ -358,7 +452,9 @@ export class ChangesetReader {
358
452
  this._nativeReader.close();
359
453
  }
360
454
  /**
361
- * Implements the `Disposable` contract — calls [[close]].
455
+ * Implements the `Disposable` contract — delegates to [[close]].
456
+ *
457
+ * @throws if the native layer fails to release its resources (re-thrown from [[close]]).
362
458
  * @beta
363
459
  */
364
460
  [Symbol.dispose]() {
@@ -1 +1 @@
1
- {"version":3,"file":"ChangesetReader.js","sourceRoot":"","sources":["../../src/ChangesetReader.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAc,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAqD,cAAc,EAAoB,MAAM,wBAAwB,CAAC;AAI7H,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,eAAe;IACT,aAAa,GAAmC,IAAI,YAAY,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC;IAC7G,+EAA+E;IACvE,WAAW,CAAoB;IAC/B,WAAW,GAAmB,cAAc,CAAC,GAAG,CAAC;IACjD,YAAY,GAAG,CAAC,CAAC;IACjB,GAAG,CAAkB;IACrB,UAAU,CAAW;IACrB,UAAU,CAAU;IACpB,iBAAiB,CAAW;IAEpC,4CAA4C;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ACvD,UAAU,EAAE,IAAI,CAAC,WAAW;4BAC5B,gBAAgB,EAAE,IAAI,CAAC,iBAAiB;yBACzC;qBACF,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;OAIG;IACH,IAAW,EAAE;QACX,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS;YACxB,MAAM,IAAI,WAAW,CAAC,YAAY,CAAC,UAAU,EAAE,oGAAoG,CAAC,CAAC;QACvJ,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED,8EAA8E;IAC9E,YAAY;IACZ,8EAA8E;IAE9E;;;OAGG;IACI,KAAK;QACV,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,CAAC,MAAM,CAAC,OAAO,CAAC;QACrB,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ECDb\r\n */\r\nimport { DbChangeStage, DbOpcode, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { IModelError } from \"@itwin/core-common\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { IModelNative } from \"./internal/NativePlatform\";\r\nimport { _nativeDb } from \"./internal/Symbols\";\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { ChangeInstance, ChangesetReaderArgs, ChangeSource, PropertyFilter, RowFormatOptions } from \"./ChangesetReaderTypes\";\r\nimport { AnyDb, SqliteChangeOp } from \"./SqliteChangesetReader\";\r\n\r\n\r\n// ---------------------------------------------------------------------------\r\n// ChangesetReader\r\n// ---------------------------------------------------------------------------\r\n\r\n/**\r\n * Reads EC-typed changeset data natively from a changeset file, changeset group,\r\n * in-memory transaction, or local un-pushed changes.\r\n *\r\n * Implements [ChangeSource]($backend) so rows can be fed directly into\r\n * [PartialChangeUnifier]($backend) to merge partial (per-table) instances into\r\n * complete EC instances.\r\n *\r\n * When the current row is a non-EC internal SQLite table, [[isECTable]] is `false`\r\n * and both [[inserted]] and [[deleted]] remain `undefined`.\r\n *\r\n * @note The native reader operates one SQLite table-row at a time. Multi-table EC\r\n * instances must be merged using [PartialChangeUnifier]($backend).\r\n * @beta\r\n */\r\nexport class ChangesetReader implements Disposable, ChangeSource {\r\n private readonly _nativeReader: IModelJsNative.ChangesetReader = new IModelNative.platform.ChangesetReader();\r\n // Internal options — keep ECClassId as raw Id so the unifier can use it as-is.\r\n private _rowOptions?: RowFormatOptions;\r\n private _propFilter: PropertyFilter = PropertyFilter.All;\r\n private _changeIndex = 0;\r\n private _op?: SqliteChangeOp;\r\n private _isECTable?: boolean;\r\n private _tableName?: string;\r\n private _isIndirectChange?: boolean;\r\n\r\n /** The db used for EC schema resolution. */\r\n public readonly db: AnyDb;\r\n\r\n /**\r\n * `true` when the current row belongs to an EC-mapped table.\r\n * Valid only after a successful call to [[step]].\r\n * @beta\r\n */\r\n public get isECTable(): boolean {\r\n if (this._isECTable === undefined)\r\n throw new IModelError(IModelStatus.BadRequest, \"ChangesetReader.isECTable is only valid after step() has positioned the reader on a current valid change.\");\r\n return this._isECTable;\r\n }\r\n\r\n /**\r\n * Name of the SQLite table for the current change row.\r\n * Valid only after a successful call to [[step]].\r\n * @beta\r\n */\r\n public get tableName(): string {\r\n if (this._tableName === undefined)\r\n throw new IModelError(IModelStatus.BadRequest, \"ChangesetReader.tableName is only valid after step() has positioned the reader on a current valid change.\");\r\n return this._tableName;\r\n }\r\n\r\n /**\r\n * `true` when the current change was applied indirectly\r\n * Valid only after a successful call to [[step]].\r\n * @beta\r\n */\r\n public get isIndirectChange(): boolean {\r\n if (this._isIndirectChange === undefined)\r\n throw new IModelError(IModelStatus.BadRequest, \"ChangesetReader.isIndirectChange is only valid after step() has positioned the reader on a current valid change.\");\r\n return this._isIndirectChange;\r\n }\r\n\r\n /**\r\n * Post-change (inserted or updated-new) EC instance, populated after each [[step]] call.\r\n * `undefined` when the current row is a Delete or a non-EC table row or [[step]] returned false.\r\n * @beta\r\n */\r\n public inserted?: ChangeInstance;\r\n\r\n /**\r\n * Pre-change (deleted or updated-old) EC instance, populated after each [[step]] call.\r\n * `undefined` when the current row is an Insert or a non-EC table row or [[step]] returned false.\r\n * @beta\r\n */\r\n public deleted?: ChangeInstance;\r\n\r\n // Private — callers use static factory methods.\r\n private constructor(db: AnyDb) {\r\n this.db = db;\r\n }\r\n\r\n /** Map public RowFormatOptions to the native adaptor options.\r\n * @internal */\r\n private toNativeRowOptions(opts: RowFormatOptions): IModelJsNative.ECSqlRowAdaptorOptions {\r\n return {\r\n abbreviateBlobs: opts.abbreviateBlobs,\r\n classIdsToClassNames: opts.classIdsToClassNames,\r\n useJsName: opts.useJsName,\r\n };\r\n }\r\n\r\n // ---------------------------------------------------------------------------\r\n // Static factory methods\r\n // ---------------------------------------------------------------------------\r\n\r\n /**\r\n * Open a changeset file from disk.\r\n * @param args.fileName Absolute path to the changeset file.\r\n * @param args.db Database at or after the changeset's ending state, used for schema resolution.\r\n * @param args.invert When `true`, invert all operations (Insert↔Delete).\r\n * @param args.valueOptions Row adaptor options controlling how EC property values are formatted.\r\n * @param args.propFilter Controls which properties are included. Defaults to `All`.\r\n * @beta\r\n */\r\n public static openFile(args: { readonly fileName: string } & ChangesetReaderArgs): ChangesetReader {\r\n const reader = new ChangesetReader(args.db);\r\n reader._rowOptions = args.rowOptions;\r\n const propFilter = args.propFilter ?? PropertyFilter.All;\r\n reader._propFilter = propFilter;\r\n try {\r\n reader._nativeReader.openFile(args.db[_nativeDb], args.fileName, args.invert ?? false, reader._propFilter);\r\n }\r\n catch (e) {\r\n reader.close();\r\n throw e;\r\n }\r\n return reader;\r\n }\r\n\r\n /**\r\n * Concatenate multiple changeset files and read them as a single logical stream.\r\n * @param args.changesetFiles Ordered list of changeset file paths.\r\n * @param args.db Database with schema at or ahead of the last changeset.\r\n * @param args.valueOptions Row adaptor options controlling how EC property values are formatted.\r\n * @param args.propFilter Controls which properties are included. Defaults to `All`.\r\n * @beta\r\n */\r\n public static openGroup(args: { readonly changesetFiles: string[] } & ChangesetReaderArgs): ChangesetReader {\r\n if (args.changesetFiles.length === 0)\r\n throw new Error(\"changesetFiles must contain at least one file.\");\r\n const reader = new ChangesetReader(args.db);\r\n reader._rowOptions = args.rowOptions;\r\n const propFilter = args.propFilter ?? PropertyFilter.All;\r\n reader._propFilter = propFilter;\r\n try {\r\n reader._nativeReader.openGroup(args.db[_nativeDb], args.changesetFiles, args.invert ?? false, reader._propFilter);\r\n }\r\n catch (e) {\r\n reader.close();\r\n throw e;\r\n }\r\n return reader;\r\n }\r\n\r\n /**\r\n * Read pending (not yet pushed) local changes from an open IModelDb.\r\n * @param args.db Must be an [IModelDb]($backend) (not [ECDb]($backend)).\r\n * @param args.includeInMemoryChanges Also include in-memory (not yet saved to disk) changes.\r\n * @param args.valueOptions Row adaptor options controlling how EC property values are formatted.\r\n * @param args.propFilter Controls which properties are included. Defaults to `All`.\r\n * @beta\r\n */\r\n public static openLocalChanges(\r\n args: Omit<ChangesetReaderArgs, \"db\"> & { db: IModelDb; includeInMemoryChanges?: boolean },\r\n ): ChangesetReader {\r\n const reader = new ChangesetReader(args.db);\r\n reader._rowOptions = args.rowOptions;\r\n const propFilter = args.propFilter ?? PropertyFilter.All;\r\n reader._propFilter = propFilter;\r\n try {\r\n reader._nativeReader.openLocalChanges(args.db[_nativeDb], args.includeInMemoryChanges ?? false, args.invert ?? false, reader._propFilter);\r\n } catch (e) {\r\n reader.close();\r\n throw e;\r\n }\r\n return reader;\r\n }\r\n\r\n /**\r\n * Read the in-memory (not yet saved to disk) changes of an open IModelDb.\r\n * @param args.db Must be an [IModelDb]($backend).\r\n * @param args.valueOptions Row adaptor options controlling how EC property values are formatted.\r\n * @param args.propFilter Controls which properties are included. Defaults to `All`.\r\n * @beta\r\n */\r\n public static openInMemoryChanges(\r\n args: Omit<ChangesetReaderArgs, \"db\"> & { db: IModelDb },\r\n ): ChangesetReader {\r\n const reader = new ChangesetReader(args.db);\r\n reader._rowOptions = args.rowOptions;\r\n const propFilter = args.propFilter ?? PropertyFilter.All;\r\n reader._propFilter = propFilter;\r\n try {\r\n reader._nativeReader.openInMemoryChanges(args.db[_nativeDb], args.invert ?? false, reader._propFilter);\r\n } catch (e) {\r\n reader.close();\r\n throw e;\r\n }\r\n return reader;\r\n }\r\n\r\n /**\r\n * Read a single saved transaction by its id.\r\n * @param args.db Must be an [IModelDb]($backend) ([ECDb]($backend) does not support transactions).\r\n * @param args.txnId The id of the saved transaction to read.\r\n * @param args.valueOptions Row adaptor options controlling how EC property values are formatted.\r\n * @param args.propFilter Controls which properties are included. Defaults to `All`.\r\n * @beta\r\n */\r\n public static openTxn(\r\n args: Omit<ChangesetReaderArgs, \"db\"> & { db: IModelDb; txnId: Id64String },\r\n ): ChangesetReader {\r\n const reader = new ChangesetReader(args.db);\r\n reader._rowOptions = args.rowOptions ?? {};\r\n const propFilter = args.propFilter ?? PropertyFilter.All;\r\n reader._propFilter = propFilter;\r\n try {\r\n reader._nativeReader.openTxn(args.db[_nativeDb], args.txnId, args.invert ?? false, reader._propFilter);\r\n } catch (e) {\r\n reader.close();\r\n throw e;\r\n }\r\n return reader;\r\n }\r\n\r\n // ---------------------------------------------------------------------------\r\n // Filtering\r\n // ---------------------------------------------------------------------------\r\n\r\n /**\r\n * Restrict iteration to changes from the named SQLite tables.\r\n * That means the rows for changes from other tables will be skipped entirely and won't be visible through the reader.\r\n * @param tableNames SQLite table names to include.\r\n * Note: Table names must be provided in the correct case for proper filtering.\r\n * @beta\r\n */\r\n public setTableNameFilters(tableNames: Set<string>): void {\r\n this._nativeReader.setTableNameFilters(Array.from(tableNames));\r\n }\r\n\r\n /**\r\n * Restrict iteration to changes with the given operation types.\r\n * That means the rows for changes with other operation types will be skipped entirely and won't be visible through the reader.\r\n * @param ops Operations to include.\r\n * @beta\r\n */\r\n public setOpCodeFilters(ops: Set<SqliteChangeOp>): void {\r\n this._nativeReader.setOpCodeFilters(Array.from(ops));\r\n }\r\n\r\n /**\r\n * Restrict iteration to changes for the given EC class names.\r\n * That means the rows for changes from other EC classes will be skipped entirely and won't be visible through the reader.\r\n * @param classNames EC class names to include. The classNames should be in the full name format(i.e. \"SchemaName:ClassName\").\r\n * Note: Schema names and class names must be provided in the correct case for proper filtering. Derived classes are not automatically included, so they must be specified explicitly if needed.\r\n * @beta\r\n */\r\n public setClassNameFilters(classNames: Set<string>): void {\r\n this._nativeReader.setClassNameFilters(Array.from(classNames));\r\n }\r\n\r\n /**\r\n * Remove the table-name filters\r\n * @beta\r\n */\r\n public clearTableNameFilters(): void {\r\n this._nativeReader.clearTableNameFilters();\r\n }\r\n\r\n /**\r\n * Remove the op-code filters\r\n * @beta\r\n */\r\n public clearOpCodeFilters(): void {\r\n this._nativeReader.clearOpCodeFilters();\r\n }\r\n\r\n /**\r\n * Remove the class-name filters\r\n * @beta\r\n */\r\n public clearClassNameFilters(): void {\r\n this._nativeReader.clearClassNameFilters();\r\n }\r\n\r\n // ---------------------------------------------------------------------------\r\n // Iteration\r\n // ---------------------------------------------------------------------------\r\n\r\n /**\r\n * Advance to the next change and populate `inserted` and/or `deleted`.\r\n * @returns `true` while positioned on a valid change; `false` when the stream is exhausted.\r\n * @beta\r\n */\r\n public step(): boolean {\r\n this.inserted = undefined;\r\n this.deleted = undefined;\r\n this._op = undefined;\r\n this._isECTable = undefined;\r\n this._tableName = undefined;\r\n this._isIndirectChange = undefined;\r\n\r\n if (this._nativeReader.step()) {\r\n this._changeIndex++;\r\n const meta = this._nativeReader.getChangeMetadata();\r\n const nativeOp = meta.opCode;\r\n const op: SqliteChangeOp = nativeOp === DbOpcode.Insert ? \"Inserted\" : nativeOp === DbOpcode.Update ? \"Updated\" : \"Deleted\";\r\n this._op = op;\r\n\r\n this._tableName = meta.tableName;\r\n this._isIndirectChange = meta.isIndirectChange;\r\n this._isECTable = meta.isECTable;\r\n\r\n const nativeRowOpts = this._rowOptions ? this.toNativeRowOptions(this._rowOptions) : {};\r\n\r\n if (op === \"Inserted\" || op === \"Updated\") {\r\n const rowValue = this._nativeReader.getValue(DbChangeStage.New, nativeRowOpts);\r\n if (rowValue !== undefined) {\r\n this.inserted = {\r\n ...rowValue.data,\r\n $meta: {\r\n op,\r\n tables: [this._tableName],\r\n changeIndexes: [this._changeIndex],\r\n stage: \"New\",\r\n instanceKey: rowValue.key,\r\n propFilter: this._propFilter,\r\n changeFetchedPropNames: rowValue.changeFetchedPropNames,\r\n rowOptions: this._rowOptions,\r\n isIndirectChange: this._isIndirectChange,\r\n },\r\n };\r\n }\r\n }\r\n\r\n if (op === \"Deleted\" || op === \"Updated\") {\r\n const rowValue = this._nativeReader.getValue(DbChangeStage.Old, nativeRowOpts);\r\n if (rowValue !== undefined) {\r\n this.deleted = {\r\n ...rowValue.data,\r\n $meta: {\r\n op,\r\n tables: [this._tableName],\r\n changeIndexes: [this._changeIndex],\r\n stage: \"Old\",\r\n instanceKey: rowValue.key,\r\n propFilter: this._propFilter,\r\n changeFetchedPropNames: rowValue.changeFetchedPropNames,\r\n rowOptions: this._rowOptions,\r\n isIndirectChange: this._isIndirectChange,\r\n },\r\n };\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * SQLite opcode of the current change.\r\n * Valid only after a successful call to [[step]].\r\n * @beta\r\n */\r\n public get op(): SqliteChangeOp {\r\n if (this._op === undefined)\r\n throw new IModelError(IModelStatus.BadRequest, \"ChangesetReader.op is only valid after step() has positioned the reader on a current valid change.\");\r\n return this._op;\r\n }\r\n\r\n // ---------------------------------------------------------------------------\r\n // Lifecycle\r\n // ---------------------------------------------------------------------------\r\n\r\n /**\r\n * Close the reader and release all native resources.\r\n * @beta\r\n */\r\n public close(): void {\r\n this._changeIndex = 0;\r\n this._op = undefined;\r\n this._isECTable = undefined;\r\n this._tableName = undefined;\r\n this._isIndirectChange = undefined;\r\n this.inserted = undefined;\r\n this.deleted = undefined;\r\n this._nativeReader.close();\r\n }\r\n\r\n /**\r\n * Implements the `Disposable` contract — calls [[close]].\r\n * @beta\r\n */\r\n public [Symbol.dispose](): void {\r\n this.close();\r\n }\r\n}\r\n\r\n\r\n"]}
1
+ {"version":3,"file":"ChangesetReader.js","sourceRoot":"","sources":["../../src/ChangesetReader.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAc,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAqD,cAAc,EAAoB,MAAM,wBAAwB,CAAC;AAI7H,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,eAAe;IAClB,MAAM,CAAU,4BAA4B,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,SAAS;IACjE,aAAa,GAAmC,IAAI,YAAY,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC;IAC7G,+EAA+E;IACvE,WAAW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AI,CAAC,WAAW;4BAC5B,gBAAgB,EAAE,IAAI,CAAC,iBAAiB;yBACzC;qBACF,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACH,IAAW,EAAE;QACX,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS;YACxB,MAAM,IAAI,WAAW,CAAC,YAAY,CAAC,UAAU,EAAE,oGAAoG,CAAC,CAAC;QACvJ,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED,8EAA8E;IAC9E,YAAY;IACZ,8EAA8E;IAE9E;;;;;;;OAOG;IACI,KAAK;QACV,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACI,CAAC,MAAM,CAAC,OAAO,CAAC;QACrB,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ECDb\n */\nimport { DbChangeStage, DbOpcode, Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { IModelError } from \"@itwin/core-common\";\nimport { IModelDb } from \"./IModelDb\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { ChangeInstance, ChangesetReaderArgs, ChangeSource, PropertyFilter, RowFormatOptions } from \"./ChangesetReaderTypes\";\nimport { AnyDb, SqliteChangeOp } from \"./SqliteChangesetReader\";\n\n\n// ---------------------------------------------------------------------------\n// ChangesetReader\n// ---------------------------------------------------------------------------\n\n/**\n * Reads EC-typed changeset data natively from a changeset file, changeset group,\n * in-memory transaction, or local un-pushed changes.\n *\n * Implements [ChangeSource]($backend) so rows can be fed directly into\n * [PartialChangeUnifier]($backend) to merge partial (per-table) instances into\n * complete EC instances.\n *\n * When the current row is a non-EC internal SQLite table, [[isECTable]] is `false`\n * and both [[inserted]] and [[deleted]] remain `undefined`.\n *\n * @note The native reader operates one SQLite table-row at a time. Multi-table EC\n * instances must be merged using [PartialChangeUnifier]($backend).\n * @beta\n */\nexport class ChangesetReader implements Disposable, ChangeSource {\n private static readonly defaultSpillThresholdInBytes = 50 * 1024 * 1024; // 50 MiB\n private readonly _nativeReader: IModelJsNative.ChangesetReader = new IModelNative.platform.ChangesetReader();\n // Internal options — keep ECClassId as raw Id so the unifier can use it as-is.\n private _rowOptions?: RowFormatOptions;\n private _propFilter: PropertyFilter = PropertyFilter.All;\n private _changeIndex = 0;\n private _op?: SqliteChangeOp;\n private _isECTable?: boolean;\n private _tableName?: string;\n private _isIndirectChange?: boolean;\n\n /** The db used for EC schema resolution. */\n public readonly db: AnyDb;\n\n /**\n * `true` when the current row belongs to an EC-mapped table.\n * Valid only after a successful call to [[step]].\n * @throws [[IModelError]] if called before a successful [[step]] call.\n * @beta\n */\n public get isECTable(): boolean {\n if (this._isECTable === undefined)\n throw new IModelError(IModelStatus.BadRequest, \"ChangesetReader.isECTable is only valid after step() has positioned the reader on a current valid change.\");\n return this._isECTable;\n }\n\n /**\n * Name of the SQLite table for the current change row.\n * Valid only after a successful call to [[step]].\n * @throws [[IModelError]] if called before a successful [[step]] call.\n * @beta\n */\n public get tableName(): string {\n if (this._tableName === undefined)\n throw new IModelError(IModelStatus.BadRequest, \"ChangesetReader.tableName is only valid after step() has positioned the reader on a current valid change.\");\n return this._tableName;\n }\n\n /**\n * `true` when the current change was applied indirectly\n * Valid only after a successful call to [[step]].\n * @throws [[IModelError]] if called before a successful [[step]] call.\n * @beta\n */\n public get isIndirectChange(): boolean {\n if (this._isIndirectChange === undefined)\n throw new IModelError(IModelStatus.BadRequest, \"ChangesetReader.isIndirectChange is only valid after step() has positioned the reader on a current valid change.\");\n return this._isIndirectChange;\n }\n\n /**\n * Post-change (inserted or updated-new) EC instance, populated after each [[step]] call.\n * `undefined` when the current row is a Delete or a non-EC table row or [[step]] returned false.\n * @beta\n */\n public inserted?: ChangeInstance;\n\n /**\n * Pre-change (deleted or updated-old) EC instance, populated after each [[step]] call.\n * `undefined` when the current row is an Insert or a non-EC table row or [[step]] returned false.\n * @beta\n */\n public deleted?: ChangeInstance;\n\n // Private — callers use static factory methods.\n private constructor(db: AnyDb) {\n this.db = db;\n }\n\n /** Map public RowFormatOptions to the native adaptor options.\n * @internal */\n private toNativeRowOptions(opts: RowFormatOptions): IModelJsNative.ECSqlRowAdaptorOptions {\n return {\n abbreviateBlobs: opts.abbreviateBlobs,\n classIdsToClassNames: opts.classIdsToClassNames,\n useJsName: opts.useJsName,\n };\n }\n\n // ---------------------------------------------------------------------------\n // Static factory methods\n // ---------------------------------------------------------------------------\n\n /**\n * Open a changeset file from disk.\n * @param args.fileName Absolute path to the changeset file.\n * @param args.db Database at or after the changeset's ending state, used for schema resolution.\n * @param args.invert When `true`, invert all operations (Insert↔Delete).\n * @param args.valueOptions Row adaptor options controlling how EC property values are formatted.\n * @param args.propFilter Controls which properties are included. Defaults to `All`.\n * @throws if the native layer fails to open the file.\n * @beta\n */\n public static openFile(args: { readonly fileName: string } & ChangesetReaderArgs): ChangesetReader {\n const reader = new ChangesetReader(args.db);\n reader._rowOptions = args.rowOptions;\n const propFilter = args.propFilter ?? PropertyFilter.All;\n reader._propFilter = propFilter;\n try {\n reader._nativeReader.openFile(args.db[_nativeDb], args.fileName, args.invert ?? false, reader._propFilter);\n }\n catch (e) {\n reader.handleCloseErrorWhileOpening(e);\n throw e;\n }\n return reader;\n }\n\n /**\n * Concatenate multiple changeset files and read them as a single logical stream.\n * @param args.changesetFiles Ordered list of changeset file paths.\n * @param args.db Database with schema at or ahead of the last changeset.\n * @param args.valueOptions Row adaptor options controlling how EC property values are formatted.\n * @param args.propFilter Controls which properties are included. Defaults to `All`.\n * @param args.spillThresholdInBytes When the total size of the changeset data in the change group exceeds this threshold (in bytes),\n * the reader writes the data to a temporary file on disk and streams it from there instead of buffering everything in memory.\n * This keeps peak memory usage bounded, making the API suitable for processing large changeset groups under low-memory conditions.\n * Defaults to 50 MiB.\n * @throws if `changesetFiles` is empty, or if the native layer fails to open\n * the group.\n * @beta\n */\n public static openGroup(args: { readonly changesetFiles: string[], spillThresholdInBytes?: number } & ChangesetReaderArgs): ChangesetReader {\n if (args.changesetFiles.length === 0)\n throw new IModelError(IModelStatus.BadArg, \"changesetFiles must contain at least one file.\");\n const reader = new ChangesetReader(args.db);\n reader._rowOptions = args.rowOptions;\n const propFilter = args.propFilter ?? PropertyFilter.All;\n reader._propFilter = propFilter;\n try {\n reader._nativeReader.openGroup(args.db[_nativeDb], args.changesetFiles, args.invert ?? false, reader._propFilter, args.spillThresholdInBytes ?? this.defaultSpillThresholdInBytes);\n }\n catch (e) {\n reader.handleCloseErrorWhileOpening(e);\n throw e;\n }\n return reader;\n }\n\n /**\n * Read pending (not yet pushed) local changes from an open IModelDb.\n * @param args.db Must be an [IModelDb]($backend) (not [ECDb]($backend)).\n * @param args.includeInMemoryChanges Also include in-memory (not yet saved to disk) changes.\n * @param args.valueOptions Row adaptor options controlling how EC property values are formatted.\n * @param args.propFilter Controls which properties are included. Defaults to `All`.\n * @param args.spillThresholdInBytes When the total size of all local un-pushed saved changes exceeds this threshold (in bytes),\n * the reader writes the data to a temporary file on disk and streams it from there instead of buffering everything in memory.\n * This keeps peak memory usage bounded, making the API suitable for iModels with large local change backlogs under low-memory conditions.\n * Defaults to 50 MiB.\n * @throws if the native layer\n * fails to open the local changes.\n * @beta\n */\n public static openLocalChanges(\n args: Omit<ChangesetReaderArgs, \"db\"> & { db: IModelDb; includeInMemoryChanges?: boolean, spillThresholdInBytes?: number },\n ): ChangesetReader {\n const reader = new ChangesetReader(args.db);\n reader._rowOptions = args.rowOptions;\n const propFilter = args.propFilter ?? PropertyFilter.All;\n reader._propFilter = propFilter;\n try {\n reader._nativeReader.openLocalChanges(args.db[_nativeDb], args.includeInMemoryChanges ?? false, args.invert ?? false, reader._propFilter, args.spillThresholdInBytes ?? this.defaultSpillThresholdInBytes);\n } catch (e) {\n reader.handleCloseErrorWhileOpening(e);\n throw e;\n }\n return reader;\n }\n\n /**\n * Read the in-memory (not yet saved to disk) changes of an open IModelDb.\n * @param args.db Must be an [IModelDb]($backend).\n * @param args.valueOptions Row adaptor options controlling how EC property values are formatted.\n * @param args.propFilter Controls which properties are included. Defaults to `All`.\n * @param args.spillThresholdInBytes When the total size of the in-memory (unsaved) change data exceeds this threshold (in bytes),\n * the reader writes the data to a temporary file on disk and streams it from there instead of buffering everything in memory.\n * This keeps peak memory usage bounded, making the API suitable for large in-memory transactions under low-memory conditions.\n * Defaults to 50 MiB.\n * @throws if the native layer encounters an error while opening the in-memory changes.\n * @beta\n */\n public static openInMemoryChanges(\n args: Omit<ChangesetReaderArgs, \"db\"> & { db: IModelDb, spillThresholdInBytes?: number },\n ): ChangesetReader {\n const reader = new ChangesetReader(args.db);\n reader._rowOptions = args.rowOptions;\n const propFilter = args.propFilter ?? PropertyFilter.All;\n reader._propFilter = propFilter;\n try {\n reader._nativeReader.openInMemoryChanges(args.db[_nativeDb], args.invert ?? false, reader._propFilter, args.spillThresholdInBytes ?? this.defaultSpillThresholdInBytes);\n } catch (e) {\n reader.handleCloseErrorWhileOpening(e);\n throw e;\n }\n return reader;\n }\n\n /**\n * Read a single saved transaction by its id.\n * @param args.db Must be an [IModelDb]($backend) ([ECDb]($backend) does not support transactions).\n * @param args.txnId The id of the saved transaction to read.\n * @param args.valueOptions Row adaptor options controlling how EC property values are formatted.\n * @param args.propFilter Controls which properties are included. Defaults to `All`.\n * @param args.spillThresholdInBytes When the total size of the transaction's change data exceeds this threshold (in bytes),\n * the reader writes the data to a temporary file on disk and streams it from there instead of buffering everything in memory.\n * This keeps peak memory usage bounded, making the API suitable for large transactions under low-memory conditions.\n * Defaults to 50 MiB.\n * @throws if `txnId` is not found, or\n * the native layer fails to open the transaction data.\n * @beta\n */\n public static openTxn(\n args: Omit<ChangesetReaderArgs, \"db\"> & { db: IModelDb; txnId: Id64String, spillThresholdInBytes?: number },\n ): ChangesetReader {\n const reader = new ChangesetReader(args.db);\n reader._rowOptions = args.rowOptions;\n const propFilter = args.propFilter ?? PropertyFilter.All;\n reader._propFilter = propFilter;\n try {\n reader._nativeReader.openTxn(args.db[_nativeDb], args.txnId, args.invert ?? false, reader._propFilter, args.spillThresholdInBytes ?? this.defaultSpillThresholdInBytes);\n } catch (e) {\n reader.handleCloseErrorWhileOpening(e);\n throw e;\n }\n return reader;\n }\n\n /** Handle errors that occur while auto closing the reader if there is also an error while opening the reader */\n private handleCloseErrorWhileOpening(e: unknown): void {\n try {\n this.close();\n } catch (closeError) {\n throw new IModelError(IModelStatus.BadArg, `Failed to open ChangesetReader with error ${e instanceof Error ? e.message : String(e)}.\n Additionally, that triggered an automatic closure of the reader\n releasing native resources which also failed with failure ${closeError instanceof Error ? closeError.message : String(closeError)}.\n Check native error logs for more details.`);\n }\n }\n\n // ---------------------------------------------------------------------------\n // Filtering\n // ---------------------------------------------------------------------------\n\n /**\n * Restrict iteration to changes from the named SQLite tables.\n * That means the rows for changes from other tables will be skipped entirely and won't be visible through the reader.\n * @param tableNames SQLite table names to include.\n * Note: Table names must be provided in the correct case for proper filtering.\n * @throws [[IModelError]] if the native layer encounters an error while setting the filter.\n * @beta\n */\n public setTableNameFilters(tableNames: Set<string>): void {\n this._nativeReader.setTableNameFilters(Array.from(tableNames));\n }\n\n /**\n * Restrict iteration to changes with the given operation types.\n * That means the rows for changes with other operation types will be skipped entirely and won't be visible through the reader.\n * @param ops Operations to include.\n * @throws [[IModelError]] if the native layer encounters an error while setting the filter.\n * @beta\n */\n public setOpCodeFilters(ops: Set<SqliteChangeOp>): void {\n this._nativeReader.setOpCodeFilters(Array.from(ops));\n }\n\n /**\n * Restrict iteration to changes for the given EC class names.\n * That means the rows for changes from other EC classes will be skipped entirely and won't be visible through the reader.\n * @param classNames EC class names to include. The classNames should be in the full name format(i.e. \"SchemaName:ClassName\").\n * Note: Schema names and class names must be provided in the correct case for proper filtering. Derived classes are not automatically included, so they must be specified explicitly if needed.\n * @throws if the native layer encounters an error while setting the filter.\n * @beta\n */\n public setClassNameFilters(classNames: Set<string>): void {\n this._nativeReader.setClassNameFilters(Array.from(classNames));\n }\n\n /**\n * Remove the table-name filters\n * @throws if the native layer encounters an error.\n * @beta\n */\n public clearTableNameFilters(): void {\n this._nativeReader.clearTableNameFilters();\n }\n\n /**\n * Remove the op-code filters\n * @throws if the native layer encounters an error.\n * @beta\n */\n public clearOpCodeFilters(): void {\n this._nativeReader.clearOpCodeFilters();\n }\n\n /**\n * Remove the class-name filters\n * @throws if the native layer encounters an error.\n * @beta\n */\n public clearClassNameFilters(): void {\n this._nativeReader.clearClassNameFilters();\n }\n\n // ---------------------------------------------------------------------------\n // Strict mode\n // ---------------------------------------------------------------------------\n\n /**\n * Enable strict mode on the reader.\n *\n * Strict mode affects how the reader handles a **column-count mismatch** between a change\n * record and the corresponding live database table. Such a mismatch can occur when columns\n * have been added to a table after the changeset was created.\n *\n * When strict mode is **enabled**: if the number of columns recorded in a change row differs\n * from the number of columns currently present in the live table, the reader throws an error\n * instead of processing that row.\n *\n * Use strict mode when you need to be certain that every change row is interpreted against\n * exactly the schema that was in effect when the changeset was written.\n *\n * @see [[disableStrictMode]] — the default (lenient) behaviour.\n * @throws if the native layer encounters an error.\n * @beta\n */\n public enableStrictMode(): void {\n this._nativeReader.enableStrictMode();\n }\n\n /**\n * Disable strict mode on the reader (this is the default).\n *\n * When strict mode is **disabled**: if the number of columns recorded in a change row differs\n * from the number of columns currently present in the live table, the reader takes the\n * **minimum** of the two column counts and proceeds normally with that subset. This is safe\n * because SQLite only ever appends new columns at the end of a table and never removes them —\n * so older change records simply lack the trailing columns that were added later, and those\n * missing columns are silently ignored.\n *\n * @see [[enableStrictMode]] — throw on column-count mismatches instead.\n * @throws if the native layer encounters an error.\n * @beta\n */\n public disableStrictMode(): void {\n this._nativeReader.disableStrictMode();\n }\n\n // ---------------------------------------------------------------------------\n // Iteration\n // ---------------------------------------------------------------------------\n\n /**\n * Advance to the next change and populate `inserted` and/or `deleted`.\n * @returns `true` while positioned on a valid change; `false` when the stream is exhausted.\n * @throws if the native layer encounters an error while reading or decoding\n * the next change.\n * @beta\n */\n public step(): boolean {\n this.inserted = undefined;\n this.deleted = undefined;\n this._op = undefined;\n this._isECTable = undefined;\n this._tableName = undefined;\n this._isIndirectChange = undefined;\n\n if (this._nativeReader.step()) {\n this._changeIndex++;\n const meta = this._nativeReader.getChangeMetadata();\n const nativeOp = meta.opCode;\n const op: SqliteChangeOp = nativeOp === DbOpcode.Insert ? \"Inserted\" : nativeOp === DbOpcode.Update ? \"Updated\" : \"Deleted\";\n this._op = op;\n\n this._tableName = meta.tableName;\n this._isIndirectChange = meta.isIndirectChange;\n this._isECTable = meta.isECTable;\n\n const nativeRowOpts = this._rowOptions ? this.toNativeRowOptions(this._rowOptions) : {};\n\n if (op === \"Inserted\" || op === \"Updated\") {\n const rowValue = this._nativeReader.getValue(DbChangeStage.New, nativeRowOpts);\n if (rowValue !== undefined) {\n this.inserted = {\n ...rowValue.data,\n $meta: {\n op,\n tables: [this._tableName],\n changeIndexes: [this._changeIndex],\n stage: \"New\",\n instanceKey: rowValue.key,\n propFilter: this._propFilter,\n changeFetchedPropNames: rowValue.changeFetchedPropNames,\n rowOptions: this._rowOptions,\n isIndirectChange: this._isIndirectChange,\n },\n };\n }\n }\n\n if (op === \"Deleted\" || op === \"Updated\") {\n const rowValue = this._nativeReader.getValue(DbChangeStage.Old, nativeRowOpts);\n if (rowValue !== undefined) {\n this.deleted = {\n ...rowValue.data,\n $meta: {\n op,\n tables: [this._tableName],\n changeIndexes: [this._changeIndex],\n stage: \"Old\",\n instanceKey: rowValue.key,\n propFilter: this._propFilter,\n changeFetchedPropNames: rowValue.changeFetchedPropNames,\n rowOptions: this._rowOptions,\n isIndirectChange: this._isIndirectChange,\n },\n };\n }\n }\n\n return true;\n }\n\n return false;\n }\n\n /**\n * SQLite opcode of the current change.\n * Valid only after a successful call to [[step]].\n * @throws [[IModelError]] if called before a successful [[step]] call.\n * @beta\n */\n public get op(): SqliteChangeOp {\n if (this._op === undefined)\n throw new IModelError(IModelStatus.BadRequest, \"ChangesetReader.op is only valid after step() has positioned the reader on a current valid change.\");\n return this._op;\n }\n\n // ---------------------------------------------------------------------------\n // Lifecycle\n // ---------------------------------------------------------------------------\n\n /**\n * Close the reader and release all native resources.\n *\n * @throws if the native layer encounters an error during cleanup. Native resources\n * are not fully released when this throws — check the native error\n * logs for details.\n * @beta\n */\n public close(): void {\n this._changeIndex = 0;\n this._op = undefined;\n this._isECTable = undefined;\n this._tableName = undefined;\n this._isIndirectChange = undefined;\n this.inserted = undefined;\n this.deleted = undefined;\n this._nativeReader.close();\n }\n\n /**\n * Implements the `Disposable` contract — delegates to [[close]].\n *\n * @throws if the native layer fails to release its resources (re-thrown from [[close]]).\n * @beta\n */\n public [Symbol.dispose](): void {\n this.close();\n }\n}\n\n\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ChangesetReaderTypes.js","sourceRoot":"","sources":["../../src/ChangesetReaderTypes.ts"],"names":[],"mappings":"AASA,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,CAAN,IAAY,cAUX;AAVD,WAAY,cAAc;IACxB,kDAAkD;IAClD,iDAAO,CAAA;IACP;;;uBAGmB;IACnB,uEAAkB,CAAA;IAClB,2CAA2C;IAC3C,iEAAe,CAAA;AACjB,CAAC,EAVW,cAAc,KAAd,cAAc,QAUzB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ECDb\r\n */\r\nimport { AnyDb, SqliteChangeOp, SqliteValueStage } from \"./SqliteChangesetReader\";\r\n\r\n// ---------------------------------------------------------------------------\r\n// Type aliases\r\n// ---------------------------------------------------------------------------\r\n\r\n/**\r\n * Controls which properties are included in the output of [ChangesetReader]($backend).\r\n * @beta\r\n */\r\nexport enum PropertyFilter {\r\n /** All EC properties mapped to changed tables. */\r\n All = 0,\r\n /** For classes whose base class is `BisCore:Element`, only `BisCore:Element` properties\r\n * mapped to changed tables are returned. If no `BisCore:Element` class property changed,\r\n * only `ECInstanceId` and `ECClassId` are returned. For other classes all mapped properties\r\n * are returned. */\r\n BisCoreElement = 1,\r\n /** Only `ECInstanceId` and `ECClassId`. */\r\n InstanceKey = 2,\r\n}\r\n\r\n/**\r\n * Row-formatting options for [ChangesetReader]($backend) factory methods.\r\n * Controls how EC property values are represented in the returned instances.\r\n * @beta\r\n */\r\nexport interface RowFormatOptions {\r\n /**\r\n * When `false`, binary properties are returned as full `Uint8Array` values.\r\n * When `true` (or omitted), binary properties are summarized as `{ bytes: N }`.\r\n */\r\n abbreviateBlobs?: boolean;\r\n /**\r\n * When `true`, `ECClassId` and `RelECClassId` values are converted from hex strings\r\n * to fully-qualified class names (e.g. `\"BisCore.DrawingModel\"`).\r\n */\r\n classIdsToClassNames?: boolean;\r\n /**\r\n * When `true`, all property keys and struct sub-keys are returned in camelCase\r\n * (e.g. `id`, `className`, `lastMod`). Navigation property sub-keys use\r\n * `{ id, relClassName }` instead of `{ Id, RelECClassId }`.\r\n */\r\n useJsName?: boolean;\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Public interfaces\r\n// ---------------------------------------------------------------------------\r\n\r\n/**\r\n * Metadata attached to every [[ChangeInstance]].\r\n * @beta\r\n */\r\nexport interface ChangeMeta {\r\n /** SQLite tables that contributed columns to this change row. */\r\n tables: string[];\r\n /** Operation that produced this change. */\r\n op: SqliteChangeOp;\r\n /** Whether this is the pre-change (`\"Old\"`) or post-change (`\"New\"`) snapshot. */\r\n stage: SqliteValueStage;\r\n /** Change-stream index positions. */\r\n changeIndexes: number[];\r\n /**\r\n * ECInstanceId and class Id in format \"<ECInstanceId>-<ECClassId>\".\r\n */\r\n instanceKey: string;\r\n /** Reader property filter that was active when this change row was captured. */\r\n propFilter: PropertyFilter;\r\n /** EC property names fetched from the current row of changeset or transaction or any other change stream.\r\n For compound data properties like point2d, point3d or navigation properties,\r\n the full name of the property is returned in case all the components of the property are fetched from the change.\r\n If all of the components are not fetched from the changes(meaning they did not change),\r\n then the individual component names which changed are returned smartly by using `.` as a separator (e.g. \"MyPoint.X\", \"MyPoint.Y\" for a point3d property \"MyPoint\" if only X and Y changed).\r\n For struct properties the property names are always returned in the \"StructProp.MemberName\" format.\r\n So if only X changed for a point2d property named \"Myp2d\" inide a struct \"CustomStruct\", the returned property name will be \"CustomStruct.Myp2d.X\".\r\n Similaly if both X and Y changed for the same point2d property, the returned property name will be \"CustomStruct.Myp2d\". */\r\n changeFetchedPropNames: string[];\r\n /** Row adaptor options that were active when this change row was captured. */\r\n rowOptions?: RowFormatOptions;\r\n /** `true` when the change was applied indirectly */\r\n isIndirectChange: boolean;\r\n}\r\n\r\n/**\r\n * An EC instance produced by [ChangesetReader]($backend) after each `step()`.\r\n * Contains the EC property bag plus mandatory `$meta` metadata.\r\n * @beta\r\n */\r\nexport interface ChangeInstance {\r\n /** Metadata describing the origin and identity of this change. */\r\n $meta: ChangeMeta;\r\n /** EC property bag (ECClassId, ECInstanceId, user-defined properties, ...). */\r\n [key: string]: any;\r\n}\r\n\r\n/**\r\n * Contract for any reader that produces EC-typed changed instances compatible with\r\n * [PartialChangeUnifier]($backend).\r\n * @beta\r\n */\r\nexport interface ChangeSource {\r\n /** The SQLite opcode of the current change row. */\r\n readonly op: SqliteChangeOp;\r\n /**\r\n * The newly-inserted or post-update EC instance.\r\n * `undefined` when the current row is a Delete, or when `isECTable` is `false`.\r\n */\r\n readonly inserted?: ChangeInstance;\r\n /**\r\n * The deleted or pre-update EC instance.\r\n * `undefined` when the current row is an Insert, or when `isECTable` is `false`.\r\n */\r\n readonly deleted?: ChangeInstance;\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// ChangesetReader args / options\r\n// ---------------------------------------------------------------------------\r\n\r\n/**\r\n * Arguments common to all [ChangesetReader]($backend) `open*` factory methods.\r\n * @beta\r\n */\r\nexport interface ChangesetReaderArgs {\r\n /** The db used to resolve EC schema. Must be at or ahead of the changeset being read. */\r\n readonly db: AnyDb;\r\n /** invert the changeset operations */\r\n readonly invert?: boolean;\r\n /** Row adaptor options controlling how EC property values are formatted. */\r\n readonly rowOptions?: RowFormatOptions;\r\n /** Controls which properties are included in the change output. Defaults to PropertyFilter.All. */\r\n readonly propFilter?: PropertyFilter;\r\n}\r\n"]}
1
+ {"version":3,"file":"ChangesetReaderTypes.js","sourceRoot":"","sources":["../../src/ChangesetReaderTypes.ts"],"names":[],"mappings":"AASA,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,CAAN,IAAY,cAUX;AAVD,WAAY,cAAc;IACxB,kDAAkD;IAClD,iDAAO,CAAA;IACP;;;uBAGmB;IACnB,uEAAkB,CAAA;IAClB,2CAA2C;IAC3C,iEAAe,CAAA;AACjB,CAAC,EAVW,cAAc,KAAd,cAAc,QAUzB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ECDb\n */\nimport { AnyDb, SqliteChangeOp, SqliteValueStage } from \"./SqliteChangesetReader\";\n\n// ---------------------------------------------------------------------------\n// Type aliases\n// ---------------------------------------------------------------------------\n\n/**\n * Controls which properties are included in the output of [ChangesetReader]($backend).\n * @beta\n */\nexport enum PropertyFilter {\n /** All EC properties mapped to changed tables. */\n All = 0,\n /** For classes whose base class is `BisCore:Element`, only `BisCore:Element` properties\n * mapped to changed tables are returned. If no `BisCore:Element` class property changed,\n * only `ECInstanceId` and `ECClassId` are returned. For other classes all mapped properties\n * are returned. */\n BisCoreElement = 1,\n /** Only `ECInstanceId` and `ECClassId`. */\n InstanceKey = 2,\n}\n\n/**\n * Row-formatting options for [ChangesetReader]($backend) factory methods.\n * Controls how EC property values are represented in the returned instances.\n * @beta\n */\nexport interface RowFormatOptions {\n /**\n * When `false`, binary properties are returned as full `Uint8Array` values.\n * When `true` (or omitted), binary properties are summarized as `{ bytes: N }`.\n */\n abbreviateBlobs?: boolean;\n /**\n * When `true`, `ECClassId` and `RelECClassId` values are converted from hex strings\n * to fully-qualified class names (e.g. `\"BisCore.DrawingModel\"`).\n */\n classIdsToClassNames?: boolean;\n /**\n * When `true`, all property keys and struct sub-keys are returned in camelCase\n * (e.g. `id`, `className`, `lastMod`). Navigation property sub-keys use\n * `{ id, relClassName }` instead of `{ Id, RelECClassId }`.\n */\n useJsName?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Public interfaces\n// ---------------------------------------------------------------------------\n\n/**\n * Metadata attached to every [[ChangeInstance]].\n * @beta\n */\nexport interface ChangeMeta {\n /** SQLite tables that contributed columns to this change row. */\n tables: string[];\n /** Operation that produced this change. */\n op: SqliteChangeOp;\n /** Whether this is the pre-change (`\"Old\"`) or post-change (`\"New\"`) snapshot. */\n stage: SqliteValueStage;\n /** Change-stream index positions. */\n changeIndexes: number[];\n /**\n * ECInstanceId and class Id in format \"<ECInstanceId>-<ECClassId>\".\n */\n instanceKey: string;\n /** Reader property filter that was active when this change row was captured. */\n propFilter: PropertyFilter;\n /** EC property names fetched from the current row of changeset or transaction or any other change stream.\n For compound data properties like point2d, point3d or navigation properties,\n the full name of the property is returned in case all the components of the property are fetched from the change.\n If all of the components are not fetched from the changes(meaning they did not change),\n then the individual component names which changed are returned smartly by using `.` as a separator (e.g. \"MyPoint.X\", \"MyPoint.Y\" for a point3d property \"MyPoint\" if only X and Y changed).\n For struct properties the property names are always returned in the \"StructProp.MemberName\" format.\n So if only X changed for a point2d property named \"Myp2d\" inide a struct \"CustomStruct\", the returned property name will be \"CustomStruct.Myp2d.X\".\n Similaly if both X and Y changed for the same point2d property, the returned property name will be \"CustomStruct.Myp2d\". */\n changeFetchedPropNames: string[];\n /** Row adaptor options that were active when this change row was captured. */\n rowOptions?: RowFormatOptions;\n /** `true` when the change was applied indirectly */\n isIndirectChange: boolean;\n}\n\n/**\n * An EC instance produced by [ChangesetReader]($backend) after each `step()`.\n * Contains the EC property bag plus mandatory `$meta` metadata.\n * @beta\n */\nexport interface ChangeInstance {\n /** Metadata describing the origin and identity of this change. */\n $meta: ChangeMeta;\n /** EC property bag (ECClassId, ECInstanceId, user-defined properties, ...). */\n [key: string]: any;\n}\n\n/**\n * Contract for any reader that produces EC-typed changed instances compatible with\n * [PartialChangeUnifier]($backend).\n * @beta\n */\nexport interface ChangeSource {\n /** The SQLite opcode of the current change row. */\n readonly op: SqliteChangeOp;\n /**\n * The newly-inserted or post-update EC instance.\n * `undefined` when the current row is a Delete, or when `isECTable` is `false`.\n */\n readonly inserted?: ChangeInstance;\n /**\n * The deleted or pre-update EC instance.\n * `undefined` when the current row is an Insert, or when `isECTable` is `false`.\n */\n readonly deleted?: ChangeInstance;\n}\n\n// ---------------------------------------------------------------------------\n// ChangesetReader args / options\n// ---------------------------------------------------------------------------\n\n/**\n * Arguments common to all [ChangesetReader]($backend) `open*` factory methods.\n * @beta\n */\nexport interface ChangesetReaderArgs {\n /** The db used to resolve EC schema. Must be at or ahead of the changeset being read. */\n readonly db: AnyDb;\n /** invert the changeset operations */\n readonly invert?: boolean;\n /** Row adaptor options controlling how EC property values are formatted. */\n readonly rowOptions?: RowFormatOptions;\n /** Controls which properties are included in the change output. Defaults to PropertyFilter.All. */\n readonly propFilter?: PropertyFilter;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ChannelControl.js","sourceRoot":"","sources":["../../src/ChannelControl.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAyH/E,YAAY;AACZ,MAAM,KAAW,cAAc,CAG9B;AAHD,WAAiB,cAAc;IAC7B,wGAAwG;IAC3F,gCAAiB,GAAG,QAAQ,CAAC;AAC5C,CAAC,EAHgB,cAAc,KAAd,cAAc,QAG9B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { _implementationProhibited, _verifyChannel } from \"./internal/Symbols\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport type { EditTxn } from \"./EditTxn\";\r\n\r\n/** The key for a channel. Used for \"allowed channels\" in [[ChannelControl]]\r\n * @beta\r\n */\r\nexport type ChannelKey = string;\r\n\r\n/**\r\n * Context provided to the channel upgrade callback.\r\n * @beta\r\n */\r\nexport interface ChannelUpgradeContext<T = any> {\r\n iModel: IModelDb;\r\n channelKey: string;\r\n fromVersion: string;\r\n toVersion: string;\r\n /** Optional data to be used during the upgrade */\r\n data?: T;\r\n}\r\n\r\n/**\r\n * Options for upgrading a channel before schema import.\r\n * The framework will automatically populate the context with iModel and data.\r\n * @beta\r\n */\r\nexport interface ChannelUpgradeOptions<T = any> {\r\n channelKey: string;\r\n fromVersion: string;\r\n toVersion: string;\r\n callback: (context: ChannelUpgradeContext<T>) => Promise<void>;\r\n}\r\n\r\n/**\r\n * Controls which channels of an iModel are permitted for write operations. An implementation of this interface is\r\n * available via [[IModelDb.channels]].\r\n * @see [Working With Channels]($docs/learning/backend/Channel.md) for details\r\n * @beta\r\n */\r\nexport interface ChannelControl {\r\n /** @internal */\r\n readonly [_implementationProhibited]: unknown;\r\n\r\n /** Add a new channel to the list of allowed channels of the [[IModelDb]] for this session.\r\n * @param channelKey The key for the channel to become editable in this session.\r\n */\r\n addAllowedChannel(channelKey: ChannelKey): void;\r\n /** Remove a channel from the list of allowed channels of the [[IModelDb]] for this session.\r\n * @param channelKey The key of the channel that should no longer be editable in this session.\r\n */\r\n removeAllowedChannel(channelKey: ChannelKey): void;\r\n /** Get the channelKey of the channel for an element by ElementId.\r\n * @throws if the element does not exist\r\n */\r\n getChannelKey(elementId: Id64String): ChannelKey;\r\n /** Make an existing element a new Channel root.\r\n * @throws if the element is already in a channel different than the shared channel, or if\r\n * there is already another channelRoot element for the specified channelKey\r\n */\r\n makeChannelRoot(args: {\r\n elementId: Id64String;\r\n channelKey: ChannelKey;\r\n /** The transaction to use for the operation. */\r\n txn: EditTxn;\r\n }): void;\r\n /** Make an existing element a new Channel root.\r\n * @throws if the element is already in a channel different than the shared channel, or if\r\n * there is already another channelRoot element for the specified channelKey\r\n * @deprecated Use [[makeChannelRoot]] and supply `txn`.\r\n */\r\n makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey }): void;\r\n /** Insert a new Subject element that is a Channel Root in this iModel.\r\n * @returns the ElementId of the new Subject element.\r\n * @note if the parentSubject element is already in a channel, this will add the Subject element and then throw an error without making it a Channel root.\r\n */\r\n insertChannelSubject(args: {\r\n /** The name of the new Subject element */\r\n subjectName: string;\r\n /** The channel key for the new [[Subject]]. This is the string to pass to [[addAllowedChannel]]*/\r\n channelKey: ChannelKey;\r\n /** the Id of the parent of the new Subject. Default is [[IModel.rootSubjectId]]. */\r\n parentSubjectId?: Id64String;\r\n /** Optional description for new Subject. */\r\n description?: string;\r\n /** The EditTxn to use for the operation. */\r\n txn: EditTxn;\r\n }): Id64String;\r\n /** Insert a new Subject element that is a Channel Root in this iModel.\r\n * @returns the ElementId of the new Subject element.\r\n * @note if the parentSubject element is already in a channel, this will add the Subject element and then throw an error without making it a Channel root.\r\n * @deprecated Use [[insertChannelSubject]] and supply `txn`.\r\n */\r\n insertChannelSubject(args: {\r\n /** The name of the new Subject element */\r\n subjectName: string;\r\n /** The channel key for the new [[Subject]]. This is the string to pass to [[addAllowedChannel]]*/\r\n channelKey: ChannelKey;\r\n /** the Id of the parent of the new Subject. Default is [[IModel.rootSubjectId]]. */\r\n parentSubjectId?: Id64String;\r\n /** Optional description for new Subject. */\r\n description?: string;\r\n }): Id64String;\r\n /**\r\n * Queries for the element Id acting as the ChannelRoot for a given channelKey, if any\r\n * @param channelKey The key for the channel to query for\r\n * @returns The element Id of the ChannelRoot element of the specified Channel key, or undefined if\r\n * there is no ChannelRoot for it\r\n */\r\n queryChannelRoot(channelKey: ChannelKey): Id64String | undefined;\r\n\r\n /** @internal */\r\n [_verifyChannel]: (modelId: Id64String) => void;\r\n\r\n /**\r\n * Upgrade a channel to a new version.\r\n * @beta\r\n */\r\n upgradeChannel(options: ChannelUpgradeOptions, iModel: IModelDb, data?: any): Promise<void>;\r\n}\r\n\r\n/** @beta */\r\nexport namespace ChannelControl {\r\n /** the name of the special \"shared\" channel holding information that is editable by any application. */\r\n export const sharedChannelName = \"shared\";\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"ChannelControl.js","sourceRoot":"","sources":["../../src/ChannelControl.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAyH/E,YAAY;AACZ,MAAM,KAAW,cAAc,CAG9B;AAHD,WAAiB,cAAc;IAC7B,wGAAwG;IAC3F,gCAAiB,GAAG,QAAQ,CAAC;AAC5C,CAAC,EAHgB,cAAc,KAAd,cAAc,QAG9B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Elements\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { _implementationProhibited, _verifyChannel } from \"./internal/Symbols\";\nimport { IModelDb } from \"./IModelDb\";\nimport type { EditTxn } from \"./EditTxn\";\n\n/** The key for a channel. Used for \"allowed channels\" in [[ChannelControl]]\n * @beta\n */\nexport type ChannelKey = string;\n\n/**\n * Context provided to the channel upgrade callback.\n * @beta\n */\nexport interface ChannelUpgradeContext<T = any> {\n iModel: IModelDb;\n channelKey: string;\n fromVersion: string;\n toVersion: string;\n /** Optional data to be used during the upgrade */\n data?: T;\n}\n\n/**\n * Options for upgrading a channel before schema import.\n * The framework will automatically populate the context with iModel and data.\n * @beta\n */\nexport interface ChannelUpgradeOptions<T = any> {\n channelKey: string;\n fromVersion: string;\n toVersion: string;\n callback: (context: ChannelUpgradeContext<T>) => Promise<void>;\n}\n\n/**\n * Controls which channels of an iModel are permitted for write operations. An implementation of this interface is\n * available via [[IModelDb.channels]].\n * @see [Working With Channels]($docs/learning/backend/Channel.md) for details\n * @beta\n */\nexport interface ChannelControl {\n /** @internal */\n readonly [_implementationProhibited]: unknown;\n\n /** Add a new channel to the list of allowed channels of the [[IModelDb]] for this session.\n * @param channelKey The key for the channel to become editable in this session.\n */\n addAllowedChannel(channelKey: ChannelKey): void;\n /** Remove a channel from the list of allowed channels of the [[IModelDb]] for this session.\n * @param channelKey The key of the channel that should no longer be editable in this session.\n */\n removeAllowedChannel(channelKey: ChannelKey): void;\n /** Get the channelKey of the channel for an element by ElementId.\n * @throws if the element does not exist\n */\n getChannelKey(elementId: Id64String): ChannelKey;\n /** Make an existing element a new Channel root.\n * @throws if the element is already in a channel different than the shared channel, or if\n * there is already another channelRoot element for the specified channelKey\n */\n makeChannelRoot(args: {\n elementId: Id64String;\n channelKey: ChannelKey;\n /** The transaction to use for the operation. */\n txn: EditTxn;\n }): void;\n /** Make an existing element a new Channel root.\n * @throws if the element is already in a channel different than the shared channel, or if\n * there is already another channelRoot element for the specified channelKey\n * @deprecated Use [[makeChannelRoot]] and supply `txn`.\n */\n makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey }): void;\n /** Insert a new Subject element that is a Channel Root in this iModel.\n * @returns the ElementId of the new Subject element.\n * @note if the parentSubject element is already in a channel, this will add the Subject element and then throw an error without making it a Channel root.\n */\n insertChannelSubject(args: {\n /** The name of the new Subject element */\n subjectName: string;\n /** The channel key for the new [[Subject]]. This is the string to pass to [[addAllowedChannel]]*/\n channelKey: ChannelKey;\n /** the Id of the parent of the new Subject. Default is [[IModel.rootSubjectId]]. */\n parentSubjectId?: Id64String;\n /** Optional description for new Subject. */\n description?: string;\n /** The EditTxn to use for the operation. */\n txn: EditTxn;\n }): Id64String;\n /** Insert a new Subject element that is a Channel Root in this iModel.\n * @returns the ElementId of the new Subject element.\n * @note if the parentSubject element is already in a channel, this will add the Subject element and then throw an error without making it a Channel root.\n * @deprecated Use [[insertChannelSubject]] and supply `txn`.\n */\n insertChannelSubject(args: {\n /** The name of the new Subject element */\n subjectName: string;\n /** The channel key for the new [[Subject]]. This is the string to pass to [[addAllowedChannel]]*/\n channelKey: ChannelKey;\n /** the Id of the parent of the new Subject. Default is [[IModel.rootSubjectId]]. */\n parentSubjectId?: Id64String;\n /** Optional description for new Subject. */\n description?: string;\n }): Id64String;\n /**\n * Queries for the element Id acting as the ChannelRoot for a given channelKey, if any\n * @param channelKey The key for the channel to query for\n * @returns The element Id of the ChannelRoot element of the specified Channel key, or undefined if\n * there is no ChannelRoot for it\n */\n queryChannelRoot(channelKey: ChannelKey): Id64String | undefined;\n\n /** @internal */\n [_verifyChannel]: (modelId: Id64String) => void;\n\n /**\n * Upgrade a channel to a new version.\n * @beta\n */\n upgradeChannel(options: ChannelUpgradeOptions, iModel: IModelDb, data?: any): Promise<void>;\n}\n\n/** @beta */\nexport namespace ChannelControl {\n /** the name of the special \"shared\" channel holding information that is editable by any application. */\n export const sharedChannelName = \"shared\";\n}\n\n"]}