import { AgendaConfig , Processor } from 'agenda' ; import * as Agenda from 'agenda' ; export class CronService { private agenda : Agenda . Agenda = new ( Agenda as any ) ( { db : { address : this . config . mongoUrl , } , } as AgendaConfig ) ; constructor ( private config ) { } async initialize ( ) { await this . agenda . start ( ) ; } define < T > ( name , callback ) { this . agenda . define ( name , callback ) ; } async processEvery ( name , interval ) { await this . agenda . every ( interval , name , { } , { } ) ; } async processNow ( name ) { await this . agenda . now ( name , null ) ; } }