Created
March 22, 2020 04:27
-
-
Save sonjisov/af154d38d671095ec3391313450fc8b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const publishToKinesis = async (payload) => { | |
// Publishing logic here which is irrelevant now | |
}; | |
// NOTE : Although I believe that this code is mostly correct, I confess that I never ran it | |
// so it may contain some minor syntax errors or something like that.... | |
export const handler = ({ Records: dynamoDbRecords }) => { | |
const promises = dynamoDbRecords.map(({ dynamodb: { OldImage: oldImage } }) => { | |
if (oldImage && oldImage.recordType === 'STATUS_TASK') { // We interested only in deleted records of type STATUS_TASK | |
return oldImage; | |
} | |
return null; | |
}).filter(r => r); | |
await Promise.resolveAll(promises); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment