@vue-skuilder/standalone-ui 0.2.19 → 0.2.20

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.
@@ -29632,18 +29632,23 @@ ${t.stack}` : JSON.stringify(t);
29632
29632
  return t === GuestUsername || t.startsWith(GuestUsername) ? getLocalUserDB(t) : this.getUserDB(t);
29633
29633
  }
29634
29634
  async hydrate(t, c) {
29635
- let u = pouchdb_setup_default.replicate(c, t, {});
29636
- this.hydrationHandle = u;
29635
+ let u = (await t.info()).doc_count === 0, d = pouchdb_setup_default.replicate(c, t, u ? { selector: { _deleted: { $exists: !1 } } } : {});
29636
+ this.hydrationHandle = d;
29637
29637
  try {
29638
- return { docsWritten: (await u).docs_written };
29638
+ let t = await d;
29639
+ return {
29640
+ docsWritten: t.docs_written,
29641
+ lastSeq: u ? t.last_seq : void 0
29642
+ };
29639
29643
  } finally {
29640
29644
  this.hydrationHandle = void 0;
29641
29645
  }
29642
29646
  }
29643
- startSync(t, c) {
29647
+ startSync(t, c, u) {
29644
29648
  t.name !== c.name && (this.syncHandle = pouchdb_setup_default.sync(t, c, {
29645
29649
  live: !0,
29646
- retry: !0
29650
+ retry: !0,
29651
+ ...u === void 0 ? {} : { pull: { since: u } }
29647
29652
  }));
29648
29653
  }
29649
29654
  stopSync() {
@@ -30072,7 +30077,7 @@ Currently logged-in as ${this._username}.`);
30072
30077
  }) : (_BaseUser._instance = new _BaseUser(await t.getCurrentUsername(), t), await _BaseUser._instance.init(), _BaseUser._instance);
30073
30078
  }
30074
30079
  constructor(t, c) {
30075
- _defineProperty$2(this, "_username", void 0), _defineProperty$2(this, "syncStrategy", void 0), _defineProperty$2(this, "localDB", void 0), _defineProperty$2(this, "remoteDB", void 0), _defineProperty$2(this, "writeDB", void 0), _defineProperty$2(this, "updateQueue", void 0), _defineProperty$2(this, "_hydration", { state: "not-required" }), _defineProperty$2(this, "_hydrationPromise", null), _BaseUser._initialized = !1, this._username = t, this.syncStrategy = c, this.setDBandQ();
30080
+ _defineProperty$2(this, "_username", void 0), _defineProperty$2(this, "syncStrategy", void 0), _defineProperty$2(this, "localDB", void 0), _defineProperty$2(this, "remoteDB", void 0), _defineProperty$2(this, "writeDB", void 0), _defineProperty$2(this, "updateQueue", void 0), _defineProperty$2(this, "_hydration", { state: "not-required" }), _defineProperty$2(this, "_hydrationPromise", null), _defineProperty$2(this, "_hydratedSeq", void 0), _BaseUser._initialized = !1, this._username = t, this.syncStrategy = c, this.setDBandQ();
30076
30081
  }
30077
30082
  setDBandQ() {
30078
30083
  this.localDB = getLocalUserDB(this._username), this.remoteDB = this.syncStrategy.setupRemoteDB(this._username), this.writeDB = this.syncStrategy.getWriteDB ? this.syncStrategy.getWriteDB(this._username) : this.localDB, this.updateQueue = new UpdateQueue(this.localDB, this.writeDB);
@@ -30082,14 +30087,14 @@ Currently logged-in as ${this._username}.`);
30082
30087
  _BaseUser._initialized = !0;
30083
30088
  return;
30084
30089
  }
30085
- this.syncStrategy.stopSync?.(), this.setDBandQ(), this._hydrationPromise = this.hydrateLocalMirror(), await this._hydrationPromise, this.syncStrategy.startSync(this.localDB, this.remoteDB), this.applyDesignDocs().catch((t) => {
30090
+ this.syncStrategy.stopSync?.(), this.setDBandQ(), this._hydrationPromise = this.hydrateLocalMirror(), await this._hydrationPromise, this.syncStrategy.startSync(this.localDB, this.remoteDB, this._hydratedSeq), this.applyDesignDocs().catch((t) => {
30086
30091
  log4(`Error in applyDesignDocs background task: ${t}`), t && typeof t == "object" && log4(`Full error details in applyDesignDocs: ${JSON.stringify(t)}`);
30087
30092
  }), this.deduplicateReviews().catch((t) => {
30088
30093
  log4(`Error in deduplicateReviews background task: ${t}`), t && typeof t == "object" && log4(`Full error details in background task: ${JSON.stringify(t)}`);
30089
30094
  }), _BaseUser._initialized = !0;
30090
30095
  }
30091
30096
  async hydrateLocalMirror() {
30092
- if (this.localDB.name === this.remoteDB.name || !this.syncStrategy.hydrate) {
30097
+ if (this._hydratedSeq = void 0, this.localDB.name === this.remoteDB.name || !this.syncStrategy.hydrate) {
30093
30098
  this._hydration = { state: "not-required" };
30094
30099
  return;
30095
30100
  }
@@ -30100,8 +30105,8 @@ Currently logged-in as ${this._username}.`);
30100
30105
  this._hydration = { state: "hydrating" };
30101
30106
  let t = Date.now();
30102
30107
  try {
30103
- let { docsWritten: c } = await withTimeout(this.syncStrategy.hydrate(this.localDB, this.remoteDB), HYDRATION_TIMEOUT_MS, `Hydration of local mirror for ${this._username}`);
30104
- await this.writeHydrationMarker(), this._hydration = {
30108
+ let { docsWritten: c, lastSeq: u } = await withTimeout(this.syncStrategy.hydrate(this.localDB, this.remoteDB), HYDRATION_TIMEOUT_MS, `Hydration of local mirror for ${this._username}`);
30109
+ this._hydratedSeq = u, await this.writeHydrationMarker(), this._hydration = {
30105
30110
  state: "hydrated",
30106
30111
  docsWritten: c,
30107
30112
  durationMs: Date.now() - t