@vue-skuilder/db 0.2.12 → 0.2.13
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 +5 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +5 -0
- package/dist/core/index.mjs.map +1 -1
- package/dist/impl/couch/index.js +13 -0
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +13 -0
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.js +5 -0
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +5 -0
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/impl/common/BaseUserDB.ts +13 -0
- package/src/impl/couch/CouchDBSyncStrategy.ts +17 -0
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.2.
|
|
7
|
+
"version": "0.2.13",
|
|
8
8
|
"description": "Database layer for vue-skuilder",
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"module": "dist/index.mjs",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@nilock2/pouchdb-authentication": "^1.0.2",
|
|
51
|
-
"@vue-skuilder/common": "0.2.
|
|
51
|
+
"@vue-skuilder/common": "0.2.13",
|
|
52
52
|
"cross-fetch": "^4.1.0",
|
|
53
53
|
"moment": "^2.29.4",
|
|
54
54
|
"pouchdb": "^9.0.0",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"vite": "^8.0.0",
|
|
63
63
|
"vitest": "^4.1.0"
|
|
64
64
|
},
|
|
65
|
-
"stableVersion": "0.2.
|
|
65
|
+
"stableVersion": "0.2.13"
|
|
66
66
|
}
|
|
@@ -214,6 +214,19 @@ Currently logged-in as ${this._username}.`
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
const ret = await this.syncStrategy.logout!();
|
|
217
|
+
|
|
218
|
+
// Mint a FRESH guest identity on logout rather than re-adopting whatever
|
|
219
|
+
// sk-guest-uuid happens to survive in localStorage. A stale UUID can point
|
|
220
|
+
// at an already-consumed guest DB (one previously migrated into a real
|
|
221
|
+
// account); re-adopting it would resurface that account's progress and, on
|
|
222
|
+
// the next signup, migrate it into the new account. Clearing the pointer
|
|
223
|
+
// forces accomodateGuest() to generate a new UUID + empty guest DB.
|
|
224
|
+
try {
|
|
225
|
+
localStorage.removeItem('sk-guest-uuid');
|
|
226
|
+
} catch (e) {
|
|
227
|
+
logger.warn('localStorage not available (Node.js environment):', e);
|
|
228
|
+
}
|
|
229
|
+
|
|
217
230
|
// return to 'guest' mode
|
|
218
231
|
this._username = await this.syncStrategy.getCurrentUsername();
|
|
219
232
|
await this.init();
|
|
@@ -228,6 +228,23 @@ export class CouchDBSyncStrategy implements SyncStrategy {
|
|
|
228
228
|
logger.info('No documents to migrate from funnel account');
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
// Destroy the consumed guest DB so it can never be re-migrated into a
|
|
232
|
+
// future account. Without this, an orphaned userdb-sk-guest-<uuid> lingers
|
|
233
|
+
// in IndexedDB indefinitely; if its stale identity is later re-adopted
|
|
234
|
+
// (e.g. on logout via a surviving sk-guest-uuid), its progress bleeds into
|
|
235
|
+
// the next new account. Best-effort: migration has already succeeded, so a
|
|
236
|
+
// teardown failure must not fail account creation.
|
|
237
|
+
try {
|
|
238
|
+
await oldLocalDB.destroy();
|
|
239
|
+
logger.info(`Destroyed consumed guest DB for ${oldUsername}`);
|
|
240
|
+
} catch (destroyErr) {
|
|
241
|
+
logger.warn(
|
|
242
|
+
`Failed to destroy consumed guest DB for ${oldUsername} (non-fatal): ${
|
|
243
|
+
destroyErr instanceof Error ? destroyErr.message : String(destroyErr)
|
|
244
|
+
}`
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
231
248
|
return { success: true };
|
|
232
249
|
} catch (error) {
|
|
233
250
|
logger.error('Migration failed:', error);
|