Storage implementations for AT Protocol OAuth applications. Provides a simple key-value storage interface with implementations for in-memory and SQLite backends.
1/**
2 * @module atproto-storage
3 *
4 * Storage implementations for AT Protocol OAuth applications.
5 *
6 * Provides a simple storage interface with implementations for:
7 * - In-memory storage (for testing/development)
8 * - SQLite storage (works with any SQLite driver via adapters)
9 *
10 * @example Val.Town / libSQL / Turso
11 * ```typescript
12 * import { sqlite } from "https://esm.town/v/std/sqlite";
13 * import { SQLiteStorage, sqliteAdapter } from "@tijs/atproto-storage";
14 *
15 * const storage = new SQLiteStorage(sqliteAdapter(sqlite));
16 * ```
17 *
18 * @example Deno native SQLite
19 * ```typescript
20 * import { Database } from "jsr:@db/sqlite";
21 * import { SQLiteStorage, denoSqliteAdapter } from "@tijs/atproto-storage";
22 *
23 * const db = new Database("storage.db");
24 * const storage = new SQLiteStorage(denoSqliteAdapter(db));
25 * ```
26 *
27 * @example Testing with MemoryStorage
28 * ```typescript
29 * import { MemoryStorage } from "@tijs/atproto-storage";
30 *
31 * const storage = new MemoryStorage();
32 * ```
33 *
34 * @example Custom SQLite adapter
35 * ```typescript
36 * import { SQLiteStorage, SQLiteAdapter } from "@tijs/atproto-storage";
37 *
38 * const customAdapter: SQLiteAdapter = {
39 * execute: async (sql, params) => myDriver.query(sql, params)
40 * };
41 * const storage = new SQLiteStorage(customAdapter);
42 * ```
43 */
44
45// Types
46export type { Logger, OAuthStorage, SQLiteAdapter } from "./src/types.ts";
47
48// Implementations
49export { MemoryStorage } from "./src/memory.ts";
50export { SQLiteStorage } from "./src/sqlite.ts";
51export type { SQLiteStorageOptions } from "./src/sqlite.ts";
52
53// Adapters
54export {
55 betterSqlite3Adapter,
56 denoSqliteAdapter,
57 sqliteAdapter,
58} from "./src/adapters.ts";
59export type { ExecutableDriver, PrepareDriver } from "./src/adapters.ts";