@itwin/core-backend 5.2.0-dev.7 → 5.3.0-dev.1

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 (192) hide show
  1. package/CHANGELOG.md +36 -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 +151 -42
  12. package/lib/cjs/BriefcaseManager.js.map +1 -1
  13. package/lib/cjs/CloudSqlite.d.ts +4 -0
  14. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  15. package/lib/cjs/CloudSqlite.js.map +1 -1
  16. package/lib/cjs/ECDb.d.ts +8 -0
  17. package/lib/cjs/ECDb.d.ts.map +1 -1
  18. package/lib/cjs/ECDb.js +22 -0
  19. package/lib/cjs/ECDb.js.map +1 -1
  20. package/lib/cjs/IModelDb.d.ts +54 -3
  21. package/lib/cjs/IModelDb.d.ts.map +1 -1
  22. package/lib/cjs/IModelDb.js +87 -9
  23. package/lib/cjs/IModelDb.js.map +1 -1
  24. package/lib/cjs/IModelHost.d.ts +11 -1
  25. package/lib/cjs/IModelHost.d.ts.map +1 -1
  26. package/lib/cjs/IModelHost.js +5 -0
  27. package/lib/cjs/IModelHost.js.map +1 -1
  28. package/lib/cjs/IModelIncrementalSchemaLocater.d.ts +1 -5
  29. package/lib/cjs/IModelIncrementalSchemaLocater.d.ts.map +1 -1
  30. package/lib/cjs/IModelIncrementalSchemaLocater.js +0 -6
  31. package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -1
  32. package/lib/cjs/SqliteChangesetReader.d.ts +8 -0
  33. package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
  34. package/lib/cjs/SqliteChangesetReader.js +11 -0
  35. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  36. package/lib/cjs/StashManager.d.ts +175 -0
  37. package/lib/cjs/StashManager.d.ts.map +1 -0
  38. package/lib/cjs/StashManager.js +306 -0
  39. package/lib/cjs/StashManager.js.map +1 -0
  40. package/lib/cjs/TxnManager.d.ts +226 -15
  41. package/lib/cjs/TxnManager.d.ts.map +1 -1
  42. package/lib/cjs/TxnManager.js +249 -23
  43. package/lib/cjs/TxnManager.js.map +1 -1
  44. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +10 -1
  45. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  46. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +15 -6
  47. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  48. package/lib/cjs/annotations/LeaderGeometry.d.ts +3 -2
  49. package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -1
  50. package/lib/cjs/annotations/LeaderGeometry.js +5 -4
  51. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
  52. package/lib/cjs/annotations/TextAnnotationElement.d.ts +52 -24
  53. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
  54. package/lib/cjs/annotations/TextAnnotationElement.js +49 -59
  55. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  56. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +2 -0
  57. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -1
  58. package/lib/cjs/annotations/TextAnnotationGeometry.js +26 -19
  59. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
  60. package/lib/cjs/annotations/TextBlockGeometry.d.ts.map +1 -1
  61. package/lib/cjs/annotations/TextBlockGeometry.js +8 -0
  62. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -1
  63. package/lib/cjs/annotations/TextBlockLayout.d.ts +49 -36
  64. package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -1
  65. package/lib/cjs/annotations/TextBlockLayout.js +204 -135
  66. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -1
  67. package/lib/cjs/internal/ChannelAdmin.js +1 -1
  68. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  69. package/lib/cjs/internal/Symbols.d.ts +1 -0
  70. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  71. package/lib/cjs/internal/Symbols.js +2 -1
  72. package/lib/cjs/internal/Symbols.js.map +1 -1
  73. package/lib/cjs/internal/annotations/fields.d.ts +2 -12
  74. package/lib/cjs/internal/annotations/fields.d.ts.map +1 -1
  75. package/lib/cjs/internal/annotations/fields.js +49 -45
  76. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  77. package/lib/cjs/workspace/Workspace.d.ts +1 -1
  78. package/lib/cjs/workspace/Workspace.js.map +1 -1
  79. package/lib/esm/BackendHubAccess.d.ts +2 -0
  80. package/lib/esm/BackendHubAccess.d.ts.map +1 -1
  81. package/lib/esm/BackendHubAccess.js.map +1 -1
  82. package/lib/esm/BackendLoggerCategory.d.ts +6 -0
  83. package/lib/esm/BackendLoggerCategory.d.ts.map +1 -1
  84. package/lib/esm/BackendLoggerCategory.js +6 -0
  85. package/lib/esm/BackendLoggerCategory.js.map +1 -1
  86. package/lib/esm/BriefcaseManager.d.ts +57 -3
  87. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  88. package/lib/esm/BriefcaseManager.js +152 -43
  89. package/lib/esm/BriefcaseManager.js.map +1 -1
  90. package/lib/esm/CloudSqlite.d.ts +4 -0
  91. package/lib/esm/CloudSqlite.d.ts.map +1 -1
  92. package/lib/esm/CloudSqlite.js.map +1 -1
  93. package/lib/esm/ECDb.d.ts +8 -0
  94. package/lib/esm/ECDb.d.ts.map +1 -1
  95. package/lib/esm/ECDb.js +22 -0
  96. package/lib/esm/ECDb.js.map +1 -1
  97. package/lib/esm/IModelDb.d.ts +54 -3
  98. package/lib/esm/IModelDb.d.ts.map +1 -1
  99. package/lib/esm/IModelDb.js +88 -10
  100. package/lib/esm/IModelDb.js.map +1 -1
  101. package/lib/esm/IModelHost.d.ts +11 -1
  102. package/lib/esm/IModelHost.d.ts.map +1 -1
  103. package/lib/esm/IModelHost.js +5 -0
  104. package/lib/esm/IModelHost.js.map +1 -1
  105. package/lib/esm/IModelIncrementalSchemaLocater.d.ts +1 -5
  106. package/lib/esm/IModelIncrementalSchemaLocater.d.ts.map +1 -1
  107. package/lib/esm/IModelIncrementalSchemaLocater.js +0 -6
  108. package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -1
  109. package/lib/esm/SqliteChangesetReader.d.ts +8 -0
  110. package/lib/esm/SqliteChangesetReader.d.ts.map +1 -1
  111. package/lib/esm/SqliteChangesetReader.js +11 -0
  112. package/lib/esm/SqliteChangesetReader.js.map +1 -1
  113. package/lib/esm/StashManager.d.ts +175 -0
  114. package/lib/esm/StashManager.d.ts.map +1 -0
  115. package/lib/esm/StashManager.js +301 -0
  116. package/lib/esm/StashManager.js.map +1 -0
  117. package/lib/esm/TxnManager.d.ts +226 -15
  118. package/lib/esm/TxnManager.d.ts.map +1 -1
  119. package/lib/esm/TxnManager.js +247 -21
  120. package/lib/esm/TxnManager.js.map +1 -1
  121. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +10 -1
  122. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  123. package/lib/esm/annotations/ElementDrivesTextAnnotation.js +13 -5
  124. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  125. package/lib/esm/annotations/LeaderGeometry.d.ts +3 -2
  126. package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -1
  127. package/lib/esm/annotations/LeaderGeometry.js +5 -4
  128. package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
  129. package/lib/esm/annotations/TextAnnotationElement.d.ts +52 -24
  130. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
  131. package/lib/esm/annotations/TextAnnotationElement.js +51 -61
  132. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  133. package/lib/esm/annotations/TextAnnotationGeometry.d.ts +2 -0
  134. package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -1
  135. package/lib/esm/annotations/TextAnnotationGeometry.js +26 -19
  136. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
  137. package/lib/esm/annotations/TextBlockGeometry.d.ts.map +1 -1
  138. package/lib/esm/annotations/TextBlockGeometry.js +8 -0
  139. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -1
  140. package/lib/esm/annotations/TextBlockLayout.d.ts +49 -36
  141. package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -1
  142. package/lib/esm/annotations/TextBlockLayout.js +205 -136
  143. package/lib/esm/annotations/TextBlockLayout.js.map +1 -1
  144. package/lib/esm/internal/ChannelAdmin.js +1 -1
  145. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  146. package/lib/esm/internal/Symbols.d.ts +1 -0
  147. package/lib/esm/internal/Symbols.d.ts.map +1 -1
  148. package/lib/esm/internal/Symbols.js +1 -0
  149. package/lib/esm/internal/Symbols.js.map +1 -1
  150. package/lib/esm/internal/annotations/fields.d.ts +2 -12
  151. package/lib/esm/internal/annotations/fields.d.ts.map +1 -1
  152. package/lib/esm/internal/annotations/fields.js +51 -47
  153. package/lib/esm/internal/annotations/fields.js.map +1 -1
  154. package/lib/esm/test/AnnotationTestUtils.d.ts +5 -1
  155. package/lib/esm/test/AnnotationTestUtils.d.ts.map +1 -1
  156. package/lib/esm/test/AnnotationTestUtils.js +6 -1
  157. package/lib/esm/test/AnnotationTestUtils.js.map +1 -1
  158. package/lib/esm/test/annotations/Fields.test.js +163 -46
  159. package/lib/esm/test/annotations/Fields.test.js.map +1 -1
  160. package/lib/esm/test/annotations/LeaderGeometry.test.js +12 -10
  161. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
  162. package/lib/esm/test/annotations/TextAnnotation.test.js +299 -43
  163. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  164. package/lib/esm/test/annotations/TextBlock.test.js +453 -86
  165. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
  166. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts +46 -0
  167. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts.map +1 -1
  168. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js +20 -2
  169. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
  170. package/lib/esm/test/ecdb/ECDb.test.js +71 -1
  171. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  172. package/lib/esm/test/hubaccess/Rebase.test.d.ts +2 -0
  173. package/lib/esm/test/hubaccess/Rebase.test.d.ts.map +1 -0
  174. package/lib/esm/test/hubaccess/Rebase.test.js +640 -0
  175. package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -0
  176. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js +20 -20
  177. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
  178. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +3 -3
  179. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
  180. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts +16 -1
  181. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts.map +1 -1
  182. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js +47 -0
  183. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +1 -1
  184. package/lib/esm/test/standalone/ChangeMerge.test.js +15 -19
  185. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  186. package/lib/esm/test/standalone/ChangesetReader.test.js +131 -1
  187. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  188. package/lib/esm/test/standalone/MergeConflict.test.js +3 -3
  189. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  190. package/lib/esm/workspace/Workspace.d.ts +1 -1
  191. package/lib/esm/workspace/Workspace.js.map +1 -1
  192. package/package.json +13 -13
package/CHANGELOG.md CHANGED
@@ -1,6 +1,41 @@
1
1
  # Change Log - @itwin/core-backend
2
2
 
3
- This log was last generated on Fri, 08 Aug 2025 18:10:14 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 17 Sep 2025 17:22:50 GMT and should not be manually modified.
4
+
5
+ ## 5.1.8
6
+ Wed, 17 Sep 2025 17:17:16 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 5.1.7
11
+ Tue, 09 Sep 2025 19:28:04 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 5.1.6
16
+ Mon, 08 Sep 2025 13:53:46 GMT
17
+
18
+ _Version update only_
19
+
20
+ ## 5.1.5
21
+ Thu, 04 Sep 2025 13:51:08 GMT
22
+
23
+ _Version update only_
24
+
25
+ ## 5.1.4
26
+ Fri, 22 Aug 2025 14:22:33 GMT
27
+
28
+ _Version update only_
29
+
30
+ ## 5.1.3
31
+ Wed, 20 Aug 2025 13:57:10 GMT
32
+
33
+ _Version update only_
34
+
35
+ ## 5.1.2
36
+ Thu, 14 Aug 2025 19:38:08 GMT
37
+
38
+ _Version update only_
4
39
 
5
40
  ## 5.1.1
6
41
  Fri, 08 Aug 2025 18:06:10 GMT
@@ -93,6 +93,8 @@ export interface IModelIdArg extends TokenArg {
93
93
  export interface AcquireNewBriefcaseIdArg extends IModelIdArg {
94
94
  /** A string to be reported to other users to identify this briefcase, for example in the case of conflicts or lock collisions. */
95
95
  readonly briefcaseAlias?: string;
96
+ /** A string to represent the device that holds the briefcase. */
97
+ readonly deviceName?: string;
96
98
  }
97
99
  /** Argument for methods that must supply an IModel name and iTwinId
98
100
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"BackendHubAccess.d.ts","sourceRoot":"","sources":["../../src/BackendHubAccess.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAmB,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EACL,WAAW,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,cAAc,EACzH,SAAS,IAAI,eAAe,EAAE,WAAW,EAAE,aAAa,EACxD,YAAY,EAAE,aAAa,EAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;EAEE;AACF,qBAAa,YAAa,SAAQ,WAAW;IAEzC,mCAAmC;aACnB,WAAW,EAAE,WAAW;IACxC,sCAAsC;aACtB,cAAc,EAAE,MAAM;;IAHtC,mCAAmC;IACnB,WAAW,EAAE,WAAW;IACxC,sCAAsC;IACtB,cAAc,EAAE,MAAM,EACtC,GAAG,EAAE,qBAAqB,GAAG,gCAAgC;CAIhE;AAED;;;GAGG;AACH,oBAAY,SAAS;IACnB,gCAAgC;IAChC,IAAI,IAAI;IACR,mJAAmJ;IACnJ,MAAM,IAAI;IACV;;OAEG;IACH,SAAS,IAAI;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,+BAA+B;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,6EAA6E;IAC7E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iFAAiF;IACjF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;I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EAAE,CAAC,GAAG,EAAE,oBAAoB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAEpE,uBAAuB;IACvB,YAAY,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChE"}
@@ -1 +1 @@
1
- {"version":3,"file":"BackendHubAccess.js","sourceRoot":"","sources":["../../src/BackendHubAccess.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2F;AAC3F,oDAI4B;AAI5B;;EAEE;AACF,MAAa,YAAa,SAAQ,yBAAW;IAGzB;IAEA;IAJlB;IACE,mCAAmC;IACnB,WAAwB;IACxC,sCAAsC;IACtB,cAAsB,EACtC,GAA6D;QAE7D,KAAK,CAAC,8BAAe,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAC;QALxC,gBAAW,GAAX,WAAW,CAAa;QAExB,mBAAc,GAAd,cAAc,CAAQ;IAIxC,CAAC;CACF;AAVD,oCAUC;AAED;;;GAGG;AACH,IAAY,SASX;AATD,WAAY,SAAS;IACnB,gCAAgC;IAChC,yCAAQ,CAAA;IACR,mJAAmJ;IACnJ,6CAAU,CAAA;IACV;;OAEG;IACH,mDAAa,CAAA;AACf,CAAC,EATW,SAAS,yBAAT,SAAS,QASpB","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 HubAccess\n */\n\nimport { AccessToken, GuidString, Id64String, IModelHubStatus } from \"@itwin/core-bentley\";\nimport {\n BriefcaseId, ChangesetFileProps, ChangesetIdWithIndex, ChangesetIndex, ChangesetIndexOrId, ChangesetProps, ChangesetRange,\n LockState as CommonLockState, IModelError, IModelVersion,\n LocalDirName, LocalFileName,\n} from \"@itwin/core-common\";\nimport { CheckpointProps, ProgressFunction } from \"./CheckpointManager\";\nimport type { TokenArg } from \"./IModelDb\";\n\n/** Exception thrown if lock cannot be acquired.\n * @beta\n*/\nexport class LockConflict extends IModelError {\n public constructor(\n /** Id of Briefcase holding lock */\n public readonly briefcaseId: BriefcaseId,\n /** Alias of Briefcase holding lock */\n public readonly briefcaseAlias: string,\n msg: \"shared lock is held\" | \"exclusive lock is already held\",\n ) {\n super(IModelHubStatus.LockOwnedByAnotherBriefcase, msg);\n }\n}\n\n/** The state of a lock. See [Acquiring locks on elements.]($docs/learning/backend/ConcurrencyControl.md#acquiring-locks-on-elements).\n * @deprecated in 4.7 - will not be removed until after 2026-06-13. Use [LockState]($common)\n * @public\n */\nexport enum LockState {\n /** The element is not locked */\n None = 0,\n /** Holding a shared lock on an element blocks other users from acquiring the Exclusive lock it. More than one user may acquire the shared lock. */\n Shared = 1,\n /** A Lock that permits modifications to an element and blocks other users from making modifications to it.\n * Holding an exclusive lock on an \"owner\" (a model or a parent element), implicitly exclusively locks all its members.\n */\n Exclusive = 2,\n}\n\n/**\n * The properties to access a V2 checkpoint through a daemon.\n * @public\n */\nexport interface V2CheckpointAccessProps {\n /** blob store account name. */\n readonly accountName: string;\n /** AccessToken that grants access to the container. */\n readonly sasToken: AccessToken;\n /** The name of the iModel's blob store container holding all checkpoints. */\n readonly containerId: string;\n /** The name of the virtual file within the container, used for the checkpoint */\n readonly dbName: string;\n /** blob storage module: e.g. \"azure\", \"google\", \"aws\". May also include URI style parameters. */\n readonly storageType: string;\n}\n\n/**\n * Maps element Ids to their corresponding [LockState]($common)s.\n * @public\n */\nexport type LockMap = Map<Id64String, CommonLockState>;\n\n/**\n * The properties of a lock that may be obtained from a lock server.\n * @public\n */\nexport interface LockProps {\n /** The elementId for the lock */\n readonly id: Id64String;\n /** the lock state */\n readonly state: CommonLockState;\n}\n\n/**\n * Argument for cancelling and tracking download progress.\n * @public\n */\nexport interface DownloadProgressArg {\n /** Called to show progress during a download. If this function returns non-zero, the download is aborted. */\n progressCallback?: ProgressFunction;\n}\n\n/**\n * Argument for methods that must supply an iTwinId\n * @public\n */\nexport interface ITwinIdArg {\n readonly iTwinId: GuidString;\n}\n\n/**\n * Argument for methods that must supply an IModelId\n * @public\n */\nexport interface IModelIdArg extends TokenArg {\n readonly iModelId: GuidString;\n}\n\n/**\n * Argument for acquiring a new BriefcaseId\n * @public\n */\nexport interface AcquireNewBriefcaseIdArg extends IModelIdArg {\n /** A string to be reported to other users to identify this briefcase, for example in the case of conflicts or lock collisions. */\n readonly briefcaseAlias?: string;\n}\n\n/** Argument for methods that must supply an IModel name and iTwinId\n * @public\n */\nexport interface IModelNameArg extends TokenArg, ITwinIdArg {\n readonly iModelName: string;\n}\n\n/** Argument for methods that must supply an IModelId and a BriefcaseId\n * @public\n */\nexport interface BriefcaseIdArg extends IModelIdArg {\n readonly briefcaseId: BriefcaseId;\n}\n\n/** Argument for methods that must supply a briefcaseId and a changeset\n * @public\n */\nexport interface BriefcaseDbArg extends BriefcaseIdArg {\n readonly changeset: ChangesetIdWithIndex;\n}\n\n/** Argument for methods that must supply an IModelId and a changeset\n * @public\n */\nexport interface ChangesetArg extends IModelIdArg {\n readonly changeset: ChangesetIndexOrId;\n}\n\n/** Argument for downloading a changeset.\n * @public\n */\nexport interface DownloadChangesetArg extends ChangesetArg, DownloadProgressArg {\n /** Directory where the changeset should be downloaded. */\n targetDir: LocalDirName;\n}\n\n/** @internal */\nexport interface ChangesetIndexArg extends IModelIdArg {\n readonly changeset: ChangesetIdWithIndex;\n}\n\n/** Argument for methods that must supply an IModelId and a range of Changesets.\n * @public\n */\nexport interface ChangesetRangeArg extends IModelIdArg {\n /** the range of changesets desired. If is undefined, *all* changesets are returned. */\n readonly range?: ChangesetRange;\n}\n\n/** Argument for downloading a changeset range.\n * @public\n */\nexport interface DownloadChangesetRangeArg extends ChangesetRangeArg, DownloadProgressArg {\n /** Directory where the changesets should be downloaded. */\n targetDir: LocalDirName;\n}\n\n/**\n * Arguments to create a new iModel in iModelHub\n * @public\n */\nexport interface CreateNewIModelProps extends IModelNameArg {\n readonly description?: string;\n readonly version0?: LocalFileName;\n readonly noLocks?: true;\n}\n\n/**\n * Methods for accessing services of IModelHub from an iTwin.js backend.\n * Generally direct access to these methods should not be required, since higher-level apis are provided.\n * @public\n */\nexport interface BackendHubAccess {\n /** Download all the changesets in the specified range. */\n downloadChangesets: (arg: DownloadChangesetRangeArg) => Promise<ChangesetFileProps[]>;\n /** Download a single changeset. */\n downloadChangeset: (arg: DownloadChangesetArg) => Promise<ChangesetFileProps>;\n /** Query the changeset properties given a ChangesetIndex */\n queryChangeset: (arg: ChangesetArg) => Promise<ChangesetProps>;\n /** Query an array of changeset properties given a range of ChangesetIndexes */\n queryChangesets: (arg: ChangesetRangeArg) => Promise<ChangesetProps[]>;\n /** Push a changeset to iModelHub. Returns the newly pushed changeset's index */\n pushChangeset: (arg: IModelIdArg & { changesetProps: ChangesetFileProps }) => Promise<ChangesetIndex>;\n /** Get the ChangesetProps of the most recent changeset */\n getLatestChangeset: (arg: IModelIdArg) => Promise<ChangesetProps>;\n /** Get the ChangesetProps for an IModelVersion */\n getChangesetFromVersion: (arg: IModelIdArg & { version: IModelVersion }) => Promise<ChangesetProps>;\n /** Get the ChangesetProps for a named version */\n getChangesetFromNamedVersion: (arg: IModelIdArg & { versionName: string }) => Promise<ChangesetProps>;\n\n /** Acquire a new briefcaseId for the supplied iModelId\n * @note usually there should only be one briefcase per iModel per user.\n */\n acquireNewBriefcaseId: (arg: AcquireNewBriefcaseIdArg) => Promise<BriefcaseId>;\n /** Release a briefcaseId. After this call it is illegal to generate changesets for the released briefcaseId. */\n releaseBriefcase: (arg: BriefcaseIdArg) => Promise<void>;\n\n /** get an array of the briefcases assigned to a user. */\n getMyBriefcaseIds: (arg: IModelIdArg) => Promise<BriefcaseId[]>;\n\n /** Get the access props for a V2 checkpoint. Returns undefined if no V2 checkpoint exists. */\n queryV2Checkpoint: (arg: CheckpointProps) => Promise<V2CheckpointAccessProps | undefined>;\n\n /**\n * acquire one or more locks. Throws if unsuccessful. If *any* lock cannot be obtained, no locks are acquired\n * @throws ConflictingLocksError if one or more requested locks are held by other briefcases.\n */\n acquireLocks: (arg: BriefcaseDbArg, locks: LockMap) => Promise<void>;\n\n /** Get the list of all held locks for a briefcase. This can be very expensive and is currently used only for tests. */\n queryAllLocks: (arg: BriefcaseDbArg) => Promise<LockProps[]>;\n\n /** Release all currently held locks */\n releaseAllLocks: (arg: BriefcaseDbArg) => Promise<void>;\n\n /** Get the iModelId of an iModel by name. Undefined if no iModel with that name exists. */\n queryIModelByName: (arg: IModelNameArg) => Promise<GuidString | undefined>;\n\n /** create a new iModel. Returns the Guid of the newly created iModel */\n createNewIModel: (arg: CreateNewIModelProps) => Promise<GuidString>;\n\n /** delete an iModel */\n deleteIModel: (arg: IModelIdArg & ITwinIdArg) => Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"BackendHubAccess.js","sourceRoot":"","sources":["../../src/BackendHubAccess.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2F;AAC3F,oDAI4B;AAI5B;;EAEE;AACF,MAAa,YAAa,SAAQ,yBAAW;IAGzB;IAEA;IAJlB;IACE,mCAAmC;IACnB,WAAwB;IACxC,sCAAsC;IACtB,cAAsB,EACtC,GAA6D;QAE7D,KAAK,CAAC,8BAAe,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAC;QALxC,gBAAW,GAAX,WAAW,CAAa;QAExB,mBAAc,GAAd,cAAc,CAAQ;IAIxC,CAAC;CACF;AAVD,oCAUC;AAED;;;GAGG;AACH,IAAY,SASX;AATD,WAAY,SAAS;IACnB,gCAAgC;IAChC,yCAAQ,CAAA;IACR,mJAAmJ;IACnJ,6CAAU,CAAA;IACV;;OAEG;IACH,mDAAa,CAAA;AACf,CAAC,EATW,SAAS,yBAAT,SAAS,QASpB","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 HubAccess\n */\n\nimport { AccessToken, GuidString, Id64String, IModelHubStatus } from \"@itwin/core-bentley\";\nimport {\n BriefcaseId, ChangesetFileProps, ChangesetIdWithIndex, ChangesetIndex, ChangesetIndexOrId, ChangesetProps, ChangesetRange,\n LockState as CommonLockState, IModelError, IModelVersion,\n LocalDirName, LocalFileName,\n} from \"@itwin/core-common\";\nimport { CheckpointProps, ProgressFunction } from \"./CheckpointManager\";\nimport type { TokenArg } from \"./IModelDb\";\n\n/** Exception thrown if lock cannot be acquired.\n * @beta\n*/\nexport class LockConflict extends IModelError {\n public constructor(\n /** Id of Briefcase holding lock */\n public readonly briefcaseId: BriefcaseId,\n /** Alias of Briefcase holding lock */\n public readonly briefcaseAlias: string,\n msg: \"shared lock is held\" | \"exclusive lock is already held\",\n ) {\n super(IModelHubStatus.LockOwnedByAnotherBriefcase, msg);\n }\n}\n\n/** The state of a lock. See [Acquiring locks on elements.]($docs/learning/backend/ConcurrencyControl.md#acquiring-locks-on-elements).\n * @deprecated in 4.7 - will not be removed until after 2026-06-13. Use [LockState]($common)\n * @public\n */\nexport enum LockState {\n /** The element is not locked */\n None = 0,\n /** Holding a shared lock on an element blocks other users from acquiring the Exclusive lock it. More than one user may acquire the shared lock. */\n Shared = 1,\n /** A Lock that permits modifications to an element and blocks other users from making modifications to it.\n * Holding an exclusive lock on an \"owner\" (a model or a parent element), implicitly exclusively locks all its members.\n */\n Exclusive = 2,\n}\n\n/**\n * The properties to access a V2 checkpoint through a daemon.\n * @public\n */\nexport interface V2CheckpointAccessProps {\n /** blob store account name. */\n readonly accountName: string;\n /** AccessToken that grants access to the container. */\n readonly sasToken: AccessToken;\n /** The name of the iModel's blob store container holding all checkpoints. */\n readonly containerId: string;\n /** The name of the virtual file within the container, used for the checkpoint */\n readonly dbName: string;\n /** blob storage module: e.g. \"azure\", \"google\", \"aws\". May also include URI style parameters. */\n readonly storageType: string;\n}\n\n/**\n * Maps element Ids to their corresponding [LockState]($common)s.\n * @public\n */\nexport type LockMap = Map<Id64String, CommonLockState>;\n\n/**\n * The properties of a lock that may be obtained from a lock server.\n * @public\n */\nexport interface LockProps {\n /** The elementId for the lock */\n readonly id: Id64String;\n /** the lock state */\n readonly state: CommonLockState;\n}\n\n/**\n * Argument for cancelling and tracking download progress.\n * @public\n */\nexport interface DownloadProgressArg {\n /** Called to show progress during a download. If this function returns non-zero, the download is aborted. */\n progressCallback?: ProgressFunction;\n}\n\n/**\n * Argument for methods that must supply an iTwinId\n * @public\n */\nexport interface ITwinIdArg {\n readonly iTwinId: GuidString;\n}\n\n/**\n * Argument for methods that must supply an IModelId\n * @public\n */\nexport interface IModelIdArg extends TokenArg {\n readonly iModelId: GuidString;\n}\n\n/**\n * Argument for acquiring a new BriefcaseId\n * @public\n */\nexport interface AcquireNewBriefcaseIdArg extends IModelIdArg {\n /** A string to be reported to other users to identify this briefcase, for example in the case of conflicts or lock collisions. */\n readonly briefcaseAlias?: string;\n /** A string to represent the device that holds the briefcase. */\n readonly deviceName?: string;\n}\n\n/** Argument for methods that must supply an IModel name and iTwinId\n * @public\n */\nexport interface IModelNameArg extends TokenArg, ITwinIdArg {\n readonly iModelName: string;\n}\n\n/** Argument for methods that must supply an IModelId and a BriefcaseId\n * @public\n */\nexport interface BriefcaseIdArg extends IModelIdArg {\n readonly briefcaseId: BriefcaseId;\n}\n\n/** Argument for methods that must supply a briefcaseId and a changeset\n * @public\n */\nexport interface BriefcaseDbArg extends BriefcaseIdArg {\n readonly changeset: ChangesetIdWithIndex;\n}\n\n/** Argument for methods that must supply an IModelId and a changeset\n * @public\n */\nexport interface ChangesetArg extends IModelIdArg {\n readonly changeset: ChangesetIndexOrId;\n}\n\n/** Argument for downloading a changeset.\n * @public\n */\nexport interface DownloadChangesetArg extends ChangesetArg, DownloadProgressArg {\n /** Directory where the changeset should be downloaded. */\n targetDir: LocalDirName;\n}\n\n/** @internal */\nexport interface ChangesetIndexArg extends IModelIdArg {\n readonly changeset: ChangesetIdWithIndex;\n}\n\n/** Argument for methods that must supply an IModelId and a range of Changesets.\n * @public\n */\nexport interface ChangesetRangeArg extends IModelIdArg {\n /** the range of changesets desired. If is undefined, *all* changesets are returned. */\n readonly range?: ChangesetRange;\n}\n\n/** Argument for downloading a changeset range.\n * @public\n */\nexport interface DownloadChangesetRangeArg extends ChangesetRangeArg, DownloadProgressArg {\n /** Directory where the changesets should be downloaded. */\n targetDir: LocalDirName;\n}\n\n/**\n * Arguments to create a new iModel in iModelHub\n * @public\n */\nexport interface CreateNewIModelProps extends IModelNameArg {\n readonly description?: string;\n readonly version0?: LocalFileName;\n readonly noLocks?: true;\n}\n\n/**\n * Methods for accessing services of IModelHub from an iTwin.js backend.\n * Generally direct access to these methods should not be required, since higher-level apis are provided.\n * @public\n */\nexport interface BackendHubAccess {\n /** Download all the changesets in the specified range. */\n downloadChangesets: (arg: DownloadChangesetRangeArg) => Promise<ChangesetFileProps[]>;\n /** Download a single changeset. */\n downloadChangeset: (arg: DownloadChangesetArg) => Promise<ChangesetFileProps>;\n /** Query the changeset properties given a ChangesetIndex */\n queryChangeset: (arg: ChangesetArg) => Promise<ChangesetProps>;\n /** Query an array of changeset properties given a range of ChangesetIndexes */\n queryChangesets: (arg: ChangesetRangeArg) => Promise<ChangesetProps[]>;\n /** Push a changeset to iModelHub. Returns the newly pushed changeset's index */\n pushChangeset: (arg: IModelIdArg & { changesetProps: ChangesetFileProps }) => Promise<ChangesetIndex>;\n /** Get the ChangesetProps of the most recent changeset */\n getLatestChangeset: (arg: IModelIdArg) => Promise<ChangesetProps>;\n /** Get the ChangesetProps for an IModelVersion */\n getChangesetFromVersion: (arg: IModelIdArg & { version: IModelVersion }) => Promise<ChangesetProps>;\n /** Get the ChangesetProps for a named version */\n getChangesetFromNamedVersion: (arg: IModelIdArg & { versionName: string }) => Promise<ChangesetProps>;\n\n /** Acquire a new briefcaseId for the supplied iModelId\n * @note usually there should only be one briefcase per iModel per user.\n */\n acquireNewBriefcaseId: (arg: AcquireNewBriefcaseIdArg) => Promise<BriefcaseId>;\n /** Release a briefcaseId. After this call it is illegal to generate changesets for the released briefcaseId. */\n releaseBriefcase: (arg: BriefcaseIdArg) => Promise<void>;\n\n /** get an array of the briefcases assigned to a user. */\n getMyBriefcaseIds: (arg: IModelIdArg) => Promise<BriefcaseId[]>;\n\n /** Get the access props for a V2 checkpoint. Returns undefined if no V2 checkpoint exists. */\n queryV2Checkpoint: (arg: CheckpointProps) => Promise<V2CheckpointAccessProps | undefined>;\n\n /**\n * acquire one or more locks. Throws if unsuccessful. If *any* lock cannot be obtained, no locks are acquired\n * @throws ConflictingLocksError if one or more requested locks are held by other briefcases.\n */\n acquireLocks: (arg: BriefcaseDbArg, locks: LockMap) => Promise<void>;\n\n /** Get the list of all held locks for a briefcase. This can be very expensive and is currently used only for tests. */\n queryAllLocks: (arg: BriefcaseDbArg) => Promise<LockProps[]>;\n\n /** Release all currently held locks */\n releaseAllLocks: (arg: BriefcaseDbArg) => Promise<void>;\n\n /** Get the iModelId of an iModel by name. Undefined if no iModel with that name exists. */\n queryIModelByName: (arg: IModelNameArg) => Promise<GuidString | undefined>;\n\n /** create a new iModel. Returns the Guid of the newly created iModel */\n createNewIModel: (arg: CreateNewIModelProps) => Promise<GuidString>;\n\n /** delete an iModel */\n deleteIModel: (arg: IModelIdArg & ITwinIdArg) => Promise<void>;\n}\n"]}
@@ -72,6 +72,12 @@ export declare enum BackendLoggerCategory {
72
72
  * - [[EventSink]]
73
73
  */
74
74
  EventSink = "core-backend.EventSink",
75
+ /** The logger category used by the following classes:
76
+ * - [[StashManager]]
77
+ * - [[StashError]]
78
+ * @internal
79
+ */
80
+ StashManager = "core-backend.StashManager",
75
81
  /** The logger category used by the following classes:
76
82
  * - [[NativeHost]], [[NativeAppStorage]]
77
83
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"BackendLoggerCategory.d.ts","sourceRoot":"","sources":["../../src/BackendLoggerCategory.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;GAIG;AACH,oBAAY,qBAAqB;IAC/B,+DAA+D;IAC/D,aAAa,+BAA+B;IAE5C;;OAEG;IACH,SAAS,2BAA2B;IAEpC;;OAEG;IACH,wBAAwB,0CAA0C;IAElE;;OAEG;IACH,QAAQ,0BAA0B;IAElC;;;;OAIG;IACH,IAAI,sBAAsB;IAE1B;;OAEG;IACH,UAAU,4BAA4B;IAEtC;;OAEG;IACH,iBAAiB,mCAAmC;IAEpD;;;OAGG;IACH,QAAQ,0BAA0B;IAElC;;OAEG;IACH,UAAU,4BAA4B;IAEtC;;OAEG;IACH,oBAAoB,sCAAsC;IAE1D;;OAEG;IACH,gBAAgB,kCAAkC;IAElD;;OAEG;IACH,iBAAiB,mCAAmC;IAEpD;;OAEG;IACH,YAAY,8BAA8B;IAE1C;;OAEG;IACH,OAAO,yBAAyB;IAEhC;;OAEG;IACH,eAAe,iCAAiC;IAChD;;OAEG;IACH,SAAS,2BAA2B;IAEpC;;;OAGG;IACH,SAAS,2BAA2B;IAEpC;;;OAGG;IACH,iBAAiB,mCAAmC;IAEpD,gBAAgB;IAChB,SAAS,2BAA2B;CACrC"}
1
+ {"version":3,"file":"BackendLoggerCategory.d.ts","sourceRoot":"","sources":["../../src/BackendLoggerCategory.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;GAIG;AACH,oBAAY,qBAAqB;IAC/B,+DAA+D;IAC/D,aAAa,+BAA+B;IAE5C;;OAEG;IACH,SAAS,2BAA2B;IAEpC;;OAEG;IACH,wBAAwB,0CAA0C;IAElE;;OAEG;IACH,QAAQ,0BAA0B;IAElC;;;;OAIG;IACH,IAAI,sBAAsB;IAE1B;;OAEG;IACH,UAAU,4BAA4B;IAEtC;;OAEG;IACH,iBAAiB,mCAAmC;IAEpD;;;OAGG;IACH,QAAQ,0BAA0B;IAElC;;OAEG;IACH,UAAU,4BAA4B;IAEtC;;OAEG;IACH,oBAAoB,sCAAsC;IAE1D;;OAEG;IACH,gBAAgB,kCAAkC;IAElD;;OAEG;IACH,iBAAiB,mCAAmC;IAEpD;;OAEG;IACH,YAAY,8BAA8B;IAE1C;;OAEG;IACH,OAAO,yBAAyB;IAEhC;;OAEG;IACH,eAAe,iCAAiC;IAChD;;OAEG;IACH,SAAS,2BAA2B;IAEpC;;;;OAIG;IACH,YAAY,8BAA8B;IAE1C;;;OAGG;IACH,SAAS,2BAA2B;IAEpC;;;OAGG;IACH,iBAAiB,mCAAmC;IAEpD,gBAAgB;IAChB,SAAS,2BAA2B;CACrC"}
@@ -80,6 +80,12 @@ var BackendLoggerCategory;
80
80
  * - [[EventSink]]
81
81
  */
82
82
  BackendLoggerCategory["EventSink"] = "core-backend.EventSink";
83
+ /** The logger category used by the following classes:
84
+ * - [[StashManager]]
85
+ * - [[StashError]]
86
+ * @internal
87
+ */
88
+ BackendLoggerCategory["StashManager"] = "core-backend.StashManager";
83
89
  /** The logger category used by the following classes:
84
90
  * - [[NativeHost]], [[NativeAppStorage]]
85
91
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"BackendLoggerCategory.js","sourceRoot":"","sources":["../../src/BackendLoggerCategory.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;GAIG;AACH,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,qCAArB,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,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,qCAArB,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,E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AI,EAAE,MAAM,GAAG,OAAO;IAiB1E,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAOlC;;;;;;OAMG;WACiB,YAAY,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY9E,4EAA4E;mBACvD,WAAW;IAgDhC;;OAEG;WACiB,aAAa,CAAC,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAqBxF"}
@@ -9,7 +9,8 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.BriefcaseManager = void 0;
11
11
  // cspell:ignore cset csets ecchanges
12
- const path = require("path");
12
+ const path = require("node:path");
13
+ const os = require("node:os");
13
14
  const core_bentley_1 = require("@itwin/core-bentley");
14
15
  const core_common_1 = require("@itwin/core-common");
15
16
  const BackendLoggerCategory_1 = require("./BackendLoggerCategory");
@@ -20,11 +21,14 @@ const IModelJsFs_1 = require("./IModelJsFs");
20
21
  const SchemaSync_1 = require("./SchemaSync");
21
22
  const Symbols_1 = require("./internal/Symbols");
22
23
  const NativePlatform_1 = require("./internal/NativePlatform");
24
+ const StashManager_1 = require("./StashManager");
23
25
  const loggerCategory = BackendLoggerCategory_1.BackendLoggerCategory.IModelDb;
24
26
  /** Manages downloading Briefcases and downloading and uploading changesets.
25
27
  * @public
26
28
  */
27
29
  class BriefcaseManager {
30
+ /** @internal */
31
+ static PULL_MERGE_RESTORE_POINT_NAME = "$pull_merge_restore_point";
28
32
  /** Get the local path of the folder storing files that are associated with an imodel */
29
33
  static getIModelPath(iModelId) { return path.join(this._cacheDir, iModelId); }
30
34
  /** @internal */
@@ -138,7 +142,7 @@ class BriefcaseManager {
138
142
  * @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)
139
143
  */
140
144
  static async downloadBriefcase(arg) {
141
- const briefcaseId = arg.briefcaseId ?? await this.acquireNewBriefcaseId(arg);
145
+ const briefcaseId = arg.briefcaseId ?? await this.acquireNewBriefcaseId({ deviceName: `${os.hostname()}:${os.type()}:${os.arch()}`, ...arg });
142
146
  const fileName = arg.fileName ?? this.getFileName({ ...arg, briefcaseId });
143
147
  if (IModelJsFs_1.IModelJsFs.existsSync(fileName))
144
148
  throw new core_common_1.IModelError(core_bentley_1.IModelStatus.FileAlreadyExists, `Briefcase "${fileName}" already exists`);
@@ -400,15 +404,30 @@ class BriefcaseManager {
400
404
  });
401
405
  db.notifyChangesetApplied();
402
406
  }
403
- /** @internal */
407
+ /**
408
+ * @internal
409
+ * Pulls and applies changesets from the iModelHub to the specified IModelDb instance.
410
+ *
411
+ * This method downloads and applies all changesets required to bring the local briefcase up to the specified changeset index.
412
+ * It supports both forward and reverse application of changesets, depending on the `toIndex` argument.
413
+ * If there are pending local transactions and a reverse operation is requested, an error is thrown.
414
+ * The method manages restore points for safe merging, handles local transaction reversal, applies each changeset in order,
415
+ * and resumes or rebases local changes as appropriate for the type of database.
416
+ *
417
+ * @param db The IModelDb instance to which changesets will be applied. Must be open and writable.
418
+ * @param arg The arguments for pulling changesets, including access token, target changeset index, and optional progress callback.
419
+ * @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.
420
+ * @returns A promise that resolves when all required changesets have been applied.
421
+ */
404
422
  static async pullAndApplyChangesets(db, arg) {
405
- if (!db.isOpen || db[Symbols_1._nativeDb].isReadonly()) // don't use db.isReadonly - we reopen the file writable just for this operation but db.isReadonly is still true
423
+ const nativeDb = db[Symbols_1._nativeDb];
424
+ 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
406
425
  throw new core_common_1.IModelError(core_bentley_1.ChangeSetStatus.ApplyError, "Briefcase must be open ReadWrite to process change sets");
407
426
  let currentIndex = db.changeset.index;
408
427
  if (currentIndex === undefined)
409
428
  currentIndex = (await IModelHost_1.IModelHost[Symbols_1._hubAccess].queryChangeset({ accessToken: arg.accessToken, iModelId: db.iModelId, changeset: { id: db.changeset.id } })).index;
410
429
  const reverse = (arg.toIndex && arg.toIndex < currentIndex) ? true : false;
411
- if (db[Symbols_1._nativeDb].hasPendingTxns() && reverse) {
430
+ if (nativeDb.hasPendingTxns() && reverse) {
412
431
  throw new core_common_1.IModelError(core_bentley_1.ChangeSetStatus.ApplyError, "Cannot reverse changesets when there are pending changes");
413
432
  }
414
433
  // Download change sets
@@ -423,53 +442,139 @@ class BriefcaseManager {
423
442
  return; // nothing to apply
424
443
  if (reverse)
425
444
  changesets.reverse();
426
- let appliedChangesets = -1;
427
- if (db[Symbols_1._nativeDb].hasPendingTxns() && !reverse && !arg.noFastForward) {
428
- // attempt to perform fast forward
429
- for (const changeset of changesets) {
430
- // do not waste time on schema changesets. They cannot be fastforwarded.
431
- if (changeset.changesType === core_common_1.ChangesetType.Schema || changeset.changesType === core_common_1.ChangesetType.SchemaSync)
432
- break;
433
- try {
434
- const stopwatch = new core_bentley_1.StopWatch(`[${changeset.id}]`, true);
435
- core_bentley_1.Logger.logInfo(loggerCategory, `Starting application of changeset with id ${stopwatch.description} using fast forward method`);
436
- await this.applySingleChangeset(db, changeset, true);
437
- core_bentley_1.Logger.logInfo(loggerCategory, `Applied changeset with id ${stopwatch.description} (${stopwatch.elapsedSeconds} seconds)`);
438
- appliedChangesets++;
439
- db.saveChanges();
440
- }
441
- catch {
442
- db.abandonChanges();
443
- break;
445
+ const briefcaseDb = db instanceof IModelDb_1.BriefcaseDb ? db : undefined;
446
+ // create restore point if certain conditions are met
447
+ if (briefcaseDb && briefcaseDb.txns.hasPendingTxns && !briefcaseDb.txns.hasPendingSchemaChanges && !reverse && !IModelHost_1.IModelHost.configuration?.disableRestorePointOnPullMerge) {
448
+ core_bentley_1.Logger.logInfo(loggerCategory, `Creating restore point ${this.PULL_MERGE_RESTORE_POINT_NAME}`);
449
+ await this.createRestorePoint(briefcaseDb, this.PULL_MERGE_RESTORE_POINT_NAME);
450
+ }
451
+ if (!reverse) {
452
+ const reversedTxns = nativeDb.pullMergeReverseLocalChanges();
453
+ core_bentley_1.Logger.logInfo(loggerCategory, `Reversed ${reversedTxns.length} local changes`);
454
+ }
455
+ // apply incoming changes
456
+ for (const changeset of changesets) {
457
+ const stopwatch = new core_bentley_1.StopWatch(`[${changeset.id}]`, true);
458
+ core_bentley_1.Logger.logInfo(loggerCategory, `Starting application of changeset with id ${stopwatch.description}`);
459
+ try {
460
+ await this.applySingleChangeset(db, changeset, false);
461
+ core_bentley_1.Logger.logInfo(loggerCategory, `Applied changeset with id ${stopwatch.description} (${stopwatch.elapsedSeconds} seconds)`);
462
+ }
463
+ catch (err) {
464
+ if (err instanceof Error) {
465
+ core_bentley_1.Logger.logError(loggerCategory, `Error applying changeset with id ${stopwatch.description}: ${err.message}`);
444
466
  }
467
+ db.abandonChanges();
468
+ throw err;
445
469
  }
446
470
  }
447
- if (appliedChangesets < changesets.length - 1) {
448
- db[Symbols_1._nativeDb].pullMergeBegin();
449
- for (const changeset of changesets.filter((_, index) => index > appliedChangesets)) {
450
- const stopwatch = new core_bentley_1.StopWatch(`[${changeset.id}]`, true);
451
- core_bentley_1.Logger.logInfo(loggerCategory, `Starting application of changeset with id ${stopwatch.description}`);
452
- try {
453
- await this.applySingleChangeset(db, changeset, false);
454
- core_bentley_1.Logger.logInfo(loggerCategory, `Applied changeset with id ${stopwatch.description} (${stopwatch.elapsedSeconds} seconds)`);
471
+ if (!reverse) {
472
+ if (briefcaseDb) {
473
+ await briefcaseDb.txns.rebaser.resume();
474
+ }
475
+ else {
476
+ // Only Briefcase has change management. Following is
477
+ // for test related to standalone db with txn enabled.
478
+ nativeDb.pullMergeRebaseBegin();
479
+ let txnId = nativeDb.pullMergeRebaseNext();
480
+ while (txnId) {
481
+ nativeDb.pullMergeRebaseReinstateTxn();
482
+ nativeDb.pullMergeRebaseUpdateTxn();
483
+ txnId = nativeDb.pullMergeRebaseNext();
455
484
  }
456
- catch (err) {
457
- if (err instanceof Error) {
458
- core_bentley_1.Logger.logError(loggerCategory, `Error applying changeset with id ${stopwatch.description}: ${err.message}`);
459
- }
460
- db.abandonChanges();
461
- db[Symbols_1._nativeDb].pullMergeEnd();
462
- throw err;
485
+ nativeDb.pullMergeRebaseEnd();
486
+ if (!nativeDb.isReadonly) {
487
+ nativeDb.saveChanges("Merge.");
463
488
  }
464
489
  }
465
- db[Symbols_1._nativeDb].pullMergeEnd();
466
- if (!db.isReadonly) {
467
- db.saveChanges("Merge.");
490
+ if (briefcaseDb && this.containsRestorePoint(briefcaseDb, this.PULL_MERGE_RESTORE_POINT_NAME)) {
491
+ core_bentley_1.Logger.logInfo(loggerCategory, `Dropping restore point ${this.PULL_MERGE_RESTORE_POINT_NAME}`);
492
+ this.dropRestorePoint(briefcaseDb, this.PULL_MERGE_RESTORE_POINT_NAME);
468
493
  }
469
494
  }
470
495
  // notify listeners
471
496
  db.notifyChangesetApplied();
472
497
  }
498
+ /**
499
+ * @internal
500
+ * Creates a restore point for the specified briefcase database.
501
+ *
502
+ * @param db - The {@link BriefcaseDb} instance for which to create the restore point.
503
+ * @param name - The unique name for the restore point. Must be a non-empty string.
504
+ * @returns A promise that resolves to the created stash object representing the restore point.
505
+ */
506
+ static async createRestorePoint(db, name) {
507
+ core_bentley_1.Logger.logTrace(loggerCategory, `Creating restore point ${name}`);
508
+ this.dropRestorePoint(db, name);
509
+ const stash = await StashManager_1.StashManager.stash({ db, description: this.makeRestorePointKey(name) });
510
+ db[Symbols_1._nativeDb].saveLocalValue(this.makeRestorePointKey(name), stash.id);
511
+ db.saveChanges("Create restore point");
512
+ core_bentley_1.Logger.logTrace(loggerCategory, `Created restore point ${name}`, () => stash);
513
+ return stash;
514
+ }
515
+ /**
516
+ * @internal
517
+ * Drops a previously created restore point from the specified briefcase database.
518
+ *
519
+ * @param db - The {@link BriefcaseDb} instance from which to drop the restore point.
520
+ * @param name - The name of the restore point to be dropped. Must be a non-empty string.
521
+ */
522
+ static dropRestorePoint(db, name) {
523
+ core_bentley_1.Logger.logTrace(loggerCategory, `Dropping restore point ${name}`);
524
+ const restorePointId = db[Symbols_1._nativeDb].queryLocalValue(this.makeRestorePointKey(name));
525
+ if (restorePointId) {
526
+ StashManager_1.StashManager.dropStash({ db, stash: restorePointId });
527
+ db[Symbols_1._nativeDb].deleteLocalValue(this.makeRestorePointKey(name));
528
+ db.saveChanges("Drop restore point");
529
+ core_bentley_1.Logger.logTrace(loggerCategory, `Dropped restore point ${name}`);
530
+ }
531
+ }
532
+ /**
533
+ * @internal
534
+ * Checks if a restore point with the specified name exists in the given briefcase database.
535
+ *
536
+ * @param db - The {@link BriefcaseDb} instance to search within.
537
+ * @param name - The name of the restore point to check for existence.
538
+ * @returns `true` if the restore point exists and its stash is present; otherwise, `false`.
539
+ */
540
+ static containsRestorePoint(db, name) {
541
+ core_bentley_1.Logger.logTrace(loggerCategory, `Checking if restore point ${name} exists`);
542
+ const key = this.makeRestorePointKey(name);
543
+ const restorePointId = db[Symbols_1._nativeDb].queryLocalValue(key);
544
+ if (!restorePointId) {
545
+ return false;
546
+ }
547
+ const stash = StashManager_1.StashManager.tryGetStash({ db, stash: restorePointId });
548
+ if (!stash) {
549
+ core_bentley_1.Logger.logTrace(loggerCategory, `Restore point ${name} does not exist. Deleting ${key}`);
550
+ db[Symbols_1._nativeDb].deleteLocalValue(key);
551
+ return false;
552
+ }
553
+ return true;
554
+ }
555
+ static makeRestorePointKey(name) {
556
+ if (name.length === 0) {
557
+ throw new Error("Invalid restore point name");
558
+ }
559
+ return `restore_point/${name}`;
560
+ }
561
+ /**
562
+ * @internal
563
+ * Restores the state of a briefcase database to a previously saved restore point.
564
+ *
565
+ * @param db - The {@link BriefcaseDb} instance to restore.
566
+ * @param name - The name of the restore point to apply.
567
+ */
568
+ static async restorePoint(db, name) {
569
+ core_bentley_1.Logger.logTrace(loggerCategory, `Restoring to restore point ${name}`);
570
+ const restorePointId = db[Symbols_1._nativeDb].queryLocalValue(this.makeRestorePointKey(name));
571
+ if (!restorePointId) {
572
+ throw new Error(`Restore point not found: ${name}`);
573
+ }
574
+ await StashManager_1.StashManager.restore({ db, stash: restorePointId });
575
+ core_bentley_1.Logger.logTrace(loggerCategory, `Restored to restore point ${name}`);
576
+ this.dropRestorePoint(db, name);
577
+ }
473
578
  /** create a changeset from the current changes, and push it to iModelHub */
474
579
  static async pushChanges(db, arg) {
475
580
  const changesetProps = db[Symbols_1._nativeDb].startCreateChangeset();
@@ -526,7 +631,11 @@ class BriefcaseManager {
526
631
  await BriefcaseManager.pullAndApplyChangesets(db, arg);
527
632
  if (!db.skipSyncSchemasOnPullAndPush)
528
633
  await SchemaSync_1.SchemaSync.pull(db);
529
- return await BriefcaseManager.pushChanges(db, arg);
634
+ // pullAndApply rebase changes and might remove redundant changes in local briefcase
635
+ // this mean hasPendingTxns was true before but now after pullAndApply it might be false
636
+ if (!db[Symbols_1._nativeDb].hasPendingTxns())
637
+ return;
638
+ await BriefcaseManager.pushChanges(db, arg);
530
639
  }
531
640
  catch (err) {
532
641
  if (retryCount-- <= 0 || err.errorNumber !== core_bentley_1.IModelHubStatus.PullIsRequired)