import { Store } from "@/Protocols/StoreProtocol" ; /**
 * This store is a in-memory async map data structure.
 * So, the data here is not supposed to be persisted.
 */ class AsyncMapStoreService < Model > implements Store < Model > { private store : Map < string , Model > = new Map ( ) ; async set ( id , data ) { this . store . set ( id , data ) ; } async delete ( id ) { this . store . delete ( id ) ; } async getOne ( id ) { const model = this . store . get ( id ) ; return model ; } async getAll ( ) { const models = Array . from ( this . store , ( [ , value ] ) => value ) ; return models ; } async getKeys ( ) { const keys = Array . from ( this . store , ( [ key ] ) => key ) ; return keys ; } set storeData ( storeData ) { this . store = storeData ; } } export default AsyncMapStoreService ;