Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

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.ts
index 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.ts
similarity index 95%
rename from src/plugins/engines/baileys/index.spec.ts
rename to src/engine/builtin/baileys/index.spec.ts
index 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.ts
similarity index 90%
rename from src/plugins/engines/baileys/index.ts
rename to src/engine/builtin/baileys/index.ts
index 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.json
similarity index 100%
rename from src/plugins/engines/baileys/manifest.json
rename to src/engine/builtin/baileys/manifest.json
diff --git a/src/plugins/engines/whatsapp-web-js/index.spec.ts b/src/engine/builtin/whatsapp-web-js/index.spec.ts
similarity index 95%
rename from src/plugins/engines/whatsapp-web-js/index.spec.ts
rename to src/engine/builtin/whatsapp-web-js/index.spec.ts
index 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.ts
similarity index 94%
rename from src/plugins/engines/whatsapp-web-js/index.ts
rename to src/engine/builtin/whatsapp-web-js/index.ts
index 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.json
similarity index 100%
rename from src/plugins/engines/whatsapp-web-js/manifest.json
rename to src/engine/builtin/whatsapp-web-js/manifest.json
diff --git a/src/engine/engine.factory.ts b/src/engine/engine.factory.ts
index 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';