hook-engine
Version:
Production-grade webhook engine with comprehensive adapter support, security, reliability, structured logging, and CLI tools.
65 lines (64 loc) • 2.22 kB
TypeScript
import { BaseAdvancedAdapter } from './base-advanced';
import { NormalizationOptions } from '../types/adapter';
import { WebhookEvent, EventFilter, EventRoute } from '../types/webhook';
/**
* Advanced GitHub webhook adapter with batch processing, filtering, routing, and multi-tenancy
* Supports all GitHub webhook events with advanced processing capabilities
*/
export declare class GitHubAdvancedAdapter extends BaseAdvancedAdapter {
getSignature(req: any): string | undefined;
verifySignature(rawBody: Buffer, sigHeader: string, secret: string): boolean;
parsePayload(body: Buffer): any;
/**
* Parse batch payload - GitHub doesn't natively support batches,
* but we can handle arrays of events
*/
parseBatchPayload(rawBody: Buffer): any[];
normalize(event: any, options?: NormalizationOptions): WebhookEvent;
/**
* Extract tenant from GitHub event
*/
extractTenant(event: any, req?: any): string | undefined;
/**
* Validate tenant access for GitHub events
*/
validateTenant(tenant: string, event: WebhookEvent): boolean;
/**
* GitHub-specific event filtering with repository and organization awareness
*/
filterEvents(events: WebhookEvent[], filter: EventFilter): WebhookEvent[];
/**
* GitHub-specific event routing with smart defaults
*/
routeEvent(event: WebhookEvent, routes: EventRoute[]): EventRoute[];
/**
* Process GitHub event with repository-specific logic
*/
protected processEvent(event: WebhookEvent, timeout: number): Promise<void>;
/**
* Process push events with commit analysis
*/
private processPushEvent;
/**
* Process pull request events with review analysis
*/
private processPullRequestEvent;
/**
* Process workflow events with build analysis
*/
private processWorkflowEvent;
/**
* Get event category for unknown events
*/
private getEventCategory;
/**
* Extract branch from event
*/
private extractBranch;
/**
* Check if event is from main branch
*/
private isMainBranch;
}
declare const githubAdvanced: GitHubAdvancedAdapter;
export default githubAdvanced;