MCPcopy Create free account
hub / github.com/nodejs/nodejs.org / sponsorsData

Function sponsorsData

apps/site/next-data/generators/supportersData.mjs:221–242  ·  view source on GitHub ↗

* Fetches supporters data from Open Collective API and GitHub Sponsors, filters active backers, * and maps it to the Supporters type. * * @returns {Promise >} Array of supporte

()

Source from the content-addressed store, hash-verified

219 * @returns {Promise<Array<import('#site/types/supporters').OpenCollectiveSupporter | import('#site/types/supporters').GitHubSponsorSupporter>>} Array of supporters
220 */
221async function sponsorsData() {
222 const seconds = 300; // Change every 5 minutes
223 const seed = Math.floor(Date.now() / (seconds * 1000));
224
225 const sponsorsResults = await Promise.allSettled([
226 fetchGithubSponsorsData(),
227 fetchOpenCollectiveData(),
228 ]);
229
230 const sponsors = sponsorsResults.flatMap(result => {
231 if (result.status === 'fulfilled') {
232 return result.value;
233 }
234
235 console.error('Supporters data source failed:', result.reason);
236 return [];
237 });
238
239 const shuffled = await shuffle(sponsors, seed);
240
241 return shuffled;
242}
243
244export default sponsorsData;

Callers

nothing calls this directly

Calls 3

shuffleFunction · 0.90
fetchGithubSponsorsDataFunction · 0.85
fetchOpenCollectiveDataFunction · 0.85

Tested by

no test coverage detected