Skip to content

Build your personal knowledge base with Trilium Notes

fix(standalone): error due to SQL returning bigint

Elian Doran458e858b2436
diff --git a/apps/client-standalone/src/lightweight/sql_provider.ts b/apps/client-standalone/src/lightweight/sql_provider.ts
index 0890f454b5..0e4d6670c9 100644
--- a/apps/client-standalone/src/lightweight/sql_provider.ts
+++ b/apps/client-standalone/src/lightweight/sql_provider.ts
@@ -1,6 +1,6 @@
+import { type BindableValue, default as sqlite3InitModule } from "@sqlite.org/sqlite-wasm";
import type { DatabaseProvider, RunResult, Statement, Transaction } from "@triliumnext/core";
-import sqlite3InitModule from "@sqlite.org/sqlite-wasm";
-import type { BindableValue } from "@sqlite.org/sqlite-wasm";
+
import demoDbSql from "./db.sql?raw";
// Type definitions for SQLite WASM (the library doesn't export these directly)
@@ -39,7 +39,7 @@ class WasmStatement implements Statement {
this.stmt.reset();
return {
changes,
- lastInsertRowid
+ lastInsertRowid: typeof lastInsertRowid === "bigint" ? Number(lastInsertRowid) : lastInsertRowid
};
} catch (e) {
// Reset on error to allow reuse
diff --git a/packages/trilium-core/src/services/sql/types.ts b/packages/trilium-core/src/services/sql/types.ts
index e4bd5cb1c7..edbbc1a3b6 100644
--- a/packages/trilium-core/src/services/sql/types.ts
+++ b/packages/trilium-core/src/services/sql/types.ts
@@ -15,7 +15,7 @@ export interface Transaction {
export interface RunResult {
changes: number;
- lastInsertRowid: number | bigint;
+ lastInsertRowid: number;
}
export interface DatabaseProvider {