import { Result } from "../common/result"; import { DomainEvent } from "../domain/domain-event"; export declare enum CorrelationType { CAUSAL = "causal", TEMPORAL = "temporal", CONTEXTUAL = "contextual", DATA = "data", BUSINESS = "business" } export interface EventCorrelation { readonly correlationId: string; readonly sourceEventId: string; readonly targetEventId: string; readonly correlationType: CorrelationType; readonly strength: number; readonly metadata: CorrelationMetadata; readonly createdAt: Date; readonly active: boolean; } export interface CorrelationMetadata { readonly businessProcessId?: string; readonly userId?: string; readonly sessionId?: string; readonly requestId?: string; readonly transactionId?: string; readonly customData?: Record; } export interface EventCorrelationRule { readonly ruleId: string; readonly name: string; readonly description?: string; readonly sourceEventPattern: EventPattern; readonly targetEventPattern: EventPattern; readonly correlationType: CorrelationType; readonly conditions: CorrelationCondition[]; readonly active: boolean; readonly priority: number; } export interface EventPattern { readonly eventType: string; readonly dataPatterns?: Record; readonly metadataPatterns?: Record; readonly timeWindow?: number; } export interface CorrelationCondition { readonly type: ConditionType; readonly fieldPath: string; readonly expectedValue: unknown; readonly operator: ComparisonOperator; } export declare enum ConditionType { EQUALS = "equals", NOT_EQUALS = "not_equals", CONTAINS = "contains", STARTS_WITH = "starts_with", ENDS_WITH = "ends_with", REGEX = "regex", GREATER_THAN = "greater_than", LESS_THAN = "less_than", EXISTS = "exists", NOT_EXISTS = "not_exists" } export declare enum ComparisonOperator { AND = "and", OR = "or", NOT = "not" } export interface EventCorrelationContext { readonly correlationId: string; readonly events: DomainEvent[]; readonly metadata: CorrelationMetadata; readonly createdAt: Date; lastUpdated: Date; strength: number; readonly correlationType: CorrelationType; } export interface EventCorrelationManager { registerCorrelationRule(rule: EventCorrelationRule): Promise>; processEvent(event: DomainEvent): Promise>; getEventCorrelations(eventId: string): Promise>; getCorrelationContext(correlationId: string): Promise>; getEventsInCorrelation(correlationId: string): Promise>; findCorrelatedEvents(event: DomainEvent, correlationType?: CorrelationType): Promise>; getCorrelationStatistics(): Promise>; removeCorrelation(correlationId: string): Promise>; } export interface CorrelationStatistics { readonly totalCorrelations: number; readonly activeCorrelations: number; readonly correlationsByType: Record; readonly averageStrength: number; readonly mostCorrelatedTypes: Array<{ eventType: string; correlationCount: number; }>; } export declare class BaseEventCorrelationManager implements EventCorrelationManager { private correlationRules; private correlations; private correlationContexts; private eventCorrelations; private statistics; registerCorrelationRule(rule: EventCorrelationRule): Promise>; processEvent(event: DomainEvent): Promise>; getEventCorrelations(eventId: string): Promise>; getCorrelationContext(correlationId: string): Promise>; getEventsInCorrelation(correlationId: string): Promise>; findCorrelatedEvents(event: DomainEvent, correlationType?: CorrelationType): Promise>; getCorrelationStatistics(): Promise>; removeCorrelation(correlationId: string): Promise>; private matchesPattern; private matchesEventType; private checkCorrelationConditions; private evaluateCondition; private containsValue; private findTargetEvents; private findSourceEvents; private createCorrelation; private calculateCorrelationStrength; private extractCorrelationMetadata; private storeCorrelation; private updateCorrelationContext; private getNestedValue; private generateCorrelationId; } export declare class EventCorrelationRuleBuilder { private ruleId; private name; private rule; constructor(ruleId: string, name: string); description(description: string): EventCorrelationRuleBuilder; sourceEventPattern(pattern: EventPattern): EventCorrelationRuleBuilder; targetEventPattern(pattern: EventPattern): EventCorrelationRuleBuilder; correlationType(type: CorrelationType): EventCorrelationRuleBuilder; addCondition(condition: CorrelationCondition): EventCorrelationRuleBuilder; active(active: boolean): EventCorrelationRuleBuilder; priority(priority: number): EventCorrelationRuleBuilder; build(): EventCorrelationRule; } export declare function createCorrelationRule(ruleId: string, name: string): EventCorrelationRuleBuilder;