import {Session} from '@shopify/shopify-api'; import {SessionStorage} from '@shopify/shopify-app-session-storage'; export class MemorySessionStorage implements SessionStorage { private sessions: Record = {}; public async storeSession(session: Session): Promise { this.sessions[session.id] = session; return true; } public async loadSession(id: string): Promise { return this.sessions[id] || undefined; } public async deleteSession(id: string): Promise { if (this.sessions[id]) { delete this.sessions[id]; } return true; } public async deleteSessions(ids: string[]): Promise { ids.forEach((id) => delete this.sessions[id]); return true; } public async findSessionsByShop(shop: string): Promise { const results = Object.values(this.sessions).filter( (session) => session.shop === shop, ); return results; } }