Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const main = async () => {
attachProcessEventHandlers()
const client = CozyClient.fromEnv(process.env)
Document.registerClient(client)
const options = await getOptions(cozyClient)
log('info', 'Options:')
log('info', JSON.stringify(options))
await onOperationOrBillCreate(client, options)
}
export const sendNotifications = async (config, transactions) => {
const enabledNotificationClasses = getEnabledNotificationClasses(config)
const client = CozyClient.fromEnv(process.env)
const accounts = await fetchTransactionAccounts(transactions)
const groups = await fetchGroups(client)
log(
'info',
`${transactions.length} new transactions on ${accounts.length} accounts.`
)
for (const Klass of enabledNotificationClasses) {
await sendNotificationForClass(Klass, {
client,
lang,
config,
data: {
accounts,
groups,
transactions
}