Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should drop it', (done) => {
const ip = new noflo.IP('data', 'Foo');
setTimeout(
() => {
chai.expect(Object.keys(ip)).to.eql([]);
return done();
},
200,
);
ins.connect();
ins.send(ip);
ins.disconnect();
});
});
brackets[input.scope].forEach((bracket) => {
output.sendIP('out', new noflo.IP('closeBracket', bracket));
});
if (!agent) {
errors.push(`Agent [${agent.id}] doesn't exists`);
}
if (!domain) {
errors.push(`Domain [${domain.id}] doesn't exists`);
}
if (!action) {
errors.push(`Action [${action.id}] doesn't exists`);
}
if (errors.length > 0) {
return output.sendDone({ [PORT_ERROR]: new NoFlo.IP('data', Boom.badRequest(errors.join('\n')), { scope }) });
}
if (
(action.agent === agent.agentName) &&
(action.domain === domain.domainName)) {
return output.sendDone({ [PORT_OUT]: new NoFlo.IP('data', action, { scope }) });
}
return output.sendDone({ [PORT_ERROR]: new NoFlo.IP('data', Boom.badRequest('The specified action is not linked with this domain or agent'), { scope }) });
});
};
.then((settings) => {
return output.sendDone({ [PORT_OUT]: new NoFlo.IP('data', settings, { scope }) });
})
.catch((err) => {
.then((setting) => {
if (!setting) {
return output.sendDone({ [PORT_ERROR]: new NoFlo.IP('data', Boom.notFound(`Setting [${id}] not found`), { scope }) });
}
const settingData = setting.string_value_setting ? setting.string_value_setting : setting;
return output.sendDone({ [PORT_OUT]: new NoFlo.IP('data', settingData, { scope }) });
})
.catch((err) => {
.then((exists) => {
return output.sendDone({ [PORT_OUT]: new NoFlo.IP('data', exists, { scope }) });
})
.catch((err) => {
.then((webhook) => {
if (!webhook) {
return output.sendDone({ [PORT_ERROR]: new NoFlo.IP('data', Boom.notFound(`Webhook [${id}] not found`), { scope }) });
}
webhook.agent = agentName;
return output.sendDone({ [PORT_OUT]: new NoFlo.IP('data', webhook, { scope }) });
})
.catch((err) => {
.then((exists) => {
return output.sendDone({ [PORT_OUT]: new NoFlo.IP('data', exists, { scope }) });
})
.catch((err) => {
.catch((err) => {
return output.sendDone({ [PORT_ERROR]: new NoFlo.IP('data', Boom.internal(err.message), { scope }) });
});
});
.then((saying) => {
if (!saying) {
return output.sendDone({ [PORT_ERROR]: new NoFlo.IP('data', Boom.notFound(`Saying [${id}] not found`), { scope }) });
}
return output.sendDone({ [PORT_OUT]: new NoFlo.IP('data', saying, { scope }) });
})
.catch((err) => {