@fedify/sqlite 1.8.1-pr.318.1252 → 1.8.1-pr.318.1253
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/README.md +19 -11
- package/deno.json +1 -1
- package/dist/kv.d.ts +5 -0
- package/dist/kv.js +5 -0
- package/kv.ts +5 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
@fedify/sqlite: SQLite drivers for Fedify
|
|
2
|
-
|
|
2
|
+
=========================================
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
[![JSR][JSR badge]][JSR]
|
|
5
|
+
[![npm][npm badge]][npm]
|
|
6
|
+
|
|
7
|
+
This package provides a SQLite-based [`KvStore`] implementation for [Fedify].
|
|
8
|
+
|
|
9
|
+
[JSR]: https://jsr.io/@fedify/sqlite
|
|
10
|
+
[JSR badge]: https://jsr.io/badges/@fedify/sqlite
|
|
11
|
+
[npm]: https://www.npmjs.com/package/@fedify/sqlite
|
|
12
|
+
[npm badge]: https://img.shields.io/npm/v/@fedify/sqlite?logo=npm
|
|
13
|
+
[Fedify]: https://fedify.dev/
|
|
14
|
+
[`KvStore`]: https://jsr.io/@fedify/fedify/doc/federation/~/KvStore
|
|
5
15
|
|
|
6
16
|
## Usage
|
|
7
17
|
|
|
8
|
-
###
|
|
18
|
+
### Deno
|
|
9
19
|
|
|
10
20
|
```typescript
|
|
11
21
|
import { DatabaseSync } from 'node:sqlite';
|
|
@@ -15,24 +25,22 @@ const db = new DatabaseSync('./data.db');
|
|
|
15
25
|
const store = new SqliteKvStore(db);
|
|
16
26
|
```
|
|
17
27
|
|
|
18
|
-
###
|
|
28
|
+
### Node.js
|
|
19
29
|
|
|
20
30
|
```typescript
|
|
21
|
-
import {
|
|
31
|
+
import { DatabaseSync } from 'node:sqlite';
|
|
22
32
|
import { SqliteKvStore } from '@fedify/sqlite';
|
|
23
33
|
|
|
24
|
-
const db = new
|
|
34
|
+
const db = new DatabaseSync('./data.db');
|
|
25
35
|
const store = new SqliteKvStore(db);
|
|
26
36
|
```
|
|
27
37
|
|
|
28
|
-
###
|
|
29
|
-
|
|
30
|
-
For Deno, you can directly import from `@fedify/sqlite` when using the import map in `deno.json`:
|
|
38
|
+
### Bun
|
|
31
39
|
|
|
32
40
|
```typescript
|
|
33
|
-
import {
|
|
41
|
+
import { Database } from 'bun:sqlite';
|
|
34
42
|
import { SqliteKvStore } from '@fedify/sqlite';
|
|
35
43
|
|
|
36
|
-
const db = new
|
|
44
|
+
const db = new Database('./data.db');
|
|
37
45
|
const store = new SqliteKvStore(db);
|
|
38
46
|
```
|
package/deno.json
CHANGED
package/dist/kv.d.ts
CHANGED
|
@@ -40,6 +40,11 @@ declare class SqliteKvStore implements KvStore {
|
|
|
40
40
|
#private;
|
|
41
41
|
readonly db: PlatformDatabase;
|
|
42
42
|
readonly options: SqliteKvStoreOptions;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a new SQLite key–value store.
|
|
45
|
+
* @param db The SQLite database to use. Supports `node:sqlite` and `bun:sqlite`.
|
|
46
|
+
* @param options The options for the key–value store.
|
|
47
|
+
*/
|
|
43
48
|
constructor(db: PlatformDatabase, options?: SqliteKvStoreOptions);
|
|
44
49
|
/**
|
|
45
50
|
* {@inheritDoc KvStore.get}
|
package/dist/kv.js
CHANGED
|
@@ -34,6 +34,11 @@ var SqliteKvStore = class SqliteKvStore {
|
|
|
34
34
|
#db;
|
|
35
35
|
#tableName;
|
|
36
36
|
#initialized;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a new SQLite key–value store.
|
|
39
|
+
* @param db The SQLite database to use. Supports `node:sqlite` and `bun:sqlite`.
|
|
40
|
+
* @param options The options for the key–value store.
|
|
41
|
+
*/
|
|
37
42
|
constructor(db, options = {}) {
|
|
38
43
|
this.db = db;
|
|
39
44
|
this.options = options;
|
package/kv.ts
CHANGED
|
@@ -49,6 +49,11 @@ export class SqliteKvStore implements KvStore {
|
|
|
49
49
|
readonly #tableName: string;
|
|
50
50
|
#initialized: boolean;
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Creates a new SQLite key–value store.
|
|
54
|
+
* @param db The SQLite database to use. Supports `node:sqlite` and `bun:sqlite`.
|
|
55
|
+
* @param options The options for the key–value store.
|
|
56
|
+
*/
|
|
52
57
|
constructor(
|
|
53
58
|
readonly db: PlatformDatabase,
|
|
54
59
|
readonly options: SqliteKvStoreOptions = {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/sqlite",
|
|
3
|
-
"version": "1.8.1-pr.318.
|
|
3
|
+
"version": "1.8.1-pr.318.1253+df65498e",
|
|
4
4
|
"description": "SQLite drivers for Fedify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"es-toolkit": "^1.31.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@fedify/fedify": "1.8.1-pr.318.
|
|
54
|
+
"@fedify/fedify": "1.8.1-pr.318.1253+df65498e"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@js-temporal/polyfill": "^0.5.1",
|