(params: JiraUpdateWorklogParams)
| 10 | import type { ToolConfig } from '@/tools/types' |
| 11 | |
| 12 | function buildWorklogBody(params: JiraUpdateWorklogParams) { |
| 13 | let timeSpentSeconds: number | undefined |
| 14 | if ( |
| 15 | params.timeSpentSeconds !== undefined && |
| 16 | params.timeSpentSeconds !== null && |
| 17 | String(params.timeSpentSeconds).trim() !== '' |
| 18 | ) { |
| 19 | const n = Number(params.timeSpentSeconds) |
| 20 | if (!Number.isFinite(n) || n <= 0) { |
| 21 | throw new Error('timeSpentSeconds must be a positive finite number') |
| 22 | } |
| 23 | timeSpentSeconds = n |
| 24 | } |
| 25 | const body: Record<string, any> = { |
| 26 | timeSpentSeconds, |
| 27 | comment: params.comment ? toAdf(params.comment) : undefined, |
| 28 | started: params.started ? normalizeJiraWorklogTimestamp(params.started) : undefined, |
| 29 | } |
| 30 | if (params.visibility) body.visibility = params.visibility |
| 31 | return body |
| 32 | } |
| 33 | |
| 34 | function transformWorklogResponse(data: any, params: JiraUpdateWorklogParams) { |
| 35 | return { |
no test coverage detected