@itwin/core-backend 5.4.0-dev.5 → 5.4.0-dev.7

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.
@@ -2728,7 +2728,6 @@ export class BriefcaseDb extends IModelDb {
2728
2728
  return db?.isBriefcaseDb() ? db : undefined;
2729
2729
  }
2730
2730
  /**
2731
- * @alpha
2732
2731
  * Permanently discards any local changes made to this briefcase, reverting the briefcase to its last synchronized state.
2733
2732
  * This operation cannot be undone. By default, all locks held by this briefcase will be released unless the `retainLocks` option is specified.
2734
2733
  * @Note This operation can be performed at any point including after failed rebase attempts.
@@ -2736,9 +2735,17 @@ export class BriefcaseDb extends IModelDb {
2736
2735
  * @param args.retainLocks - If `true`, retains all currently held locks after discarding changes. If omitted or `false`, all locks will be released.
2737
2736
  * @returns A promise that resolves when the operation is complete.
2738
2737
  * @throws May throw if discarding changes fails.
2738
+ *
2739
+ * @public @preview
2739
2740
  */
2740
2741
  async discardChanges(args) {
2741
2742
  Logger.logInfo(loggerCategory, "Discarding local changes");
2743
+ if (this.txns.isIndirectChanges) {
2744
+ throw new IModelError(IModelStatus.BadRequest, "Cannot discard changes when there are indirect changes");
2745
+ }
2746
+ if (this.txns.rebaser.inProgress() && !this.txns.rebaser.isAborting) {
2747
+ throw new IModelError(IModelStatus.BadRequest, "Cannot discard changes while a rebase is in progress");
2748
+ }
2742
2749
  this.clearCaches();
2743
2750
  this[_nativeDb].clearECDbCache();
2744
2751
  this[_nativeDb].discardLocalChanges();