@vue-skuilder/db 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.
- package/dist/{SyncStrategy-BJMZq3WO.d.cts → SyncStrategy-CCU1H81I.d.cts} +8 -2
- package/dist/{SyncStrategy-BJMZq3WO.d.ts → SyncStrategy-CCU1H81I.d.ts} +8 -2
- package/dist/core/index.js +12 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +12 -2
- package/dist/core/index.mjs.map +1 -1
- package/dist/impl/couch/index.d.cts +18 -2
- package/dist/impl/couch/index.d.ts +18 -2
- package/dist/impl/couch/index.js +54 -6
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +54 -6
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.d.cts +1 -1
- package/dist/impl/static/index.d.ts +1 -1
- package/dist/impl/static/index.js +12 -2
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +12 -2
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/index.js +54 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/impl/common/BaseUserDB.ts +19 -2
- package/src/impl/common/SyncStrategy.ts +17 -4
- package/src/impl/couch/CouchDBSyncStrategy.ts +52 -4
package/dist/core/index.mjs
CHANGED
|
@@ -6901,6 +6901,14 @@ var init_BaseUserDB = __esm({
|
|
|
6901
6901
|
_hydration = { state: "not-required" };
|
|
6902
6902
|
/** In-flight hydration, so concurrent callers can wait for a real answer. */
|
|
6903
6903
|
_hydrationPromise = null;
|
|
6904
|
+
/**
|
|
6905
|
+
* Sequence the local mirror was filled to by a hydration that succeeded in
|
|
6906
|
+
* THIS init(), handed to startSync() so the live pull can skip history it
|
|
6907
|
+
* would otherwise re-walk. Undefined whenever there is no such guarantee —
|
|
6908
|
+
* hydration skipped, not required, or failed. Never persisted; see the
|
|
6909
|
+
* `since` note in CouchDBSyncStrategy.startSync().
|
|
6910
|
+
*/
|
|
6911
|
+
_hydratedSeq;
|
|
6904
6912
|
/**
|
|
6905
6913
|
* How far the local mirror can be trusted, RIGHT NOW. See
|
|
6906
6914
|
* {@link UserHydrationStatus}.
|
|
@@ -7387,7 +7395,7 @@ Currently logged-in as ${this._username}.`
|
|
|
7387
7395
|
this.setDBandQ();
|
|
7388
7396
|
this._hydrationPromise = this.hydrateLocalMirror();
|
|
7389
7397
|
await this._hydrationPromise;
|
|
7390
|
-
this.syncStrategy.startSync(this.localDB, this.remoteDB);
|
|
7398
|
+
this.syncStrategy.startSync(this.localDB, this.remoteDB, this._hydratedSeq);
|
|
7391
7399
|
this.applyDesignDocs().catch((error) => {
|
|
7392
7400
|
log3(`Error in applyDesignDocs background task: ${error}`);
|
|
7393
7401
|
if (error && typeof error === "object") {
|
|
@@ -7415,6 +7423,7 @@ Currently logged-in as ${this._username}.`
|
|
|
7415
7423
|
* ceiling). Callers decide what a failure means for them.
|
|
7416
7424
|
*/
|
|
7417
7425
|
async hydrateLocalMirror() {
|
|
7426
|
+
this._hydratedSeq = void 0;
|
|
7418
7427
|
if (this.localDB.name === this.remoteDB.name || !this.syncStrategy.hydrate) {
|
|
7419
7428
|
this._hydration = { state: "not-required" };
|
|
7420
7429
|
return;
|
|
@@ -7426,11 +7435,12 @@ Currently logged-in as ${this._username}.`
|
|
|
7426
7435
|
this._hydration = { state: "hydrating" };
|
|
7427
7436
|
const start = Date.now();
|
|
7428
7437
|
try {
|
|
7429
|
-
const { docsWritten } = await withTimeout(
|
|
7438
|
+
const { docsWritten, lastSeq } = await withTimeout(
|
|
7430
7439
|
this.syncStrategy.hydrate(this.localDB, this.remoteDB),
|
|
7431
7440
|
HYDRATION_TIMEOUT_MS,
|
|
7432
7441
|
`Hydration of local mirror for ${this._username}`
|
|
7433
7442
|
);
|
|
7443
|
+
this._hydratedSeq = lastSeq;
|
|
7434
7444
|
await this.writeHydrationMarker();
|
|
7435
7445
|
this._hydration = {
|
|
7436
7446
|
state: "hydrated",
|