Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(result => {
logger.info(`Successfully published ${publishParams.name} ${fileName}`, result);
// Support new daemon, TODO: remove
publishResults = result.output && result.output.claim_id ? result.output : result;
// get the channel information
if (publishParams.channel_name) {
logger.debug(`this claim was published in channel: ${publishParams.channel_name}`);
return db.Channel.findOne({
where: {
channelName: publishParams.channel_name,
},
});
} else {
logger.debug('this claim was not published in a channel');
return null;
}
require('./configuration/Winston');
const Server = require('./classes/Server');
const Winston = require('winston'); // error: 0, warn: 1, info: 2, verbose: 3, debug: 4, silly: 5
const roomName = process.argv[2];
Winston.info('Child process started');
Winston.info('Process id = ', process.pid);
Winston.info('Room name:', roomName);
Winston.info('Starting server...');
const server = new Server(roomName);
Winston.info('Server is running');
process.on('uncaughtException', function(err) {
Winston.error(`Caught exception: ${err}`);
});
getUsers(endpointId, accessToken, uriOverride) {
const users = [];
// Note:
// Unable to reduce the volume of data returned as
// https://graph.microsoft.com/beta/users
// ?select=id,displayName,jobTitle,department,userPrincipalName,city,state,country,mail,businessPhones,manager
// &expand=manager
// does not seem to return the manager.
// Also, query string 'filter=accountEnabled eq true' seems to cause manager to not return.
const getUsersUri = uriOverride || 'https://graph.microsoft.com/beta/users?expand=manager';
winston.info(`Retrieving ${getUsersUri} ...`);
return rp({
uri: getUsersUri,
headers: {
Authorization: `Bearer ${accessToken}`,
'Content-Type': 'application/json'
},
json: true
})
.then(res => {
users.push(...res.value.filter(x => x.accountEnabled).map(x => this.toAppUser(x)));
// Recursively follow '@odata.nextLink' on response if it exists
// to get all pages of data.
const nextLink = res['@odata.nextLink'];
client.shutdown(function (state) {
if (state === Riak.Cluster.State.SHUTDOWN) {
logger.info("cluster stopped");
process.exit();
}
});
}
async loadingTrainingData(filePath) {
logger.info('Starting load RASA NLU training data...');
let trainingFiles = getTrainingFiles(filePath);
if (trainingFiles.length === 0) {
let m = `No RASA training file found in path: ${filePath}`;
logger.debug(m);
return Promise.reject(m);
}
let finishTrainingFiles = [];
let failedTrainingFiles = [];
for (let file of trainingFiles) {
let data = jsf.readFileSync(file);
await this.rasaService.training(data, this.rasaProjectName)
.then(resp => {
finishTrainingFiles.push(file);
})
.catch(err => {
const afterEmail = (err, type, email) => {
if (err) {
return logger.error(err)
}
logger.info(`${type} report email sent to ${email}`)
}
return function (req, res, next) {
winston.info ('removing access token from the database');
AccessToken.findByIdAndRemove (req.authInfo.token_id, function (err) {
if (err)
return next (err);
res.send (200, {});
});
};
};
if (reset) {
importer.validated = null;
importer.last = null;
store.setItem('first', null);
store.setItem('validated', null);
store.setItem('last', null);
} else {
importer.validated = store.getItem('validated');
importer.last = store.getItem('last');
}
importer.first = {index : config.startIndex || 32570};
importer.remote = new ripple.Remote(options);
winston.info("first ledger: ", importer.first ? importer.first.index : "");
winston.info("last validated ledger: ", importer.validated ? importer.validated.index : "");
winston.info("latest ledger: ", importer.last ? importer.last.index : "");
importer.start = function () {
importer.remote.connect();
importer.remote.on('ledger_closed', function(resp){
winston.info("ledger closed:", resp.ledger_index);
importer.getLedger(resp.ledger_index, function(err, ledger) {
if (ledger) indexer.pingCouchDB();
});
});
importer.remote.on('connect', function() {
winston.info("connected");
Logger.prepare_io_string = function (_type, _uid, _args) {
/*
* This prepares the output string for intercepted socket.io events
*
* The format is: io:
*/
try {
return 'io: ' + _uid + ' ' + _type + ' ' + util.inspect(Array.prototype.slice.call(_args), { depth: 3 }) + '\n';
} catch (err) {
winston.info('Logger.prepare_io_string: Failed', err);
return 'error';
}
};
/** @benchmark
* push
*/
start = new Date().getTime();
for(i=0; i