Skip to content

Commit

Permalink
feat: added interface type to new payload event
Browse files Browse the repository at this point in the history
  • Loading branch information
firmbase-tal committed Nov 18, 2024
1 parent b1ca29d commit b47a908
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/event-subscribers.loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { EventEmitter2 } from 'eventemitter2';
import { EventEmitterReadinessWatcher } from './event-emitter-readiness.watcher';
import { EventsMetadataAccessor } from './events-metadata.accessor';
import { OnEventOptions } from './interfaces';
import { EventRequestObject } from './interfaces/event-request-object.interface';

@Injectable()
export class EventSubscribersLoader
Expand Down Expand Up @@ -138,7 +139,9 @@ export class EventSubscribersLoader
event,
async (...args: unknown[]) => {
const request = this.getRequestFromEventPayload(args);
const contextId = ContextIdFactory.getByRequest({ payload: request });
const contextId = ContextIdFactory.getByRequest<
EventRequestObject<unknown>
>({ payload: request });

this.moduleRef.registerRequestByContextId(request, contextId);

Expand Down
3 changes: 3 additions & 0 deletions lib/interfaces/event-request-object.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type EventRequestObject<T> = {
payload: T;
};

0 comments on commit b47a908

Please sign in to comment.