import type { TypeGuardFn } from 'guardz';
import { Status } from '../../domain/event/Status';
import type { ErrorContext } from '../../utils/safe-event-never-throws';
/**
 * Configuration for EventSource event listeners
 */
export interface EventSourceListenerConfig<T> {
    /** Type guard function to validate event data */
    guard: TypeGuardFn<T>;
    /** Enable tolerance mode (default: false) */
    tolerance?: boolean;
    /** Allowed origins for security validation */
    allowedOrigins?: string[];
    /** Allowed sources for security validation */
    allowedSources?: string[];
    /** Callback for type mismatch errors */
    onTypeMismatch?: (errorMessage: string) => void;
    /** Callback for security violations */
    onSecurityViolation?: (origin: string, message: string) => void;
    /** Callback for other errors */
    onError?: (error: string, context: ErrorContext) => void;
}
/**
 * Safe EventSource event listener with callback-based API
 * Usage: eventSource.addEventListener('message', safeEventSourceListener(isSSEData, { onSuccess: handleSSEData }));
 */
export declare function safeEventSourceListener<T>(guard: TypeGuardFn<T>, config: EventSourceListenerConfig<T> & {
    onSuccess: (data: T) => void;
    onError?: (result: {
        status: Status.ERROR;
        code: number;
        message: string;
    }) => void;
}): (event: MessageEvent) => void;
//# sourceMappingURL=EventSourceListener.d.ts.map