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.
@@ -3817,7 +3817,7 @@ function getVersion2() {
3817
3817
  const pkg = JSON.parse(readFileSync5(resolve7(process.cwd(), "package.json"), "utf-8"));
3818
3818
  return pkg.version;
3819
3819
  } catch {
3820
- return "2.1.5";
3820
+ return "2.1.8";
3821
3821
  }
3822
3822
  }
3823
3823
  }
@@ -4368,7 +4368,7 @@ function getVersion() {
4368
4368
  const pkg = JSON.parse(readFileSync5(resolve7(process.cwd(), "package.json"), "utf-8"));
4369
4369
  return pkg.version;
4370
4370
  } catch {
4371
- return "2.1.5";
4371
+ return "2.1.8";
4372
4372
  }
4373
4373
  }
4374
4374
  }
@@ -5500,7 +5500,7 @@ var PKG_VERSION = (() => {
5500
5500
  const pkg = JSON.parse(require("fs").readFileSync(require("path").resolve(__dirname, "../../package.json"), "utf-8"));
5501
5501
  return pkg.version;
5502
5502
  } catch {
5503
- return "2.1.5";
5503
+ return "2.1.8";
5504
5504
  }
5505
5505
  })();
5506
5506
  function handleHealth(store, pathname, method, res) {
@@ -6173,8 +6173,9 @@ var Store = class extends EventEmitter {
6173
6173
  vals.push(this.now());
6174
6174
  sets.push("version = version + 1");
6175
6175
  vals.push(id);
6176
+ const sql = `UPDATE atoms SET ${sets.join(", ")} WHERE id = ?`;
6176
6177
  try {
6177
- this.stmt(`UPDATE atoms SET ${sets.join(", ")} WHERE id = ?`).run(...vals);
6178
+ this.stmt(sql).run(...vals);
6178
6179
  } catch (err) {
6179
6180
  if (err.message?.includes("malformed") || err.message?.includes("corrupt")) {
6180
6181
  throw new Error(`Database appears corrupted. Run "mnemosyne doctor --data-dir ./data" or delete the data directory and run "mnemosyne init" again.`);
@@ -7067,7 +7068,7 @@ CREATE TRIGGER IF NOT EXISTS trig_search_atoms_insert AFTER INSERT ON atoms BEGI
7067
7068
  END;
7068
7069
 
7069
7070
  CREATE TRIGGER IF NOT EXISTS trig_search_atoms_update AFTER UPDATE ON atoms BEGIN
7070
- UPDATE search_atoms SET title = new.title, summary = COALESCE(new.summary, '') WHERE rowid = new.rowid;
7071
+ INSERT OR REPLACE INTO search_atoms(rowid, title, summary) VALUES (new.rowid, new.title, COALESCE(new.summary, ''));
7071
7072
  END;
7072
7073
 
7073
7074
  CREATE TRIGGER IF NOT EXISTS trig_search_atoms_delete AFTER DELETE ON atoms BEGIN
@@ -7117,6 +7118,10 @@ function getDb() {
7117
7118
  db.pragma("journal_mode = WAL");
7118
7119
  db.pragma("foreign_keys = ON");
7119
7120
  db.pragma("synchronous = NORMAL");
7121
+ try {
7122
+ db.pragma("wal_checkpoint(TRUNCATE)");
7123
+ } catch {
7124
+ }
7120
7125
  try {
7121
7126
  const { getLoadablePath } = require("sqlite-vec");
7122
7127
  db.loadExtension(getLoadablePath());
@@ -7195,7 +7200,7 @@ var MnemosyneServer = class {
7195
7200
  const wss = new import_websocket_server.default({ server: this.httpServer });
7196
7201
  this.wsHandler = new WebSocketHandler(wss, this.store);
7197
7202
  }
7198
- const version = cfg?.server?.version || "2.1.5";
7203
+ const version = cfg?.server?.version || "2.1.8";
7199
7204
  this.httpServer.listen(port, () => {
7200
7205
  console.log(`Mnemosyne v${version} \u2014 port ${port}`);
7201
7206
  console.log(`Dashboard: http://${host}:${port}/dashboard`);