@@ -11,8 +11,8 @@ import {EventExclusionsTable, EventsTable} from './events-table';
1111import { eventsFromRows } from './events-from-rows' ;
1212import { Client } from '@libsql/client' ;
1313import { StatusCodes } from 'http-status-codes' ;
14- import { DomainEvent } from '../../types' ;
15- import { EventName , EventOfType } from '../../types/domain-event' ;
14+ import { StoredDomainEvent , StoredEventOfType } from '../../types' ;
15+ import { EventName } from '../../types/domain-event' ;
1616import { dbExecute } from '../../util' ;
1717import { exclusionEventsFromRows } from './exclusion-events-from-rows' ;
1818
@@ -87,8 +87,11 @@ export const getAllEventsByType =
8787 // This assumes that the DB has only returned events of the correct type.
8888 // This assumption avoids the need to do extra validation.
8989 // TODO - Pass codec to validate straight to eventsFromRows and get best of both.
90- TE . map < ReadonlyArray < DomainEvent > , ReadonlyArray < EventOfType < T > > > (
91- es => es as ReadonlyArray < EventOfType < T > >
90+ TE . map <
91+ ReadonlyArray < StoredDomainEvent > ,
92+ ReadonlyArray < StoredEventOfType < T > >
93+ > (
94+ es => es as ReadonlyArray < StoredEventOfType < T > >
9295 )
9396 ) ;
9497
@@ -130,9 +133,12 @@ export const getAllEventsByTypes =
130133 // This assumption avoids the need to do extra validation.
131134 // TODO - Pass codec to validate straight to eventsFromRows and get best of both.
132135 TE . map <
133- ReadonlyArray < DomainEvent > ,
134- ReadonlyArray < EventOfType < T > | EventOfType < R > >
135- > ( es => es as ReadonlyArray < EventOfType < T > | EventOfType < R > > )
136+ ReadonlyArray < StoredDomainEvent > ,
137+ ReadonlyArray < StoredEventOfType < T > | StoredEventOfType < R > >
138+ > (
139+ es =>
140+ es as ReadonlyArray < StoredEventOfType < T > | StoredEventOfType < R > >
141+ )
136142 ) ;
137143
138144export const getAllExclusionEvents = ( dbClient : Client ) : Dependencies [ 'getAllExclusionEvents' ] =>
@@ -161,5 +167,5 @@ export const getAllExclusionEvents = (dbClient: Client): Dependencies['getAllExc
161167 )
162168 ) ,
163169 TE . map ( table => table . rows ) ,
164- TE . map ( exclusionEventsFromRows )
170+ TE . chainEitherK ( exclusionEventsFromRows )
165171 ) ;
0 commit comments