import { stripHtml } from '@matters/matters-html-formatter' ; import { gcp } from 'connectors' ; import { ArticleToLanguageResolver } from 'definitions' ; const resolver = async ( { id , content , language : storedLanguage } , _ , { dataSources : { draftService } } ) => { if ( storedLanguage ) { return storedLanguage ; } gcp . detectLanguage ( stripHtml ( content . slice ( 0 , 300 ) ) ) . then ( ( language ) => language && draftService . baseUpdate ( id , { language } ) ) ; return ; } ; export default resolver ;