Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}, this);
this._uniq = 0;
// Don't freak out!
// This happily overwrites inherited properties.
Object.assign(this, options);
// Trace, debug, and dump flags should be sets, but options might
// include them as arrays.
['traceFlags', 'debugFlags', 'dumpFlags'].forEach(function(f) {
if (Array.isArray(this[f])) {
this[f] = new Set(this[f]);
}
}, this);
if (options.parent && (!this.loggerBackend || !this.metrics)) {
var srlogger = ServiceRunner.getLogger(options.parent.logging);
if (!this.loggerBackend) {
this.loggerBackend = function(logData, cb) {
srlogger.log(logData.logType, prepareLog(logData));
cb();
};
}
if (!this.metrics) {
this.metrics = ServiceRunner.getMetrics(options.parent.metrics, srlogger);
}
}
if (!localSettings && options.localsettings) {
localSettings = require(options.localsettings);
}
if (localSettings && localSettings.setup) {
function ParsoidConfig(localSettings, options) {
options = options || {};
this.mwApiMap = new Map();
this.reverseMwApiMap = new Map();
Object.keys(CONFIG_DEFAULTS).forEach(function(k) {
this[k] = Util.clone(CONFIG_DEFAULTS[k]);
}, this);
this._uniq = 0;
// Don't freak out!
// This happily overwrites inherited properties.
Object.assign(this, options);
if (options.parent && (!this.loggerBackend || !this.metrics)) {
var srlogger = ServiceRunner.getLogger(options.parent.logging);
if (!this.loggerBackend) {
this.loggerBackend = function(logData, cb) {
srlogger.log(logData.logType, prepareLog(logData));
cb();
};
}
if (!this.metrics) {
this.metrics = ServiceRunner.getMetrics(options.parent.metrics, srlogger);
}
}
if (!localSettings && options.localsettings) {
localSettings = require(options.localsettings);
}
if (localSettings && localSettings.setup) {
this._uniq = 0;
// Don't freak out!
// This happily overwrites inherited properties.
Object.assign(this, options);
if (options.parent && (!this.loggerBackend || !this.metrics)) {
var srlogger = ServiceRunner.getLogger(options.parent.logging);
if (!this.loggerBackend) {
this.loggerBackend = function(logData, cb) {
srlogger.log(logData.logType, prepareLog(logData));
cb();
};
}
if (!this.metrics) {
this.metrics = ServiceRunner.getMetrics(options.parent.metrics, srlogger);
}
}
if (!localSettings && options.localsettings) {
localSettings = require(options.localsettings);
}
if (localSettings && localSettings.setup) {
localSettings.setup(this);
}
// Call setMwApi for each specified API.
if (Array.isArray(this.mwApis)) {
this.mwApis.forEach(function(api) {
this.setMwApi(api);
}, this);
['traceFlags', 'debugFlags', 'dumpFlags'].forEach(function(f) {
if (Array.isArray(this[f])) {
this[f] = new Set(this[f]);
}
}, this);
if (options.parent && (!this.loggerBackend || !this.metrics)) {
var srlogger = ServiceRunner.getLogger(options.parent.logging);
if (!this.loggerBackend) {
this.loggerBackend = function(logData, cb) {
srlogger.log(logData.logType, prepareLog(logData));
cb();
};
}
if (!this.metrics) {
this.metrics = ServiceRunner.getMetrics(options.parent.metrics, srlogger);
}
}
if (!localSettings && options.localsettings) {
localSettings = require(options.localsettings);
}
if (localSettings && localSettings.setup) {
localSettings.setup(this);
}
// Call setMwApi for each specified API.
if (Array.isArray(this.mwApis)) {
this.mwApis.forEach(function(api) {
this.setMwApi(api);
}, this);