@vue-skuilder/db 0.1.11-2 → 0.1.11-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/core/index.js +41 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +39 -5
- package/dist/core/index.mjs.map +1 -1
- package/dist/impl/couch/index.js +70 -28
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +68 -27
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.js +41 -6
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +39 -5
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +64 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
- package/src/factory.ts +6 -2
- package/src/impl/common/BaseUserDB.ts +35 -2
- package/src/impl/couch/auth.ts +57 -21
- package/src/impl/couch/index.ts +17 -5
package/dist/core/index.js
CHANGED
|
@@ -1445,12 +1445,14 @@ var init_adminDB2 = __esm({
|
|
|
1445
1445
|
});
|
|
1446
1446
|
|
|
1447
1447
|
// src/impl/couch/auth.ts
|
|
1448
|
+
var import_cross_fetch;
|
|
1448
1449
|
var init_auth = __esm({
|
|
1449
1450
|
"src/impl/couch/auth.ts"() {
|
|
1450
1451
|
"use strict";
|
|
1451
1452
|
init_factory();
|
|
1452
1453
|
init_types_legacy();
|
|
1453
1454
|
init_logger();
|
|
1455
|
+
import_cross_fetch = __toESM(require("cross-fetch"));
|
|
1454
1456
|
}
|
|
1455
1457
|
});
|
|
1456
1458
|
|
|
@@ -1503,12 +1505,13 @@ function getStartAndEndKeys2(key) {
|
|
|
1503
1505
|
endkey: key + "\uFFF0"
|
|
1504
1506
|
};
|
|
1505
1507
|
}
|
|
1506
|
-
var import_moment4, import_process, isBrowser, GUEST_LOCAL_DB, localUserDB, pouchDBincludeCredentialsConfig, REVIEW_TIME_FORMAT2;
|
|
1508
|
+
var import_cross_fetch2, import_moment4, import_process, isBrowser, GUEST_LOCAL_DB, localUserDB, pouchDBincludeCredentialsConfig, REVIEW_TIME_FORMAT2;
|
|
1507
1509
|
var init_couch = __esm({
|
|
1508
1510
|
"src/impl/couch/index.ts"() {
|
|
1509
1511
|
"use strict";
|
|
1510
1512
|
init_factory();
|
|
1511
1513
|
init_types_legacy();
|
|
1514
|
+
import_cross_fetch2 = __toESM(require("cross-fetch"));
|
|
1512
1515
|
import_moment4 = __toESM(require("moment"));
|
|
1513
1516
|
init_logger();
|
|
1514
1517
|
init_pouchdb_setup();
|
|
@@ -2091,8 +2094,18 @@ Currently logged-in as ${this._username}.`
|
|
|
2091
2094
|
}
|
|
2092
2095
|
this.setDBandQ();
|
|
2093
2096
|
this.syncStrategy.startSync(this.localDB, this.remoteDB);
|
|
2094
|
-
|
|
2095
|
-
|
|
2097
|
+
this.applyDesignDocs().catch((error) => {
|
|
2098
|
+
log3(`Error in applyDesignDocs background task: ${error}`);
|
|
2099
|
+
if (error && typeof error === "object") {
|
|
2100
|
+
log3(`Full error details in applyDesignDocs: ${JSON.stringify(error)}`);
|
|
2101
|
+
}
|
|
2102
|
+
});
|
|
2103
|
+
this.deduplicateReviews().catch((error) => {
|
|
2104
|
+
log3(`Error in deduplicateReviews background task: ${error}`);
|
|
2105
|
+
if (error && typeof error === "object") {
|
|
2106
|
+
log3(`Full error details in background task: ${JSON.stringify(error)}`);
|
|
2107
|
+
}
|
|
2108
|
+
});
|
|
2096
2109
|
_BaseUser._initialized = true;
|
|
2097
2110
|
}
|
|
2098
2111
|
static designDocs = [
|
|
@@ -2110,10 +2123,15 @@ Currently logged-in as ${this._username}.`
|
|
|
2110
2123
|
}
|
|
2111
2124
|
];
|
|
2112
2125
|
async applyDesignDocs() {
|
|
2126
|
+
log3(`Starting applyDesignDocs for user: ${this._username}`);
|
|
2127
|
+
log3(`Remote DB name: ${this.remoteDB.name || "unknown"}`);
|
|
2113
2128
|
if (this._username === "admin") {
|
|
2129
|
+
log3("Skipping design docs for admin user");
|
|
2114
2130
|
return;
|
|
2115
2131
|
}
|
|
2132
|
+
log3(`Applying ${_BaseUser.designDocs.length} design docs`);
|
|
2116
2133
|
for (const doc of _BaseUser.designDocs) {
|
|
2134
|
+
log3(`Applying design doc: ${doc._id}`);
|
|
2117
2135
|
try {
|
|
2118
2136
|
try {
|
|
2119
2137
|
const existingDoc = await this.remoteDB.get(doc._id);
|
|
@@ -2212,8 +2230,13 @@ Currently logged-in as ${this._username}.`
|
|
|
2212
2230
|
async deduplicateReviews() {
|
|
2213
2231
|
try {
|
|
2214
2232
|
log3("Starting deduplication of scheduled reviews...");
|
|
2233
|
+
log3(`Remote DB name: ${this.remoteDB.name || "unknown"}`);
|
|
2234
|
+
log3(`Write DB name: ${this.writeDB.name || "unknown"}`);
|
|
2215
2235
|
const reviewsMap = {};
|
|
2216
2236
|
const duplicateDocIds = [];
|
|
2237
|
+
log3(
|
|
2238
|
+
`Attempting to query remoteDB for reviewCards/reviewCards. Database: ${this.remoteDB.name || "unknown"}`
|
|
2239
|
+
);
|
|
2217
2240
|
const scheduledReviews = await this.remoteDB.query("reviewCards/reviewCards");
|
|
2218
2241
|
log3(`Found ${scheduledReviews.rows.length} scheduled reviews to process`);
|
|
2219
2242
|
scheduledReviews.rows.forEach((r) => {
|
|
@@ -2248,6 +2271,17 @@ Currently logged-in as ${this._username}.`
|
|
|
2248
2271
|
}
|
|
2249
2272
|
} catch (error) {
|
|
2250
2273
|
log3(`Error during review deduplication: ${error}`);
|
|
2274
|
+
if (error && typeof error === "object" && "status" in error && error.status === 404) {
|
|
2275
|
+
log3(
|
|
2276
|
+
`Database not found (404) during review deduplication. Database: ${this.remoteDB.name || "unknown"}`
|
|
2277
|
+
);
|
|
2278
|
+
log3(
|
|
2279
|
+
`This might indicate the user database doesn't exist or the reviewCards view isn't available`
|
|
2280
|
+
);
|
|
2281
|
+
}
|
|
2282
|
+
if (error && typeof error === "object") {
|
|
2283
|
+
log3(`Full error details: ${JSON.stringify(error)}`);
|
|
2284
|
+
}
|
|
2251
2285
|
}
|
|
2252
2286
|
}
|
|
2253
2287
|
/**
|
|
@@ -2408,15 +2442,16 @@ function getDataLayer() {
|
|
|
2408
2442
|
}
|
|
2409
2443
|
return dataLayerInstance;
|
|
2410
2444
|
}
|
|
2411
|
-
var ENV, dataLayerInstance;
|
|
2445
|
+
var NOT_SET, ENV, dataLayerInstance;
|
|
2412
2446
|
var init_factory = __esm({
|
|
2413
2447
|
"src/factory.ts"() {
|
|
2414
2448
|
"use strict";
|
|
2415
2449
|
init_common();
|
|
2416
2450
|
init_logger();
|
|
2451
|
+
NOT_SET = "NOT_SET";
|
|
2417
2452
|
ENV = {
|
|
2418
|
-
COUCHDB_SERVER_PROTOCOL:
|
|
2419
|
-
COUCHDB_SERVER_URL:
|
|
2453
|
+
COUCHDB_SERVER_PROTOCOL: NOT_SET,
|
|
2454
|
+
COUCHDB_SERVER_URL: NOT_SET,
|
|
2420
2455
|
LOCAL_STORAGE_PREFIX: ""
|
|
2421
2456
|
};
|
|
2422
2457
|
dataLayerInstance = null;
|