mnemosyne-core 2.1.5 → 2.1.8

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/index.mjs CHANGED
@@ -207,7 +207,7 @@ function getVersion() {
207
207
  const pkg = JSON.parse(readFileSync6(resolve9(process.cwd(), "package.json"), "utf-8"));
208
208
  return pkg.version;
209
209
  } catch {
210
- return "2.1.5";
210
+ return "2.1.8";
211
211
  }
212
212
  }
213
213
  }
@@ -4568,8 +4568,9 @@ var Store = class extends EventEmitter {
4568
4568
  vals.push(this.now());
4569
4569
  sets.push("version = version + 1");
4570
4570
  vals.push(id);
4571
+ const sql = `UPDATE atoms SET ${sets.join(", ")} WHERE id = ?`;
4571
4572
  try {
4572
- this.stmt(`UPDATE atoms SET ${sets.join(", ")} WHERE id = ?`).run(...vals);
4573
+ this.stmt(sql).run(...vals);
4573
4574
  } catch (err) {
4574
4575
  if (err.message?.includes("malformed") || err.message?.includes("corrupt")) {
4575
4576
  throw new Error(`Database appears corrupted. Run "mnemosyne doctor --data-dir ./data" or delete the data directory and run "mnemosyne init" again.`);
@@ -5360,7 +5361,7 @@ function getVersion2() {
5360
5361
  const pkg = JSON.parse(readFileSync6(resolve9(process.cwd(), "package.json"), "utf-8"));
5361
5362
  return pkg.version;
5362
5363
  } catch {
5363
- return "2.1.5";
5364
+ return "2.1.8";
5364
5365
  }
5365
5366
  }
5366
5367
  }
@@ -5599,7 +5600,7 @@ CREATE TRIGGER IF NOT EXISTS trig_search_atoms_insert AFTER INSERT ON atoms BEGI
5599
5600
  END;
5600
5601
 
5601
5602
  CREATE TRIGGER IF NOT EXISTS trig_search_atoms_update AFTER UPDATE ON atoms BEGIN
5602
- UPDATE search_atoms SET title = new.title, summary = COALESCE(new.summary, '') WHERE rowid = new.rowid;
5603
+ INSERT OR REPLACE INTO search_atoms(rowid, title, summary) VALUES (new.rowid, new.title, COALESCE(new.summary, ''));
5603
5604
  END;
5604
5605
 
5605
5606
  CREATE TRIGGER IF NOT EXISTS trig_search_atoms_delete AFTER DELETE ON atoms BEGIN
@@ -5947,7 +5948,7 @@ function getVersion3() {
5947
5948
  const pkg = JSON.parse(readFileSync6(resolve9(process.cwd(), "package.json"), "utf-8"));
5948
5949
  return pkg.version;
5949
5950
  } catch {
5950
- return "2.1.5";
5951
+ return "2.1.8";
5951
5952
  }
5952
5953
  }
5953
5954
  }
@@ -7113,7 +7114,7 @@ var PKG_VERSION = (() => {
7113
7114
  const pkg = JSON.parse(__require("fs").readFileSync(__require("path").resolve(__dirname, "../../package.json"), "utf-8"));
7114
7115
  return pkg.version;
7115
7116
  } catch {
7116
- return "2.1.5";
7117
+ return "2.1.8";
7117
7118
  }
7118
7119
  })();
7119
7120
  function handleHealth(store, pathname, method, res) {
@@ -7396,6 +7397,10 @@ function getDb() {
7396
7397
  db.pragma("journal_mode = WAL");
7397
7398
  db.pragma("foreign_keys = ON");
7398
7399
  db.pragma("synchronous = NORMAL");
7400
+ try {
7401
+ db.pragma("wal_checkpoint(TRUNCATE)");
7402
+ } catch {
7403
+ }
7399
7404
  try {
7400
7405
  const { getLoadablePath } = __require("sqlite-vec");
7401
7406
  db.loadExtension(getLoadablePath());
@@ -7474,7 +7479,7 @@ var MnemosyneServer = class {
7474
7479
  const wss = new import_websocket_server.default({ server: this.httpServer });
7475
7480
  this.wsHandler = new WebSocketHandler(wss, this.store);
7476
7481
  }
7477
- const version = cfg?.server?.version || "2.1.5";
7482
+ const version = cfg?.server?.version || "2.1.8";
7478
7483
  this.httpServer.listen(port, () => {
7479
7484
  console.log(`Mnemosyne v${version} \u2014 port ${port}`);
7480
7485
  console.log(`Dashboard: http://${host}:${port}/dashboard`);