New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

buzzapi

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

buzzapi - npm Package Compare versions

Comparing version

to
1.2.4

@@ -1,3 +0,4 @@

var _ = require('lodash/core');
var isEmpty = require('lodash.isempty');
var debug = require('debug')('buzzapi');
var hyperid = require('hyperid')({'fixedLength': true, 'urlSafe': true});
var os = require('os');

@@ -45,3 +46,3 @@ var request = require('requestretry');

openReqs++;
if (_.isFunction(data)) {
if (typeof data === 'function') {
callback = data;

@@ -52,5 +53,4 @@ data = {};

myOpts.url = util.format('%s/apiv3/%s/%s', server, resource, operation);
data.handle = data.handle || util.format('from-%d@%s-rand%d', process.pid, os.hostname(), Math.floor(Math.random() * 32768));
myOpts.body = _.extend(data, that.options);
myOpts.json = true;
myOpts.api_client_request_handle = data.api_client_request_handle || util.format('%d@%s-%s', process.pid, os.hostname(), hyperid());
myOpts.json = Object.assign(data, that.options);
debug('Requesting %s', JSON.stringify(myOpts));

@@ -72,3 +72,3 @@ request.post(myOpts, function(err, response, body) {

} else {
debug('Got messageId: %s', body.api_result_data);
debug('Got messageId: %s for %s', body.api_result_data, myOpts.api_client_request_handle);
unresolved[body.api_result_data] = {'resolve': res, 'reject': rej, 'callback': callback, 'initTime': new Date()};

@@ -121,3 +121,4 @@ ticket = body.api_app_ticket;

if (messageIds.length === 0) { return; }
debug('Asking for result of %s', messageIds);
let handle = util.format('%d@%s-%s', process.pid, os.hostname(), hyperid());
debug('Asking for result of %s using handle %s', messageIds, handle);
request.post({

@@ -129,3 +130,4 @@ 'url': util.format('%s/apiv3/api.my_messages', server),

'api_pull_response_to': messageIds,
'api_receive_timeout': 5000
'api_receive_timeout': 5000,
'api_client_request_handle': handle
}

@@ -187,3 +189,3 @@ }, (err, response, body) => {

}
} else if (_.isEmpty(body.api_result_data)) {
} else if (isEmpty(body.api_result_data)) {
// Empty result_data here means our data isn't ready, wait 1 to 5 seconds and try again

@@ -190,0 +192,0 @@ debug('Result not ready for ' + messageIds);

{
"name": "buzzapi",
"version": "1.2.3",
"version": "1.2.4",
"description": "Simple node library for interacting with buzzapi",

@@ -16,13 +16,15 @@ "repository": "https://github.com/stuartf/buzzapi-node.git",

"debug": "^3.1.0",
"lodash": "^4.17.5",
"requestretry": "^1.13.0"
"hyperid": "^1.4.1",
"lodash.isempty": "^4.4.0",
"request": "^2.87.0",
"requestretry": "^2.0.0"
},
"devDependencies": {
"chai": "^4.1.2",
"coveralls": "^3.0.0",
"coveralls": "^3.0.2",
"istanbul": "^0.4.5",
"mocha": "^5.0.4",
"mocha": "^5.2.0",
"mocha-lcov-reporter": "^1.3.0",
"nock": "^9.2.3"
"nock": "^9.4.2"
}
}

@@ -10,3 +10,3 @@ const expect = require('chai').expect;

const defaultBody = {'api_operation': 'read', 'api_pull_response_to': ['ABC123'], 'api_app_ticket': 'XYZ789', 'api_receive_timeout': 5000};
const defaultBody = {'api_operation': 'read', 'api_pull_response_to': ['ABC123'], 'api_app_ticket': 'XYZ789', 'api_receive_timeout': 5000, 'api_client_request_handle': /.*/};
const api = nock('https://api.gatech.edu');

@@ -13,0 +13,0 @@