Update to the latest version of @actions/github.
This commit is contained in:
parent
55458a1ab1
commit
9ed519fa12
419 changed files with 56978 additions and 151535 deletions
39
node_modules/@octokit/graphql/dist-node/index.js
generated
vendored
39
node_modules/@octokit/graphql/dist-node/index.js
generated
vendored
|
|
@ -5,13 +5,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|||
var request = require('@octokit/request');
|
||||
var universalUserAgent = require('universal-user-agent');
|
||||
|
||||
const VERSION = "4.3.1";
|
||||
const VERSION = "4.5.6";
|
||||
|
||||
class GraphqlError extends Error {
|
||||
constructor(request, response) {
|
||||
const message = response.data.errors[0].message;
|
||||
super(message);
|
||||
Object.assign(this, response.data);
|
||||
Object.assign(this, {
|
||||
headers: response.headers
|
||||
});
|
||||
this.name = "GraphqlError";
|
||||
this.request = request; // Maintains proper stack trace (only available on V8)
|
||||
|
||||
|
|
@ -24,14 +27,19 @@ 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"];
|
||||
const GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
|
||||
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
|
||||
}, options) : options = query;
|
||||
const requestOptions = Object.keys(options).reduce((result, key) => {
|
||||
}, options) : query;
|
||||
const requestOptions = Object.keys(parsedOptions).reduce((result, key) => {
|
||||
if (NON_VARIABLE_OPTIONS.includes(key)) {
|
||||
result[key] = options[key];
|
||||
result[key] = parsedOptions[key];
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -39,12 +47,27 @@ function graphql(request, query, options) {
|
|||
result.variables = {};
|
||||
}
|
||||
|
||||
result.variables[key] = options[key];
|
||||
result.variables[key] = parsedOptions[key];
|
||||
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 => {
|
||||
if (response.data.errors) {
|
||||
const headers = {};
|
||||
|
||||
for (const key of Object.keys(response.headers)) {
|
||||
headers[key] = response.headers[key];
|
||||
}
|
||||
|
||||
throw new GraphqlError(requestOptions, {
|
||||
headers,
|
||||
data: response.data
|
||||
});
|
||||
}
|
||||
|
|
|
|||
2
node_modules/@octokit/graphql/dist-node/index.js.map
generated
vendored
2
node_modules/@octokit/graphql/dist-node/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue