@octokit/webhooks 11.0.0-beta.2 → 11.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist-node/index.js +27 -50
- package/dist-node/index.js.map +1 -1
- package/dist-src/generated/webhook-names.js +10 -0
- package/dist-src/index.js +12 -2
- package/dist-src/to-normalized-json-string.js +1 -1
- package/dist-types/generated/webhook-names.d.ts +1 -1
- package/dist-types/index.d.ts +12 -2
- package/dist-types/middleware/node/get-missing-headers.d.ts +1 -1
- package/dist-types/middleware/node/get-payload.d.ts +1 -1
- package/dist-types/middleware/node/middleware.d.ts +2 -2
- package/dist-types/middleware/node/on-unhandled-request-default.d.ts +2 -2
- package/dist-types/middleware/node/types.d.ts +1 -1
- package/dist-types/to-normalized-json-string.d.ts +1 -1
- package/dist-types/types.d.ts +10 -9
- package/dist-web/index.js +23 -3
- package/dist-web/index.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -191,7 +191,7 @@ webhooks.verify(eventPayload, signature);
|
|
|
191
191
|
eventPayload
|
|
192
192
|
</code>
|
|
193
193
|
<em>
|
|
194
|
-
(Object or String)
|
|
194
|
+
(Object [deprecated] or String)
|
|
195
195
|
</em>
|
|
196
196
|
</td>
|
|
197
197
|
<td>
|
|
@@ -262,7 +262,7 @@ webhooks.verifyAndReceive({ id, name, payload, signature });
|
|
|
262
262
|
payload
|
|
263
263
|
</code>
|
|
264
264
|
<em>
|
|
265
|
-
Object or String
|
|
265
|
+
Object (deprecated) or String
|
|
266
266
|
</em>
|
|
267
267
|
</td>
|
|
268
268
|
<td>
|
|
@@ -626,6 +626,7 @@ If there are actions for a webhook, events are emitted for both, the webhook nam
|
|
|
626
626
|
| [`commit_comment`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#commit_comment) | `created` |
|
|
627
627
|
| [`create`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#create) | |
|
|
628
628
|
| [`delete`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#delete) | |
|
|
629
|
+
| [`dependabot_alert`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#dependabot_alert) | `created`<br>`dismissed`<br>`fixed`<br>`reintroduced`<br>`reopened` |
|
|
629
630
|
| [`deploy_key`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#deploy_key) | `created`<br>`deleted` |
|
|
630
631
|
| [`deployment`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#deployment) | `created` |
|
|
631
632
|
| [`deployment_status`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#deployment_status) | `created` |
|
|
@@ -660,6 +661,7 @@ If there are actions for a webhook, events are emitted for both, the webhook nam
|
|
|
660
661
|
| [`pull_request_review_comment`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request_review_comment) | `created`<br>`deleted`<br>`edited` |
|
|
661
662
|
| [`pull_request_review_thread`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request_review_thread) | `resolved`<br>`unresolved` |
|
|
662
663
|
| [`push`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push) | |
|
|
664
|
+
| [`registry_package`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#registry_package) | `published`<br>`updated` |
|
|
663
665
|
| [`release`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#release) | `created`<br>`deleted`<br>`edited`<br>`prereleased`<br>`published`<br>`released`<br>`unpublished` |
|
|
664
666
|
| [`repository`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#repository) | `archived`<br>`created`<br>`deleted`<br>`edited`<br>`privatized`<br>`publicized`<br>`renamed`<br>`transferred`<br>`unarchived` |
|
|
665
667
|
| [`repository_dispatch`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#repository_dispatch) | |
|
|
@@ -675,7 +677,7 @@ If there are actions for a webhook, events are emitted for both, the webhook nam
|
|
|
675
677
|
| [`watch`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#watch) | `started` |
|
|
676
678
|
| [`workflow_dispatch`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_dispatch) | |
|
|
677
679
|
| [`workflow_job`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_job) | `completed`<br>`in_progress`<br>`queued` |
|
|
678
|
-
| [`workflow_run`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_run) | `completed`<br>`requested`
|
|
680
|
+
| [`workflow_run`](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_run) | `completed`<br>`in_progress`<br>`requested` |
|
|
679
681
|
|
|
680
682
|
<!-- /autogenerated via scripts/generate-types.ts -->
|
|
681
683
|
|
package/dist-node/index.js
CHANGED
|
@@ -17,32 +17,27 @@ const createLogger = logger => ({
|
|
|
17
17
|
|
|
18
18
|
// THIS FILE IS GENERATED - DO NOT EDIT DIRECTLY
|
|
19
19
|
// make edits in scripts/generate-types.ts
|
|
20
|
-
const emitterEventNames = ["branch_protection_rule", "branch_protection_rule.created", "branch_protection_rule.deleted", "branch_protection_rule.edited", "check_run", "check_run.completed", "check_run.created", "check_run.requested_action", "check_run.rerequested", "check_suite", "check_suite.completed", "check_suite.requested", "check_suite.rerequested", "code_scanning_alert", "code_scanning_alert.appeared_in_branch", "code_scanning_alert.closed_by_user", "code_scanning_alert.created", "code_scanning_alert.fixed", "code_scanning_alert.reopened", "code_scanning_alert.reopened_by_user", "commit_comment", "commit_comment.created", "create", "delete", "deploy_key", "deploy_key.created", "deploy_key.deleted", "deployment", "deployment.created", "deployment_status", "deployment_status.created", "discussion", "discussion.answered", "discussion.category_changed", "discussion.created", "discussion.deleted", "discussion.edited", "discussion.labeled", "discussion.locked", "discussion.pinned", "discussion.transferred", "discussion.unanswered", "discussion.unlabeled", "discussion.unlocked", "discussion.unpinned", "discussion_comment", "discussion_comment.created", "discussion_comment.deleted", "discussion_comment.edited", "fork", "github_app_authorization", "github_app_authorization.revoked", "gollum", "installation", "installation.created", "installation.deleted", "installation.new_permissions_accepted", "installation.suspend", "installation.unsuspend", "installation_repositories", "installation_repositories.added", "installation_repositories.removed", "issue_comment", "issue_comment.created", "issue_comment.deleted", "issue_comment.edited", "issues", "issues.assigned", "issues.closed", "issues.deleted", "issues.demilestoned", "issues.edited", "issues.labeled", "issues.locked", "issues.milestoned", "issues.opened", "issues.pinned", "issues.reopened", "issues.transferred", "issues.unassigned", "issues.unlabeled", "issues.unlocked", "issues.unpinned", "label", "label.created", "label.deleted", "label.edited", "marketplace_purchase", "marketplace_purchase.cancelled", "marketplace_purchase.changed", "marketplace_purchase.pending_change", "marketplace_purchase.pending_change_cancelled", "marketplace_purchase.purchased", "member", "member.added", "member.edited", "member.removed", "membership", "membership.added", "membership.removed", "merge_group", "merge_group.checks_requested", "meta", "meta.deleted", "milestone", "milestone.closed", "milestone.created", "milestone.deleted", "milestone.edited", "milestone.opened", "org_block", "org_block.blocked", "org_block.unblocked", "organization", "organization.deleted", "organization.member_added", "organization.member_invited", "organization.member_removed", "organization.renamed", "package", "package.published", "package.updated", "page_build", "ping", "project", "project.closed", "project.created", "project.deleted", "project.edited", "project.reopened", "project_card", "project_card.converted", "project_card.created", "project_card.deleted", "project_card.edited", "project_card.moved", "project_column", "project_column.created", "project_column.deleted", "project_column.edited", "project_column.moved", "projects_v2_item", "projects_v2_item.archived", "projects_v2_item.converted", "projects_v2_item.created", "projects_v2_item.deleted", "projects_v2_item.edited", "projects_v2_item.reordered", "projects_v2_item.restored", "public", "pull_request", "pull_request.assigned", "pull_request.auto_merge_disabled", "pull_request.auto_merge_enabled", "pull_request.closed", "pull_request.converted_to_draft", "pull_request.dequeued", "pull_request.edited", "pull_request.labeled", "pull_request.locked", "pull_request.opened", "pull_request.queued", "pull_request.ready_for_review", "pull_request.reopened", "pull_request.review_request_removed", "pull_request.review_requested", "pull_request.synchronize", "pull_request.unassigned", "pull_request.unlabeled", "pull_request.unlocked", "pull_request_review", "pull_request_review.dismissed", "pull_request_review.edited", "pull_request_review.submitted", "pull_request_review_comment", "pull_request_review_comment.created", "pull_request_review_comment.deleted", "pull_request_review_comment.edited", "pull_request_review_thread", "pull_request_review_thread.resolved", "pull_request_review_thread.unresolved", "push", "release", "release.created", "release.deleted", "release.edited", "release.prereleased", "release.published", "release.released", "release.unpublished", "repository", "repository.archived", "repository.created", "repository.deleted", "repository.edited", "repository.privatized", "repository.publicized", "repository.renamed", "repository.transferred", "repository.unarchived", "repository_dispatch", "repository_import", "repository_vulnerability_alert", "repository_vulnerability_alert.create", "repository_vulnerability_alert.dismiss", "repository_vulnerability_alert.reopen", "repository_vulnerability_alert.resolve", "secret_scanning_alert", "secret_scanning_alert.created", "secret_scanning_alert.reopened", "secret_scanning_alert.resolved", "security_advisory", "security_advisory.performed", "security_advisory.published", "security_advisory.updated", "security_advisory.withdrawn", "sponsorship", "sponsorship.cancelled", "sponsorship.created", "sponsorship.edited", "sponsorship.pending_cancellation", "sponsorship.pending_tier_change", "sponsorship.tier_changed", "star", "star.created", "star.deleted", "status", "team", "team.added_to_repository", "team.created", "team.deleted", "team.edited", "team.removed_from_repository", "team_add", "watch", "watch.started", "workflow_dispatch", "workflow_job", "workflow_job.completed", "workflow_job.in_progress", "workflow_job.queued", "workflow_run", "workflow_run.completed", "workflow_run.requested"];
|
|
20
|
+
const emitterEventNames = ["branch_protection_rule", "branch_protection_rule.created", "branch_protection_rule.deleted", "branch_protection_rule.edited", "check_run", "check_run.completed", "check_run.created", "check_run.requested_action", "check_run.rerequested", "check_suite", "check_suite.completed", "check_suite.requested", "check_suite.rerequested", "code_scanning_alert", "code_scanning_alert.appeared_in_branch", "code_scanning_alert.closed_by_user", "code_scanning_alert.created", "code_scanning_alert.fixed", "code_scanning_alert.reopened", "code_scanning_alert.reopened_by_user", "commit_comment", "commit_comment.created", "create", "delete", "dependabot_alert", "dependabot_alert.created", "dependabot_alert.dismissed", "dependabot_alert.fixed", "dependabot_alert.reintroduced", "dependabot_alert.reopened", "deploy_key", "deploy_key.created", "deploy_key.deleted", "deployment", "deployment.created", "deployment_status", "deployment_status.created", "discussion", "discussion.answered", "discussion.category_changed", "discussion.created", "discussion.deleted", "discussion.edited", "discussion.labeled", "discussion.locked", "discussion.pinned", "discussion.transferred", "discussion.unanswered", "discussion.unlabeled", "discussion.unlocked", "discussion.unpinned", "discussion_comment", "discussion_comment.created", "discussion_comment.deleted", "discussion_comment.edited", "fork", "github_app_authorization", "github_app_authorization.revoked", "gollum", "installation", "installation.created", "installation.deleted", "installation.new_permissions_accepted", "installation.suspend", "installation.unsuspend", "installation_repositories", "installation_repositories.added", "installation_repositories.removed", "issue_comment", "issue_comment.created", "issue_comment.deleted", "issue_comment.edited", "issues", "issues.assigned", "issues.closed", "issues.deleted", "issues.demilestoned", "issues.edited", "issues.labeled", "issues.locked", "issues.milestoned", "issues.opened", "issues.pinned", "issues.reopened", "issues.transferred", "issues.unassigned", "issues.unlabeled", "issues.unlocked", "issues.unpinned", "label", "label.created", "label.deleted", "label.edited", "marketplace_purchase", "marketplace_purchase.cancelled", "marketplace_purchase.changed", "marketplace_purchase.pending_change", "marketplace_purchase.pending_change_cancelled", "marketplace_purchase.purchased", "member", "member.added", "member.edited", "member.removed", "membership", "membership.added", "membership.removed", "merge_group", "merge_group.checks_requested", "meta", "meta.deleted", "milestone", "milestone.closed", "milestone.created", "milestone.deleted", "milestone.edited", "milestone.opened", "org_block", "org_block.blocked", "org_block.unblocked", "organization", "organization.deleted", "organization.member_added", "organization.member_invited", "organization.member_removed", "organization.renamed", "package", "package.published", "package.updated", "page_build", "ping", "project", "project.closed", "project.created", "project.deleted", "project.edited", "project.reopened", "project_card", "project_card.converted", "project_card.created", "project_card.deleted", "project_card.edited", "project_card.moved", "project_column", "project_column.created", "project_column.deleted", "project_column.edited", "project_column.moved", "projects_v2_item", "projects_v2_item.archived", "projects_v2_item.converted", "projects_v2_item.created", "projects_v2_item.deleted", "projects_v2_item.edited", "projects_v2_item.reordered", "projects_v2_item.restored", "public", "pull_request", "pull_request.assigned", "pull_request.auto_merge_disabled", "pull_request.auto_merge_enabled", "pull_request.closed", "pull_request.converted_to_draft", "pull_request.dequeued", "pull_request.edited", "pull_request.labeled", "pull_request.locked", "pull_request.opened", "pull_request.queued", "pull_request.ready_for_review", "pull_request.reopened", "pull_request.review_request_removed", "pull_request.review_requested", "pull_request.synchronize", "pull_request.unassigned", "pull_request.unlabeled", "pull_request.unlocked", "pull_request_review", "pull_request_review.dismissed", "pull_request_review.edited", "pull_request_review.submitted", "pull_request_review_comment", "pull_request_review_comment.created", "pull_request_review_comment.deleted", "pull_request_review_comment.edited", "pull_request_review_thread", "pull_request_review_thread.resolved", "pull_request_review_thread.unresolved", "push", "registry_package", "registry_package.published", "registry_package.updated", "release", "release.created", "release.deleted", "release.edited", "release.prereleased", "release.published", "release.released", "release.unpublished", "repository", "repository.archived", "repository.created", "repository.deleted", "repository.edited", "repository.privatized", "repository.publicized", "repository.renamed", "repository.transferred", "repository.unarchived", "repository_dispatch", "repository_import", "repository_vulnerability_alert", "repository_vulnerability_alert.create", "repository_vulnerability_alert.dismiss", "repository_vulnerability_alert.reopen", "repository_vulnerability_alert.resolve", "secret_scanning_alert", "secret_scanning_alert.created", "secret_scanning_alert.reopened", "secret_scanning_alert.resolved", "security_advisory", "security_advisory.performed", "security_advisory.published", "security_advisory.updated", "security_advisory.withdrawn", "sponsorship", "sponsorship.cancelled", "sponsorship.created", "sponsorship.edited", "sponsorship.pending_cancellation", "sponsorship.pending_tier_change", "sponsorship.tier_changed", "star", "star.created", "star.deleted", "status", "team", "team.added_to_repository", "team.created", "team.deleted", "team.edited", "team.removed_from_repository", "team_add", "watch", "watch.started", "workflow_dispatch", "workflow_job", "workflow_job.completed", "workflow_job.in_progress", "workflow_job.queued", "workflow_run", "workflow_run.completed", "workflow_run.in_progress", "workflow_run.requested"];
|
|
21
21
|
|
|
22
22
|
function handleEventHandlers(state, webhookName, handler) {
|
|
23
23
|
if (!state.hooks[webhookName]) {
|
|
24
24
|
state.hooks[webhookName] = [];
|
|
25
25
|
}
|
|
26
|
-
|
|
27
26
|
state.hooks[webhookName].push(handler);
|
|
28
27
|
}
|
|
29
|
-
|
|
30
28
|
function receiverOn(state, webhookNameOrNames, handler) {
|
|
31
29
|
if (Array.isArray(webhookNameOrNames)) {
|
|
32
30
|
webhookNameOrNames.forEach(webhookName => receiverOn(state, webhookName, handler));
|
|
33
31
|
return;
|
|
34
32
|
}
|
|
35
|
-
|
|
36
33
|
if (["*", "error"].includes(webhookNameOrNames)) {
|
|
37
34
|
const webhookName = webhookNameOrNames === "*" ? "any" : webhookNameOrNames;
|
|
38
35
|
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`;
|
|
39
36
|
throw new Error(message);
|
|
40
37
|
}
|
|
41
|
-
|
|
42
38
|
if (!emitterEventNames.includes(webhookNameOrNames)) {
|
|
43
39
|
state.log.warn(`"${webhookNameOrNames}" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`);
|
|
44
40
|
}
|
|
45
|
-
|
|
46
41
|
handleEventHandlers(state, webhookNameOrNames, handler);
|
|
47
42
|
}
|
|
48
43
|
function receiverOnAny(state, handler) {
|
|
@@ -57,14 +52,12 @@ function receiverOnError(state, handler) {
|
|
|
57
52
|
// "Fatal: Error occurred" message to stdout
|
|
58
53
|
function wrapErrorHandler(handler, error) {
|
|
59
54
|
let returnValue;
|
|
60
|
-
|
|
61
55
|
try {
|
|
62
56
|
returnValue = handler(error);
|
|
63
57
|
} catch (error) {
|
|
64
58
|
console.log('FATAL: Error occurred in "error" event handler');
|
|
65
59
|
console.log(error);
|
|
66
60
|
}
|
|
67
|
-
|
|
68
61
|
if (returnValue && returnValue.catch) {
|
|
69
62
|
returnValue.catch(error => {
|
|
70
63
|
console.log('FATAL: Error occurred in "error" event handler');
|
|
@@ -74,21 +67,16 @@ function wrapErrorHandler(handler, error) {
|
|
|
74
67
|
}
|
|
75
68
|
|
|
76
69
|
// @ts-ignore to address #245
|
|
77
|
-
|
|
78
70
|
function getHooks(state, eventPayloadAction, eventName) {
|
|
79
71
|
const hooks = [state.hooks[eventName], state.hooks["*"]];
|
|
80
|
-
|
|
81
72
|
if (eventPayloadAction) {
|
|
82
73
|
hooks.unshift(state.hooks[`${eventName}.${eventPayloadAction}`]);
|
|
83
74
|
}
|
|
84
|
-
|
|
85
75
|
return [].concat(...hooks.filter(Boolean));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
76
|
+
}
|
|
77
|
+
// main handler function
|
|
89
78
|
function receiverHandle(state, event) {
|
|
90
79
|
const errorHandlers = state.hooks.error || [];
|
|
91
|
-
|
|
92
80
|
if (event instanceof Error) {
|
|
93
81
|
const error = Object.assign(new AggregateError([event]), {
|
|
94
82
|
event,
|
|
@@ -97,30 +85,23 @@ function receiverHandle(state, event) {
|
|
|
97
85
|
errorHandlers.forEach(handler => wrapErrorHandler(handler, error));
|
|
98
86
|
return Promise.reject(error);
|
|
99
87
|
}
|
|
100
|
-
|
|
101
88
|
if (!event || !event.name) {
|
|
102
89
|
throw new AggregateError(["Event name not passed"]);
|
|
103
90
|
}
|
|
104
|
-
|
|
105
91
|
if (!event.payload) {
|
|
106
92
|
throw new AggregateError(["Event payload not passed"]);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
93
|
+
}
|
|
94
|
+
// flatten arrays of event listeners and remove undefined values
|
|
110
95
|
const hooks = getHooks(state, "action" in event.payload ? event.payload.action : null, event.name);
|
|
111
|
-
|
|
112
96
|
if (hooks.length === 0) {
|
|
113
97
|
return Promise.resolve();
|
|
114
98
|
}
|
|
115
|
-
|
|
116
99
|
const errors = [];
|
|
117
100
|
const promises = hooks.map(handler => {
|
|
118
101
|
let promise = Promise.resolve(event);
|
|
119
|
-
|
|
120
102
|
if (state.transform) {
|
|
121
103
|
promise = promise.then(state.transform);
|
|
122
104
|
}
|
|
123
|
-
|
|
124
105
|
return promise.then(event => {
|
|
125
106
|
return handler(event);
|
|
126
107
|
}).catch(error => errors.push(Object.assign(error, {
|
|
@@ -131,7 +112,6 @@ function receiverHandle(state, event) {
|
|
|
131
112
|
if (errors.length === 0) {
|
|
132
113
|
return;
|
|
133
114
|
}
|
|
134
|
-
|
|
135
115
|
const error = new AggregateError(errors);
|
|
136
116
|
Object.assign(error, {
|
|
137
117
|
event,
|
|
@@ -147,13 +127,11 @@ function removeListener(state, webhookNameOrNames, handler) {
|
|
|
147
127
|
webhookNameOrNames.forEach(webhookName => removeListener(state, webhookName, handler));
|
|
148
128
|
return;
|
|
149
129
|
}
|
|
150
|
-
|
|
151
130
|
if (!state.hooks[webhookNameOrNames]) {
|
|
152
131
|
return;
|
|
153
|
-
}
|
|
132
|
+
}
|
|
133
|
+
// remove last hook that has been added, that way
|
|
154
134
|
// it behaves the same as removeListener
|
|
155
|
-
|
|
156
|
-
|
|
157
135
|
for (let i = state.hooks[webhookNameOrNames].length - 1; i >= 0; i--) {
|
|
158
136
|
if (state.hooks[webhookNameOrNames][i] === handler) {
|
|
159
137
|
state.hooks[webhookNameOrNames].splice(i, 1);
|
|
@@ -167,11 +145,9 @@ function createEventHandler(options) {
|
|
|
167
145
|
hooks: {},
|
|
168
146
|
log: createLogger(options && options.log)
|
|
169
147
|
};
|
|
170
|
-
|
|
171
148
|
if (options && options.transform) {
|
|
172
149
|
state.transform = options.transform;
|
|
173
150
|
}
|
|
174
|
-
|
|
175
151
|
return {
|
|
176
152
|
on: receiverOn.bind(null, state),
|
|
177
153
|
onAny: receiverOnAny.bind(null, state),
|
|
@@ -182,7 +158,7 @@ function createEventHandler(options) {
|
|
|
182
158
|
}
|
|
183
159
|
|
|
184
160
|
/**
|
|
185
|
-
* GitHub sends its JSON with
|
|
161
|
+
* GitHub sends its JSON with no indentation and no line break at the end
|
|
186
162
|
*/
|
|
187
163
|
function toNormalizedJsonString(payload) {
|
|
188
164
|
const payloadString = JSON.stringify(payload);
|
|
@@ -202,7 +178,6 @@ async function verify(secret, payload, signature) {
|
|
|
202
178
|
async function verifyAndReceive(state, event) {
|
|
203
179
|
// verify will validate that the secret is not undefined
|
|
204
180
|
const matchesSignature = await webhooksMethods.verify(state.secret, typeof event.payload === "object" ? toNormalizedJsonString(event.payload) : event.payload, event.signature);
|
|
205
|
-
|
|
206
181
|
if (!matchesSignature) {
|
|
207
182
|
const error = new Error("[@octokit/webhooks] signature does not match event payload and secret");
|
|
208
183
|
return state.eventHandler.receive(Object.assign(error, {
|
|
@@ -210,7 +185,6 @@ async function verifyAndReceive(state, event) {
|
|
|
210
185
|
status: 400
|
|
211
186
|
}));
|
|
212
187
|
}
|
|
213
|
-
|
|
214
188
|
return state.eventHandler.receive({
|
|
215
189
|
id: event.id,
|
|
216
190
|
name: event.name,
|
|
@@ -218,8 +192,8 @@ async function verifyAndReceive(state, event) {
|
|
|
218
192
|
});
|
|
219
193
|
}
|
|
220
194
|
|
|
221
|
-
const WEBHOOK_HEADERS = ["x-github-event", "x-hub-signature-256", "x-github-delivery"];
|
|
222
|
-
|
|
195
|
+
const WEBHOOK_HEADERS = ["x-github-event", "x-hub-signature-256", "x-github-delivery"];
|
|
196
|
+
// https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#delivery-headers
|
|
223
197
|
function getMissingHeaders(request) {
|
|
224
198
|
return WEBHOOK_HEADERS.filter(header => !(header in request.headers));
|
|
225
199
|
}
|
|
@@ -231,8 +205,8 @@ function getPayload(request) {
|
|
|
231
205
|
if (request.body) return Promise.resolve(request.body);
|
|
232
206
|
return new Promise((resolve, reject) => {
|
|
233
207
|
let data = "";
|
|
234
|
-
request.setEncoding("utf8");
|
|
235
|
-
|
|
208
|
+
request.setEncoding("utf8");
|
|
209
|
+
// istanbul ignore next
|
|
236
210
|
request.on("error", error => reject(new AggregateError([error])));
|
|
237
211
|
request.on("data", chunk => data += chunk);
|
|
238
212
|
request.on("end", () => {
|
|
@@ -258,7 +232,6 @@ function onUnhandledRequestDefault(request, response) {
|
|
|
258
232
|
|
|
259
233
|
async function middleware(webhooks, options, request, response, next) {
|
|
260
234
|
let pathname;
|
|
261
|
-
|
|
262
235
|
try {
|
|
263
236
|
pathname = new URL(request.url, "http://localhost").pathname;
|
|
264
237
|
} catch (error) {
|
|
@@ -270,7 +243,6 @@ async function middleware(webhooks, options, request, response, next) {
|
|
|
270
243
|
}));
|
|
271
244
|
return true;
|
|
272
245
|
}
|
|
273
|
-
|
|
274
246
|
if (pathname !== options.path) {
|
|
275
247
|
next === null || next === void 0 ? void 0 : next();
|
|
276
248
|
return false;
|
|
@@ -278,9 +250,7 @@ async function middleware(webhooks, options, request, response, next) {
|
|
|
278
250
|
onUnhandledRequestDefault(request, response);
|
|
279
251
|
return true;
|
|
280
252
|
}
|
|
281
|
-
|
|
282
253
|
const missingHeaders = getMissingHeaders(request).join(", ");
|
|
283
|
-
|
|
284
254
|
if (missingHeaders) {
|
|
285
255
|
response.writeHead(400, {
|
|
286
256
|
"content-type": "application/json"
|
|
@@ -290,20 +260,18 @@ async function middleware(webhooks, options, request, response, next) {
|
|
|
290
260
|
}));
|
|
291
261
|
return true;
|
|
292
262
|
}
|
|
293
|
-
|
|
294
263
|
const eventName = request.headers["x-github-event"];
|
|
295
264
|
const signatureSHA256 = request.headers["x-hub-signature-256"];
|
|
296
265
|
const id = request.headers["x-github-delivery"];
|
|
297
|
-
options.log.debug(`${eventName} event received (id: ${id})`);
|
|
266
|
+
options.log.debug(`${eventName} event received (id: ${id})`);
|
|
267
|
+
// GitHub will abort the request if it does not receive a response within 10s
|
|
298
268
|
// See https://github.com/octokit/webhooks.js/issues/185
|
|
299
|
-
|
|
300
269
|
let didTimeout = false;
|
|
301
270
|
const timeout = setTimeout(() => {
|
|
302
271
|
didTimeout = true;
|
|
303
272
|
response.statusCode = 202;
|
|
304
273
|
response.end("still processing\n");
|
|
305
274
|
}, 9000).unref();
|
|
306
|
-
|
|
307
275
|
try {
|
|
308
276
|
const payload = await getPayload(request);
|
|
309
277
|
await webhooks.verifyAndReceive({
|
|
@@ -340,12 +308,12 @@ function createNodeMiddleware(webhooks, {
|
|
|
340
308
|
});
|
|
341
309
|
}
|
|
342
310
|
|
|
311
|
+
// U holds the return value of `transform` function in Options
|
|
343
312
|
class Webhooks {
|
|
344
313
|
constructor(options) {
|
|
345
314
|
if (!options || !options.secret) {
|
|
346
315
|
throw new Error("[@octokit/webhooks] options.secret required");
|
|
347
316
|
}
|
|
348
|
-
|
|
349
317
|
const state = {
|
|
350
318
|
eventHandler: createEventHandler(options),
|
|
351
319
|
secret: options.secret,
|
|
@@ -353,15 +321,24 @@ class Webhooks {
|
|
|
353
321
|
log: createLogger(options.log)
|
|
354
322
|
};
|
|
355
323
|
this.sign = sign.bind(null, options.secret);
|
|
356
|
-
this.verify =
|
|
324
|
+
this.verify = (eventPayload, signature) => {
|
|
325
|
+
if (typeof eventPayload === "object") {
|
|
326
|
+
console.error("[@octokit/webhooks] Passing a JSON payload object to `verify()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`");
|
|
327
|
+
}
|
|
328
|
+
return verify(options.secret, eventPayload, signature);
|
|
329
|
+
};
|
|
357
330
|
this.on = state.eventHandler.on;
|
|
358
331
|
this.onAny = state.eventHandler.onAny;
|
|
359
332
|
this.onError = state.eventHandler.onError;
|
|
360
333
|
this.removeListener = state.eventHandler.removeListener;
|
|
361
334
|
this.receive = state.eventHandler.receive;
|
|
362
|
-
this.verifyAndReceive =
|
|
335
|
+
this.verifyAndReceive = options => {
|
|
336
|
+
if (typeof options.payload === "object") {
|
|
337
|
+
console.error("[@octokit/webhooks] Passing a JSON payload object to `verifyAndReceive()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`");
|
|
338
|
+
}
|
|
339
|
+
return verifyAndReceive(state, options);
|
|
340
|
+
};
|
|
363
341
|
}
|
|
364
|
-
|
|
365
342
|
}
|
|
366
343
|
|
|
367
344
|
exports.Webhooks = Webhooks;
|
package/dist-node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../dist-src/createLogger.js","../dist-src/generated/webhook-names.js","../dist-src/event-handler/on.js","../dist-src/event-handler/wrap-error-handler.js","../dist-src/event-handler/receive.js","../dist-src/event-handler/remove-listener.js","../dist-src/event-handler/index.js","../dist-src/to-normalized-json-string.js","../dist-src/sign.js","../dist-src/verify.js","../dist-src/verify-and-receive.js","../dist-src/middleware/node/get-missing-headers.js","../dist-src/middleware/node/get-payload.js","../dist-src/middleware/node/on-unhandled-request-default.js","../dist-src/middleware/node/middleware.js","../dist-src/middleware/node/index.js","../dist-src/index.js"],"sourcesContent":["export const createLogger = (logger) => ({\n debug: () => { },\n info: () => { },\n warn: console.warn.bind(console),\n error: console.error.bind(console),\n ...logger,\n});\n","// THIS FILE IS GENERATED - DO NOT EDIT DIRECTLY\n// make edits in scripts/generate-types.ts\nexport const emitterEventNames = [\n \"branch_protection_rule\",\n \"branch_protection_rule.created\",\n \"branch_protection_rule.deleted\",\n \"branch_protection_rule.edited\",\n \"check_run\",\n \"check_run.completed\",\n \"check_run.created\",\n \"check_run.requested_action\",\n \"check_run.rerequested\",\n \"check_suite\",\n \"check_suite.completed\",\n \"check_suite.requested\",\n \"check_suite.rerequested\",\n \"code_scanning_alert\",\n \"code_scanning_alert.appeared_in_branch\",\n \"code_scanning_alert.closed_by_user\",\n \"code_scanning_alert.created\",\n \"code_scanning_alert.fixed\",\n \"code_scanning_alert.reopened\",\n \"code_scanning_alert.reopened_by_user\",\n \"commit_comment\",\n \"commit_comment.created\",\n \"create\",\n \"delete\",\n \"deploy_key\",\n \"deploy_key.created\",\n \"deploy_key.deleted\",\n \"deployment\",\n \"deployment.created\",\n \"deployment_status\",\n \"deployment_status.created\",\n \"discussion\",\n \"discussion.answered\",\n \"discussion.category_changed\",\n \"discussion.created\",\n \"discussion.deleted\",\n \"discussion.edited\",\n \"discussion.labeled\",\n \"discussion.locked\",\n \"discussion.pinned\",\n \"discussion.transferred\",\n \"discussion.unanswered\",\n \"discussion.unlabeled\",\n \"discussion.unlocked\",\n \"discussion.unpinned\",\n \"discussion_comment\",\n \"discussion_comment.created\",\n \"discussion_comment.deleted\",\n \"discussion_comment.edited\",\n \"fork\",\n \"github_app_authorization\",\n \"github_app_authorization.revoked\",\n \"gollum\",\n \"installation\",\n \"installation.created\",\n \"installation.deleted\",\n \"installation.new_permissions_accepted\",\n \"installation.suspend\",\n \"installation.unsuspend\",\n \"installation_repositories\",\n \"installation_repositories.added\",\n \"installation_repositories.removed\",\n \"issue_comment\",\n \"issue_comment.created\",\n \"issue_comment.deleted\",\n \"issue_comment.edited\",\n \"issues\",\n \"issues.assigned\",\n \"issues.closed\",\n \"issues.deleted\",\n \"issues.demilestoned\",\n \"issues.edited\",\n \"issues.labeled\",\n \"issues.locked\",\n \"issues.milestoned\",\n \"issues.opened\",\n \"issues.pinned\",\n \"issues.reopened\",\n \"issues.transferred\",\n \"issues.unassigned\",\n \"issues.unlabeled\",\n \"issues.unlocked\",\n \"issues.unpinned\",\n \"label\",\n \"label.created\",\n \"label.deleted\",\n \"label.edited\",\n \"marketplace_purchase\",\n \"marketplace_purchase.cancelled\",\n \"marketplace_purchase.changed\",\n \"marketplace_purchase.pending_change\",\n \"marketplace_purchase.pending_change_cancelled\",\n \"marketplace_purchase.purchased\",\n \"member\",\n \"member.added\",\n \"member.edited\",\n \"member.removed\",\n \"membership\",\n \"membership.added\",\n \"membership.removed\",\n \"merge_group\",\n \"merge_group.checks_requested\",\n \"meta\",\n \"meta.deleted\",\n \"milestone\",\n \"milestone.closed\",\n \"milestone.created\",\n \"milestone.deleted\",\n \"milestone.edited\",\n \"milestone.opened\",\n \"org_block\",\n \"org_block.blocked\",\n \"org_block.unblocked\",\n \"organization\",\n \"organization.deleted\",\n \"organization.member_added\",\n \"organization.member_invited\",\n \"organization.member_removed\",\n \"organization.renamed\",\n \"package\",\n \"package.published\",\n \"package.updated\",\n \"page_build\",\n \"ping\",\n \"project\",\n \"project.closed\",\n \"project.created\",\n \"project.deleted\",\n \"project.edited\",\n \"project.reopened\",\n \"project_card\",\n \"project_card.converted\",\n \"project_card.created\",\n \"project_card.deleted\",\n \"project_card.edited\",\n \"project_card.moved\",\n \"project_column\",\n \"project_column.created\",\n \"project_column.deleted\",\n \"project_column.edited\",\n \"project_column.moved\",\n \"projects_v2_item\",\n \"projects_v2_item.archived\",\n \"projects_v2_item.converted\",\n \"projects_v2_item.created\",\n \"projects_v2_item.deleted\",\n \"projects_v2_item.edited\",\n \"projects_v2_item.reordered\",\n \"projects_v2_item.restored\",\n \"public\",\n \"pull_request\",\n \"pull_request.assigned\",\n \"pull_request.auto_merge_disabled\",\n \"pull_request.auto_merge_enabled\",\n \"pull_request.closed\",\n \"pull_request.converted_to_draft\",\n \"pull_request.dequeued\",\n \"pull_request.edited\",\n \"pull_request.labeled\",\n \"pull_request.locked\",\n \"pull_request.opened\",\n \"pull_request.queued\",\n \"pull_request.ready_for_review\",\n \"pull_request.reopened\",\n \"pull_request.review_request_removed\",\n \"pull_request.review_requested\",\n \"pull_request.synchronize\",\n \"pull_request.unassigned\",\n \"pull_request.unlabeled\",\n \"pull_request.unlocked\",\n \"pull_request_review\",\n \"pull_request_review.dismissed\",\n \"pull_request_review.edited\",\n \"pull_request_review.submitted\",\n \"pull_request_review_comment\",\n \"pull_request_review_comment.created\",\n \"pull_request_review_comment.deleted\",\n \"pull_request_review_comment.edited\",\n \"pull_request_review_thread\",\n \"pull_request_review_thread.resolved\",\n \"pull_request_review_thread.unresolved\",\n \"push\",\n \"release\",\n \"release.created\",\n \"release.deleted\",\n \"release.edited\",\n \"release.prereleased\",\n \"release.published\",\n \"release.released\",\n \"release.unpublished\",\n \"repository\",\n \"repository.archived\",\n \"repository.created\",\n \"repository.deleted\",\n \"repository.edited\",\n \"repository.privatized\",\n \"repository.publicized\",\n \"repository.renamed\",\n \"repository.transferred\",\n \"repository.unarchived\",\n \"repository_dispatch\",\n \"repository_import\",\n \"repository_vulnerability_alert\",\n \"repository_vulnerability_alert.create\",\n \"repository_vulnerability_alert.dismiss\",\n \"repository_vulnerability_alert.reopen\",\n \"repository_vulnerability_alert.resolve\",\n \"secret_scanning_alert\",\n \"secret_scanning_alert.created\",\n \"secret_scanning_alert.reopened\",\n \"secret_scanning_alert.resolved\",\n \"security_advisory\",\n \"security_advisory.performed\",\n \"security_advisory.published\",\n \"security_advisory.updated\",\n \"security_advisory.withdrawn\",\n \"sponsorship\",\n \"sponsorship.cancelled\",\n \"sponsorship.created\",\n \"sponsorship.edited\",\n \"sponsorship.pending_cancellation\",\n \"sponsorship.pending_tier_change\",\n \"sponsorship.tier_changed\",\n \"star\",\n \"star.created\",\n \"star.deleted\",\n \"status\",\n \"team\",\n \"team.added_to_repository\",\n \"team.created\",\n \"team.deleted\",\n \"team.edited\",\n \"team.removed_from_repository\",\n \"team_add\",\n \"watch\",\n \"watch.started\",\n \"workflow_dispatch\",\n \"workflow_job\",\n \"workflow_job.completed\",\n \"workflow_job.in_progress\",\n \"workflow_job.queued\",\n \"workflow_run\",\n \"workflow_run.completed\",\n \"workflow_run.requested\",\n];\n","import { emitterEventNames } from \"../generated/webhook-names\";\nfunction handleEventHandlers(state, webhookName, handler) {\n if (!state.hooks[webhookName]) {\n state.hooks[webhookName] = [];\n }\n state.hooks[webhookName].push(handler);\n}\nexport function receiverOn(state, webhookNameOrNames, handler) {\n if (Array.isArray(webhookNameOrNames)) {\n webhookNameOrNames.forEach((webhookName) => receiverOn(state, webhookName, handler));\n return;\n }\n if ([\"*\", \"error\"].includes(webhookNameOrNames)) {\n const webhookName = webhookNameOrNames === \"*\" ? \"any\" : webhookNameOrNames;\n 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`;\n throw new Error(message);\n }\n if (!emitterEventNames.includes(webhookNameOrNames)) {\n state.log.warn(`\"${webhookNameOrNames}\" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`);\n }\n handleEventHandlers(state, webhookNameOrNames, handler);\n}\nexport function receiverOnAny(state, handler) {\n handleEventHandlers(state, \"*\", handler);\n}\nexport function receiverOnError(state, handler) {\n handleEventHandlers(state, \"error\", handler);\n}\n","// Errors thrown or rejected Promises in \"error\" event handlers are not handled\n// as they are in the webhook event handlers. If errors occur, we log a\n// \"Fatal: Error occurred\" message to stdout\nexport function wrapErrorHandler(handler, error) {\n let returnValue;\n try {\n returnValue = handler(error);\n }\n catch (error) {\n console.log('FATAL: Error occurred in \"error\" event handler');\n console.log(error);\n }\n if (returnValue && returnValue.catch) {\n returnValue.catch((error) => {\n console.log('FATAL: Error occurred in \"error\" event handler');\n console.log(error);\n });\n }\n}\n","// @ts-ignore to address #245\nimport AggregateError from \"aggregate-error\";\nimport { wrapErrorHandler } from \"./wrap-error-handler\";\nfunction getHooks(state, eventPayloadAction, eventName) {\n const hooks = [state.hooks[eventName], state.hooks[\"*\"]];\n if (eventPayloadAction) {\n hooks.unshift(state.hooks[`${eventName}.${eventPayloadAction}`]);\n }\n return [].concat(...hooks.filter(Boolean));\n}\n// main handler function\nexport function receiverHandle(state, event) {\n const errorHandlers = state.hooks.error || [];\n if (event instanceof Error) {\n const error = Object.assign(new AggregateError([event]), {\n event,\n errors: [event],\n });\n errorHandlers.forEach((handler) => wrapErrorHandler(handler, error));\n return Promise.reject(error);\n }\n if (!event || !event.name) {\n throw new AggregateError([\"Event name not passed\"]);\n }\n if (!event.payload) {\n throw new AggregateError([\"Event payload not passed\"]);\n }\n // flatten arrays of event listeners and remove undefined values\n const hooks = getHooks(state, \"action\" in event.payload ? event.payload.action : null, event.name);\n if (hooks.length === 0) {\n return Promise.resolve();\n }\n const errors = [];\n const promises = hooks.map((handler) => {\n let promise = Promise.resolve(event);\n if (state.transform) {\n promise = promise.then(state.transform);\n }\n return promise\n .then((event) => {\n return handler(event);\n })\n .catch((error) => errors.push(Object.assign(error, { event })));\n });\n return Promise.all(promises).then(() => {\n if (errors.length === 0) {\n return;\n }\n const error = new AggregateError(errors);\n Object.assign(error, {\n event,\n errors,\n });\n errorHandlers.forEach((handler) => wrapErrorHandler(handler, error));\n throw error;\n });\n}\n","export function removeListener(state, webhookNameOrNames, handler) {\n if (Array.isArray(webhookNameOrNames)) {\n webhookNameOrNames.forEach((webhookName) => removeListener(state, webhookName, handler));\n return;\n }\n if (!state.hooks[webhookNameOrNames]) {\n return;\n }\n // remove last hook that has been added, that way\n // it behaves the same as removeListener\n for (let i = state.hooks[webhookNameOrNames].length - 1; i >= 0; i--) {\n if (state.hooks[webhookNameOrNames][i] === handler) {\n state.hooks[webhookNameOrNames].splice(i, 1);\n return;\n }\n }\n}\n","import { createLogger } from \"../createLogger\";\nimport { receiverOn as on, receiverOnAny as onAny, receiverOnError as onError, } from \"./on\";\nimport { receiverHandle as receive } from \"./receive\";\nimport { removeListener } from \"./remove-listener\";\nexport function createEventHandler(options) {\n const state = {\n hooks: {},\n log: createLogger(options && options.log),\n };\n if (options && options.transform) {\n state.transform = options.transform;\n }\n return {\n on: on.bind(null, state),\n onAny: onAny.bind(null, state),\n onError: onError.bind(null, state),\n removeListener: removeListener.bind(null, state),\n receive: receive.bind(null, state),\n };\n}\n","/**\n * GitHub sends its JSON with an indentation of 2 spaces and a line break at the end\n */\nexport function toNormalizedJsonString(payload) {\n const payloadString = JSON.stringify(payload);\n return payloadString.replace(/[^\\\\]\\\\u[\\da-f]{4}/g, (s) => {\n return s.substr(0, 3) + s.substr(3).toUpperCase();\n });\n}\n","import { sign as signMethod } from \"@octokit/webhooks-methods\";\nimport { toNormalizedJsonString } from \"./to-normalized-json-string\";\nexport async function sign(secret, payload) {\n return signMethod(secret, typeof payload === \"string\" ? payload : toNormalizedJsonString(payload));\n}\n","import { verify as verifyMethod } from \"@octokit/webhooks-methods\";\nimport { toNormalizedJsonString } from \"./to-normalized-json-string\";\nexport async function verify(secret, payload, signature) {\n return verifyMethod(secret, typeof payload === \"string\" ? payload : toNormalizedJsonString(payload), signature);\n}\n","import { verify } from \"@octokit/webhooks-methods\";\nimport { toNormalizedJsonString } from \"./to-normalized-json-string\";\nexport async function verifyAndReceive(state, event) {\n // verify will validate that the secret is not undefined\n const matchesSignature = await verify(state.secret, typeof event.payload === \"object\"\n ? toNormalizedJsonString(event.payload)\n : event.payload, event.signature);\n if (!matchesSignature) {\n const error = new Error(\"[@octokit/webhooks] signature does not match event payload and secret\");\n return state.eventHandler.receive(Object.assign(error, { event, status: 400 }));\n }\n return state.eventHandler.receive({\n id: event.id,\n name: event.name,\n payload: typeof event.payload === \"string\"\n ? JSON.parse(event.payload)\n : event.payload,\n });\n}\n","const WEBHOOK_HEADERS = [\n \"x-github-event\",\n \"x-hub-signature-256\",\n \"x-github-delivery\",\n];\n// https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#delivery-headers\nexport function getMissingHeaders(request) {\n return WEBHOOK_HEADERS.filter((header) => !(header in request.headers));\n}\n","// @ts-ignore to address #245\nimport AggregateError from \"aggregate-error\";\nexport function getPayload(request) {\n // If request.body already exists we can stop here\n // See https://github.com/octokit/webhooks.js/pull/23\n if (request.body)\n return Promise.resolve(request.body);\n return new Promise((resolve, reject) => {\n let data = \"\";\n request.setEncoding(\"utf8\");\n // istanbul ignore next\n request.on(\"error\", (error) => reject(new AggregateError([error])));\n request.on(\"data\", (chunk) => (data += chunk));\n request.on(\"end\", () => {\n try {\n resolve(JSON.parse(data));\n }\n catch (error) {\n error.message = \"Invalid JSON\";\n error.status = 400;\n reject(new AggregateError([error]));\n }\n });\n });\n}\n","export function onUnhandledRequestDefault(request, response) {\n response.writeHead(404, {\n \"content-type\": \"application/json\",\n });\n response.end(JSON.stringify({\n error: `Unknown route: ${request.method} ${request.url}`,\n }));\n}\n","import { getMissingHeaders } from \"./get-missing-headers\";\nimport { getPayload } from \"./get-payload\";\nimport { onUnhandledRequestDefault } from \"./on-unhandled-request-default\";\nexport async function middleware(webhooks, options, request, response, next) {\n let pathname;\n try {\n pathname = new URL(request.url, \"http://localhost\").pathname;\n }\n catch (error) {\n response.writeHead(422, {\n \"content-type\": \"application/json\",\n });\n response.end(JSON.stringify({\n error: `Request URL could not be parsed: ${request.url}`,\n }));\n return true;\n }\n if (pathname !== options.path) {\n next?.();\n return false;\n }\n else if (request.method !== \"POST\") {\n onUnhandledRequestDefault(request, response);\n return true;\n }\n const missingHeaders = getMissingHeaders(request).join(\", \");\n if (missingHeaders) {\n response.writeHead(400, {\n \"content-type\": \"application/json\",\n });\n response.end(JSON.stringify({\n error: `Required headers missing: ${missingHeaders}`,\n }));\n return true;\n }\n const eventName = request.headers[\"x-github-event\"];\n const signatureSHA256 = request.headers[\"x-hub-signature-256\"];\n const id = request.headers[\"x-github-delivery\"];\n options.log.debug(`${eventName} event received (id: ${id})`);\n // GitHub will abort the request if it does not receive a response within 10s\n // See https://github.com/octokit/webhooks.js/issues/185\n let didTimeout = false;\n const timeout = setTimeout(() => {\n didTimeout = true;\n response.statusCode = 202;\n response.end(\"still processing\\n\");\n }, 9000).unref();\n try {\n const payload = await getPayload(request);\n await webhooks.verifyAndReceive({\n id: id,\n name: eventName,\n payload: payload,\n signature: signatureSHA256,\n });\n clearTimeout(timeout);\n if (didTimeout)\n return true;\n response.end(\"ok\\n\");\n return true;\n }\n catch (error) {\n clearTimeout(timeout);\n if (didTimeout)\n return true;\n const err = Array.from(error)[0];\n const errorMessage = err.message\n ? `${err.name}: ${err.message}`\n : \"Error: An Unspecified error occurred\";\n response.statusCode = typeof err.status !== \"undefined\" ? err.status : 500;\n options.log.error(error);\n response.end(JSON.stringify({\n error: errorMessage,\n }));\n return true;\n }\n}\n","import { createLogger } from \"../../createLogger\";\nimport { middleware } from \"./middleware\";\nexport function createNodeMiddleware(webhooks, { path = \"/api/github/webhooks\", log = createLogger(), } = {}) {\n return middleware.bind(null, webhooks, {\n path,\n log,\n });\n}\n","import { createLogger } from \"./createLogger\";\nimport { createEventHandler } from \"./event-handler/index\";\nimport { sign } from \"./sign\";\nimport { verify } from \"./verify\";\nimport { verifyAndReceive } from \"./verify-and-receive\";\nexport { createNodeMiddleware } from \"./middleware/node/index\";\nexport { emitterEventNames } from \"./generated/webhook-names\";\n// U holds the return value of `transform` function in Options\nclass Webhooks {\n constructor(options) {\n if (!options || !options.secret) {\n throw new Error(\"[@octokit/webhooks] options.secret required\");\n }\n const state = {\n eventHandler: createEventHandler(options),\n secret: options.secret,\n hooks: {},\n log: createLogger(options.log),\n };\n this.sign = sign.bind(null, options.secret);\n this.verify = verify.bind(null, options.secret);\n this.on = state.eventHandler.on;\n this.onAny = state.eventHandler.onAny;\n this.onError = state.eventHandler.onError;\n this.removeListener = state.eventHandler.removeListener;\n this.receive = state.eventHandler.receive;\n this.verifyAndReceive = verifyAndReceive.bind(null, state);\n }\n}\nexport { createEventHandler, Webhooks, };\n"],"names":["createLogger","logger","debug","info","warn","console","bind","error","emitterEventNames","handleEventHandlers","state","webhookName","handler","hooks","push","receiverOn","webhookNameOrNames","Array","isArray","forEach","includes","message","charAt","toUpperCase","slice","Error","log","receiverOnAny","receiverOnError","wrapErrorHandler","returnValue","catch","getHooks","eventPayloadAction","eventName","unshift","concat","filter","Boolean","receiverHandle","event","errorHandlers","Object","assign","AggregateError","errors","Promise","reject","name","payload","action","length","resolve","promises","map","promise","transform","then","all","removeListener","i","splice","createEventHandler","options","on","onAny","onError","receive","toNormalizedJsonString","payloadString","JSON","stringify","replace","s","substr","sign","secret","signMethod","verify","signature","verifyMethod","verifyAndReceive","matchesSignature","eventHandler","status","id","parse","WEBHOOK_HEADERS","getMissingHeaders","request","header","headers","getPayload","body","data","setEncoding","chunk","onUnhandledRequestDefault","response","writeHead","end","method","url","middleware","webhooks","next","pathname","URL","path","missingHeaders","join","signatureSHA256","didTimeout","timeout","setTimeout","statusCode","unref","clearTimeout","err","from","errorMessage","createNodeMiddleware","Webhooks","constructor"],"mappings":";;;;;;;;;AAAO,MAAMA,YAAY,GAAIC,MAAD,KAAa;EACrCC,KAAK,EAAE,MAAM,EADwB;EAErCC,IAAI,EAAE,MAAM,EAFyB;EAGrCC,IAAI,EAAEC,OAAO,CAACD,IAAR,CAAaE,IAAb,CAAkBD,OAAlB,CAH+B;EAIrCE,KAAK,EAAEF,OAAO,CAACE,KAAR,CAAcD,IAAd,CAAmBD,OAAnB,CAJ8B;EAKrC,GAAGJ;AALkC,CAAb,CAArB;;ACAP;AACA;AACA,MAAaO,iBAAiB,GAAG,CAC7B,wBAD6B,EAE7B,gCAF6B,EAG7B,gCAH6B,EAI7B,+BAJ6B,EAK7B,WAL6B,EAM7B,qBAN6B,EAO7B,mBAP6B,EAQ7B,4BAR6B,EAS7B,uBAT6B,EAU7B,aAV6B,EAW7B,uBAX6B,EAY7B,uBAZ6B,EAa7B,yBAb6B,EAc7B,qBAd6B,EAe7B,wCAf6B,EAgB7B,oCAhB6B,EAiB7B,6BAjB6B,EAkB7B,2BAlB6B,EAmB7B,8BAnB6B,EAoB7B,sCApB6B,EAqB7B,gBArB6B,EAsB7B,wBAtB6B,EAuB7B,QAvB6B,EAwB7B,QAxB6B,EAyB7B,YAzB6B,EA0B7B,oBA1B6B,EA2B7B,oBA3B6B,EA4B7B,YA5B6B,EA6B7B,oBA7B6B,EA8B7B,mBA9B6B,EA+B7B,2BA/B6B,EAgC7B,YAhC6B,EAiC7B,qBAjC6B,EAkC7B,6BAlC6B,EAmC7B,oBAnC6B,EAoC7B,oBApC6B,EAqC7B,mBArC6B,EAsC7B,oBAtC6B,EAuC7B,mBAvC6B,EAwC7B,mBAxC6B,EAyC7B,wBAzC6B,EA0C7B,uBA1C6B,EA2C7B,sBA3C6B,EA4C7B,qBA5C6B,EA6C7B,qBA7C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nD,IAA2D,EAAnG,EAAuG;EAC1G,OAAOuG,UAAU,CAACjG,IAAX,CAAgB,IAAhB,EAAsBkG,QAAtB,EAAgC;IACnCI,IADmC;IAEnClF;GAFG,CAAP;AAIH;;ACCD,MAAMgG,QAAN,CAAe;EACXC,WAAW,CAAC5D,OAAD,EAAU;IACjB,IAAI,CAACA,OAAD,IAAY,CAACA,OAAO,CAACa,MAAzB,EAAiC;MAC7B,MAAM,IAAInD,KAAJ,CAAU,6CAAV,CAAN;;;IAEJ,MAAMf,KAAK,GAAG;MACVyE,YAAY,EAAErB,kBAAkB,CAACC,OAAD,CADtB;MAEVa,MAAM,EAAEb,OAAO,CAACa,MAFN;MAGV/D,KAAK,EAAE,EAHG;MAIVa,GAAG,EAAE1B,YAAY,CAAC+D,OAAO,CAACrC,GAAT;KAJrB;IAMA,KAAKiD,IAAL,GAAYA,IAAI,CAACrE,IAAL,CAAU,IAAV,EAAgByD,OAAO,CAACa,MAAxB,CAAZ;IACA,KAAKE,MAAL,GAAcA,MAAM,CAACxE,IAAP,CAAY,IAAZ,EAAkByD,OAAO,CAACa,MAA1B,CAAd;IACA,KAAKZ,EAAL,GAAUtD,KAAK,CAACyE,YAAN,CAAmBnB,EAA7B;IACA,KAAKC,KAAL,GAAavD,KAAK,CAACyE,YAAN,CAAmBlB,KAAhC;IACA,KAAKC,OAAL,GAAexD,KAAK,CAACyE,YAAN,CAAmBjB,OAAlC;IACA,KAAKP,cAAL,GAAsBjD,KAAK,CAACyE,YAAN,CAAmBxB,cAAzC;IACA,KAAKQ,OAAL,GAAezD,KAAK,CAACyE,YAAN,CAAmBhB,OAAlC;IACA,KAAKc,gBAAL,GAAwBA,gBAAgB,CAAC3E,IAAjB,CAAsB,IAAtB,EAA4BI,KAA5B,CAAxB;;;AAlBO;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../dist-src/createLogger.js","../dist-src/generated/webhook-names.js","../dist-src/event-handler/on.js","../dist-src/event-handler/wrap-error-handler.js","../dist-src/event-handler/receive.js","../dist-src/event-handler/remove-listener.js","../dist-src/event-handler/index.js","../dist-src/to-normalized-json-string.js","../dist-src/sign.js","../dist-src/verify.js","../dist-src/verify-and-receive.js","../dist-src/middleware/node/get-missing-headers.js","../dist-src/middleware/node/get-payload.js","../dist-src/middleware/node/on-unhandled-request-default.js","../dist-src/middleware/node/middleware.js","../dist-src/middleware/node/index.js","../dist-src/index.js"],"sourcesContent":["export const createLogger = (logger) => ({\n debug: () => { },\n info: () => { },\n warn: console.warn.bind(console),\n error: console.error.bind(console),\n ...logger,\n});\n","// THIS FILE IS GENERATED - DO NOT EDIT DIRECTLY\n// make edits in scripts/generate-types.ts\nexport const emitterEventNames = [\n \"branch_protection_rule\",\n \"branch_protection_rule.created\",\n \"branch_protection_rule.deleted\",\n \"branch_protection_rule.edited\",\n \"check_run\",\n \"check_run.completed\",\n \"check_run.created\",\n \"check_run.requested_action\",\n \"check_run.rerequested\",\n \"check_suite\",\n \"check_suite.completed\",\n \"check_suite.requested\",\n \"check_suite.rerequested\",\n \"code_scanning_alert\",\n \"code_scanning_alert.appeared_in_branch\",\n \"code_scanning_alert.closed_by_user\",\n \"code_scanning_alert.created\",\n \"code_scanning_alert.fixed\",\n \"code_scanning_alert.reopened\",\n \"code_scanning_alert.reopened_by_user\",\n \"commit_comment\",\n \"commit_comment.created\",\n \"create\",\n \"delete\",\n \"dependabot_alert\",\n \"dependabot_alert.created\",\n \"dependabot_alert.dismissed\",\n \"dependabot_alert.fixed\",\n \"dependabot_alert.reintroduced\",\n \"dependabot_alert.reopened\",\n \"deploy_key\",\n \"deploy_key.created\",\n \"deploy_key.deleted\",\n \"deployment\",\n \"deployment.created\",\n \"deployment_status\",\n \"deployment_status.created\",\n \"discussion\",\n \"discussion.answered\",\n \"discussion.category_changed\",\n \"discussion.created\",\n \"discussion.deleted\",\n \"discussion.edited\",\n \"discussion.labeled\",\n \"discussion.locked\",\n \"discussion.pinned\",\n \"discussion.transferred\",\n \"discussion.unanswered\",\n \"discussion.unlabeled\",\n \"discussion.unlocked\",\n \"discussion.unpinned\",\n \"discussion_comment\",\n \"discussion_comment.created\",\n \"discussion_comment.deleted\",\n \"discussion_comment.edited\",\n \"fork\",\n \"github_app_authorization\",\n \"github_app_authorization.revoked\",\n \"gollum\",\n \"installation\",\n \"installation.created\",\n \"installation.deleted\",\n \"installation.new_permissions_accepted\",\n \"installation.suspend\",\n \"installation.unsuspend\",\n \"installation_repositories\",\n \"installation_repositories.added\",\n \"installation_repositories.removed\",\n \"issue_comment\",\n \"issue_comment.created\",\n \"issue_comment.deleted\",\n \"issue_comment.edited\",\n \"issues\",\n \"issues.assigned\",\n \"issues.closed\",\n \"issues.deleted\",\n \"issues.demilestoned\",\n \"issues.edited\",\n \"issues.labeled\",\n \"issues.locked\",\n \"issues.milestoned\",\n \"issues.opened\",\n \"issues.pinned\",\n \"issues.reopened\",\n \"issues.transferred\",\n \"issues.unassigned\",\n \"issues.unlabeled\",\n \"issues.unlocked\",\n \"issues.unpinned\",\n \"label\",\n \"label.created\",\n \"label.deleted\",\n \"label.edited\",\n \"marketplace_purchase\",\n \"marketplace_purchase.cancelled\",\n \"marketplace_purchase.changed\",\n \"marketplace_purchase.pending_change\",\n \"marketplace_purchase.pending_change_cancelled\",\n \"marketplace_purchase.purchased\",\n \"member\",\n \"member.added\",\n \"member.edited\",\n \"member.removed\",\n \"membership\",\n \"membership.added\",\n \"membership.removed\",\n \"merge_group\",\n \"merge_group.checks_requested\",\n \"meta\",\n \"meta.deleted\",\n \"milestone\",\n \"milestone.closed\",\n \"milestone.created\",\n \"milestone.deleted\",\n \"milestone.edited\",\n \"milestone.opened\",\n \"org_block\",\n \"org_block.blocked\",\n \"org_block.unblocked\",\n \"organization\",\n \"organization.deleted\",\n \"organization.member_added\",\n \"organization.member_invited\",\n \"organization.member_removed\",\n \"organization.renamed\",\n \"package\",\n \"package.published\",\n \"package.updated\",\n \"page_build\",\n \"ping\",\n \"project\",\n \"project.closed\",\n \"project.created\",\n \"project.deleted\",\n \"project.edited\",\n \"project.reopened\",\n \"project_card\",\n \"project_card.converted\",\n \"project_card.created\",\n \"project_card.deleted\",\n \"project_card.edited\",\n \"project_card.moved\",\n \"project_column\",\n \"project_column.created\",\n \"project_column.deleted\",\n \"project_column.edited\",\n \"project_column.moved\",\n \"projects_v2_item\",\n \"projects_v2_item.archived\",\n \"projects_v2_item.converted\",\n \"projects_v2_item.created\",\n \"projects_v2_item.deleted\",\n \"projects_v2_item.edited\",\n \"projects_v2_item.reordered\",\n \"projects_v2_item.restored\",\n \"public\",\n \"pull_request\",\n \"pull_request.assigned\",\n \"pull_request.auto_merge_disabled\",\n \"pull_request.auto_merge_enabled\",\n \"pull_request.closed\",\n \"pull_request.converted_to_draft\",\n \"pull_request.dequeued\",\n \"pull_request.edited\",\n \"pull_request.labeled\",\n \"pull_request.locked\",\n \"pull_request.opened\",\n \"pull_request.queued\",\n \"pull_request.ready_for_review\",\n \"pull_request.reopened\",\n \"pull_request.review_request_removed\",\n \"pull_request.review_requested\",\n \"pull_request.synchronize\",\n \"pull_request.unassigned\",\n \"pull_request.unlabeled\",\n \"pull_request.unlocked\",\n \"pull_request_review\",\n \"pull_request_review.dismissed\",\n \"pull_request_review.edited\",\n \"pull_request_review.submitted\",\n \"pull_request_review_comment\",\n \"pull_request_review_comment.created\",\n \"pull_request_review_comment.deleted\",\n \"pull_request_review_comment.edited\",\n \"pull_request_review_thread\",\n \"pull_request_review_thread.resolved\",\n \"pull_request_review_thread.unresolved\",\n \"push\",\n \"registry_package\",\n \"registry_package.published\",\n \"registry_package.updated\",\n \"release\",\n \"release.created\",\n \"release.deleted\",\n \"release.edited\",\n \"release.prereleased\",\n \"release.published\",\n \"release.released\",\n \"release.unpublished\",\n \"repository\",\n \"repository.archived\",\n \"repository.created\",\n \"repository.deleted\",\n \"repository.edited\",\n \"repository.privatized\",\n \"repository.publicized\",\n \"repository.renamed\",\n \"repository.transferred\",\n \"repository.unarchived\",\n \"repository_dispatch\",\n \"repository_import\",\n \"repository_vulnerability_alert\",\n \"repository_vulnerability_alert.create\",\n \"repository_vulnerability_alert.dismiss\",\n \"repository_vulnerability_alert.reopen\",\n \"repository_vulnerability_alert.resolve\",\n \"secret_scanning_alert\",\n \"secret_scanning_alert.created\",\n \"secret_scanning_alert.reopened\",\n \"secret_scanning_alert.resolved\",\n \"security_advisory\",\n \"security_advisory.performed\",\n \"security_advisory.published\",\n \"security_advisory.updated\",\n \"security_advisory.withdrawn\",\n \"sponsorship\",\n \"sponsorship.cancelled\",\n \"sponsorship.created\",\n \"sponsorship.edited\",\n \"sponsorship.pending_cancellation\",\n \"sponsorship.pending_tier_change\",\n \"sponsorship.tier_changed\",\n \"star\",\n \"star.created\",\n \"star.deleted\",\n \"status\",\n \"team\",\n \"team.added_to_repository\",\n \"team.created\",\n \"team.deleted\",\n \"team.edited\",\n \"team.removed_from_repository\",\n \"team_add\",\n \"watch\",\n \"watch.started\",\n \"workflow_dispatch\",\n \"workflow_job\",\n \"workflow_job.completed\",\n \"workflow_job.in_progress\",\n \"workflow_job.queued\",\n \"workflow_run\",\n \"workflow_run.completed\",\n \"workflow_run.in_progress\",\n \"workflow_run.requested\",\n];\n","import { emitterEventNames } from \"../generated/webhook-names\";\nfunction handleEventHandlers(state, webhookName, handler) {\n if (!state.hooks[webhookName]) {\n state.hooks[webhookName] = [];\n }\n state.hooks[webhookName].push(handler);\n}\nexport function receiverOn(state, webhookNameOrNames, handler) {\n if (Array.isArray(webhookNameOrNames)) {\n webhookNameOrNames.forEach((webhookName) => receiverOn(state, webhookName, handler));\n return;\n }\n if ([\"*\", \"error\"].includes(webhookNameOrNames)) {\n const webhookName = webhookNameOrNames === \"*\" ? \"any\" : webhookNameOrNames;\n 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`;\n throw new Error(message);\n }\n if (!emitterEventNames.includes(webhookNameOrNames)) {\n state.log.warn(`\"${webhookNameOrNames}\" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`);\n }\n handleEventHandlers(state, webhookNameOrNames, handler);\n}\nexport function receiverOnAny(state, handler) {\n handleEventHandlers(state, \"*\", handler);\n}\nexport function receiverOnError(state, handler) {\n handleEventHandlers(state, \"error\", handler);\n}\n","// Errors thrown or rejected Promises in \"error\" event handlers are not handled\n// as they are in the webhook event handlers. If errors occur, we log a\n// \"Fatal: Error occurred\" message to stdout\nexport function wrapErrorHandler(handler, error) {\n let returnValue;\n try {\n returnValue = handler(error);\n }\n catch (error) {\n console.log('FATAL: Error occurred in \"error\" event handler');\n console.log(error);\n }\n if (returnValue && returnValue.catch) {\n returnValue.catch((error) => {\n console.log('FATAL: Error occurred in \"error\" event handler');\n console.log(error);\n });\n }\n}\n","// @ts-ignore to address #245\nimport AggregateError from \"aggregate-error\";\nimport { wrapErrorHandler } from \"./wrap-error-handler\";\nfunction getHooks(state, eventPayloadAction, eventName) {\n const hooks = [state.hooks[eventName], state.hooks[\"*\"]];\n if (eventPayloadAction) {\n hooks.unshift(state.hooks[`${eventName}.${eventPayloadAction}`]);\n }\n return [].concat(...hooks.filter(Boolean));\n}\n// main handler function\nexport function receiverHandle(state, event) {\n const errorHandlers = state.hooks.error || [];\n if (event instanceof Error) {\n const error = Object.assign(new AggregateError([event]), {\n event,\n errors: [event],\n });\n errorHandlers.forEach((handler) => wrapErrorHandler(handler, error));\n return Promise.reject(error);\n }\n if (!event || !event.name) {\n throw new AggregateError([\"Event name not passed\"]);\n }\n if (!event.payload) {\n throw new AggregateError([\"Event payload not passed\"]);\n }\n // flatten arrays of event listeners and remove undefined values\n const hooks = getHooks(state, \"action\" in event.payload ? event.payload.action : null, event.name);\n if (hooks.length === 0) {\n return Promise.resolve();\n }\n const errors = [];\n const promises = hooks.map((handler) => {\n let promise = Promise.resolve(event);\n if (state.transform) {\n promise = promise.then(state.transform);\n }\n return promise\n .then((event) => {\n return handler(event);\n })\n .catch((error) => errors.push(Object.assign(error, { event })));\n });\n return Promise.all(promises).then(() => {\n if (errors.length === 0) {\n return;\n }\n const error = new AggregateError(errors);\n Object.assign(error, {\n event,\n errors,\n });\n errorHandlers.forEach((handler) => wrapErrorHandler(handler, error));\n throw error;\n });\n}\n","export function removeListener(state, webhookNameOrNames, handler) {\n if (Array.isArray(webhookNameOrNames)) {\n webhookNameOrNames.forEach((webhookName) => removeListener(state, webhookName, handler));\n return;\n }\n if (!state.hooks[webhookNameOrNames]) {\n return;\n }\n // remove last hook that has been added, that way\n // it behaves the same as removeListener\n for (let i = state.hooks[webhookNameOrNames].length - 1; i >= 0; i--) {\n if (state.hooks[webhookNameOrNames][i] === handler) {\n state.hooks[webhookNameOrNames].splice(i, 1);\n return;\n }\n }\n}\n","import { createLogger } from \"../createLogger\";\nimport { receiverOn as on, receiverOnAny as onAny, receiverOnError as onError, } from \"./on\";\nimport { receiverHandle as receive } from \"./receive\";\nimport { removeListener } from \"./remove-listener\";\nexport function createEventHandler(options) {\n const state = {\n hooks: {},\n log: createLogger(options && options.log),\n };\n if (options && options.transform) {\n state.transform = options.transform;\n }\n return {\n on: on.bind(null, state),\n onAny: onAny.bind(null, state),\n onError: onError.bind(null, state),\n removeListener: removeListener.bind(null, state),\n receive: receive.bind(null, state),\n };\n}\n","/**\n * GitHub sends its JSON with no indentation and no line break at the end\n */\nexport function toNormalizedJsonString(payload) {\n const payloadString = JSON.stringify(payload);\n return payloadString.replace(/[^\\\\]\\\\u[\\da-f]{4}/g, (s) => {\n return s.substr(0, 3) + s.substr(3).toUpperCase();\n });\n}\n","import { sign as signMethod } from \"@octokit/webhooks-methods\";\nimport { toNormalizedJsonString } from \"./to-normalized-json-string\";\nexport async function sign(secret, payload) {\n return signMethod(secret, typeof payload === \"string\" ? payload : toNormalizedJsonString(payload));\n}\n","import { verify as verifyMethod } from \"@octokit/webhooks-methods\";\nimport { toNormalizedJsonString } from \"./to-normalized-json-string\";\nexport async function verify(secret, payload, signature) {\n return verifyMethod(secret, typeof payload === \"string\" ? payload : toNormalizedJsonString(payload), signature);\n}\n","import { verify } from \"@octokit/webhooks-methods\";\nimport { toNormalizedJsonString } from \"./to-normalized-json-string\";\nexport async function verifyAndReceive(state, event) {\n // verify will validate that the secret is not undefined\n const matchesSignature = await verify(state.secret, typeof event.payload === \"object\"\n ? toNormalizedJsonString(event.payload)\n : event.payload, event.signature);\n if (!matchesSignature) {\n const error = new Error(\"[@octokit/webhooks] signature does not match event payload and secret\");\n return state.eventHandler.receive(Object.assign(error, { event, status: 400 }));\n }\n return state.eventHandler.receive({\n id: event.id,\n name: event.name,\n payload: typeof event.payload === \"string\"\n ? JSON.parse(event.payload)\n : event.payload,\n });\n}\n","const WEBHOOK_HEADERS = [\n \"x-github-event\",\n \"x-hub-signature-256\",\n \"x-github-delivery\",\n];\n// https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#delivery-headers\nexport function getMissingHeaders(request) {\n return WEBHOOK_HEADERS.filter((header) => !(header in request.headers));\n}\n","// @ts-ignore to address #245\nimport AggregateError from \"aggregate-error\";\nexport function getPayload(request) {\n // If request.body already exists we can stop here\n // See https://github.com/octokit/webhooks.js/pull/23\n if (request.body)\n return Promise.resolve(request.body);\n return new Promise((resolve, reject) => {\n let data = \"\";\n request.setEncoding(\"utf8\");\n // istanbul ignore next\n request.on(\"error\", (error) => reject(new AggregateError([error])));\n request.on(\"data\", (chunk) => (data += chunk));\n request.on(\"end\", () => {\n try {\n resolve(JSON.parse(data));\n }\n catch (error) {\n error.message = \"Invalid JSON\";\n error.status = 400;\n reject(new AggregateError([error]));\n }\n });\n });\n}\n","export function onUnhandledRequestDefault(request, response) {\n response.writeHead(404, {\n \"content-type\": \"application/json\",\n });\n response.end(JSON.stringify({\n error: `Unknown route: ${request.method} ${request.url}`,\n }));\n}\n","import { getMissingHeaders } from \"./get-missing-headers\";\nimport { getPayload } from \"./get-payload\";\nimport { onUnhandledRequestDefault } from \"./on-unhandled-request-default\";\nexport async function middleware(webhooks, options, request, response, next) {\n let pathname;\n try {\n pathname = new URL(request.url, \"http://localhost\").pathname;\n }\n catch (error) {\n response.writeHead(422, {\n \"content-type\": \"application/json\",\n });\n response.end(JSON.stringify({\n error: `Request URL could not be parsed: ${request.url}`,\n }));\n return true;\n }\n if (pathname !== options.path) {\n next?.();\n return false;\n }\n else if (request.method !== \"POST\") {\n onUnhandledRequestDefault(request, response);\n return true;\n }\n const missingHeaders = getMissingHeaders(request).join(\", \");\n if (missingHeaders) {\n response.writeHead(400, {\n \"content-type\": \"application/json\",\n });\n response.end(JSON.stringify({\n error: `Required headers missing: ${missingHeaders}`,\n }));\n return true;\n }\n const eventName = request.headers[\"x-github-event\"];\n const signatureSHA256 = request.headers[\"x-hub-signature-256\"];\n const id = request.headers[\"x-github-delivery\"];\n options.log.debug(`${eventName} event received (id: ${id})`);\n // GitHub will abort the request if it does not receive a response within 10s\n // See https://github.com/octokit/webhooks.js/issues/185\n let didTimeout = false;\n const timeout = setTimeout(() => {\n didTimeout = true;\n response.statusCode = 202;\n response.end(\"still processing\\n\");\n }, 9000).unref();\n try {\n const payload = await getPayload(request);\n await webhooks.verifyAndReceive({\n id: id,\n name: eventName,\n payload: payload,\n signature: signatureSHA256,\n });\n clearTimeout(timeout);\n if (didTimeout)\n return true;\n response.end(\"ok\\n\");\n return true;\n }\n catch (error) {\n clearTimeout(timeout);\n if (didTimeout)\n return true;\n const err = Array.from(error)[0];\n const errorMessage = err.message\n ? `${err.name}: ${err.message}`\n : \"Error: An Unspecified error occurred\";\n response.statusCode = typeof err.status !== \"undefined\" ? err.status : 500;\n options.log.error(error);\n response.end(JSON.stringify({\n error: errorMessage,\n }));\n return true;\n }\n}\n","import { createLogger } from \"../../createLogger\";\nimport { middleware } from \"./middleware\";\nexport function createNodeMiddleware(webhooks, { path = \"/api/github/webhooks\", log = createLogger(), } = {}) {\n return middleware.bind(null, webhooks, {\n path,\n log,\n });\n}\n","import { createLogger } from \"./createLogger\";\nimport { createEventHandler } from \"./event-handler/index\";\nimport { sign } from \"./sign\";\nimport { verify } from \"./verify\";\nimport { verifyAndReceive } from \"./verify-and-receive\";\nexport { createNodeMiddleware } from \"./middleware/node/index\";\nexport { emitterEventNames } from \"./generated/webhook-names\";\n// U holds the return value of `transform` function in Options\nclass Webhooks {\n constructor(options) {\n if (!options || !options.secret) {\n throw new Error(\"[@octokit/webhooks] options.secret required\");\n }\n const state = {\n eventHandler: createEventHandler(options),\n secret: options.secret,\n hooks: {},\n log: createLogger(options.log),\n };\n this.sign = sign.bind(null, options.secret);\n this.verify = (eventPayload, signature) => {\n if (typeof eventPayload === \"object\") {\n console.error(\"[@octokit/webhooks] Passing a JSON payload object to `verify()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`\");\n }\n return verify(options.secret, eventPayload, signature);\n };\n this.on = state.eventHandler.on;\n this.onAny = state.eventHandler.onAny;\n this.onError = state.eventHandler.onError;\n this.removeListener = state.eventHandler.removeListener;\n this.receive = state.eventHandler.receive;\n this.verifyAndReceive = (options) => {\n if (typeof options.payload === \"object\") {\n console.error(\"[@octokit/webhooks] Passing a JSON payload object to `verifyAndReceive()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`\");\n }\n return verifyAndReceive(state, options);\n };\n }\n}\nexport { createEventHandler, Webhooks, };\n"],"names":["createLogger","logger","debug","info","warn","console","bind","error","emitterEventNames","handleEventHandlers","state","webhookName","handler","hooks","push","receiverOn","webhookNameOrNames","Array","isArray","forEach","includes","message","charAt","toUpperCase","slice","Error","log","receiverOnAny","receiverOnError","wrapErrorHandler","returnValue","catch","getHooks","eventPayloadAction","eventName","unshift","concat","filter","Boolean","receiverHandle","event","errorHandlers","Object","assign","AggregateError","errors","Promise","reject","name","payload","action","length","resolve","promises","map","promise","transform","then","all","removeListener","i","splice","createEventHandler","options","on","onAny","onError","receive","toNormalizedJsonString","payloadString","JSON","stringify","replace","s","substr","sign","secret","signMethod","verify","signature","verifyMethod","verifyAndReceive","matchesSignature","eventHandler","status","id","parse","WEBHOOK_HEADERS","getMissingHeaders","request","header","headers","getPayload","body","data","setEncoding","chunk","onUnhandledRequestDefault","response","writeHead","end","method","url","middleware","webhooks","next","pathname","URL","path","missingHeaders","join","signatureSHA256","didTimeout","timeout","setTimeout","statusCode","unref","clearTimeout","err","from","errorMessage","createNodeMiddleware","Webhooks","constructor","eventPayload"],"mappings":";;;;;;;;;AAAO,MAAMA,YAAY,GAAIC,MAAM,KAAM;EACrCC,KAAK,EAAE,MAAM,EAAG;EAChBC,IAAI,EAAE,MAAM,EAAG;EACfC,IAAI,EAAEC,OAAO,CAACD,IAAI,CAACE,IAAI,CAACD,OAAO,CAAC;EAChCE,KAAK,EAAEF,OAAO,CAACE,KAAK,CAACD,IAAI,CAACD,OAAO,CAAC;EAClC,GAAGJ;AACP,CAAC,CAAC;;ACNF;AACA;AACA,MAAaO,iBAAiB,GAAG,CAC7B,wBAAwB,EACxB,gCAAgC,EAChC,gCAAgC,EAChC,+BAA+B,EAC/B,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,4BAA4B,EAC5B,uBAAuB,EACvB,aAAa,EACb,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,wCAAwC,EACxC,oCAAoC,EACpC,6BAA6B,EAC7B,2BAA2B,EAC3B,8BAA8B,EAC9B,sCAAsC,EACtC,gBAAgB,EAChB,wBAAwB,EACxB,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,+BAA+B,EAC/B,2BAA2B,EAC3B,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,2BAA2B,EAC3B,YAAY,EACZ,qBAAqB,EACrB,6BAA6B,EAC7B,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,s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C/B,IAAI,CAACC,KAAK,GAAGvD,KAAK,CAACyE,YAAY,CAAClB,KAAK;IACrC,IAAI,CAACC,OAAO,GAAGxD,KAAK,CAACyE,YAAY,CAACjB,OAAO;IACzC,IAAI,CAACP,cAAc,GAAGjD,KAAK,CAACyE,YAAY,CAACxB,cAAc;IACvD,IAAI,CAACQ,OAAO,GAAGzD,KAAK,CAACyE,YAAY,CAAChB,OAAO;IACzC,IAAI,CAACc,gBAAgB,GAAIlB,OAAO,IAAK;MACjC,IAAI,OAAOA,OAAO,CAACd,OAAO,KAAK,QAAQ,EAAE;QACrC5C,OAAO,CAACE,KAAK,CAAC,0KAA0K,CAAC;;MAE7L,OAAO0E,gBAAgB,CAACvE,KAAK,EAAEqD,OAAO,CAAC;KAC1C;;AAET;;;;;;;"}
|
|
@@ -25,6 +25,12 @@ export const emitterEventNames = [
|
|
|
25
25
|
"commit_comment.created",
|
|
26
26
|
"create",
|
|
27
27
|
"delete",
|
|
28
|
+
"dependabot_alert",
|
|
29
|
+
"dependabot_alert.created",
|
|
30
|
+
"dependabot_alert.dismissed",
|
|
31
|
+
"dependabot_alert.fixed",
|
|
32
|
+
"dependabot_alert.reintroduced",
|
|
33
|
+
"dependabot_alert.reopened",
|
|
28
34
|
"deploy_key",
|
|
29
35
|
"deploy_key.created",
|
|
30
36
|
"deploy_key.deleted",
|
|
@@ -183,6 +189,9 @@ export const emitterEventNames = [
|
|
|
183
189
|
"pull_request_review_thread.resolved",
|
|
184
190
|
"pull_request_review_thread.unresolved",
|
|
185
191
|
"push",
|
|
192
|
+
"registry_package",
|
|
193
|
+
"registry_package.published",
|
|
194
|
+
"registry_package.updated",
|
|
186
195
|
"release",
|
|
187
196
|
"release.created",
|
|
188
197
|
"release.deleted",
|
|
@@ -244,5 +253,6 @@ export const emitterEventNames = [
|
|
|
244
253
|
"workflow_job.queued",
|
|
245
254
|
"workflow_run",
|
|
246
255
|
"workflow_run.completed",
|
|
256
|
+
"workflow_run.in_progress",
|
|
247
257
|
"workflow_run.requested",
|
|
248
258
|
];
|
package/dist-src/index.js
CHANGED
|
@@ -18,13 +18,23 @@ class Webhooks {
|
|
|
18
18
|
log: createLogger(options.log),
|
|
19
19
|
};
|
|
20
20
|
this.sign = sign.bind(null, options.secret);
|
|
21
|
-
this.verify =
|
|
21
|
+
this.verify = (eventPayload, signature) => {
|
|
22
|
+
if (typeof eventPayload === "object") {
|
|
23
|
+
console.error("[@octokit/webhooks] Passing a JSON payload object to `verify()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`");
|
|
24
|
+
}
|
|
25
|
+
return verify(options.secret, eventPayload, signature);
|
|
26
|
+
};
|
|
22
27
|
this.on = state.eventHandler.on;
|
|
23
28
|
this.onAny = state.eventHandler.onAny;
|
|
24
29
|
this.onError = state.eventHandler.onError;
|
|
25
30
|
this.removeListener = state.eventHandler.removeListener;
|
|
26
31
|
this.receive = state.eventHandler.receive;
|
|
27
|
-
this.verifyAndReceive =
|
|
32
|
+
this.verifyAndReceive = (options) => {
|
|
33
|
+
if (typeof options.payload === "object") {
|
|
34
|
+
console.error("[@octokit/webhooks] Passing a JSON payload object to `verifyAndReceive()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`");
|
|
35
|
+
}
|
|
36
|
+
return verifyAndReceive(state, options);
|
|
37
|
+
};
|
|
28
38
|
}
|
|
29
39
|
}
|
|
30
40
|
export { createEventHandler, Webhooks, };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* GitHub sends its JSON with
|
|
2
|
+
* GitHub sends its JSON with no indentation and no line break at the end
|
|
3
3
|
*/
|
|
4
4
|
export function toNormalizedJsonString(payload) {
|
|
5
5
|
const payloadString = JSON.stringify(payload);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const emitterEventNames: readonly ["branch_protection_rule", "branch_protection_rule.created", "branch_protection_rule.deleted", "branch_protection_rule.edited", "check_run", "check_run.completed", "check_run.created", "check_run.requested_action", "check_run.rerequested", "check_suite", "check_suite.completed", "check_suite.requested", "check_suite.rerequested", "code_scanning_alert", "code_scanning_alert.appeared_in_branch", "code_scanning_alert.closed_by_user", "code_scanning_alert.created", "code_scanning_alert.fixed", "code_scanning_alert.reopened", "code_scanning_alert.reopened_by_user", "commit_comment", "commit_comment.created", "create", "delete", "deploy_key", "deploy_key.created", "deploy_key.deleted", "deployment", "deployment.created", "deployment_status", "deployment_status.created", "discussion", "discussion.answered", "discussion.category_changed", "discussion.created", "discussion.deleted", "discussion.edited", "discussion.labeled", "discussion.locked", "discussion.pinned", "discussion.transferred", "discussion.unanswered", "discussion.unlabeled", "discussion.unlocked", "discussion.unpinned", "discussion_comment", "discussion_comment.created", "discussion_comment.deleted", "discussion_comment.edited", "fork", "github_app_authorization", "github_app_authorization.revoked", "gollum", "installation", "installation.created", "installation.deleted", "installation.new_permissions_accepted", "installation.suspend", "installation.unsuspend", "installation_repositories", "installation_repositories.added", "installation_repositories.removed", "issue_comment", "issue_comment.created", "issue_comment.deleted", "issue_comment.edited", "issues", "issues.assigned", "issues.closed", "issues.deleted", "issues.demilestoned", "issues.edited", "issues.labeled", "issues.locked", "issues.milestoned", "issues.opened", "issues.pinned", "issues.reopened", "issues.transferred", "issues.unassigned", "issues.unlabeled", "issues.unlocked", "issues.unpinned", "label", "label.created", "label.deleted", "label.edited", "marketplace_purchase", "marketplace_purchase.cancelled", "marketplace_purchase.changed", "marketplace_purchase.pending_change", "marketplace_purchase.pending_change_cancelled", "marketplace_purchase.purchased", "member", "member.added", "member.edited", "member.removed", "membership", "membership.added", "membership.removed", "merge_group", "merge_group.checks_requested", "meta", "meta.deleted", "milestone", "milestone.closed", "milestone.created", "milestone.deleted", "milestone.edited", "milestone.opened", "org_block", "org_block.blocked", "org_block.unblocked", "organization", "organization.deleted", "organization.member_added", "organization.member_invited", "organization.member_removed", "organization.renamed", "package", "package.published", "package.updated", "page_build", "ping", "project", "project.closed", "project.created", "project.deleted", "project.edited", "project.reopened", "project_card", "project_card.converted", "project_card.created", "project_card.deleted", "project_card.edited", "project_card.moved", "project_column", "project_column.created", "project_column.deleted", "project_column.edited", "project_column.moved", "projects_v2_item", "projects_v2_item.archived", "projects_v2_item.converted", "projects_v2_item.created", "projects_v2_item.deleted", "projects_v2_item.edited", "projects_v2_item.reordered", "projects_v2_item.restored", "public", "pull_request", "pull_request.assigned", "pull_request.auto_merge_disabled", "pull_request.auto_merge_enabled", "pull_request.closed", "pull_request.converted_to_draft", "pull_request.dequeued", "pull_request.edited", "pull_request.labeled", "pull_request.locked", "pull_request.opened", "pull_request.queued", "pull_request.ready_for_review", "pull_request.reopened", "pull_request.review_request_removed", "pull_request.review_requested", "pull_request.synchronize", "pull_request.unassigned", "pull_request.unlabeled", "pull_request.unlocked", "pull_request_review", "pull_request_review.dismissed", "pull_request_review.edited", "pull_request_review.submitted", "pull_request_review_comment", "pull_request_review_comment.created", "pull_request_review_comment.deleted", "pull_request_review_comment.edited", "pull_request_review_thread", "pull_request_review_thread.resolved", "pull_request_review_thread.unresolved", "push", "release", "release.created", "release.deleted", "release.edited", "release.prereleased", "release.published", "release.released", "release.unpublished", "repository", "repository.archived", "repository.created", "repository.deleted", "repository.edited", "repository.privatized", "repository.publicized", "repository.renamed", "repository.transferred", "repository.unarchived", "repository_dispatch", "repository_import", "repository_vulnerability_alert", "repository_vulnerability_alert.create", "repository_vulnerability_alert.dismiss", "repository_vulnerability_alert.reopen", "repository_vulnerability_alert.resolve", "secret_scanning_alert", "secret_scanning_alert.created", "secret_scanning_alert.reopened", "secret_scanning_alert.resolved", "security_advisory", "security_advisory.performed", "security_advisory.published", "security_advisory.updated", "security_advisory.withdrawn", "sponsorship", "sponsorship.cancelled", "sponsorship.created", "sponsorship.edited", "sponsorship.pending_cancellation", "sponsorship.pending_tier_change", "sponsorship.tier_changed", "star", "star.created", "star.deleted", "status", "team", "team.added_to_repository", "team.created", "team.deleted", "team.edited", "team.removed_from_repository", "team_add", "watch", "watch.started", "workflow_dispatch", "workflow_job", "workflow_job.completed", "workflow_job.in_progress", "workflow_job.queued", "workflow_run", "workflow_run.completed", "workflow_run.requested"];
|
|
1
|
+
export declare const emitterEventNames: readonly ["branch_protection_rule", "branch_protection_rule.created", "branch_protection_rule.deleted", "branch_protection_rule.edited", "check_run", "check_run.completed", "check_run.created", "check_run.requested_action", "check_run.rerequested", "check_suite", "check_suite.completed", "check_suite.requested", "check_suite.rerequested", "code_scanning_alert", "code_scanning_alert.appeared_in_branch", "code_scanning_alert.closed_by_user", "code_scanning_alert.created", "code_scanning_alert.fixed", "code_scanning_alert.reopened", "code_scanning_alert.reopened_by_user", "commit_comment", "commit_comment.created", "create", "delete", "dependabot_alert", "dependabot_alert.created", "dependabot_alert.dismissed", "dependabot_alert.fixed", "dependabot_alert.reintroduced", "dependabot_alert.reopened", "deploy_key", "deploy_key.created", "deploy_key.deleted", "deployment", "deployment.created", "deployment_status", "deployment_status.created", "discussion", "discussion.answered", "discussion.category_changed", "discussion.created", "discussion.deleted", "discussion.edited", "discussion.labeled", "discussion.locked", "discussion.pinned", "discussion.transferred", "discussion.unanswered", "discussion.unlabeled", "discussion.unlocked", "discussion.unpinned", "discussion_comment", "discussion_comment.created", "discussion_comment.deleted", "discussion_comment.edited", "fork", "github_app_authorization", "github_app_authorization.revoked", "gollum", "installation", "installation.created", "installation.deleted", "installation.new_permissions_accepted", "installation.suspend", "installation.unsuspend", "installation_repositories", "installation_repositories.added", "installation_repositories.removed", "issue_comment", "issue_comment.created", "issue_comment.deleted", "issue_comment.edited", "issues", "issues.assigned", "issues.closed", "issues.deleted", "issues.demilestoned", "issues.edited", "issues.labeled", "issues.locked", "issues.milestoned", "issues.opened", "issues.pinned", "issues.reopened", "issues.transferred", "issues.unassigned", "issues.unlabeled", "issues.unlocked", "issues.unpinned", "label", "label.created", "label.deleted", "label.edited", "marketplace_purchase", "marketplace_purchase.cancelled", "marketplace_purchase.changed", "marketplace_purchase.pending_change", "marketplace_purchase.pending_change_cancelled", "marketplace_purchase.purchased", "member", "member.added", "member.edited", "member.removed", "membership", "membership.added", "membership.removed", "merge_group", "merge_group.checks_requested", "meta", "meta.deleted", "milestone", "milestone.closed", "milestone.created", "milestone.deleted", "milestone.edited", "milestone.opened", "org_block", "org_block.blocked", "org_block.unblocked", "organization", "organization.deleted", "organization.member_added", "organization.member_invited", "organization.member_removed", "organization.renamed", "package", "package.published", "package.updated", "page_build", "ping", "project", "project.closed", "project.created", "project.deleted", "project.edited", "project.reopened", "project_card", "project_card.converted", "project_card.created", "project_card.deleted", "project_card.edited", "project_card.moved", "project_column", "project_column.created", "project_column.deleted", "project_column.edited", "project_column.moved", "projects_v2_item", "projects_v2_item.archived", "projects_v2_item.converted", "projects_v2_item.created", "projects_v2_item.deleted", "projects_v2_item.edited", "projects_v2_item.reordered", "projects_v2_item.restored", "public", "pull_request", "pull_request.assigned", "pull_request.auto_merge_disabled", "pull_request.auto_merge_enabled", "pull_request.closed", "pull_request.converted_to_draft", "pull_request.dequeued", "pull_request.edited", "pull_request.labeled", "pull_request.locked", "pull_request.opened", "pull_request.queued", "pull_request.ready_for_review", "pull_request.reopened", "pull_request.review_request_removed", "pull_request.review_requested", "pull_request.synchronize", "pull_request.unassigned", "pull_request.unlabeled", "pull_request.unlocked", "pull_request_review", "pull_request_review.dismissed", "pull_request_review.edited", "pull_request_review.submitted", "pull_request_review_comment", "pull_request_review_comment.created", "pull_request_review_comment.deleted", "pull_request_review_comment.edited", "pull_request_review_thread", "pull_request_review_thread.resolved", "pull_request_review_thread.unresolved", "push", "registry_package", "registry_package.published", "registry_package.updated", "release", "release.created", "release.deleted", "release.edited", "release.prereleased", "release.published", "release.released", "release.unpublished", "repository", "repository.archived", "repository.created", "repository.deleted", "repository.edited", "repository.privatized", "repository.publicized", "repository.renamed", "repository.transferred", "repository.unarchived", "repository_dispatch", "repository_import", "repository_vulnerability_alert", "repository_vulnerability_alert.create", "repository_vulnerability_alert.dismiss", "repository_vulnerability_alert.reopen", "repository_vulnerability_alert.resolve", "secret_scanning_alert", "secret_scanning_alert.created", "secret_scanning_alert.reopened", "secret_scanning_alert.resolved", "security_advisory", "security_advisory.performed", "security_advisory.published", "security_advisory.updated", "security_advisory.withdrawn", "sponsorship", "sponsorship.cancelled", "sponsorship.created", "sponsorship.edited", "sponsorship.pending_cancellation", "sponsorship.pending_tier_change", "sponsorship.tier_changed", "star", "star.created", "star.deleted", "status", "team", "team.added_to_repository", "team.created", "team.deleted", "team.edited", "team.removed_from_repository", "team_add", "watch", "watch.started", "workflow_dispatch", "workflow_job", "workflow_job.completed", "workflow_job.in_progress", "workflow_job.queued", "workflow_run", "workflow_run.completed", "workflow_run.in_progress", "workflow_run.requested"];
|
package/dist-types/index.d.ts
CHANGED
|
@@ -2,15 +2,25 @@ import { createEventHandler } from "./event-handler/index";
|
|
|
2
2
|
import { EmitterWebhookEvent, EmitterWebhookEventName, HandlerFunction, RemoveHandlerFunction, Options, WebhookError, WebhookEventHandlerError, EmitterWebhookEventWithStringPayloadAndSignature, EmitterWebhookEventWithSignature } from "./types";
|
|
3
3
|
export { createNodeMiddleware } from "./middleware/node/index";
|
|
4
4
|
export { emitterEventNames } from "./generated/webhook-names";
|
|
5
|
+
export type Iverify = {
|
|
6
|
+
/** @deprecated Passing a JSON payload object to `verify()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`. */
|
|
7
|
+
(eventPayload: object, signature: string): Promise<boolean>;
|
|
8
|
+
(eventPayload: string, signature: string): Promise<boolean>;
|
|
9
|
+
};
|
|
10
|
+
export type IverifyAndReceive = {
|
|
11
|
+
/** @deprecated Passing a JSON payload object to `verifyAndReceive()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`. */
|
|
12
|
+
(options: EmitterWebhookEventWithSignature): Promise<void>;
|
|
13
|
+
(options: EmitterWebhookEventWithStringPayloadAndSignature): Promise<void>;
|
|
14
|
+
};
|
|
5
15
|
declare class Webhooks<TTransformed = unknown> {
|
|
6
16
|
sign: (payload: string | object) => Promise<string>;
|
|
7
|
-
verify:
|
|
17
|
+
verify: Iverify;
|
|
8
18
|
on: <E extends EmitterWebhookEventName>(event: E | E[], callback: HandlerFunction<E, TTransformed>) => void;
|
|
9
19
|
onAny: (callback: (event: EmitterWebhookEvent) => any) => void;
|
|
10
20
|
onError: (callback: (event: WebhookEventHandlerError) => any) => void;
|
|
11
21
|
removeListener: <E extends EmitterWebhookEventName | "*">(event: E | E[], callback: RemoveHandlerFunction<E, TTransformed>) => void;
|
|
12
22
|
receive: (event: EmitterWebhookEvent) => Promise<void>;
|
|
13
|
-
verifyAndReceive:
|
|
23
|
+
verifyAndReceive: IverifyAndReceive;
|
|
14
24
|
constructor(options: Options<TTransformed> & {
|
|
15
25
|
secret: string;
|
|
16
26
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type IncomingMessage = any;
|
|
2
|
+
type ServerResponse = any;
|
|
3
3
|
import { Webhooks } from "../../index";
|
|
4
4
|
import { MiddlewareOptions } from "./types";
|
|
5
5
|
export declare function middleware(webhooks: Webhooks, options: Required<MiddlewareOptions>, request: IncomingMessage, response: ServerResponse, next?: Function): Promise<boolean>;
|
package/dist-types/types.d.ts
CHANGED
|
@@ -2,19 +2,20 @@ import { RequestError } from "@octokit/request-error";
|
|
|
2
2
|
import type { WebhookEventMap, WebhookEventName } from "@octokit/webhooks-types";
|
|
3
3
|
import { Logger } from "./createLogger";
|
|
4
4
|
import type { emitterEventNames } from "./generated/webhook-names";
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export type EmitterWebhookEventName = (typeof emitterEventNames)[number];
|
|
6
|
+
export type EmitterWebhookEvent<TEmitterEvent extends EmitterWebhookEventName = EmitterWebhookEventName> = TEmitterEvent extends `${infer TWebhookEvent}.${infer TAction}` ? BaseWebhookEvent<Extract<TWebhookEvent, WebhookEventName>> & {
|
|
7
7
|
payload: {
|
|
8
8
|
action: TAction;
|
|
9
9
|
};
|
|
10
10
|
} : BaseWebhookEvent<Extract<TEmitterEvent, WebhookEventName>>;
|
|
11
|
-
export
|
|
11
|
+
export type EmitterWebhookEventWithStringPayloadAndSignature = {
|
|
12
12
|
id: string;
|
|
13
13
|
name: EmitterWebhookEventName;
|
|
14
14
|
payload: string;
|
|
15
15
|
signature: string;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
/** @deprecated */
|
|
18
|
+
export type EmitterWebhookEventWithSignature = EmitterWebhookEvent & {
|
|
18
19
|
signature: string;
|
|
19
20
|
};
|
|
20
21
|
interface BaseWebhookEvent<TName extends WebhookEventName> {
|
|
@@ -27,10 +28,10 @@ export interface Options<TTransformed = unknown> {
|
|
|
27
28
|
transform?: TransformMethod<TTransformed>;
|
|
28
29
|
log?: Partial<Logger>;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
export
|
|
32
|
-
export
|
|
33
|
-
|
|
31
|
+
type TransformMethod<T> = (event: EmitterWebhookEvent) => T | PromiseLike<T>;
|
|
32
|
+
export type HandlerFunction<TName extends EmitterWebhookEventName, TTransformed> = (event: EmitterWebhookEvent<TName> & TTransformed) => any;
|
|
33
|
+
export type RemoveHandlerFunction<TName extends EmitterWebhookEventName | "*", TTransformed> = (event: EmitterWebhookEvent<Exclude<TName, "*">> & TTransformed) => any;
|
|
34
|
+
type Hooks = {
|
|
34
35
|
[key: string]: Function[];
|
|
35
36
|
};
|
|
36
37
|
export interface State extends Options<any> {
|
|
@@ -41,7 +42,7 @@ export interface State extends Options<any> {
|
|
|
41
42
|
/**
|
|
42
43
|
* Error object with optional properties coming from `octokit.request` errors
|
|
43
44
|
*/
|
|
44
|
-
export
|
|
45
|
+
export type WebhookError = Error & Partial<RequestError>;
|
|
45
46
|
export interface WebhookEventHandlerError extends AggregateError<WebhookError> {
|
|
46
47
|
event: EmitterWebhookEvent;
|
|
47
48
|
}
|
package/dist-web/index.js
CHANGED
|
@@ -36,6 +36,12 @@ const emitterEventNames = [
|
|
|
36
36
|
"commit_comment.created",
|
|
37
37
|
"create",
|
|
38
38
|
"delete",
|
|
39
|
+
"dependabot_alert",
|
|
40
|
+
"dependabot_alert.created",
|
|
41
|
+
"dependabot_alert.dismissed",
|
|
42
|
+
"dependabot_alert.fixed",
|
|
43
|
+
"dependabot_alert.reintroduced",
|
|
44
|
+
"dependabot_alert.reopened",
|
|
39
45
|
"deploy_key",
|
|
40
46
|
"deploy_key.created",
|
|
41
47
|
"deploy_key.deleted",
|
|
@@ -194,6 +200,9 @@ const emitterEventNames = [
|
|
|
194
200
|
"pull_request_review_thread.resolved",
|
|
195
201
|
"pull_request_review_thread.unresolved",
|
|
196
202
|
"push",
|
|
203
|
+
"registry_package",
|
|
204
|
+
"registry_package.published",
|
|
205
|
+
"registry_package.updated",
|
|
197
206
|
"release",
|
|
198
207
|
"release.created",
|
|
199
208
|
"release.deleted",
|
|
@@ -255,6 +264,7 @@ const emitterEventNames = [
|
|
|
255
264
|
"workflow_job.queued",
|
|
256
265
|
"workflow_run",
|
|
257
266
|
"workflow_run.completed",
|
|
267
|
+
"workflow_run.in_progress",
|
|
258
268
|
"workflow_run.requested",
|
|
259
269
|
];
|
|
260
270
|
|
|
@@ -398,7 +408,7 @@ function createEventHandler(options) {
|
|
|
398
408
|
}
|
|
399
409
|
|
|
400
410
|
/**
|
|
401
|
-
* GitHub sends its JSON with
|
|
411
|
+
* GitHub sends its JSON with no indentation and no line break at the end
|
|
402
412
|
*/
|
|
403
413
|
function toNormalizedJsonString(payload) {
|
|
404
414
|
const payloadString = JSON.stringify(payload);
|
|
@@ -572,13 +582,23 @@ class Webhooks {
|
|
|
572
582
|
log: createLogger(options.log),
|
|
573
583
|
};
|
|
574
584
|
this.sign = sign.bind(null, options.secret);
|
|
575
|
-
this.verify =
|
|
585
|
+
this.verify = (eventPayload, signature) => {
|
|
586
|
+
if (typeof eventPayload === "object") {
|
|
587
|
+
console.error("[@octokit/webhooks] Passing a JSON payload object to `verify()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`");
|
|
588
|
+
}
|
|
589
|
+
return verify(options.secret, eventPayload, signature);
|
|
590
|
+
};
|
|
576
591
|
this.on = state.eventHandler.on;
|
|
577
592
|
this.onAny = state.eventHandler.onAny;
|
|
578
593
|
this.onError = state.eventHandler.onError;
|
|
579
594
|
this.removeListener = state.eventHandler.removeListener;
|
|
580
595
|
this.receive = state.eventHandler.receive;
|
|
581
|
-
this.verifyAndReceive =
|
|
596
|
+
this.verifyAndReceive = (options) => {
|
|
597
|
+
if (typeof options.payload === "object") {
|
|
598
|
+
console.error("[@octokit/webhooks] Passing a JSON payload object to `verifyAndReceive()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`");
|
|
599
|
+
}
|
|
600
|
+
return verifyAndReceive(state, options);
|
|
601
|
+
};
|
|
582
602
|
}
|
|
583
603
|
}
|
|
584
604
|
|
package/dist-web/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../dist-src/createLogger.js","../dist-src/generated/webhook-names.js","../dist-src/event-handler/on.js","../dist-src/event-handler/wrap-error-handler.js","../dist-src/event-handler/receive.js","../dist-src/event-handler/remove-listener.js","../dist-src/event-handler/index.js","../dist-src/to-normalized-json-string.js","../dist-src/sign.js","../dist-src/verify.js","../dist-src/verify-and-receive.js","../dist-src/middleware/node/get-missing-headers.js","../dist-src/middleware/node/get-payload.js","../dist-src/middleware/node/on-unhandled-request-default.js","../dist-src/middleware/node/middleware.js","../dist-src/middleware/node/index.js","../dist-src/index.js"],"sourcesContent":["export const createLogger = (logger) => ({\n debug: () => { },\n info: () => { },\n warn: console.warn.bind(console),\n error: console.error.bind(console),\n ...logger,\n});\n","// THIS FILE IS GENERATED - DO NOT EDIT DIRECTLY\n// make edits in scripts/generate-types.ts\nexport const emitterEventNames = [\n \"branch_protection_rule\",\n \"branch_protection_rule.created\",\n \"branch_protection_rule.deleted\",\n \"branch_protection_rule.edited\",\n \"check_run\",\n \"check_run.completed\",\n \"check_run.created\",\n \"check_run.requested_action\",\n \"check_run.rerequested\",\n \"check_suite\",\n \"check_suite.completed\",\n \"check_suite.requested\",\n \"check_suite.rerequested\",\n \"code_scanning_alert\",\n \"code_scanning_alert.appeared_in_branch\",\n \"code_scanning_alert.closed_by_user\",\n \"code_scanning_alert.created\",\n \"code_scanning_alert.fixed\",\n \"code_scanning_alert.reopened\",\n \"code_scanning_alert.reopened_by_user\",\n \"commit_comment\",\n \"commit_comment.created\",\n \"create\",\n \"delete\",\n \"deploy_key\",\n \"deploy_key.created\",\n \"deploy_key.deleted\",\n \"deployment\",\n \"deployment.created\",\n \"deployment_status\",\n \"deployment_status.created\",\n \"discussion\",\n \"discussion.answered\",\n \"discussion.category_changed\",\n \"discussion.created\",\n \"discussion.deleted\",\n \"discussion.edited\",\n \"discussion.labeled\",\n \"discussion.locked\",\n \"discussion.pinned\",\n \"discussion.transferred\",\n \"discussion.unanswered\",\n \"discussion.unlabeled\",\n \"discussion.unlocked\",\n \"discussion.unpinned\",\n \"discussion_comment\",\n \"discussion_comment.created\",\n \"discussion_comment.deleted\",\n \"discussion_comment.edited\",\n \"fork\",\n \"github_app_authorization\",\n \"github_app_authorization.revoked\",\n \"gollum\",\n \"installation\",\n \"installation.created\",\n \"installation.deleted\",\n \"installation.new_permissions_accepted\",\n \"installation.suspend\",\n \"installation.unsuspend\",\n \"installation_repositories\",\n \"installation_repositories.added\",\n \"installation_repositories.removed\",\n \"issue_comment\",\n \"issue_comment.created\",\n \"issue_comment.deleted\",\n \"issue_comment.edited\",\n \"issues\",\n \"issues.assigned\",\n \"issues.closed\",\n \"issues.deleted\",\n \"issues.demilestoned\",\n \"issues.edited\",\n \"issues.labeled\",\n \"issues.locked\",\n \"issues.milestoned\",\n \"issues.opened\",\n \"issues.pinned\",\n \"issues.reopened\",\n \"issues.transferred\",\n \"issues.unassigned\",\n \"issues.unlabeled\",\n \"issues.unlocked\",\n \"issues.unpinned\",\n \"label\",\n \"label.created\",\n \"label.deleted\",\n \"label.edited\",\n \"marketplace_purchase\",\n \"marketplace_purchase.cancelled\",\n \"marketplace_purchase.changed\",\n \"marketplace_purchase.pending_change\",\n \"marketplace_purchase.pending_change_cancelled\",\n \"marketplace_purchase.purchased\",\n \"member\",\n \"member.added\",\n \"member.edited\",\n \"member.removed\",\n \"membership\",\n \"membership.added\",\n \"membership.removed\",\n \"merge_group\",\n \"merge_group.checks_requested\",\n \"meta\",\n \"meta.deleted\",\n \"milestone\",\n \"milestone.closed\",\n \"milestone.created\",\n \"milestone.deleted\",\n \"milestone.edited\",\n \"milestone.opened\",\n \"org_block\",\n \"org_block.blocked\",\n \"org_block.unblocked\",\n \"organization\",\n \"organization.deleted\",\n \"organization.member_added\",\n \"organization.member_invited\",\n \"organization.member_removed\",\n \"organization.renamed\",\n \"package\",\n \"package.published\",\n \"package.updated\",\n \"page_build\",\n \"ping\",\n \"project\",\n \"project.closed\",\n \"project.created\",\n \"project.deleted\",\n \"project.edited\",\n \"project.reopened\",\n \"project_card\",\n \"project_card.converted\",\n \"project_card.created\",\n \"project_card.deleted\",\n \"project_card.edited\",\n \"project_card.moved\",\n \"project_column\",\n \"project_column.created\",\n \"project_column.deleted\",\n \"project_column.edited\",\n \"project_column.moved\",\n \"projects_v2_item\",\n \"projects_v2_item.archived\",\n \"projects_v2_item.converted\",\n \"projects_v2_item.created\",\n \"projects_v2_item.deleted\",\n \"projects_v2_item.edited\",\n \"projects_v2_item.reordered\",\n \"projects_v2_item.restored\",\n \"public\",\n \"pull_request\",\n \"pull_request.assigned\",\n \"pull_request.auto_merge_disabled\",\n \"pull_request.auto_merge_enabled\",\n \"pull_request.closed\",\n \"pull_request.converted_to_draft\",\n \"pull_request.dequeued\",\n \"pull_request.edited\",\n \"pull_request.labeled\",\n \"pull_request.locked\",\n \"pull_request.opened\",\n \"pull_request.queued\",\n \"pull_request.ready_for_review\",\n \"pull_request.reopened\",\n \"pull_request.review_request_removed\",\n \"pull_request.review_requested\",\n \"pull_request.synchronize\",\n \"pull_request.unassigned\",\n \"pull_request.unlabeled\",\n \"pull_request.unlocked\",\n \"pull_request_review\",\n \"pull_request_review.dismissed\",\n \"pull_request_review.edited\",\n \"pull_request_review.submitted\",\n \"pull_request_review_comment\",\n \"pull_request_review_comment.created\",\n \"pull_request_review_comment.deleted\",\n \"pull_request_review_comment.edited\",\n \"pull_request_review_thread\",\n \"pull_request_review_thread.resolved\",\n \"pull_request_review_thread.unresolved\",\n \"push\",\n \"release\",\n \"release.created\",\n \"release.deleted\",\n \"release.edited\",\n \"release.prereleased\",\n \"release.published\",\n \"release.released\",\n \"release.unpublished\",\n \"repository\",\n \"repository.archived\",\n \"repository.created\",\n \"repository.deleted\",\n \"repository.edited\",\n \"repository.privatized\",\n \"repository.publicized\",\n \"repository.renamed\",\n \"repository.transferred\",\n \"repository.unarchived\",\n \"repository_dispatch\",\n \"repository_import\",\n \"repository_vulnerability_alert\",\n \"repository_vulnerability_alert.create\",\n \"repository_vulnerability_alert.dismiss\",\n \"repository_vulnerability_alert.reopen\",\n \"repository_vulnerability_alert.resolve\",\n \"secret_scanning_alert\",\n \"secret_scanning_alert.created\",\n \"secret_scanning_alert.reopened\",\n \"secret_scanning_alert.resolved\",\n \"security_advisory\",\n \"security_advisory.performed\",\n \"security_advisory.published\",\n \"security_advisory.updated\",\n \"security_advisory.withdrawn\",\n \"sponsorship\",\n \"sponsorship.cancelled\",\n \"sponsorship.created\",\n \"sponsorship.edited\",\n \"sponsorship.pending_cancellation\",\n \"sponsorship.pending_tier_change\",\n \"sponsorship.tier_changed\",\n \"star\",\n \"star.created\",\n \"star.deleted\",\n \"status\",\n \"team\",\n \"team.added_to_repository\",\n \"team.created\",\n \"team.deleted\",\n \"team.edited\",\n \"team.removed_from_repository\",\n \"team_add\",\n \"watch\",\n \"watch.started\",\n \"workflow_dispatch\",\n \"workflow_job\",\n \"workflow_job.completed\",\n \"workflow_job.in_progress\",\n \"workflow_job.queued\",\n \"workflow_run\",\n \"workflow_run.completed\",\n \"workflow_run.requested\",\n];\n","import { emitterEventNames } from \"../generated/webhook-names\";\nfunction handleEventHandlers(state, webhookName, handler) {\n if (!state.hooks[webhookName]) {\n state.hooks[webhookName] = [];\n }\n state.hooks[webhookName].push(handler);\n}\nexport function receiverOn(state, webhookNameOrNames, handler) {\n if (Array.isArray(webhookNameOrNames)) {\n webhookNameOrNames.forEach((webhookName) => receiverOn(state, webhookName, handler));\n return;\n }\n if ([\"*\", \"error\"].includes(webhookNameOrNames)) {\n const webhookName = webhookNameOrNames === \"*\" ? \"any\" : webhookNameOrNames;\n 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`;\n throw new Error(message);\n }\n if (!emitterEventNames.includes(webhookNameOrNames)) {\n state.log.warn(`\"${webhookNameOrNames}\" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`);\n }\n handleEventHandlers(state, webhookNameOrNames, handler);\n}\nexport function receiverOnAny(state, handler) {\n handleEventHandlers(state, \"*\", handler);\n}\nexport function receiverOnError(state, handler) {\n handleEventHandlers(state, \"error\", handler);\n}\n","// Errors thrown or rejected Promises in \"error\" event handlers are not handled\n// as they are in the webhook event handlers. If errors occur, we log a\n// \"Fatal: Error occurred\" message to stdout\nexport function wrapErrorHandler(handler, error) {\n let returnValue;\n try {\n returnValue = handler(error);\n }\n catch (error) {\n console.log('FATAL: Error occurred in \"error\" event handler');\n console.log(error);\n }\n if (returnValue && returnValue.catch) {\n returnValue.catch((error) => {\n console.log('FATAL: Error occurred in \"error\" event handler');\n console.log(error);\n });\n }\n}\n","// @ts-ignore to address #245\nimport AggregateError from \"aggregate-error\";\nimport { wrapErrorHandler } from \"./wrap-error-handler\";\nfunction getHooks(state, eventPayloadAction, eventName) {\n const hooks = [state.hooks[eventName], state.hooks[\"*\"]];\n if (eventPayloadAction) {\n hooks.unshift(state.hooks[`${eventName}.${eventPayloadAction}`]);\n }\n return [].concat(...hooks.filter(Boolean));\n}\n// main handler function\nexport function receiverHandle(state, event) {\n const errorHandlers = state.hooks.error || [];\n if (event instanceof Error) {\n const error = Object.assign(new AggregateError([event]), {\n event,\n errors: [event],\n });\n errorHandlers.forEach((handler) => wrapErrorHandler(handler, error));\n return Promise.reject(error);\n }\n if (!event || !event.name) {\n throw new AggregateError([\"Event name not passed\"]);\n }\n if (!event.payload) {\n throw new AggregateError([\"Event payload not passed\"]);\n }\n // flatten arrays of event listeners and remove undefined values\n const hooks = getHooks(state, \"action\" in event.payload ? event.payload.action : null, event.name);\n if (hooks.length === 0) {\n return Promise.resolve();\n }\n const errors = [];\n const promises = hooks.map((handler) => {\n let promise = Promise.resolve(event);\n if (state.transform) {\n promise = promise.then(state.transform);\n }\n return promise\n .then((event) => {\n return handler(event);\n })\n .catch((error) => errors.push(Object.assign(error, { event })));\n });\n return Promise.all(promises).then(() => {\n if (errors.length === 0) {\n return;\n }\n const error = new AggregateError(errors);\n Object.assign(error, {\n event,\n errors,\n });\n errorHandlers.forEach((handler) => wrapErrorHandler(handler, error));\n throw error;\n });\n}\n","export function removeListener(state, webhookNameOrNames, handler) {\n if (Array.isArray(webhookNameOrNames)) {\n webhookNameOrNames.forEach((webhookName) => removeListener(state, webhookName, handler));\n return;\n }\n if (!state.hooks[webhookNameOrNames]) {\n return;\n }\n // remove last hook that has been added, that way\n // it behaves the same as removeListener\n for (let i = state.hooks[webhookNameOrNames].length - 1; i >= 0; i--) {\n if (state.hooks[webhookNameOrNames][i] === handler) {\n state.hooks[webhookNameOrNames].splice(i, 1);\n return;\n }\n }\n}\n","import { createLogger } from \"../createLogger\";\nimport { receiverOn as on, receiverOnAny as onAny, receiverOnError as onError, } from \"./on\";\nimport { receiverHandle as receive } from \"./receive\";\nimport { removeListener } from \"./remove-listener\";\nexport function createEventHandler(options) {\n const state = {\n hooks: {},\n log: createLogger(options && options.log),\n };\n if (options && options.transform) {\n state.transform = options.transform;\n }\n return {\n on: on.bind(null, state),\n onAny: onAny.bind(null, state),\n onError: onError.bind(null, state),\n removeListener: removeListener.bind(null, state),\n receive: receive.bind(null, state),\n };\n}\n","/**\n * GitHub sends its JSON with an indentation of 2 spaces and a line break at the end\n */\nexport function toNormalizedJsonString(payload) {\n const payloadString = JSON.stringify(payload);\n return payloadString.replace(/[^\\\\]\\\\u[\\da-f]{4}/g, (s) => {\n return s.substr(0, 3) + s.substr(3).toUpperCase();\n });\n}\n","import { sign as signMethod } from \"@octokit/webhooks-methods\";\nimport { toNormalizedJsonString } from \"./to-normalized-json-string\";\nexport async function sign(secret, payload) {\n return signMethod(secret, typeof payload === \"string\" ? payload : toNormalizedJsonString(payload));\n}\n","import { verify as verifyMethod } from \"@octokit/webhooks-methods\";\nimport { toNormalizedJsonString } from \"./to-normalized-json-string\";\nexport async function verify(secret, payload, signature) {\n return verifyMethod(secret, typeof payload === \"string\" ? payload : toNormalizedJsonString(payload), signature);\n}\n","import { verify } from \"@octokit/webhooks-methods\";\nimport { toNormalizedJsonString } from \"./to-normalized-json-string\";\nexport async function verifyAndReceive(state, event) {\n // verify will validate that the secret is not undefined\n const matchesSignature = await verify(state.secret, typeof event.payload === \"object\"\n ? toNormalizedJsonString(event.payload)\n : event.payload, event.signature);\n if (!matchesSignature) {\n const error = new Error(\"[@octokit/webhooks] signature does not match event payload and secret\");\n return state.eventHandler.receive(Object.assign(error, { event, status: 400 }));\n }\n return state.eventHandler.receive({\n id: event.id,\n name: event.name,\n payload: typeof event.payload === \"string\"\n ? JSON.parse(event.payload)\n : event.payload,\n });\n}\n","const WEBHOOK_HEADERS = [\n \"x-github-event\",\n \"x-hub-signature-256\",\n \"x-github-delivery\",\n];\n// https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#delivery-headers\nexport function getMissingHeaders(request) {\n return WEBHOOK_HEADERS.filter((header) => !(header in request.headers));\n}\n","// @ts-ignore to address #245\nimport AggregateError from \"aggregate-error\";\nexport function getPayload(request) {\n // If request.body already exists we can stop here\n // See https://github.com/octokit/webhooks.js/pull/23\n if (request.body)\n return Promise.resolve(request.body);\n return new Promise((resolve, reject) => {\n let data = \"\";\n request.setEncoding(\"utf8\");\n // istanbul ignore next\n request.on(\"error\", (error) => reject(new AggregateError([error])));\n request.on(\"data\", (chunk) => (data += chunk));\n request.on(\"end\", () => {\n try {\n resolve(JSON.parse(data));\n }\n catch (error) {\n error.message = \"Invalid JSON\";\n error.status = 400;\n reject(new AggregateError([error]));\n }\n });\n });\n}\n","export function onUnhandledRequestDefault(request, response) {\n response.writeHead(404, {\n \"content-type\": \"application/json\",\n });\n response.end(JSON.stringify({\n error: `Unknown route: ${request.method} ${request.url}`,\n }));\n}\n","import { getMissingHeaders } from \"./get-missing-headers\";\nimport { getPayload } from \"./get-payload\";\nimport { onUnhandledRequestDefault } from \"./on-unhandled-request-default\";\nexport async function middleware(webhooks, options, request, response, next) {\n let pathname;\n try {\n pathname = new URL(request.url, \"http://localhost\").pathname;\n }\n catch (error) {\n response.writeHead(422, {\n \"content-type\": \"application/json\",\n });\n response.end(JSON.stringify({\n error: `Request URL could not be parsed: ${request.url}`,\n }));\n return true;\n }\n if (pathname !== options.path) {\n next?.();\n return false;\n }\n else if (request.method !== \"POST\") {\n onUnhandledRequestDefault(request, response);\n return true;\n }\n const missingHeaders = getMissingHeaders(request).join(\", \");\n if (missingHeaders) {\n response.writeHead(400, {\n \"content-type\": \"application/json\",\n });\n response.end(JSON.stringify({\n error: `Required headers missing: ${missingHeaders}`,\n }));\n return true;\n }\n const eventName = request.headers[\"x-github-event\"];\n const signatureSHA256 = request.headers[\"x-hub-signature-256\"];\n const id = request.headers[\"x-github-delivery\"];\n options.log.debug(`${eventName} event received (id: ${id})`);\n // GitHub will abort the request if it does not receive a response within 10s\n // See https://github.com/octokit/webhooks.js/issues/185\n let didTimeout = false;\n const timeout = setTimeout(() => {\n didTimeout = true;\n response.statusCode = 202;\n response.end(\"still processing\\n\");\n }, 9000).unref();\n try {\n const payload = await getPayload(request);\n await webhooks.verifyAndReceive({\n id: id,\n name: eventName,\n payload: payload,\n signature: signatureSHA256,\n });\n clearTimeout(timeout);\n if (didTimeout)\n return true;\n response.end(\"ok\\n\");\n return true;\n }\n catch (error) {\n clearTimeout(timeout);\n if (didTimeout)\n return true;\n const err = Array.from(error)[0];\n const errorMessage = err.message\n ? `${err.name}: ${err.message}`\n : \"Error: An Unspecified error occurred\";\n response.statusCode = typeof err.status !== \"undefined\" ? err.status : 500;\n options.log.error(error);\n response.end(JSON.stringify({\n error: errorMessage,\n }));\n return true;\n }\n}\n","import { createLogger } from \"../../createLogger\";\nimport { middleware } from \"./middleware\";\nexport function createNodeMiddleware(webhooks, { path = \"/api/github/webhooks\", log = createLogger(), } = {}) {\n return middleware.bind(null, webhooks, {\n path,\n log,\n });\n}\n","import { createLogger } from \"./createLogger\";\nimport { createEventHandler } from \"./event-handler/index\";\nimport { sign } from \"./sign\";\nimport { verify } from \"./verify\";\nimport { verifyAndReceive } from \"./verify-and-receive\";\nexport { createNodeMiddleware } from \"./middleware/node/index\";\nexport { emitterEventNames } from \"./generated/webhook-names\";\n// U holds the return value of `transform` function in Options\nclass Webhooks {\n constructor(options) {\n if (!options || !options.secret) {\n throw new Error(\"[@octokit/webhooks] options.secret required\");\n }\n const state = {\n eventHandler: createEventHandler(options),\n secret: options.secret,\n hooks: {},\n log: createLogger(options.log),\n };\n this.sign = sign.bind(null, options.secret);\n this.verify = verify.bind(null, options.secret);\n this.on = state.eventHandler.on;\n this.onAny = state.eventHandler.onAny;\n this.onError = state.eventHandler.onError;\n this.removeListener = state.eventHandler.removeListener;\n this.receive = state.eventHandler.receive;\n this.verifyAndReceive = verifyAndReceive.bind(null, state);\n }\n}\nexport { createEventHandler, Webhooks, };\n"],"names":["on","onAny","onError","receive","signMethod","verifyMethod","verify"],"mappings":";;;AAAO,MAAM,YAAY,GAAG,CAAC,MAAM,MAAM;AACzC,IAAI,KAAK,EAAE,MAAM,GAAG;AACpB,IAAI,IAAI,EAAE,MAAM,GAAG;AACnB,IAAI,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;A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;AACzC,YAAY,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;AAC3E,SAAS;AACT,QAAQ,MAAM,KAAK,GAAG;AACtB,YAAY,YAAY,EAAE,kBAAkB,CAAC,OAAO,CAAC;AACrD,YAAY,MAAM,EAAE,OAAO,CAAC,MAAM;AAClC,YAAY,KAAK,EAAE,EAAE;AACrB,YAAY,GAAG,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC;AAC1C,SAAS,CAAC;AACV,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AACpD,QAAQ,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AACxD,QAAQ,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;AACxC,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC;AAC9C,QAAQ,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC;AAClD,QAAQ,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC;AAChE,QAAQ,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC;AAClD,QAAQ,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACnE,KAAK;AACL,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../dist-src/createLogger.js","../dist-src/generated/webhook-names.js","../dist-src/event-handler/on.js","../dist-src/event-handler/wrap-error-handler.js","../dist-src/event-handler/receive.js","../dist-src/event-handler/remove-listener.js","../dist-src/event-handler/index.js","../dist-src/to-normalized-json-string.js","../dist-src/sign.js","../dist-src/verify.js","../dist-src/verify-and-receive.js","../dist-src/middleware/node/get-missing-headers.js","../dist-src/middleware/node/get-payload.js","../dist-src/middleware/node/on-unhandled-request-default.js","../dist-src/middleware/node/middleware.js","../dist-src/middleware/node/index.js","../dist-src/index.js"],"sourcesContent":["export const createLogger = (logger) => ({\n debug: () => { },\n info: () => { },\n warn: console.warn.bind(console),\n error: console.error.bind(console),\n ...logger,\n});\n","// THIS FILE IS GENERATED - DO NOT EDIT DIRECTLY\n// make edits in scripts/generate-types.ts\nexport const emitterEventNames = [\n \"branch_protection_rule\",\n \"branch_protection_rule.created\",\n \"branch_protection_rule.deleted\",\n \"branch_protection_rule.edited\",\n \"check_run\",\n \"check_run.completed\",\n \"check_run.created\",\n \"check_run.requested_action\",\n \"check_run.rerequested\",\n \"check_suite\",\n \"check_suite.completed\",\n \"check_suite.requested\",\n \"check_suite.rerequested\",\n \"code_scanning_alert\",\n \"code_scanning_alert.appeared_in_branch\",\n \"code_scanning_alert.closed_by_user\",\n \"code_scanning_alert.created\",\n \"code_scanning_alert.fixed\",\n \"code_scanning_alert.reopened\",\n \"code_scanning_alert.reopened_by_user\",\n \"commit_comment\",\n \"commit_comment.created\",\n \"create\",\n \"delete\",\n \"dependabot_alert\",\n \"dependabot_alert.created\",\n \"dependabot_alert.dismissed\",\n \"dependabot_alert.fixed\",\n \"dependabot_alert.reintroduced\",\n \"dependabot_alert.reopened\",\n \"deploy_key\",\n \"deploy_key.created\",\n \"deploy_key.deleted\",\n \"deployment\",\n \"deployment.created\",\n \"deployment_status\",\n \"deployment_status.created\",\n \"discussion\",\n \"discussion.answered\",\n \"discussion.category_changed\",\n \"discussion.created\",\n \"discussion.deleted\",\n \"discussion.edited\",\n \"discussion.labeled\",\n \"discussion.locked\",\n \"discussion.pinned\",\n \"discussion.transferred\",\n \"discussion.unanswered\",\n \"discussion.unlabeled\",\n \"discussion.unlocked\",\n \"discussion.unpinned\",\n \"discussion_comment\",\n \"discussion_comment.created\",\n \"discussion_comment.deleted\",\n \"discussion_comment.edited\",\n \"fork\",\n \"github_app_authorization\",\n \"github_app_authorization.revoked\",\n \"gollum\",\n \"installation\",\n \"installation.created\",\n \"installation.deleted\",\n \"installation.new_permissions_accepted\",\n \"installation.suspend\",\n \"installation.unsuspend\",\n \"installation_repositories\",\n \"installation_repositories.added\",\n \"installation_repositories.removed\",\n \"issue_comment\",\n \"issue_comment.created\",\n \"issue_comment.deleted\",\n \"issue_comment.edited\",\n \"issues\",\n \"issues.assigned\",\n \"issues.closed\",\n \"issues.deleted\",\n \"issues.demilestoned\",\n \"issues.edited\",\n \"issues.labeled\",\n \"issues.locked\",\n \"issues.milestoned\",\n \"issues.opened\",\n \"issues.pinned\",\n \"issues.reopened\",\n \"issues.transferred\",\n \"issues.unassigned\",\n \"issues.unlabeled\",\n \"issues.unlocked\",\n \"issues.unpinned\",\n \"label\",\n \"label.created\",\n \"label.deleted\",\n \"label.edited\",\n \"marketplace_purchase\",\n \"marketplace_purchase.cancelled\",\n \"marketplace_purchase.changed\",\n \"marketplace_purchase.pending_change\",\n \"marketplace_purchase.pending_change_cancelled\",\n \"marketplace_purchase.purchased\",\n \"member\",\n \"member.added\",\n \"member.edited\",\n \"member.removed\",\n \"membership\",\n \"membership.added\",\n \"membership.removed\",\n \"merge_group\",\n \"merge_group.checks_requested\",\n \"meta\",\n \"meta.deleted\",\n \"milestone\",\n \"milestone.closed\",\n \"milestone.created\",\n \"milestone.deleted\",\n \"milestone.edited\",\n \"milestone.opened\",\n \"org_block\",\n \"org_block.blocked\",\n \"org_block.unblocked\",\n \"organization\",\n \"organization.deleted\",\n \"organization.member_added\",\n \"organization.member_invited\",\n \"organization.member_removed\",\n \"organization.renamed\",\n \"package\",\n \"package.published\",\n \"package.updated\",\n \"page_build\",\n \"ping\",\n \"project\",\n \"project.closed\",\n \"project.created\",\n \"project.deleted\",\n \"project.edited\",\n \"project.reopened\",\n \"project_card\",\n \"project_card.converted\",\n \"project_card.created\",\n \"project_card.deleted\",\n \"project_card.edited\",\n \"project_card.moved\",\n \"project_column\",\n \"project_column.created\",\n \"project_column.deleted\",\n \"project_column.edited\",\n \"project_column.moved\",\n \"projects_v2_item\",\n \"projects_v2_item.archived\",\n \"projects_v2_item.converted\",\n \"projects_v2_item.created\",\n \"projects_v2_item.deleted\",\n \"projects_v2_item.edited\",\n \"projects_v2_item.reordered\",\n \"projects_v2_item.restored\",\n \"public\",\n \"pull_request\",\n \"pull_request.assigned\",\n \"pull_request.auto_merge_disabled\",\n \"pull_request.auto_merge_enabled\",\n \"pull_request.closed\",\n \"pull_request.converted_to_draft\",\n \"pull_request.dequeued\",\n \"pull_request.edited\",\n \"pull_request.labeled\",\n \"pull_request.locked\",\n \"pull_request.opened\",\n \"pull_request.queued\",\n \"pull_request.ready_for_review\",\n \"pull_request.reopened\",\n \"pull_request.review_request_removed\",\n \"pull_request.review_requested\",\n \"pull_request.synchronize\",\n \"pull_request.unassigned\",\n \"pull_request.unlabeled\",\n \"pull_request.unlocked\",\n \"pull_request_review\",\n \"pull_request_review.dismissed\",\n \"pull_request_review.edited\",\n \"pull_request_review.submitted\",\n \"pull_request_review_comment\",\n \"pull_request_review_comment.created\",\n \"pull_request_review_comment.deleted\",\n \"pull_request_review_comment.edited\",\n \"pull_request_review_thread\",\n \"pull_request_review_thread.resolved\",\n \"pull_request_review_thread.unresolved\",\n \"push\",\n \"registry_package\",\n \"registry_package.published\",\n \"registry_package.updated\",\n \"release\",\n \"release.created\",\n \"release.deleted\",\n \"release.edited\",\n \"release.prereleased\",\n \"release.published\",\n \"release.released\",\n \"release.unpublished\",\n \"repository\",\n \"repository.archived\",\n \"repository.created\",\n \"repository.deleted\",\n \"repository.edited\",\n \"repository.privatized\",\n \"repository.publicized\",\n \"repository.renamed\",\n \"repository.transferred\",\n \"repository.unarchived\",\n \"repository_dispatch\",\n \"repository_import\",\n \"repository_vulnerability_alert\",\n \"repository_vulnerability_alert.create\",\n \"repository_vulnerability_alert.dismiss\",\n \"repository_vulnerability_alert.reopen\",\n \"repository_vulnerability_alert.resolve\",\n \"secret_scanning_alert\",\n \"secret_scanning_alert.created\",\n \"secret_scanning_alert.reopened\",\n \"secret_scanning_alert.resolved\",\n \"security_advisory\",\n \"security_advisory.performed\",\n \"security_advisory.published\",\n \"security_advisory.updated\",\n \"security_advisory.withdrawn\",\n \"sponsorship\",\n \"sponsorship.cancelled\",\n \"sponsorship.created\",\n \"sponsorship.edited\",\n \"sponsorship.pending_cancellation\",\n \"sponsorship.pending_tier_change\",\n \"sponsorship.tier_changed\",\n \"star\",\n \"star.created\",\n \"star.deleted\",\n \"status\",\n \"team\",\n \"team.added_to_repository\",\n \"team.created\",\n \"team.deleted\",\n \"team.edited\",\n \"team.removed_from_repository\",\n \"team_add\",\n \"watch\",\n \"watch.started\",\n \"workflow_dispatch\",\n \"workflow_job\",\n \"workflow_job.completed\",\n \"workflow_job.in_progress\",\n \"workflow_job.queued\",\n \"workflow_run\",\n \"workflow_run.completed\",\n \"workflow_run.in_progress\",\n \"workflow_run.requested\",\n];\n","import { emitterEventNames } from \"../generated/webhook-names\";\nfunction handleEventHandlers(state, webhookName, handler) {\n if (!state.hooks[webhookName]) {\n state.hooks[webhookName] = [];\n }\n state.hooks[webhookName].push(handler);\n}\nexport function receiverOn(state, webhookNameOrNames, handler) {\n if (Array.isArray(webhookNameOrNames)) {\n webhookNameOrNames.forEach((webhookName) => receiverOn(state, webhookName, handler));\n return;\n }\n if ([\"*\", \"error\"].includes(webhookNameOrNames)) {\n const webhookName = webhookNameOrNames === \"*\" ? \"any\" : webhookNameOrNames;\n 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`;\n throw new Error(message);\n }\n if (!emitterEventNames.includes(webhookNameOrNames)) {\n state.log.warn(`\"${webhookNameOrNames}\" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`);\n }\n handleEventHandlers(state, webhookNameOrNames, handler);\n}\nexport function receiverOnAny(state, handler) {\n handleEventHandlers(state, \"*\", handler);\n}\nexport function receiverOnError(state, handler) {\n handleEventHandlers(state, \"error\", handler);\n}\n","// Errors thrown or rejected Promises in \"error\" event handlers are not handled\n// as they are in the webhook event handlers. If errors occur, we log a\n// \"Fatal: Error occurred\" message to stdout\nexport function wrapErrorHandler(handler, error) {\n let returnValue;\n try {\n returnValue = handler(error);\n }\n catch (error) {\n console.log('FATAL: Error occurred in \"error\" event handler');\n console.log(error);\n }\n if (returnValue && returnValue.catch) {\n returnValue.catch((error) => {\n console.log('FATAL: Error occurred in \"error\" event handler');\n console.log(error);\n });\n }\n}\n","// @ts-ignore to address #245\nimport AggregateError from \"aggregate-error\";\nimport { wrapErrorHandler } from \"./wrap-error-handler\";\nfunction getHooks(state, eventPayloadAction, eventName) {\n const hooks = [state.hooks[eventName], state.hooks[\"*\"]];\n if (eventPayloadAction) {\n hooks.unshift(state.hooks[`${eventName}.${eventPayloadAction}`]);\n }\n return [].concat(...hooks.filter(Boolean));\n}\n// main handler function\nexport function receiverHandle(state, event) {\n const errorHandlers = state.hooks.error || [];\n if (event instanceof Error) {\n const error = Object.assign(new AggregateError([event]), {\n event,\n errors: [event],\n });\n errorHandlers.forEach((handler) => wrapErrorHandler(handler, error));\n return Promise.reject(error);\n }\n if (!event || !event.name) {\n throw new AggregateError([\"Event name not passed\"]);\n }\n if (!event.payload) {\n throw new AggregateError([\"Event payload not passed\"]);\n }\n // flatten arrays of event listeners and remove undefined values\n const hooks = getHooks(state, \"action\" in event.payload ? event.payload.action : null, event.name);\n if (hooks.length === 0) {\n return Promise.resolve();\n }\n const errors = [];\n const promises = hooks.map((handler) => {\n let promise = Promise.resolve(event);\n if (state.transform) {\n promise = promise.then(state.transform);\n }\n return promise\n .then((event) => {\n return handler(event);\n })\n .catch((error) => errors.push(Object.assign(error, { event })));\n });\n return Promise.all(promises).then(() => {\n if (errors.length === 0) {\n return;\n }\n const error = new AggregateError(errors);\n Object.assign(error, {\n event,\n errors,\n });\n errorHandlers.forEach((handler) => wrapErrorHandler(handler, error));\n throw error;\n });\n}\n","export function removeListener(state, webhookNameOrNames, handler) {\n if (Array.isArray(webhookNameOrNames)) {\n webhookNameOrNames.forEach((webhookName) => removeListener(state, webhookName, handler));\n return;\n }\n if (!state.hooks[webhookNameOrNames]) {\n return;\n }\n // remove last hook that has been added, that way\n // it behaves the same as removeListener\n for (let i = state.hooks[webhookNameOrNames].length - 1; i >= 0; i--) {\n if (state.hooks[webhookNameOrNames][i] === handler) {\n state.hooks[webhookNameOrNames].splice(i, 1);\n return;\n }\n }\n}\n","import { createLogger } from \"../createLogger\";\nimport { receiverOn as on, receiverOnAny as onAny, receiverOnError as onError, } from \"./on\";\nimport { receiverHandle as receive } from \"./receive\";\nimport { removeListener } from \"./remove-listener\";\nexport function createEventHandler(options) {\n const state = {\n hooks: {},\n log: createLogger(options && options.log),\n };\n if (options && options.transform) {\n state.transform = options.transform;\n }\n return {\n on: on.bind(null, state),\n onAny: onAny.bind(null, state),\n onError: onError.bind(null, state),\n removeListener: removeListener.bind(null, state),\n receive: receive.bind(null, state),\n };\n}\n","/**\n * GitHub sends its JSON with no indentation and no line break at the end\n */\nexport function toNormalizedJsonString(payload) {\n const payloadString = JSON.stringify(payload);\n return payloadString.replace(/[^\\\\]\\\\u[\\da-f]{4}/g, (s) => {\n return s.substr(0, 3) + s.substr(3).toUpperCase();\n });\n}\n","import { sign as signMethod } from \"@octokit/webhooks-methods\";\nimport { toNormalizedJsonString } from \"./to-normalized-json-string\";\nexport async function sign(secret, payload) {\n return signMethod(secret, typeof payload === \"string\" ? payload : toNormalizedJsonString(payload));\n}\n","import { verify as verifyMethod } from \"@octokit/webhooks-methods\";\nimport { toNormalizedJsonString } from \"./to-normalized-json-string\";\nexport async function verify(secret, payload, signature) {\n return verifyMethod(secret, typeof payload === \"string\" ? payload : toNormalizedJsonString(payload), signature);\n}\n","import { verify } from \"@octokit/webhooks-methods\";\nimport { toNormalizedJsonString } from \"./to-normalized-json-string\";\nexport async function verifyAndReceive(state, event) {\n // verify will validate that the secret is not undefined\n const matchesSignature = await verify(state.secret, typeof event.payload === \"object\"\n ? toNormalizedJsonString(event.payload)\n : event.payload, event.signature);\n if (!matchesSignature) {\n const error = new Error(\"[@octokit/webhooks] signature does not match event payload and secret\");\n return state.eventHandler.receive(Object.assign(error, { event, status: 400 }));\n }\n return state.eventHandler.receive({\n id: event.id,\n name: event.name,\n payload: typeof event.payload === \"string\"\n ? JSON.parse(event.payload)\n : event.payload,\n });\n}\n","const WEBHOOK_HEADERS = [\n \"x-github-event\",\n \"x-hub-signature-256\",\n \"x-github-delivery\",\n];\n// https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#delivery-headers\nexport function getMissingHeaders(request) {\n return WEBHOOK_HEADERS.filter((header) => !(header in request.headers));\n}\n","// @ts-ignore to address #245\nimport AggregateError from \"aggregate-error\";\nexport function getPayload(request) {\n // If request.body already exists we can stop here\n // See https://github.com/octokit/webhooks.js/pull/23\n if (request.body)\n return Promise.resolve(request.body);\n return new Promise((resolve, reject) => {\n let data = \"\";\n request.setEncoding(\"utf8\");\n // istanbul ignore next\n request.on(\"error\", (error) => reject(new AggregateError([error])));\n request.on(\"data\", (chunk) => (data += chunk));\n request.on(\"end\", () => {\n try {\n resolve(JSON.parse(data));\n }\n catch (error) {\n error.message = \"Invalid JSON\";\n error.status = 400;\n reject(new AggregateError([error]));\n }\n });\n });\n}\n","export function onUnhandledRequestDefault(request, response) {\n response.writeHead(404, {\n \"content-type\": \"application/json\",\n });\n response.end(JSON.stringify({\n error: `Unknown route: ${request.method} ${request.url}`,\n }));\n}\n","import { getMissingHeaders } from \"./get-missing-headers\";\nimport { getPayload } from \"./get-payload\";\nimport { onUnhandledRequestDefault } from \"./on-unhandled-request-default\";\nexport async function middleware(webhooks, options, request, response, next) {\n let pathname;\n try {\n pathname = new URL(request.url, \"http://localhost\").pathname;\n }\n catch (error) {\n response.writeHead(422, {\n \"content-type\": \"application/json\",\n });\n response.end(JSON.stringify({\n error: `Request URL could not be parsed: ${request.url}`,\n }));\n return true;\n }\n if (pathname !== options.path) {\n next?.();\n return false;\n }\n else if (request.method !== \"POST\") {\n onUnhandledRequestDefault(request, response);\n return true;\n }\n const missingHeaders = getMissingHeaders(request).join(\", \");\n if (missingHeaders) {\n response.writeHead(400, {\n \"content-type\": \"application/json\",\n });\n response.end(JSON.stringify({\n error: `Required headers missing: ${missingHeaders}`,\n }));\n return true;\n }\n const eventName = request.headers[\"x-github-event\"];\n const signatureSHA256 = request.headers[\"x-hub-signature-256\"];\n const id = request.headers[\"x-github-delivery\"];\n options.log.debug(`${eventName} event received (id: ${id})`);\n // GitHub will abort the request if it does not receive a response within 10s\n // See https://github.com/octokit/webhooks.js/issues/185\n let didTimeout = false;\n const timeout = setTimeout(() => {\n didTimeout = true;\n response.statusCode = 202;\n response.end(\"still processing\\n\");\n }, 9000).unref();\n try {\n const payload = await getPayload(request);\n await webhooks.verifyAndReceive({\n id: id,\n name: eventName,\n payload: payload,\n signature: signatureSHA256,\n });\n clearTimeout(timeout);\n if (didTimeout)\n return true;\n response.end(\"ok\\n\");\n return true;\n }\n catch (error) {\n clearTimeout(timeout);\n if (didTimeout)\n return true;\n const err = Array.from(error)[0];\n const errorMessage = err.message\n ? `${err.name}: ${err.message}`\n : \"Error: An Unspecified error occurred\";\n response.statusCode = typeof err.status !== \"undefined\" ? err.status : 500;\n options.log.error(error);\n response.end(JSON.stringify({\n error: errorMessage,\n }));\n return true;\n }\n}\n","import { createLogger } from \"../../createLogger\";\nimport { middleware } from \"./middleware\";\nexport function createNodeMiddleware(webhooks, { path = \"/api/github/webhooks\", log = createLogger(), } = {}) {\n return middleware.bind(null, webhooks, {\n path,\n log,\n });\n}\n","import { createLogger } from \"./createLogger\";\nimport { createEventHandler } from \"./event-handler/index\";\nimport { sign } from \"./sign\";\nimport { verify } from \"./verify\";\nimport { verifyAndReceive } from \"./verify-and-receive\";\nexport { createNodeMiddleware } from \"./middleware/node/index\";\nexport { emitterEventNames } from \"./generated/webhook-names\";\n// U holds the return value of `transform` function in Options\nclass Webhooks {\n constructor(options) {\n if (!options || !options.secret) {\n throw new Error(\"[@octokit/webhooks] options.secret required\");\n }\n const state = {\n eventHandler: createEventHandler(options),\n secret: options.secret,\n hooks: {},\n log: createLogger(options.log),\n };\n this.sign = sign.bind(null, options.secret);\n this.verify = (eventPayload, signature) => {\n if (typeof eventPayload === \"object\") {\n console.error(\"[@octokit/webhooks] Passing a JSON payload object to `verify()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`\");\n }\n return verify(options.secret, eventPayload, signature);\n };\n this.on = state.eventHandler.on;\n this.onAny = state.eventHandler.onAny;\n this.onError = state.eventHandler.onError;\n this.removeListener = state.eventHandler.removeListener;\n this.receive = state.eventHandler.receive;\n this.verifyAndReceive = (options) => {\n if (typeof options.payload === \"object\") {\n console.error(\"[@octokit/webhooks] Passing a JSON payload object to `verifyAndReceive()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`\");\n }\n return verifyAndReceive(state, options);\n };\n }\n}\nexport { createEventHandler, Webhooks, };\n"],"names":["on","onAny","onError","receive","signMethod","verifyMethod","verify"],"mappings":";;;AAAO,MAAM,YAAY,GAAG,CAAC,MAAM,MAAM;AACzC,IAAI,KAAK,EAAE,MAAM,GAAG;AACpB,IAAI,IAAI,EAAE,MAAM,GAAG;AACnB,IAAI,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;AACpC,IAAI,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;AACtC,IAAI,GAAG,MAAM;AACb,CAAC,CAAC;;ACNF;AACA;AACA,AAAY,MAAC,iBAAiB,GAAG;AACjC,IAAI,wBAAwB;AAC5B,IAAI,gCAAgC;AACpC,IAAI,gCAAgC;AACpC,IAAI,+BAA+B;AACnC,IAAI,WAAW;AACf,IAAI,qBAAqB;AACzB,IAAI,mBAAmB;AACvB,IAAI,4BAA4B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KAAK;AACL,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octokit/webhooks",
|
|
3
3
|
"description": "GitHub webhook events toolset for Node.js",
|
|
4
|
-
"version": "11.0.0-beta.
|
|
4
|
+
"version": "11.0.0-beta.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist-*/",
|
|
@@ -18,27 +18,27 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@octokit/request-error": "^3.0.0",
|
|
20
20
|
"@octokit/webhooks-methods": "^3.0.0",
|
|
21
|
-
"@octokit/webhooks-types": "6.
|
|
21
|
+
"@octokit/webhooks-types": "6.7.0",
|
|
22
22
|
"aggregate-error": "^3.1.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@jest/types": "^29.0.0",
|
|
26
26
|
"@octokit/tsconfig": "^1.0.1",
|
|
27
|
-
"@octokit/webhooks-schemas": "6.
|
|
27
|
+
"@octokit/webhooks-schemas": "6.8.0",
|
|
28
28
|
"@pika/pack": "^0.3.7",
|
|
29
29
|
"@pika/plugin-build-node": "^0.9.2",
|
|
30
30
|
"@pika/plugin-build-web": "^0.9.2",
|
|
31
31
|
"@pika/plugin-ts-standard-pkg": "^0.9.2",
|
|
32
32
|
"@types/jest": "^29.0.0",
|
|
33
33
|
"@types/json-schema": "^7.0.7",
|
|
34
|
-
"@types/node": "^
|
|
34
|
+
"@types/node": "^18.0.0",
|
|
35
35
|
"@types/node-fetch": "^2.5.8",
|
|
36
36
|
"@types/prettier": "^2.0.0",
|
|
37
|
-
"axios": "^0.
|
|
37
|
+
"axios": "^1.0.0",
|
|
38
38
|
"express": "^4.17.1",
|
|
39
39
|
"jest": "^29.0.0",
|
|
40
40
|
"node-fetch": "^2.6.7",
|
|
41
|
-
"prettier": "2.
|
|
41
|
+
"prettier": "2.8.2",
|
|
42
42
|
"prettier-plugin-packagejson": "^2.2.9",
|
|
43
43
|
"ts-jest": "^29.0.0",
|
|
44
44
|
"ts-node": "^10.0.0",
|