-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
280 lines (273 loc) · 5.53 KB
/
types.ts
File metadata and controls
280 lines (273 loc) · 5.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
/**
* @file Public type surface for `github/*` modules — pure interfaces. No I/O or
* runtime side effects so this module stays cheap to import everywhere.
* Constants live in `./constants`, named errors in `./errors`.
*/
/**
* Options for GitHub API fetch requests.
*/
export interface GitHubFetchOptions {
/**
* GitHub authentication token. If not provided, will attempt to use token
* from environment variables.
*/
token?: string | undefined
/**
* Additional HTTP headers to include in the request. Will be merged with
* default headers (Accept, User-Agent, Authorization).
*/
headers?: Record<string, string> | undefined
}
/**
* Error thrown when GitHub API rate limit is exceeded. Extends the standard
* Error with additional rate limit information.
*/
export interface GitHubRateLimitError extends Error {
/**
* HTTP status code (always 403 for rate limit errors)
*/
status: number
/**
* Date when the rate limit will reset. Undefined if reset time is not
* available in response headers.
*/
resetTime?: Date | undefined
}
/**
* GitHub ref object returned by the API. Represents a git reference (tag or
* branch).
*/
export interface GitHubRef {
/**
* The object this ref points to.
*/
object: {
/**
* SHA of the commit or tag object.
*/
sha: string
/**
* Type of object ('commit' or 'tag')
*/
type: string
/**
* API URL to fetch the full object details.
*/
url: string
}
/**
* Full ref path (e.g., 'refs/tags/v1.0.0' or 'refs/heads/main')
*/
ref: string
/**
* API URL for this ref.
*/
url: string
}
/**
* GitHub annotated tag object returned by the API. Represents a git tag with
* metadata.
*/
export interface GitHubTag {
/**
* Tag annotation message.
*/
message: string
/**
* The commit this tag points to.
*/
object: {
/**
* SHA of the commit.
*/
sha: string
/**
* Type of object (usually 'commit')
*/
type: string
/**
* API URL to fetch the commit details.
*/
url: string
}
/**
* SHA of this tag object itself.
*/
sha: string
/**
* Tag name (e.g., 'v1.0.0')
*/
tag: string
/**
* Information about who created the tag. Undefined for lightweight tags.
*/
tagger?: {
/**
* Tag creation date in ISO 8601 format.
*/
date: string
/**
* Tagger's email address.
*/
email: string
/**
* Tagger's name.
*/
name: string
}
/**
* API URL for this tag object.
*/
url: string
}
/**
* GitHub commit object returned by the API. Represents a git commit with
* metadata.
*/
export interface GitHubCommit {
/**
* Full commit SHA.
*/
sha: string
/**
* API URL for this commit.
*/
url: string
/**
* Commit details.
*/
commit: {
/**
* Commit message.
*/
message: string
/**
* Author information.
*/
author: {
/**
* Commit author date in ISO 8601 format.
*/
date: string
/**
* Author's email address.
*/
email: string
/**
* Author's name.
*/
name: string
}
}
}
/**
* Options for resolving git refs to commit SHAs.
*/
export interface ResolveRefOptions {
/**
* GitHub authentication token. If not provided, will attempt to use token
* from environment variables.
*/
token?: string | undefined
}
/**
* GitHub Security Advisory (GHSA) details. Represents a complete security
* advisory from GitHub's database.
*/
export interface GhsaDetails {
/**
* GHSA identifier (e.g., 'GHSA-xxxx-yyyy-zzzz')
*/
ghsaId: string
/**
* Short summary of the vulnerability.
*/
summary: string
/**
* Detailed description of the vulnerability.
*/
details: string
/**
* Severity level ('low', 'moderate', 'high', 'critical')
*/
severity: string
/**
* Alternative identifiers (CVE IDs, etc.)
*/
aliases: string[]
/**
* ISO 8601 timestamp when advisory was published.
*/
publishedAt: string
/**
* ISO 8601 timestamp when advisory was last updated.
*/
updatedAt: string
/**
* ISO 8601 timestamp when advisory was withdrawn. `null` if advisory is still
* active.
*/
withdrawnAt: string | null
/**
* External reference URLs for more information.
*/
references: Array<{ url: string }>
/**
* Affected packages and version ranges.
*/
vulnerabilities: Array<{
/**
* Package information.
*/
package: {
/**
* Ecosystem (e.g., 'npm', 'pip', 'maven')
*/
ecosystem: string
/**
* Package name.
*/
name: string
}
/**
* Version range expression for vulnerable versions.
*/
vulnerableVersionRange: string
/**
* First patched version that fixes the vulnerability. `null` if no patched
* version exists yet.
*/
firstPatchedVersion: { identifier: string } | null
}>
/**
* CVSS (Common Vulnerability Scoring System) information. `null` if CVSS
* score is not available.
*/
cvss: {
/**
* CVSS score (0.0-10.0)
*/
score: number
/**
* CVSS vector string describing the vulnerability characteristics.
*/
vectorString: string
} | null
/**
* CWE (Common Weakness Enumeration) categories.
*/
cwes: Array<{
/**
* CWE identifier (e.g., 'CWE-79')
*/
cweId: string
/**
* Human-readable CWE name.
*/
name: string
/**
* Description of the weakness category.
*/
description: string
}>
}