@dexto/core 1.1.4

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.
@@ -0,0 +1,20 @@
1
+ import {
2
+ createInitialPreferences,
3
+ getGlobalPreferencesPath,
4
+ globalPreferencesExist,
5
+ loadGlobalPreferences,
6
+ saveGlobalPreferences,
7
+ updateGlobalPreferences
8
+ } from "./chunk-J6AXCN3H.js";
9
+ import "./chunk-XFQLRBHE.js";
10
+ import "./chunk-D62MHQBE.js";
11
+ import "./chunk-TPERKLLN.js";
12
+ import "./chunk-MVKLS3LM.js";
13
+ export {
14
+ createInitialPreferences,
15
+ getGlobalPreferencesPath,
16
+ globalPreferencesExist,
17
+ loadGlobalPreferences,
18
+ saveGlobalPreferences,
19
+ updateGlobalPreferences
20
+ };
@@ -0,0 +1,21 @@
1
+ import {
2
+ copyDirectory,
3
+ ensureDextoGlobalDirectory,
4
+ findPackageRoot,
5
+ getDextoEnvPath,
6
+ getDextoGlobalPath,
7
+ getDextoPath,
8
+ isPath,
9
+ resolveBundledScript
10
+ } from "./chunk-D62MHQBE.js";
11
+ import "./chunk-MVKLS3LM.js";
12
+ export {
13
+ copyDirectory,
14
+ ensureDextoGlobalDirectory,
15
+ findPackageRoot,
16
+ getDextoEnvPath,
17
+ getDextoGlobalPath,
18
+ getDextoPath,
19
+ isPath,
20
+ resolveBundledScript
21
+ };
@@ -0,0 +1,216 @@
1
+ import {
2
+ StorageError
3
+ } from "./chunk-F2QFAECT.js";
4
+ import "./chunk-TPERKLLN.js";
5
+ import {
6
+ init_esm_shims
7
+ } from "./chunk-MVKLS3LM.js";
8
+
9
+ // src/storage/backend/postgres-backend.ts
10
+ init_esm_shims();
11
+ import { Pool } from "pg";
12
+ var PostgresBackend = class {
13
+ constructor(config) {
14
+ this.config = config;
15
+ }
16
+ pool = null;
17
+ connected = false;
18
+ async connect() {
19
+ if (this.connected) return;
20
+ this.pool = new Pool({
21
+ connectionString: this.config.connectionString || this.config.url,
22
+ max: this.config.maxConnections || 20,
23
+ idleTimeoutMillis: this.config.idleTimeoutMillis || 3e4,
24
+ connectionTimeoutMillis: this.config.connectionTimeoutMillis || 2e3,
25
+ ...this.config.options
26
+ });
27
+ const client = await this.pool.connect();
28
+ try {
29
+ await client.query("SELECT NOW()");
30
+ await this.createTables(client);
31
+ this.connected = true;
32
+ } finally {
33
+ client.release();
34
+ }
35
+ }
36
+ async disconnect() {
37
+ if (this.pool) {
38
+ await this.pool.end();
39
+ this.pool = null;
40
+ }
41
+ this.connected = false;
42
+ }
43
+ isConnected() {
44
+ return this.connected && this.pool !== null;
45
+ }
46
+ getBackendType() {
47
+ return "postgres";
48
+ }
49
+ // Core operations
50
+ async get(key) {
51
+ this.checkConnection();
52
+ const client = await this.pool.connect();
53
+ try {
54
+ const result = await client.query("SELECT value FROM kv WHERE key = $1", [key]);
55
+ return result.rows[0] ? result.rows[0].value : void 0;
56
+ } catch (error) {
57
+ throw StorageError.readFailed(
58
+ "get",
59
+ error instanceof Error ? error.message : String(error),
60
+ { key }
61
+ );
62
+ } finally {
63
+ client.release();
64
+ }
65
+ }
66
+ async set(key, value) {
67
+ this.checkConnection();
68
+ const client = await this.pool.connect();
69
+ try {
70
+ await client.query(
71
+ "INSERT INTO kv (key, value, updated_at) VALUES ($1, $2, $3) ON CONFLICT (key) DO UPDATE SET value = $2, updated_at = $3",
72
+ [key, JSON.stringify(value), /* @__PURE__ */ new Date()]
73
+ );
74
+ } finally {
75
+ client.release();
76
+ }
77
+ }
78
+ async delete(key) {
79
+ this.checkConnection();
80
+ const client = await this.pool.connect();
81
+ try {
82
+ await client.query("BEGIN");
83
+ await client.query("DELETE FROM kv WHERE key = $1", [key]);
84
+ await client.query("DELETE FROM lists WHERE key = $1", [key]);
85
+ await client.query("COMMIT");
86
+ } catch (error) {
87
+ await client.query("ROLLBACK");
88
+ throw error;
89
+ } finally {
90
+ client.release();
91
+ }
92
+ }
93
+ // List operations
94
+ async list(prefix) {
95
+ this.checkConnection();
96
+ const client = await this.pool.connect();
97
+ try {
98
+ const kvResult = await client.query("SELECT key FROM kv WHERE key LIKE $1", [
99
+ `${prefix}%`
100
+ ]);
101
+ const listResult = await client.query(
102
+ "SELECT DISTINCT key FROM lists WHERE key LIKE $1",
103
+ [`${prefix}%`]
104
+ );
105
+ const allKeys = /* @__PURE__ */ new Set([
106
+ ...kvResult.rows.map((row) => row.key),
107
+ ...listResult.rows.map((row) => row.key)
108
+ ]);
109
+ return Array.from(allKeys).sort();
110
+ } finally {
111
+ client.release();
112
+ }
113
+ }
114
+ async append(key, item) {
115
+ this.checkConnection();
116
+ const client = await this.pool.connect();
117
+ try {
118
+ await client.query("INSERT INTO lists (key, item, created_at) VALUES ($1, $2, $3)", [
119
+ key,
120
+ JSON.stringify(item),
121
+ /* @__PURE__ */ new Date()
122
+ ]);
123
+ } finally {
124
+ client.release();
125
+ }
126
+ }
127
+ async getRange(key, start, count) {
128
+ this.checkConnection();
129
+ const client = await this.pool.connect();
130
+ try {
131
+ const result = await client.query(
132
+ "SELECT item FROM lists WHERE key = $1 ORDER BY created_at ASC LIMIT $2 OFFSET $3",
133
+ [key, count, start]
134
+ );
135
+ return result.rows.map((row) => JSON.parse(row.item));
136
+ } finally {
137
+ client.release();
138
+ }
139
+ }
140
+ // Schema management
141
+ async createTables(client) {
142
+ await client.query(`
143
+ CREATE TABLE IF NOT EXISTS kv (
144
+ key VARCHAR(255) PRIMARY KEY,
145
+ value JSONB NOT NULL,
146
+ updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
147
+ )
148
+ `);
149
+ await client.query(`
150
+ CREATE TABLE IF NOT EXISTS lists (
151
+ id BIGSERIAL PRIMARY KEY,
152
+ key VARCHAR(255) NOT NULL,
153
+ item JSONB NOT NULL,
154
+ created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
155
+ )
156
+ `);
157
+ await client.query("CREATE INDEX IF NOT EXISTS idx_kv_key ON kv(key)");
158
+ await client.query("CREATE INDEX IF NOT EXISTS idx_lists_key ON lists(key)");
159
+ await client.query(
160
+ "CREATE INDEX IF NOT EXISTS idx_lists_created_at ON lists(key, created_at DESC)"
161
+ );
162
+ }
163
+ checkConnection() {
164
+ if (!this.connected || !this.pool) {
165
+ throw StorageError.notConnected("PostgresBackend");
166
+ }
167
+ }
168
+ // Advanced operations
169
+ async transaction(callback) {
170
+ this.checkConnection();
171
+ const client = await this.pool.connect();
172
+ try {
173
+ await client.query("BEGIN");
174
+ const result = await callback(client);
175
+ await client.query("COMMIT");
176
+ return result;
177
+ } catch (error) {
178
+ await client.query("ROLLBACK");
179
+ throw error;
180
+ } finally {
181
+ client.release();
182
+ }
183
+ }
184
+ async getStats() {
185
+ this.checkConnection();
186
+ const client = await this.pool.connect();
187
+ try {
188
+ const kvResult = await client.query("SELECT COUNT(*) as count FROM kv");
189
+ const listResult = await client.query("SELECT COUNT(*) as count FROM lists");
190
+ const sizeResult = await client.query(
191
+ "SELECT pg_size_pretty(pg_total_relation_size($1)) as size",
192
+ ["kv"]
193
+ );
194
+ return {
195
+ kvCount: parseInt(kvResult.rows[0].count),
196
+ listCount: parseInt(listResult.rows[0].count),
197
+ totalSize: sizeResult.rows[0].size
198
+ };
199
+ } finally {
200
+ client.release();
201
+ }
202
+ }
203
+ // Maintenance operations
204
+ async vacuum() {
205
+ this.checkConnection();
206
+ const client = await this.pool.connect();
207
+ try {
208
+ await client.query("VACUUM ANALYZE kv, lists");
209
+ } finally {
210
+ client.release();
211
+ }
212
+ }
213
+ };
214
+ export {
215
+ PostgresBackend
216
+ };
@@ -0,0 +1,169 @@
1
+ import {
2
+ StorageError
3
+ } from "./chunk-F2QFAECT.js";
4
+ import "./chunk-TPERKLLN.js";
5
+ import {
6
+ init_esm_shims
7
+ } from "./chunk-MVKLS3LM.js";
8
+
9
+ // src/storage/backend/redis-backend.ts
10
+ init_esm_shims();
11
+ import { Redis } from "ioredis";
12
+ var RedisBackend = class {
13
+ constructor(config) {
14
+ this.config = config;
15
+ }
16
+ redis = null;
17
+ connected = false;
18
+ async connect() {
19
+ if (this.connected) return;
20
+ this.redis = new Redis({
21
+ ...this.config.host && { host: this.config.host },
22
+ ...this.config.port && { port: this.config.port },
23
+ ...this.config.password && { password: this.config.password },
24
+ db: this.config.database || 0,
25
+ family: 4,
26
+ // IPv4 by default
27
+ ...this.config.connectionTimeoutMillis && {
28
+ connectTimeout: this.config.connectionTimeoutMillis
29
+ },
30
+ ...this.config.connectionTimeoutMillis && {
31
+ commandTimeout: this.config.connectionTimeoutMillis
32
+ },
33
+ maxRetriesPerRequest: 3,
34
+ lazyConnect: true,
35
+ ...this.config.options
36
+ });
37
+ this.redis.on("error", (error) => {
38
+ console.error("Redis connection error:", error);
39
+ });
40
+ this.redis.on("connect", () => {
41
+ this.connected = true;
42
+ });
43
+ this.redis.on("close", () => {
44
+ this.connected = false;
45
+ });
46
+ await this.redis.connect();
47
+ }
48
+ async disconnect() {
49
+ if (this.redis) {
50
+ await this.redis.quit();
51
+ this.redis = null;
52
+ }
53
+ this.connected = false;
54
+ }
55
+ isConnected() {
56
+ return this.connected && this.redis?.status === "ready";
57
+ }
58
+ getBackendType() {
59
+ return "redis";
60
+ }
61
+ // Core operations
62
+ async get(key) {
63
+ this.checkConnection();
64
+ try {
65
+ const value = await this.redis.get(key);
66
+ return value ? JSON.parse(value) : void 0;
67
+ } catch (error) {
68
+ throw StorageError.readFailed(
69
+ "get",
70
+ error instanceof Error ? error.message : String(error),
71
+ { key }
72
+ );
73
+ }
74
+ }
75
+ async set(key, value, ttlSeconds) {
76
+ this.checkConnection();
77
+ try {
78
+ const serialized = JSON.stringify(value);
79
+ if (ttlSeconds) {
80
+ await this.redis.setex(key, ttlSeconds, serialized);
81
+ } else {
82
+ await this.redis.set(key, serialized);
83
+ }
84
+ } catch (error) {
85
+ throw StorageError.writeFailed(
86
+ "set",
87
+ error instanceof Error ? error.message : String(error),
88
+ { key }
89
+ );
90
+ }
91
+ }
92
+ async delete(key) {
93
+ this.checkConnection();
94
+ try {
95
+ await this.redis.del(key);
96
+ } catch (error) {
97
+ throw StorageError.deleteFailed(
98
+ "delete",
99
+ error instanceof Error ? error.message : String(error),
100
+ { key }
101
+ );
102
+ }
103
+ }
104
+ // Redis-specific optimizations
105
+ async mget(keys) {
106
+ this.checkConnection();
107
+ if (keys.length === 0) return [];
108
+ const values = await this.redis.mget(...keys);
109
+ return values.map((value) => value ? JSON.parse(value) : void 0);
110
+ }
111
+ async mset(entries) {
112
+ this.checkConnection();
113
+ if (entries.length === 0) return;
114
+ const pipeline = this.redis.pipeline();
115
+ for (const [key, value] of entries) {
116
+ pipeline.set(key, JSON.stringify(value));
117
+ }
118
+ await pipeline.exec();
119
+ }
120
+ async exists(key) {
121
+ this.checkConnection();
122
+ const result = await this.redis.exists(key);
123
+ return result === 1;
124
+ }
125
+ async expire(key, ttlSeconds) {
126
+ this.checkConnection();
127
+ await this.redis.expire(key, ttlSeconds);
128
+ }
129
+ // Cache-specific operations
130
+ async increment(key, by = 1) {
131
+ this.checkConnection();
132
+ return await this.redis.incrby(key, by);
133
+ }
134
+ async decrement(key, by = 1) {
135
+ this.checkConnection();
136
+ return await this.redis.decrby(key, by);
137
+ }
138
+ // List operations (for compatibility with DatabaseBackend patterns)
139
+ async append(key, item) {
140
+ this.checkConnection();
141
+ await this.redis.rpush(key, JSON.stringify(item));
142
+ }
143
+ async getRange(key, start, count) {
144
+ this.checkConnection();
145
+ const items = await this.redis.lrange(key, start, start + count - 1);
146
+ return items.map((item) => JSON.parse(item));
147
+ }
148
+ async list(prefix) {
149
+ this.checkConnection();
150
+ return await this.redis.keys(`${prefix}*`);
151
+ }
152
+ checkConnection() {
153
+ if (!this.connected || !this.redis || this.redis.status !== "ready") {
154
+ throw StorageError.notConnected("RedisBackend");
155
+ }
156
+ }
157
+ // Maintenance operations
158
+ async flushdb() {
159
+ this.checkConnection();
160
+ await this.redis.flushdb();
161
+ }
162
+ async info() {
163
+ this.checkConnection();
164
+ return await this.redis.info();
165
+ }
166
+ };
167
+ export {
168
+ RedisBackend
169
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ LocalAgentRegistry,
3
+ getAgentRegistry
4
+ } from "./chunk-FCJVTIBV.js";
5
+ import "./chunk-J6AXCN3H.js";
6
+ import "./chunk-PI6XFMEW.js";
7
+ import "./chunk-XFQLRBHE.js";
8
+ import "./chunk-D62MHQBE.js";
9
+ import "./chunk-TPERKLLN.js";
10
+ import "./chunk-MVKLS3LM.js";
11
+ export {
12
+ LocalAgentRegistry,
13
+ getAgentRegistry
14
+ };
@@ -0,0 +1,248 @@
1
+ import {
2
+ StorageError
3
+ } from "./chunk-F2QFAECT.js";
4
+ import {
5
+ getDextoPath,
6
+ logger
7
+ } from "./chunk-D62MHQBE.js";
8
+ import "./chunk-TPERKLLN.js";
9
+ import {
10
+ init_esm_shims
11
+ } from "./chunk-MVKLS3LM.js";
12
+
13
+ // src/storage/backend/sqlite-backend.ts
14
+ init_esm_shims();
15
+ import { dirname } from "path";
16
+ import { mkdirSync } from "fs";
17
+ import * as path from "path";
18
+ var Database;
19
+ var SQLiteBackend = class {
20
+ db;
21
+ // Database.Database
22
+ dbPath;
23
+ config;
24
+ constructor(config) {
25
+ this.config = config;
26
+ this.dbPath = "";
27
+ }
28
+ resolveDefaultPath(dbName) {
29
+ const storageDir = getDextoPath("database");
30
+ const finalPath = path.join(storageDir, dbName);
31
+ logger.info(`SQLite storage directory: ${storageDir}`);
32
+ logger.debug(`SQLite database file: ${finalPath}`);
33
+ return finalPath;
34
+ }
35
+ initializeTables() {
36
+ logger.debug("SQLite initializing database schema...");
37
+ try {
38
+ this.db.exec(`
39
+ CREATE TABLE IF NOT EXISTS kv_store (
40
+ key TEXT PRIMARY KEY,
41
+ value TEXT NOT NULL,
42
+ created_at INTEGER DEFAULT (strftime('%s', 'now')),
43
+ updated_at INTEGER DEFAULT (strftime('%s', 'now'))
44
+ )
45
+ `);
46
+ this.db.exec(`
47
+ CREATE TABLE IF NOT EXISTS list_store (
48
+ key TEXT NOT NULL,
49
+ value TEXT NOT NULL,
50
+ sequence INTEGER,
51
+ created_at INTEGER DEFAULT (strftime('%s', 'now')),
52
+ PRIMARY KEY (key, sequence)
53
+ )
54
+ `);
55
+ this.db.exec(`
56
+ CREATE INDEX IF NOT EXISTS idx_kv_store_key ON kv_store(key);
57
+ CREATE INDEX IF NOT EXISTS idx_list_store_key ON list_store(key);
58
+ CREATE INDEX IF NOT EXISTS idx_list_store_sequence ON list_store(key, sequence);
59
+ `);
60
+ logger.debug(
61
+ "SQLite database schema initialized: kv_store, list_store tables with indexes"
62
+ );
63
+ } catch (error) {
64
+ throw StorageError.migrationFailed(
65
+ error instanceof Error ? error.message : String(error),
66
+ {
67
+ operation: "table_initialization",
68
+ backend: "sqlite"
69
+ }
70
+ );
71
+ }
72
+ }
73
+ async connect() {
74
+ if (!Database) {
75
+ try {
76
+ const module = await import("better-sqlite3");
77
+ Database = module.default || module;
78
+ } catch (error) {
79
+ throw StorageError.connectionFailed(
80
+ `Failed to import better-sqlite3: ${error instanceof Error ? error.message : String(error)}`
81
+ );
82
+ }
83
+ }
84
+ if (this.config.path) {
85
+ this.dbPath = this.config.path;
86
+ logger.info(`SQLite using custom path: ${this.dbPath}`);
87
+ } else {
88
+ this.dbPath = this.resolveDefaultPath(this.config.database || "dexto.db");
89
+ }
90
+ const dir = dirname(this.dbPath);
91
+ logger.debug(`SQLite ensuring directory exists: ${dir}`);
92
+ try {
93
+ mkdirSync(dir, { recursive: true });
94
+ } catch (error) {
95
+ logger.debug(`Directory creation result: ${error ? "exists" : "created"}`);
96
+ }
97
+ const sqliteOptions = this.config.options || {};
98
+ logger.debug(`SQLite initializing database with config:`, {
99
+ readonly: sqliteOptions.readonly || false,
100
+ fileMustExist: sqliteOptions.fileMustExist || false,
101
+ timeout: sqliteOptions.timeout || 5e3
102
+ });
103
+ this.db = new Database(this.dbPath, {
104
+ readonly: sqliteOptions.readonly || false,
105
+ fileMustExist: sqliteOptions.fileMustExist || false,
106
+ timeout: sqliteOptions.timeout || 5e3,
107
+ verbose: sqliteOptions.verbose ? (message, ...additionalArgs) => {
108
+ logger.debug(
109
+ typeof message === "string" || typeof message === "object" && message !== null ? message : String(message),
110
+ ...additionalArgs
111
+ );
112
+ } : void 0
113
+ });
114
+ this.db.pragma("journal_mode = WAL");
115
+ logger.debug("SQLite enabled WAL mode for better concurrency");
116
+ this.initializeTables();
117
+ logger.info(`\u2705 SQLite backend successfully connected to: ${this.dbPath}`);
118
+ }
119
+ async disconnect() {
120
+ if (this.db) {
121
+ this.db.close();
122
+ }
123
+ }
124
+ isConnected() {
125
+ return this.db !== null;
126
+ }
127
+ getBackendType() {
128
+ return "sqlite";
129
+ }
130
+ // Core operations
131
+ async get(key) {
132
+ this.checkConnection();
133
+ try {
134
+ const row = this.db.prepare("SELECT value FROM kv_store WHERE key = ?").get(key);
135
+ return row ? JSON.parse(row.value) : void 0;
136
+ } catch (error) {
137
+ throw StorageError.readFailed(
138
+ "get",
139
+ error instanceof Error ? error.message : String(error),
140
+ { key }
141
+ );
142
+ }
143
+ }
144
+ async set(key, value) {
145
+ this.checkConnection();
146
+ try {
147
+ const serialized = JSON.stringify(value);
148
+ this.db.prepare(
149
+ "INSERT OR REPLACE INTO kv_store (key, value, updated_at) VALUES (?, ?, ?)"
150
+ ).run(key, serialized, Date.now());
151
+ } catch (error) {
152
+ throw StorageError.writeFailed(
153
+ "set",
154
+ error instanceof Error ? error.message : String(error),
155
+ { key }
156
+ );
157
+ }
158
+ }
159
+ async delete(key) {
160
+ this.checkConnection();
161
+ try {
162
+ this.db.prepare("DELETE FROM kv_store WHERE key = ?").run(key);
163
+ this.db.prepare("DELETE FROM list_store WHERE key = ?").run(key);
164
+ } catch (error) {
165
+ throw StorageError.deleteFailed(
166
+ "delete",
167
+ error instanceof Error ? error.message : String(error),
168
+ { key }
169
+ );
170
+ }
171
+ }
172
+ // List operations
173
+ async list(prefix) {
174
+ this.checkConnection();
175
+ try {
176
+ const kvKeys = this.db.prepare("SELECT key FROM kv_store WHERE key LIKE ?").all(`${prefix}%`);
177
+ const listKeys = this.db.prepare("SELECT DISTINCT key FROM list_store WHERE key LIKE ?").all(`${prefix}%`);
178
+ const allKeys = /* @__PURE__ */ new Set([
179
+ ...kvKeys.map((row) => row.key),
180
+ ...listKeys.map((row) => row.key)
181
+ ]);
182
+ return Array.from(allKeys).sort();
183
+ } catch (error) {
184
+ throw StorageError.readFailed(
185
+ "list",
186
+ error instanceof Error ? error.message : String(error),
187
+ { prefix }
188
+ );
189
+ }
190
+ }
191
+ async append(key, item) {
192
+ this.checkConnection();
193
+ try {
194
+ const serialized = JSON.stringify(item);
195
+ this.db.prepare(
196
+ "INSERT INTO list_store (key, value, sequence) VALUES (?, ?, (SELECT COALESCE(MAX(sequence), 0) + 1 FROM list_store WHERE key = ?))"
197
+ ).run(key, serialized, key);
198
+ } catch (error) {
199
+ throw StorageError.writeFailed(
200
+ "append",
201
+ error instanceof Error ? error.message : String(error),
202
+ { key }
203
+ );
204
+ }
205
+ }
206
+ async getRange(key, start, count) {
207
+ this.checkConnection();
208
+ try {
209
+ const rows = this.db.prepare(
210
+ "SELECT value FROM list_store WHERE key = ? ORDER BY sequence ASC LIMIT ? OFFSET ?"
211
+ ).all(key, count, start);
212
+ return rows.map((row) => JSON.parse(row.value));
213
+ } catch (error) {
214
+ throw StorageError.readFailed(
215
+ "getRange",
216
+ error instanceof Error ? error.message : String(error),
217
+ { key, start, count }
218
+ );
219
+ }
220
+ }
221
+ // Schema management
222
+ checkConnection() {
223
+ if (!this.db) {
224
+ throw StorageError.notConnected("SQLiteBackend");
225
+ }
226
+ }
227
+ // Maintenance operations
228
+ async vacuum() {
229
+ this.checkConnection();
230
+ this.db.exec("VACUUM");
231
+ }
232
+ async getStats() {
233
+ this.checkConnection();
234
+ const kvCount = this.db.prepare("SELECT COUNT(*) as count FROM kv_store").get();
235
+ const listCount = this.db.prepare("SELECT COUNT(*) as count FROM list_store").get();
236
+ const dbSize = this.db.prepare(
237
+ "SELECT page_count * page_size as size FROM pragma_page_count(), pragma_page_size()"
238
+ ).get();
239
+ return {
240
+ kvCount: kvCount.count,
241
+ listCount: listCount.count,
242
+ dbSize: dbSize.size
243
+ };
244
+ }
245
+ };
246
+ export {
247
+ SQLiteBackend
248
+ };