import { DynamoDB } from 'aws-sdk' ; import { WithAttributes } from '../../chaining/common' ; import { BatchGet } from '../../chaining/find/batch-get/batch-get' ; import { buildKey , projectionExpression } from '../helpers' ; export function buildBatchGetInput < KeySchema > ( batchGet , withAttributes ? ) { const input = { RequestItems : { [ batchGet . schema . tableName ] : { Keys : batchGet . keys . map ( ( key ) => buildKey ( key ) ) , } , } , } ; if ( withAttributes ) { input . RequestItems [ batchGet . schema . tableName ] . ProjectionExpression = projectionExpression ( withAttributes . attributes ) ; input . RequestItems [ batchGet . schema . tableName ] . ExpressionAttributeNames = withAttributes . expressionAttributeNames ; } return input ; }