refactor(core): Standardize filename casing for environments and eventbus (no-changelog) (#10527)

This commit is contained in:
Iván Ovejero
2024-08-26 11:10:06 +02:00
committed by GitHub
parent 9d156d3703
commit 96e69ad5f2
87 changed files with 207 additions and 206 deletions

View File

@@ -0,0 +1,29 @@
import { MessageEventBusDestinationTypeNames } from 'n8n-workflow';
import type { EventDestinations } from '@db/entities/EventDestinations';
import type { MessageEventBus } from '../message-event-bus/message-event-bus';
import type { MessageEventBusDestination } from './message-event-bus-destination.ee';
import { MessageEventBusDestinationSentry } from './message-event-bus-destination-sentry.ee';
import { MessageEventBusDestinationSyslog } from './message-event-bus-destination-syslog.ee';
import { MessageEventBusDestinationWebhook } from './message-event-bus-destination-webhook.ee';
import { Container } from 'typedi';
import { Logger } from '@/logger';
export function messageEventBusDestinationFromDb(
eventBusInstance: MessageEventBus,
dbData: EventDestinations,
): MessageEventBusDestination | null {
const destinationData = dbData.destination;
if ('__type' in destinationData) {
switch (destinationData.__type) {
case MessageEventBusDestinationTypeNames.sentry:
return MessageEventBusDestinationSentry.deserialize(eventBusInstance, destinationData);
case MessageEventBusDestinationTypeNames.syslog:
return MessageEventBusDestinationSyslog.deserialize(eventBusInstance, destinationData);
case MessageEventBusDestinationTypeNames.webhook:
return MessageEventBusDestinationWebhook.deserialize(eventBusInstance, destinationData);
default:
Container.get(Logger).debug('MessageEventBusDestination __type unknown');
}
}
return null;
}