( apiConfiguration: ProviderSettings, routerModels?: RouterModels, organizationAllowList?: OrganizationAllowList, zooCodeIsAuthenticated?: boolean, )
| 14 | } from "@roo-code/types" |
| 15 | |
| 16 | export function validateApiConfiguration( |
| 17 | apiConfiguration: ProviderSettings, |
| 18 | routerModels?: RouterModels, |
| 19 | organizationAllowList?: OrganizationAllowList, |
| 20 | zooCodeIsAuthenticated?: boolean, |
| 21 | ): string | undefined { |
| 22 | const keysAndIdsPresentErrorMessage = validateModelsAndKeysProvided(apiConfiguration, zooCodeIsAuthenticated) |
| 23 | |
| 24 | if (keysAndIdsPresentErrorMessage) { |
| 25 | return keysAndIdsPresentErrorMessage |
| 26 | } |
| 27 | |
| 28 | const organizationAllowListError = validateProviderAgainstOrganizationSettings( |
| 29 | apiConfiguration, |
| 30 | organizationAllowList, |
| 31 | ) |
| 32 | |
| 33 | if (organizationAllowListError) { |
| 34 | return organizationAllowListError.message |
| 35 | } |
| 36 | |
| 37 | return validateDynamicProviderModelId(apiConfiguration, routerModels) |
| 38 | } |
| 39 | |
| 40 | function validateModelsAndKeysProvided( |
| 41 | apiConfiguration: ProviderSettings, |
no test coverage detected