()
| 171 | } |
| 172 | |
| 173 | async function fetchDonationsQuery() { |
| 174 | const data = await graphql(DONATIONS_QUERY); |
| 175 | |
| 176 | if (data.errors) { |
| 177 | throw new Error(JSON.stringify(data.errors)); |
| 178 | } |
| 179 | |
| 180 | const nodeRes = data.data.organization?.sponsorsActivities; |
| 181 | if (!nodeRes) { |
| 182 | return []; |
| 183 | } |
| 184 | |
| 185 | const { nodes } = nodeRes; |
| 186 | return nodes.map(n => { |
| 187 | const s = n.sponsor || n.sponsorEntity; // support different field names |
| 188 | return { |
| 189 | name: s?.name || s?.login || null, |
| 190 | image: s?.avatarUrl || null, |
| 191 | url: s?.url || null, |
| 192 | source: 'github', |
| 193 | }; |
| 194 | }); |
| 195 | } |
| 196 | |
| 197 | const graphql = async (query, variables = {}) => { |
| 198 | const res = await fetchWithRetry(GITHUB_GRAPHQL_URL, { |
no test coverage detected