(row: RawOauthRow)
| 108 | type RawOauthRow = typeof mcpServerOauth.$inferSelect |
| 109 | |
| 110 | async function mapOauthRow(row: RawOauthRow): Promise<McpOauthRow> { |
| 111 | return { |
| 112 | id: row.id, |
| 113 | mcpServerId: row.mcpServerId, |
| 114 | userId: row.userId, |
| 115 | workspaceId: row.workspaceId, |
| 116 | clientInformation: row.clientInformation |
| 117 | ? await safeDecrypt( |
| 118 | row.id, |
| 119 | 'clientInformation', |
| 120 | row.clientInformation, |
| 121 | (d) => JSON.parse(d) as OAuthClientInformationMixed |
| 122 | ) |
| 123 | : null, |
| 124 | tokens: row.tokens |
| 125 | ? await safeDecrypt(row.id, 'tokens', row.tokens, (d) => JSON.parse(d) as OAuthTokens) |
| 126 | : null, |
| 127 | codeVerifier: row.codeVerifier |
| 128 | ? await safeDecrypt(row.id, 'codeVerifier', row.codeVerifier, (d) => d) |
| 129 | : null, |
| 130 | state: row.state, |
| 131 | stateCreatedAt: row.stateCreatedAt, |
| 132 | updatedAt: row.updatedAt, |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | export async function loadOauthRow(params: { mcpServerId: string }): Promise<McpOauthRow | null> { |
| 137 | const [row] = await db |
no test coverage detected