Skip to content

Commit

Permalink
fix type and bump v5.0.19
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreDecollas committed Feb 14, 2022
1 parent 82fbd66 commit 66f23a1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nestjs-geteventstore",
"version": "5.0.18",
"version": "5.0.19",
"description": "Event Store connector for NestJS-Cqrs",
"author": "Vincent Vermersch <vincent.vermersch@prestashop.com >",
"contributors": [
Expand Down
22 changes: 17 additions & 5 deletions src/interfaces/config/read-event-bus-config.type.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import { ReadEventOptionsType, IReadEvent, IBaseEvent } from '../events';
import { ReadEventOptionsType, IReadEvent } from '../events';
import { IEventBusPrepublishConfig } from './event-bus-prepublish-config.interface';
import { EventStoreEvent } from '../../event-store';

type EventMapperType = (
data: any,
options: ReadEventOptionsType,
) => IReadEvent | null;

type EventConstructorType<T extends EventStoreEvent> = new (
...args: any[]
) => T;

export type ReadEventBusConfigType<T extends IReadEvent = IReadEvent> =
IEventBusPrepublishConfig<T> & {
eventMapper?: EventMapperType;
allowedEvents?: { [key: string]: IBaseEvent };
};
IEventBusPrepublishConfig<T> &
(
| {
eventMapper: EventMapperType;
allowedEvents?: never;
}
| {
eventMapper?: never;
allowedEvents: { [key: string]: EventConstructorType<any> };
}
);

0 comments on commit 66f23a1

Please sign in to comment.