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

@bluelilo/node-core

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bluelilo/node-core - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

44

lib/axios.js

@@ -12,2 +12,4 @@ "use strict";

var _logger = require("./logger");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -19,3 +21,3 @@

instance.interceptors.request.use(function (config) {
function applyTrackingHeaders(config) {
const correlationId = (0, _middleware.getCorrelationId)();

@@ -32,5 +34,45 @@

}
}
function applyMetadata(config) {
config.metadata = {
startTime: process.hrtime()
};
}
function logRequestTime({
config: {
url,
method,
metadata
},
status
}) {
const [seconds, nanos] = process.hrtime(metadata.startTime);
const requestTime = seconds * 1000 + nanos / 1000000;
_logger.logger.info('', {
url,
status,
method,
requestTime
});
}
instance.interceptors.request.use(function (config) {
applyTrackingHeaders(config);
applyMetadata(config);
return config;
}, function (error) {
applyTrackingHeaders(error.config);
applyMetadata(error.config);
return Promise.reject(error);
});
instance.interceptors.response.use(function (response) {
logRequestTime(response);
return response;
}, function (error) {
logRequestTime(error.response);
return Promise.reject(error);
});
const trackedAxios = instance;

@@ -37,0 +79,0 @@ exports.trackedAxios = trackedAxios;

4

lib/middleware/index.js

@@ -42,4 +42,6 @@ "use strict";

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -46,0 +48,0 @@

{
"name": "@bluelilo/node-core",
"version": "1.0.1",
"version": "1.1.0",
"description": "",

@@ -20,16 +20,16 @@ "scripts": {

"devDependencies": {
"@babel/cli": "7.5.0",
"@babel/core": "7.5.4",
"@babel/preset-env": "7.5.4",
"@babel/register": "7.4.4",
"babel-eslint": "10.0.2",
"eslint": "5.16.0",
"eslint-config-prettier": "5.1.0",
"eslint-plugin-jest": "22.7.2",
"@babel/cli": "7.7.4",
"@babel/core": "7.7.4",
"@babel/preset-env": "7.7.4",
"@babel/register": "7.7.4",
"babel-eslint": "10.0.3",
"eslint": "6.7.1",
"eslint-config-prettier": "6.7.0",
"eslint-plugin-jest": "23.0.5",
"express": "4.17.1",
"find-free-port": "2.0.0",
"jest": "24.8.0",
"prettier": "1.18.2",
"prettier-eslint": "9.0.0",
"release-it": "12.3.3"
"jest": "24.9.0",
"prettier": "1.19.1",
"prettier-eslint": "9.0.1",
"release-it": "12.4.3"
},

@@ -43,3 +43,3 @@ "dependencies": {

"url-value-parser": "2.0.1",
"uuid": "3.3.2",
"uuid": "3.3.3",
"winston": "3.2.1"

@@ -46,0 +46,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