@theholocron/github-client 1.58.0-alpha.24 → 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.
Files changed (2) hide show
  1. package/dist/index.mjs +14 -5
  2. package/package.json +6 -6
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. `per_page=100` — GitHub's max — covers
452
- * every real PR in this org; a PR genuinely exceeding 100 changed
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) => rest.request(`${repoBase(repo)}/pulls/${number}/files?per_page=100`),
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.24",
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.24",
35
+ "@theholocron/http-client": "^1.58.0-alpha.26",
36
36
  "@theholocron/observability": "^0.7.0-alpha.3"
37
37
  },
38
38
  "devDependencies": {
@@ -45,10 +45,10 @@
45
45
  "tsdown": "^0.23.5",
46
46
  "typescript": "^5.9.3",
47
47
  "vitest": "^5.1.0",
48
- "@theholocron/eslint-config": "^8.9.0-alpha.13",
49
- "@theholocron/tsconfig": "^8.9.0-alpha.13",
50
- "@theholocron/tsdown-config": "^8.9.0-alpha.13",
51
- "@theholocron/vitest-config": "^8.9.0-alpha.13"
48
+ "@theholocron/eslint-config": "^8.9.0-alpha.15",
49
+ "@theholocron/tsconfig": "^8.9.0-alpha.15",
50
+ "@theholocron/vitest-config": "^8.9.0-alpha.15",
51
+ "@theholocron/tsdown-config": "^8.9.0-alpha.15"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22.0.0"