@agentconnect.md/setup 1.41.0-rc.140 → 1.41.0-rc.142

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.js CHANGED
@@ -59411,8 +59411,21 @@ async function mintAppJwt(cfg) {
59411
59411
  }
59412
59412
  return (await auth({ type: "app" })).token;
59413
59413
  }
59414
+ /** `rel="next"` from a Link header, relative to `baseUrl`. */
59415
+ function nextPathFrom(link, baseUrl) {
59416
+ if (!link) return void 0;
59417
+ for (const part of link.split(",")) {
59418
+ const url = /<([^>]+)>\s*;\s*rel="next"/.exec(part.trim())?.[1];
59419
+ if (url?.startsWith(baseUrl)) return url.slice(baseUrl.length);
59420
+ }
59421
+ }
59414
59422
  /** One GitHub REST call → parsed JSON. Throws `GithubApiError` on any non-2xx. */
59415
59423
  async function githubRequest(path, opts) {
59424
+ return (await githubRequestPage(path, opts)).data;
59425
+ }
59426
+ /** {@link githubRequest} keeping the pagination cursor — for the list endpoints
59427
+ * whose first page is not the whole answer. */
59428
+ async function githubRequestPage(path, opts) {
59416
59429
  const fetchImpl = opts.fetchImpl ?? fetch;
59417
59430
  let res;
59418
59431
  try {
@@ -59432,9 +59445,13 @@ async function githubRequest(path, opts) {
59432
59445
  }
59433
59446
  if (res.ok) {
59434
59447
  const text = await res.text();
59435
- if (!text) return void 0;
59448
+ const nextPath = nextPathFrom(res.headers.get("link"), opts.baseUrl ?? API_BASE);
59449
+ if (!text) return { data: void 0 };
59436
59450
  const safe = opts.bigIdsAsStrings ? text.replace(/"id"\s*:\s*(\d{15,})/g, "\"id\":\"$1\"") : text;
59437
- return JSON.parse(safe);
59451
+ return {
59452
+ data: JSON.parse(safe),
59453
+ ...nextPath ? { nextPath } : {}
59454
+ };
59438
59455
  }
59439
59456
  let detail = "";
59440
59457
  try {