* Transforms a raw Jira search result issue into typed output.
(issue: any)
| 7 | * Transforms a raw Jira search result issue into typed output. |
| 8 | */ |
| 9 | function transformSearchIssue(issue: any) { |
| 10 | const fields = issue?.fields ?? {} |
| 11 | return { |
| 12 | id: issue.id ?? '', |
| 13 | key: issue.key ?? '', |
| 14 | self: issue.self ?? '', |
| 15 | summary: fields.summary ?? '', |
| 16 | description: extractAdfText(fields.description), |
| 17 | status: { |
| 18 | id: fields.status?.id ?? '', |
| 19 | name: fields.status?.name ?? '', |
| 20 | description: fields.status?.description ?? null, |
| 21 | statusCategory: fields.status?.statusCategory |
| 22 | ? { |
| 23 | id: fields.status.statusCategory.id, |
| 24 | key: fields.status.statusCategory.key ?? '', |
| 25 | name: fields.status.statusCategory.name ?? '', |
| 26 | colorName: fields.status.statusCategory.colorName ?? '', |
| 27 | } |
| 28 | : null, |
| 29 | }, |
| 30 | issuetype: { |
| 31 | id: fields.issuetype?.id ?? '', |
| 32 | name: fields.issuetype?.name ?? '', |
| 33 | description: fields.issuetype?.description ?? null, |
| 34 | subtask: fields.issuetype?.subtask ?? false, |
| 35 | iconUrl: fields.issuetype?.iconUrl ?? null, |
| 36 | }, |
| 37 | project: { |
| 38 | id: fields.project?.id ?? '', |
| 39 | key: fields.project?.key ?? '', |
| 40 | name: fields.project?.name ?? '', |
| 41 | projectTypeKey: fields.project?.projectTypeKey ?? null, |
| 42 | }, |
| 43 | priority: fields.priority |
| 44 | ? { |
| 45 | id: fields.priority.id ?? '', |
| 46 | name: fields.priority.name ?? '', |
| 47 | iconUrl: fields.priority.iconUrl ?? null, |
| 48 | } |
| 49 | : null, |
| 50 | statusName: fields.status?.name ?? '', |
| 51 | assignee: transformUser(fields.assignee), |
| 52 | assigneeName: fields.assignee?.displayName ?? fields.assignee?.accountId ?? null, |
| 53 | reporter: transformUser(fields.reporter), |
| 54 | labels: fields.labels ?? [], |
| 55 | components: (fields.components ?? []).map((c: any) => ({ |
| 56 | id: c.id ?? '', |
| 57 | name: c.name ?? '', |
| 58 | description: c.description ?? null, |
| 59 | })), |
| 60 | resolution: fields.resolution |
| 61 | ? { |
| 62 | id: fields.resolution.id ?? '', |
| 63 | name: fields.resolution.name ?? '', |
| 64 | description: fields.resolution.description ?? null, |
| 65 | } |
| 66 | : null, |
nothing calls this directly
no test coverage detected