|
1 | 1 | import type { JiraSearchUsersParams, JiraSearchUsersResponse } from '@/tools/jira/types' |
2 | 2 | import { TIMESTAMP_OUTPUT, USER_OUTPUT_PROPERTIES } from '@/tools/jira/types' |
3 | | -import { getJiraCloudId } from '@/tools/jira/utils' |
| 3 | +import { getJiraCloudId, transformUser } from '@/tools/jira/utils' |
4 | 4 | import type { ToolConfig } from '@/tools/types' |
5 | 5 |
|
6 | | -/** |
7 | | - * Transforms a raw Jira user API object into typed output. |
8 | | - */ |
9 | | -function transformUserOutput(user: any) { |
10 | | - return { |
11 | | - accountId: user.accountId ?? '', |
12 | | - accountType: user.accountType ?? null, |
13 | | - active: user.active ?? false, |
14 | | - displayName: user.displayName ?? '', |
15 | | - emailAddress: user.emailAddress ?? null, |
16 | | - avatarUrl: user.avatarUrls?.['48x48'] ?? null, |
17 | | - timeZone: user.timeZone ?? null, |
18 | | - self: user.self ?? null, |
19 | | - } |
20 | | -} |
21 | | - |
22 | 6 | export const jiraSearchUsersTool: ToolConfig<JiraSearchUsersParams, JiraSearchUsersResponse> = { |
23 | 7 | id: 'jira_search_users', |
24 | 8 | name: 'Jira Search Users', |
@@ -144,7 +128,10 @@ export const jiraSearchUsersTool: ToolConfig<JiraSearchUsersParams, JiraSearchUs |
144 | 128 | success: true, |
145 | 129 | output: { |
146 | 130 | ts: new Date().toISOString(), |
147 | | - users: users.map(transformUserOutput), |
| 131 | + users: users.map((user: any) => ({ |
| 132 | + ...transformUser(user), |
| 133 | + self: user.self ?? null, |
| 134 | + })), |
148 | 135 | total: users.length, |
149 | 136 | }, |
150 | 137 | } |
|
0 commit comments