fase(16): integrations module
This commit is contained in:
14
src/main.ts
14
src/main.ts
@@ -55,6 +55,12 @@ import { hashPassword, verifyPassword } from './modules/auth/infrastructure/auth
|
||||
import { KyselyReportRepository } from './modules/reporting/infrastructure/repositories/KyselyReportRepository';
|
||||
import { GenerateReportCommand } from './modules/reporting/application/commands/GenerateReportCommand';
|
||||
|
||||
// Integrations module
|
||||
import { KyselyIntegrationRepository } from './modules/integrations/infrastructure/repositories/KyselyIntegrationRepository';
|
||||
import { KyselyWebhookEndpointRepository } from './modules/integrations/infrastructure/repositories/KyselyWebhookEndpointRepository';
|
||||
import { WebhookDispatcher } from './modules/integrations/infrastructure/webhooks/WebhookDispatcher';
|
||||
import { OnFindingCreated } from './modules/integrations/application/event-handlers/OnFindingCreated';
|
||||
|
||||
// Job queue
|
||||
import { SQLiteJobQueue } from './jobs/SQLiteJobQueue';
|
||||
import { createExplorationJobHandler, EXPLORATION_JOB_TYPE } from './jobs/workers/ExplorationWorker';
|
||||
@@ -133,6 +139,13 @@ async function bootstrap(): Promise<void> {
|
||||
// 11. Reporting use cases
|
||||
const generateReport = new GenerateReportCommand(reportRepo, eventBus);
|
||||
|
||||
// 11b. Integrations
|
||||
const integrationRepo = new KyselyIntegrationRepository(db);
|
||||
const webhookRepo = new KyselyWebhookEndpointRepository(db);
|
||||
const webhookDispatcher = new WebhookDispatcher(webhookRepo, logger);
|
||||
const onFindingCreated = new OnFindingCreated(integrationRepo, webhookRepo, webhookDispatcher, logger);
|
||||
eventBus.subscribe('findings.finding_created', onFindingCreated);
|
||||
|
||||
// 12. Job queue (created before HTTP server so it can be injected)
|
||||
const jobQueue = new SQLiteJobQueue(db, logger, config.jobs.pollIntervalMs);
|
||||
jobQueue.registerHandler(
|
||||
@@ -151,6 +164,7 @@ async function bootstrap(): Promise<void> {
|
||||
findingsDeps: { getFinding, listFindings, findingStats, resolveFinding, enrichFinding },
|
||||
fuzzingDeps: { runFuzz, repository: fuzzRepo },
|
||||
reportingDeps: { generateReport, reportRepository: reportRepo, jobQueue },
|
||||
integrationsDeps: { integrationRepo, webhookRepo },
|
||||
authDeps: {
|
||||
registerCommand,
|
||||
loginCommand,
|
||||
|
||||
Reference in New Issue
Block a user