module import * as DynamoDB from 'aws-sdk/clients/dynamodb' ; import { createLogger , Logger } from '../../../logger/logger' ; import { toDb } from '../../../mapper/mapper' ; import { ModelConstructor } from '../../../model/model-constructor' ; import { DynamoDbWrapper } from '../../dynamo-db-wrapper' ; import { createIfNotExistsCondition } from '../../expression/create-if-not-exists-condition.function' ; import { WriteRequest } from '../write.request' ; /**
 * Request class for the PutItem operation.
 */ export class PutRequest < T , T2 = void > extends WriteRequest < T , T2 , DynamoDB . PutItemInput , DynamoDB . PutItemOutput , PutRequest < T , T2 > > { protected readonly logger : Logger ; constructor ( dynamoDBWrapper , modelClazz , item ) { super ( dynamoDBWrapper , modelClazz ) ; this . logger = createLogger ( 'dynamo.request.PutRequest' , modelClazz ) ; this . params . Item = toDb ( item , this . modelClazz ) ; } param predicate ifNotExists ( predicate = true ) { if ( predicate ) { this . onlyIf ( ... createIfNotExistsCondition ( this . metadata ) ) ; } return this ; } returnValues ( returnValues ) ; returnValues ( returnValues ) ; returnValues ( returnValues ) { this . params . ReturnValues = returnValues ; return < any > this ; } protected doRequest ( params ) { return this . dynamoDBWrapper . putItem ( params ) ; } }