- revert octokit/rest upgrade as this require node 18 (which github actions does not yet support)

This commit is contained in:
Mike Penz
2023-07-14 09:08:33 +00:00
committed by GitHub
parent 34e64f17ce
commit 9196792cd5
6 changed files with 352 additions and 386 deletions
Generated Vendored
+182 -239
View File
@@ -5377,6 +5377,44 @@ exports.paginatingEndpoints = paginatingEndpoints;
//# sourceMappingURL=index.js.map
/***/ }),
/***/ 8883:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
const VERSION = "1.0.4";
/**
* @param octokit Octokit instance
* @param options Options passed to Octokit constructor
*/
function requestLog(octokit) {
octokit.hook.wrap("request", (request, options) => {
octokit.log.debug("request", options);
const start = Date.now();
const requestOptions = octokit.request.endpoint.parse(options);
const path = requestOptions.url.replace(options.baseUrl, "");
return request(options).then(response => {
octokit.log.info(`${requestOptions.method} ${path} - ${response.status} in ${Date.now() - start}ms`);
return response;
}).catch(error => {
octokit.log.info(`${requestOptions.method} ${path} - ${error.status} in ${Date.now() - start}ms`);
throw error;
});
});
}
requestLog.VERSION = VERSION;
exports.requestLog = requestLog;
//# sourceMappingURL=index.js.map
/***/ }),
/***/ 3044:
@@ -6791,12 +6829,12 @@ __export(dist_src_exports, {
});
module.exports = __toCommonJS(dist_src_exports);
var import_core = __nccwpck_require__(4952);
var import_plugin_request_log = __nccwpck_require__(748);
var import_plugin_request_log = __nccwpck_require__(8883);
var import_plugin_paginate_rest = __nccwpck_require__(606);
var import_plugin_rest_endpoint_methods = __nccwpck_require__(4923);
// pkg/dist-src/version.js
var VERSION = "20.0.1";
var VERSION = "19.0.13";
// pkg/dist-src/index.js
var Octokit = import_core.Octokit.plugin(
@@ -6933,13 +6971,10 @@ var import_graphql = __nccwpck_require__(7461);
var import_auth_token = __nccwpck_require__(7633);
// pkg/dist-src/version.js
var VERSION = "5.0.0";
var VERSION = "4.2.4";
// pkg/dist-src/index.js
var Octokit = class {
static {
this.VERSION = VERSION;
}
static defaults(defaults) {
const OctokitWithDefaults = class extends this {
constructor(...args) {
@@ -6962,9 +6997,6 @@ var Octokit = class {
};
return OctokitWithDefaults;
}
static {
this.plugins = [];
}
/**
* Attach a plugin (or many) to your Octokit instance.
*
@@ -6972,14 +7004,12 @@ var Octokit = class {
* const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)
*/
static plugin(...newPlugins) {
var _a;
const currentPlugins = this.plugins;
const NewOctokit = class extends this {
static {
this.plugins = currentPlugins.concat(
newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
);
}
};
const NewOctokit = (_a = class extends this {
}, _a.plugins = currentPlugins.concat(
newPlugins.filter((plugin) => !currentPlugins.includes(plugin))
), _a);
return NewOctokit;
}
constructor(options = {}) {
@@ -7060,6 +7090,8 @@ var Octokit = class {
});
}
};
Octokit.VERSION = VERSION;
Octokit.plugins = [];
// Annotate the CommonJS export names for ESM import in node:
0 && (0);
@@ -7096,26 +7128,6 @@ __export(dist_src_exports, {
});
module.exports = __toCommonJS(dist_src_exports);
// pkg/dist-src/defaults.js
var import_universal_user_agent = __nccwpck_require__(5030);
// pkg/dist-src/version.js
var VERSION = "9.0.0";
// pkg/dist-src/defaults.js
var userAgent = `octokit-endpoint.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`;
var DEFAULTS = {
method: "GET",
baseUrl: "https://api.github.com",
headers: {
accept: "application/vnd.github.v3+json",
"user-agent": userAgent
},
mediaType: {
format: ""
}
};
// pkg/dist-src/util/lowercase-keys.js
function lowercaseKeys(object) {
if (!object) {
@@ -7166,14 +7178,12 @@ function merge(defaults, route, options) {
removeUndefinedProperties(options);
removeUndefinedProperties(options.headers);
const mergedOptions = mergeDeep(defaults || {}, options);
if (options.url === "/graphql") {
if (defaults && defaults.mediaType.previews?.length) {
mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(
(preview) => !mergedOptions.mediaType.previews.includes(preview)
).concat(mergedOptions.mediaType.previews);
}
mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, ""));
if (defaults && defaults.mediaType.previews.length) {
mergedOptions.mediaType.previews = defaults.mediaType.previews.filter((preview) => !mergedOptions.mediaType.previews.includes(preview)).concat(mergedOptions.mediaType.previews);
}
mergedOptions.mediaType.previews = mergedOptions.mediaType.previews.map(
(preview) => preview.replace(/-preview/, "")
);
return mergedOptions;
}
@@ -7365,20 +7375,18 @@ function parse(options) {
if (!isBinaryRequest) {
if (options.mediaType.format) {
headers.accept = headers.accept.split(/,/).map(
(format) => format.replace(
(preview) => preview.replace(
/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,
`application/vnd$1$2.${options.mediaType.format}`
)
).join(",");
}
if (url.endsWith("/graphql")) {
if (options.mediaType.previews?.length) {
const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || [];
headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
return `application/vnd.github.${preview}-preview${format}`;
}).join(",");
}
if (options.mediaType.previews.length) {
const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || [];
headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
return `application/vnd.github.${preview}-preview${format}`;
}).join(",");
}
}
if (["GET", "HEAD"].includes(method)) {
@@ -7422,6 +7430,27 @@ function withDefaults(oldDefaults, newDefaults) {
});
}
// pkg/dist-src/defaults.js
var import_universal_user_agent = __nccwpck_require__(5030);
// pkg/dist-src/version.js
var VERSION = "7.0.6";
// pkg/dist-src/defaults.js
var userAgent = `octokit-endpoint.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`;
var DEFAULTS = {
method: "GET",
baseUrl: "https://api.github.com",
headers: {
accept: "application/vnd.github.v3+json",
"user-agent": userAgent
},
mediaType: {
format: "",
previews: []
}
};
// pkg/dist-src/index.js
var endpoint = withDefaults(null, DEFAULTS);
// Annotate the CommonJS export names for ESM import in node:
@@ -7461,17 +7490,11 @@ __export(dist_src_exports, {
withCustomRequest: () => withCustomRequest
});
module.exports = __toCommonJS(dist_src_exports);
var import_request3 = __nccwpck_require__(6206);
var import_request = __nccwpck_require__(6206);
var import_universal_user_agent = __nccwpck_require__(5030);
// pkg/dist-src/version.js
var VERSION = "7.0.1";
// pkg/dist-src/with-defaults.js
var import_request2 = __nccwpck_require__(6206);
// pkg/dist-src/graphql.js
var import_request = __nccwpck_require__(6206);
var VERSION = "5.0.6";
// pkg/dist-src/error.js
function _buildMessageForResponseErrors(data) {
@@ -7516,9 +7539,7 @@ function graphql(request2, query, options) {
if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key))
continue;
return Promise.reject(
new Error(
`[@octokit/graphql] "${key}" cannot be used as variable name`
)
new Error(`[@octokit/graphql] "${key}" cannot be used as variable name`)
);
}
}
@@ -7569,7 +7590,7 @@ function withDefaults(request2, newDefaults) {
}
// pkg/dist-src/index.js
var graphql2 = withDefaults(import_request3.request, {
var graphql2 = withDefaults(import_request.request, {
headers: {
"user-agent": `octokit-graphql.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
},
@@ -7622,7 +7643,7 @@ __export(dist_src_exports, {
module.exports = __toCommonJS(dist_src_exports);
// pkg/dist-src/version.js
var VERSION = "8.0.0";
var VERSION = "6.1.2";
// pkg/dist-src/normalize-paginated-list-response.js
function normalizePaginatedListResponse(response) {
@@ -7789,7 +7810,6 @@ var paginatingEndpoints = [
"GET /orgs/{org}/projects",
"GET /orgs/{org}/public_members",
"GET /orgs/{org}/repos",
"GET /orgs/{org}/rulesets",
"GET /orgs/{org}/secret-scanning/alerts",
"GET /orgs/{org}/teams",
"GET /orgs/{org}/teams/{team_slug}/discussions",
@@ -7879,8 +7899,6 @@ var paginatingEndpoints = [
"GET /repos/{owner}/{repo}/releases",
"GET /repos/{owner}/{repo}/releases/{release_id}/assets",
"GET /repos/{owner}/{repo}/releases/{release_id}/reactions",
"GET /repos/{owner}/{repo}/rules/branches/{branch}",
"GET /repos/{owner}/{repo}/rulesets",
"GET /repos/{owner}/{repo}/secret-scanning/alerts",
"GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations",
"GET /repos/{owner}/{repo}/security-advisories",
@@ -7978,66 +7996,6 @@ paginateRest.VERSION = VERSION;
0 && (0);
/***/ }),
/***/ 748:
/***/ ((module) => {
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// pkg/dist-src/index.js
var dist_src_exports = {};
__export(dist_src_exports, {
requestLog: () => requestLog
});
module.exports = __toCommonJS(dist_src_exports);
// pkg/dist-src/version.js
var VERSION = "4.0.0";
// pkg/dist-src/index.js
function requestLog(octokit) {
octokit.hook.wrap("request", (request, options) => {
octokit.log.debug("request", options);
const start = Date.now();
const requestOptions = octokit.request.endpoint.parse(options);
const path = requestOptions.url.replace(options.baseUrl, "");
return request(options).then((response) => {
octokit.log.info(
`${requestOptions.method} ${path} - ${response.status} in ${Date.now() - start}ms`
);
return response;
}).catch((error) => {
octokit.log.info(
`${requestOptions.method} ${path} - ${error.status} in ${Date.now() - start}ms`
);
throw error;
});
});
}
requestLog.VERSION = VERSION;
// Annotate the CommonJS export names for ESM import in node:
0 && (0);
/***/ }),
/***/ 4923:
@@ -8072,7 +8030,7 @@ __export(dist_src_exports, {
module.exports = __toCommonJS(dist_src_exports);
// pkg/dist-src/version.js
var VERSION = "9.0.0";
var VERSION = "7.2.3";
// pkg/dist-src/generated/endpoints.js
var Endpoints = {
@@ -10059,6 +10017,79 @@ legacyRestEndpointMethods.VERSION = VERSION;
/***/ }),
/***/ 6239:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var deprecation = __nccwpck_require__(8932);
var once = _interopDefault(__nccwpck_require__(1223));
const logOnceCode = once(deprecation => console.warn(deprecation));
const logOnceHeaders = once(deprecation => console.warn(deprecation));
/**
* Error with extra properties to help with debugging
*/
class RequestError extends Error {
constructor(message, statusCode, options) {
super(message);
// Maintains proper stack trace (only available on V8)
/* istanbul ignore next */
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
this.name = "HttpError";
this.status = statusCode;
let headers;
if ("headers" in options && typeof options.headers !== "undefined") {
headers = options.headers;
}
if ("response" in options) {
this.response = options.response;
headers = options.response.headers;
}
// redact request credentials without mutating original request options
const requestCopy = Object.assign({}, options.request);
if (options.request.headers.authorization) {
requestCopy.headers = Object.assign({}, options.request.headers, {
authorization: options.request.headers.authorization.replace(/ .*$/, " [REDACTED]")
});
}
requestCopy.url = requestCopy.url
// client_id & client_secret can be passed as URL query parameters to increase rate limit
// see https://developer.github.com/v3/#increasing-the-unauthenticated-rate-limit-for-oauth-applications
.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]")
// OAuth tokens can be passed as URL query parameters, although it is not recommended
// see https://developer.github.com/v3/#oauth2-token-sent-in-a-header
.replace(/\baccess_token=\w+/g, "access_token=[REDACTED]");
this.request = requestCopy;
// deprecations
Object.defineProperty(this, "code", {
get() {
logOnceCode(new deprecation.Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`."));
return statusCode;
}
});
Object.defineProperty(this, "headers", {
get() {
logOnceHeaders(new deprecation.Deprecation("[@octokit/request-error] `error.headers` is deprecated, use `error.response.headers`."));
return headers || {};
}
});
}
}
exports.RequestError = RequestError;
//# sourceMappingURL=index.js.map
/***/ }),
/***/ 6206:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
@@ -10091,94 +10122,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// pkg/dist-src/index.js
var dist_src_exports = {};
__export(dist_src_exports, {
RequestError: () => RequestError
});
module.exports = __toCommonJS(dist_src_exports);
var import_deprecation = __nccwpck_require__(8932);
var import_once = __toESM(__nccwpck_require__(1223));
var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation));
var logOnceHeaders = (0, import_once.default)((deprecation) => console.warn(deprecation));
var RequestError = class extends Error {
constructor(message, statusCode, options) {
super(message);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
this.name = "HttpError";
this.status = statusCode;
let headers;
if ("headers" in options && typeof options.headers !== "undefined") {
headers = options.headers;
}
if ("response" in options) {
this.response = options.response;
headers = options.response.headers;
}
const requestCopy = Object.assign({}, options.request);
if (options.request.headers.authorization) {
requestCopy.headers = Object.assign({}, options.request.headers, {
authorization: options.request.headers.authorization.replace(
/ .*$/,
" [REDACTED]"
)
});
}
requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]");
this.request = requestCopy;
Object.defineProperty(this, "code", {
get() {
logOnceCode(
new import_deprecation.Deprecation(
"[@octokit/request-error] `error.code` is deprecated, use `error.status`."
)
);
return statusCode;
}
});
Object.defineProperty(this, "headers", {
get() {
logOnceHeaders(
new import_deprecation.Deprecation(
"[@octokit/request-error] `error.headers` is deprecated, use `error.response.headers`."
)
);
return headers || {};
}
});
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (0);
/***/ }),
/***/ 6206:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// pkg/dist-src/index.js
var dist_src_exports = {};
__export(dist_src_exports, {
@@ -10189,10 +10132,11 @@ var import_endpoint = __nccwpck_require__(6065);
var import_universal_user_agent = __nccwpck_require__(5030);
// pkg/dist-src/version.js
var VERSION = "8.1.0";
var VERSION = "6.2.8";
// pkg/dist-src/fetch-wrapper.js
var import_is_plain_object = __nccwpck_require__(3287);
var import_node_fetch = __toESM(__nccwpck_require__(467));
var import_request_error = __nccwpck_require__(6239);
// pkg/dist-src/get-buffer-response.js
@@ -10202,33 +10146,32 @@ function getBufferResponse(response) {
// pkg/dist-src/fetch-wrapper.js
function fetchWrapper(requestOptions) {
var _a, _b, _c;
const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console;
const parseSuccessResponseBody = ((_a = requestOptions.request) == null ? void 0 : _a.parseSuccessResponseBody) !== false;
if ((0, import_is_plain_object.isPlainObject)(requestOptions.body) || Array.isArray(requestOptions.body)) {
requestOptions.body = JSON.stringify(requestOptions.body);
}
let headers = {};
let status;
let url;
let { fetch } = globalThis;
if ((_b = requestOptions.request) == null ? void 0 : _b.fetch) {
fetch = requestOptions.request.fetch;
}
if (!fetch) {
throw new Error(
'Global "fetch" not found. Please provide `options.request.fetch` to octokit or upgrade to node@18 or newer.'
);
}
return fetch(requestOptions.url, {
method: requestOptions.method,
body: requestOptions.body,
headers: requestOptions.headers,
signal: (_c = requestOptions.request) == null ? void 0 : _c.signal,
// duplex must be set if request.body is ReadableStream or Async Iterables.
// See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
...requestOptions.body && { duplex: "half" }
}).then(async (response) => {
const fetch = requestOptions.request && requestOptions.request.fetch || globalThis.fetch || /* istanbul ignore next */
import_node_fetch.default;
return fetch(
requestOptions.url,
Object.assign(
{
method: requestOptions.method,
body: requestOptions.body,
headers: requestOptions.headers,
redirect: requestOptions.redirect,
// duplex must be set if request.body is ReadableStream or Async Iterables.
// See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
...requestOptions.body && { duplex: "half" }
},
// `requestOptions.request.agent` type is incompatible
// see https://github.com/octokit/types.ts/pull/264
requestOptions.request
)
).then(async (response) => {
url = response.url;
status = response.status;
for (const keyAndValue of response.headers) {
@@ -10282,7 +10225,7 @@ function fetchWrapper(requestOptions) {
});
throw error;
}
return parseSuccessResponseBody ? await getResponseData(response) : response.body;
return getResponseData(response);
}).then((data) => {
return {
status,