From 501bf1609b5a7da6831e78359b8eb340932f9675 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Tue, 25 Mar 2025 15:45:53 -0500 Subject: [PATCH] Make limit "configurable" in welcome script --- scripts/welcome.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/welcome.js b/scripts/welcome.js index ff501a4c..0e7aed49 100755 --- a/scripts/welcome.js +++ b/scripts/welcome.js @@ -25,6 +25,8 @@ if (!SN_API_KEY) { process.exit(1) } +const LIMIT = 21 + async function gql (query, variables = {}) { const response = await fetch(`${SN_API_URL}/api/graphql`, { method: 'POST', @@ -73,8 +75,8 @@ function fetchRecentBios () { // fetch all recent bios. we assume here there won't be more than 21 // since the last bio we already included in a post as defined by FETCH_AFTER. return gql( - `query NewBios { - items(sort: "recent", type: "bios", limit: 21) { + `query NewBios($limit: Limit!) { + items(sort: "recent", type: "bios", limit: $limit) { items { id title @@ -89,7 +91,7 @@ function fetchRecentBios () { } } } - }` + }`, { limit: LIMIT } ) }