Update checked-in dependencies
This commit is contained in:
parent
c9f0d30a86
commit
95d52b7807
647 changed files with 498055 additions and 3880 deletions
144
node_modules/@octokit/webhooks/dist-bundle/index.js
generated
vendored
144
node_modules/@octokit/webhooks/dist-bundle/index.js
generated
vendored
|
|
@ -40,6 +40,7 @@ var emitterEventNames = [
|
|||
"custom_property",
|
||||
"custom_property.created",
|
||||
"custom_property.deleted",
|
||||
"custom_property.promote_to_enterprise",
|
||||
"custom_property.updated",
|
||||
"custom_property_values",
|
||||
"custom_property_values.updated",
|
||||
|
|
@ -117,10 +118,12 @@ var emitterEventNames = [
|
|||
"issues.pinned",
|
||||
"issues.reopened",
|
||||
"issues.transferred",
|
||||
"issues.typed",
|
||||
"issues.unassigned",
|
||||
"issues.unlabeled",
|
||||
"issues.unlocked",
|
||||
"issues.unpinned",
|
||||
"issues.untyped",
|
||||
"label",
|
||||
"label.created",
|
||||
"label.deleted",
|
||||
|
|
@ -653,6 +656,146 @@ function createNodeMiddleware(webhooks, {
|
|||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/middleware/web/get-missing-headers.js
|
||||
var WEBHOOK_HEADERS2 = [
|
||||
"x-github-event",
|
||||
"x-hub-signature-256",
|
||||
"x-github-delivery"
|
||||
];
|
||||
function getMissingHeaders2(request) {
|
||||
return WEBHOOK_HEADERS2.filter((header) => !request.headers.has(header));
|
||||
}
|
||||
|
||||
// pkg/dist-src/middleware/web/get-payload.js
|
||||
function getPayload2(request) {
|
||||
return request.text();
|
||||
}
|
||||
|
||||
// pkg/dist-src/middleware/web/on-unhandled-request-default.js
|
||||
function onUnhandledRequestDefault2(request) {
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
error: `Unknown route: ${request.method} ${request.url}`
|
||||
}),
|
||||
{
|
||||
status: 404,
|
||||
headers: {
|
||||
"content-type": "application/json"
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// pkg/dist-src/middleware/web/middleware.js
|
||||
async function middleware2(webhooks, options, request) {
|
||||
let pathname;
|
||||
try {
|
||||
pathname = new URL(request.url, "http://localhost").pathname;
|
||||
} catch (error) {
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
error: `Request URL could not be parsed: ${request.url}`
|
||||
}),
|
||||
{
|
||||
status: 422,
|
||||
headers: {
|
||||
"content-type": "application/json"
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
if (pathname !== options.path || request.method !== "POST") {
|
||||
return onUnhandledRequestDefault2(request);
|
||||
}
|
||||
if (typeof request.headers.get("content-type") !== "string" || !request.headers.get("content-type").startsWith("application/json")) {
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
error: `Unsupported "Content-Type" header value. Must be "application/json"`
|
||||
}),
|
||||
{
|
||||
status: 415,
|
||||
headers: {
|
||||
"content-type": "application/json"
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
const missingHeaders = getMissingHeaders2(request).join(", ");
|
||||
if (missingHeaders) {
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
error: `Required headers missing: ${missingHeaders}`
|
||||
}),
|
||||
{
|
||||
status: 422,
|
||||
headers: {
|
||||
"content-type": "application/json"
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
const eventName = request.headers.get("x-github-event");
|
||||
const signatureSHA256 = request.headers.get("x-hub-signature-256");
|
||||
const id = request.headers.get("x-github-delivery");
|
||||
options.log.debug(`${eventName} event received (id: ${id})`);
|
||||
let didTimeout = false;
|
||||
let timeout;
|
||||
const timeoutPromise = new Promise((resolve) => {
|
||||
timeout = setTimeout(() => {
|
||||
didTimeout = true;
|
||||
resolve(
|
||||
new Response("still processing\n", {
|
||||
status: 202,
|
||||
headers: { "Content-Type": "text/plain" }
|
||||
})
|
||||
);
|
||||
}, 9e3).unref();
|
||||
});
|
||||
const processWebhook = async () => {
|
||||
try {
|
||||
const payload = await getPayload2(request);
|
||||
await webhooks.verifyAndReceive({
|
||||
id,
|
||||
name: eventName,
|
||||
payload,
|
||||
signature: signatureSHA256
|
||||
});
|
||||
clearTimeout(timeout);
|
||||
if (didTimeout) return new Response(null);
|
||||
return new Response("ok\n");
|
||||
} catch (error) {
|
||||
clearTimeout(timeout);
|
||||
if (didTimeout) return new Response(null);
|
||||
const err = Array.from(error.errors)[0];
|
||||
const errorMessage = err.message ? `${err.name}: ${err.message}` : "Error: An Unspecified error occurred";
|
||||
options.log.error(error);
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
error: errorMessage
|
||||
}),
|
||||
{
|
||||
status: typeof err.status !== "undefined" ? err.status : 500,
|
||||
headers: {
|
||||
"content-type": "application/json"
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
return await Promise.race([timeoutPromise, processWebhook()]);
|
||||
}
|
||||
|
||||
// pkg/dist-src/middleware/web/index.js
|
||||
function createWebMiddleware(webhooks, {
|
||||
path = "/api/github/webhooks",
|
||||
log = createLogger()
|
||||
} = {}) {
|
||||
return middleware2.bind(null, webhooks, {
|
||||
path,
|
||||
log
|
||||
});
|
||||
}
|
||||
|
||||
// pkg/dist-src/index.js
|
||||
var Webhooks = class {
|
||||
sign;
|
||||
|
|
@ -688,5 +831,6 @@ export {
|
|||
Webhooks,
|
||||
createEventHandler,
|
||||
createNodeMiddleware,
|
||||
createWebMiddleware,
|
||||
emitterEventNames
|
||||
};
|
||||
|
|
|
|||
8
node_modules/@octokit/webhooks/dist-bundle/index.js.map
generated
vendored
8
node_modules/@octokit/webhooks/dist-bundle/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