@fudrouter/fsrouter 0.6.96 → 0.6.98

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.
@@ -470,7 +470,7 @@ export async function POST_handler(req, res) {
470
470
  return res.json({ deleted: deletedCount });
471
471
  }
472
472
  // ── Action: Bulk add ready accounts to 9router ─────────────────
473
- if (action === "bulk-add-to-9router") {
473
+ if (action === "bulk-add-to-9router" || action === "bulk-add-to-fsrouter") {
474
474
  const { provider } = body;
475
475
  const accounts = await listCodeBuddyAccounts();
476
476
  const ready = accounts.filter(a => {
@@ -66,6 +66,23 @@ export async function POST_handler(req, res) {
66
66
  // state differs between machines. Keep raw-file restore below for old backups.
67
67
  if (body.database) {
68
68
  await importDb(body.database);
69
+ // Flush WAL into the main DB file BEFORE we remove -wal/-shm below,
70
+ // otherwise the just-imported rows live only in the WAL and get deleted.
71
+ const db = await getAdapter();
72
+ if (db && typeof db.checkpoint === "function") {
73
+ try {
74
+ db.checkpoint();
75
+ }
76
+ catch (e) {
77
+ console.warn("[Restore] checkpoint failed:", e.message);
78
+ }
79
+ }
80
+ if (db && typeof db.exec === "function") {
81
+ try {
82
+ db.exec("PRAGMA wal_checkpoint(TRUNCATE)");
83
+ }
84
+ catch { /* ignore */ }
85
+ }
69
86
  }
70
87
  else {
71
88
  const db = await getAdapter();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fudrouter/fsrouter",
3
- "version": "0.6.96",
3
+ "version": "0.6.98",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "9Router v2 — Express Backend (API, SSE, DB, Auth, MITM)",