add toJson job method

This commit is contained in:
Patrick Chatain
2019-02-03 14:32:30 +01:00
parent c214d32234
commit 8ae30e8f89
+19
View File
@@ -228,6 +228,25 @@ declare namespace Bull {
* Takes a lock for this job so that no other queue worker can process it at the same time.
*/
takeLock(): Promise<number | false>;
/**
* Get job properties as Json Object
*/
toJSON(): {
id: JobId,
name: string,
data: T,
opts: JobOptions,
progress: number,
delay: number,
timestamp: number,
attemptsMade: number,
failedReason: string,
stacktrace: string[] | null,
returnvalue: any,
finishedOn: number | null,
processedOn: number | null
};
}
type JobStatus = 'completed' | 'waiting' | 'active' | 'delayed' | 'failed';