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

warehouse.ai-api-client

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

warehouse.ai-api-client - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

28

index.js

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

const debug = require('diagnostics')('warehouse');

@@ -8,2 +6,3 @@ const qs = require('querystringify');

const Builds = require('./builds');
const retry = require('retryme');

@@ -34,2 +33,3 @@ /**

options = options || {};
this.retry = options.retry || {};
this.uri = options.uri;

@@ -110,12 +110,24 @@ this.auth = options.auth ? 'Bearer ' + options.auth : null;

request(options, function replied(error, response, body) {
if (error) return next(error);
//
// Ignore 404 and 400's when it comes to retries
//
const operation = retry.op(this.retry, (err) => {
return err.message.includes('404')
|| err.message.includes('400');
});
if (response.statusCode === 404) return next(new Error(`404 Not Found ${JSON.stringify(body)}`));
operation.attempt(fn => {
request(options, function replied(error, response, body) {
if (error) return fn(error);
if (response.statusCode < 200 || response.statusCode > 299) return next(new Error(`Invalid status code ${response.statusCode} ${body ? JSON.stringify(body) : ''}`));
if (response.statusCode === 404) return fn(new Error(`404 Not Found ${JSON.stringify(body)}`));
if (response.statusCode === 400) return fn(new Error(`400 Bad Request ${JSON.stringify(body)}`));
next(null, body);
});
if (response.statusCode < 200 || response.statusCode > 299) return fn(new Error(`Invalid status code ${response.statusCode} ${body ? JSON.stringify(body) : ''}`));
fn(null, body);
});
}, next);
return this;

@@ -122,0 +134,0 @@ };

{
"name": "warehouse.ai-api-client",
"description": "Node.JS API to communicate with warehouse.ai",
"version": "2.0.1",
"version": "2.1.0",
"main": "index.js",

@@ -29,3 +29,4 @@ "scripts": {

"querystringify": "0.0.3",
"request": "^2.70.0"
"request": "^2.70.0",
"retryme": "^1.0.0"
},

@@ -32,0 +33,0 @@ "devDependencies": {

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