export interface NewSessionData { uid: string; role: string; data?: T; expired_at?: number; } export interface SessionData extends NewSessionData { sid: string; active: boolean; created_at: number; } export interface SingleSession extends SessionData { track: (arg: { path: string }) => void; destroy: () => boolean; } type FilterSessionArg = { uid: string; sid: string; role: string; active: boolean; created_at: { gt?: number; lt?: number }; expired_at: { gt?: number; lt?: number }; }; export type SessionStore = { create: (arg: { uid: string; role: string; data?: T; expired_at?: number; }) => SingleSession; findMany: (arg?: Partial) => SingleSession[]; findFirst: (arg?: Partial) => null | SingleSession; }; export type ServerSession = SessionStore & { current?: SingleSession; }; export type ClientSessionStatus = "checking" | "guest" | "expired" | "active"; export type ClientSession = { status: ClientSessionStatus; current: null | SessionData; recheck(): Promise<{ status: ClientSessionStatus }>; login(arg: { method: "user-pass"; username: string; password: string; }): Promise; logout(): Promise; };