From f1bebe1456ae0985017478e88fefcf1fdafc55f7 Mon Sep 17 00:00:00 2001 From: peter-evans Date: Fri, 22 May 2020 02:21:32 +0000 Subject: [PATCH] Update distribution --- dist/index.js | 149 ++++++++++++++++++++++++-------------------------- 1 file changed, 71 insertions(+), 78 deletions(-) diff --git a/dist/index.js b/dist/index.js index 5dd85cc..3811fa9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -19,7 +19,13 @@ module.exports = /******/ }; /******/ /******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ var threw = true; +/******/ try { +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ threw = false; +/******/ } finally { +/******/ if(threw) delete installedModules[moduleId]; +/******/ } /******/ /******/ // Flag the module as loaded /******/ module.l = true; @@ -386,13 +392,6 @@ module.exports._parse = parse; module.exports._enoent = enoent; -/***/ }), - -/***/ 34: -/***/ (function(module) { - -module.exports = require("https"); - /***/ }), /***/ 39: @@ -1628,7 +1627,7 @@ module.exports = require("child_process"); var net = __webpack_require__(631); var tls = __webpack_require__(16); var http = __webpack_require__(605); -var https = __webpack_require__(34); +var https = __webpack_require__(211); var events = __webpack_require__(614); var assert = __webpack_require__(357); var util = __webpack_require__(669); @@ -2174,32 +2173,9 @@ function checkMode (stat, options) { /***/ }), /***/ 211: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, '__esModule', { value: true }); - -function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } - -var osName = _interopDefault(__webpack_require__(2)); - -function getUserAgent() { - try { - return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`; - } catch (error) { - if (/wmic os get Caption/.test(error.message)) { - return "Windows "; - } - - return ""; - } -} - -exports.getUserAgent = getUserAgent; -//# sourceMappingURL=index.js.map +/***/ (function(module) { +module.exports = require("https"); /***/ }), @@ -4036,7 +4012,7 @@ function authenticationRequestError(state, error, options) { module.exports = parseOptions; const { Deprecation } = __webpack_require__(692); -const { getUserAgent } = __webpack_require__(796); +const { getUserAgent } = __webpack_require__(619); const once = __webpack_require__(969); const pkg = __webpack_require__(215); @@ -4646,7 +4622,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var isPlainObject = _interopDefault(__webpack_require__(696)); -var universalUserAgent = __webpack_require__(562); +var universalUserAgent = __webpack_require__(796); function lowercaseKeys(object) { if (!object) { @@ -5367,7 +5343,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau var Stream = _interopDefault(__webpack_require__(413)); var http = _interopDefault(__webpack_require__(605)); var Url = _interopDefault(__webpack_require__(835)); -var https = _interopDefault(__webpack_require__(34)); +var https = _interopDefault(__webpack_require__(211)); var zlib = _interopDefault(__webpack_require__(761)); // Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js @@ -7158,13 +7134,15 @@ class GitHub extends rest_1.Octokit { static getOctokitOptions(args) { const token = args[0]; const options = Object.assign({}, args[1]); // Shallow clone - don't mutate the object provided by the caller + // Base URL - GHES or Dotcom + options.baseUrl = options.baseUrl || this.getApiBaseUrl(); // Auth const auth = GitHub.getAuthString(token, options); if (auth) { options.auth = auth; } // Proxy - const agent = GitHub.getProxyAgent(options); + const agent = GitHub.getProxyAgent(options.baseUrl, options); if (agent) { // Shallow clone - don't mutate the object provided by the caller options.request = options.request ? Object.assign({}, options.request) : {}; @@ -7175,6 +7153,7 @@ class GitHub extends rest_1.Octokit { } static getGraphQL(args) { const defaults = {}; + defaults.baseUrl = this.getGraphQLBaseUrl(); const token = args[0]; const options = args[1]; // Authorization @@ -7185,7 +7164,7 @@ class GitHub extends rest_1.Octokit { }; } // Proxy - const agent = GitHub.getProxyAgent(options); + const agent = GitHub.getProxyAgent(defaults.baseUrl, options); if (agent) { defaults.request = { agent }; } @@ -7201,17 +7180,31 @@ class GitHub extends rest_1.Octokit { } return typeof options.auth === 'string' ? options.auth : `token ${token}`; } - static getProxyAgent(options) { + static getProxyAgent(destinationUrl, options) { var _a; if (!((_a = options.request) === null || _a === void 0 ? void 0 : _a.agent)) { - const serverUrl = 'https://api.github.com'; - if (httpClient.getProxyUrl(serverUrl)) { + if (httpClient.getProxyUrl(destinationUrl)) { const hc = new httpClient.HttpClient(); - return hc.getAgent(serverUrl); + return hc.getAgent(destinationUrl); } } return undefined; } + static getApiBaseUrl() { + return process.env['GITHUB_API_URL'] || 'https://api.github.com'; + } + static getGraphQLBaseUrl() { + let url = process.env['GITHUB_GRAPHQL_URL'] || 'https://api.github.com/graphql'; + // Shouldn't be a trailing slash, but remove if so + if (url.endsWith('/')) { + url = url.substr(0, url.length - 1); + } + // Remove trailing "/graphql" + if (url.toUpperCase().endsWith('/GRAPHQL')) { + url = url.substr(0, url.length - '/graphql'.length); + } + return url; + } } exports.GitHub = GitHub; //# sourceMappingURL=github.js.map @@ -7766,7 +7759,7 @@ function hasFirstPage (link) { Object.defineProperty(exports, "__esModule", { value: true }); const url = __webpack_require__(835); const http = __webpack_require__(605); -const https = __webpack_require__(34); +const https = __webpack_require__(211); const pm = __webpack_require__(950); let tunnel; var HttpCodes; @@ -8325,36 +8318,6 @@ function hasPreviousPage (link) { } -/***/ }), - -/***/ 562: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, '__esModule', { value: true }); - -function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } - -var osName = _interopDefault(__webpack_require__(2)); - -function getUserAgent() { - try { - return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`; - } catch (error) { - if (/wmic os get Caption/.test(error.message)) { - return "Windows "; - } - - return ""; - } -} - -exports.getUserAgent = getUserAgent; -//# sourceMappingURL=index.js.map - - /***/ }), /***/ 563: @@ -8538,6 +8501,36 @@ module.exports = require("http"); module.exports = require("events"); +/***/ }), + +/***/ 619: +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var osName = _interopDefault(__webpack_require__(2)); + +function getUserAgent() { + try { + return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`; + } catch (error) { + if (/wmic os get Caption/.test(error.message)) { + return "Windows "; + } + + throw error; + } +} + +exports.getUserAgent = getUserAgent; +//# sourceMappingURL=index.js.map + + /***/ }), /***/ 621: @@ -8940,7 +8933,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var endpoint = __webpack_require__(385); -var universalUserAgent = __webpack_require__(211); +var universalUserAgent = __webpack_require__(796); var isPlainObject = _interopDefault(__webpack_require__(696)); var nodeFetch = _interopDefault(__webpack_require__(454)); var requestError = __webpack_require__(463); @@ -9173,7 +9166,7 @@ function getUserAgent() { return "Windows "; } - throw error; + return ""; } } @@ -24795,7 +24788,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); var request = __webpack_require__(753); var universalUserAgent = __webpack_require__(796); -const VERSION = "4.3.1"; +const VERSION = "4.5.0"; class GraphqlError extends Error { constructor(request, response) { @@ -24814,7 +24807,7 @@ class GraphqlError extends Error { } -const NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query"]; +const NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query", "mediaType"]; function graphql(request, query, options) { options = typeof query === "string" ? options = Object.assign({ query