@bull-board/api
Advanced tools
Comparing version 3.7.2 to 3.8.0
@@ -40,3 +40,3 @@ "use strict"; | ||
data: queue.format('data', jobProps.data), | ||
name: jobProps.name, | ||
name: queue.format('name', jobProps), | ||
returnValue: queue.format('returnValue', jobProps.returnvalue), | ||
@@ -43,0 +43,0 @@ isFailed: !!jobProps.failedReason || (Array.isArray(stacktrace) && stacktrace.length > 0), |
@@ -1,2 +0,2 @@ | ||
import { JobCleanStatus, JobCounts, JobStatus, QueueAdapterOptions, QueueJob } from '../../typings/app'; | ||
import { FormatterField, JobCleanStatus, JobCounts, JobStatus, QueueAdapterOptions, QueueJob } from '../../typings/app'; | ||
export declare abstract class BaseAdapter { | ||
@@ -7,4 +7,4 @@ readonly readOnlyMode: boolean; | ||
protected constructor(options?: Partial<QueueAdapterOptions>); | ||
setFormatter(field: 'data' | 'returnValue', formatter: (data: any) => any): void; | ||
format(field: 'data' | 'returnValue', data: any): any; | ||
setFormatter(field: FormatterField, formatter: (data: any) => any): void; | ||
format(field: FormatterField, data: any): any; | ||
abstract clean(queueStatus: JobCleanStatus, graceTimeMs: number): Promise<void>; | ||
@@ -11,0 +11,0 @@ abstract getJob(id: string): Promise<QueueJob | undefined | null>; |
@@ -15,3 +15,6 @@ "use strict"; | ||
format(field, data) { | ||
return typeof this.formatters[field] === 'function' ? this.formatters[field](data) : data; | ||
const defaultValue = field === 'name' ? data.name : data; | ||
return typeof this.formatters[field] === 'function' | ||
? this.formatters[field](data) | ||
: defaultValue; | ||
} | ||
@@ -18,0 +21,0 @@ } |
@@ -112,1 +112,2 @@ import { BaseAdapter } from '../src/queueAdapters/base'; | ||
} | ||
export declare type FormatterField = 'data' | 'returnValue' | 'name'; |
{ | ||
"name": "@bull-board/api", | ||
"version": "3.7.2", | ||
"version": "3.8.0", | ||
"description": "Core server APIs of bull-board", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45486
733