UNPKG

@castore/event-storage-adapter-redux

Version:

DRY Castore EventStorageAdapter implementation using a Redux store

12 lines 1.04 kB
import { Reducer } from '@reduxjs/toolkit'; import { EventStore, EventStoreEventDetails, EventStoreId } from '@castore/core'; export declare type EventStoreReduxState<EVENT_STORE extends EventStore = EventStore> = { eventsByAggregateId: Record<string, EventStoreEventDetails<EVENT_STORE>[]>; aggregateIds: { aggregateId: string; initialEventTimestamp: string; }[]; }; export declare type EventStoresReduxState<EVENT_STORES extends EventStore[] = EventStore[]> = EventStore[] extends EVENT_STORES ? Record<string, EventStoreReduxState> : EVENT_STORES extends [infer HEAD_EVENT_STORE, ...infer TAIL_EVENT_STORES] ? HEAD_EVENT_STORE extends EventStore ? TAIL_EVENT_STORES extends EventStore[] ? Record<EventStoreId<HEAD_EVENT_STORE>, EventStoreReduxState<HEAD_EVENT_STORE>> & EventStoresReduxState<TAIL_EVENT_STORES> : never : never : unknown; export declare type EventStoreReduxReducer<EVENT_STORE extends EventStore = EventStore> = Reducer<EventStoreReduxState<EVENT_STORE>>; //# sourceMappingURL=types.d.ts.map