|
| 1 | +import { fetchApi } from '../../utils/fetchApi.js'; |
| 2 | + |
| 3 | +export async function runCveReportingList({ repo, status, reportId } = {}) { |
| 4 | + return fetchApi('/extension/analysis/cve-reporting/list', 'POST', { repo, status, report_id: reportId }); |
| 5 | +} |
| 6 | + |
| 7 | +export async function runCveReportingCreate({ name, repo, scheduleConfig, reportConfig, description, notificationConfig, createdBy } = {}) { |
| 8 | + if (!name) { |
| 9 | + const err = new Error('--name is required'); |
| 10 | + err.exitCode = 1; |
| 11 | + throw err; |
| 12 | + } |
| 13 | + return fetchApi('/extension/analysis/cve-reporting/create', 'POST', { |
| 14 | + name, |
| 15 | + repo, |
| 16 | + schedule_config: scheduleConfig ? JSON.parse(scheduleConfig) : undefined, |
| 17 | + report_config: reportConfig ? JSON.parse(reportConfig) : undefined, |
| 18 | + description, |
| 19 | + notification_config: notificationConfig ? JSON.parse(notificationConfig) : undefined, |
| 20 | + created_by: createdBy, |
| 21 | + }); |
| 22 | +} |
| 23 | + |
| 24 | +export async function runCveReportingUpdate({ reportId, repo, status, name, description, scheduleConfig, reportConfig, notificationConfig } = {}) { |
| 25 | + if (!reportId) { |
| 26 | + const err = new Error('--report-id is required'); |
| 27 | + err.exitCode = 1; |
| 28 | + throw err; |
| 29 | + } |
| 30 | + return fetchApi('/extension/analysis/cve-reporting/update', 'POST', { |
| 31 | + report_id: reportId, |
| 32 | + repo, |
| 33 | + status, |
| 34 | + name, |
| 35 | + description, |
| 36 | + schedule_config: scheduleConfig ? JSON.parse(scheduleConfig) : undefined, |
| 37 | + report_config: reportConfig ? JSON.parse(reportConfig) : undefined, |
| 38 | + notification_config: notificationConfig ? JSON.parse(notificationConfig) : undefined, |
| 39 | + }); |
| 40 | +} |
0 commit comments