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

mailgun-js

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailgun-js - npm Package Compare versions

Comparing version 0.7.15 to 0.8.0

31

lib/build.js
var inflection = require('inflection');
var pathProxy = require('path-proxy');
var Q = require('q');
var promisifyCall = require('promisify-call');

@@ -34,5 +34,3 @@ var noop = function () {

constructor.prototype[getName(actionName)] = function (data, fn) {
var deferred = Q.defer();
function impl (data, fn) {
var requestPath = action.href;

@@ -46,4 +44,2 @@ var pathParams = action.href.match(/{[^}]+}/g) || [];

if (!fn) fn = noop;
var err;

@@ -53,3 +49,3 @@

err = new Error('Invalid number of params in path (expected ' + pathParams.length + ', got ' + this.params.length + ').');
return rejectError(err, deferred, fn);
return fn(err);
}

@@ -78,3 +74,3 @@

if (err) {
return rejectError(err, deferred, fn);
return fn(err);
}

@@ -101,3 +97,3 @@

if (err) {
return rejectError(err, deferred, fn);
return fn(err);
}

@@ -107,12 +103,9 @@

return this.client.request(action.method, requestPath, data, fn);
}
constructor.prototype[getName(actionName)] = function (data, fn) {
return promisifyCall(this, impl, data, fn);
};
}
;
};
function rejectError(err, deferred, fn) {
deferred.reject(err);
fn(err);
return deferred.promise;
}
function getName(name) {

@@ -130,5 +123,1 @@ name = name.toLowerCase();

};

@@ -5,3 +5,2 @@ var https = require('https');

var qs = require('querystring');
var q = require('q');
var fs = require('fs');

@@ -12,2 +11,3 @@ var Readable = require('stream').Readable;

var retry = require('async').retry;
var promisifyCall = require('promisify-call');

@@ -34,14 +34,5 @@ var debug = require('debug')('mailgun-js');

Request.prototype.request = function (method, resource, data, fn) {
this.deferred = q.defer();
Request.prototype._request = function (method, resource, data, fn) {
var self = this;
if (typeof data === 'function' && !fn) {
fn = data;
data = {};
}
if (!fn) fn = noop;
var path = ''.concat(this.endpoint, resource);

@@ -94,13 +85,2 @@

function finalCb(error, body) {
if (error) {
self.deferred.reject(error);
}
else {
self.deferred.resolve(body);
}
return fn(error, body);
}
if (this.retry > 1) {

@@ -110,10 +90,21 @@ retry(this.retry, function (retryCb) {

self.performRequest(opts);
}, finalCb);
}, fn);
}
else {
this.callback = finalCb;
this.callback = fn;
this.performRequest(opts);
}
}
return this.deferred.promise;
Request.prototype.request = function (method, resource, data, fn) {
if (typeof data === 'function' && !fn) {
fn = data;
data = {};
}
if (!data) {
data = {}
}
return promisifyCall(this, this._request, method, resource, data, fn);
};

@@ -120,0 +111,0 @@

@@ -8,3 +8,3 @@ {

],
"version": "0.7.15",
"version": "0.8.0",
"homepage": "https://github.com/bojand/mailgun-js",

@@ -20,3 +20,3 @@ "license": "MIT",

"engines": {
"node": ">= 0.8.0"
"node": ">=6.9"
},

@@ -31,4 +31,4 @@ "main": "./lib/mailgun.js",

"path-proxy": "~1.0.0",
"promisify-call": "^2.0.2",
"proxy-agent": "~2.0.0",
"q": "~1.4.0",
"tsscmp": "~1.0.0"

@@ -53,3 +53,6 @@ },

"docs:publish": "npm run docs:build && cd _book && git init && git commit --allow-empty -m 'Update docs' && git checkout -b gh-pages && git add . && git commit -am 'Update docs' && git push https://github.com/bojand/mailgun-js.git gh-pages --force"
},
"directories": {
"test": "test"
}
}

@@ -5,3 +5,4 @@ {

"api_key_mg": "key-3ax6xnjp29jd6fds4gc373sgvjxteol0",
"domain_mg": "samples.mailgun.org"
"domain_mg": "samples.mailgun.org",
"public_api_key": "pubkey-9etago7vl-weiziizr5jbvzm0np7k245"
}
{
"message": {
"to": "mailgunjstest+send@gmail.com",
"to": "mailgunjs+test1@gmail.com",
"from": "mailgunjstest+recv1@gmail.com",

@@ -10,4 +10,4 @@ "subject": "Test email subject",

"to": [
"mailgunjstest+recv1@gmail.com",
"mailgunjstest+recv2@gmail.com"
"mailgunjs+test1@gmail.com",
"mailgunjs+test2@gmail.com"
],

@@ -18,7 +18,7 @@ "from": "mailgunjstest+send@gmail.com",

"recipient-variables": {
"mailgunjstest+recv1@gmail.com": {
"mailgunjs+test1@gmail.com": {
"first": "Bob",
"id": 1
},
"mailgunjstest+recv2@gmail.com": {
"mailgunjs+test2@gmail.com": {
"first": "Alice",

@@ -25,0 +25,0 @@ "id": 2

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