MCPcopy Index your code
hub / github.com/simstudioai/sim / mapOauthRow

Function mapOauthRow

apps/sim/lib/mcp/oauth/storage.ts:110–134  ·  view source on GitHub ↗
(row: RawOauthRow)

Source from the content-addressed store, hash-verified

108type RawOauthRow = typeof mcpServerOauth.$inferSelect
109
110async 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
136export async function loadOauthRow(params: { mcpServerId: string }): Promise<McpOauthRow | null> {
137 const [row] = await db

Callers 2

loadOauthRowFunction · 0.85
loadOauthRowByStateFunction · 0.85

Calls 2

safeDecryptFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected