UNPKG

bun-sqlite-session-store

Version:

A bun:sqlite session store to be used with express-session

37 lines (36 loc) 1.2 kB
import { Store, SessionData as ExpressSessionData } from 'express-session'; import { Database } from 'bun:sqlite'; interface Cookie { originalMaxAge: number | null; maxAge?: number; signed?: boolean; expires?: Date | null; httpOnly?: boolean; path?: string; domain?: string; secure?: boolean | 'auto'; sameSite?: boolean | 'lax' | 'strict' | 'none'; } interface SessionData extends ExpressSessionData { cookie: Cookie; [key: string]: any; } interface StoreOptions { db: Database; ttl?: number; [key: string]: any; } export declare class SQLiteStore extends Store { private db; private ttl; constructor(options?: StoreOptions); private initializeDb; get(sid: string, callback: (err: any, session?: SessionData | null) => void): void; set(sid: string, session: SessionData, callback: (err?: any) => void): void; destroy(sid: string, callback: (err?: any) => void): void; clear(callback: (err?: any) => void): void; length(callback: (err?: any, length?: number) => void): void; touch(sid: string, session: SessionData, callback: (err?: any) => void): void; prune(): void; } export default SQLiteStore;