From 66f23a17ad08519d3d06386bb1bc90d3366ef8ae Mon Sep 17 00:00:00 2001 From: Alexandre Decollas Date: Mon, 14 Feb 2022 11:27:35 +0100 Subject: [PATCH] fix type and bump v5.0.19 --- package.json | 2 +- .../config/read-event-bus-config.type.ts | 22 ++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 2a910a0..6bbdc02 100644 --- a/package.json +++ b/package.json @@ -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 ", "contributors": [ diff --git a/src/interfaces/config/read-event-bus-config.type.ts b/src/interfaces/config/read-event-bus-config.type.ts index 300b6b2..de76f98 100644 --- a/src/interfaces/config/read-event-bus-config.type.ts +++ b/src/interfaces/config/read-event-bus-config.type.ts @@ -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 = new ( + ...args: any[] +) => T; + export type ReadEventBusConfigType = - IEventBusPrepublishConfig & { - eventMapper?: EventMapperType; - allowedEvents?: { [key: string]: IBaseEvent }; - }; + IEventBusPrepublishConfig & + ( + | { + eventMapper: EventMapperType; + allowedEvents?: never; + } + | { + eventMapper?: never; + allowedEvents: { [key: string]: EventConstructorType }; + } + );