* Extracts a plain-text value for a given request field id (e.g. `summary`, * `description`) from a request's `requestFieldValues`. The JSM API returns * `value` either as a plain string (wiki markup) or, for some rich-text fields, * as an ADF document — both are handled.
(request: JsmRequest, fieldId: string)
| 148 | * as an ADF document — both are handled. |
| 149 | */ |
| 150 | function getFieldText(request: JsmRequest, fieldId: string): string { |
| 151 | const field = request.requestFieldValues?.find((f) => f.fieldId === fieldId) |
| 152 | if (!field) return '' |
| 153 | const { value } = field |
| 154 | if (typeof value === 'string') return value |
| 155 | if (value && typeof value === 'object') { |
| 156 | const adf = extractAdfText(value) |
| 157 | if (adf) return adf |
| 158 | } |
| 159 | return '' |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * Resolves the best available "change indicator" timestamp for a request. |
no test coverage detected