import { FormatterField , JobCleanStatus , JobCounts , JobStatus , QueueAdapterOptions , QueueJob , } from '../../typings/app' ; export abstract class BaseAdapter { public readonly readOnlyMode : boolean ; public readonly prefix : string ; private formatters = new Map < FormatterField , ( data : any ) => any > ( ) ; protected constructor ( options = { } ) { this . readOnlyMode = options . readOnlyMode === true ; this . prefix = options . prefix || '' ; } public setFormatter < T extends FormatterField > ( field , formatter ) { this . formatters . set ( field , formatter ) ; } public format ( field , data , defaultValue = data ) { const fieldFormatter = this . formatters . get ( field ) ; return typeof fieldFormatter === 'function' ? fieldFormatter ( data ) : defaultValue ; } public abstract clean ( queueStatus , graceTimeMs ) ; public abstract getJob ( id ) ; public abstract getJobCounts ( ... jobStatuses ) ; public abstract getJobs ( jobStatuses , start ? , end ? ) ; public abstract getJobLogs ( id ) ; public abstract getName ( ) ; public abstract getRedisInfo ( ) ; public abstract isPaused ( ) ; public abstract pause ( ) ; public abstract resume ( ) ; }