import { randomUUID } from "node:crypto";
export function defaultSessionIdGenerator() {
    return randomUUID();
}
export function createSessionStore() {
    const sessions = new Map();
    return {
        create(id) {
            const session = {
                id,
                initialized: false,
                createdAt: new Date(),
                lastSeenAt: new Date(),
            };
            sessions.set(id, session);
            return session;
        },
        get(id) {
            return sessions.get(id);
        },
        delete(id) {
            return sessions.delete(id);
        },
        has(id) {
            return sessions.has(id);
        },
        touch(id) {
            const session = sessions.get(id);
            if (session !== undefined) {
                session.lastSeenAt = new Date();
            }
        },
        entries() {
            return sessions.values();
        },
    };
}
