From c875081275986f5dd288c69b2017ad19a09066ac Mon Sep 17 00:00:00 2001 From: lorentz Date: Wed, 15 Jul 2026 08:07:45 -0400 Subject: [PATCH] fix(15): WR-01 use shared getAutotaskClient factory in phishing-detector --- lib/services/phishing-detector.ts | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/lib/services/phishing-detector.ts b/lib/services/phishing-detector.ts index a88de0f..a732c2c 100644 --- a/lib/services/phishing-detector.ts +++ b/lib/services/phishing-detector.ts @@ -14,7 +14,7 @@ import { createHash } from 'crypto'; import { postgresClient } from './postgres-client'; -import { AutotaskClient } from './autotask-client'; +import { getAutotaskClient } from './autotask-factory'; // ============================================================================= // Pure detection logic — pattern matcher + content hash @@ -109,19 +109,6 @@ export interface EvidencePayload { attachments: EvidenceAttachment[]; } -let _autotaskClient: AutotaskClient | null = null; -function getAutotaskClient(): AutotaskClient { - if (!_autotaskClient) { - _autotaskClient = new AutotaskClient({ - apiUrl: process.env.AUTOTASK_API_URL || '', - username: process.env.AUTOTASK_USERNAME || '', - password: process.env.AUTOTASK_SECRET || '', - apiIntegrationCode: process.env.AUTOTASK_API_INTEGRATION_CODE || '', - }); - } - return _autotaskClient; -} - /** * Gather EVID-01 evidence for a candidate ticket: company name, ticket notes, * time entries, and attachment metadata (never base64 `data` — content fetch