Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
refactor(engine): move the builtin engine plugins under src/engine
Yudhi Armyndharisa61ec2a18d47
diff --git a/src/engine/adapters/whatsapp-web-js.adapter.spec.ts b/src/engine/adapters/whatsapp-web-js.adapter.spec.tsindex b282094b4..a889c4297 100644--- a/src/engine/adapters/whatsapp-web-js.adapter.spec.ts+++ b/src/engine/adapters/whatsapp-web-js.adapter.spec.ts@@ -5272,7 +5272,7 @@ describe('WhatsAppWebJsAdapter orphaned Chromium sweep (pre-launch)', () => {it('does not mutate the caller-owned puppeteer args array shared across sessions', async () => {// Every adapter receives the SAME array instance — ConfigService.get() returns a live reference- // into the cached config tree, via the plugin path (plugins/engines/whatsapp-web-js) and the+ // into the cached config tree, via the plugin path (engine/builtin/whatsapp-web-js) and the// factory fallback alike. Appending in place therefore rewrites global config for the rest of// the process lifetime, leaking one session's flags (proxy, session marker) into every later// launch. Without the defensive copy this assertion sees both session markers accumulate.diff --git a/src/plugins/engines/baileys/index.spec.ts b/src/engine/builtin/baileys/index.spec.tssimilarity index 95%rename from src/plugins/engines/baileys/index.spec.tsrename to src/engine/builtin/baileys/index.spec.tsindex 051aec840..c1c9d3f6f 100644--- a/src/plugins/engines/baileys/index.spec.ts+++ b/src/engine/builtin/baileys/index.spec.ts@@ -1,11 +1,11 @@import type { PluginContext } from '../../../core/plugins';-jest.mock('../../../engine/adapters/baileys.adapter', () => ({+jest.mock('../../adapters/baileys.adapter', () => ({BaileysAdapter: jest.fn().mockImplementation((config: unknown) => ({ config })),}));import { BaileysPlugin } from './index';-import { BaileysAdapter } from '../../../engine/adapters/baileys.adapter';+import { BaileysAdapter } from '../../adapters/baileys.adapter';describe('BaileysPlugin.createEngine (opaque config)', () => {beforeEach(() => jest.clearAllMocks());diff --git a/src/plugins/engines/baileys/index.ts b/src/engine/builtin/baileys/index.tssimilarity index 90%rename from src/plugins/engines/baileys/index.tsrename to src/engine/builtin/baileys/index.tsindex 42a87c668..a935b4ffe 100644--- a/src/plugins/engines/baileys/index.ts+++ b/src/engine/builtin/baileys/index.ts@@ -4,10 +4,10 @@*/import { PluginContext, PluginType, IEnginePlugin } from '../../../core/plugins';-import { IWhatsAppEngine } from '../../../engine/interfaces/whatsapp-engine.interface';-import { BaileysAdapter } from '../../../engine/adapters/baileys.adapter';-import { BaileysMessageStore } from '../../../engine/types/baileys.types';-import { LidMappingStore } from '../../../engine/identity/lid-mapping-store.service';+import { IWhatsAppEngine } from '../../interfaces/whatsapp-engine.interface';+import { BaileysAdapter } from '../../adapters/baileys.adapter';+import { BaileysMessageStore } from '../../types/baileys.types';+import { LidMappingStore } from '../../identity/lid-mapping-store.service';export class BaileysPlugin implements IEnginePlugin {type = PluginType.ENGINE as const;diff --git a/src/plugins/engines/baileys/manifest.json b/src/engine/builtin/baileys/manifest.jsonsimilarity index 100%rename from src/plugins/engines/baileys/manifest.jsonrename to src/engine/builtin/baileys/manifest.jsondiff --git a/src/plugins/engines/whatsapp-web-js/index.spec.ts b/src/engine/builtin/whatsapp-web-js/index.spec.tssimilarity index 95%rename from src/plugins/engines/whatsapp-web-js/index.spec.tsrename to src/engine/builtin/whatsapp-web-js/index.spec.tsindex 466a42353..b500f9b08 100644--- a/src/plugins/engines/whatsapp-web-js/index.spec.ts+++ b/src/engine/builtin/whatsapp-web-js/index.spec.ts@@ -1,9 +1,9 @@-jest.mock('../../../engine/adapters/whatsapp-web-js.adapter', () => ({+jest.mock('../../adapters/whatsapp-web-js.adapter', () => ({WhatsAppWebJsAdapter: jest.fn().mockImplementation((config: unknown) => ({ config })),}));import { WhatsAppWebJsPlugin } from './index';-import { WhatsAppWebJsAdapter } from '../../../engine/adapters/whatsapp-web-js.adapter';+import { WhatsAppWebJsAdapter } from '../../adapters/whatsapp-web-js.adapter';import { PluginContext } from '../../../core/plugins';describe('WhatsAppWebJsPlugin.createEngine (opaque config)', () => {diff --git a/src/plugins/engines/whatsapp-web-js/index.ts b/src/engine/builtin/whatsapp-web-js/index.tssimilarity index 94%rename from src/plugins/engines/whatsapp-web-js/index.tsrename to src/engine/builtin/whatsapp-web-js/index.tsindex de1846125..ad59fb33b 100644--- a/src/plugins/engines/whatsapp-web-js/index.ts+++ b/src/engine/builtin/whatsapp-web-js/index.ts@@ -4,9 +4,9 @@*/import { PluginContext, PluginType, IEnginePlugin } from '../../../core/plugins';-import { IWhatsAppEngine } from '../../../engine/interfaces/whatsapp-engine.interface';-import { WhatsAppWebJsAdapter } from '../../../engine/adapters/whatsapp-web-js.adapter';-import { LidMappingStore } from '../../../engine/identity/lid-mapping-store.service';+import { IWhatsAppEngine } from '../../interfaces/whatsapp-engine.interface';+import { WhatsAppWebJsAdapter } from '../../adapters/whatsapp-web-js.adapter';+import { LidMappingStore } from '../../identity/lid-mapping-store.service';export class WhatsAppWebJsPlugin implements IEnginePlugin {type = PluginType.ENGINE as const;diff --git a/src/plugins/engines/whatsapp-web-js/manifest.json b/src/engine/builtin/whatsapp-web-js/manifest.jsonsimilarity index 100%rename from src/plugins/engines/whatsapp-web-js/manifest.jsonrename to src/engine/builtin/whatsapp-web-js/manifest.jsondiff --git a/src/engine/engine.factory.ts b/src/engine/engine.factory.tsindex 57a2b93dc..bdc8d49f6 100644--- a/src/engine/engine.factory.ts+++ b/src/engine/engine.factory.ts@@ -5,8 +5,8 @@ import { ConfigService } from '@nestjs/config';import { IWhatsAppEngine } from './interfaces/whatsapp-engine.interface';import { WhatsAppWebJsAdapter } from './adapters/whatsapp-web-js.adapter';import { PluginLoaderService, PluginType, IEnginePlugin, PluginManifest } from '../core/plugins';-import { WhatsAppWebJsPlugin } from '../plugins/engines/whatsapp-web-js';-import { BaileysPlugin } from '../plugins/engines/baileys';+import { WhatsAppWebJsPlugin } from './builtin/whatsapp-web-js';+import { BaileysPlugin } from './builtin/baileys';import { createLogger } from '../common/services/logger.service';import { BaileysMessageStoreService } from './adapters/baileys-message-store.service';import { LidMappingStoreService } from './identity/lid-mapping-store.service';