import { injectable , interfaces } from 'inversify' ; import { Id } from '@centsideas/types' ; import { SnapshotStore } from './snapshot-store' ; import { PersistedSnapshot } from './snapshot' ; @ injectable ( ) export class InMemorySnapshotStore implements SnapshotStore { private snapshots : Record < string , PersistedSnapshot > = { } ; async store ( snapshot ) { this . snapshots [ snapshot . aggregateId . toString ( ) ] = snapshot ; } async get ( id ) { return this . snapshots [ id . toString ( ) ] ; } } export const inMemorySnapshotStoreFactory = ( context ) => ( ) => context . container . get ( InMemorySnapshotStore ) ;