Bump Octokit core, REST pagination, REST methdos

This commit is contained in:
Jonathan Clem
2020-11-17 09:13:01 -05:00
parent bc192ff403
commit ed05d35c66
3 changed files with 212 additions and 239 deletions

367
dist/index.js vendored
View File

@@ -211,11 +211,7 @@ const Endpoints = {
unstarRepoForAuthenticatedUser: ["DELETE /user/starred/{owner}/{repo}"] unstarRepoForAuthenticatedUser: ["DELETE /user/starred/{owner}/{repo}"]
}, },
apps: { apps: {
addRepoToInstallation: ["PUT /user/installations/{installation_id}/repositories/{repository_id}", { addRepoToInstallation: ["PUT /user/installations/{installation_id}/repositories/{repository_id}"],
mediaType: {
previews: ["machine-man"]
}
}],
checkToken: ["POST /applications/{client_id}/token"], checkToken: ["POST /applications/{client_id}/token"],
createContentAttachment: ["POST /content_references/{content_reference_id}/attachments", { createContentAttachment: ["POST /content_references/{content_reference_id}/attachments", {
mediaType: { mediaType: {
@@ -223,81 +219,29 @@ const Endpoints = {
} }
}], }],
createFromManifest: ["POST /app-manifests/{code}/conversions"], createFromManifest: ["POST /app-manifests/{code}/conversions"],
createInstallationAccessToken: ["POST /app/installations/{installation_id}/access_tokens", { createInstallationAccessToken: ["POST /app/installations/{installation_id}/access_tokens"],
mediaType: {
previews: ["machine-man"]
}
}],
deleteAuthorization: ["DELETE /applications/{client_id}/grant"], deleteAuthorization: ["DELETE /applications/{client_id}/grant"],
deleteInstallation: ["DELETE /app/installations/{installation_id}", { deleteInstallation: ["DELETE /app/installations/{installation_id}"],
mediaType: {
previews: ["machine-man"]
}
}],
deleteToken: ["DELETE /applications/{client_id}/token"], deleteToken: ["DELETE /applications/{client_id}/token"],
getAuthenticated: ["GET /app", { getAuthenticated: ["GET /app"],
mediaType: { getBySlug: ["GET /apps/{app_slug}"],
previews: ["machine-man"] getInstallation: ["GET /app/installations/{installation_id}"],
} getOrgInstallation: ["GET /orgs/{org}/installation"],
}], getRepoInstallation: ["GET /repos/{owner}/{repo}/installation"],
getBySlug: ["GET /apps/{app_slug}", {
mediaType: {
previews: ["machine-man"]
}
}],
getInstallation: ["GET /app/installations/{installation_id}", {
mediaType: {
previews: ["machine-man"]
}
}],
getOrgInstallation: ["GET /orgs/{org}/installation", {
mediaType: {
previews: ["machine-man"]
}
}],
getRepoInstallation: ["GET /repos/{owner}/{repo}/installation", {
mediaType: {
previews: ["machine-man"]
}
}],
getSubscriptionPlanForAccount: ["GET /marketplace_listing/accounts/{account_id}"], getSubscriptionPlanForAccount: ["GET /marketplace_listing/accounts/{account_id}"],
getSubscriptionPlanForAccountStubbed: ["GET /marketplace_listing/stubbed/accounts/{account_id}"], getSubscriptionPlanForAccountStubbed: ["GET /marketplace_listing/stubbed/accounts/{account_id}"],
getUserInstallation: ["GET /users/{username}/installation", { getUserInstallation: ["GET /users/{username}/installation"],
mediaType: {
previews: ["machine-man"]
}
}],
listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"], listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"],
listAccountsForPlanStubbed: ["GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"], listAccountsForPlanStubbed: ["GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"],
listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories", { listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories"],
mediaType: { listInstallations: ["GET /app/installations"],
previews: ["machine-man"] listInstallationsForAuthenticatedUser: ["GET /user/installations"],
}
}],
listInstallations: ["GET /app/installations", {
mediaType: {
previews: ["machine-man"]
}
}],
listInstallationsForAuthenticatedUser: ["GET /user/installations", {
mediaType: {
previews: ["machine-man"]
}
}],
listPlans: ["GET /marketplace_listing/plans"], listPlans: ["GET /marketplace_listing/plans"],
listPlansStubbed: ["GET /marketplace_listing/stubbed/plans"], listPlansStubbed: ["GET /marketplace_listing/stubbed/plans"],
listReposAccessibleToInstallation: ["GET /installation/repositories", { listReposAccessibleToInstallation: ["GET /installation/repositories"],
mediaType: {
previews: ["machine-man"]
}
}],
listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"], listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"],
listSubscriptionsForAuthenticatedUserStubbed: ["GET /user/marketplace_purchases/stubbed"], listSubscriptionsForAuthenticatedUserStubbed: ["GET /user/marketplace_purchases/stubbed"],
removeRepoFromInstallation: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}", { removeRepoFromInstallation: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}"],
mediaType: {
previews: ["machine-man"]
}
}],
resetToken: ["PATCH /applications/{client_id}/token"], resetToken: ["PATCH /applications/{client_id}/token"],
revokeInstallationAccessToken: ["DELETE /installation/token"], revokeInstallationAccessToken: ["DELETE /installation/token"],
suspendInstallation: ["PUT /app/installations/{installation_id}/suspended"], suspendInstallation: ["PUT /app/installations/{installation_id}/suspended"],
@@ -369,8 +313,15 @@ const Endpoints = {
}] }]
}, },
codeScanning: { codeScanning: {
getAlert: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_id}"], getAlert: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}", {}, {
listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"] renamedParameters: {
alert_id: "alert_number"
}
}],
listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"],
listRecentAnalyses: ["GET /repos/{owner}/{repo}/code-scanning/analyses"],
updateAlert: ["PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}"],
uploadSarif: ["POST /repos/{owner}/{repo}/code-scanning/sarifs"]
}, },
codesOfConduct: { codesOfConduct: {
getAllCodesOfConduct: ["GET /codes_of_conduct", { getAllCodesOfConduct: ["GET /codes_of_conduct", {
@@ -612,11 +563,7 @@ const Endpoints = {
getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"], getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"],
getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"], getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"],
list: ["GET /organizations"], list: ["GET /organizations"],
listAppInstallations: ["GET /orgs/{org}/installations", { listAppInstallations: ["GET /orgs/{org}/installations"],
mediaType: {
previews: ["machine-man"]
}
}],
listBlockedUsers: ["GET /orgs/{org}/blocks"], listBlockedUsers: ["GET /orgs/{org}/blocks"],
listForAuthenticatedUser: ["GET /user/orgs"], listForAuthenticatedUser: ["GET /user/orgs"],
listForUser: ["GET /users/{username}/orgs"], listForUser: ["GET /users/{username}/orgs"],
@@ -1229,7 +1176,7 @@ const Endpoints = {
} }
}; };
const VERSION = "4.1.2"; const VERSION = "4.2.1";
function endpointsToMethods(octokit, endpointsMap) { function endpointsToMethods(octokit, endpointsMap) {
const newMethods = {}; const newMethods = {};
@@ -1658,7 +1605,7 @@ exports.getState = getState;
Object.defineProperty(exports, '__esModule', { value: true }); Object.defineProperty(exports, '__esModule', { value: true });
const VERSION = "2.3.0"; const VERSION = "2.6.0";
/** /**
* Some “list” response that can be paginated have a different response structure * Some “list” response that can be paginated have a different response structure
@@ -1711,26 +1658,23 @@ function iterator(octokit, route, parameters) {
let url = options.url; let url = options.url;
return { return {
[Symbol.asyncIterator]: () => ({ [Symbol.asyncIterator]: () => ({
next() { async next() {
if (!url) { if (!url) return {
return Promise.resolve({
done: true done: true
}); };
} const response = await requestMethod({
return requestMethod({
method, method,
url, url,
headers headers
}).then(normalizePaginatedListResponse).then(response => { });
// `response.headers.link` format: const normalizedResponse = normalizePaginatedListResponse(response); // `response.headers.link` format:
// '<https://api.github.com/users/aseemk/followers?page=2>; rel="next", <https://api.github.com/users/aseemk/followers?page=2>; rel="last"' // '<https://api.github.com/users/aseemk/followers?page=2>; rel="next", <https://api.github.com/users/aseemk/followers?page=2>; rel="last"'
// sets `url` to undefined if "next" URL is not present or `link` header is not set // sets `url` to undefined if "next" URL is not present or `link` header is not set
url = ((response.headers.link || "").match(/<([^>]+)>;\s*rel="next"/) || [])[1];
url = ((normalizedResponse.headers.link || "").match(/<([^>]+)>;\s*rel="next"/) || [])[1];
return { return {
value: response value: normalizedResponse
}; };
});
} }
}) })
@@ -1768,6 +1712,10 @@ function gather(octokit, results, iterator, mapFn) {
}); });
} }
const composePaginateRest = Object.assign(paginate, {
iterator
});
/** /**
* @param octokit Octokit instance * @param octokit Octokit instance
* @param options Options passed to Octokit constructor * @param options Options passed to Octokit constructor
@@ -1782,6 +1730,7 @@ function paginateRest(octokit) {
} }
paginateRest.VERSION = VERSION; paginateRest.VERSION = VERSION;
exports.composePaginateRest = composePaginateRest;
exports.paginateRest = paginateRest; exports.paginateRest = paginateRest;
//# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map
@@ -2128,18 +2077,18 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
var endpoint = __webpack_require__(440); var endpoint = __webpack_require__(440);
var universalUserAgent = __webpack_require__(429); var universalUserAgent = __webpack_require__(429);
var isPlainObject = _interopDefault(__webpack_require__(840)); var isPlainObject = __webpack_require__(287);
var nodeFetch = _interopDefault(__webpack_require__(467)); var nodeFetch = _interopDefault(__webpack_require__(467));
var requestError = __webpack_require__(537); var requestError = __webpack_require__(537);
const VERSION = "5.4.7"; const VERSION = "5.4.10";
function getBufferResponse(response) { function getBufferResponse(response) {
return response.arrayBuffer(); return response.arrayBuffer();
} }
function fetchWrapper(requestOptions) { function fetchWrapper(requestOptions) {
if (isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) { if (isPlainObject.isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) {
requestOptions.body = JSON.stringify(requestOptions.body); requestOptions.body = JSON.stringify(requestOptions.body);
} }
@@ -2296,6 +2245,52 @@ function toCommandValue(input) {
exports.toCommandValue = toCommandValue; exports.toCommandValue = toCommandValue;
//# sourceMappingURL=utils.js.map //# sourceMappingURL=utils.js.map
/***/ }),
/***/ 287:
/***/ (function(__unusedmodule, exports) {
"use strict";
Object.defineProperty(exports, '__esModule', { value: true });
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
function isObject(o) {
return Object.prototype.toString.call(o) === '[object Object]';
}
function isPlainObject(o) {
var ctor,prot;
if (isObject(o) === false) return false;
// If has modified constructor
ctor = o.constructor;
if (ctor === undefined) return true;
// If has modified prototype
prot = ctor.prototype;
if (isObject(prot) === false) return false;
// If constructor does not have an Object-specific method
if (prot.hasOwnProperty('isPrototypeOf') === false) {
return false;
}
// Most likely a plain Object
return true;
}
exports.isPlainObject = isPlainObject;
/***/ }), /***/ }),
/***/ 294: /***/ 294:
@@ -2837,9 +2832,7 @@ exports.getOctokit = getOctokit;
Object.defineProperty(exports, '__esModule', { value: true }); Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var isPlainObject = __webpack_require__(287);
var isPlainObject = _interopDefault(__webpack_require__(840));
var universalUserAgent = __webpack_require__(429); var universalUserAgent = __webpack_require__(429);
function lowercaseKeys(object) { function lowercaseKeys(object) {
@@ -2856,7 +2849,7 @@ function lowercaseKeys(object) {
function mergeDeep(defaults, options) { function mergeDeep(defaults, options) {
const result = Object.assign({}, defaults); const result = Object.assign({}, defaults);
Object.keys(options).forEach(key => { Object.keys(options).forEach(key => {
if (isPlainObject(options[key])) { if (isPlainObject.isPlainObject(options[key])) {
if (!(key in defaults)) Object.assign(result, { if (!(key in defaults)) Object.assign(result, {
[key]: options[key] [key]: options[key]
});else result[key] = mergeDeep(defaults[key], options[key]); });else result[key] = mergeDeep(defaults[key], options[key]);
@@ -2869,6 +2862,16 @@ function mergeDeep(defaults, options) {
return result; return result;
} }
function removeUndefinedProperties(obj) {
for (const key in obj) {
if (obj[key] === undefined) {
delete obj[key];
}
}
return obj;
}
function merge(defaults, route, options) { function merge(defaults, route, options) {
if (typeof route === "string") { if (typeof route === "string") {
let [method, url] = route.split(" "); let [method, url] = route.split(" ");
@@ -2883,7 +2886,10 @@ function merge(defaults, route, options) {
} // lowercase header names before merging with defaults to avoid duplicates } // lowercase header names before merging with defaults to avoid duplicates
options.headers = lowercaseKeys(options.headers); options.headers = lowercaseKeys(options.headers); // remove properties with undefined values before merging
removeUndefinedProperties(options);
removeUndefinedProperties(options.headers);
const mergedOptions = mergeDeep(defaults || {}, options); // mediaType.previews arrays are merged, instead of overwritten const mergedOptions = mergeDeep(defaults || {}, options); // mediaType.previews arrays are merged, instead of overwritten
if (defaults && defaults.mediaType.previews.length) { if (defaults && defaults.mediaType.previews.length) {
@@ -3105,7 +3111,7 @@ function parse(options) {
// https://fetch.spec.whatwg.org/#methods // https://fetch.spec.whatwg.org/#methods
let method = options.method.toUpperCase(); // replace :varname with {varname} to make it RFC 6570 compatible let method = options.method.toUpperCase(); // replace :varname with {varname} to make it RFC 6570 compatible
let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{+$1}"); let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
let headers = Object.assign({}, options.headers); let headers = Object.assign({}, options.headers);
let body; let body;
let parameters = omit(options, ["method", "baseUrl", "url", "headers", "request", "mediaType"]); // extract variable names from URL to calculate remaining variables later let parameters = omit(options, ["method", "baseUrl", "url", "headers", "request", "mediaType"]); // extract variable names from URL to calculate remaining variables later
@@ -3119,9 +3125,9 @@ function parse(options) {
const omittedParameters = Object.keys(options).filter(option => urlVariableNames.includes(option)).concat("baseUrl"); const omittedParameters = Object.keys(options).filter(option => urlVariableNames.includes(option)).concat("baseUrl");
const remainingParameters = omit(parameters, omittedParameters); const remainingParameters = omit(parameters, omittedParameters);
const isBinaryRequset = /application\/octet-stream/i.test(headers.accept); const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
if (!isBinaryRequset) { if (!isBinaryRequest) {
if (options.mediaType.format) { if (options.mediaType.format) {
// e.g. application/vnd.github.v3+json => application/vnd.github.v3.raw // e.g. application/vnd.github.v3+json => application/vnd.github.v3.raw
headers.accept = headers.accept.split(/,/).map(preview => preview.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`)).join(","); headers.accept = headers.accept.split(/,/).map(preview => preview.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`)).join(",");
@@ -3190,7 +3196,7 @@ function withDefaults(oldDefaults, newDefaults) {
}); });
} }
const VERSION = "6.0.5"; const VERSION = "6.0.9";
const userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`; // DEFAULTS has all properties set that EndpointOptions has, except url. const userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`; // DEFAULTS has all properties set that EndpointOptions has, except url.
// So we use RequestParameters and add method as additional required property. // So we use RequestParameters and add method as additional required property.
@@ -5094,7 +5100,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
var request = __webpack_require__(234); var request = __webpack_require__(234);
var universalUserAgent = __webpack_require__(429); var universalUserAgent = __webpack_require__(429);
const VERSION = "4.5.4"; const VERSION = "4.5.7";
class GraphqlError extends Error { class GraphqlError extends Error {
constructor(request, response) { constructor(request, response) {
@@ -5117,13 +5123,18 @@ class GraphqlError extends Error {
} }
const NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query", "mediaType"]; const NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query", "mediaType"];
const GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
function graphql(request, query, options) { function graphql(request, query, options) {
options = typeof query === "string" ? options = Object.assign({ if (typeof query === "string" && options && "query" in options) {
return Promise.reject(new Error(`[@octokit/graphql] "query" cannot be used as variable name`));
}
const parsedOptions = typeof query === "string" ? Object.assign({
query query
}, options) : options = query; }, options) : query;
const requestOptions = Object.keys(options).reduce((result, key) => { const requestOptions = Object.keys(parsedOptions).reduce((result, key) => {
if (NON_VARIABLE_OPTIONS.includes(key)) { if (NON_VARIABLE_OPTIONS.includes(key)) {
result[key] = options[key]; result[key] = parsedOptions[key];
return result; return result;
} }
@@ -5131,9 +5142,17 @@ function graphql(request, query, options) {
result.variables = {}; result.variables = {};
} }
result.variables[key] = options[key]; result.variables[key] = parsedOptions[key];
return result; return result;
}, {}); }, {}); // workaround for GitHub Enterprise baseUrl set with /api/v3 suffix
// https://github.com/octokit/auth-app.js/issues/111#issuecomment-657610451
const baseUrl = parsedOptions.baseUrl || request.endpoint.DEFAULTS.baseUrl;
if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {
requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql");
}
return request(requestOptions).then(response => { return request(requestOptions).then(response => {
if (response.data.errors) { if (response.data.errors) {
const headers = {}; const headers = {};
@@ -5425,56 +5444,43 @@ var request = __webpack_require__(234);
var graphql = __webpack_require__(668); var graphql = __webpack_require__(668);
var authToken = __webpack_require__(334); var authToken = __webpack_require__(334);
function _defineProperty(obj, key, value) { function _objectWithoutPropertiesLoose(source, excluded) {
if (key in obj) { if (source == null) return {};
Object.defineProperty(obj, key, { var target = {};
value: value, var sourceKeys = Object.keys(source);
enumerable: true, var key, i;
configurable: true,
writable: true for (i = 0; i < sourceKeys.length; i++) {
}); key = sourceKeys[i];
} else { if (excluded.indexOf(key) >= 0) continue;
obj[key] = value; target[key] = source[key];
} }
return obj; return target;
} }
function ownKeys(object, enumerableOnly) { function _objectWithoutProperties(source, excluded) {
var keys = Object.keys(object); if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) { if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object); var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys; for (i = 0; i < sourceSymbolKeys.length; i++) {
} key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
function _objectSpread2(target) { if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
for (var i = 1; i < arguments.length; i++) { target[key] = source[key];
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
} }
} }
return target; return target;
} }
const VERSION = "3.1.2"; const VERSION = "3.2.1";
class Octokit { class Octokit {
constructor(options = {}) { constructor(options = {}) {
@@ -5506,9 +5512,7 @@ class Octokit {
} }
this.request = request.request.defaults(requestDefaults); this.request = request.request.defaults(requestDefaults);
this.graphql = graphql.withCustomRequest(this.request).defaults(_objectSpread2(_objectSpread2({}, requestDefaults), {}, { this.graphql = graphql.withCustomRequest(this.request).defaults(requestDefaults);
baseUrl: requestDefaults.baseUrl.replace(/\/api\/v3$/, "/api")
}));
this.log = Object.assign({ this.log = Object.assign({
debug: () => {}, debug: () => {},
info: () => {}, info: () => {},
@@ -5516,7 +5520,7 @@ class Octokit {
error: console.error.bind(console) error: console.error.bind(console)
}, options.log); }, options.log);
this.hook = hook; // (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance this.hook = hook; // (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance
// is unauthenticated. The `this.auth()` method is a no-op and no request hook is registred. // is unauthenticated. The `this.auth()` method is a no-op and no request hook is registered.
// (2) If only `options.auth` is set, use the default token authentication strategy. // (2) If only `options.auth` is set, use the default token authentication strategy.
// (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance. // (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance.
// TODO: type `options.auth` based on `options.authStrategy`. // TODO: type `options.auth` based on `options.authStrategy`.
@@ -5535,8 +5539,21 @@ class Octokit {
this.auth = auth; this.auth = auth;
} }
} else { } else {
const auth = options.authStrategy(Object.assign({ const {
request: this.request authStrategy
} = options,
otherOptions = _objectWithoutProperties(options, ["authStrategy"]);
const auth = authStrategy(Object.assign({
request: this.request,
log: this.log,
// we pass the current octokit instance as well as its constructor options
// to allow for authentication strategies that return a new octokit instance
// that shares the same internal state as the current one. The original
// requirement for this was the "event-octokit" authentication strategy
// of https://github.com/probot/octokit-auth-probot.
octokit: this,
octokitOptions: otherOptions
}, options.auth)); // @ts-ignore ¯\_(ツ)_/¯ }, options.auth)); // @ts-ignore ¯\_(ツ)_/¯
hook.wrap("request", auth.hook); hook.wrap("request", auth.hook);
@@ -5624,50 +5641,6 @@ function removeHook (state, name, method) {
module.exports = require("url"); module.exports = require("url");
/***/ }),
/***/ 840:
/***/ (function(module) {
"use strict";
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
function isObject(o) {
return Object.prototype.toString.call(o) === '[object Object]';
}
function isPlainObject(o) {
var ctor,prot;
if (isObject(o) === false) return false;
// If has modified constructor
ctor = o.constructor;
if (ctor === undefined) return true;
// If has modified prototype
prot = ctor.prototype;
if (isObject(prot) === false) return false;
// If constructor does not have an Object-specific method
if (prot.hasOwnProperty('isPrototypeOf') === false) {
return false;
}
// Most likely a plain Object
return true;
}
module.exports = isPlainObject;
/***/ }), /***/ }),
/***/ 875: /***/ 875:

70
package-lock.json generated
View File

@@ -1186,17 +1186,17 @@
} }
}, },
"@octokit/auth-token": { "@octokit/auth-token": {
"version": "2.4.2", "version": "2.4.3",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.2.tgz", "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.3.tgz",
"integrity": "sha512-jE/lE/IKIz2v1+/P0u4fJqv0kYwXOTujKemJMFr6FeopsxlIK3+wKDCJGnysg81XID5TgZQbIfuJ5J0lnTiuyQ==", "integrity": "sha512-fdGoOQ3kQJh+hrilc0Plg50xSfaCKOeYN9t6dpJKXN9BxhhfquL0OzoQXg3spLYymL5rm29uPeI3KEXRaZQ9zg==",
"requires": { "requires": {
"@octokit/types": "^5.0.0" "@octokit/types": "^5.0.0"
} }
}, },
"@octokit/core": { "@octokit/core": {
"version": "3.1.2", "version": "3.2.1",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.1.2.tgz", "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.2.1.tgz",
"integrity": "sha512-AInOFULmwOa7+NFi9F8DlDkm5qtZVmDQayi7TUgChE3yeIGPq0Y+6cAEXPexQ3Ea+uZy66hKEazR7DJyU+4wfw==", "integrity": "sha512-XfFSDDwv6tclUenS0EmB6iA7u+4aOHBT1Lz4PtQNQQg3hBbNaR/+Uv5URU+egeIuuGAiMRiDyY92G4GBOWOqDA==",
"requires": { "requires": {
"@octokit/auth-token": "^2.4.0", "@octokit/auth-token": "^2.4.0",
"@octokit/graphql": "^4.3.1", "@octokit/graphql": "^4.3.1",
@@ -1207,19 +1207,19 @@
} }
}, },
"@octokit/endpoint": { "@octokit/endpoint": {
"version": "6.0.5", "version": "6.0.9",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.5.tgz", "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.9.tgz",
"integrity": "sha512-70K5u6zd45ItOny6aHQAsea8HHQjlQq85yqOMe+Aj8dkhN2qSJ9T+Q3YjUjEYfPRBcuUWNgMn62DQnP/4LAIiQ==", "integrity": "sha512-3VPLbcCuqji4IFTclNUtGdp9v7g+nspWdiCUbK3+iPMjJCZ6LEhn1ts626bWLOn0GiDb6j+uqGvPpqLnY7pBgw==",
"requires": { "requires": {
"@octokit/types": "^5.0.0", "@octokit/types": "^5.0.0",
"is-plain-object": "^4.0.0", "is-plain-object": "^5.0.0",
"universal-user-agent": "^6.0.0" "universal-user-agent": "^6.0.0"
} }
}, },
"@octokit/graphql": { "@octokit/graphql": {
"version": "4.5.4", "version": "4.5.7",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.4.tgz", "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.7.tgz",
"integrity": "sha512-ITpZ+dQc0cXAW1FmDkHJJM+8Lb6anUnin0VB5hLBilnYVdLC0ICFU/KIvT7OXfW9S81DE3U4Vx2EypDG1OYaPA==", "integrity": "sha512-Gk0AR+DcwIK/lK/GX+OQ99UqtenQhcbrhHHfOYlrCQe17ADnX3EKAOKRsAZ9qZvpi5MuwWm/Nm+9aO2kTDSdyA==",
"requires": { "requires": {
"@octokit/request": "^5.3.0", "@octokit/request": "^5.3.0",
"@octokit/types": "^5.0.0", "@octokit/types": "^5.0.0",
@@ -1227,41 +1227,41 @@
} }
}, },
"@octokit/plugin-paginate-rest": { "@octokit/plugin-paginate-rest": {
"version": "2.3.0", "version": "2.6.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.3.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.6.0.tgz",
"integrity": "sha512-Ye2ZJreP0ZlqJQz8fz+hXvrEAEYK4ay7br1eDpWzr6j76VXs/gKqxFcH8qRzkB3fo/2xh4Vy9VtGii4ZDc9qlA==", "integrity": "sha512-o+O8c1PqsC5++BHXfMZabRRsBIVb34tXPWyQLyp2IXq5MmkxdipS7TXM4Y9ldL1PzY9CTrCsn/lzFFJGM3oRRA==",
"requires": { "requires": {
"@octokit/types": "^5.2.0" "@octokit/types": "^5.5.0"
} }
}, },
"@octokit/plugin-rest-endpoint-methods": { "@octokit/plugin-rest-endpoint-methods": {
"version": "4.1.2", "version": "4.2.1",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.1.2.tgz", "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.2.1.tgz",
"integrity": "sha512-PTI7wpbGEZ2IR87TVh+TNWaLcgX/RsZQalFbQCq8XxYUrQ36RHyERrHSNXFy5gkWpspUAOYRSV707JJv6BhqJA==", "integrity": "sha512-QyFr4Bv807Pt1DXZOC5a7L5aFdrwz71UHTYoHVajYV5hsqffWm8FUl9+O7nxRu5PDMtB/IKrhFqTmdBTK5cx+A==",
"requires": { "requires": {
"@octokit/types": "^5.1.1", "@octokit/types": "^5.5.0",
"deprecation": "^2.3.1" "deprecation": "^2.3.1"
} }
}, },
"@octokit/request": { "@octokit/request": {
"version": "5.4.7", "version": "5.4.10",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.7.tgz", "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.10.tgz",
"integrity": "sha512-FN22xUDP0i0uF38YMbOfx6TotpcENP5W8yJM1e/LieGXn6IoRxDMnBf7tx5RKSW4xuUZ/1P04NFZy5iY3Rax1A==", "integrity": "sha512-egA49HkqEORVGDZGav1mh+VD+7uLgOxtn5oODj6guJk0HCy+YBSYapFkSLFgeYj3Fr18ZULKGURkjyhkAChylw==",
"requires": { "requires": {
"@octokit/endpoint": "^6.0.1", "@octokit/endpoint": "^6.0.1",
"@octokit/request-error": "^2.0.0", "@octokit/request-error": "^2.0.0",
"@octokit/types": "^5.0.0", "@octokit/types": "^5.0.0",
"deprecation": "^2.0.0", "deprecation": "^2.0.0",
"is-plain-object": "^4.0.0", "is-plain-object": "^5.0.0",
"node-fetch": "^2.3.0", "node-fetch": "^2.6.1",
"once": "^1.4.0", "once": "^1.4.0",
"universal-user-agent": "^6.0.0" "universal-user-agent": "^6.0.0"
} }
}, },
"@octokit/request-error": { "@octokit/request-error": {
"version": "2.0.2", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.2.tgz", "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.3.tgz",
"integrity": "sha512-2BrmnvVSV1MXQvEkrb9zwzP0wXFNbPJij922kYBTLIlIafukrGOb+ABBT2+c6wZiuyWDH1K1zmjGQ0toN/wMWw==", "integrity": "sha512-GgD5z8Btm301i2zfvJLk/mkhvGCdjQ7wT8xF9ov5noQY8WbKZDH9cOBqXzoeKd1mLr1xH2FwbtGso135zGBgTA==",
"requires": { "requires": {
"@octokit/types": "^5.0.1", "@octokit/types": "^5.0.1",
"deprecation": "^2.0.0", "deprecation": "^2.0.0",
@@ -1269,9 +1269,9 @@
} }
}, },
"@octokit/types": { "@octokit/types": {
"version": "5.4.1", "version": "5.5.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.4.1.tgz", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.5.0.tgz",
"integrity": "sha512-OlMlSySBJoJ6uozkr/i03nO5dlYQyE05vmQNZhAh9MyO4DPBP88QlwsDVLmVjIMFssvIZB6WO0ctIGMRG+xsJQ==", "integrity": "sha512-UZ1pErDue6bZNjYOotCNveTXArOMZQFG6hKJfOnGnulVCMcVVi7YIIuuR4WfBhjo7zgpmzn/BkPDnUXtNx+PcQ==",
"requires": { "requires": {
"@types/node": ">= 8" "@types/node": ">= 8"
} }
@@ -3523,9 +3523,9 @@
"dev": true "dev": true
}, },
"is-plain-object": { "is-plain-object": {
"version": "4.1.1", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-4.1.1.tgz", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
"integrity": "sha512-5Aw8LLVsDlZsETVMhoMXzqsXwQqr/0vlnBYzIXJbYo2F4yYlhLHs+Ez7Bod7IIQKWkJbJfxrWD7pA1Dw1TKrwA==" "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
}, },
"is-potential-custom-element-name": { "is-potential-custom-element-name": {
"version": "1.0.0", "version": "1.0.0",

View File

@@ -38,9 +38,9 @@
"@actions/core": "^1.2.6", "@actions/core": "^1.2.6",
"@actions/github": "^4.0.0", "@actions/github": "^4.0.0",
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"@octokit/core": "^3.1.2", "@octokit/core": "^3.2.1",
"@octokit/plugin-paginate-rest": "^2.3.0", "@octokit/plugin-paginate-rest": "^2.6.0",
"@octokit/plugin-rest-endpoint-methods": "^4.1.2" "@octokit/plugin-rest-endpoint-methods": "4.2.1"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^26.0.10", "@types/jest": "^26.0.10",