Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
log.debug(options, 'Data posted is not valid');
// Add error to the response object
getError(self, errArr);
// done(valid);
}
// running custom validations of model(written in model js file) if any
if (Model.customValidations || inst.__data.customValidations) {
log.trace(options, 'executing custom validations for model');
var customValArr = [];
var custValidations = inst.__data.customValidations || [];
delete inst.__data.customValidations;
custValidations = custValidations.concat(Model.customValidations || []);
custValidations.forEach(function customValidationForEachCb(customValidation) {
customValArr.push(async.apply(customValidation, inst.__data, context));
});
async.parallel(customValArr, function customModelValidationsAsyncParallelElseCb(err, customResults) {
if (err) {
customResults.push(err);
}
// Add error to the response object
customResults = [].concat.apply([], customResults);
var custErrArr = customResults.filter(function modelValidationAsyncParalllelCustomErrCb(d) {
return d !== null && typeof d !== 'undefined';
});
// inst.errors will have custom errors if any
if ((custErrArr && custErrArr.length > 0) || inst.errors) {
valid = false;
getError(self, custErrArr);
}
done(valid);
});
} else {
} catch (e) {
log.warn("could not write to decoder. err=" + e);
}
}
if (!dataObj.newSegment) return out();
// actions on new segment
//log.debug("dl+decoder pause");
this.dl.pause();
this.decoder.stdout.pause();
// TODO: do the hotlist search only if mlPredictor is unsure?
async.parallel([
function(cb) {
if (!self.config.enablePredictorMl || !self.mlPredictor.ready) return setImmediate(cb);
self.mlPredictor.predict(function(err, data) {
if (!err && data && self.listener.writable) {
self.listener.write({ type: "ml", data });
} else {
log.warn("skip ml result because err=" + err + " data=" + JSON.stringify(data) + " writable=" + self.listener.writable);
}
cb(err);
});
},
function(cb) {
if (!self.config.enablePredictorHotlist) return setImmediate(cb);
self.hotlist.onFingers(function(err, data) {
if (!err && data && self.listener.writable) {
fetch(callback) {
async.parallel([
// Fetches version data on the Repo
(cb) => {
this._sendApiRequest(this.url, `${this.repoPath}/versions`, cb);
},
// Fetches the author data
(cb) => {
this._getAllCommits(this.url, `${this.repoPath}/commits`, {}, cb);
},
// Fetch General data
(cb) => {
this._sendApiRequest(this.url, `${this.repoPath}`, cb);
},
], (error, results) => {
if (error === null) {
const sourceData = new SourceData();
// General info
getSourceStats(env, callback) {
let stats = {
cluster_status: 'Red',
docs: {
total: 0
},
databases: {}
};
async.parallel([
callback => {
this.source.getDb(env.options.source, (err, db) => {
if (err) {
return callback(err);
}
db.admin().serverStatus((err, info) => {
if (err) {
return callback(err);
}
stats.version = info.version;
stats.cluster_status = 'Green';
callback();
});
});
},
callback => {
function(list, complete) {
async.parallel(
[
function getTasks(cb) {
api(
{ url: "/tasks", qs: { list_id: list.id, completed: false } },
function(err, res, body) {
showProgress();
cb(err, body);
}
);
},
function getCompletedTasks(cb) {
api(
{ url: "/tasks", qs: { list_id: list.id, completed: true } },
function(err, res, body) {
showProgress();
cb(err, body);
gulp.task('prepare-folders',function(callback) {
async.parallel({
build: function(callback) {
fse.ensureDir(path.join(__dirname,'build'),callback);
},
dist: function(callback) {
fse.ensureDir(path.join(__dirname,'dist'),callback);
}
},callback);
});
FormData.prototype.getLength = function(cb) {
var knownLength = this._overheadLength + this._valueLength;
if (this._streams.length) {
knownLength += this._lastBoundary().length;
}
if (!this._lengthRetrievers.length) {
process.nextTick(cb.bind(this, null, knownLength));
return;
}
async.parallel(this._lengthRetrievers, function(err, values) {
if (err) {
cb(err);
return;
}
values.forEach(function(length) {
knownLength += length;
});
cb(null, knownLength);
});
};
function netServersClose(cb) {
var tasks = [];
for (var id in cservice.locals.net.servers) {
var server = cservice.locals.net.servers[id];
if (!server.cservice || server.cservice.isReady === false)
continue;
tasks.push(createWaitForCloseTask(server));
}
if (tasks.length === 0) {
return cb();
}
async.parallel(tasks, cb);
}
case 'customFunction':
arr.push(async.apply(addCustomFunction, ctx, p13nRule[instruction]));
break;
case 'httpPostFunction':
arr.push(async.apply(addHttpPostFunction, ctx, p13nRule[instruction]));
break;
case 'mask':
arr.push(async.apply(maskFields, ctx, p13nRule[instruction]));
break;
default:
}
}
}
log.debug(ctx.req.callContext, 'returning updated context - ', ctx);
async.parallel(arr, function applyPersonalizationRuleAsyncParallelFn(err, results) {
if (err) {
callback(err);
}
callback();
});
};
var createFixtureChecks = function(callback) {
async.parallel([
function(cb) { createDummyCheck(99.95, 'Top Quality', ['good', 'all'], cb); },
function(cb) { createDummyCheck(99.85, 'Good Quality', ['good', 'all'], cb); },
function(cb) { createDummyCheck(99, 'Neun und neunzig Luftballons', ['average', 'all'], cb); },
function(cb) { createDummyCheck(80, 'My Unstable Site', ['average', 'all'], cb); },
function(cb) { createDummyCheck(70, 'The lousy site I built for Al', ['low', 'all'], cb); }
], callback);
};