api/index.js
// Enumeration Utility for aggregating Dynamo Records
Enumeration Utility for aggregating Dynamo Records
Enumeration Utility for aggregating Dynamo Records
async function scanDynamoRecords(scanParams, itemArray) {
    try {
        const dynamoData = await dynamodb.scan(scanParams).promise();
        itemArray = itemArray.concat(dynamoData.Items);
        if (dynamoData.LastEvaluatedKey) {
            scanParams.ExclusiveStartkey = dynamoData.LastEvaluatedKey;
            return await scanDynamoRecords(scanParams, itemArray);
        }
        return itemArray;
    }
    catch (error) {
        console.error('Scanning Dynamo Records Error ', error);
    }
}
async function scanDynamoRecords ( scanParams , itemArray ) { try { const dynamoData = await dynamodb . scan ( scanParams ) . promise ( ) ; itemArray = itemArray . concat ( dynamoData . Items ) ; if ( dynamoData . LastEvaluatedKey ) { scanParams . ExclusiveStartkey = dynamoData . LastEvaluatedKey ; return await scanDynamoRecords ( scanParams , itemArray ) ; } return itemArray ; } catch ( error ) { console . error ( 'Scanning Dynamo Records Error ' , error ) ; } }
Enumeration Utility for aggregating Dynamo Records
Enumeration Utility for aggregating Dynamo Records