import { SpriteProfile } from "../types/SpriteProfile"; export class MemorySync { private store: Map = new Map(); async sync(profile: SpriteProfile) { this.store.set(profile.id, profile); } get(id: string): SpriteProfile | undefined { return this.store.get(id); } async clear() { this.store.clear(); } async remove(id: string) { this.store.delete(id); } async getAll(): Promise { return Array.from(this.store.values()); } async has(id: string): Promise { return this.store.has(id); } async getByTrait(traitName: string, traitValue: number): Promise { const results: SpriteProfile[] = []; for (const profile of this.store.values()) { if (profile.traits.some(t => t.name === traitName && t.value === traitValue)) { results.push(profile); } } return results; } async getByName(name: string): Promise { for (const profile of this.store.values()) { if (profile.name === name) { return profile; } } return undefined; } }