@queuert/sqlite
createSqliteStateAdapter
Section titled “createSqliteStateAdapter”const stateAdapter = await createSqliteStateAdapter({ stateProvider: SqliteStateProvider, // You implement this tablePrefix?: string, // Table name prefix (default: "queuert_") idType?: string, // SQL type for job IDs (default: "TEXT") idGenerator?: () => string, // ID generator (default: crypto.randomUUID()) checkForeignKeys?: boolean, // Enable PRAGMA foreign_keys (default: true)});Returns Promise<SqliteStateAdapter>.
SqliteStateAdapter
Section titled “SqliteStateAdapter”SqliteStateAdapter — StateAdapter extended with migration support, following the same pattern as PgStateAdapter:
type SqliteStateAdapter = StateAdapter & { migrateToLatest: () => Promise<MigrationResult>;};SqliteStateProvider
Section titled “SqliteStateProvider”SqliteStateProvider — you implement this to bridge your SQLite client. Note the extra returns parameter compared to PgStateProvider:
type SqliteStateProvider<TTxContext> = { runInTransaction: <T>(fn: (txCtx: TTxContext) => Promise<T>) => Promise<T>; executeSql: (options: { txCtx?: TTxContext; sql: string; params?: unknown[]; returns: boolean; // Whether the SQL returns rows }) => Promise<unknown[]>;};sqliteLiteral
Section titled “sqliteLiteral”sqliteLiteral — SQL literal escaping for ORM compatibility:
function sqliteLiteral(value: unknown): string;createAsyncLock / AsyncLock
Section titled “createAsyncLock / AsyncLock”Re-exported from queuert/internal. SQLite requires serialized write access. If your application performs writes outside of Queuert (e.g., in your state provider), use createAsyncLock to coordinate access so that your writes and Queuert’s writes don’t conflict:
import { createAsyncLock } from "@queuert/sqlite";
const lock = createAsyncLock();
// Use the same lock in your state provider and application codeawait lock(async () => { // Serialized database access});MigrationResult
Section titled “MigrationResult”Same type as @queuert/postgres:
type MigrationResult = { applied: string[]; // Migrations applied in this run skipped: string[]; // Already-applied migrations unrecognized: string[]; // Unknown migrations found in the database};See Also
Section titled “See Also”- State Adapters — Integration guide for state adapters
- Adapter Architecture — Design philosophy and context management