import { SavedObject } from '../../types' ; import { SavedObjectsImportRetry } from '../types' ; export function splitOverwrites < T > ( savedObjects , retries ) { const objectsToOverwrite = [ ] ; const objectsToNotOverwrite = [ ] ; const overwrites = retries . filter ( ( retry ) => retry . overwrite ) . map ( ( retry ) => `${ retry . type }:${ retry . id }` ) ; for ( const savedObject of savedObjects ) { if ( overwrites . includes ( `${ savedObject . type }:${ savedObject . id }` ) ) { objectsToOverwrite . push ( savedObject ) ; } else { objectsToNotOverwrite . push ( savedObject ) ; } } return { objectsToOverwrite , objectsToNotOverwrite } ; }