import * as AWS from 'aws-sdk' ; const { HISTORY_TABLE_NAME } = process . env ; const ddb = new AWS . DynamoDB . DocumentClient ( ) ; param crawlId export const getHistoryEntry = async ( crawlId ) => ( await ddb . get ( { TableName : HISTORY_TABLE_NAME ! , Key : { crawlId , } , ConsistentRead : true , } ) . promise ( ) ) . Item ! ; param historyEntry export const putHistoryEntry = async ( historyEntry ) => { await ddb . put ( { TableName : HISTORY_TABLE_NAME ! , Item : historyEntry , } ) . promise ( ) ; } ; param crawlId param updateFields export const updateHistoryEntry = async ( crawlId , updateFields ) => { const historyEntry = await getHistoryEntry ( crawlId ) ; await putHistoryEntry ( { ... historyEntry , ... updateFields , } ) ; } ;