@itwin/core-backend 5.2.0-dev.3 → 5.2.0-dev.31

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 (193) hide show
  1. package/CHANGELOG.md +79 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +2 -0
  3. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  4. package/lib/cjs/BackendHubAccess.js.map +1 -1
  5. package/lib/cjs/BackendLoggerCategory.d.ts +6 -0
  6. package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
  7. package/lib/cjs/BackendLoggerCategory.js +6 -0
  8. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  9. package/lib/cjs/BriefcaseManager.d.ts +57 -3
  10. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  11. package/lib/cjs/BriefcaseManager.js +153 -44
  12. package/lib/cjs/BriefcaseManager.js.map +1 -1
  13. package/lib/cjs/ClassRegistry.js +2 -2
  14. package/lib/cjs/ClassRegistry.js.map +1 -1
  15. package/lib/cjs/CloudSqlite.d.ts +4 -0
  16. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  17. package/lib/cjs/CloudSqlite.js.map +1 -1
  18. package/lib/cjs/ECDb.d.ts +8 -0
  19. package/lib/cjs/ECDb.d.ts.map +1 -1
  20. package/lib/cjs/ECDb.js +22 -0
  21. package/lib/cjs/ECDb.js.map +1 -1
  22. package/lib/cjs/IModelDb.d.ts +54 -3
  23. package/lib/cjs/IModelDb.d.ts.map +1 -1
  24. package/lib/cjs/IModelDb.js +88 -10
  25. package/lib/cjs/IModelDb.js.map +1 -1
  26. package/lib/cjs/IModelHost.d.ts +11 -1
  27. package/lib/cjs/IModelHost.d.ts.map +1 -1
  28. package/lib/cjs/IModelHost.js +5 -0
  29. package/lib/cjs/IModelHost.js.map +1 -1
  30. package/lib/cjs/IModelIncrementalSchemaLocater.d.ts +1 -5
  31. package/lib/cjs/IModelIncrementalSchemaLocater.d.ts.map +1 -1
  32. package/lib/cjs/IModelIncrementalSchemaLocater.js +0 -6
  33. package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -1
  34. package/lib/cjs/StashManager.d.ts +175 -0
  35. package/lib/cjs/StashManager.d.ts.map +1 -0
  36. package/lib/cjs/StashManager.js +306 -0
  37. package/lib/cjs/StashManager.js.map +1 -0
  38. package/lib/cjs/TxnManager.d.ts +226 -15
  39. package/lib/cjs/TxnManager.d.ts.map +1 -1
  40. package/lib/cjs/TxnManager.js +249 -23
  41. package/lib/cjs/TxnManager.js.map +1 -1
  42. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +10 -1
  43. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  44. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +12 -1
  45. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  46. package/lib/cjs/annotations/LeaderGeometry.d.ts +3 -2
  47. package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -1
  48. package/lib/cjs/annotations/LeaderGeometry.js +4 -3
  49. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
  50. package/lib/cjs/annotations/TextAnnotationElement.d.ts +52 -24
  51. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
  52. package/lib/cjs/annotations/TextAnnotationElement.js +49 -59
  53. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  54. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +2 -0
  55. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -1
  56. package/lib/cjs/annotations/TextAnnotationGeometry.js +2 -2
  57. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
  58. package/lib/cjs/annotations/TextBlockLayout.d.ts +3 -9
  59. package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -1
  60. package/lib/cjs/annotations/TextBlockLayout.js +3 -22
  61. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -1
  62. package/lib/cjs/internal/ChannelAdmin.js +1 -1
  63. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  64. package/lib/cjs/internal/Symbols.d.ts +1 -0
  65. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  66. package/lib/cjs/internal/Symbols.js +2 -1
  67. package/lib/cjs/internal/Symbols.js.map +1 -1
  68. package/lib/cjs/internal/annotations/fields.d.ts +2 -12
  69. package/lib/cjs/internal/annotations/fields.d.ts.map +1 -1
  70. package/lib/cjs/internal/annotations/fields.js +47 -40
  71. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  72. package/lib/cjs/internal/workspace/SettingsImpl.js +1 -1
  73. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  74. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js +2 -2
  75. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  76. package/lib/cjs/workspace/Workspace.d.ts +1 -1
  77. package/lib/cjs/workspace/Workspace.js.map +1 -1
  78. package/lib/esm/BackendHubAccess.d.ts +2 -0
  79. package/lib/esm/BackendHubAccess.d.ts.map +1 -1
  80. package/lib/esm/BackendHubAccess.js.map +1 -1
  81. package/lib/esm/BackendLoggerCategory.d.ts +6 -0
  82. package/lib/esm/BackendLoggerCategory.d.ts.map +1 -1
  83. package/lib/esm/BackendLoggerCategory.js +6 -0
  84. package/lib/esm/BackendLoggerCategory.js.map +1 -1
  85. package/lib/esm/BriefcaseManager.d.ts +57 -3
  86. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  87. package/lib/esm/BriefcaseManager.js +154 -45
  88. package/lib/esm/BriefcaseManager.js.map +1 -1
  89. package/lib/esm/ClassRegistry.js +2 -2
  90. package/lib/esm/ClassRegistry.js.map +1 -1
  91. package/lib/esm/CloudSqlite.d.ts +4 -0
  92. package/lib/esm/CloudSqlite.d.ts.map +1 -1
  93. package/lib/esm/CloudSqlite.js.map +1 -1
  94. package/lib/esm/ECDb.d.ts +8 -0
  95. package/lib/esm/ECDb.d.ts.map +1 -1
  96. package/lib/esm/ECDb.js +22 -0
  97. package/lib/esm/ECDb.js.map +1 -1
  98. package/lib/esm/IModelDb.d.ts +54 -3
  99. package/lib/esm/IModelDb.d.ts.map +1 -1
  100. package/lib/esm/IModelDb.js +89 -11
  101. package/lib/esm/IModelDb.js.map +1 -1
  102. package/lib/esm/IModelHost.d.ts +11 -1
  103. package/lib/esm/IModelHost.d.ts.map +1 -1
  104. package/lib/esm/IModelHost.js +5 -0
  105. package/lib/esm/IModelHost.js.map +1 -1
  106. package/lib/esm/IModelIncrementalSchemaLocater.d.ts +1 -5
  107. package/lib/esm/IModelIncrementalSchemaLocater.d.ts.map +1 -1
  108. package/lib/esm/IModelIncrementalSchemaLocater.js +0 -6
  109. package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -1
  110. package/lib/esm/StashManager.d.ts +175 -0
  111. package/lib/esm/StashManager.d.ts.map +1 -0
  112. package/lib/esm/StashManager.js +301 -0
  113. package/lib/esm/StashManager.js.map +1 -0
  114. package/lib/esm/TxnManager.d.ts +226 -15
  115. package/lib/esm/TxnManager.d.ts.map +1 -1
  116. package/lib/esm/TxnManager.js +247 -21
  117. package/lib/esm/TxnManager.js.map +1 -1
  118. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +10 -1
  119. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  120. package/lib/esm/annotations/ElementDrivesTextAnnotation.js +10 -0
  121. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  122. package/lib/esm/annotations/LeaderGeometry.d.ts +3 -2
  123. package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -1
  124. package/lib/esm/annotations/LeaderGeometry.js +4 -3
  125. package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
  126. package/lib/esm/annotations/TextAnnotationElement.d.ts +52 -24
  127. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
  128. package/lib/esm/annotations/TextAnnotationElement.js +51 -61
  129. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  130. package/lib/esm/annotations/TextAnnotationGeometry.d.ts +2 -0
  131. package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -1
  132. package/lib/esm/annotations/TextAnnotationGeometry.js +2 -2
  133. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
  134. package/lib/esm/annotations/TextBlockLayout.d.ts +3 -9
  135. package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -1
  136. package/lib/esm/annotations/TextBlockLayout.js +3 -22
  137. package/lib/esm/annotations/TextBlockLayout.js.map +1 -1
  138. package/lib/esm/internal/ChannelAdmin.js +1 -1
  139. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  140. package/lib/esm/internal/Symbols.d.ts +1 -0
  141. package/lib/esm/internal/Symbols.d.ts.map +1 -1
  142. package/lib/esm/internal/Symbols.js +1 -0
  143. package/lib/esm/internal/Symbols.js.map +1 -1
  144. package/lib/esm/internal/annotations/fields.d.ts +2 -12
  145. package/lib/esm/internal/annotations/fields.d.ts.map +1 -1
  146. package/lib/esm/internal/annotations/fields.js +50 -43
  147. package/lib/esm/internal/annotations/fields.js.map +1 -1
  148. package/lib/esm/internal/workspace/SettingsImpl.js +1 -1
  149. package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
  150. package/lib/esm/internal/workspace/SettingsSchemasImpl.js +2 -2
  151. package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  152. package/lib/esm/test/AnnotationTestUtils.d.ts +5 -1
  153. package/lib/esm/test/AnnotationTestUtils.d.ts.map +1 -1
  154. package/lib/esm/test/AnnotationTestUtils.js +6 -1
  155. package/lib/esm/test/AnnotationTestUtils.js.map +1 -1
  156. package/lib/esm/test/annotations/Fields.test.js +158 -43
  157. package/lib/esm/test/annotations/Fields.test.js.map +1 -1
  158. package/lib/esm/test/annotations/LeaderGeometry.test.js +12 -10
  159. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
  160. package/lib/esm/test/annotations/TextAnnotation.test.js +299 -43
  161. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  162. package/lib/esm/test/annotations/TextBlock.test.js +39 -35
  163. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
  164. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts +46 -0
  165. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts.map +1 -1
  166. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js +20 -2
  167. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
  168. package/lib/esm/test/ecdb/ECDb.test.js +71 -1
  169. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  170. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.d.ts.map +1 -1
  171. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js +8 -2
  172. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
  173. package/lib/esm/test/hubaccess/Rebase.test.d.ts +2 -0
  174. package/lib/esm/test/hubaccess/Rebase.test.d.ts.map +1 -0
  175. package/lib/esm/test/hubaccess/Rebase.test.js +640 -0
  176. package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -0
  177. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js +20 -20
  178. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
  179. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +3 -3
  180. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
  181. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts +16 -1
  182. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts.map +1 -1
  183. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js +47 -0
  184. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +1 -1
  185. package/lib/esm/test/standalone/ChangeMerge.test.js +15 -19
  186. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  187. package/lib/esm/test/standalone/MergeConflict.test.js +3 -3
  188. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  189. package/lib/esm/test/standalone/NativeAppStorage.test.js +2 -2
  190. package/lib/esm/test/standalone/NativeAppStorage.test.js.map +1 -1
  191. package/lib/esm/workspace/Workspace.d.ts +1 -1
  192. package/lib/esm/workspace/Workspace.js.map +1 -1
  193. package/package.json +14 -14
@@ -1 +1 @@
1
- {"version":3,"file":"BackendLoggerCategory.js","sourceRoot":"","sources":["../../src/BackendLoggerCategory.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH;;;;GAIG;AACH,MAAM,CAAN,IAAY,qBA+FX;AA/FD,WAAY,qBAAqB;IAC/B,+DAA+D;IAC/D,qEAA4C,CAAA;IAE5C;;OAEG;IACH,6DAAoC,CAAA;IAEpC;;OAEG;IACH,2FAAkE,CAAA;IAElE;;OAEG;IACH,2DAAkC,CAAA;IAElC;;;;OAIG;IACH,mDAA0B,CAAA;IAE1B;;OAEG;IACH,+DAAsC,CAAA;IAEtC;;OAEG;IACH,6EAAoD,CAAA;IAEpD;;;OAGG;IACH,2DAAkC,CAAA;IAElC;;OAEG;IACH,+DAAsC,CAAA;IAEtC;;OAEG;IACH,mFAA0D,CAAA;IAE1D;;OAEG;IACH,2EAAkD,CAAA;IAElD;;OAEG;IACH,6EAAoD,CAAA;IAEpD;;OAEG;IACH,mEAA0C,CAAA;IAE1C;;OAEG;IACH,yDAAgC,CAAA;IAEhC;;OAEG;IACH,yEAAgD,CAAA;IAChD;;OAEG;IACH,6DAAoC,CAAA;IAEpC;;;OAGG;IACH,6DAAoC,CAAA;IAEpC;;;OAGG;IACH,6EAAoD,CAAA;IAEpD,gBAAgB;IAChB,6DAAoC,CAAA;AACtC,CAAC,EA/FW,qBAAqB,KAArB,qBAAqB,QA+FhC","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 Logging\n */\n\n/** Logger categories used by this package\n * @note All logger categories in this package start with the `core-backend` prefix.\n * @see [Logger]($bentley)\n * @public\n */\nexport enum BackendLoggerCategory {\n /** The logger category used by API related to authorization */\n Authorization = \"core-backend.Authorization\",\n\n /** The logger category used by the following classes:\n * - [[CodeSpecs]]\n */\n CodeSpecs = \"core-backend.CodeSpecs\",\n\n /** The logger category used by the following classes:\n * - [[CustomViewState3dCreator]]\n */\n CustomViewState3dCreator = \"core-backend.CustomViewState3dCreator\",\n\n /** The logger category used by the [[DevTools]] class and related classes.\n * @internal\n */\n DevTools = \"core-backend.DevTools\",\n\n /** The logger category used by the following classes:\n * - [[ChangeSummaryManager]]\n * - [[ECDb]]\n * - [[ECSqlStatement]]\n */\n ECDb = \"core-backend.ECDb\",\n\n /** The logger category used by the following classes:\n * - [[Functional]]\n */\n Functional = \"core-backend.Functional\",\n\n /** The logger category used by the following classes:\n * - [[LinearReferencing]]\n */\n LinearReferencing = \"core-backend.LinearReferencing\",\n\n /** The logger category used by the following classes:\n * - BriefcaseManager\n * - [[IModelDb]]\n */\n IModelDb = \"core-backend.IModelDb\",\n\n /** The logger category used by the following classes:\n * - [[IModelHost]]\n */\n IModelHost = \"core-backend.IModelHost\",\n\n /** The logger category used by the following classes:\n * - TileRequestMemoizer\n */\n IModelTileRequestRpc = \"core-backend.IModelTileRequestRpc\",\n\n /** The logger category used by the following classes:\n * - IModelTileRpcImpl (Tile Uploading)\n */\n IModelTileUpload = \"core-backend.IModelTileUpload\",\n\n /** The logger category used by the following classes:\n * - TileStorage (tile upload/download)\n */\n IModelTileStorage = \"core-backend.IModelTileStorage\",\n\n /** The logger category used by the following classes:\n * - [[Relationship]]\n */\n Relationship = \"core-backend.Relationship\",\n\n /** The logger category used by the following classes:\n * - [[Schemas]]\n */\n Schemas = \"core-backend.Schemas\",\n\n /** The logger category used by the following classes:\n * - [[PromiseMemoizer]]\n */\n PromiseMemoizer = \"core-backend.PromiseMemoizer\",\n /** The logger category used by the following classes:\n * - [[EventSink]]\n */\n EventSink = \"core-backend.EventSink\",\n\n /** The logger category used by the following classes:\n * - [[NativeHost]], [[NativeAppStorage]]\n * @internal\n */\n NativeApp = \"core-backend.NativeApp\",\n\n /** The logger category used by the following classes:\n * - [[ViewStateHydrator]]\n * @internal\n */\n ViewStateHydrator = \"core-backend.ViewStateHydrator\",\n\n /** @internal */\n Workspace = \"core-backend.Workspace\",\n}\n"]}
1
+ {"version":3,"file":"BackendLoggerCategory.js","sourceRoot":"","sources":["../../src/BackendLoggerCategory.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH;;;;GAIG;AACH,MAAM,CAAN,IAAY,qBAsGX;AAtGD,WAAY,qBAAqB;IAC/B,+DAA+D;IAC/D,qEAA4C,CAAA;IAE5C;;OAEG;IACH,6DAAoC,CAAA;IAEpC;;OAEG;IACH,2FAAkE,CAAA;IAElE;;OAEG;IACH,2DAAkC,CAAA;IAElC;;;;OAIG;IACH,mDAA0B,CAAA;IAE1B;;OAEG;IACH,+DAAsC,CAAA;IAEtC;;OAEG;IACH,6EAAoD,CAAA;IAEpD;;;OAGG;IACH,2DAAkC,CAAA;IAElC;;OAEG;IACH,+DAAsC,CAAA;IAEtC;;OAEG;IACH,mFAA0D,CAAA;IAE1D;;OAEG;IACH,2EAAkD,CAAA;IAElD;;OAEG;IACH,6EAAoD,CAAA;IAEpD;;OAEG;IACH,mEAA0C,CAAA;IAE1C;;OAEG;IACH,yDAAgC,CAAA;IAEhC;;OAEG;IACH,yEAAgD,CAAA;IAChD;;OAEG;IACH,6DAAoC,CAAA;IAEpC;;;;OAIG;IACH,mEAA0C,CAAA;IAE1C;;;OAGG;IACH,6DAAoC,CAAA;IAEpC;;;OAGG;IACH,6EAAoD,CAAA;IAEpD,gBAAgB;IAChB,6DAAoC,CAAA;AACtC,CAAC,EAtGW,qBAAqB,KAArB,qBAAqB,QAsGhC","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 Logging\n */\n\n/** Logger categories used by this package\n * @note All logger categories in this package start with the `core-backend` prefix.\n * @see [Logger]($bentley)\n * @public\n */\nexport enum BackendLoggerCategory {\n /** The logger category used by API related to authorization */\n Authorization = \"core-backend.Authorization\",\n\n /** The logger category used by the following classes:\n * - [[CodeSpecs]]\n */\n CodeSpecs = \"core-backend.CodeSpecs\",\n\n /** The logger category used by the following classes:\n * - [[CustomViewState3dCreator]]\n */\n CustomViewState3dCreator = \"core-backend.CustomViewState3dCreator\",\n\n /** The logger category used by the [[DevTools]] class and related classes.\n * @internal\n */\n DevTools = \"core-backend.DevTools\",\n\n /** The logger category used by the following classes:\n * - [[ChangeSummaryManager]]\n * - [[ECDb]]\n * - [[ECSqlStatement]]\n */\n ECDb = \"core-backend.ECDb\",\n\n /** The logger category used by the following classes:\n * - [[Functional]]\n */\n Functional = \"core-backend.Functional\",\n\n /** The logger category used by the following classes:\n * - [[LinearReferencing]]\n */\n LinearReferencing = \"core-backend.LinearReferencing\",\n\n /** The logger category used by the following classes:\n * - BriefcaseManager\n * - [[IModelDb]]\n */\n IModelDb = \"core-backend.IModelDb\",\n\n /** The logger category used by the following classes:\n * - [[IModelHost]]\n */\n IModelHost = \"core-backend.IModelHost\",\n\n /** The logger category used by the following classes:\n * - TileRequestMemoizer\n */\n IModelTileRequestRpc = \"core-backend.IModelTileRequestRpc\",\n\n /** The logger category used by the following classes:\n * - IModelTileRpcImpl (Tile Uploading)\n */\n IModelTileUpload = \"core-backend.IModelTileUpload\",\n\n /** The logger category used by the following classes:\n * - TileStorage (tile upload/download)\n */\n IModelTileStorage = \"core-backend.IModelTileStorage\",\n\n /** The logger category used by the following classes:\n * - [[Relationship]]\n */\n Relationship = \"core-backend.Relationship\",\n\n /** The logger category used by the following classes:\n * - [[Schemas]]\n */\n Schemas = \"core-backend.Schemas\",\n\n /** The logger category used by the following classes:\n * - [[PromiseMemoizer]]\n */\n PromiseMemoizer = \"core-backend.PromiseMemoizer\",\n /** The logger category used by the following classes:\n * - [[EventSink]]\n */\n EventSink = \"core-backend.EventSink\",\n\n /** The logger category used by the following classes:\n * - [[StashManager]]\n * - [[StashError]]\n * @internal\n */\n StashManager = \"core-backend.StashManager\",\n\n /** The logger category used by the following classes:\n * - [[NativeHost]], [[NativeAppStorage]]\n * @internal\n */\n NativeApp = \"core-backend.NativeApp\",\n\n /** The logger category used by the following classes:\n * - [[ViewStateHydrator]]\n * @internal\n */\n ViewStateHydrator = \"core-backend.ViewStateHydrator\",\n\n /** @internal */\n Workspace = \"core-backend.Workspace\",\n}\n"]}
@@ -6,6 +6,7 @@ import { BriefcaseId, BriefcaseProps, ChangesetFileProps, ChangesetIndex, Change
6
6
  import { AcquireNewBriefcaseIdArg, DownloadChangesetArg, DownloadChangesetRangeArg, IModelNameArg } from "./BackendHubAccess";
7
7
  import { ProgressFunction } from "./CheckpointManager";
8
8
  import { BriefcaseDb, IModelDb, TokenArg } from "./IModelDb";
9
+ import { StashProps } from "./StashManager";
9
10
  /** The argument for [[BriefcaseManager.downloadBriefcase]]
10
11
  * @public
11
12
  */
@@ -33,7 +34,8 @@ export interface PushChangesArgs extends TokenArg {
33
34
  /** The delay to wait between retry attempts on failed pushes. Default is 3 seconds. */
34
35
  pushRetryDelay?: BeDuration;
35
36
  /**
36
- * For testing purpose
37
+ * (unused)
38
+ * @deprecated Not used by BriefcaseManager. Caller should remove this flag.
37
39
  * @internal
38
40
  */
39
41
  noFastForward?: true;
@@ -55,7 +57,8 @@ export type PullChangesArgs = ToChangesetArgs & {
55
57
  */
56
58
  onProgress?: ProgressFunction;
57
59
  /**
58
- * For testing purpose
60
+ * (unused)
61
+ * @deprecated Not used by BriefcaseManager. Caller should remove this flag.
59
62
  * @internal
60
63
  */
61
64
  noFastForward?: true;
@@ -77,6 +80,8 @@ export type RevertChangesArgs = Optional<PushChangesArgs, "description"> & {
77
80
  * @public
78
81
  */
79
82
  export declare class BriefcaseManager {
83
+ /** @internal */
84
+ static readonly PULL_MERGE_RESTORE_POINT_NAME = "$pull_merge_restore_point";
80
85
  /** Get the local path of the folder storing files that are associated with an imodel */
81
86
  static getIModelPath(iModelId: GuidString): LocalDirName;
82
87
  /** @internal */
@@ -209,8 +214,57 @@ export declare class BriefcaseManager {
209
214
  private static applySingleChangeset;
210
215
  /** @internal */
211
216
  static revertTimelineChanges(db: IModelDb, arg: RevertChangesArgs): Promise<void>;
212
- /** @internal */
217
+ /**
218
+ * @internal
219
+ * Pulls and applies changesets from the iModelHub to the specified IModelDb instance.
220
+ *
221
+ * This method downloads and applies all changesets required to bring the local briefcase up to the specified changeset index.
222
+ * It supports both forward and reverse application of changesets, depending on the `toIndex` argument.
223
+ * If there are pending local transactions and a reverse operation is requested, an error is thrown.
224
+ * The method manages restore points for safe merging, handles local transaction reversal, applies each changeset in order,
225
+ * and resumes or rebases local changes as appropriate for the type of database.
226
+ *
227
+ * @param db The IModelDb instance to which changesets will be applied. Must be open and writable.
228
+ * @param arg The arguments for pulling changesets, including access token, target changeset index, and optional progress callback.
229
+ * @throws IModelError If the briefcase is not open in read-write mode, if there are pending transactions when reversing, or if applying a changeset fails.
230
+ * @returns A promise that resolves when all required changesets have been applied.
231
+ */
213
232
  static pullAndApplyChangesets(db: IModelDb, arg: PullChangesArgs): Promise<void>;
233
+ /**
234
+ * @internal
235
+ * Creates a restore point for the specified briefcase database.
236
+ *
237
+ * @param db - The {@link BriefcaseDb} instance for which to create the restore point.
238
+ * @param name - The unique name for the restore point. Must be a non-empty string.
239
+ * @returns A promise that resolves to the created stash object representing the restore point.
240
+ */
241
+ static createRestorePoint(db: BriefcaseDb, name: string): Promise<StashProps>;
242
+ /**
243
+ * @internal
244
+ * Drops a previously created restore point from the specified briefcase database.
245
+ *
246
+ * @param db - The {@link BriefcaseDb} instance from which to drop the restore point.
247
+ * @param name - The name of the restore point to be dropped. Must be a non-empty string.
248
+ */
249
+ static dropRestorePoint(db: BriefcaseDb, name: string): void;
250
+ /**
251
+ * @internal
252
+ * Checks if a restore point with the specified name exists in the given briefcase database.
253
+ *
254
+ * @param db - The {@link BriefcaseDb} instance to search within.
255
+ * @param name - The name of the restore point to check for existence.
256
+ * @returns `true` if the restore point exists and its stash is present; otherwise, `false`.
257
+ */
258
+ static containsRestorePoint(db: BriefcaseDb, name: string): boolean;
259
+ private static makeRestorePointKey;
260
+ /**
261
+ * @internal
262
+ * Restores the state of a briefcase database to a previously saved restore point.
263
+ *
264
+ * @param db - The {@link BriefcaseDb} instance to restore.
265
+ * @param name - The name of the restore point to apply.
266
+ */
267
+ static restorePoint(db: BriefcaseDb, name: string): Promise<void>;
214
268
  /** create a changeset from the current changes, and push it to iModelHub */
215
269
  private static pushChanges;
216
270
  /** Pull/merge (if necessary), then push all local changes as a changeset. Called by [[BriefcaseDb.pushChanges]]
@@ -1 +1 @@
1
- {"version":3,"file":"BriefcaseManager.d.ts","sourceRoot":"","sources":["../../src/BriefcaseManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EACL,WAAW,EAAE,UAAU,EAA6B,UAAU,EAAmD,QAAQ,EAC1H,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,WAAW,EAAoB,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,cAAc,EAA6C,mBAAmB,EACrM,YAAY,EAAE,aAAa,EAAE,wBAAwB,EACtD,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE9H,OAAO,EAAs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,EAAE,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAqBxF"}
@@ -6,22 +6,26 @@
6
6
  * @module iModels
7
7
  */
8
8
  // cspell:ignore cset csets ecchanges
9
- import * as path from "path";
9
+ import * as path from "node:path";
10
+ import * as os from "node:os";
10
11
  import { BeDuration, ChangeSetStatus, DbResult, IModelHubStatus, IModelStatus, Logger, OpenMode, StopWatch } from "@itwin/core-bentley";
11
12
  import { BriefcaseIdValue, ChangesetType, IModelError, IModelVersion, } from "@itwin/core-common";
12
13
  import { BackendLoggerCategory } from "./BackendLoggerCategory";
13
14
  import { CheckpointManager } from "./CheckpointManager";
14
- import { IModelDb } from "./IModelDb";
15
+ import { BriefcaseDb, IModelDb } from "./IModelDb";
15
16
  import { IModelHost } from "./IModelHost";
16
17
  import { IModelJsFs } from "./IModelJsFs";
17
18
  import { SchemaSync } from "./SchemaSync";
18
19
  import { _hubAccess, _nativeDb, _releaseAllLocks } from "./internal/Symbols";
19
20
  import { IModelNative } from "./internal/NativePlatform";
21
+ import { StashManager } from "./StashManager";
20
22
  const loggerCategory = BackendLoggerCategory.IModelDb;
21
23
  /** Manages downloading Briefcases and downloading and uploading changesets.
22
24
  * @public
23
25
  */
24
26
  export class BriefcaseManager {
27
+ /** @internal */
28
+ static PULL_MERGE_RESTORE_POINT_NAME = "$pull_merge_restore_point";
25
29
  /** Get the local path of the folder storing files that are associated with an imodel */
26
30
  static getIModelPath(iModelId) { return path.join(this._cacheDir, iModelId); }
27
31
  /** @internal */
@@ -135,7 +139,7 @@ export class BriefcaseManager {
135
139
  * @note *It is invalid to edit briefcases on a shared network drive* and that is a sure way to corrupt your briefcase (see https://www.sqlite.org/howtocorrupt.html)
136
140
  */
137
141
  static async downloadBriefcase(arg) {
138
- const briefcaseId = arg.briefcaseId ?? await this.acquireNewBriefcaseId(arg);
142
+ const briefcaseId = arg.briefcaseId ?? await this.acquireNewBriefcaseId({ deviceName: `${os.hostname()}:${os.type()}:${os.arch()}`, ...arg });
139
143
  const fileName = arg.fileName ?? this.getFileName({ ...arg, briefcaseId });
140
144
  if (IModelJsFs.existsSync(fileName))
141
145
  throw new IModelError(IModelStatus.FileAlreadyExists, `Briefcase "${fileName}" already exists`);
@@ -238,7 +242,7 @@ export class BriefcaseManager {
238
242
  IModelJsFs.unlinkSync(filePath);
239
243
  }
240
244
  catch (err) {
241
- throw new IModelError(IModelStatus.BadRequest, `cannot delete briefcase file ${err}`);
245
+ throw new IModelError(IModelStatus.BadRequest, `cannot delete briefcase file ${String(err)}`);
242
246
  }
243
247
  // next, delete all files that start with the briefcase's filePath (e.g. "a.bim-locks", "a.bim-journal", etc.)
244
248
  try {
@@ -261,7 +265,7 @@ export class BriefcaseManager {
261
265
  IModelJsFs.unlinkSync(pathname);
262
266
  }
263
267
  catch (error) {
264
- Logger.logError(loggerCategory, `Cannot delete file ${pathname}, ${error}`);
268
+ Logger.logError(loggerCategory, `Cannot delete file ${pathname}, ${String(error)}`);
265
269
  return false;
266
270
  }
267
271
  return true;
@@ -397,15 +401,30 @@ export class BriefcaseManager {
397
401
  });
398
402
  db.notifyChangesetApplied();
399
403
  }
400
- /** @internal */
404
+ /**
405
+ * @internal
406
+ * Pulls and applies changesets from the iModelHub to the specified IModelDb instance.
407
+ *
408
+ * This method downloads and applies all changesets required to bring the local briefcase up to the specified changeset index.
409
+ * It supports both forward and reverse application of changesets, depending on the `toIndex` argument.
410
+ * If there are pending local transactions and a reverse operation is requested, an error is thrown.
411
+ * The method manages restore points for safe merging, handles local transaction reversal, applies each changeset in order,
412
+ * and resumes or rebases local changes as appropriate for the type of database.
413
+ *
414
+ * @param db The IModelDb instance to which changesets will be applied. Must be open and writable.
415
+ * @param arg The arguments for pulling changesets, including access token, target changeset index, and optional progress callback.
416
+ * @throws IModelError If the briefcase is not open in read-write mode, if there are pending transactions when reversing, or if applying a changeset fails.
417
+ * @returns A promise that resolves when all required changesets have been applied.
418
+ */
401
419
  static async pullAndApplyChangesets(db, arg) {
402
- if (!db.isOpen || db[_nativeDb].isReadonly()) // don't use db.isReadonly - we reopen the file writable just for this operation but db.isReadonly is still true
420
+ const nativeDb = db[_nativeDb];
421
+ if (!db.isOpen || nativeDb.isReadonly()) // don't use db.isReadonly - we reopen the file writable just for this operation but db.isReadonly is still true
403
422
  throw new IModelError(ChangeSetStatus.ApplyError, "Briefcase must be open ReadWrite to process change sets");
404
423
  let currentIndex = db.changeset.index;
405
424
  if (currentIndex === undefined)
406
425
  currentIndex = (await IModelHost[_hubAccess].queryChangeset({ accessToken: arg.accessToken, iModelId: db.iModelId, changeset: { id: db.changeset.id } })).index;
407
426
  const reverse = (arg.toIndex && arg.toIndex < currentIndex) ? true : false;
408
- if (db[_nativeDb].hasPendingTxns() && reverse) {
427
+ if (nativeDb.hasPendingTxns() && reverse) {
409
428
  throw new IModelError(ChangeSetStatus.ApplyError, "Cannot reverse changesets when there are pending changes");
410
429
  }
411
430
  // Download change sets
@@ -420,53 +439,139 @@ export class BriefcaseManager {
420
439
  return; // nothing to apply
421
440
  if (reverse)
422
441
  changesets.reverse();
423
- let appliedChangesets = -1;
424
- if (db[_nativeDb].hasPendingTxns() && !reverse && !arg.noFastForward) {
425
- // attempt to perform fast forward
426
- for (const changeset of changesets) {
427
- // do not waste time on schema changesets. They cannot be fastforwarded.
428
- if (changeset.changesType === ChangesetType.Schema || changeset.changesType === ChangesetType.SchemaSync)
429
- break;
430
- try {
431
- const stopwatch = new StopWatch(`[${changeset.id}]`, true);
432
- Logger.logInfo(loggerCategory, `Starting application of changeset with id ${stopwatch.description} using fast forward method`);
433
- await this.applySingleChangeset(db, changeset, true);
434
- Logger.logInfo(loggerCategory, `Applied changeset with id ${stopwatch.description} (${stopwatch.elapsedSeconds} seconds)`);
435
- appliedChangesets++;
436
- db.saveChanges();
437
- }
438
- catch {
439
- db.abandonChanges();
440
- break;
442
+ const briefcaseDb = db instanceof BriefcaseDb ? db : undefined;
443
+ // create restore point if certain conditions are met
444
+ if (briefcaseDb && briefcaseDb.txns.hasPendingTxns && !briefcaseDb.txns.hasPendingSchemaChanges && !reverse && !IModelHost.configuration?.disableRestorePointOnPullMerge) {
445
+ Logger.logInfo(loggerCategory, `Creating restore point ${this.PULL_MERGE_RESTORE_POINT_NAME}`);
446
+ await this.createRestorePoint(briefcaseDb, this.PULL_MERGE_RESTORE_POINT_NAME);
447
+ }
448
+ if (!reverse) {
449
+ const reversedTxns = nativeDb.pullMergeReverseLocalChanges();
450
+ Logger.logInfo(loggerCategory, `Reversed ${reversedTxns.length} local changes`);
451
+ }
452
+ // apply incoming changes
453
+ for (const changeset of changesets) {
454
+ const stopwatch = new StopWatch(`[${changeset.id}]`, true);
455
+ Logger.logInfo(loggerCategory, `Starting application of changeset with id ${stopwatch.description}`);
456
+ try {
457
+ await this.applySingleChangeset(db, changeset, false);
458
+ Logger.logInfo(loggerCategory, `Applied changeset with id ${stopwatch.description} (${stopwatch.elapsedSeconds} seconds)`);
459
+ }
460
+ catch (err) {
461
+ if (err instanceof Error) {
462
+ Logger.logError(loggerCategory, `Error applying changeset with id ${stopwatch.description}: ${err.message}`);
441
463
  }
464
+ db.abandonChanges();
465
+ throw err;
442
466
  }
443
467
  }
444
- if (appliedChangesets < changesets.length - 1) {
445
- db[_nativeDb].pullMergeBegin();
446
- for (const changeset of changesets.filter((_, index) => index > appliedChangesets)) {
447
- const stopwatch = new StopWatch(`[${changeset.id}]`, true);
448
- Logger.logInfo(loggerCategory, `Starting application of changeset with id ${stopwatch.description}`);
449
- try {
450
- await this.applySingleChangeset(db, changeset, false);
451
- Logger.logInfo(loggerCategory, `Applied changeset with id ${stopwatch.description} (${stopwatch.elapsedSeconds} seconds)`);
468
+ if (!reverse) {
469
+ if (briefcaseDb) {
470
+ await briefcaseDb.txns.rebaser.resume();
471
+ }
472
+ else {
473
+ // Only Briefcase has change management. Following is
474
+ // for test related to standalone db with txn enabled.
475
+ nativeDb.pullMergeRebaseBegin();
476
+ let txnId = nativeDb.pullMergeRebaseNext();
477
+ while (txnId) {
478
+ nativeDb.pullMergeRebaseReinstateTxn();
479
+ nativeDb.pullMergeRebaseUpdateTxn();
480
+ txnId = nativeDb.pullMergeRebaseNext();
452
481
  }
453
- catch (err) {
454
- if (err instanceof Error) {
455
- Logger.logError(loggerCategory, `Error applying changeset with id ${stopwatch.description}: ${err.message}`);
456
- }
457
- db.abandonChanges();
458
- db[_nativeDb].pullMergeEnd();
459
- throw err;
482
+ nativeDb.pullMergeRebaseEnd();
483
+ if (!nativeDb.isReadonly) {
484
+ nativeDb.saveChanges("Merge.");
460
485
  }
461
486
  }
462
- db[_nativeDb].pullMergeEnd();
463
- if (!db.isReadonly) {
464
- db.saveChanges("Merge.");
487
+ if (briefcaseDb && this.containsRestorePoint(briefcaseDb, this.PULL_MERGE_RESTORE_POINT_NAME)) {
488
+ Logger.logInfo(loggerCategory, `Dropping restore point ${this.PULL_MERGE_RESTORE_POINT_NAME}`);
489
+ this.dropRestorePoint(briefcaseDb, this.PULL_MERGE_RESTORE_POINT_NAME);
465
490
  }
466
491
  }
467
492
  // notify listeners
468
493
  db.notifyChangesetApplied();
469
494
  }
495
+ /**
496
+ * @internal
497
+ * Creates a restore point for the specified briefcase database.
498
+ *
499
+ * @param db - The {@link BriefcaseDb} instance for which to create the restore point.
500
+ * @param name - The unique name for the restore point. Must be a non-empty string.
501
+ * @returns A promise that resolves to the created stash object representing the restore point.
502
+ */
503
+ static async createRestorePoint(db, name) {
504
+ Logger.logTrace(loggerCategory, `Creating restore point ${name}`);
505
+ this.dropRestorePoint(db, name);
506
+ const stash = await StashManager.stash({ db, description: this.makeRestorePointKey(name) });
507
+ db[_nativeDb].saveLocalValue(this.makeRestorePointKey(name), stash.id);
508
+ db.saveChanges("Create restore point");
509
+ Logger.logTrace(loggerCategory, `Created restore point ${name}`, () => stash);
510
+ return stash;
511
+ }
512
+ /**
513
+ * @internal
514
+ * Drops a previously created restore point from the specified briefcase database.
515
+ *
516
+ * @param db - The {@link BriefcaseDb} instance from which to drop the restore point.
517
+ * @param name - The name of the restore point to be dropped. Must be a non-empty string.
518
+ */
519
+ static dropRestorePoint(db, name) {
520
+ Logger.logTrace(loggerCategory, `Dropping restore point ${name}`);
521
+ const restorePointId = db[_nativeDb].queryLocalValue(this.makeRestorePointKey(name));
522
+ if (restorePointId) {
523
+ StashManager.dropStash({ db, stash: restorePointId });
524
+ db[_nativeDb].deleteLocalValue(this.makeRestorePointKey(name));
525
+ db.saveChanges("Drop restore point");
526
+ Logger.logTrace(loggerCategory, `Dropped restore point ${name}`);
527
+ }
528
+ }
529
+ /**
530
+ * @internal
531
+ * Checks if a restore point with the specified name exists in the given briefcase database.
532
+ *
533
+ * @param db - The {@link BriefcaseDb} instance to search within.
534
+ * @param name - The name of the restore point to check for existence.
535
+ * @returns `true` if the restore point exists and its stash is present; otherwise, `false`.
536
+ */
537
+ static containsRestorePoint(db, name) {
538
+ Logger.logTrace(loggerCategory, `Checking if restore point ${name} exists`);
539
+ const key = this.makeRestorePointKey(name);
540
+ const restorePointId = db[_nativeDb].queryLocalValue(key);
541
+ if (!restorePointId) {
542
+ return false;
543
+ }
544
+ const stash = StashManager.tryGetStash({ db, stash: restorePointId });
545
+ if (!stash) {
546
+ Logger.logTrace(loggerCategory, `Restore point ${name} does not exist. Deleting ${key}`);
547
+ db[_nativeDb].deleteLocalValue(key);
548
+ return false;
549
+ }
550
+ return true;
551
+ }
552
+ static makeRestorePointKey(name) {
553
+ if (name.length === 0) {
554
+ throw new Error("Invalid restore point name");
555
+ }
556
+ return `restore_point/${name}`;
557
+ }
558
+ /**
559
+ * @internal
560
+ * Restores the state of a briefcase database to a previously saved restore point.
561
+ *
562
+ * @param db - The {@link BriefcaseDb} instance to restore.
563
+ * @param name - The name of the restore point to apply.
564
+ */
565
+ static async restorePoint(db, name) {
566
+ Logger.logTrace(loggerCategory, `Restoring to restore point ${name}`);
567
+ const restorePointId = db[_nativeDb].queryLocalValue(this.makeRestorePointKey(name));
568
+ if (!restorePointId) {
569
+ throw new Error(`Restore point not found: ${name}`);
570
+ }
571
+ await StashManager.restore({ db, stash: restorePointId });
572
+ Logger.logTrace(loggerCategory, `Restored to restore point ${name}`);
573
+ this.dropRestorePoint(db, name);
574
+ }
470
575
  /** create a changeset from the current changes, and push it to iModelHub */
471
576
  static async pushChanges(db, arg) {
472
577
  const changesetProps = db[_nativeDb].startCreateChangeset();
@@ -523,7 +628,11 @@ export class BriefcaseManager {
523
628
  await BriefcaseManager.pullAndApplyChangesets(db, arg);
524
629
  if (!db.skipSyncSchemasOnPullAndPush)
525
630
  await SchemaSync.pull(db);
526
- return await BriefcaseManager.pushChanges(db, arg);
631
+ // pullAndApply rebase changes and might remove redundant changes in local briefcase
632
+ // this mean hasPendingTxns was true before but now after pullAndApply it might be false
633
+ if (!db[_nativeDb].hasPendingTxns())
634
+ return;
635
+ await BriefcaseManager.pushChanges(db, arg);
527
636
  }
528
637
  catch (err) {
529
638
  if (retryCount-- <= 0 || err.errorNumber !== IModelHubStatus.PullIsRequired)