Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

style(plugins): apply prettier --fix to capability layer files

rmyndharis031efa42c618
diff --git a/src/core/plugins/plugin-capability.spec.ts b/src/core/plugins/plugin-capability.spec.ts
index 3babd2adc..1994cf4b0 100644
--- a/src/core/plugins/plugin-capability.spec.ts
+++ b/src/core/plugins/plugin-capability.spec.ts
@@ -50,9 +50,9 @@ describe('PluginLoaderService capability facade — ctx.messages', () => {
});
function contextFor(plugin: PluginInstance): PluginContext {
- return (
- loader as unknown as { createPluginContext: (p: PluginInstance) => PluginContext }
- ).createPluginContext(plugin);
+ return (loader as unknown as { createPluginContext: (p: PluginInstance) => PluginContext }).createPluginContext(
+ plugin,
+ );
}
it('messages.sendText delegates to MessageService.sendText with a wrapped dto', async () => {
@@ -110,9 +110,9 @@ describe('PluginLoaderService capability facade — ctx.engine', () => {
}
function contextFor(plugin: PluginInstance): PluginContext {
- return (
- loader as unknown as { createPluginContext: (p: PluginInstance) => PluginContext }
- ).createPluginContext(plugin);
+ return (loader as unknown as { createPluginContext: (p: PluginInstance) => PluginContext }).createPluginContext(
+ plugin,
+ );
}
it('engine.getGroupInfo delegates to SessionService.getEngine(id).getGroupInfo', async () => {
diff --git a/src/core/plugins/plugin-loader.service.ts b/src/core/plugins/plugin-loader.service.ts
index 8effcb1b8..fdf89dd48 100644
--- a/src/core/plugins/plugin-loader.service.ts
+++ b/src/core/plugins/plugin-loader.service.ts
@@ -291,9 +291,7 @@ export class PluginLoaderService implements OnModuleInit {
private assertSessionAllowed(manifest: PluginManifest, sessionId: string): void {
const allowed = manifest.sessions ?? ['*'];
if (!allowed.includes('*') && !allowed.includes(sessionId)) {
- throw new PluginCapabilityError(
- `Plugin ${manifest.id} is not permitted to act on session ${sessionId}`,
- );
+ throw new PluginCapabilityError(`Plugin ${manifest.id} is not permitted to act on session ${sessionId}`);
}
}
@@ -306,9 +304,7 @@ export class PluginLoaderService implements OnModuleInit {
this.assertSessionAllowed(manifest, sessionId);
const engine = this.moduleRef.get(SessionService, { strict: false }).getEngine(sessionId);
if (!engine) {
- throw new PluginCapabilityError(
- `Session ${sessionId} has no active engine (unknown or not started)`,
- );
+ throw new PluginCapabilityError(`Session ${sessionId} has no active engine (unknown or not started)`);
}
return engine;
}
diff --git a/src/core/plugins/plugin.interfaces.ts b/src/core/plugins/plugin.interfaces.ts
index 930462a70..bd02e904b 100644
--- a/src/core/plugins/plugin.interfaces.ts
+++ b/src/core/plugins/plugin.interfaces.ts
@@ -101,12 +101,7 @@ export class PluginCapabilityError extends Error {
export interface PluginMessagingCapability {
sendText(sessionId: string, chatId: string, text: string): Promise<MessageResponseDto>;
- reply(
- sessionId: string,
- chatId: string,
- quotedMessageId: string,
- text: string,
- ): Promise<MessageResponseDto>;
+ reply(sessionId: string, chatId: string, quotedMessageId: string, text: string): Promise<MessageResponseDto>;
}
export interface PluginEngineReadCapability {
diff --git a/src/plugins/extensions/auto-reply/index.ts b/src/plugins/extensions/auto-reply/index.ts
index f31d27c9b..58cfe97f3 100644
--- a/src/plugins/extensions/auto-reply/index.ts
+++ b/src/plugins/extensions/auto-reply/index.ts
@@ -11,17 +11,12 @@ import { IncomingMessage } from '../../../engine/interfaces/whatsapp-engine.inte
export class AutoReplyPlugin implements IPlugin {
onEnable(context: PluginContext): Promise<void> {
- context.registerHook('message:received', ctx =>
- this.onMessage(context, ctx as HookContext<IncomingMessage>),
- );
+ context.registerHook('message:received', ctx => this.onMessage(context, ctx as HookContext<IncomingMessage>));
context.logger.log('Auto-reply reference plugin enabled');
return Promise.resolve();
}
- private async onMessage(
- context: PluginContext,
- ctx: HookContext<IncomingMessage>,
- ): Promise<HookResult> {
+ private async onMessage(context: PluginContext, ctx: HookContext<IncomingMessage>): Promise<HookResult> {
const message = ctx.data;
// Reply only to inbound, non-group, engine-originated messages; never to our own sends.