Comparing version 2.1.1 to 2.2.0
@@ -45,34 +45,19 @@ "use strict"; | ||
key: "checkBalance", | ||
value: function checkBalance() { | ||
this._nexmo.checkBalance.apply(this._nexmo, arguments); | ||
value: function checkBalance(callback) { | ||
return this.options.rest.get("/account/get-balance", callback); | ||
} | ||
/** | ||
* TODO: document | ||
*/ | ||
}, { | ||
key: "updatePassword", | ||
value: function updatePassword() { | ||
this._nexmo.changePassword.apply(this._nexmo, arguments); | ||
value: function updatePassword(newSecret, callback) { | ||
return this.options.rest.postUseQueryString("/account/settings", { newSecret: newSecret }, callback); | ||
} | ||
/** | ||
* TODO: document | ||
*/ | ||
}, { | ||
key: "updateSMSCallback", | ||
value: function updateSMSCallback() { | ||
this._nexmo.changeMoCallbackUrl.apply(this._nexmo, arguments); | ||
value: function updateSMSCallback(moCallBackUrl, callback) { | ||
return this.options.rest.postUseQueryString("/account/settings", { moCallBackUrl: moCallBackUrl }, callback); | ||
} | ||
/** | ||
* TODO: document | ||
*/ | ||
}, { | ||
key: "updateDeliveryReceiptCallback", | ||
value: function updateDeliveryReceiptCallback() { | ||
this._nexmo.changeDrCallbackUrl.apply(this._nexmo, arguments); | ||
value: function updateDeliveryReceiptCallback(drCallBackUrl, callback) { | ||
return this.options.rest.postUseQueryString("/account/settings", { drCallBackUrl: drCallBackUrl }, callback); | ||
} | ||
@@ -91,2 +76,2 @@ }, { | ||
module.exports = exports["default"]; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9BY2NvdW50LmpzIl0sIm5hbWVzIjpbIkFjY291bnQiLCJjcmVkZW50aWFscyIsIm9wdGlvbnMiLCJjcmVkcyIsIl9uZXhtbyIsIm5leG1vT3ZlcnJpZGUiLCJpbml0aWFsaXplIiwiYXBpS2V5IiwiYXBpU2VjcmV0IiwiY2hlY2tCYWxhbmNlIiwiYXBwbHkiLCJhcmd1bWVudHMiLCJjaGFuZ2VQYXNzd29yZC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uICAgICAgeyBkckNhbGxCYWNrVXJsIH0sXG4gICAgICBjYWxsYmFja1xuICAgICk7XG4gIH1cblxuICB0b3BVcCh0cngsIGNhbGxiYWNrKSB7XG4gICAgcmV0dXJuIHRoaXMub3B0aW9ucy5yZXN0LnBvc3RVc2VRdWVyeVN0cmluZyhcbiAgICAgIFwiL2FjY291bnQvdG9wLXVwXCIsXG4gICAgICB7IHRyeCB9LFxuICAgICAgY2FsbGJhY2tcbiAgICApO1xuICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IEFjY291bnQ7XG4iXX0= |
@@ -13,2 +13,3 @@ "use strict"; | ||
var http = require("http"); | ||
var request = require("request"); | ||
var querystring = require("querystring"); | ||
@@ -30,2 +31,4 @@ | ||
this.logger = options.logger; | ||
this.timeout = options.timeout; | ||
this.requestLib = request; | ||
@@ -42,2 +45,4 @@ if (options.userAgent) { | ||
var skipJsonParsing = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | ||
if (typeof method === "function") { | ||
@@ -64,2 +69,6 @@ callback = method; | ||
if (this.timeout !== undefined) { | ||
options.timeout = this.timeout; | ||
} | ||
// Allow existing headers to be overridden | ||
@@ -79,3 +88,3 @@ // Allow new headers to be added | ||
} else { | ||
request = http.request(options); | ||
request = this.http.request(options); | ||
} | ||
@@ -106,3 +115,3 @@ | ||
_this.__parseResponse(response, responseData, endpoint.method, callback); | ||
_this.__parseResponse(response, responseData, endpoint.method, callback, skipJsonParsing); | ||
} | ||
@@ -124,3 +133,3 @@ }); | ||
key: "__parseResponse", | ||
value: function __parseResponse(httpResponse, data, method, callback) { | ||
value: function __parseResponse(httpResponse, data, method, callback, skipJsonParsing) { | ||
var isArrayOrBuffer = data instanceof Array || data instanceof Buffer; | ||
@@ -155,3 +164,7 @@ if (!isArrayOrBuffer) { | ||
} else if (method !== "DELETE") { | ||
response = JSON.parse(data.join("")); | ||
if (!!skipJsonParsing) { | ||
response = data.join(""); | ||
} else { | ||
response = JSON.parse(data.join("")); | ||
} | ||
} else { | ||
@@ -197,17 +210,94 @@ response = data; | ||
value: function get(path, params, callback) { | ||
var useJwt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | ||
if (!callback) { | ||
if (typeof params == "function") { | ||
callback = params; | ||
params = {}; | ||
} | ||
} | ||
params = params || {}; | ||
params["api_key"] = this.credentials.apiKey; | ||
params["api_secret"] = this.credentials.apiSecret; | ||
if (!useJwt) { | ||
params["api_key"] = this.credentials.apiKey; | ||
params["api_secret"] = this.credentials.apiSecret; | ||
} | ||
path = path + "?" + querystring.stringify(params); | ||
this.request({ path: path }, "GET", callback); | ||
var headers = { "Content-Type": "application/json" }; | ||
if (useJwt) { | ||
headers["Authorization"] = "Bearer " + this.credentials.generateJwt(); | ||
} | ||
this.request({ path: path, headers: headers }, "GET", callback); | ||
} | ||
}, { | ||
key: "delete", | ||
value: function _delete(path, callback, useJwt) { | ||
var params = {}; | ||
if (!useJwt) { | ||
params["api_key"] = this.credentials.apiKey; | ||
params["api_secret"] = this.credentials.apiSecret; | ||
} | ||
path = path + "?" + querystring.stringify(params); | ||
this.request({ path: path }, "DELETE", callback); | ||
} | ||
}, { | ||
key: "postFile", | ||
value: function postFile(path, options, callback, useJwt) { | ||
var qs = {}; | ||
if (!useJwt) { | ||
qs["api_key"] = this.credentials.apiKey; | ||
qs["api_secret"] = this.credentials.apiSecret; | ||
} | ||
if (Object.keys(qs).length) { | ||
var joinChar = "?"; | ||
if (path.indexOf(joinChar) !== -1) { | ||
joinChar = "&"; | ||
} | ||
path = path + joinChar + querystring.stringify(qs); | ||
} | ||
var file = options.file; | ||
delete options.file; // We don't send this as metadata | ||
var formData = {}; | ||
if (file) { | ||
formData["filedata"] = { | ||
value: file, | ||
options: { | ||
filename: options.filename || null | ||
} | ||
}; | ||
} | ||
if (options.info) { | ||
formData.info = JSON.stringify(options.info); | ||
} | ||
if (options.url) { | ||
formData.url = options.url; | ||
} | ||
this.requestLib.post({ | ||
url: "https://" + this.host + path, | ||
formData: formData, | ||
headers: { | ||
Authorization: "Bearer " + this.credentials.generateJwt() | ||
} | ||
}, callback); | ||
} | ||
}, { | ||
key: "post", | ||
value: function post(path, params, callback) { | ||
var qs = { | ||
api_key: this.credentials.apiKey, | ||
api_secret: this.credentials.apiSecret | ||
}; | ||
value: function post(path, params, callback, useJwt) { | ||
var qs = {}; | ||
if (!useJwt) { | ||
qs["api_key"] = this.credentials.apiKey; | ||
qs["api_secret"] = this.credentials.apiSecret; | ||
} | ||
@@ -225,6 +315,8 @@ var joinChar = "?"; | ||
key: "postUseQueryString", | ||
value: function postUseQueryString(path, params, callback) { | ||
value: function postUseQueryString(path, params, callback, useJwt) { | ||
params = params || {}; | ||
params["api_key"] = this.credentials.apiKey; | ||
params["api_secret"] = this.credentials.apiSecret; | ||
if (!useJwt) { | ||
params["api_key"] = this.credentials.apiKey; | ||
params["api_secret"] = this.credentials.apiSecret; | ||
} | ||
@@ -242,2 +334,2 @@ path = path + "?" + querystring.stringify(params); | ||
module.exports = exports["default"]; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9IdHRwQ2xpZW50LmpzIl0sIm5hbWVzIjpbImh0dHBzIiwicmVxdWlyZSIsImh0dHAiLCJxdWVyeXN0cmluZyIsIkh0dHBDbGllbnQiLCJvcHRpb25zIiwiY3JlZGVudGlhbHMiLCJob3N0IiwicG9ydCIsImhlYWRlcnMiLCJBY2NlcHQiLCJsb2dnZXIiLCJ1c2VyQWdlbnQiLCJlbmRwb2ludCIsIm1ldGhvZCIsImNhbGxiYWNrIiwicGF0aCIsIk9iamVjdCIsImFzc2lnbiIsImtleXMiLCJmb3JFYWNoIiwia2V5IiwiaW5mbyIsImJvZHkiLCJyZXF1ZXN0IiwiZW5kIiwicmVzcG9uc2VEYXRhIiwib24iLCJpc0JpbmFyeSIsInJlc3BvbnNlIiwic2V0RW5jb2RpbmciLCJwdXNoIiwiY2h1bmsiLCJzdGF0d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lzLmNyZWRlbnRpYWxzLmFwaUtleTtcbiAgICAgIHBhcmFtc1tcImFwaV9zZWNyZXRcIl0gPSB0aGlzLmNyZWRlbnRpYWxzLmFwaVNlY3JldDtcbiAgICB9XG5cbiAgICBwYXRoID0gcGF0aCArIFwiP1wiICsgcXVlcnlzdHJpbmcuc3RyaW5naWZ5KHBhcmFtcyk7XG5cbiAgICB0aGlzLnJlcXVlc3QoeyBwYXRoOiBwYXRoIH0sIFwiUE9TVFwiLCBjYWxsYmFjayk7XG4gIH1cbn1cblxuZXhwb3J0IGRlZmF1bHQgSHR0cENsaWVudDtcbiJdfQ== |
@@ -65,2 +65,6 @@ "use strict"; | ||
var _Media = require("./Media"); | ||
var _Media2 = _interopRequireDefault(_Media); | ||
var _HttpClient = require("./HttpClient"); | ||
@@ -141,2 +145,3 @@ | ||
this.conversion = new _Conversion2.default(this.credentials, this.options); | ||
this.media = new _Media2.default(this.credentials, this.options); | ||
@@ -202,2 +207,2 @@ /** | ||
module.exports = exports["default"]; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9OZXhtby5qcyJdLCJuYW1lcyI6WyJqd3RHZW5lcmF0b3JJbnN0YW5jZSIsIk5leG1vIiwiY3JlZGVudGlhbHMiLCJvcHRpb25zIiwiZGVidWciLCJwYXJzZSIsImxvZ2dlciIsInVzZXJBZ2VudCIsInBhY2thZ2VEZXRhaWxzIiwicmVxdWlyZSIsImpvaW4iLCJfX2Rpcm5hbWUiLCJ2ZXJzaW9uIiwicHJvY2VzcyIsInJlcGxhY2UiLCJlIiwiY29uc29sZSIsIndhcm4iLCJhcHBlbmRUb1VzZXJBZ2VudCIsImh0dHBDbGllbnQiLCJPYmplY3QiLCJhc3NpZ24iLCJob3N0IiwiYXBpIiwicmVzdCIsIm1lc3NhZ2UiLCJ2b2ljZSIsIm51bWJlciIsInZlcmlmeSIsIm51bWJlckluc2lnaHQiLCJhcHBs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4gKiBAcmV0dXJucyB7U3RyaW5nfSB0aGUgZ2VuZXJhdGVkIHRva2VuXG4gKi9cbk5leG1vLmdlbmVyYXRlSnd0ID0gKHByaXZhdGVLZXksIGNsYWltcykgPT4ge1xuICBpZiAoIShwcml2YXRlS2V5IGluc3RhbmNlb2YgQnVmZmVyKSkge1xuICAgIGlmICghZnMuZXhpc3RzU3luYyhwcml2YXRlS2V5KSkge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKGBGaWxlIFwiJHtwcml2YXRlS2V5fVwiIG5vdCBmb3VuZC5gKTtcbiAgICB9IGVsc2Uge1xuICAgICAgcHJpdmF0ZUtleSA9IGZzLnJlYWRGaWxlU3luYyhwcml2YXRlS2V5KTtcbiAgICB9XG4gIH1cbiAgcmV0dXJuIGp3dEdlbmVyYXRvckluc3RhbmNlLmdlbmVyYXRlKHByaXZhdGVLZXksIGNsYWltcyk7XG59O1xuXG5leHBvcnQgZGVmYXVsdCBOZXhtbztcbiJdfQ== |
{ | ||
"name": "nexmo", | ||
"author": "nexmo", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"main": "lib/Nexmo", | ||
@@ -69,2 +69,3 @@ "keywords": [ | ||
"jsonwebtoken": "^7.1.9", | ||
"request": "^2.83.0", | ||
"uuid": "^2.0.2" | ||
@@ -71,0 +72,0 @@ }, |
@@ -53,3 +53,5 @@ # Nexmo Client Library for Node.js [![build status](https://secure.travis-ci.org/Nexmo/nexmo-node.png)](http://travis-ci.org/Nexmo/nexmo-node) | ||
warn: function() {args...} | ||
} | ||
}, | ||
// Set a custom timeout for requests to Nexmo in milliseconds. Defaults to the standard for Node http requests, which is 120,000 ms. | ||
timeout: integer | ||
} | ||
@@ -514,2 +516,58 @@ ``` | ||
## Creating your own requests | ||
> !!!IMPORTANT!!! This section uses internal APIs and should not be relied on. We make no guarantees that the interface is stable. Relying on these methods is not recommended for production applications | ||
For endpoints that are not yet implemented, you can use the Nexmo HTTP Client to | ||
make requests with the correct authentication method. | ||
In these examples, we assume that you've created a `nexmo` instance as follows: | ||
```javascript | ||
var nexmo = new Nexmo({ | ||
apiKey: 'API_KEY', | ||
apiSecret: 'API_SECRET', | ||
applicationId: 'APPLICATION_ID', | ||
privateKey: './private.key', | ||
}); | ||
``` | ||
* If your API endpoint is on `api.nexmo.com`, use the `nexmo.options.api` object. | ||
* If your API endpoint is on `rest.nexmo.com`, use the `nexmo.options.rest` object. | ||
Both of these objects expose the following methods: | ||
* `get(path, params, callback, useJwt)` (`params` is the query string to use) | ||
* `post(path, params, callback, useJwt)` (`params` is the POST body to send) | ||
* `postUseQueryString(path, params, callback, useJwt)` (`params` is the query string to use) | ||
* `delete(path, callback, useJwt)` | ||
To make a request to `api.nexmo.com/v1/calls?status=rejected`: | ||
```javascript | ||
nexmo.options.api.get( | ||
"/v1/calls", | ||
{"status": "rejected"}, | ||
function(err, data){ | ||
console.log(err); | ||
console.log(data); | ||
}, | ||
true // Use JWT for authentication | ||
); | ||
``` | ||
To make a request to `rest.nexmo.com/sms/json?from=Demo&to=447700900000&text=Testing`: | ||
```javascript | ||
nexmo.options.rest.postUseQueryString( | ||
"/sms/json", | ||
{"from": "Demo", "to": "447700900000", "text": "Testing"}, | ||
function(err, data){ | ||
console.log(err); | ||
console.log(data); | ||
}, | ||
false // Don't use JWT, fall back to API key/secret | ||
); | ||
``` | ||
## API Coverage | ||
@@ -563,2 +621,9 @@ | ||
* [x] Update | ||
* Media | ||
* [x] Upload | ||
* [x] Download | ||
* [x] Search | ||
* [x] Get | ||
* [x] Update | ||
* [x] Delete | ||
* Voice (Deprecated) | ||
@@ -565,0 +630,0 @@ * [x] Outbound Calls |
import Account from "../lib/Account"; | ||
import Credentials from "../lib/Credentials"; | ||
import HttpClient from "../lib/HttpClient"; | ||
import NullLogger from "../lib/ConsoleLogger.js"; | ||
import { expect, sinon, TestUtils } from "./NexmoTestUtils"; | ||
import ResourceTestHelper from "./ResourceTestHelper"; | ||
import NexmoStub from "./NexmoStub"; | ||
describe("Account", function() { | ||
beforeEach(function() { | ||
this.httpClientStub = TestUtils.getHttpClient(); | ||
sinon.stub(this.httpClientStub, "request"); | ||
this.account = new Account(TestUtils.getCredentials(), { | ||
rest: this.httpClientStub | ||
}); | ||
}); | ||
import sinon from "sinon"; | ||
import chai, { expect } from "chai"; | ||
import sinonChai from "sinon-chai"; | ||
chai.use(sinonChai); | ||
describe("checkBalance", function() { | ||
it("should call the correct endpoint", function() { | ||
return expect(this.account) | ||
.method("checkBalance") | ||
.to.get.url("/account/get-balance"); | ||
}); | ||
}); | ||
var accountAPIs = { | ||
checkBalance: "checkBalance", | ||
changePassword: "updatePassword", | ||
changeMoCallbackUrl: "updateSMSCallback", | ||
changeDrCallbackUrl: "updateDeliveryReceiptCallback" | ||
}; | ||
describe("Account Object", function() { | ||
it("should implement all v1 APIs", function() { | ||
NexmoStub.checkAllFunctionsAreDefined(accountAPIs, Account); | ||
describe("updatePassword", function() { | ||
it("should call the correct endpoint", function() { | ||
return expect(this.account) | ||
.method("updatePassword") | ||
.withParams("example_password") | ||
.to.post.to.url("/account/settings?newSecret=example_password"); | ||
}); | ||
}); | ||
it("should proxy the function call to the underlying `nexmo` object", function() { | ||
NexmoStub.checkAllFunctionsAreCalled(accountAPIs, Account); | ||
describe("updateSMSCallback", function() { | ||
it("should call the correct endpoint", function() { | ||
return expect(this.account) | ||
.method("updateSMSCallback") | ||
.withParams("http://example.com/sms_callback") | ||
.to.post.to.url( | ||
"/account/settings?moCallBackUrl=http%3A%2F%2Fexample.com%2Fsms_callback" | ||
); | ||
}); | ||
}); | ||
}); | ||
describe("Account", function() { | ||
beforeEach(function() { | ||
var creds = Credentials.parse({ | ||
apiKey: "myKey", | ||
apiSecret: "mySecret" | ||
describe("updateDeliveryReceiptCallback", function() { | ||
it("should call the correct endpoint", function() { | ||
return expect(this.account) | ||
.method("updateDeliveryReceiptCallback") | ||
.withParams("http://example.com/dr_callback") | ||
.to.post.to.url( | ||
"/account/settings?drCallBackUrl=http%3A%2F%2Fexample.com%2Fdr_callback" | ||
); | ||
}); | ||
this.httpClientStub = new HttpClient( | ||
{ | ||
logger: new NullLogger() | ||
}, | ||
creds | ||
); | ||
sinon.stub(this.httpClientStub, "request"); | ||
var options = { | ||
rest: this.httpClientStub | ||
}; | ||
this.account = new Account(creds, options); | ||
}); | ||
describe("topUp", function() { | ||
it("should call the correct endpoint", function(done) { | ||
this.httpClientStub.request.yields(null, {}); | ||
var expectedRequestArgs = ResourceTestHelper.requestArgsMatch({ | ||
path: "/account/top-up?trx=ABC123" | ||
}); | ||
this.account.topUp( | ||
"ABC123", | ||
function(err, data) { | ||
expect(this.httpClientStub.request).to.have.been.calledWith( | ||
sinon.match(expectedRequestArgs) | ||
); | ||
done(); | ||
}.bind(this) | ||
); | ||
it("should call the correct endpoint", function() { | ||
return expect(this.account) | ||
.method("topUp") | ||
.withParams("ABC123") | ||
.to.post.to.url("/account/top-up?trx=ABC123"); | ||
}); | ||
@@ -82,3 +68,3 @@ | ||
this.httpClientStub.request.yields(null, mockData); | ||
this.account.topUp("trx-123", function(err, data) { | ||
this.account.topUp("trx-123", (err, data) => { | ||
expect(err).to.eql(null); | ||
@@ -98,3 +84,3 @@ expect(data).to.eql(mockData); | ||
this.httpClientStub.request.yields(mockData, null); | ||
this.account.topUp("trx-123", function(err, data) { | ||
this.account.topUp("trx-123", (err, data) => { | ||
expect(err).to.eql(mockData); | ||
@@ -101,0 +87,0 @@ expect(data).to.eql(null); |
@@ -192,2 +192,35 @@ import sinon from "sinon"; | ||
it("should be possible to set the timeout", function() { | ||
var mock = sinon.mock(fakeHttp); | ||
mock | ||
.expects("request") | ||
.once() | ||
.withArgs({ | ||
headers: defaultHeaders, | ||
host: "api.nexmo.com", | ||
method: "POST", | ||
path: "/api", | ||
port: 443, | ||
timeout: 5000 | ||
}) | ||
.returns(fakeRequest); | ||
var client = new HttpClient({ | ||
https: fakeHttp, | ||
logger: logger, | ||
timeout: 5000 | ||
}); | ||
client.request( | ||
{ | ||
host: "api.nexmo.com", | ||
path: "/api" | ||
}, | ||
"POST", | ||
{ | ||
some: "data" | ||
} | ||
); | ||
}); | ||
it("should not override the method when method and callback are undefined", function() { | ||
@@ -368,2 +401,13 @@ var mock = sinon.mock(fakeHttp); | ||
it("should not error with invalid JSON if parsing is disabled", function() { | ||
var callback = sinon.spy(); | ||
const response = { | ||
statusCode: 200, | ||
headers: { "content-type": "application/json" } | ||
}; | ||
const data = "not_json"; | ||
client.__parseResponse(response, [data], "GET", callback, true); | ||
expect(callback).was.calledWith(null, data); | ||
}); | ||
it("should parse binary data", function() { | ||
@@ -370,0 +414,0 @@ var callback = sinon.spy(); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
362100
56
4402
636
3
3
8
+ Addedrequest@^2.83.0
+ Addedajv@6.12.6(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@1.0.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.7.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedcaseless@0.12.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcore-util-is@1.0.2(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@2.3.3(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedhar-schema@2.0.0(transitive)
+ Addedhar-validator@5.1.5(transitive)
+ Addedhttp-signature@1.2.0(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedoauth-sign@0.9.0(transitive)
+ Addedperformance-now@2.1.0(transitive)
+ Addedpsl@1.10.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqs@6.5.3(transitive)
+ Addedrequest@2.88.2(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedtough-cookie@2.5.0(transitive)
+ Addedtunnel-agent@0.6.0(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedverror@1.10.0(transitive)