@bull-board/api
Version:
A Dashboard server API built on top of bull or bullmq.
32 lines • 1.25 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseAdapter = void 0;
class BaseAdapter {
constructor(type, options = {}) {
this.formatters = new Map();
this.readOnlyMode = options.readOnlyMode === true;
this.allowRetries = this.readOnlyMode ? false : options.allowRetries !== false;
this.allowCompletedRetries = this.allowRetries && options.allowCompletedRetries !== false;
this.prefix = options.prefix || '';
this.delimiter = options.delimiter || '';
this.description = options.description || '';
this.displayName = options.displayName || '';
this.type = type;
}
getDescription() {
return this.description;
}
getDisplayName() {
return this.displayName;
}
setFormatter(field, formatter) {
this.formatters.set(field, formatter);
}
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
format(field, data, defaultValue = data) {
const fieldFormatter = this.formatters.get(field);
return typeof fieldFormatter === 'function' ? fieldFormatter(data) : defaultValue;
}
}
exports.BaseAdapter = BaseAdapter;
//# sourceMappingURL=base.js.map