This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

refactor: implement singleton pattern for in-memory stores

Co-authored-by: aider (anthropic/claude-sonnet-4-20250514) <aider@aider.chat>

+20
+10
src/modules/user/tests/infrastructure/InMemorySessionStore.ts
··· 7 7 * In-memory implementation of NodeSavedSessionStore for testing 8 8 */ 9 9 export class InMemorySessionStore implements NodeSavedSessionStore { 10 + private static instance: InMemorySessionStore; 10 11 private sessions: Map<string, NodeSavedSession> = new Map(); 12 + 13 + private constructor() {} 14 + 15 + public static getInstance(): InMemorySessionStore { 16 + if (!InMemorySessionStore.instance) { 17 + InMemorySessionStore.instance = new InMemorySessionStore(); 18 + } 19 + return InMemorySessionStore.instance; 20 + } 11 21 12 22 async get(key: string): Promise<NodeSavedSession | undefined> { 13 23 return this.sessions.get(key);
+10
src/modules/user/tests/infrastructure/InMemoryStateStore.ts
··· 7 7 * In-memory implementation of NodeSavedStateStore for testing 8 8 */ 9 9 export class InMemoryStateStore implements NodeSavedStateStore { 10 + private static instance: InMemoryStateStore; 10 11 private states: Map<string, NodeSavedState> = new Map(); 12 + 13 + private constructor() {} 14 + 15 + public static getInstance(): InMemoryStateStore { 16 + if (!InMemoryStateStore.instance) { 17 + InMemoryStateStore.instance = new InMemoryStateStore(); 18 + } 19 + return InMemoryStateStore.instance; 20 + } 11 21 12 22 async get(key: string): Promise<NodeSavedState | undefined> { 13 23 return this.states.get(key);