import type { SessionStore } from '../contracts/SessionStore.js'; /** * Mutable HTTP session bound to a {@link SessionStore}. */ export declare class Session { private readonly store; private readonly logicalName; private idValue; private startedFlag; private meta; /** * @param store - Persistence backend. * @param name - Logical session name (cookie segment / driver hint). */ constructor(store: SessionStore, name: string); /** * @returns Opaque session identifier. */ getId(): string; /** * @param id - New session identifier (used after regeneration). */ setId(id: string): void; /** * @returns Logical session name provided at construction. */ getName(): string; /** * Loads session data from the store. * * @returns False when the session is new / empty. */ start(): Promise; /** * Persists the current session payload. */ save(): Promise; /** * Rotates the session id; optionally destroys the previous row. * * @param destroy - When true, delete the old id from the store. * @returns True when migration succeeded. */ migrate(destroy?: boolean): Promise; /** * Clears session data and rotates the identifier. */ invalidate(): Promise; /** * @returns True after {@link Session.start} completes. */ isStarted(): boolean; /** * @returns Copy of user attributes (excludes internal meta envelope when stored inline). */ all(): Record; /** * @param key - Attribute key. */ has(key: string): boolean; /** * @param key - Attribute key. */ exists(key: string): boolean; /** * @param key - Attribute key. */ missing(key: string): boolean; /** * @param key - Attribute key. * @param fallback - Value when missing. * @returns Stored value or fallback. */ get(key: string, fallback?: T): T; /** * @param key - Attribute key. * @param value - Serializable value. */ put(key: string, value: unknown): void; /** * Appends to an array attribute (creates the array when missing). * * @param key - Attribute key. * @param value - Value to append. */ push(key: string, value: unknown): void; /** * @param key - Attribute key. * @param fallback - Fallback when missing. * @returns Removed value or fallback. */ pull(key: string, fallback?: T): T; /** * @param key - Attribute key or list of keys. */ forget(key: string | string[]): void; /** * Clears user attributes and flash buckets (keeps structural defaults). */ flush(): void; /** * @param key - Numeric attribute key. * @param amount - Delta (default 1). * @returns New value. */ increment(key: string, amount?: number): number; /** * @param key - Numeric attribute key. * @param amount - Delta (default 1). * @returns New value. */ decrement(key: string, amount?: number): number; /** * Flash data for the next request. * * @param key - Flash key. * @param value - Serializable value. */ flash(key: string, value: unknown): void; /** * Flash data for the current request only. * * @param key - Flash key. * @param value - Serializable value. */ now(key: string, value: unknown): void; /** * Keeps all flash data for an additional request. */ reflash(): void; /** * Keeps only the provided flash keys for another request. * * @param keys - Keys to persist into the next flash bag. */ keep(keys: string | string[]): void; /** * @returns CSRF token (creates one when missing). */ token(): string; /** * Rotates the CSRF token value. */ regenerateToken(): void; /** * @returns Previously stored intended URL, if any. */ previousUrl(): string | null; /** * @param url - URL to remember for redirects. */ setPreviousUrl(url: string): void; /** * Ages flash data at the beginning of a request (moves `flashNext` from the last response into `flashNow`). */ ageFlashData(): void; } //# sourceMappingURL=Session.d.ts.map