Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const findAppSuggestions = async setting => {
log('info', 'Fetch transactions changes, triggers and apps suggestions')
const [transactionsToCheck, triggers, suggestions] = await Promise.all([
BankTransaction.fetchChanges(get(setting, 'appSuggestions.lastSeq')),
Trigger.fetchAll(),
AppSuggestion.fetchAll()
])
log('info', `Fetched ${transactionsToCheck.documents.length} transactions`)
log('info', `Fetched ${triggers.length} triggers`)
log('info', `Fetched ${suggestions.length} apps suggestions`)
set(setting, 'appSuggestions.lastSeq', transactionsToCheck.newLastSeq)
log('info', 'Get not installed brands')
const installedSlugs = triggers.map(getKonnectorFromTrigger)
const brands = getNotInstalledBrands(installedSlugs)
log('info', `${brands.length} not installed brands`)