module import { Attributes } from '../../../mapper/type/attribute.type' ; import { ConditionalParams } from '../../operation-params.type' ; import { Expression } from '../type/expression.type' ; import { uniqueAttributeValueName } from './unique-attribute-value-name.function' ; param expression param params return hidden export function resolveAttributeValueNameConflicts ( expression , params ) { let attributeValues = { } ; let statement = expression . statement ; if ( params . ExpressionAttributeValues ) { const existingAttributeValueNames = Object . keys ( params . ExpressionAttributeValues ) ; Object . keys ( expression . attributeValues ) . map ( ( key ) => [ key , uniqueAttributeValueName ( key . replace ( ':' , '' ) , existingAttributeValueNames ) ] ) . forEach ( ( [ oldValName , newValName ] ) => { attributeValues [ newValName ] = expression . attributeValues [ oldValName ] ; statement = statement . split ( oldValName ) . join ( newValName ) ; } ) ; } else { attributeValues = expression . attributeValues ; } return { ... expression , attributeValues , statement } ; }