/** * @module session * @added v0.2.12 */ import { IHttpContext } from "../http/context.js"; import { ISessionDriver } from "./contract.js"; export declare class Session { readonly driver: ISessionDriver; protected data: any; protected flashData: any; _id: string | undefined; opened: boolean; constructor(driver: ISessionDriver); protected reset(): void; init(id?: string): Promise; flush(): Promise; close(): Promise; shouldBeOpened(): void; get id(): string; has(key: string): boolean; get(key: string): any; set(key: string, value: any): void; put(key: string, value: any): void; pull(key: string): any; flash(key: string, value: any): void; } export interface ISessionMiddlewareOpts { /** * @default {SessionFileDriver} */ driver?: ISessionDriver; /** * @default {"sess"} */ cookie?: string; } export declare class SessionMiddleware { opts: ISessionMiddlewareOpts; constructor(opts?: ISessionMiddlewareOpts); static middleware(opts?: ISessionMiddlewareOpts): (ctx: IHttpContext, next: any, valueKey?: string) => Promise; /** * * @param ctx * @param next * @returns {Promise} */ handle(ctx: IHttpContext, next: any, valueKey?: string): Promise; }