@rmdes/indiekit-endpoint-github 1.2.0 → 1.2.2

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.
@@ -39,9 +39,10 @@ const STARRED_QUERY = `
39
39
  const LISTS_QUERY = `
40
40
  query($cursor: String) {
41
41
  viewer {
42
- lists(first: 100, after: $cursor) {
42
+ lists(first: 5, after: $cursor) {
43
43
  totalCount
44
44
  nodes {
45
+ id
45
46
  name
46
47
  slug
47
48
  description
@@ -63,9 +64,9 @@ const LISTS_QUERY = `
63
64
  `;
64
65
 
65
66
  const LIST_ITEMS_QUERY = `
66
- query($slug: String!, $cursor: String) {
67
- viewer {
68
- list(slug: $slug) {
67
+ query($id: ID!, $cursor: String) {
68
+ node(id: $id) {
69
+ ... on UserList {
69
70
  items(first: 100, after: $cursor) {
70
71
  nodes {
71
72
  ... on Repository {
@@ -187,7 +188,8 @@ export async function fetchAllLists(token) {
187
188
  let cursor = null;
188
189
  let hasNextPage = true;
189
190
 
190
- // Fetch all lists (outer pagination)
191
+ // Fetch lists in batches of 5 with inline items (first 100 per list)
192
+ // Small batches avoid GitHub GraphQL timeout on large accounts
191
193
  while (hasNextPage) {
192
194
  const response = await fetch(GITHUB_GRAPHQL_URL, {
193
195
  method: "POST",
@@ -214,21 +216,13 @@ export async function fetchAllLists(token) {
214
216
  const listsData = body.data.viewer.lists;
215
217
 
216
218
  for (const node of listsData.nodes) {
217
- // Skip private lists
218
219
  if (node.isPrivate) continue;
219
220
 
220
221
  const repoFullNames = (node.items.nodes || [])
221
222
  .map((n) => n.nameWithOwner)
222
223
  .filter(Boolean);
223
224
 
224
- const list = {
225
- name: node.name,
226
- slug: node.slug,
227
- description: node.description || "",
228
- repoFullNames,
229
- };
230
-
231
- // If this list has more items than the first page, paginate them
225
+ // Paginate remaining items via node(id:) if list has >100 repos
232
226
  if (node.items.pageInfo.hasNextPage) {
233
227
  let itemsCursor = node.items.pageInfo.endCursor;
234
228
  let itemsHasNext = true;
@@ -244,7 +238,7 @@ export async function fetchAllLists(token) {
244
238
  },
245
239
  body: JSON.stringify({
246
240
  query: LIST_ITEMS_QUERY,
247
- variables: { slug: node.slug, cursor: itemsCursor },
241
+ variables: { id: node.id, cursor: itemsCursor },
248
242
  }),
249
243
  });
250
244
 
@@ -260,10 +254,10 @@ export async function fetchAllLists(token) {
260
254
  break;
261
255
  }
262
256
 
263
- const itemsData = itemsBody.data.viewer.list.items;
257
+ const itemsData = itemsBody.data.node.items;
264
258
  for (const itemNode of itemsData.nodes) {
265
259
  if (itemNode.nameWithOwner) {
266
- list.repoFullNames.push(itemNode.nameWithOwner);
260
+ repoFullNames.push(itemNode.nameWithOwner);
267
261
  }
268
262
  }
269
263
 
@@ -272,7 +266,12 @@ export async function fetchAllLists(token) {
272
266
  }
273
267
  }
274
268
 
275
- allLists.push(list);
269
+ allLists.push({
270
+ name: node.name,
271
+ slug: node.slug,
272
+ description: node.description || "",
273
+ repoFullNames,
274
+ });
276
275
  }
277
276
 
278
277
  cursor = listsData.pageInfo.endCursor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-github",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "GitHub activity endpoint for Indiekit. Display commits, stars, contributions, and featured repositories.",
5
5
  "keywords": [
6
6
  "indiekit",