@@ -68,17 +68,7 @@ export class ExpressBridge {
6868 } ,
6969 } ) ;
7070
71- const matchedPatterns = this . comparableCollection . filter (
72- ( eventPattern : EventPattern < Partial < typeof incomingEvent > > ) => {
73- console . log ( 'testing pattern: ' , eventPattern ) ;
74- console . log ( 'against... ' , incomingEvent ) ;
75- return eventPattern . test ( incomingEvent ) ;
76- }
77- ) ;
78-
79- console . log ( 'Matched patterns: ' , matchedPatterns ) ;
80- console . log ( 'Did we match patterns?: ' , matchedPatterns . length > 0 ) ;
81- console . log ( 'patterns to match against: ' , this . comparableCollection ) ;
71+ const matchedPatterns = this . match ( incomingEvent ) ;
8272
8373 if ( matchedPatterns . length > 0 ) {
8474 await this . telemetry ?. beacon ( 'EB-MATCH' , {
@@ -147,6 +137,16 @@ export class ExpressBridge {
147137 public getTelemetryId ( ) {
148138 return this . telemetry . eb_event_id ;
149139 }
140+
141+ private match (
142+ incomingEvent : Record < string , any >
143+ ) : EventPattern < typeof incomingEvent > [ ] {
144+ return this . comparableCollection . filter (
145+ ( eventPattern : EventPattern < Partial < typeof incomingEvent > > ) => {
146+ return eventPattern . test ( incomingEvent as any ) ;
147+ }
148+ ) ;
149+ }
150150}
151151
152152function pipeline ( message : EventType , ...functions : handlerType [ ] ) : EventType {
0 commit comments