UNPKG

unleash-server

Version:

Unleash is an enterprise ready feature flag service. It provides different strategies for handling feature flags.

42 lines 1.23 kB
export default class FakeSessionStore { constructor() { this.sessions = []; } async getActiveSessions() { return this.sessions.filter((session) => session.expired != null); } destroy() { } async exists(key) { return this.sessions.some((s) => s.sid === key); } async getAll() { return this.sessions; } async getSessionsForUser(userId) { return this.sessions.filter((session) => session.sess.user.id === userId); } async deleteSessionsForUser(userId) { this.sessions = this.sessions.filter((session) => session.sess.user.id !== userId); } async deleteAll() { this.sessions = []; } async delete(sid) { this.sessions.splice(this.sessions.findIndex((s) => s.sid === sid), 1); } async get(sid) { return Promise.resolve(this.sessions.find((s) => s.sid === sid)); } async insertSession(data) { const session = { ...data, createdAt: new Date() }; this.sessions.push(session); return session; } async getSessionsCount() { return []; } async getMaxSessionsCount() { return 0; } } //# sourceMappingURL=fake-session-store.js.map