Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hubot-jira-issue-fetcher

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hubot-jira-issue-fetcher - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

.eslintrc.yml

5

hubot.js

@@ -14,3 +14,3 @@ 'use strict';

var configuration = {
host: process.env.JIRA_HOST,
jiraHost: process.env.JIRA_HOST,
projectsKeys: process.env.JIRA_PROJECTS_KEYS.split(','),

@@ -27,3 +27,3 @@ jiraUser: process.env.JIRA_USER,

var parser = (0, _messageParser2.default)(configuration);
robot.listen(function (message) {
robot.listen(function () {
return true;

@@ -34,2 +34,3 @@ }, function (res) {

needDetailedInfo = isDirectMessage(message, robot);
parser.parse(message, needDetailedInfo).then(function (attachments) {

@@ -36,0 +37,0 @@ if (attachments) {

4

lib/issueMessageFormatter.js

@@ -23,3 +23,3 @@ 'use strict';

title: issue.key + ': ' + issue.fields.summary,
title_link: 'https://' + config.host + '/browse/' + issue.key,
title_link: 'https://' + config.jiraHost + '/browse/' + issue.key,
text: issue.fields.description,

@@ -38,3 +38,3 @@ fields: [{

color: getColorForStatus(issue.fields.status.name),
text: '<https://' + config.host + '/browse/' + issue.key + '|' + issue.key + '> `' + issue.fields.status.name + '` ' + issue.fields.summary,
text: '<https://' + config.jiraHost + '/browse/' + issue.key + '|' + issue.key + '> `' + issue.fields.status.name + '` ' + issue.fields.summary,
mrkdwn_in: ['text']

@@ -41,0 +41,0 @@ };

@@ -8,34 +8,14 @@ 'use strict';

exports.default = function (config) {
var AUTH = new Buffer(config.jiraUser + ':' + config.jiraPwd).toString('base64');
var jiraRestEndpoint = 'https://' + config.host + '/rest';
var jira = new _jiraClient2.default({
protocol: 'https',
host: config.jiraHost,
username: config.jiraUser,
password: config.jiraPwd,
apiVersion: '2',
strictSSL: true
});
function _getIssue(params) {
var getUrl = jiraRestEndpoint + '/api/2/issue/' + params.key;
return (0, _got2.default)(getUrl, {
json: true,
headers: {
'Authorization': 'Basic ' + params.auth,
'user-agent': 'AirVantasge JIRA bot'
}
}).then(function (res) {
return res.body;
});
}
function _getIssuesByKeys(keys) {
var searchUrl = jiraRestEndpoint + '/api/2/search';
var searchQuery = {
jql: 'key in (' + keys.join(',') + ')'
};
return _got2.default.post(searchUrl, {
json: true,
body: JSON.stringify(searchQuery),
headers: {
'Authorization': 'Basic ' + AUTH,
'user-agent': 'AirVantage slack bot',
'Content-type': 'application/json'
}
}).then(function (res) {
return res.body.issues;
return jira.searchJira('key in (' + keys.join(',') + ')').then(function (res) {
return res.issues;
});

@@ -45,5 +25,2 @@ }

return {
getIssue: function getIssue(params) {
return _getIssue(params);
},
getIssuesByKeys: function getIssuesByKeys(keys) {

@@ -55,8 +32,6 @@ return _getIssuesByKeys(keys);

var _got = require('got');
var _jiraClient = require('jira-client');
var _got2 = _interopRequireDefault(_got);
var _jiraClient2 = _interopRequireDefault(_jiraClient);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -27,9 +27,11 @@ 'use strict';

});
var detailedInfo = void 0;
function _extractIssueKeys(message) {
var messageChunks = message ? message.split(" ") : [];
return _lodash2.default.chain(messageChunks).map(function (chunk) {
var keys = _lodash2.default.chain(messageChunks).map(function (chunk) {
return _lodash2.default.map(config.projectsKeys, function (projectKey) {
// Issue key detected
if (chunk.indexOf(projectKey) === 0) {
if (chunk.indexOf(projectKey + '-') === 0) {
return chunk;

@@ -40,6 +42,10 @@ }

if (chunk.indexOf(projectKey) !== -1) {
return chunk.split('https://' + config.host + '/browse/')[1];
return chunk.split('https://' + config.jiraHost + '/browse/')[1];
}
});
}).flatten().compact().value();
detailedInfo = detailedInfo || keys && messageChunks.length === keys.length;
return keys;
}

@@ -56,2 +62,3 @@

parse: function parse(message, needDetailedInfo) {
detailedInfo = needDetailedInfo;
var issueKeys = _extractIssueKeys(message);

@@ -62,3 +69,3 @@

var messages = void 0;
if (needDetailedInfo) {
if (detailedInfo) {
messages = messageFormatter.buildDetailedMessages(issues);

@@ -65,0 +72,0 @@ } else {

{
"name": "hubot-jira-issue-fetcher",
"version": "1.0.0",
"version": "1.1.0",
"description": "Bot fetching JIRA issue details",

@@ -16,2 +16,3 @@ "main": "index.js",

"got": "^6.6.3",
"jira-client": "^4.2.0",
"lodash": "^4.17.2"

@@ -24,2 +25,3 @@ },

"babel-preset-latest": "^6.16.0",
"eslint": "^3.14.0",
"grunt": "^1.0.1",

@@ -26,0 +28,0 @@ "grunt-release": "^0.14.0"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc