(report: ReportFragment)
| 28 | import { lowercase } from '@code-pushup/utils'; |
| 29 | |
| 30 | export function transformGQLReport(report: ReportFragment): Report { |
| 31 | return { |
| 32 | commit: transformGQLCommit(report.commit), |
| 33 | plugins: report.plugins.map(plugin => |
| 34 | transformGQLPlugin( |
| 35 | plugin, |
| 36 | report.issues?.edges.map(({ node }) => node) ?? [], |
| 37 | ), |
| 38 | ), |
| 39 | categories: report.categories.map(transformGQLCategory), |
| 40 | // TODO: make report metadata required in Portal API? |
| 41 | packageName: report.packageName ?? 'unknown', |
| 42 | version: report.packageVersion ?? 'unknown', |
| 43 | date: report.commandStartDate ?? '', |
| 44 | duration: report.commandDuration ?? 0, |
| 45 | }; |
| 46 | } |
| 47 | |
| 48 | function transformGQLCommit(commit: CommitFragment): Commit { |
| 49 | return { |
no test coverage detected