import { Message } from '@node-ts/bus-messages' ; import { LoggerFactory } from '../logger' ; import { ClassConstructor } from '../util' ; import { Handler , HandlerDefinition , MessageBase } from './handler' ; interface RegisteredHandlers { messageType : ClassConstructor < MessageBase > ; handlers : HandlerDefinition [ ] ; } export interface HandlerRegistrations { [ key ] : RegisteredHandlers ; } /**
 * Provide a way for externally managed messages to be handled
 * by the Bus
 */ export interface CustomResolver < MessageType > { /**
     * A resolver function that will be executed for each read message
     * to determine if it's to be handled by the handler declaring this resolver
     */ resolveWith : ( ( message : MessageType ) => boolean ) ; /**
     * If provided, will attempt to subscribe the queue to this topic.
     * If not provided, assumes that the queue will be subscribed to the topic manually.
     */ topicIdentifier ? : string ; } export interface HandlerResolver { handler : HandlerDefinition ; resolver ( message ) : boolean ; messageType : ClassConstructor < MessageBase > | undefined ; topicIdentifier : string | undefined ; } export type MessageName = string ; /**
 * An internal singleton that contains all registrations of messages to functions that handle
 * those messages.
 */ export interface HandlerRegistry { param messageType param handler param customResolver node-ts register < TMessage extends MessageBase > ( messageType , handler ) : void ; registerCustom < TMessage extends MessageBase > ( handler , customResolver ) : void ; param message get < MessageType extends Message > ( loggerFactory , message ) : HandlerDefinition < MessageType > [ ] ; /**
     * Retrieves a list of all messages that have handler registrations
     */ getMessageNames ( ) : string [ ] ; param messageName getMessageConstructor < TMessage extends Message > ( messageName ) : ClassConstructor < TMessage > | undefined ; /**
     * Retrieves an array of all topic arns that are managed externally but require subscribing to as there are
     * custom handlers that handle those messages.
     */ getExternallyManagedTopicIdentifiers ( ) : string [ ] ; /**
     * Gets all registered message handler resolvers
     */ getResolvers ( ) : HandlerResolver [ ] ; /**
     * Gets a list of all class based handlers that have been registered
     */ getClassHandlers ( ) : Handler [ ] ; /**
     * Removes all handlers from the registry
     */ reset ( ) : void ; }