(view: Omit<AuthStatusView, 'accountProperties'>)
| 41 | } |
| 42 | |
| 43 | function buildAccountProperties(view: Omit<AuthStatusView, 'accountProperties'>): AuthStatusProperty[] { |
| 44 | const properties: AuthStatusProperty[] = [] |
| 45 | const expiredSuffix = view.authExpired ? ' (expired)' : '' |
| 46 | |
| 47 | if (view.subscriptionName) { |
| 48 | properties.push({ |
| 49 | label: 'Login method', |
| 50 | value: `${view.subscriptionName} Account${expiredSuffix}`, |
| 51 | }) |
| 52 | } else if ( |
| 53 | view.authMethod === 'managed_oauth' || |
| 54 | view.authMethod === 'managed_oauth_expired' || |
| 55 | view.authMethod === 'console' |
| 56 | ) { |
| 57 | properties.push({ |
| 58 | label: 'Login method', |
| 59 | value: `Noumena Managed Account${expiredSuffix}`, |
| 60 | }) |
| 61 | } |
| 62 | |
| 63 | if (view.authTokenSource) { |
| 64 | properties.push({ |
| 65 | label: 'Auth token', |
| 66 | value: `${view.authTokenSource}${expiredSuffix}`, |
| 67 | }) |
| 68 | } |
| 69 | |
| 70 | if (view.apiKeySource) { |
| 71 | properties.push({ |
| 72 | label: 'API key', |
| 73 | value: view.apiKeySource, |
| 74 | }) |
| 75 | } |
| 76 | |
| 77 | if (view.orgName && !process.env.IS_DEMO) { |
| 78 | properties.push({ |
| 79 | label: 'Organization', |
| 80 | value: view.orgName, |
| 81 | }) |
| 82 | } |
| 83 | |
| 84 | if (view.email && !process.env.IS_DEMO) { |
| 85 | properties.push({ |
| 86 | label: 'Email', |
| 87 | value: view.email, |
| 88 | }) |
| 89 | } |
| 90 | |
| 91 | return properties |
| 92 | } |
| 93 | |
| 94 | export function buildAuthStatusView( |
| 95 | session: ResolvedAuthSession, |
no outgoing calls
no test coverage detected