MCPcopy Index your code
hub / github.com/simstudioai/sim / fetchSupplementary

Function fetchSupplementary

apps/sim/tools/jira/retrieve.ts:275–317  ·  view source on GitHub ↗
(cloudId: string, data: any)

Source from the content-addressed store, hash-verified

273 }
274
275 const fetchSupplementary = async (cloudId: string, data: any) => {
276 const base = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${params.issueKey?.trim() ?? ''}`
277 const [commentsResp, worklogResp, watchersResp] = await Promise.all([
278 fetch(`${base}/comment?maxResults=100&orderBy=-created`, {
279 headers: { Accept: 'application/json', Authorization: `Bearer ${params.accessToken}` },
280 }),
281 fetch(`${base}/worklog?maxResults=100`, {
282 headers: { Accept: 'application/json', Authorization: `Bearer ${params.accessToken}` },
283 }),
284 fetch(`${base}/watchers`, {
285 headers: { Accept: 'application/json', Authorization: `Bearer ${params.accessToken}` },
286 }),
287 ])
288
289 try {
290 if (commentsResp.ok) {
291 const commentsData = await commentsResp.json()
292 if (data?.fields) data.fields.comment = commentsData?.comments || data.fields.comment
293 }
294 } catch {
295 logger.debug?.('Failed to fetch comments')
296 }
297
298 try {
299 if (worklogResp.ok) {
300 const worklogData = await worklogResp.json()
301 if (data?.fields) data.fields.worklog = worklogData || data.fields.worklog
302 }
303 } catch {
304 logger.debug?.('Failed to fetch worklog')
305 }
306
307 try {
308 if (watchersResp.ok) {
309 const watchersData = await watchersResp.json()
310 if (data?.fields) {
311 data.fields.watches = watchersData
312 }
313 }
314 } catch {
315 logger.debug?.('Failed to fetch watchers')
316 }
317 }
318
319 let data: any
320

Callers 1

retrieve.tsFile · 0.85

Calls 1

debugMethod · 0.80

Tested by

no test coverage detected