(session: ResolvedAuthSession)
| 6 | } from './types.js' |
| 7 | |
| 8 | function buildAuthMethod(session: ResolvedAuthSession): AuthStatusView['authMethod'] { |
| 9 | if (session.principalSource === 'third_party_provider') { |
| 10 | return 'third_party' |
| 11 | } |
| 12 | if ( |
| 13 | session.principalSource === 'managed_oauth' && |
| 14 | session.sessionState === 'expired' |
| 15 | ) { |
| 16 | return 'managed_oauth_expired' |
| 17 | } |
| 18 | if (session.principalSource === 'managed_oauth') { |
| 19 | return 'managed_oauth' |
| 20 | } |
| 21 | if (session.principalSource === 'api_key_helper') { |
| 22 | return 'api_key_helper' |
| 23 | } |
| 24 | if ( |
| 25 | session.principalSource === 'service_oauth_env' || |
| 26 | session.principalSource === 'service_oauth_fd' || |
| 27 | session.principalSource === 'external_bearer_compat' |
| 28 | ) { |
| 29 | return 'oauth_token' |
| 30 | } |
| 31 | if (session.principalSource === 'console_api_key') { |
| 32 | return 'console' |
| 33 | } |
| 34 | if ( |
| 35 | session.principalSource === 'direct_api_key_env' || |
| 36 | session.principalSource === 'service_api_key_fd' |
| 37 | ) { |
| 38 | return 'api_key' |
| 39 | } |
| 40 | return 'none' |
| 41 | } |
| 42 | |
| 43 | function buildAccountProperties(view: Omit<AuthStatusView, 'accountProperties'>): AuthStatusProperty[] { |
| 44 | const properties: AuthStatusProperty[] = [] |
no outgoing calls
no test coverage detected