File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,12 +12,13 @@ import {
1212 updateDynamoDB ,
1313} from '../sinks/dynamodb' ;
1414
15- import { filterOnEventType , filterOnContent } from '../filters' ;
15+ import { filterOnEventType , filterOnContent , outLatched } from '../filters' ;
1616
1717import { normalize } from './correlate' ;
1818
1919export const update = ( rule ) => ( s ) => s // eslint-disable-line import/prefer-default-export
2020 // reacting to collected events vs change events
21+ . filter ( outLatched )
2122 . map ( ( uow ) => ( uow . record . eventName === 'INSERT' && uow . record . dynamodb . Keys . sk . S === 'EVENT' ? /* istanbul ignore next */ normalize ( uow ) : uow ) )
2223
2324 . filter ( onEventType ( rule ) )
Original file line number Diff line number Diff line change @@ -287,6 +287,40 @@ describe('flavors/update.js', () => {
287287 } )
288288 . done ( done ) ;
289289 } ) ;
290+
291+ it ( 'should skip processing if latched' , ( done ) => {
292+ const events = toDynamodbRecords ( [
293+ {
294+ timestamp : 1572832690 ,
295+ keys : {
296+ pk : '1' ,
297+ sk : 'thing' ,
298+ } ,
299+ newImage : {
300+ pk : '1' ,
301+ sk : 'thing' ,
302+ discriminator : 'thing' ,
303+ name : 'Thing One' ,
304+ description : 'This is thing one' ,
305+ otherThing : 'thing|2' ,
306+ latched : true ,
307+ ttl : 1549053422 ,
308+ timestamp : 1548967022000 ,
309+ } ,
310+ } ,
311+ ] ) ;
312+
313+ initialize ( {
314+ ...initializeFrom ( rules ) ,
315+ } , { ...defaultOptions , AES : false } )
316+ . assemble ( fromDynamodb ( events ) , false )
317+ . collect ( )
318+ // .tap((collected) => console.log(JSON.stringify(collected, null, 2)))
319+ . tap ( ( collected ) => {
320+ expect ( collected . length ) . to . equal ( 0 ) ;
321+ } )
322+ . done ( done ) ;
323+ } ) ;
290324} ) ;
291325
292326const toUpdateRequest = ( uow ) => ( {
You can’t perform that action at this time.
0 commit comments