@theholocron/github-client 1.58.0-alpha.67 → 1.58.0-alpha.68

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 +13 -1
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -161,9 +161,21 @@ function checks(rest) {
161
161
  };
162
162
  }
163
163
  // src/environments/environments.ts
164
+ const PAGE_SIZE$1 = 100;
165
+ /** A stop for a response that never ends; 100 pages is 10,000 environments, far past GitHub's limit. */
166
+ const MAX_PAGES$3 = 100;
164
167
  function environments(rest) {
165
168
  return {
166
- listEnvironments: (repo) => rest.request(`${repoBase(repo)}/environments`).then((r) => r.environments),
169
+ /** Every environment, all pages: GitHub lists 30 by default and at most 100 a page. */
170
+ listEnvironments: async (repo) => {
171
+ const all = [];
172
+ for (let page = 1; page <= MAX_PAGES$3; page += 1) {
173
+ const r = await rest.request(`${repoBase(repo)}/environments?per_page=${PAGE_SIZE$1}&page=${page}`);
174
+ all.push(...r.environments);
175
+ if (r.environments.length < PAGE_SIZE$1 || all.length >= r.total_count) break;
176
+ }
177
+ return all;
178
+ },
167
179
  upsertEnvironment: (repo, name, body) => rest.request(`${repoBase(repo)}/environments/${encodeURIComponent(name)}`, {
168
180
  method: "PUT",
169
181
  body
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/github-client",
3
- "version": "1.58.0-alpha.67",
3
+ "version": "1.58.0-alpha.68",
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.67",
35
+ "@theholocron/http-client": "^1.58.0-alpha.68",
36
36
  "@theholocron/observability": "^0.7.0-alpha.9"
37
37
  },
38
38
  "devDependencies": {