export type NewSessionData> = T & { uid: string; role: string; expired_at?: number; }; export type SessionData> = NewSessionData & { sid: string; created_at: number; }; export type SingleSession> = { data: T; track: (arg: { path: string }) => Promise; destroy: () => Promise; }; type FilterSessionArg = { uid: string; sid: string; role: string; created_at: { gt?: number; lt?: number }; expired_at: { gt?: number; lt?: number }; }; export type SessionStore> = { create: ( data: Record & { uid: string; role: string; expired_at?: number; } ) => Promise>; findMany: (arg: Partial) => Promise[]>; findFirst: ( arg: Partial ) => Promise>; }; export const newSessionStore = () => { return { async create(data) { const new_session: SingleSession = { data: { ...data, created_at: Date.now() } as T, async destroy() {}, async track(arg) {}, }; return new_session; }, async findFirst(arg) { return null; }, async findMany(arg) { return []; }, } as SessionStore; };