Transform Json Input
function input
Use a Pass type Step Function to merge a script under the field name "transformScript into the input JSON.
"Inject Update Status and Updated": {
"Type": "Pass",
"Result":"event.doc.status = event.jobStatus.success ? 'finished' : 'failure'; event.doc.updated=new Date()"
"ResultPath": "$.transformScript",
"Next": "..."
}
The script can modify the 'event' object containing the parsed input json, which will be returned as the output of the lambda.
In the example above the script adds the following to the input.
"doc": {
"status": "finished",
"updated": "2018-03-19T21:20:08.571Z"
}
Note: we use a "trace" value throughout our system's design to track a process across tiers/logs.