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

monti-apm-core

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monti-apm-core - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

6

CHANGELOG.md
# Change Log
## 1.7.0
March 15, 2020
* Remove request and babel-runtime dependencies
* Add `Kadira.get(path, options)`
## 1.6.0

@@ -4,0 +10,0 @@ August 12, 2020

99

dist/index.js

@@ -32,5 +32,5 @@ 'use strict';

var _request = require('request');
var _axios = require('axios');
var _request2 = _interopRequireDefault(_request);
var _axios2 = _interopRequireDefault(_axios);

@@ -108,10 +108,9 @@ var _clock = require('./clock.js');

value: function getJob(id) {
var body = { action: 'get', params: {} };
(0, _assign2.default)(body.params, { id: id });
var data = { action: 'get', params: {} };
(0, _assign2.default)(data.params, { id: id });
var url = this._options.endpoint + '/jobs';
var params = {
body: body,
headers: this._headers,
json: true
data: data,
headers: this._headers
};

@@ -125,10 +124,9 @@

value: function updateJob(id, diff) {
var body = { action: 'set', params: {} };
(0, _assign2.default)(body.params, diff, { id: id });
var data = { action: 'set', params: {} };
(0, _assign2.default)(data.params, diff, { id: id });
var url = this._options.endpoint + '/jobs';
var params = {
body: body,
headers: this._headers,
json: true
data: data,
headers: this._headers
};

@@ -150,12 +148,25 @@

var url = this._options.endpoint;
var body = (0, _stringify2.default)(payload);
var data = (0, _stringify2.default)(payload);
var params = {
body: body,
data: data,
headers: this._headers
};
logger('send data - ' + body.substr(0, 50) + '...');
logger('send data - ' + data.substr(0, 50) + '...');
return this._send(url, params);
}
}, {
key: 'get',
value: function get(path) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var url = this._options.endpoint + path;
var params = {
headers: (0, _extends3.default)({}, this._headers),
noRetry: options.noRetry
};
logger('get request to ' + url);
return this._send(url, params);
}
}, {
key: 'sendStream',

@@ -165,3 +176,3 @@ value: function sendStream(path, stream) {

var params = {
body: stream,
data: stream,
headers: (0, _extends3.default)({}, this._headers, {

@@ -187,4 +198,4 @@ 'content-type': 'application/octet-stream'

// communicates with the server with http (using fetch)
// Also handles response http status codes and retries
// communicates with the server with http
// Also handles response http status codes and retries

@@ -194,27 +205,45 @@ }, {

value: function _send(url, params) {
var retryEnabled = true;
if (params.noRetry) {
retryEnabled = false;
delete params.noRetry;
}
return (0, _retry2.default)(function () {
return new _promise2.default(function (resolve, reject) {
_request2.default.post(url, params, function (err, res, body) {
if (err) {
return reject(err);
}
(0, _axios2.default)((0, _extends3.default)({
url: url
}, params, {
method: params.method || 'POST'
})).then(function (res) {
return resolve(res.data);
}).catch(function (err) {
if (err.response && err.response.status) {
var status = err.response.status;
if (res.statusCode === 200) {
return resolve(body);
}
if (status === 401) {
logger('Error: Unauthorized');
return reject(new _retry.ByPassRetryError('Unauthorized'));
} else if (status >= 400 && status < 500) {
var _message = 'Agent Error: ' + status;
logger('Error: ' + _message);
return reject(new _retry.ByPassRetryError(_message));
}
if (res.statusCode === 401) {
logger('Error: Unauthorized');
return reject(new _retry.ByPassRetryError('Unauthorized'));
var message = 'Request failed: ' + status;
var ErrConstructor = retryEnabled ? Error : _retry.ByPassRetryError;
logger('Error: ' + message);
return reject(new ErrConstructor(message));
}
if (res.statusCode >= 400 && res.statusCode < 500) {
var _message = 'Agent Error: ' + res.statusCode;
logger('Error: ' + _message);
return reject(new _retry.ByPassRetryError(_message));
if (!retryEnabled) {
var oldErr = err;
// eslint-disable-next-line no-param-reassign
err = new _retry.ByPassRetryError(oldErr.message);
err.stack = oldErr.stack;
}
var message = 'Request failed: ' + res.statusCode;
logger('Error: ' + message);
reject(new Error(message));
return reject(err);
});

@@ -221,0 +250,0 @@ });

{
"name": "monti-apm-core",
"version": "1.6.0",
"version": "1.7.0",
"description": "Monti APM Core API",

@@ -17,3 +17,3 @@ "main": "./dist/",

"prepublish": "./node_modules/.bin/babel --plugins \"transform-runtime\" lib --ignore __tests__ --out-dir ./dist",
"lint": "./node_modules/.bin/eslint ./lib",
"lint": "./node_modules/.bin/eslint ./lib --cache",
"lintfix": "./node_modules/.bin/eslint ./lib --fix",

@@ -52,7 +52,5 @@ "testonly": "mocha --require scripts/mocha-bootload lib/**/__tests__/**/*.js",

"dependencies": {
"axios": "^0.19.2",
"babel-runtime": "6.x.x",
"debug": "^3.2.6",
"request": "2.x.x"
"axios": "^0.21.1",
"debug": "^3.2.6"
}
}
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