Comparing version 1.1.2 to 1.2.0
@@ -0,1 +1,21 @@ | ||
// Copyright (c) 2016 Uber Technologies, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
var crypto = require('crypto'); | ||
@@ -27,4 +47,14 @@ var fs = require('fs'); | ||
this.configFile = opts.configFile || | ||
path.join(process.env.HOME, '.arcrc'); | ||
this.configFile = opts.configFile; | ||
if (!this.configFile) { | ||
if (process.env.HOME) { | ||
this.configFile = path.join(process.env.HOME, '.arcrc'); | ||
} else { | ||
var noHomeEnvError = new Error( | ||
'Unable to find $HOME/.arcrc: ' + | ||
'$HOME env variable is not defined.' | ||
); | ||
return cb(noHomeEnvError, null); | ||
} | ||
} | ||
@@ -74,18 +104,7 @@ var self = this; | ||
Canduit.prototype.requestWithToken = function requestWithToken (route, params, cb) { | ||
params['api.token'] = this.token; | ||
var req = request.get(this.api + route, { | ||
json: true, | ||
qs: params, | ||
}, cb); | ||
this.logger.log('GET %s', this.api + route); | ||
return req; | ||
}; | ||
Canduit.prototype.requestWithCert = function requestWithCert (route, params, cb) { | ||
Canduit.prototype.createRequest = function createRequest (route, params, cb) { | ||
if (this.session) { | ||
params.__conduit__ = this.session; | ||
} else if (this.token) { | ||
params.__conduit__ = { token: this.token }; | ||
} | ||
@@ -102,3 +121,3 @@ | ||
this.logger.log('POST to %s with %s', | ||
this.api + route, req.body.toString()); | ||
this.api + route, (req.body || '').toString()); | ||
@@ -110,4 +129,3 @@ return req; | ||
var logger = this.logger; | ||
var request = this.token ? this.requestWithToken : this.requestWithCert; | ||
var req = request.call(this, route, params || {}, processResponse); | ||
var req = this.createRequest(route, params || {}, processResponse); | ||
@@ -114,0 +132,0 @@ function processResponse(error, response, data) { |
{ | ||
"name": "canduit", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Node.js Phabricator Conduit API client", | ||
@@ -9,3 +9,4 @@ "main": "canduit.js", | ||
"jshint": "jshint --verbose .", | ||
"cover": "istanbul cover --report cobertura --report html --print detail test" | ||
"cover": "istanbul cover --report cobertura --report html --print detail test", | ||
"add-license-headers": "uber-licence" | ||
}, | ||
@@ -27,3 +28,3 @@ "repository": { | ||
"dependencies": { | ||
"request": "^2.44.0" | ||
"request": "^2.72.0" | ||
}, | ||
@@ -33,8 +34,9 @@ "devDependencies": { | ||
"getport": "^0.1.0", | ||
"istanbul": "^0.3.20", | ||
"jshint": "^2.5.6", | ||
"run-parallel": "^1.0.0", | ||
"tape": "^4.2.0", | ||
"tmp": "^0.0.27" | ||
"istanbul": "^0.4.3", | ||
"jshint": "^2.9.2", | ||
"run-parallel": "^1.1.6", | ||
"tape": "^4.5.1", | ||
"tmp": "^0.0.28", | ||
"uber-licence": "^2.0.2" | ||
} | ||
} |
@@ -1,2 +0,3 @@ | ||
# canduit [![Build status](https://travis-ci.org/uber/canduit.png?branch=master)](https://travis-ci.org/uber/canduit) [![bitHound Score](https://www.bithound.io/github/uber/canduit/badges/score.svg)](https://www.bithound.io/github/uber/canduit) | ||
# canduit | ||
[![Build status](https://travis-ci.org/uber/canduit.png?branch=master)](https://travis-ci.org/uber/canduit) [![bitHound Score](https://www.bithound.io/github/uber/canduit/badges/score.svg)](https://www.bithound.io/github/uber/canduit) [![bitHound Dependencies](https://www.bithound.io/github/uber/canduit/badges/dependencies.svg)](https://www.bithound.io/github/uber/canduit/master/dependencies/npm) [![bitHound Dev Dependencies](https://www.bithound.io/github/uber/canduit/badges/devDependencies.svg)](https://www.bithound.io/github/uber/canduit/master/dependencies/npm) | ||
@@ -3,0 +4,0 @@ Node.js Phabricator Conduit API client. |
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
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
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
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
81334
18
563
66
8
Updatedrequest@^2.72.0