Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniovazquezblanco committed Jul 30, 2024
1 parent 1ddf242 commit 8392d7c
Show file tree
Hide file tree
Showing 2 changed files with 253 additions and 333 deletions.
263 changes: 118 additions & 145 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35279,11 +35279,11 @@ class RequestError extends Error {
response;
constructor(message, statusCode, options) {
super(message);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
this.name = "HttpError";
this.status = statusCode;
this.status = Number.parseInt(statusCode);
if (Number.isNaN(this.status)) {
this.status = 0;
}
if ("response" in options) {
this.response = options.response;
}
Expand All @@ -35306,144 +35306,128 @@ class RequestError extends Error {
// pkg/dist-src/index.js


// pkg/dist-src/defaults.js


// pkg/dist-src/version.js
var dist_bundle_VERSION = "0.0.0-development";

// pkg/dist-src/defaults.js
var defaults_default = {
headers: {
"user-agent": `octokit-request.js/${dist_bundle_VERSION} ${getUserAgent()}`
}
};

// pkg/dist-src/is-plain-object.js
function dist_bundle_isPlainObject(value) {
if (typeof value !== "object" || value === null)
return false;
if (Object.prototype.toString.call(value) !== "[object Object]")
return false;
if (typeof value !== "object" || value === null) return false;
if (Object.prototype.toString.call(value) !== "[object Object]") return false;
const proto = Object.getPrototypeOf(value);
if (proto === null)
return true;
if (proto === null) return true;
const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
}

// pkg/dist-src/fetch-wrapper.js


// pkg/dist-src/get-buffer-response.js
function getBufferResponse(response) {
return response.arrayBuffer();
}

// pkg/dist-src/fetch-wrapper.js
function fetchWrapper(requestOptions) {
const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console;
const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
if (dist_bundle_isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) {
requestOptions.body = JSON.stringify(requestOptions.body);
}
let headers = {};
let status;
let url;
let { fetch } = globalThis;
if (requestOptions.request?.fetch) {
fetch = requestOptions.request.fetch;
}
async function fetchWrapper(requestOptions) {
const fetch = requestOptions.request?.fetch || globalThis.fetch;
if (!fetch) {
throw new Error(
"fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing"
);
}
return fetch(requestOptions.url, {
method: requestOptions.method,
body: requestOptions.body,
redirect: requestOptions.request?.redirect,
// Header values must be `string`
headers: Object.fromEntries(
Object.entries(requestOptions.headers).map(([name, value]) => [
name,
String(value)
])
),
signal: requestOptions.request?.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) => {
url = response.url;
status = response.status;
for (const keyAndValue of response.headers) {
headers[keyAndValue[0]] = keyAndValue[1];
}
if ("deprecation" in headers) {
const matches = headers.link && headers.link.match(/<([^>]+)>; rel="deprecation"/);
const deprecationLink = matches && matches.pop();
log.warn(
`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${headers.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
);
}
if (status === 204 || status === 205) {
return;
}
if (requestOptions.method === "HEAD") {
if (status < 400) {
return;
const log = requestOptions.request?.log || console;
const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
const body = dist_bundle_isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body;
const requestHeaders = Object.fromEntries(
Object.entries(requestOptions.headers).map(([name, value]) => [
name,
String(value)
])
);
let fetchResponse;
try {
fetchResponse = await fetch(requestOptions.url, {
method: requestOptions.method,
body,
redirect: requestOptions.request?.redirect,
headers: requestHeaders,
signal: requestOptions.request?.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" }
});
} catch (error) {
let message = "Unknown Error";
if (error instanceof Error) {
if (error.name === "AbortError") {
error.status = 500;
throw error;
}
throw new RequestError(response.statusText, status, {
response: {
url,
status,
headers,
data: void 0
},
request: requestOptions
});
}
if (status === 304) {
throw new RequestError("Not modified", status, {
response: {
url,
status,
headers,
data: await getResponseData(response)
},
request: requestOptions
});
}
if (status >= 400) {
const data = await getResponseData(response);
const error = new RequestError(toErrorMessage(data), status, {
response: {
url,
status,
headers,
data
},
request: requestOptions
});
throw error;
}
return parseSuccessResponseBody ? await getResponseData(response) : response.body;
}).then((data) => {
return {
status,
url,
headers,
data
};
}).catch((error) => {
if (error instanceof RequestError)
throw error;
else if (error.name === "AbortError")
throw error;
let message = error.message;
if (error.name === "TypeError" && "cause" in error) {
if (error.cause instanceof Error) {
message = error.cause.message;
} else if (typeof error.cause === "string") {
message = error.cause;
message = error.message;
if (error.name === "TypeError" && "cause" in error) {
if (error.cause instanceof Error) {
message = error.cause.message;
} else if (typeof error.cause === "string") {
message = error.cause;
}
}
}
throw new RequestError(message, 500, {
const requestError = new RequestError(message, 500, {
request: requestOptions
});
});
requestError.cause = error;
throw requestError;
}
const status = fetchResponse.status;
const url = fetchResponse.url;
const responseHeaders = {};
for (const [key, value] of fetchResponse.headers) {
responseHeaders[key] = value;
}
const octokitResponse = {
url,
status,
headers: responseHeaders,
data: ""
};
if ("deprecation" in responseHeaders) {
const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/);
const deprecationLink = matches && matches.pop();
log.warn(
`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
);
}
if (status === 204 || status === 205) {
return octokitResponse;
}
if (requestOptions.method === "HEAD") {
if (status < 400) {
return octokitResponse;
}
throw new RequestError(fetchResponse.statusText, status, {
response: octokitResponse,
request: requestOptions
});
}
if (status === 304) {
octokitResponse.data = await getResponseData(fetchResponse);
throw new RequestError("Not modified", status, {
response: octokitResponse,
request: requestOptions
});
}
if (status >= 400) {
octokitResponse.data = await getResponseData(fetchResponse);
throw new RequestError(toErrorMessage(octokitResponse.data), status, {
response: octokitResponse,
request: requestOptions
});
}
octokitResponse.data = parseSuccessResponseBody ? await getResponseData(fetchResponse) : fetchResponse.body;
return octokitResponse;
}
async function getResponseData(response) {
const contentType = response.headers.get("content-type");
Expand All @@ -35453,22 +35437,18 @@ async function getResponseData(response) {
if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) {
return response.text();
}
return getBufferResponse(response);
return response.arrayBuffer();
}
function toErrorMessage(data) {
if (typeof data === "string")
if (typeof data === "string") {
return data;
let suffix;
if ("documentation_url" in data) {
suffix = ` - ${data.documentation_url}`;
} else {
suffix = "";
}
if (data instanceof ArrayBuffer) {
return "Unknown error";
}
if ("message" in data) {
if (Array.isArray(data.errors)) {
return `${data.message}: ${data.errors.map(JSON.stringify).join(", ")}${suffix}`;
}
return `${data.message}${suffix}`;
const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : "";
return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`;
}
return `Unknown error: ${JSON.stringify(data)}`;
}
Expand Down Expand Up @@ -35499,11 +35479,7 @@ function dist_bundle_withDefaults(oldEndpoint, newDefaults) {
}

// pkg/dist-src/index.js
var request = dist_bundle_withDefaults(endpoint, {
headers: {
"user-agent": `octokit-request.js/${dist_bundle_VERSION} ${getUserAgent()}`
}
});
var request = dist_bundle_withDefaults(endpoint, defaults_default);


;// CONCATENATED MODULE: ./node_modules/@octokit/rest/node_modules/@octokit/graphql/dist-bundle/index.js
Expand Down Expand Up @@ -35824,7 +35800,7 @@ class Octokit {


;// CONCATENATED MODULE: ./node_modules/@octokit/rest/node_modules/@octokit/plugin-request-log/dist-src/version.js
const dist_src_version_VERSION = "5.3.0";
const dist_src_version_VERSION = "5.3.1";


;// CONCATENATED MODULE: ./node_modules/@octokit/rest/node_modules/@octokit/plugin-request-log/dist-src/index.js
Expand All @@ -35842,7 +35818,7 @@ function requestLog(octokit) {
);
return response;
}).catch((error) => {
const requestId = error.response.headers["x-github-request-id"] || "UNKNOWN";
const requestId = error.response?.headers["x-github-request-id"] || "UNKNOWN";
octokit.log.error(
`${requestOptions.method} ${path} - ${error.status} with id ${requestId} in ${Date.now() - start}ms`
);
Expand All @@ -35866,8 +35842,7 @@ function normalizePaginatedListResponse(response) {
};
}
const responseNeedsNormalization = "total_count" in response.data && !("url" in response.data);
if (!responseNeedsNormalization)
return response;
if (!responseNeedsNormalization) return response;
const incompleteResults = response.data.incomplete_results;
const repositorySelection = response.data.repository_selection;
const totalCount = response.data.total_count;
Expand Down Expand Up @@ -35897,8 +35872,7 @@ function iterator(octokit, route, parameters) {
return {
[Symbol.asyncIterator]: () => ({
async next() {
if (!url)
return { done: true };
if (!url) return { done: true };
try {
const response = await requestMethod({ method, url, headers });
const normalizedResponse = normalizePaginatedListResponse(response);
Expand All @@ -35907,8 +35881,7 @@ function iterator(octokit, route, parameters) {
) || [])[1];
return { value: normalizedResponse };
} catch (error) {
if (error.status !== 409)
throw error;
if (error.status !== 409) throw error;
url = "";
return {
value: {
Expand Down Expand Up @@ -36222,7 +36195,7 @@ paginateRest.VERSION = plugin_paginate_rest_dist_bundle_VERSION;


;// CONCATENATED MODULE: ./node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js
const plugin_rest_endpoint_methods_dist_src_version_VERSION = "13.2.1";
const plugin_rest_endpoint_methods_dist_src_version_VERSION = "13.2.4";

//# sourceMappingURL=version.js.map

Expand Down Expand Up @@ -38317,7 +38290,7 @@ legacyRestEndpointMethods.VERSION = plugin_rest_endpoint_methods_dist_src_versio
//# sourceMappingURL=index.js.map

;// CONCATENATED MODULE: ./node_modules/@octokit/rest/dist-src/version.js
const rest_dist_src_version_VERSION = "21.0.0";
const rest_dist_src_version_VERSION = "21.0.1";


;// CONCATENATED MODULE: ./node_modules/@octokit/rest/dist-src/index.js
Expand Down
Loading

2 comments on commit 8392d7c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.❔
Category Percentage Covered / Total
🟒 Statements 91.16% 134/147
🟑 Branches 78.26% 18/23
🟒 Functions 100% 10/10
🟒 Lines 91.16% 134/147

Test suite run success

6 tests passing in 2 suites.

Report generated by πŸ§ͺjest coverage report action from 8392d7c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

Caution

An unexpected error occurred. For more details, check console

TypeError: Cannot read properties of undefined (reading 'totalStatements')
St.❔
Category Percentage Covered / Total
🟒 Statements 91.16% 134/147
🟑 Branches 78.26% 18/23
🟒 Functions 100% 10/10
🟒 Lines 91.16% 134/147

Test suite run success

6 tests passing in 2 suites.

Report generated by πŸ§ͺjest coverage report action from 8392d7c

Please sign in to comment.