import type { CookieSerializeOptions } from "./cookies.js"; export type VextSessionData = Record; export interface VextSessionStore { get(id: string): VextSessionData | null | Promise; set(id: string, data: VextSessionData, ttlSeconds: number): void | Promise; delete(id: string): void | Promise; touch?(id: string, ttlSeconds: number): void | Promise; clearExpired?(): void | Promise; close?(): void | Promise; } export interface VextCacheLike { get(key: string): T | undefined | Promise; set(key: string, value: T, ttlMs?: number): void | Promise; del(key: string): boolean | void | Promise; } export interface VextSessionStoreSerializer { serialize(data: VextSessionData): unknown; deserialize(value: unknown): VextSessionData; } export interface VextCacheSessionStoreOptions { prefix?: string; serializer?: VextSessionStoreSerializer; close?: () => void | Promise; } export interface VextSessionCookieOptions extends Omit { secure?: boolean | "auto"; } export interface VextSessionConfig { enabled?: boolean; name?: string; ttl?: number; rolling?: boolean; autoCommit?: boolean; idLength?: number; cookie?: VextSessionCookieOptions; store?: VextSessionStore; } /** Route-safe Session behavior overrides. Store and cookie identity remain app-wide. */ export interface VextRouteSessionOptions { enabled?: boolean; rolling?: boolean; autoCommit?: boolean; } export interface VextSession { readonly id: string; readonly isNew: boolean; readonly isDestroyed: boolean; save(): Promise; regenerate(): Promise; destroy(): Promise; [key: string]: unknown; }