import { Vocabulary , Definition } from "@ulangi/ulangi-common/interfaces" ; import { DefinitionStatus } from '@ulangi/ulangi-common/enums' ; import { DeepPartial , DeepMutable } from '@ulangi/extended-types' ; import { getCurrentValueByColumnName } from "./getCurrentValueByColumnName" ; import { prepareValuesForUpdate } from "./prepareValuesForUpdate" ; import { prepareValuesForInsert } from "./prepareValuesForInsert" ; export function prepareValueListForUpload ( valueList ) { return valueList . map ( ( values ) : [ DeepPartial < Vocabulary > , undefined | string ] => { const valueByName = getCurrentValueByColumnName ( values ) ; if ( valueByName . edited === "NEW" ) { return prepareValuesForInsert ( valueByName ) ; } else { return prepareValuesForUpdate ( valueByName ) ; } } ) ; }