Upgrade octokit to v4.1.2
This commit is contained in:
parent
dbbcbe019d
commit
c1745a9831
1214 changed files with 160765 additions and 0 deletions
37
node_modules/@octokit/webhooks/dist-src/event-handler/on.js
generated
vendored
Normal file
37
node_modules/@octokit/webhooks/dist-src/event-handler/on.js
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import { emitterEventNames } from "../generated/webhook-names.js";
|
||||
function handleEventHandlers(state, webhookName, handler) {
|
||||
if (!state.hooks[webhookName]) {
|
||||
state.hooks[webhookName] = [];
|
||||
}
|
||||
state.hooks[webhookName].push(handler);
|
||||
}
|
||||
function receiverOn(state, webhookNameOrNames, handler) {
|
||||
if (Array.isArray(webhookNameOrNames)) {
|
||||
webhookNameOrNames.forEach(
|
||||
(webhookName) => receiverOn(state, webhookName, handler)
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (["*", "error"].includes(webhookNameOrNames)) {
|
||||
const webhookName = webhookNameOrNames === "*" ? "any" : webhookNameOrNames;
|
||||
const message = `Using the "${webhookNameOrNames}" event with the regular Webhooks.on() function is not supported. Please use the Webhooks.on${webhookName.charAt(0).toUpperCase() + webhookName.slice(1)}() method instead`;
|
||||
throw new Error(message);
|
||||
}
|
||||
if (!emitterEventNames.includes(webhookNameOrNames)) {
|
||||
state.log.warn(
|
||||
`"${webhookNameOrNames}" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`
|
||||
);
|
||||
}
|
||||
handleEventHandlers(state, webhookNameOrNames, handler);
|
||||
}
|
||||
function receiverOnAny(state, handler) {
|
||||
handleEventHandlers(state, "*", handler);
|
||||
}
|
||||
function receiverOnError(state, handler) {
|
||||
handleEventHandlers(state, "error", handler);
|
||||
}
|
||||
export {
|
||||
receiverOn,
|
||||
receiverOnAny,
|
||||
receiverOnError
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue