cyrus-gitlab-event-transport 0.2.38
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/LICENSE +201 -0
- package/dist/GitLabCommentService.d.ts +89 -0
- package/dist/GitLabCommentService.d.ts.map +1 -0
- package/dist/GitLabCommentService.js +78 -0
- package/dist/GitLabCommentService.js.map +1 -0
- package/dist/GitLabEventTransport.d.ts +63 -0
- package/dist/GitLabEventTransport.d.ts.map +1 -0
- package/dist/GitLabEventTransport.js +175 -0
- package/dist/GitLabEventTransport.js.map +1 -0
- package/dist/GitLabMessageTranslator.d.ts +69 -0
- package/dist/GitLabMessageTranslator.d.ts.map +1 -0
- package/dist/GitLabMessageTranslator.js +274 -0
- package/dist/GitLabMessageTranslator.js.map +1 -0
- package/dist/gitlab-webhook-utils.d.ts +74 -0
- package/dist/gitlab-webhook-utils.d.ts.map +1 -0
- package/dist/gitlab-webhook-utils.js +157 -0
- package/dist/gitlab-webhook-utils.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +169 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +30 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service for posting comments (notes) back to GitLab MR conversations.
|
|
3
|
+
*
|
|
4
|
+
* Uses the GitLab REST API v4 with a personal or project access token
|
|
5
|
+
* to post notes on merge requests and reply to discussion threads.
|
|
6
|
+
*/
|
|
7
|
+
export interface GitLabCommentServiceConfig {
|
|
8
|
+
/** GitLab API base URL (default: https://gitlab.com) */
|
|
9
|
+
apiBaseUrl?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Parameters for posting a note on a GitLab MR
|
|
13
|
+
*/
|
|
14
|
+
export interface PostMRNoteParams {
|
|
15
|
+
/** GitLab access token */
|
|
16
|
+
token: string;
|
|
17
|
+
/** Project ID (numeric) */
|
|
18
|
+
projectId: number;
|
|
19
|
+
/** MR iid (project-scoped ID) */
|
|
20
|
+
mrIid: number;
|
|
21
|
+
/** Note body (markdown) */
|
|
22
|
+
body: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parameters for posting a reply to a discussion thread
|
|
26
|
+
*/
|
|
27
|
+
export interface PostDiscussionReplyParams {
|
|
28
|
+
/** GitLab access token */
|
|
29
|
+
token: string;
|
|
30
|
+
/** Project ID (numeric) */
|
|
31
|
+
projectId: number;
|
|
32
|
+
/** MR iid (project-scoped ID) */
|
|
33
|
+
mrIid: number;
|
|
34
|
+
/** Discussion ID to reply to */
|
|
35
|
+
discussionId: string;
|
|
36
|
+
/** Reply body (markdown) */
|
|
37
|
+
body: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Parameters for adding an award emoji (reaction) to a note
|
|
41
|
+
*/
|
|
42
|
+
export interface AddAwardEmojiParams {
|
|
43
|
+
/** GitLab access token */
|
|
44
|
+
token: string;
|
|
45
|
+
/** Project ID (numeric) */
|
|
46
|
+
projectId: number;
|
|
47
|
+
/** MR iid (project-scoped ID) */
|
|
48
|
+
mrIid: number;
|
|
49
|
+
/** Note ID to react to */
|
|
50
|
+
noteId: number;
|
|
51
|
+
/** Emoji name (e.g., "eyes", "thumbsup", "heart") */
|
|
52
|
+
name: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Response from GitLab API after creating a note
|
|
56
|
+
*/
|
|
57
|
+
export interface GitLabNoteResponse {
|
|
58
|
+
id: number;
|
|
59
|
+
body: string;
|
|
60
|
+
created_at: string;
|
|
61
|
+
author: {
|
|
62
|
+
id: number;
|
|
63
|
+
username: string;
|
|
64
|
+
name: string;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export declare class GitLabCommentService {
|
|
68
|
+
private apiBaseUrl;
|
|
69
|
+
constructor(config?: GitLabCommentServiceConfig);
|
|
70
|
+
/**
|
|
71
|
+
* Post a note (comment) on a merge request.
|
|
72
|
+
*
|
|
73
|
+
* @see https://docs.gitlab.com/ee/api/notes.html#create-new-merge-request-note
|
|
74
|
+
*/
|
|
75
|
+
postMRNote(params: PostMRNoteParams): Promise<GitLabNoteResponse>;
|
|
76
|
+
/**
|
|
77
|
+
* Post a reply to a discussion thread on a merge request.
|
|
78
|
+
*
|
|
79
|
+
* @see https://docs.gitlab.com/ee/api/discussions.html#add-note-to-existing-merge-request-thread
|
|
80
|
+
*/
|
|
81
|
+
postDiscussionReply(params: PostDiscussionReplyParams): Promise<GitLabNoteResponse>;
|
|
82
|
+
/**
|
|
83
|
+
* Add an award emoji (reaction) to a note on a merge request.
|
|
84
|
+
*
|
|
85
|
+
* @see https://docs.gitlab.com/ee/api/award_emoji.html#award-a-new-emoji-on-a-note
|
|
86
|
+
*/
|
|
87
|
+
addAwardEmoji(params: AddAwardEmojiParams): Promise<void>;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=GitLabCommentService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitLabCommentService.d.ts","sourceRoot":"","sources":["../src/GitLabCommentService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,0BAA0B;IAC1C,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,gBAA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B9B;;;;OAIG;IACG,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;CAoB/D"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service for posting comments (notes) back to GitLab MR conversations.
|
|
3
|
+
*
|
|
4
|
+
* Uses the GitLab REST API v4 with a personal or project access token
|
|
5
|
+
* to post notes on merge requests and reply to discussion threads.
|
|
6
|
+
*/
|
|
7
|
+
export class GitLabCommentService {
|
|
8
|
+
apiBaseUrl;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.apiBaseUrl = config?.apiBaseUrl ?? "https://gitlab.com";
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Post a note (comment) on a merge request.
|
|
14
|
+
*
|
|
15
|
+
* @see https://docs.gitlab.com/ee/api/notes.html#create-new-merge-request-note
|
|
16
|
+
*/
|
|
17
|
+
async postMRNote(params) {
|
|
18
|
+
const { token, projectId, mrIid, body } = params;
|
|
19
|
+
const url = `${this.apiBaseUrl}/api/v4/projects/${projectId}/merge_requests/${mrIid}/notes`;
|
|
20
|
+
const response = await fetch(url, {
|
|
21
|
+
method: "POST",
|
|
22
|
+
headers: {
|
|
23
|
+
"PRIVATE-TOKEN": token,
|
|
24
|
+
"Content-Type": "application/json",
|
|
25
|
+
},
|
|
26
|
+
body: JSON.stringify({ body }),
|
|
27
|
+
});
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
const errorBody = await response.text();
|
|
30
|
+
throw new Error(`[GitLabCommentService] Failed to post MR note: ${response.status} ${response.statusText} - ${errorBody}`);
|
|
31
|
+
}
|
|
32
|
+
return (await response.json());
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Post a reply to a discussion thread on a merge request.
|
|
36
|
+
*
|
|
37
|
+
* @see https://docs.gitlab.com/ee/api/discussions.html#add-note-to-existing-merge-request-thread
|
|
38
|
+
*/
|
|
39
|
+
async postDiscussionReply(params) {
|
|
40
|
+
const { token, projectId, mrIid, discussionId, body } = params;
|
|
41
|
+
const url = `${this.apiBaseUrl}/api/v4/projects/${projectId}/merge_requests/${mrIid}/discussions/${discussionId}/notes`;
|
|
42
|
+
const response = await fetch(url, {
|
|
43
|
+
method: "POST",
|
|
44
|
+
headers: {
|
|
45
|
+
"PRIVATE-TOKEN": token,
|
|
46
|
+
"Content-Type": "application/json",
|
|
47
|
+
},
|
|
48
|
+
body: JSON.stringify({ body }),
|
|
49
|
+
});
|
|
50
|
+
if (!response.ok) {
|
|
51
|
+
const errorBody = await response.text();
|
|
52
|
+
throw new Error(`[GitLabCommentService] Failed to post discussion reply: ${response.status} ${response.statusText} - ${errorBody}`);
|
|
53
|
+
}
|
|
54
|
+
return (await response.json());
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Add an award emoji (reaction) to a note on a merge request.
|
|
58
|
+
*
|
|
59
|
+
* @see https://docs.gitlab.com/ee/api/award_emoji.html#award-a-new-emoji-on-a-note
|
|
60
|
+
*/
|
|
61
|
+
async addAwardEmoji(params) {
|
|
62
|
+
const { token, projectId, mrIid, noteId, name } = params;
|
|
63
|
+
const url = `${this.apiBaseUrl}/api/v4/projects/${projectId}/merge_requests/${mrIid}/notes/${noteId}/award_emoji`;
|
|
64
|
+
const response = await fetch(url, {
|
|
65
|
+
method: "POST",
|
|
66
|
+
headers: {
|
|
67
|
+
"PRIVATE-TOKEN": token,
|
|
68
|
+
"Content-Type": "application/json",
|
|
69
|
+
},
|
|
70
|
+
body: JSON.stringify({ name }),
|
|
71
|
+
});
|
|
72
|
+
if (!response.ok) {
|
|
73
|
+
const errorBody = await response.text();
|
|
74
|
+
throw new Error(`[GitLabCommentService] Failed to add award emoji: ${response.status} ${response.statusText} - ${errorBody}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=GitLabCommentService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitLabComment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,UAAU,MAAM,SAAS,EAAE,CAC5G,CAAC;QACH,CAAC;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import type { TranslationContext } from "cyrus-core";
|
|
3
|
+
import { type ILogger } from "cyrus-core";
|
|
4
|
+
import type { GitLabEventTransportConfig, GitLabEventTransportEvents } from "./types.js";
|
|
5
|
+
export declare interface GitLabEventTransport {
|
|
6
|
+
on<K extends keyof GitLabEventTransportEvents>(event: K, listener: GitLabEventTransportEvents[K]): this;
|
|
7
|
+
emit<K extends keyof GitLabEventTransportEvents>(event: K, ...args: Parameters<GitLabEventTransportEvents[K]>): boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* GitLabEventTransport - Handles forwarded GitLab webhook event delivery
|
|
11
|
+
*
|
|
12
|
+
* This class provides a typed EventEmitter-based transport
|
|
13
|
+
* for handling GitLab webhooks forwarded from CYHOST.
|
|
14
|
+
*
|
|
15
|
+
* It registers a POST /gitlab-webhook endpoint with a Fastify server
|
|
16
|
+
* and verifies incoming webhooks using either:
|
|
17
|
+
* 1. "proxy" mode: Verifies Bearer token authentication (self-hosted)
|
|
18
|
+
* 2. "signature" mode: Verifies X-Gitlab-Token header (direct webhooks)
|
|
19
|
+
*
|
|
20
|
+
* Supported GitLab event types:
|
|
21
|
+
* - note: Comments/notes on merge requests
|
|
22
|
+
* - merge_request: MR state changes (approved, changes_requested, etc.)
|
|
23
|
+
*/
|
|
24
|
+
export declare class GitLabEventTransport extends EventEmitter {
|
|
25
|
+
private config;
|
|
26
|
+
private logger;
|
|
27
|
+
private messageTranslator;
|
|
28
|
+
private translationContext;
|
|
29
|
+
constructor(config: GitLabEventTransportConfig, logger?: ILogger, translationContext?: TranslationContext);
|
|
30
|
+
/**
|
|
31
|
+
* Set the translation context for message translation.
|
|
32
|
+
*/
|
|
33
|
+
setTranslationContext(context: TranslationContext): void;
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the effective verification mode and secret at request time.
|
|
36
|
+
* When started in proxy mode, checks if GITLAB_WEBHOOK_SECRET and
|
|
37
|
+
* CYRUS_HOST_EXTERNAL have been added to the environment since startup,
|
|
38
|
+
* enabling a runtime switch to signature verification.
|
|
39
|
+
*/
|
|
40
|
+
private resolveVerification;
|
|
41
|
+
/**
|
|
42
|
+
* Register the /gitlab-webhook endpoint with the Fastify server
|
|
43
|
+
*/
|
|
44
|
+
register(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Handle webhook using GitLab's X-Gitlab-Token secret verification.
|
|
47
|
+
* GitLab uses a simple token comparison (not HMAC).
|
|
48
|
+
*/
|
|
49
|
+
private handleSignatureWebhook;
|
|
50
|
+
/**
|
|
51
|
+
* Handle webhook using Bearer token authentication (forwarded from CYHOST)
|
|
52
|
+
*/
|
|
53
|
+
private handleProxyWebhook;
|
|
54
|
+
/**
|
|
55
|
+
* Process the webhook request and emit the appropriate event
|
|
56
|
+
*/
|
|
57
|
+
private processAndEmitEvent;
|
|
58
|
+
/**
|
|
59
|
+
* Translate and emit an internal message from a webhook event.
|
|
60
|
+
*/
|
|
61
|
+
private emitMessage;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=GitLabEventTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitLabEventTransport.d.ts","sourceRoot":"","sources":["../src/GitLabEventTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAGxD,OAAO,KAAK,EACX,0BAA0B,EAC1B,0BAA0B,EAM1B,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,OAAO,WAAW,oBAAoB;IAC5C,EAAE,CAAC,CAAC,SAAS,MAAM,0BAA0B,EAC5C,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,0BAA0B,CAAC,CAAC,CAAC,GACrC,IAAI,CAAC;IACR,IAAI,CAAC,CAAC,SAAS,MAAM,0BAA0B,EAC9C,KAAK,EAAE,CAAC,EACR,GAAG,IAAI,EAAE,UAAU,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,GAChD,OAAO,CAAC;CACX;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,oBAAqB,SAAQ,YAAY;IACrD,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,iBAAiB,CAA0B;IACnD,OAAO,CAAC,kBAAkB,CAAqB;gBAG9C,MAAM,EAAE,0BAA0B,EAClC,MAAM,CAAC,EAAE,OAAO,EAChB,kBAAkB,CAAC,EAAE,kBAAkB;IASxC;;OAEG;IACH,qBAAqB,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAIxD;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAuB3B;;OAEG;IACH,QAAQ,IAAI,IAAI;IA6BhB;;;OAGG;YACW,sBAAsB;IAmBpC;;OAEG;YACW,kBAAkB;IAoBhC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAmE3B;;OAEG;IACH,OAAO,CAAC,WAAW;CAYnB"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import { createLogger } from "cyrus-core";
|
|
3
|
+
import { GitLabMessageTranslator } from "./GitLabMessageTranslator.js";
|
|
4
|
+
/**
|
|
5
|
+
* GitLabEventTransport - Handles forwarded GitLab webhook event delivery
|
|
6
|
+
*
|
|
7
|
+
* This class provides a typed EventEmitter-based transport
|
|
8
|
+
* for handling GitLab webhooks forwarded from CYHOST.
|
|
9
|
+
*
|
|
10
|
+
* It registers a POST /gitlab-webhook endpoint with a Fastify server
|
|
11
|
+
* and verifies incoming webhooks using either:
|
|
12
|
+
* 1. "proxy" mode: Verifies Bearer token authentication (self-hosted)
|
|
13
|
+
* 2. "signature" mode: Verifies X-Gitlab-Token header (direct webhooks)
|
|
14
|
+
*
|
|
15
|
+
* Supported GitLab event types:
|
|
16
|
+
* - note: Comments/notes on merge requests
|
|
17
|
+
* - merge_request: MR state changes (approved, changes_requested, etc.)
|
|
18
|
+
*/
|
|
19
|
+
export class GitLabEventTransport extends EventEmitter {
|
|
20
|
+
config;
|
|
21
|
+
logger;
|
|
22
|
+
messageTranslator;
|
|
23
|
+
translationContext;
|
|
24
|
+
constructor(config, logger, translationContext) {
|
|
25
|
+
super();
|
|
26
|
+
this.config = config;
|
|
27
|
+
this.logger = logger ?? createLogger({ component: "GitLabEventTransport" });
|
|
28
|
+
this.messageTranslator = new GitLabMessageTranslator();
|
|
29
|
+
this.translationContext = translationContext ?? {};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Set the translation context for message translation.
|
|
33
|
+
*/
|
|
34
|
+
setTranslationContext(context) {
|
|
35
|
+
this.translationContext = { ...this.translationContext, ...context };
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Resolve the effective verification mode and secret at request time.
|
|
39
|
+
* When started in proxy mode, checks if GITLAB_WEBHOOK_SECRET and
|
|
40
|
+
* CYRUS_HOST_EXTERNAL have been added to the environment since startup,
|
|
41
|
+
* enabling a runtime switch to signature verification.
|
|
42
|
+
*/
|
|
43
|
+
resolveVerification() {
|
|
44
|
+
if (this.config.verificationMode === "signature") {
|
|
45
|
+
return { mode: "signature", secret: this.config.secret };
|
|
46
|
+
}
|
|
47
|
+
const isExternalHost = process.env.CYRUS_HOST_EXTERNAL?.toLowerCase().trim() === "true";
|
|
48
|
+
const gitlabSecret = process.env.GITLAB_WEBHOOK_SECRET;
|
|
49
|
+
const hasGitlabSecret = gitlabSecret != null && gitlabSecret !== "";
|
|
50
|
+
if (isExternalHost && hasGitlabSecret) {
|
|
51
|
+
this.logger.info("Runtime switch: GITLAB_WEBHOOK_SECRET detected, using GitLab token verification");
|
|
52
|
+
return { mode: "signature", secret: gitlabSecret };
|
|
53
|
+
}
|
|
54
|
+
return { mode: "proxy", secret: this.config.secret };
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Register the /gitlab-webhook endpoint with the Fastify server
|
|
58
|
+
*/
|
|
59
|
+
register() {
|
|
60
|
+
this.config.fastifyServer.post("/gitlab-webhook", async (request, reply) => {
|
|
61
|
+
try {
|
|
62
|
+
const { mode, secret } = this.resolveVerification();
|
|
63
|
+
if (mode === "signature") {
|
|
64
|
+
await this.handleSignatureWebhook(request, reply, secret);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
await this.handleProxyWebhook(request, reply, secret);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
const err = new Error("Webhook error");
|
|
72
|
+
if (error instanceof Error) {
|
|
73
|
+
err.cause = error;
|
|
74
|
+
}
|
|
75
|
+
this.logger.error("Webhook error", err);
|
|
76
|
+
this.emit("error", err);
|
|
77
|
+
reply.code(500).send({ error: "Internal server error" });
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
this.logger.info(`Registered POST /gitlab-webhook endpoint (${this.config.verificationMode} mode)`);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Handle webhook using GitLab's X-Gitlab-Token secret verification.
|
|
84
|
+
* GitLab uses a simple token comparison (not HMAC).
|
|
85
|
+
*/
|
|
86
|
+
async handleSignatureWebhook(request, reply, secret) {
|
|
87
|
+
const token = request.headers["x-gitlab-token"];
|
|
88
|
+
if (!token) {
|
|
89
|
+
reply.code(401).send({ error: "Missing X-Gitlab-Token header" });
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (token !== secret) {
|
|
93
|
+
reply.code(401).send({ error: "Invalid webhook token" });
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
this.processAndEmitEvent(request, reply);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Handle webhook using Bearer token authentication (forwarded from CYHOST)
|
|
100
|
+
*/
|
|
101
|
+
async handleProxyWebhook(request, reply, secret) {
|
|
102
|
+
const authHeader = request.headers.authorization;
|
|
103
|
+
if (!authHeader) {
|
|
104
|
+
reply.code(401).send({ error: "Missing Authorization header" });
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const expectedAuth = `Bearer ${secret}`;
|
|
108
|
+
if (authHeader !== expectedAuth) {
|
|
109
|
+
reply.code(401).send({ error: "Invalid authorization token" });
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
this.processAndEmitEvent(request, reply);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Process the webhook request and emit the appropriate event
|
|
116
|
+
*/
|
|
117
|
+
processAndEmitEvent(request, reply) {
|
|
118
|
+
const body = request.body;
|
|
119
|
+
const objectKind = body.object_kind;
|
|
120
|
+
const accessToken = request.headers["x-gitlab-access-token"];
|
|
121
|
+
if (!objectKind) {
|
|
122
|
+
reply.code(400).send({ error: "Missing object_kind in payload" });
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (objectKind !== "note" && objectKind !== "merge_request") {
|
|
126
|
+
this.logger.debug(`Ignoring unsupported event type: ${objectKind}`);
|
|
127
|
+
reply.code(200).send({ success: true, ignored: true });
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const payload = body;
|
|
131
|
+
// For note events, only handle notes on merge requests
|
|
132
|
+
if (objectKind === "note") {
|
|
133
|
+
const notePayload = payload;
|
|
134
|
+
if (notePayload.object_attributes.noteable_type !== "MergeRequest") {
|
|
135
|
+
this.logger.debug(`Ignoring note on ${notePayload.object_attributes.noteable_type}`);
|
|
136
|
+
reply.code(200).send({ success: true, ignored: true });
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// For merge_request events, only handle specific actions
|
|
141
|
+
if (objectKind === "merge_request") {
|
|
142
|
+
const mrPayload = payload;
|
|
143
|
+
const action = mrPayload.object_attributes.action;
|
|
144
|
+
if (action !== "approved" && action !== "unapproved") {
|
|
145
|
+
this.logger.debug(`Ignoring merge_request with action: ${action}`);
|
|
146
|
+
reply.code(200).send({ success: true, ignored: true });
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const webhookEvent = {
|
|
151
|
+
eventType: objectKind,
|
|
152
|
+
payload,
|
|
153
|
+
accessToken,
|
|
154
|
+
};
|
|
155
|
+
this.logger.info(`Received ${objectKind} webhook from ${payload.project.path_with_namespace}`);
|
|
156
|
+
// Emit "event" for legacy compatibility
|
|
157
|
+
this.emit("event", webhookEvent);
|
|
158
|
+
// Emit "message" with translated internal message
|
|
159
|
+
this.emitMessage(webhookEvent);
|
|
160
|
+
reply.code(200).send({ success: true });
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Translate and emit an internal message from a webhook event.
|
|
164
|
+
*/
|
|
165
|
+
emitMessage(event) {
|
|
166
|
+
const result = this.messageTranslator.translate(event, this.translationContext);
|
|
167
|
+
if (result.success) {
|
|
168
|
+
this.emit("message", result.message);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
this.logger.debug(`Message translation skipped: ${result.reason}`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=GitLabEventTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitLabEventTransport.js","sourceRoot":"","sources":["../src/GitLabEventTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAgB,MAAM,YAAY,CAAC;AAExD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAsBvE;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,oBAAqB,SAAQ,YAAY;IAC7C,MAAM,CAA6B;IACnC,MAAM,CAAU;IAChB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