import { SessionData } from 'express-session';
import { Store } from 'express-session';
import { Surreal } from 'surrealdb';

export declare class SurrealDBStore extends Store {
    private readonly options;
    private db;
    private tableName;
    private lastConnectionAttempt;
    private hasConnected;
    private isConnected;
    constructor(options: SurrealDBStoreOptions);
    /**
     * Perform the initial connection to the database. This also sets the scope of our connection.
     */
    private _connect;
    /**
     * Get session data by session ID
     */
    get(sessionId: string, cb: Function): void;
    /**
     * Set session data for a given session ID
     */
    set(sessionId: string, session: SessionData, cb: Function): void;
    touch(sid: string, session: any, cb: Function): void;
    destroy(sessionId: string, cb: Function): void;
    length(cb: Function): void;
    all(cb: Function): void;
    clear(cb: Function): void;
}

export declare type SurrealDBStoreOptions = {
    /**
     * URL used to connect to SurrealDB
     * e.g. http://127.0.0.1:8000/rpc
     */
    url: string;
    /**
     * Table to use for storing the sessions
     * @default `user_sessions`
     */
    tableName: string;
    /**
     * Options for the initial SurrealDB connection.
     * You should set the namespace and database in this object.
     */
    connectionOpts: Parameters<Surreal['connect']>[1];
    /**
     * Sign-in options
     * @deprecated Use SurrealDBStoreOptions.connectionOpts instead (fixes reconnection issues). This will be removed in a future release.
     */
    signinOpts?: Parameters<Surreal['signin']>[0];
    /**
     * Automatically sweep and remove expired sessions periodically.
     * @default false
     */
    autoSweepExpired?: boolean;
    /**
     * Interval in milliseconds to sweep for expired sessions.
     * @default 600000 (10 minutes)
     */
    autoSweepIntervalMs?: number;
    /**
     * Use options (Select namespace, database)
     * @optional
     * @deprecated Use SurrealDBStoreOptions.connectionOpts instead (fixes reconnection issues). This will be removed in a future release.
     */
    useOpts?: Parameters<Surreal['use']>[0];
    /**
     * Optional surreal db instance override.
     */
    surreal?: Surreal;
    /**
     * Optional logger
     */
    logger?: {
        error?: (any: any) => void;
        info?: (any: any) => void;
        debug?: (any: any) => void;
    };
    /**
     * Custom setter function for storing session data. If provided, this function will be used instead of the default upsert logic.
     */
    customSetter?: (db: Surreal, sessionId: string, session: SessionData) => Promise<any>;
    /**
     * Custom getter function for retrieving session data. If provided, this function will be used instead of the default select logic.
     */
    customGetter?: (db: Surreal, sessionId: string) => Promise<SessionData | null>;
};

export { }
