Use node:sqlite

This commit is contained in:
2026-08-02 20:57:07 +10:00
parent 2442b17a4c
commit 33a465eca0
3 changed files with 5 additions and 17 deletions

12
package-lock.json generated
View File

@@ -17,7 +17,6 @@
"@xo-cash/state": "0.0.1", "@xo-cash/state": "0.0.1",
"@xo-cash/templates": "^0.0.3", "@xo-cash/templates": "^0.0.3",
"@xo-cash/types": "^0.0.1", "@xo-cash/types": "^0.0.1",
"better-sqlite3": "^12.6.2",
"clipboardy": "^5.1.0", "clipboardy": "^5.1.0",
"ink": "^6.6.0", "ink": "^6.6.0",
"prettier": "^3.8.1", "prettier": "^3.8.1",
@@ -31,7 +30,6 @@
"xo-tui": "dist/index.js" "xo-tui": "dist/index.js"
}, },
"devDependencies": { "devDependencies": {
"@types/better-sqlite3": "^7.6.13",
"@types/node": "^25.0.10", "@types/node": "^25.0.10",
"@types/qrcode": "^1.5.6", "@types/qrcode": "^1.5.6",
"@types/react": "^19.2.14", "@types/react": "^19.2.14",
@@ -1113,16 +1111,6 @@
"tslib": "^2.4.0" "tslib": "^2.4.0"
} }
}, },
"node_modules/@types/better-sqlite3": {
"version": "7.6.13",
"resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-7.6.13.tgz",
"integrity": "sha512-NMv9ASNARoKksWtsq/SHakpYAYnhBrQgGD8zkLYk/jaK8jUGn08CfEdTRgYhMypUQAfzSP8W6gNLe0q19/t4VA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/chai": { "node_modules/@types/chai": {
"version": "5.2.3", "version": "5.2.3",
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",

View File

@@ -41,7 +41,6 @@
"@xo-cash/state": "0.0.1", "@xo-cash/state": "0.0.1",
"@xo-cash/templates": "^0.0.3", "@xo-cash/templates": "^0.0.3",
"@xo-cash/types": "^0.0.1", "@xo-cash/types": "^0.0.1",
"better-sqlite3": "^12.6.2",
"clipboardy": "^5.1.0", "clipboardy": "^5.1.0",
"ink": "^6.6.0", "ink": "^6.6.0",
"prettier": "^3.8.1", "prettier": "^3.8.1",
@@ -50,7 +49,6 @@
"zod": "^4.3.6" "zod": "^4.3.6"
}, },
"devDependencies": { "devDependencies": {
"@types/better-sqlite3": "^7.6.13",
"@types/node": "^25.0.10", "@types/node": "^25.0.10",
"@types/qrcode": "^1.5.6", "@types/qrcode": "^1.5.6",
"@types/react": "^19.2.14", "@types/react": "^19.2.14",

View File

@@ -1,6 +1,8 @@
import Database from "better-sqlite3"; // import Database from "better-sqlite3";
import { decodeExtendedJson, encodeExtendedJson } from "../utils/ext-json.js"; import { decodeExtendedJson, encodeExtendedJson } from "../utils/ext-json.js";
import { DatabaseSync } from 'node:sqlite'
/** /**
* This is not an actual storage adapter that we want to make use of. This storage adapter is a stop-gap while the engine is under development. * This is not an actual storage adapter that we want to make use of. This storage adapter is a stop-gap while the engine is under development.
* At the time of writing the storage adapter, the engine provided no way to read data about your currenty invitations, so that is where this is coming in. * At the time of writing the storage adapter, the engine provided no way to read data about your currenty invitations, so that is where this is coming in.
@@ -21,7 +23,7 @@ export abstract class BaseStorage {
export class Storage extends BaseStorage { export class Storage extends BaseStorage {
static async create(dbPath: string): Promise<Storage> { static async create(dbPath: string): Promise<Storage> {
// Create the database // Create the database
const database = new Database(dbPath); const database = new DatabaseSync(dbPath);
// Create the storage table if it doesn't exist // Create the storage table if it doesn't exist
database database
@@ -34,7 +36,7 @@ export class Storage extends BaseStorage {
} }
constructor( constructor(
private readonly database: Database.Database, private readonly database: DatabaseSync,
private readonly basePath: string, private readonly basePath: string,
) { ) {
super(); super();