/**
 * Generic webhook normalizer.
 *
 * Implements the WebhookNormalizer interface for non-GitHub webhook sources.
 * Handles arbitrary HTTP payloads: JSON and URL-encoded form data.
 * Extracts event type from configurable header or JSONPath in body.
 * Filters sensitive headers per source configuration.
 */
import type { WebhookNormalizer, SimulatedEvent } from '@kici-dev/engine';
import type { GenericSourceManager } from '../../webhook/generic-sources.js';
/**
 * Generic webhook normalizer implementing WebhookNormalizer from @kici-dev/engine.
 *
 * Transforms arbitrary HTTP webhook payloads into KiCI's universal SimulatedEvent format.
 * Unlike Git providers, generic webhooks have no repo, ref, or SHA -- they carry
 * event payloads from external services (Stripe, Slack, custom APIs, etc.).
 */
export declare class GenericWebhookNormalizer implements WebhookNormalizer {
    private readonly sourceManager;
    readonly provider: "generic";
    constructor(sourceManager: GenericSourceManager);
    /**
     * Extract routing key from the X-KiCI-Source-ID header.
     * The route handler sets this header based on the URL path parameter.
     */
    extractRoutingKey(headers: Record<string, string>, _payload: unknown): string | null;
    /**
     * Extract delivery ID from configurable header or generate one.
     * Checks X-Request-ID, X-Delivery-ID, or X-Idempotency-Key headers.
     */
    extractDeliveryId(headers: Record<string, string>): string | null;
    /**
     * Extract event type from configurable header.
     * Falls back to X-Event-Type header.
     */
    extractEventType(headers: Record<string, string>): string | null;
    /**
     * Verify signature -- delegates to the generic verification module.
     * This method is part of the WebhookNormalizer interface but generic webhooks
     * use the separate verifyGenericWebhook function with per-source config.
     * Returns true here as a no-op; actual verification is handled upstream.
     */
    verifySignature(_body: string, _headers: Record<string, string>, _secret: string): boolean;
    /**
     * Normalize a generic webhook event into a SimulatedEvent.
     *
     * Generic webhooks produce events with:
     * - type: the extracted event type or 'generic_webhook' fallback
     * - action: undefined (no sub-action concept for generic sources)
     * - targetBranch: '__generic__' (no branch concept)
     * - payload: the raw parsed payload with filtered headers
     * - provider: 'generic'
     */
    normalizeEvent(eventType: string, _action: string | null, payload: unknown): SimulatedEvent | null;
    /**
     * Extract repository identifier -- generic webhooks have no repo concept.
     */
    extractRepoIdentifier(_payload: unknown): string | null;
    /**
     * Extract ref -- generic webhooks have no ref concept.
     */
    extractRef(_eventType: string, _payload: unknown): string;
    /**
     * Extract credentials -- generic webhooks carry no provider credentials.
     */
    extractCredentials(_payload: unknown): Record<string, unknown>;
    /**
     * Parse and normalize a full generic webhook request.
     *
     * This is the main entry point for generic webhook processing:
     * 1. Looks up source config by routing key
     * 2. Parses body as JSON or URL-encoded form data
     * 3. Extracts event type from configured header or JSONPath in body
     * 4. Filters sensitive headers
     * 5. Returns normalized WebhookData
     *
     * @param routingKey - The routing key for this source (from URL path)
     * @param rawBody - Raw request body string
     * @param headers - Request headers (lowercase keys)
     * @returns Normalized data or null if source not found/disabled
     */
    normalizeGenericRequest(routingKey: string, rawBody: string, headers: Record<string, string>): Promise<{
        event: string;
        payload: Record<string, unknown>;
        headers: Record<string, string>;
        routingKey: string;
    } | null>;
}
/**
 * Parse request body as JSON or URL-encoded form data.
 */
export declare function parseBody(rawBody: string, contentType?: string): Record<string, unknown>;
/**
 * Extract event type from headers or payload path.
 *
 * Priority:
 * 1. Source-configured header (event_type_header)
 * 2. Source-configured JSONPath in body (event_type_path) -- simple dot notation
 * 3. Fallback header X-Event-Type
 * 4. Default: 'default'
 */
export declare function extractEventType(headers: Record<string, string>, payload: Record<string, unknown>, eventTypeHeader?: string | null, eventTypePath?: string | null): string;
/**
 * Get a nested value from an object using dot notation.
 * e.g., getNestedValue({a: {b: 'c'}}, 'a.b') => 'c'
 */
export declare function getNestedValue(obj: Record<string, unknown>, path: string): unknown;
/**
 * Filter out sensitive headers.
 */
export declare function filterHeaders(headers: Record<string, string>, stripHeaders: string[]): Record<string, string>;
//# sourceMappingURL=normalizer.d.ts.map