import { CompanyTypes , createScraper , SCRAPERS } from 'israeli-bank-scrapers-core' ; import { AccountToScrapeConfig } from '../configManager/configManager' ; export { ScaperScrapingResult } from 'israeli-bank-scrapers-core/lib/scrapers/base-scraper' ; export { Transaction } from 'israeli-bank-scrapers-core/lib/transactions' ; export const inputVendors = Object . keys ( SCRAPERS ) . filter ( ( key ) => key !== CompanyTypes . hapoalimBeOnline ) . map ( ( key ) => ( { key , ... SCRAPERS [ key ] , } ) ) ; interface ScrapeParameters { companyId : AccountToScrapeConfig [ 'key' ] ; credentials : AccountToScrapeConfig [ 'loginFields' ] ; startDate : Date ; showBrowser ? : boolean ; } type EmitProgressEventFunction = ( eventCompanyId : string , message : string ) => Promise < void > ; export async function scrape ( { companyId , credentials , startDate , showBrowser = false } , emitProgressEvent , chromePath ) { const options = { companyId , startDate , combineInstallments : false , showBrowser , verbose : false , executablePath : chromePath } ; const scraper = createScraper ( options ) ; scraper . onProgress ( ( eventCompanyId , payload ) => { emitProgressEvent ( companyId , payload . type ) ; } ) ; const scrapeResult = await scraper . scrape ( credentials ) ; return scrapeResult ; }