@kubun/db-better-sqlite 0.10.0 → 0.12.0

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.
Files changed (2) hide show
  1. package/lib/index.js +19 -1
  2. package/package.json +13 -13
package/lib/index.js CHANGED
@@ -1 +1,19 @@
1
- import{AbstractSQLiteAdapter as e}from"@kubun/db-adapter";import t from"better-sqlite3";import{SqliteDialect as r}from"kysely";export class SQLiteAdapter extends e{#e;constructor(e){super(),this.#e=new r({database:new t(e.database)})}get dialect(){return this.#e}encodeBinary(e){return Buffer.from(e)}}
1
+ import { AbstractSQLiteAdapter } from '@kubun/db-adapter';
2
+ import SQLite from 'better-sqlite3';
3
+ import { SqliteDialect } from 'kysely';
4
+ export class SQLiteAdapter extends AbstractSQLiteAdapter {
5
+ #dialect;
6
+ constructor(params){
7
+ super();
8
+ this.#dialect = new SqliteDialect({
9
+ database: new SQLite(params.database)
10
+ });
11
+ }
12
+ get dialect() {
13
+ return this.#dialect;
14
+ }
15
+ // better-sqlite3 expects binary data to use Buffer
16
+ encodeBinary(value) {
17
+ return Buffer.from(value);
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
1
  {
2
2
  "name": "@kubun/db-better-sqlite",
3
- "version": "0.10.0",
4
- "license": "see LICENSE.md",
3
+ "version": "0.12.0",
5
4
  "keywords": [],
5
+ "license": "see LICENSE.md",
6
+ "sideEffects": false,
6
7
  "type": "module",
7
- "main": "lib/index.js",
8
- "types": "lib/index.d.ts",
9
8
  "exports": {
10
9
  ".": "./lib/index.js"
11
10
  },
11
+ "main": "lib/index.js",
12
+ "types": "lib/index.d.ts",
12
13
  "files": [
13
14
  "lib/*",
14
15
  "LICENSE.md"
15
16
  ],
16
- "sideEffects": false,
17
17
  "dependencies": {
18
- "better-sqlite3": "^12.10.0",
19
- "kysely": "^0.29.2",
20
- "@kubun/db-adapter": "^0.10.0"
18
+ "better-sqlite3": "^13.0.3",
19
+ "kysely": "^0.29.4",
20
+ "@kubun/db-adapter": "^0.12.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@types/better-sqlite3": "^7.6.13"
23
+ "@types/better-sqlite3": "^9.6.0"
24
24
  },
25
25
  "scripts": {
26
+ "build": "pnpm run build:clean && pnpm run build:js && pnpm run build:types",
26
27
  "build:clean": "del lib",
27
- "build:js": "swc src -d ./lib --config-file ../../swc.json --strip-leading-paths",
28
+ "build:js": "swc src -d ./lib --config-file ../../node_modules/@kigu/dev/swc.json --strip-leading-paths",
28
29
  "build:types": "tsc --emitDeclarationOnly --skipLibCheck",
29
30
  "build:types:ci": "tsc --emitDeclarationOnly --declarationMap false",
30
- "build": "pnpm run build:clean && pnpm run build:js && pnpm run build:types",
31
+ "test": "pnpm run test:types && pnpm run test:unit",
31
32
  "test:types": "tsc --noEmit -p tsconfig.test.json",
32
- "test:unit": "vitest run",
33
- "test": "pnpm run test:types && pnpm run test:unit"
33
+ "test:unit": "vitest run"
34
34
  }
35
35
  }