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

@best/api-db

Package Overview
Dependencies
Maintainers
3
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@best/api-db - npm Package Compare versions

Comparing version 5.0.4 to 5.1.0

43

build/rest/frontend/index.js

@@ -13,3 +13,4 @@ "use strict";

const types_1 = require("../../types");
const node_fetch_1 = __importDefault(require("node-fetch"));
const https_1 = __importDefault(require("https"));
const https_proxy_agent_1 = __importDefault(require("https-proxy-agent"));
/**

@@ -24,15 +25,41 @@ * An implementation for a REST-based DB adapter.

}
request(url, options, payload) {
return new Promise((resolve, reject) => {
// The 'https' library does not natively support requests over a proxy.
// We can still add proxy support by setting `options.agent` to an instance of `https-proxy-agent` agent.
// More details on what an agent is responsible for can be found here: https://nodejs.org/docs/latest-v14.x/api/http.html#http_class_http_agent
const proxy = process.env.HTTP_PROXY;
if (proxy) {
// @ts-ignore
options.agent = new https_proxy_agent_1.default(proxy);
}
const req = https_1.default.request(url, options, (response) => {
let responseBody = '';
response.on('data', (chunk) => {
responseBody += chunk;
});
response.on('end', () => {
resolve({ ok: true, body: responseBody });
});
});
req.on('error', (error) => {
reject({ ok: false, error });
});
req.write(payload);
req.end();
});
}
async saveSnapshots(snapshots, projectName) {
const requestUrl = `${this.config.uri}/api/v1/${projectName}/snapshots`;
const response = await node_fetch_1.default(requestUrl, {
method: 'post',
body: JSON.stringify(snapshots),
const payload = JSON.stringify(snapshots);
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${this.config.token}`
},
});
// Log the response body for troubleshooting purposes
}
};
const response = await this.request(requestUrl, options, payload);
if (!response.ok) {
console.error(await response.text());
console.error(response.error);
return false;

@@ -39,0 +66,0 @@ }

5

package.json

@@ -8,5 +8,5 @@ {

},
"version": "5.0.4",
"version": "5.1.0",
"dependencies": {
"node-fetch": "~2.6.1",
"https-proxy-agent": "^5.0.0",
"pg": "^8.4.1",

@@ -16,3 +16,2 @@ "sqlite": "^3.0.3"

"devDependencies": {
"@types/node-fetch": "2.5.12",
"@types/pg": "^7.4.14"

@@ -19,0 +18,0 @@ },

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