@vue-skuilder/db 0.2.19 → 0.2.21

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 (35) hide show
  1. package/dist/{SyncStrategy-BJMZq3WO.d.cts → SyncStrategy-CCU1H81I.d.cts} +8 -2
  2. package/dist/{SyncStrategy-BJMZq3WO.d.ts → SyncStrategy-CCU1H81I.d.ts} +8 -2
  3. package/dist/{contentSource-D-LQYFyx.d.cts → contentSource-BMxsujRu.d.cts} +5 -0
  4. package/dist/{contentSource-BDRX_YYJ.d.ts → contentSource-Bazgkf4C.d.ts} +5 -0
  5. package/dist/core/index.d.cts +3 -3
  6. package/dist/core/index.d.ts +3 -3
  7. package/dist/core/index.js +12 -2
  8. package/dist/core/index.js.map +1 -1
  9. package/dist/core/index.mjs +12 -2
  10. package/dist/core/index.mjs.map +1 -1
  11. package/dist/{dataLayerProvider-Dpshuql4.d.ts → dataLayerProvider-Bt-D6xas.d.ts} +1 -1
  12. package/dist/{dataLayerProvider-Dd2UcCif.d.cts → dataLayerProvider-DifVCcIS.d.cts} +1 -1
  13. package/dist/impl/couch/index.d.cts +20 -4
  14. package/dist/impl/couch/index.d.ts +20 -4
  15. package/dist/impl/couch/index.js +54 -6
  16. package/dist/impl/couch/index.js.map +1 -1
  17. package/dist/impl/couch/index.mjs +54 -6
  18. package/dist/impl/couch/index.mjs.map +1 -1
  19. package/dist/impl/static/index.d.cts +3 -3
  20. package/dist/impl/static/index.d.ts +3 -3
  21. package/dist/impl/static/index.js +12 -2
  22. package/dist/impl/static/index.js.map +1 -1
  23. package/dist/impl/static/index.mjs +12 -2
  24. package/dist/impl/static/index.mjs.map +1 -1
  25. package/dist/index.d.cts +3 -3
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.js +54 -6
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +54 -6
  30. package/dist/index.mjs.map +1 -1
  31. package/package.json +3 -3
  32. package/src/core/types/user.ts +6 -1
  33. package/src/impl/common/BaseUserDB.ts +19 -2
  34. package/src/impl/common/SyncStrategy.ts +17 -4
  35. package/src/impl/couch/CouchDBSyncStrategy.ts +52 -4
@@ -5603,6 +5603,14 @@ var init_BaseUserDB = __esm({
5603
5603
  _hydration = { state: "not-required" };
5604
5604
  /** In-flight hydration, so concurrent callers can wait for a real answer. */
5605
5605
  _hydrationPromise = null;
5606
+ /**
5607
+ * Sequence the local mirror was filled to by a hydration that succeeded in
5608
+ * THIS init(), handed to startSync() so the live pull can skip history it
5609
+ * would otherwise re-walk. Undefined whenever there is no such guarantee —
5610
+ * hydration skipped, not required, or failed. Never persisted; see the
5611
+ * `since` note in CouchDBSyncStrategy.startSync().
5612
+ */
5613
+ _hydratedSeq;
5606
5614
  /**
5607
5615
  * How far the local mirror can be trusted, RIGHT NOW. See
5608
5616
  * {@link UserHydrationStatus}.
@@ -6089,7 +6097,7 @@ Currently logged-in as ${this._username}.`
6089
6097
  this.setDBandQ();
6090
6098
  this._hydrationPromise = this.hydrateLocalMirror();
6091
6099
  await this._hydrationPromise;
6092
- this.syncStrategy.startSync(this.localDB, this.remoteDB);
6100
+ this.syncStrategy.startSync(this.localDB, this.remoteDB, this._hydratedSeq);
6093
6101
  this.applyDesignDocs().catch((error) => {
6094
6102
  log3(`Error in applyDesignDocs background task: ${error}`);
6095
6103
  if (error && typeof error === "object") {
@@ -6117,6 +6125,7 @@ Currently logged-in as ${this._username}.`
6117
6125
  * ceiling). Callers decide what a failure means for them.
6118
6126
  */
6119
6127
  async hydrateLocalMirror() {
6128
+ this._hydratedSeq = void 0;
6120
6129
  if (this.localDB.name === this.remoteDB.name || !this.syncStrategy.hydrate) {
6121
6130
  this._hydration = { state: "not-required" };
6122
6131
  return;
@@ -6128,11 +6137,12 @@ Currently logged-in as ${this._username}.`
6128
6137
  this._hydration = { state: "hydrating" };
6129
6138
  const start = Date.now();
6130
6139
  try {
6131
- const { docsWritten } = await withTimeout(
6140
+ const { docsWritten, lastSeq } = await withTimeout(
6132
6141
  this.syncStrategy.hydrate(this.localDB, this.remoteDB),
6133
6142
  HYDRATION_TIMEOUT_MS,
6134
6143
  `Hydration of local mirror for ${this._username}`
6135
6144
  );
6145
+ this._hydratedSeq = lastSeq;
6136
6146
  await this.writeHydrationMarker();
6137
6147
  this._hydration = {
6138
6148
  state: "hydrated",