@theholocron/github-client 1.58.0-alpha.25 → 1.58.0-alpha.26
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/dist/index.mjs +14 -5
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -424,6 +424,9 @@ const RESOLVE_REVIEW_THREAD_MUTATION = `
|
|
|
424
424
|
/** Page size and the most pages {@link pulls}`.listPullRequests` reads: 100 a page (GitHub's maximum) over 100 pages, so 10,000 pull requests. */
|
|
425
425
|
const PULL_REQUEST_PAGE_SIZE = 100;
|
|
426
426
|
const PULL_REQUEST_MAX_PAGES = 100;
|
|
427
|
+
/** Page size and the most pages {@link pulls}`.listFiles` reads: 100 a page over 30 pages, the 3000 files GitHub serves. */
|
|
428
|
+
const FILE_PAGE_SIZE = 100;
|
|
429
|
+
const FILE_MAX_PAGES = 30;
|
|
427
430
|
function pulls(rest, graphql) {
|
|
428
431
|
return {
|
|
429
432
|
getPullRequest: (repo, number) => rest.request(`${repoBase(repo)}/pulls/${number}`),
|
|
@@ -448,12 +451,18 @@ function pulls(rest, graphql) {
|
|
|
448
451
|
*/
|
|
449
452
|
listCommits: (repo, number) => rest.request(`${repoBase(repo)}/pulls/${number}/commits?per_page=100`),
|
|
450
453
|
/**
|
|
451
|
-
* A PR's own changed files
|
|
452
|
-
*
|
|
453
|
-
* files (GitHub caps this endpoint at 3000 regardless of pagination)
|
|
454
|
-
* is an edge case no consumer here needs to paginate for today.
|
|
454
|
+
* A PR's own changed files, read a page at a time until a page comes back short. GitHub serves at most
|
|
455
|
+
* 3000 files from this endpoint, so a larger PR is cut at that cap.
|
|
455
456
|
*/
|
|
456
|
-
listFiles: (repo, number) =>
|
|
457
|
+
listFiles: async (repo, number) => {
|
|
458
|
+
const all = [];
|
|
459
|
+
for (let page = 1; page <= FILE_MAX_PAGES; page++) {
|
|
460
|
+
const batch = await rest.request(`${repoBase(repo)}/pulls/${number}/files?per_page=${FILE_PAGE_SIZE}&page=${page}`);
|
|
461
|
+
all.push(...batch);
|
|
462
|
+
if (batch.length < FILE_PAGE_SIZE) break;
|
|
463
|
+
}
|
|
464
|
+
return all;
|
|
465
|
+
},
|
|
457
466
|
/** A PR's reviews, oldest first. `per_page=100` covers every real PR in this org. */
|
|
458
467
|
listReviews: (repo, number) => rest.request(`${repoBase(repo)}/pulls/${number}/reviews?per_page=100`),
|
|
459
468
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/github-client",
|
|
3
|
-
"version": "1.58.0-alpha.
|
|
3
|
+
"version": "1.58.0-alpha.26",
|
|
4
4
|
"description": "A TypeScript client for the GitHub REST API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@theholocron/http-client": "^1.58.0-alpha.
|
|
35
|
+
"@theholocron/http-client": "^1.58.0-alpha.26",
|
|
36
36
|
"@theholocron/observability": "^0.7.0-alpha.3"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|