Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
import { Global, Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { EngineFactory } from './engine.factory';
import { BaileysStoredMessage } from './adapters/baileys-stored-message.entity';
import { BaileysMessageStoreService } from './adapters/baileys-message-store.service';
import { LidMapping } from './identity/lid-mapping.entity';
import { LidMappingStoreService } from './identity/lid-mapping-store.service';
import { ChatState } from './adapters/baileys-chat-state.entity';
import { ChatStateStoreService } from './adapters/baileys-chat-state-store.service';
import { EngineRegistry } from './engine-registry.service';
@Global()
@Module({
imports: [TypeOrmModule.forFeature([BaileysStoredMessage, LidMapping, ChatState], 'data')],
// EngineRegistry is exported from this @Global module so the feature services that only need a
// live engine can inject it directly, instead of importing SessionModule to reach the lifecycle
// owner. It is a singleton by DI, which is what makes it a safe single source of truth.
providers: [EngineFactory, BaileysMessageStoreService, LidMappingStoreService, ChatStateStoreService, EngineRegistry],
exports: [EngineFactory, LidMappingStoreService, ChatStateStoreService, EngineRegistry],
})
export class EngineModule {}