@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
|
@@ -3,7 +3,7 @@ import { D as DataLayerProvider } from '../../dataLayerProvider-Dd2UcCif.cjs';
|
|
|
3
3
|
import { S as StaticCourseManifest } from '../../types-BFUa1pa3.cjs';
|
|
4
4
|
import { CourseConfig, CourseElo, DataShape } from '@vue-skuilder/common';
|
|
5
5
|
import { S as SkuilderCourseData, Q as QualifiedCardID, T as TagStub, a as Tag } from '../../types-legacy-4tlwHnXo.cjs';
|
|
6
|
-
import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-
|
|
6
|
+
import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-CCU1H81I.cjs';
|
|
7
7
|
import 'moment';
|
|
8
8
|
|
|
9
9
|
interface SkuilderManifest {
|
|
@@ -3,7 +3,7 @@ import { D as DataLayerProvider } from '../../dataLayerProvider-Dpshuql4.js';
|
|
|
3
3
|
import { S as StaticCourseManifest } from '../../types-CHgpWQAY.js';
|
|
4
4
|
import { CourseConfig, CourseElo, DataShape } from '@vue-skuilder/common';
|
|
5
5
|
import { S as SkuilderCourseData, Q as QualifiedCardID, T as TagStub, a as Tag } from '../../types-legacy-4tlwHnXo.js';
|
|
6
|
-
import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-
|
|
6
|
+
import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-CCU1H81I.js';
|
|
7
7
|
import 'moment';
|
|
8
8
|
|
|
9
9
|
interface SkuilderManifest {
|
|
@@ -5626,6 +5626,14 @@ var init_BaseUserDB = __esm({
|
|
|
5626
5626
|
_hydration = { state: "not-required" };
|
|
5627
5627
|
/** In-flight hydration, so concurrent callers can wait for a real answer. */
|
|
5628
5628
|
_hydrationPromise = null;
|
|
5629
|
+
/**
|
|
5630
|
+
* Sequence the local mirror was filled to by a hydration that succeeded in
|
|
5631
|
+
* THIS init(), handed to startSync() so the live pull can skip history it
|
|
5632
|
+
* would otherwise re-walk. Undefined whenever there is no such guarantee —
|
|
5633
|
+
* hydration skipped, not required, or failed. Never persisted; see the
|
|
5634
|
+
* `since` note in CouchDBSyncStrategy.startSync().
|
|
5635
|
+
*/
|
|
5636
|
+
_hydratedSeq;
|
|
5629
5637
|
/**
|
|
5630
5638
|
* How far the local mirror can be trusted, RIGHT NOW. See
|
|
5631
5639
|
* {@link UserHydrationStatus}.
|
|
@@ -6112,7 +6120,7 @@ Currently logged-in as ${this._username}.`
|
|
|
6112
6120
|
this.setDBandQ();
|
|
6113
6121
|
this._hydrationPromise = this.hydrateLocalMirror();
|
|
6114
6122
|
await this._hydrationPromise;
|
|
6115
|
-
this.syncStrategy.startSync(this.localDB, this.remoteDB);
|
|
6123
|
+
this.syncStrategy.startSync(this.localDB, this.remoteDB, this._hydratedSeq);
|
|
6116
6124
|
this.applyDesignDocs().catch((error) => {
|
|
6117
6125
|
log3(`Error in applyDesignDocs background task: ${error}`);
|
|
6118
6126
|
if (error && typeof error === "object") {
|
|
@@ -6140,6 +6148,7 @@ Currently logged-in as ${this._username}.`
|
|
|
6140
6148
|
* ceiling). Callers decide what a failure means for them.
|
|
6141
6149
|
*/
|
|
6142
6150
|
async hydrateLocalMirror() {
|
|
6151
|
+
this._hydratedSeq = void 0;
|
|
6143
6152
|
if (this.localDB.name === this.remoteDB.name || !this.syncStrategy.hydrate) {
|
|
6144
6153
|
this._hydration = { state: "not-required" };
|
|
6145
6154
|
return;
|
|
@@ -6151,11 +6160,12 @@ Currently logged-in as ${this._username}.`
|
|
|
6151
6160
|
this._hydration = { state: "hydrating" };
|
|
6152
6161
|
const start = Date.now();
|
|
6153
6162
|
try {
|
|
6154
|
-
const { docsWritten } = await withTimeout(
|
|
6163
|
+
const { docsWritten, lastSeq } = await withTimeout(
|
|
6155
6164
|
this.syncStrategy.hydrate(this.localDB, this.remoteDB),
|
|
6156
6165
|
HYDRATION_TIMEOUT_MS,
|
|
6157
6166
|
`Hydration of local mirror for ${this._username}`
|
|
6158
6167
|
);
|
|
6168
|
+
this._hydratedSeq = lastSeq;
|
|
6159
6169
|
await this.writeHydrationMarker();
|
|
6160
6170
|
this._hydration = {
|
|
6161
6171
|
state: "hydrated",
|