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

notification-processor

Package Overview
Dependencies
Maintainers
6
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

notification-processor - npm Package Compare versions

Comparing version 1.10.4 to 1.11.0

notification-processor.sublime-workspace

61

lib/processors/request.processor.js
(function() {
var MESSAGE_PROPERTIES, RequestError, StatusCodeError, _, _retrieveMessage, _safeParse, ref, request;
var MESSAGE_PROPERTIES, Promise, RequestError, StatusCodeError, _, _retrieveMessage, _safeParse, ref, request;
_ = require("lodash");
Promise = require("bluebird");
request = require("request-promise");

@@ -30,34 +32,35 @@

return function(notification) {
var __isSilentError, options;
var __isSilentError;
__isSilentError = function(err) {
return err.constructor === StatusCodeError && _.includes(silentErrors, err.statusCode);
};
options = requestGenerator(notification);
return request(options).promise()["catch"](__isSilentError, function(err) {
return _.omit(err, "response");
})["catch"](StatusCodeError, function(arg1) {
var error, statusCode;
statusCode = arg1.statusCode, error = arg1.error;
throw {
message: _(_safeParse(error)).pick(MESSAGE_PROPERTIES).values().map(_retrieveMessage).compact().head(),
detail: {
response: {
statusCode: statusCode,
body: error
return Promise.method(requestGenerator)(notification).then(function(options) {
return request(options).promise()["catch"](__isSilentError, function(err) {
return _.omit(err, "response");
})["catch"](StatusCodeError, function(arg1) {
var error, statusCode;
statusCode = arg1.statusCode, error = arg1.error;
throw {
message: _(_safeParse(error)).pick(MESSAGE_PROPERTIES).values().map(_retrieveMessage).compact().head(),
detail: {
response: {
statusCode: statusCode,
body: error
}
}
}
};
})["catch"](RequestError, function(arg1) {
var cause;
cause = arg1.cause;
throw {
message: cause.code,
detail: cause
};
}).tapCatch(function(err) {
return _.defaultsDeep(err, {
message: "unknown",
detail: {
request: options
}
};
})["catch"](RequestError, function(arg1) {
var cause;
cause = arg1.cause;
throw {
message: cause.code,
detail: cause
};
}).tapCatch(function(err) {
return _.defaultsDeep(err, {
message: "unknown",
detail: {
request: options
}
});
});

@@ -64,0 +67,0 @@ });

(function() {
var DOMAIN, MESSAGE, PATH, RequestProcessor, errors, nock, nockStub, req, should, sinon;
var DOMAIN, MESSAGE, PATH, Promise, RequestProcessor, errors, nock, nockStub, req, should, sinon;

@@ -14,2 +14,4 @@ nock = require("nock");

Promise = require("bluebird");
RequestProcessor = require("./request.processor");

@@ -55,3 +57,3 @@

});
return it("should do a POST request and its should be ignored if is a silent errors", function() {
it("should do a POST request and its should be ignored if is a silent errors", function() {
var nockDomain, spy;

@@ -68,2 +70,16 @@ nockDomain = nockStub().reply(409, {});

});
return it("should do a POST request event if is called with a promise and it should be successful", function() {
var nockDomain, spy;
nockDomain = nockStub().reply(200, {});
spy = sinon.spy((function(_this) {
return function() {
return Promise.resolve(req());
};
})(this));
return RequestProcessor(spy)(MESSAGE).should.be.fulfilled().tap(function() {
return nockDomain.done();
}).tap(function() {
return spy.should.be.calledWith(MESSAGE);
});
});
});

@@ -70,0 +86,0 @@

{
"name": "notification-processor",
"version": "1.10.4",
"version": "1.11.0",
"description": "notification-processor",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -0,0 +0,0 @@ # notification-processor

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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