Comparing version 12.1.0 to 13.0.0
@@ -460,2 +460,23 @@ { | ||
"description": "Logins for Users to assign to this issue. NOTE: Only users with push access can set assignees for new issues. Assignees are silently dropped otherwise." | ||
}, | ||
"url": { | ||
"type": "String", | ||
"required": true, | ||
"validation": "", | ||
"invalidmsg": "", | ||
"description": "Dynamic URL for release asset uploads returned by the release’s API response." | ||
}, | ||
"contentType": { | ||
"type": "String", | ||
"required": true, | ||
"validation": "", | ||
"invalidmsg": "", | ||
"description": "The content type of a release asset upload." | ||
}, | ||
"contentLength": { | ||
"type": "Number", | ||
"required": true, | ||
"validation": "", | ||
"invalidmsg": "", | ||
"description": "Size of release asset upload in bytes." | ||
} | ||
@@ -462,0 +483,0 @@ }, |
@@ -16,3 +16,2 @@ /** section: github | ||
Error.call(this, message) | ||
// Error.captureStackTrace(this, arguments.callee); | ||
this.message = message | ||
@@ -101,3 +100,3 @@ this.code = code | ||
this.defaultMessage = defaultMsg | ||
exports.HttpError.call(this, msg || status + ': ' + defaultMsg, status) | ||
exports.HttpError.call(this, msg, status) | ||
@@ -104,0 +103,0 @@ if (status >= 500) { Error.captureStackTrace(this, arguments.callee) } // eslint-disable-line |
434
lib/index.js
'use strict' | ||
var fs = require('fs') | ||
var HttpsProxyAgent = require('https-proxy-agent') | ||
var mime = require('mime') | ||
var netrc = require('netrc') | ||
var toCamelCase = require('lodash/camelCase') | ||
var urlTemplate = require('url-template') | ||
var error = require('./error') | ||
var Url = require('url') | ||
var Util = require('./util') | ||
var Promise = require('./promise') | ||
var debug = require('debug')('node-github') | ||
var ROUTES = require('./routes.json') | ||
@@ -88,5 +85,11 @@ var DEFINITIONS = require('./definitions.json') | ||
this.config = config | ||
this.debug = config.debug | ||
this.Promise = config.Promise || config.promise || Promise | ||
if ('followRedirects' in config) { | ||
console.warn('DEPRECATED: followRedirects option is no longer supported. All redirects are followed correctly') | ||
} | ||
if ('Promise' in config) { | ||
console.warn('DEPRECATED: Promise option is no longer supported. The native Promise API is used') | ||
} | ||
var pathPrefix = '' | ||
@@ -160,3 +163,3 @@ // Check if a prefix is passed in the config and strip any leading or trailing slashes from it. | ||
throw new error.BadRequest("Invalid variable parameter name substitution; param '" + | ||
paramName + "' not found in definitions.json", 'fatal') | ||
paramName + "' not found in definitions.json") | ||
} else { | ||
@@ -191,29 +194,24 @@ def = paramsStruct[paramName] = DEFINITIONS.params[paramName] | ||
if (def.type) { | ||
type = def.type.toLowerCase() | ||
if (type === 'number') { | ||
value = parseInt(value, 10) | ||
if (isNaN(value)) { | ||
throw new error.BadRequest("Invalid value for parameter '" + | ||
paramName + "': " + msg[paramName] + ' is NaN') | ||
type = def.type.toLowerCase() | ||
if (type === 'number') { | ||
value = parseInt(value, 10) | ||
if (isNaN(value)) { | ||
throw new error.BadRequest("Invalid value for parameter '" + | ||
paramName + "': " + msg[paramName] + ' is NaN') | ||
} | ||
} else if (type === 'json') { | ||
if (typeof value === 'string') { | ||
try { | ||
value = JSON.parse(value) | ||
} catch (ex) { | ||
throw new error.BadRequest("JSON parse error of value for parameter '" + | ||
paramName + "': " + value) | ||
} | ||
} else if (type === 'float') { | ||
value = parseFloat(value) | ||
if (isNaN(value)) { | ||
throw new error.BadRequest("Invalid value for parameter '" + | ||
paramName + "': " + msg[paramName] + ' is NaN') | ||
} | ||
} else if (type === 'json') { | ||
if (typeof value === 'string') { | ||
try { | ||
value = JSON.parse(value) | ||
} catch (ex) { | ||
throw new error.BadRequest("JSON parse error of value for parameter '" + | ||
paramName + "': " + value) | ||
} | ||
} | ||
} else if (type === 'date') { | ||
value = new Date(value) | ||
} | ||
} else if (type === 'date') { | ||
value = new Date(value) | ||
} | ||
msg[paramName] = value | ||
@@ -229,5 +227,2 @@ } | ||
var block = struct[routePart] | ||
if (!block) { | ||
return | ||
} | ||
var messageType = baseType + '/' + routePart | ||
@@ -243,7 +238,2 @@ if (block.url && block.params) { | ||
self[section] = {} | ||
// add a utility function 'getFooApi()', which returns the | ||
// section to which functions are attached. | ||
self[toCamelCase('get-' + section + '-api')] = function () { | ||
return self[section] | ||
} | ||
} | ||
@@ -264,8 +254,6 @@ | ||
self.sendError(ex, block, msg, callback) | ||
if (self.debug) { | ||
Util.log(ex.message, 'fatal') | ||
} | ||
debug('fatal:', ex.message) | ||
if (self.Promise && typeof callback !== 'function') { | ||
return self.Promise.reject(ex) | ||
if (typeof callback !== 'function') { | ||
return Promise.reject(ex) | ||
} | ||
@@ -277,20 +265,16 @@ | ||
if (!callback) { | ||
if (self.Promise) { | ||
return new self.Promise(function (resolve, reject) { | ||
var cb = function (err, obj) { | ||
if (err) { | ||
reject(err) | ||
} else { | ||
resolve(obj) | ||
} | ||
} | ||
self.handler(msg, JSON.parse(JSON.stringify(block)), cb) | ||
}) | ||
} else { | ||
throw new Error('neither a callback or global promise implementation was provided') | ||
if (callback) { | ||
return self.handler(msg, JSON.parse(JSON.stringify(block)), callback) | ||
} | ||
return new Promise(function (resolve, reject) { | ||
var cb = function (err, obj) { | ||
if (err) { | ||
reject(err) | ||
} else { | ||
resolve(obj) | ||
} | ||
} | ||
} else { | ||
self.handler(msg, JSON.parse(JSON.stringify(block)), callback) | ||
} | ||
self.handler(msg, JSON.parse(JSON.stringify(block)), cb) | ||
}) | ||
} | ||
@@ -356,4 +340,4 @@ } else { | ||
} | ||
if (!options.type || 'basic|oauth|client|token|integration|netrc'.indexOf(options.type) === -1) { | ||
throw new Error("Invalid authentication type, must be 'basic', 'integration', 'oauth', 'client' or 'netrc'") | ||
if (!options.type || 'basic|oauth|client|token|integration'.indexOf(options.type) === -1) { | ||
throw new Error("Invalid authentication type, must be 'basic', 'integration', 'oauth', or 'client'") | ||
} | ||
@@ -376,10 +360,5 @@ if (options.type === 'basic' && (!options.username || !options.password)) { | ||
function getPageLinks (link) { | ||
if (typeof link === 'object' && (link.link || link.meta.link)) { | ||
link = link.link || link.meta.link | ||
} | ||
link = link.link || link.meta.link || '' | ||
var links = {} | ||
if (typeof link !== 'string') { | ||
return links | ||
} | ||
@@ -391,2 +370,3 @@ // link format: | ||
}) | ||
return links | ||
@@ -397,3 +377,3 @@ } | ||
* Client#hasNextPage(link) -> null | ||
* - link (mixed): response of a request or the contents of the Link header | ||
* - link (Object): response of a request | ||
* | ||
@@ -408,3 +388,3 @@ * Check if a request result contains a link to the next page | ||
* Client#hasPreviousPage(link) -> null | ||
* - link (mixed): response of a request or the contents of the Link header | ||
* - link (Object): response of a request | ||
* | ||
@@ -419,3 +399,3 @@ * Check if a request result contains a link to the previous page | ||
* Client#hasLastPage(link) -> null | ||
* - link (mixed): response of a request or the contents of the Link header | ||
* - link (Object): response of a request | ||
* | ||
@@ -430,3 +410,3 @@ * Check if a request result contains a link to the last page | ||
* Client#hasFirstPage(link) -> null | ||
* - link (mixed): response of a request or the contents of the Link header | ||
* - link (Object): response of a request | ||
* | ||
@@ -440,2 +420,8 @@ * Check if a request result contains a link to the first page | ||
function getPage (link, which, headers, callback) { | ||
if (typeof headers === 'function') { | ||
callback = headers | ||
headers = null | ||
} | ||
headers = applyAcceptHeader(link, headers) | ||
var self = this | ||
@@ -445,3 +431,6 @@ var url = getPageLinks(link)[which] | ||
var urlErr = new error.NotFound('No ' + which + ' page found') | ||
return self.Promise && !callback ? self.Promise.reject(urlErr) : callback(urlErr) | ||
if (callback) { | ||
return callback(urlErr) | ||
} | ||
return Promise.reject(urlErr) | ||
} | ||
@@ -452,5 +441,3 @@ | ||
var msg = Object.create(parsedUrl.query) | ||
if (headers !== null) { | ||
msg.headers = headers | ||
} | ||
msg.headers = headers | ||
@@ -463,20 +450,16 @@ var block = { | ||
if (!callback) { | ||
if (self.Promise) { | ||
return new self.Promise(function (resolve, reject) { | ||
var cb = function (err, obj) { | ||
if (err) { | ||
reject(err) | ||
} else { | ||
resolve(obj) | ||
} | ||
} | ||
self.handler(msg, JSON.parse(JSON.stringify(block)), cb) | ||
}) | ||
} else { | ||
throw new Error('neither a callback or global promise implementation was provided') | ||
if (callback) { | ||
return self.handler(msg, JSON.parse(JSON.stringify(block)), callback) | ||
} | ||
return new Promise(function (resolve, reject) { | ||
var cb = function (err, obj) { | ||
if (err) { | ||
reject(err) | ||
} else { | ||
resolve(obj) | ||
} | ||
} | ||
} else { | ||
self.handler(msg, JSON.parse(JSON.stringify(block)), callback) | ||
} | ||
self.handler(msg, JSON.parse(JSON.stringify(block)), cb) | ||
}) | ||
} | ||
@@ -486,3 +469,3 @@ | ||
* Client#getNextPage(link, callback) -> null | ||
* - link (mixed): response of a request or the contents of the Link header | ||
* - link (Object): response of a request | ||
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. | ||
@@ -494,7 +477,2 @@ * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. | ||
this.getNextPage = function (link, headers, callback) { | ||
if (typeof headers === 'function') { | ||
callback = headers | ||
headers = null | ||
} | ||
headers = applyAcceptHeader(link, headers) | ||
return getPage.call(this, link, 'next', headers, callback) | ||
@@ -505,3 +483,3 @@ } | ||
* Client#getPreviousPage(link, callback) -> null | ||
* - link (mixed): response of a request or the contents of the Link header | ||
* - link (Object): response of a request | ||
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. | ||
@@ -513,7 +491,2 @@ * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. | ||
this.getPreviousPage = function (link, headers, callback) { | ||
if (typeof headers === 'function') { | ||
callback = headers | ||
headers = null | ||
} | ||
headers = applyAcceptHeader(link, headers) | ||
return getPage.call(this, link, 'prev', headers, callback) | ||
@@ -524,3 +497,3 @@ } | ||
* Client#getLastPage(link, callback) -> null | ||
* - link (mixed): response of a request or the contents of the Link header | ||
* - link (Object): response of a request | ||
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. | ||
@@ -532,7 +505,2 @@ * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. | ||
this.getLastPage = function (link, headers, callback) { | ||
if (typeof headers === 'function') { | ||
callback = headers | ||
headers = null | ||
} | ||
headers = applyAcceptHeader(link, headers) | ||
return getPage.call(this, link, 'last', headers, callback) | ||
@@ -543,3 +511,3 @@ } | ||
* Client#getFirstPage(link, callback) -> null | ||
* - link (mixed): response of a request or the contents of the Link header | ||
* - link (Object): response of a request | ||
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. | ||
@@ -551,7 +519,2 @@ * - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument. | ||
this.getFirstPage = function (link, headers, callback) { | ||
if (typeof headers === 'function') { | ||
callback = headers | ||
headers = null | ||
} | ||
headers = applyAcceptHeader(link, headers) | ||
return getPage.call(this, link, 'first', headers, callback) | ||
@@ -579,17 +542,19 @@ } | ||
var url = def.url | ||
if (msg.url) { | ||
url = Url.parse(urlTemplate.parse(msg.url).expand(msg), true) | ||
return { | ||
url: url.path, | ||
host: url.host | ||
} | ||
} | ||
if (config.pathPrefix && url.indexOf(config.pathPrefix) !== 0) { | ||
url = config.pathPrefix + def.url | ||
} | ||
var ret = {} | ||
if (!def || !def.params) { | ||
ret.url = url | ||
return ret | ||
} | ||
Object.keys(def.params).forEach(function (paramName) { | ||
// do not send filePath as query argument | ||
if (paramName === 'filePath') { | ||
return | ||
} | ||
paramName = paramName.replace(/^[$]+/, '') | ||
@@ -603,21 +568,15 @@ if (!(paramName in msg)) { | ||
var val | ||
if (valFormat !== 'json') { | ||
if (typeof msg[paramName] === 'object') { | ||
try { | ||
msg[paramName] = JSON.stringify(msg[paramName]) | ||
val = encodeURIComponent(msg[paramName]) | ||
} catch (ex) { | ||
return Util.log('httpSend: Error while converting object to JSON: ' + | ||
(ex.message || ex), 'error') | ||
} | ||
} else if (def.params[paramName] && def.params[paramName].combined) { | ||
// Check if this is a combined (search) string. | ||
if (valFormat === 'json') { | ||
val = msg[paramName] | ||
} else { | ||
if (def.params[paramName] && def.params[paramName].combined) { | ||
// Check if this is a combined (search) string. | ||
val = msg[paramName].split(/[\s\t\r\n]*\+[\s\t\r\n]*/) | ||
.map(function (part) { | ||
return encodeURIComponent(part) | ||
}) | ||
.join('+') | ||
.map(function (part) { | ||
return encodeURIComponent(part) | ||
}) | ||
.join('+') | ||
} else { | ||
// the ref param is a path so we don't want to [fully] encode it but we do want to encode the # if there is one | ||
// (see https://github.com/mikedeboer/node-github/issues/499#issuecomment-280093040) | ||
// the ref param is a path so we don't want to [fully] encode it but we do want to encode the # if there is one | ||
// (see https://github.com/mikedeboer/node-github/issues/499#issuecomment-280093040) | ||
if (paramName === 'ref') { | ||
@@ -629,4 +588,2 @@ val = msg[paramName].replace(/#/g, '%23') | ||
} | ||
} else { | ||
val = msg[paramName] | ||
} | ||
@@ -653,2 +610,3 @@ | ||
ret.url = url | ||
return ret | ||
@@ -672,20 +630,11 @@ } | ||
var hasFileBody = block.hasFileBody | ||
var hasBody = !hasFileBody && (typeof (msg.body) !== 'undefined' || 'head|get|delete'.indexOf(method) === -1) | ||
var hasBody = typeof (msg.body) !== 'undefined' || 'head|get|delete'.indexOf(method) === -1 | ||
var format = getRequestFormat.call(this, hasBody, block) | ||
var protocol = this.config.protocol || DEFINITIONS.constants.protocol || 'http' | ||
var protocol = this.config.protocol || DEFINITIONS.constants.protocol | ||
var port = this.config.port || (protocol === 'https' ? 443 : 80) | ||
var host = block.host || this.config.host || DEFINITIONS.constants.host | ||
var host = this.config.host || DEFINITIONS.constants.host | ||
// Edge case for github enterprise uploadAsset: | ||
// 1) In public api, host changes to uploads.github.com. In enterprise, the host remains the same. | ||
// 2) In enterprise, the pathPrefix changes from: /api/v3 to /api/uploads. | ||
if ((this.config.host && this.config.host !== DEFINITIONS.constants.host) && | ||
(block.host && block.host === 'uploads.github.com')) { // enterprise uploadAsset | ||
host = this.config.host | ||
this.config.pathPrefix = '/api/uploads' | ||
} | ||
var obj = getQueryAndUrl(msg, block, format, self.config) | ||
var query = obj.query | ||
var url = this.config.url ? this.config.url + obj.url : obj.url | ||
var queryAndUrl = getQueryAndUrl(msg, block, format, self.config) | ||
var query = queryAndUrl.query | ||
var url = queryAndUrl.url | ||
var path = url | ||
@@ -698,2 +647,5 @@ if (!hasBody && query && query.length) { | ||
var agent | ||
// proxy options will be removed: https://github.com/octokit/node-github/issues/656 | ||
/* istanbul ignore if */ | ||
if (this.config.proxy !== undefined) { | ||
@@ -704,2 +656,5 @@ proxyUrl = this.config.proxy | ||
} | ||
// proxy options will be removed: https://github.com/octokit/node-github/issues/656 | ||
/* istanbul ignore if */ | ||
if (proxyUrl) { | ||
@@ -711,21 +666,21 @@ agent = new HttpsProxyAgent(proxyUrl) | ||
var headers = { | ||
'host': host, | ||
'content-length': '0' | ||
} | ||
if (hasBody) { | ||
if (format === 'json') { | ||
query = JSON.stringify(query) | ||
} else if (format === 'raw') { | ||
var headers = {} | ||
if (hasFileBody) { | ||
headers['content-length'] = msg.contentLength | ||
headers['content-type'] = msg.contentType | ||
delete msg.contentLength | ||
delete msg.contentType | ||
} else if (hasBody) { | ||
if (format === 'raw') { | ||
query = msg.data | ||
} else { | ||
query = query.join('&') | ||
query = JSON.stringify(query) | ||
} | ||
headers['content-length'] = Buffer.byteLength(query || '', 'utf8') | ||
headers['content-type'] = format === 'json' | ||
? 'application/json; charset=utf-8' | ||
: format === 'raw' | ||
? 'text/plain; charset=utf-8' | ||
: 'application/x-www-form-urlencoded; charset=utf-8' | ||
headers['content-type'] = format === 'raw' | ||
? 'text/plain; charset=utf-8' | ||
: 'application/json; charset=utf-8' | ||
} | ||
if (this.auth) { | ||
@@ -755,12 +710,2 @@ var basic | ||
break | ||
case 'netrc': | ||
var auth = netrc()[host] | ||
if (!auth) { | ||
throw new Error("~/.netrc authentication type chosen but no credentials found for '" + host + "'") | ||
} | ||
basic = Buffer.from(auth.login + ':' + auth.password, 'ascii').toString('base64') | ||
headers['Authorization'] = 'Basic ' + basic | ||
break | ||
default: | ||
break | ||
} | ||
@@ -786,2 +731,3 @@ } | ||
} | ||
addCustomHeaders(Object.assign(msg.headers || {}, this.config.headers)) | ||
@@ -797,4 +743,7 @@ | ||
headers.host = queryAndUrl.host || host | ||
var options = { | ||
host: host, | ||
agent: agent, | ||
host: headers.host, | ||
port: port, | ||
@@ -805,31 +754,15 @@ path: path, | ||
ca: ca, | ||
family: this.config.family | ||
family: this.config.family, | ||
rejectUnauthorized: this.config.rejectUnauthorized | ||
} | ||
if (agent) { | ||
options.agent = agent | ||
} | ||
debug('REQUEST:', options) | ||
if (this.config.rejectUnauthorized !== undefined) { | ||
options.rejectUnauthorized = this.config.rejectUnauthorized | ||
} | ||
if (this.debug) { | ||
console.log('REQUEST: ', options) | ||
} | ||
function httpSendRequest () { | ||
var reqModule | ||
// Verbosity for WebPack compliance | ||
if (self.config.followRedirects === false) { | ||
reqModule = protocol === 'http' ? require('http') : require('https') | ||
} else { | ||
reqModule = protocol === 'http' ? require('follow-redirects/http') : require('follow-redirects/https') | ||
} | ||
var reqModule = protocol === 'http' ? require('http') : require('https') | ||
var req = reqModule.request(options, function (res) { | ||
if (self.debug) { | ||
console.log('STATUS: ' + res.statusCode) | ||
console.log('HEADERS: ' + JSON.stringify(res.headers)) | ||
} | ||
debug('STATUS: ' + res.statusCode) | ||
debug('HEADERS: ' + JSON.stringify(res.headers)) | ||
res.setEncoding('utf8') | ||
@@ -840,2 +773,3 @@ var data = '' | ||
}) | ||
/* istanbul ignore next */ | ||
res.on('error', function (err) { | ||
@@ -845,2 +779,8 @@ callCallback(err) | ||
res.on('end', function () { | ||
if (res.statusCode >= 301 && res.statusCode <= 307) { | ||
options.path = Url.parse(res.headers.location, true).path | ||
httpSendRequest() | ||
return | ||
} | ||
if (res.statusCode >= 400 || res.statusCode < 10) { | ||
@@ -856,2 +796,3 @@ callCallback(new error.HttpError(data, res.statusCode, res.headers)) | ||
var timeout = (block.timeout !== undefined) ? block.timeout : self.config.timeout | ||
if (timeout) { | ||
@@ -862,5 +803,3 @@ req.setTimeout(timeout) | ||
req.on('error', function (e) { | ||
if (self.debug) { | ||
console.log('problem with request: ' + e.message) | ||
} | ||
debug('problem with request: ' + e.message) | ||
callCallback(e.message) | ||
@@ -870,7 +809,5 @@ }) | ||
req.on('timeout', function () { | ||
if (self.debug) { | ||
console.log('problem with request: timed out') | ||
} | ||
debug('problem with request: timed out') | ||
req.abort() | ||
callCallback(new error.GatewayTimeout()) | ||
callCallback(new error.GatewayTimeout('Request timeout')) | ||
}) | ||
@@ -880,35 +817,19 @@ | ||
if (hasBody && query && query.length) { | ||
if (self.debug) { | ||
console.log('REQUEST BODY: ' + query + '\n') | ||
} | ||
debug('REQUEST BODY: ' + query + '\n') | ||
req.write(query + '\n') | ||
} | ||
if (block.hasFileBody) { | ||
var stream = fs.createReadStream(msg.filePath) | ||
stream.pipe(req) | ||
} else { | ||
req.end() | ||
if (hasFileBody) { | ||
req.write(Buffer.from(msg.file)) | ||
} | ||
req.end() | ||
}; | ||
if (hasFileBody) { | ||
fs.stat(msg.filePath, function (err, stat) { | ||
if (err) { | ||
callCallback(err) | ||
} else { | ||
headers['content-length'] = stat.size | ||
headers['content-type'] = mime.getType(msg.name) | ||
httpSendRequest() | ||
} | ||
}) | ||
} else { | ||
httpSendRequest() | ||
} | ||
httpSendRequest() | ||
} | ||
this.sendError = function (err, block, msg, callback) { | ||
if (this.debug) { | ||
Util.log(err, block, msg, 'error') | ||
} | ||
debug('error:', err, block, msg) | ||
if (typeof err === 'string') { | ||
@@ -929,22 +850,13 @@ err = new error.InternalServerError(err) | ||
var ret | ||
try { | ||
var data = res.data | ||
var data = res.data | ||
var contentType = res.headers['content-type'] | ||
if (contentType && contentType.indexOf('application/json') !== -1) { | ||
data = res.data && JSON.parse(res.data) | ||
} | ||
ret = {data: data} | ||
} catch (ex) { | ||
if (callback) { | ||
callback(new error.InternalServerError(ex.message), res) | ||
} | ||
return | ||
var contentType = res.headers['content-type'] | ||
if (contentType && contentType.indexOf('application/json') !== -1) { | ||
data = res.data && JSON.parse(res.data) | ||
} | ||
var ret = { | ||
data: data, | ||
meta: {} | ||
} | ||
if (!ret) { | ||
ret = {} | ||
} | ||
ret.meta = {} | ||
self.responseHeaders.forEach(function (header) { | ||
@@ -956,7 +868,5 @@ if (res.headers[header]) { | ||
if (callback) { | ||
callback(null, ret) | ||
} | ||
callback(null, ret) | ||
}) | ||
} | ||
}).call(Client.prototype) |
@@ -1,1 +0,1 @@ | ||
{"name":"github","version":"12.1.0","description":"NodeJS wrapper for the GitHub API","author":"Mike de Boer <info@mikedeboer.nl>","contributors":[{"name":"Mike de Boer","email":"info@mikedeboer.nl"},{"name":"Fabian Jakobs","email":"fabian@c9.io"},{"name":"Joe Gallo","email":"joe@brassafrax.com"},{"name":"Gregor Martynus","url":"https://github.com/gr2m"}],"repository":"https://github.com/octokit/node-github","engines":{"node":">=4"},"dependencies":{"dotenv":"^4.0.0","follow-redirects":"1.2.6","https-proxy-agent":"^2.1.0","lodash":"^4.17.4","mime":"^2.0.3","netrc":"^0.1.4"},"devDependencies":{"@octokit/fixtures":"^5.4.0","chai":"^4.1.2","coveralls":"^3.0.0","glob":"^7.1.2","mocha":"^4.0.1","mustache":"^2.2.1","npm-run-all":"^4.1.1","nyc":"^11.2.1","proxyquire":"^1.8.0","semantic-release":"^8.2.0","standard":"^10.0.3","standard-markdown":"^4.0.2"},"main":"lib","types":"lib/index.d.ts","scripts":{"coverage":"nyc report --reporter=html && open coverage/index.html","coverage:upload":"nyc report --reporter=text-lcov | coveralls","pretest":"standard && standard-markdown","test":"nyc mocha test/**/*-test.js","build":"npm-run-all build:*","build:flow":"node scripts/generateFlowTypes","build:ts":"node scripts/generateTypeScriptTypes","presemantic-release":"npm run -s build","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"license":"MIT","licenses":[{"type":"The MIT License","url":"http://www.opensource.org/licenses/mit-license.php"}],"files":["lib"],"apidoc":{"title":"node-github","name":"node-github","version":"11.0.0","template":{"withCompare":true}},"nyc":{"ignore":["examples","test"]}} | ||
{"name":"github","version":"13.0.0","description":"NodeJS wrapper for the GitHub API","author":"Mike de Boer <info@mikedeboer.nl>","contributors":[{"name":"Mike de Boer","email":"info@mikedeboer.nl"},{"name":"Fabian Jakobs","email":"fabian@c9.io"},{"name":"Joe Gallo","email":"joe@brassafrax.com"},{"name":"Gregor Martynus","url":"https://github.com/gr2m"}],"repository":"https://github.com/octokit/node-github","engines":{"node":">=4"},"dependencies":{"debug":"^3.1.0","dotenv":"^4.0.0","https-proxy-agent":"^2.1.0","lodash":"^4.17.4","url-template":"^2.0.8"},"devDependencies":{"@octokit/fixtures":"^5.4.0","apidoc":"^0.17.6","chai":"^4.1.2","coveralls":"^3.0.0","gh-pages-with-token":"^1.0.0","glob":"^7.1.2","mkdirp":"^0.5.1","mocha":"^4.0.1","mustache":"^2.2.1","nock":"^9.1.0","npm-run-all":"^4.1.1","nyc":"^11.2.1","proxyquire":"^1.8.0","semantic-release":"^11.0.0","simple-mock":"^0.8.0","standard":"^10.0.3","standard-markdown":"^4.0.2"},"main":"lib","types":"lib/index.d.ts","scripts":{"coverage":"nyc report --reporter=html && open coverage/index.html","coverage:upload":"nyc report --reporter=text-lcov | coveralls","pretest":"standard && standard-markdown","test":"nyc mocha test/**/*-test.js","build":"npm-run-all build:*","prebuild:docs":"mkdirp doc/","build:docs":"node scripts/generate-api-docs","postbuild:docs":"apidoc -i doc/ -o apidoc/","build:flow":"node scripts/generate-flow-types","build:ts":"node scripts/generate-typescript-types","deploy-docs":"gh-pages-with-token -d apidoc","presemantic-release":"npm run -s build","semantic-release":"semantic-release","postpublish":"npm run -s deploy-docs"},"license":"MIT","licenses":[{"type":"The MIT License","url":"http://www.opensource.org/licenses/mit-license.php"}],"files":["lib"],"apidoc":{"template":{"withCompare":false}},"nyc":{"ignore":["examples","test"]},"publishConfig":{"tag":"next"}} |
@@ -35,2 +35,4 @@ # node-github | ||
<!-- HEADS UP: when changing the options for the constructor, make sure to also | ||
update the type definition templates in scripts/templates/* --> | ||
```js | ||
@@ -41,4 +43,2 @@ var GitHubApi = require('github') | ||
// optional | ||
debug: true, | ||
Promise: require('bluebird'), | ||
timeout: 5000, | ||
@@ -57,3 +57,2 @@ host: 'github.my-GHE-enabled-company.com', // should be api.github.com for GitHub | ||
requestMedia: 'application/vnd.github.something-custom', | ||
followRedirects: false, // default: true; there's currently an issue with non-get redirects, so allow disabling follow-redirects | ||
rejectUnauthorized: false, // default: true | ||
@@ -135,7 +134,2 @@ family: 6 | ||
}) | ||
// ~/.netrc | ||
github.authenticate({ | ||
type: 'netrc' | ||
}) | ||
``` | ||
@@ -168,5 +162,5 @@ | ||
## Promises | ||
## DEBUG | ||
See example [here](https://github.com/octokit/node-github/blob/master/examples/testPromiseGetNextPage.js). | ||
Set `DEBUG=node-github:*` for additioanl debug logs. | ||
@@ -220,15 +214,4 @@ ## Tests | ||
## Dev notes | ||
To update the apidoc for github pages: | ||
```bash | ||
$ npm install apidoc -g | ||
$ apidoc -i doc/ -o apidoc/ | ||
``` | ||
Just a reminder, since an ad-hoc filter was added to the apidoc, don't overwrite index.html, main.js. | ||
## LICENSE | ||
MIT license. See the LICENSE file for details. | ||
[MIT](LICENSE) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
5
3
3
541556
17
9
12101
212
+ Addeddebug@^3.1.0
+ Addedurl-template@^2.0.8
+ Addedurl-template@2.0.8(transitive)
- Removedfollow-redirects@1.2.6
- Removedmime@^2.0.3
- Removednetrc@^0.1.4
- Removedfollow-redirects@1.2.6(transitive)
- Removedmime@2.6.0(transitive)
- Removednetrc@0.1.4(transitive)