@message-queue-toolkit/core
Version:
Useful utilities, interfaces and base classes for message queue handling. Supports AMQP and SQS with a common abstraction on top currently
21 lines • 822 B
JavaScript
export class EventRegistry {
supportedEvents;
supportedEventTypes;
supportedEventMap = {};
constructor(supportedEvents) {
this.supportedEvents = supportedEvents;
this.supportedEventTypes = new Set();
for (const supportedEvent of supportedEvents) {
this.supportedEventMap[supportedEvent.consumerSchema.shape.type.value] = supportedEvent;
this.supportedEventTypes.add(supportedEvent.consumerSchema.shape.type.value);
}
}
getEventDefinitionByTypeName = (eventTypeName) => {
// biome-ignore lint/style/noNonNullAssertion: It's ok
return this.supportedEventMap[eventTypeName];
};
isSupportedEvent(eventTypeName) {
return this.supportedEventTypes.has(eventTypeName);
}
}
//# sourceMappingURL=EventRegistry.js.map