@fedify/sqlite 1.10.5 → 1.10.7
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/deno.json +1 -1
- package/dist/adapter.d.ts +0 -1
- package/dist/kv.cjs +10 -16
- package/dist/kv.d.cts +3 -3
- package/dist/kv.js +4 -10
- package/dist/mod.cjs +4 -6
- package/dist/mod.js +2 -5
- package/dist/sqlite.bun.cjs +5 -9
- package/dist/sqlite.bun.d.cts +1 -1
- package/dist/sqlite.bun.d.ts +1 -1
- package/dist/sqlite.bun.js +3 -7
- package/dist/sqlite.node.cjs +4 -8
- package/dist/sqlite.node.d.cts +1 -1
- package/dist/sqlite.node.d.ts +1 -1
- package/dist/sqlite.node.js +2 -6
- package/package.json +3 -3
- package/tsdown.config.ts +6 -0
- package/dist/_virtual/rolldown_runtime.cjs +0 -33
- package/dist/dist/sqlite.node.d.cts +0 -2
package/deno.json
CHANGED
package/dist/adapter.d.ts
CHANGED
package/dist/kv.cjs
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const __logtape_logtape = require_rolldown_runtime.__toESM(require("@logtape/logtape"));
|
|
7
|
-
const es_toolkit = require_rolldown_runtime.__toESM(require("es-toolkit"));
|
|
8
|
-
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
let _sqlite = require("#sqlite");
|
|
4
|
+
let _logtape_logtape = require("@logtape/logtape");
|
|
5
|
+
let es_toolkit = require("es-toolkit");
|
|
9
6
|
//#region src/kv.ts
|
|
10
|
-
const logger = (0,
|
|
7
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
11
8
|
"fedify",
|
|
12
9
|
"sqlite",
|
|
13
10
|
"kv"
|
|
@@ -42,7 +39,7 @@ var SqliteKvStore = class SqliteKvStore {
|
|
|
42
39
|
constructor(db, options = {}) {
|
|
43
40
|
this.db = db;
|
|
44
41
|
this.options = options;
|
|
45
|
-
this.#db = new
|
|
42
|
+
this.#db = new _sqlite.SqliteDatabase(db);
|
|
46
43
|
this.#initialized = options.initialized ?? false;
|
|
47
44
|
this.#tableName = options.tableName ?? SqliteKvStore.#defaultTableName;
|
|
48
45
|
if (!SqliteKvStore.#tableNameRegex.test(this.#tableName)) throw new Error(`Invalid table name for the key–value store: ${this.#tableName}`);
|
|
@@ -59,7 +56,7 @@ var SqliteKvStore = class SqliteKvStore {
|
|
|
59
56
|
FROM "${this.#tableName}"
|
|
60
57
|
WHERE key = ? AND (expires IS NULL OR expires > ?)
|
|
61
58
|
`).get(encodedKey, now);
|
|
62
|
-
if (!result) return
|
|
59
|
+
if (!result) return;
|
|
63
60
|
return this.#decodeValue(result.value);
|
|
64
61
|
}
|
|
65
62
|
/**
|
|
@@ -78,7 +75,6 @@ var SqliteKvStore = class SqliteKvStore {
|
|
|
78
75
|
value = excluded.value,
|
|
79
76
|
expires = excluded.expires`).run(encodedKey, encodedValue, now, expiresAt);
|
|
80
77
|
this.#expire();
|
|
81
|
-
return;
|
|
82
78
|
}
|
|
83
79
|
/**
|
|
84
80
|
* {@inheritDoc KvStore.delete}
|
|
@@ -107,8 +103,7 @@ var SqliteKvStore = class SqliteKvStore {
|
|
|
107
103
|
FROM "${this.#tableName}"
|
|
108
104
|
WHERE key = ? AND (expires IS NULL OR expires > ?)
|
|
109
105
|
`).get(encodedKey, now);
|
|
110
|
-
|
|
111
|
-
if (!(0, es_toolkit.isEqual)(currentValue, expectedValue)) {
|
|
106
|
+
if (!(0, es_toolkit.isEqual)(currentResult === void 0 ? void 0 : this.#decodeValue(currentResult.value), expectedValue)) {
|
|
112
107
|
this.#db.exec("ROLLBACK");
|
|
113
108
|
return false;
|
|
114
109
|
}
|
|
@@ -213,6 +208,5 @@ var SqliteKvStore = class SqliteKvStore {
|
|
|
213
208
|
return JSON.parse(value);
|
|
214
209
|
}
|
|
215
210
|
};
|
|
216
|
-
|
|
217
211
|
//#endregion
|
|
218
|
-
exports.SqliteKvStore = SqliteKvStore;
|
|
212
|
+
exports.SqliteKvStore = SqliteKvStore;
|
package/dist/kv.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PlatformDatabase } from "#sqlite";
|
|
2
2
|
import { KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions } from "@fedify/fedify";
|
|
3
3
|
|
|
4
4
|
//#region src/kv.d.ts
|
|
@@ -37,14 +37,14 @@ interface SqliteKvStoreOptions {
|
|
|
37
37
|
*/
|
|
38
38
|
declare class SqliteKvStore implements KvStore {
|
|
39
39
|
#private;
|
|
40
|
-
readonly db:
|
|
40
|
+
readonly db: PlatformDatabase;
|
|
41
41
|
readonly options: SqliteKvStoreOptions;
|
|
42
42
|
/**
|
|
43
43
|
* Creates a new SQLite key–value store.
|
|
44
44
|
* @param db The SQLite database to use. Supports `node:sqlite` and `bun:sqlite`.
|
|
45
45
|
* @param options The options for the key–value store.
|
|
46
46
|
*/
|
|
47
|
-
constructor(db:
|
|
47
|
+
constructor(db: PlatformDatabase, options?: SqliteKvStoreOptions);
|
|
48
48
|
/**
|
|
49
49
|
* {@inheritDoc KvStore.get}
|
|
50
50
|
*/
|
package/dist/kv.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
4
2
|
import { SqliteDatabase } from "#sqlite";
|
|
5
3
|
import { getLogger } from "@logtape/logtape";
|
|
6
4
|
import { isEqual } from "es-toolkit";
|
|
7
|
-
|
|
8
5
|
//#region src/kv.ts
|
|
9
6
|
const logger = getLogger([
|
|
10
7
|
"fedify",
|
|
@@ -58,7 +55,7 @@ var SqliteKvStore = class SqliteKvStore {
|
|
|
58
55
|
FROM "${this.#tableName}"
|
|
59
56
|
WHERE key = ? AND (expires IS NULL OR expires > ?)
|
|
60
57
|
`).get(encodedKey, now);
|
|
61
|
-
if (!result) return
|
|
58
|
+
if (!result) return;
|
|
62
59
|
return this.#decodeValue(result.value);
|
|
63
60
|
}
|
|
64
61
|
/**
|
|
@@ -77,7 +74,6 @@ var SqliteKvStore = class SqliteKvStore {
|
|
|
77
74
|
value = excluded.value,
|
|
78
75
|
expires = excluded.expires`).run(encodedKey, encodedValue, now, expiresAt);
|
|
79
76
|
this.#expire();
|
|
80
|
-
return;
|
|
81
77
|
}
|
|
82
78
|
/**
|
|
83
79
|
* {@inheritDoc KvStore.delete}
|
|
@@ -106,8 +102,7 @@ var SqliteKvStore = class SqliteKvStore {
|
|
|
106
102
|
FROM "${this.#tableName}"
|
|
107
103
|
WHERE key = ? AND (expires IS NULL OR expires > ?)
|
|
108
104
|
`).get(encodedKey, now);
|
|
109
|
-
|
|
110
|
-
if (!isEqual(currentValue, expectedValue)) {
|
|
105
|
+
if (!isEqual(currentResult === void 0 ? void 0 : this.#decodeValue(currentResult.value), expectedValue)) {
|
|
111
106
|
this.#db.exec("ROLLBACK");
|
|
112
107
|
return false;
|
|
113
108
|
}
|
|
@@ -212,6 +207,5 @@ var SqliteKvStore = class SqliteKvStore {
|
|
|
212
207
|
return JSON.parse(value);
|
|
213
208
|
}
|
|
214
209
|
};
|
|
215
|
-
|
|
216
210
|
//#endregion
|
|
217
|
-
export { SqliteKvStore };
|
|
211
|
+
export { SqliteKvStore };
|
package/dist/mod.cjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.SqliteKvStore = require_kv.SqliteKvStore;
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_kv = require("./kv.cjs");
|
|
4
|
+
exports.SqliteKvStore = require_kv.SqliteKvStore;
|
package/dist/mod.js
CHANGED
package/dist/sqlite.bun.cjs
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
5
|
-
const bun_sqlite = require_rolldown_runtime.__toESM(require("bun:sqlite"));
|
|
6
|
-
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
let bun_sqlite = require("bun:sqlite");
|
|
7
4
|
//#region src/sqlite.bun.ts
|
|
8
5
|
var SqliteDatabase = class {
|
|
9
6
|
constructor(db) {
|
|
@@ -28,15 +25,14 @@ var SqliteStatement = class {
|
|
|
28
25
|
}
|
|
29
26
|
get(...params) {
|
|
30
27
|
const result = this.stmt.get(...params);
|
|
31
|
-
if (result === null) return
|
|
28
|
+
if (result === null) return;
|
|
32
29
|
return result;
|
|
33
30
|
}
|
|
34
31
|
all(...params) {
|
|
35
32
|
return this.stmt.all(...params);
|
|
36
33
|
}
|
|
37
34
|
};
|
|
38
|
-
|
|
39
35
|
//#endregion
|
|
40
36
|
exports.PlatformDatabase = bun_sqlite.Database;
|
|
41
37
|
exports.SqliteDatabase = SqliteDatabase;
|
|
42
|
-
exports.SqliteStatement = SqliteStatement;
|
|
38
|
+
exports.SqliteStatement = SqliteStatement;
|
package/dist/sqlite.bun.d.cts
CHANGED
|
@@ -20,4 +20,4 @@ declare class SqliteStatement implements SqliteStatementAdapter {
|
|
|
20
20
|
all(...params: unknown[]): unknown[];
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
|
-
export { Database as PlatformDatabase, Statement as PlatformStatement, SqliteDatabase, SqliteStatement };
|
|
23
|
+
export { Database as PlatformDatabase, type Statement as PlatformStatement, SqliteDatabase, SqliteStatement };
|
package/dist/sqlite.bun.d.ts
CHANGED
|
@@ -21,4 +21,4 @@ declare class SqliteStatement implements SqliteStatementAdapter {
|
|
|
21
21
|
all(...params: unknown[]): unknown[];
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
|
-
export { Database as PlatformDatabase, Statement as PlatformStatement, SqliteDatabase, SqliteStatement };
|
|
24
|
+
export { Database as PlatformDatabase, type Statement as PlatformStatement, SqliteDatabase, SqliteStatement };
|
package/dist/sqlite.bun.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
4
2
|
import { Database } from "bun:sqlite";
|
|
5
|
-
|
|
6
3
|
//#region src/sqlite.bun.ts
|
|
7
4
|
var SqliteDatabase = class {
|
|
8
5
|
constructor(db) {
|
|
@@ -27,13 +24,12 @@ var SqliteStatement = class {
|
|
|
27
24
|
}
|
|
28
25
|
get(...params) {
|
|
29
26
|
const result = this.stmt.get(...params);
|
|
30
|
-
if (result === null) return
|
|
27
|
+
if (result === null) return;
|
|
31
28
|
return result;
|
|
32
29
|
}
|
|
33
30
|
all(...params) {
|
|
34
31
|
return this.stmt.all(...params);
|
|
35
32
|
}
|
|
36
33
|
};
|
|
37
|
-
|
|
38
34
|
//#endregion
|
|
39
|
-
export { Database as PlatformDatabase, SqliteDatabase, SqliteStatement };
|
|
35
|
+
export { Database as PlatformDatabase, SqliteDatabase, SqliteStatement };
|
package/dist/sqlite.node.cjs
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
5
|
-
const node_sqlite = require_rolldown_runtime.__toESM(require("node:sqlite"));
|
|
6
|
-
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
let node_sqlite = require("node:sqlite");
|
|
7
4
|
//#region src/sqlite.node.ts
|
|
8
5
|
var SqliteDatabase = class {
|
|
9
6
|
constructor(db) {
|
|
@@ -37,8 +34,7 @@ var SqliteStatement = class {
|
|
|
37
34
|
return this.stmt.all(...params);
|
|
38
35
|
}
|
|
39
36
|
};
|
|
40
|
-
|
|
41
37
|
//#endregion
|
|
42
38
|
exports.PlatformDatabase = node_sqlite.DatabaseSync;
|
|
43
39
|
exports.SqliteDatabase = SqliteDatabase;
|
|
44
|
-
exports.SqliteStatement = SqliteStatement;
|
|
40
|
+
exports.SqliteStatement = SqliteStatement;
|
package/dist/sqlite.node.d.cts
CHANGED
|
@@ -20,4 +20,4 @@ declare class SqliteStatement implements SqliteStatementAdapter {
|
|
|
20
20
|
all(...params: unknown[]): unknown[];
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
|
-
export { DatabaseSync as PlatformDatabase, StatementSync as PlatformStatement, SqliteDatabase, SqliteStatement };
|
|
23
|
+
export { DatabaseSync as PlatformDatabase, type StatementSync as PlatformStatement, SqliteDatabase, SqliteStatement };
|
package/dist/sqlite.node.d.ts
CHANGED
|
@@ -21,4 +21,4 @@ declare class SqliteStatement implements SqliteStatementAdapter {
|
|
|
21
21
|
all(...params: unknown[]): unknown[];
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
|
-
export { DatabaseSync as PlatformDatabase, StatementSync as PlatformStatement, SqliteDatabase, SqliteStatement };
|
|
24
|
+
export { DatabaseSync as PlatformDatabase, type StatementSync as PlatformStatement, SqliteDatabase, SqliteStatement };
|
package/dist/sqlite.node.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
4
2
|
import { DatabaseSync } from "node:sqlite";
|
|
5
|
-
|
|
6
3
|
//#region src/sqlite.node.ts
|
|
7
4
|
var SqliteDatabase = class {
|
|
8
5
|
constructor(db) {
|
|
@@ -36,6 +33,5 @@ var SqliteStatement = class {
|
|
|
36
33
|
return this.stmt.all(...params);
|
|
37
34
|
}
|
|
38
35
|
};
|
|
39
|
-
|
|
40
36
|
//#endregion
|
|
41
|
-
export { DatabaseSync as PlatformDatabase, SqliteDatabase, SqliteStatement };
|
|
37
|
+
export { DatabaseSync as PlatformDatabase, SqliteDatabase, SqliteStatement };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/sqlite",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.7",
|
|
4
4
|
"description": "SQLite drivers for Fedify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"es-toolkit": "^1.31.0"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@fedify/fedify": "^1.10.
|
|
65
|
+
"@fedify/fedify": "^1.10.7"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@std/async": "npm:@jsr/std__async@^1.0.13",
|
|
69
|
-
"tsdown": "^0.
|
|
69
|
+
"tsdown": "^0.21.6",
|
|
70
70
|
"typescript": "^5.9.2"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
package/tsdown.config.ts
CHANGED
|
@@ -6,6 +6,12 @@ export default defineConfig({
|
|
|
6
6
|
unbundle: true,
|
|
7
7
|
format: ["esm", "cjs"],
|
|
8
8
|
platform: "node",
|
|
9
|
+
outExtensions({ format }) {
|
|
10
|
+
return {
|
|
11
|
+
js: format === "cjs" ? ".cjs" : ".js",
|
|
12
|
+
dts: format === "cjs" ? ".d.cts" : ".d.ts",
|
|
13
|
+
};
|
|
14
|
+
},
|
|
9
15
|
inputOptions: {
|
|
10
16
|
onwarn(warning, defaultHandler) {
|
|
11
17
|
if (
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
|
-
|
|
4
|
-
//#region rolldown:runtime
|
|
5
|
-
var __create = Object.create;
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
13
|
-
key = keys[i];
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
-
get: ((k) => from[k]).bind(null, key),
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
-
value: mod,
|
|
23
|
-
enumerable: true
|
|
24
|
-
}) : target, mod));
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
|
|
28
|
-
Object.defineProperty(exports, '__toESM', {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
get: function () {
|
|
31
|
-
return __toESM;
|
|
32
|
-
}
|
|
33
|
-
});
|