Skip to content

Commit

Permalink
Don't display internal console session token
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-balitskyi committed Dec 12, 2024
1 parent f10b027 commit b66cecd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/lib/layout/api-endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,18 @@ export interface ApiEndpointLayoutContext {
type AuthMethodDisplayName =
| 'API key'
| 'Client session token'
| 'Console session token'
| 'Personal access token'
| 'Publishable key'

type ConsoleSessionAuthMethod = Extract<SeamAuthMethod, 'console_session_token'>
const internalAuthMethod: ConsoleSessionAuthMethod = 'console_session_token'

const seamAuthMethodToDisplayNameMap: Record<
SeamAuthMethod,
Exclude<SeamAuthMethod, ConsoleSessionAuthMethod>,
AuthMethodDisplayName
> = {
api_key: 'API key',
client_session_token: 'Client session token',
console_session_token: 'Console session token',
personal_access_token: 'Personal access token',
publishable_key: 'Publishable key',
}
Expand All @@ -73,9 +74,9 @@ export function setEndpointLayoutContext(
file.description = endpoint.description
file.title = endpoint.title
file.path = endpoint.path
file.authMethods = endpoint.authMethods.map(
(method) => seamAuthMethodToDisplayNameMap[method],
)
file.authMethods = endpoint.authMethods
.filter((method) => method !== internalAuthMethod)
.map((method) => seamAuthMethodToDisplayNameMap[method])

Check failure on line 79 in src/lib/layout/api-endpoint.ts

View workflow job for this annotation

GitHub Actions / Typecheck

Property 'console_session_token' does not exist on type 'Record<"api_key" | "personal_access_token" | "client_session_token" | "publishable_key", AuthMethodDisplayName>'. Did you mean 'client_session_token'?

file.request = {
preferredMethod: endpoint.request?.preferredMethod ?? '',
Expand Down

0 comments on commit b66cecd

Please sign in to comment.