MCPcopy Create free account
hub / github.com/simstudioai/sim / formatCredentialResponse

Function formatCredentialResponse

apps/sim/app/api/credentials/[id]/route.ts:12–32  ·  view source on GitHub ↗
(access: CredentialActorContext)

Source from the content-addressed store, hash-verified

10const logger = createLogger('CredentialByIdAPI')
11
12function formatCredentialResponse(access: CredentialActorContext) {
13 const cred = access.credential
14 if (!cred) return null
15
16 return {
17 id: cred.id,
18 workspaceId: cred.workspaceId,
19 type: cred.type,
20 displayName: cred.displayName,
21 description: cred.description,
22 providerId: cred.providerId,
23 accountId: cred.accountId,
24 envKey: cred.envKey,
25 envOwnerUserId: cred.envOwnerUserId,
26 createdBy: cred.createdBy,
27 createdAt: cred.createdAt,
28 updatedAt: cred.updatedAt,
29 role: access.isAdmin ? 'admin' : (access.member?.role ?? null),
30 status: access.member?.status ?? (access.isAdmin ? 'active' : null),
31 }
32}
33
34export const GET = withRouteHandler(
35 async (request: NextRequest, { params }: { params: Promise<{ id: string }> }) => {

Callers 1

route.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected