(provider: OAuthProvider)
| 604 | * Uses the pre-computed mapping from OAUTH_PROVIDERS for accuracy. |
| 605 | */ |
| 606 | export function parseProvider(provider: OAuthProvider): ProviderConfig { |
| 607 | // First, check if this is a known providerId from our config |
| 608 | const mapping = PROVIDER_ID_TO_BASE_PROVIDER[provider] |
| 609 | if (mapping) { |
| 610 | return { |
| 611 | baseProvider: mapping.baseProvider, |
| 612 | featureType: mapping.serviceKey, |
| 613 | } |
| 614 | } |
| 615 | |
| 616 | // Handle compound providers (e.g., 'google-email' -> { baseProvider: 'google', featureType: 'email' }) |
| 617 | const [base, feature] = provider.split('-') |
| 618 | |
| 619 | if (feature) { |
| 620 | return { |
| 621 | baseProvider: base, |
| 622 | featureType: feature, |
| 623 | } |
| 624 | } |
| 625 | |
| 626 | // For simple providers, use 'default' as feature type |
| 627 | return { |
| 628 | baseProvider: provider, |
| 629 | featureType: 'default', |
| 630 | } |
| 631 | } |
no outgoing calls
no test coverage detected