Team Ai
Apppublic

oex2003/evolution-api

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
server.module.ts142 linesDownload Raw Back to api
1import { CacheEngine } from '@cache/cacheengine';2import { Chatwoot, configService, ProviderSession } from '@config/env.config';3import { eventEmitter } from '@config/event.config';4import { Logger } from '@config/logger.config';5 6import { BusinessController } from './controllers/business.controller';7import { CallController } from './controllers/call.controller';8import { ChatController } from './controllers/chat.controller';9import { GroupController } from './controllers/group.controller';10import { InstanceController } from './controllers/instance.controller';11import { LabelController } from './controllers/label.controller';12import { ProxyController } from './controllers/proxy.controller';13import { SendMessageController } from './controllers/sendMessage.controller';14import { SettingsController } from './controllers/settings.controller';15import { TemplateController } from './controllers/template.controller';16import { ChannelController } from './integrations/channel/channel.controller';17import { EvolutionController } from './integrations/channel/evolution/evolution.controller';18import { MetaController } from './integrations/channel/meta/meta.controller';19import { BaileysController } from './integrations/channel/whatsapp/baileys.controller';20import { ChatbotController } from './integrations/chatbot/chatbot.controller';21import { ChatwootController } from './integrations/chatbot/chatwoot/controllers/chatwoot.controller';22import { ChatwootService } from './integrations/chatbot/chatwoot/services/chatwoot.service';23import { DifyController } from './integrations/chatbot/dify/controllers/dify.controller';24import { DifyService } from './integrations/chatbot/dify/services/dify.service';25import { EvoaiController } from './integrations/chatbot/evoai/controllers/evoai.controller';26import { EvoaiService } from './integrations/chatbot/evoai/services/evoai.service';27import { EvolutionBotController } from './integrations/chatbot/evolutionBot/controllers/evolutionBot.controller';28import { EvolutionBotService } from './integrations/chatbot/evolutionBot/services/evolutionBot.service';29import { FlowiseController } from './integrations/chatbot/flowise/controllers/flowise.controller';30import { FlowiseService } from './integrations/chatbot/flowise/services/flowise.service';31import { N8nController } from './integrations/chatbot/n8n/controllers/n8n.controller';32import { N8nService } from './integrations/chatbot/n8n/services/n8n.service';33import { OpenaiController } from './integrations/chatbot/openai/controllers/openai.controller';34import { OpenaiService } from './integrations/chatbot/openai/services/openai.service';35import { TypebotController } from './integrations/chatbot/typebot/controllers/typebot.controller';36import { TypebotService } from './integrations/chatbot/typebot/services/typebot.service';37import { EventManager } from './integrations/event/event.manager';38import { S3Controller } from './integrations/storage/s3/controllers/s3.controller';39import { S3Service } from './integrations/storage/s3/services/s3.service';40import { ProviderFiles } from './provider/sessions';41import { PrismaRepository } from './repository/repository.service';42import { CacheService } from './services/cache.service';43import { WAMonitoringService } from './services/monitor.service';44import { ProxyService } from './services/proxy.service';45import { SettingsService } from './services/settings.service';46import { TemplateService } from './services/template.service';47 48const logger = new Logger('WA MODULE');49 50let chatwootCache: CacheService = null;51if (configService.get<Chatwoot>('CHATWOOT').ENABLED) {52  chatwootCache = new CacheService(new CacheEngine(configService, ChatwootService.name).getEngine());53}54 55export const cache = new CacheService(new CacheEngine(configService, 'instance').getEngine());56const baileysCache = new CacheService(new CacheEngine(configService, 'baileys').getEngine());57 58let providerFiles: ProviderFiles = null;59if (configService.get<ProviderSession>('PROVIDER').ENABLED) {60  providerFiles = new ProviderFiles(configService);61}62 63export const prismaRepository = new PrismaRepository(configService);64 65export const waMonitor = new WAMonitoringService(66  eventEmitter,67  configService,68  prismaRepository,69  providerFiles,70  cache,71  chatwootCache,72  baileysCache,73);74 75const s3Service = new S3Service(prismaRepository);76export const s3Controller = new S3Controller(s3Service);77 78const templateService = new TemplateService(waMonitor, prismaRepository, configService);79export const templateController = new TemplateController(templateService);80 81const proxyService = new ProxyService(waMonitor);82export const proxyController = new ProxyController(proxyService, waMonitor);83 84const chatwootService = new ChatwootService(waMonitor, configService, prismaRepository, chatwootCache);85export const chatwootController = new ChatwootController(chatwootService, configService, prismaRepository);86 87const settingsService = new SettingsService(waMonitor);88export const settingsController = new SettingsController(settingsService);89 90export const instanceController = new InstanceController(91  waMonitor,92  configService,93  prismaRepository,94  eventEmitter,95  chatwootService,96  settingsService,97  proxyController,98  cache,99  chatwootCache,100  baileysCache,101  providerFiles,102);103export const sendMessageController = new SendMessageController(waMonitor);104export const callController = new CallController(waMonitor);105export const chatController = new ChatController(waMonitor);106export const businessController = new BusinessController(waMonitor);107export const groupController = new GroupController(waMonitor);108export const labelController = new LabelController(waMonitor);109 110export const eventManager = new EventManager(prismaRepository, waMonitor);111export const chatbotController = new ChatbotController(prismaRepository, waMonitor);112export const channelController = new ChannelController(prismaRepository, waMonitor);113 114// channels115export const evolutionController = new EvolutionController(prismaRepository, waMonitor);116export const metaController = new MetaController(prismaRepository, waMonitor);117export const baileysController = new BaileysController(waMonitor);118 119const openaiService = new OpenaiService(waMonitor, prismaRepository, configService);120export const openaiController = new OpenaiController(openaiService, prismaRepository, waMonitor);121 122// chatbots123const typebotService = new TypebotService(waMonitor, configService, prismaRepository, openaiService);124export const typebotController = new TypebotController(typebotService, prismaRepository, waMonitor);125 126const difyService = new DifyService(waMonitor, prismaRepository, configService, openaiService);127export const difyController = new DifyController(difyService, prismaRepository, waMonitor);128 129const evolutionBotService = new EvolutionBotService(waMonitor, prismaRepository, configService, openaiService);130export const evolutionBotController = new EvolutionBotController(evolutionBotService, prismaRepository, waMonitor);131 132const flowiseService = new FlowiseService(waMonitor, prismaRepository, configService, openaiService);133export const flowiseController = new FlowiseController(flowiseService, prismaRepository, waMonitor);134 135const n8nService = new N8nService(waMonitor, prismaRepository, configService, openaiService);136export const n8nController = new N8nController(n8nService, prismaRepository, waMonitor);137 138const evoaiService = new EvoaiService(waMonitor, prismaRepository, configService, openaiService);139export const evoaiController = new EvoaiController(evoaiService, prismaRepository, waMonitor);140 141logger.info('Module - ON');142