import { EAdminPermission } from '@cloudbeaver/core-administration' ; import { injectable } from '@cloudbeaver/core-di' ; import { PermissionsResource , SessionDataResource } from '@cloudbeaver/core-root' ; import { AuthProviderConfigurationParametersFragment , CachedMapResource , GetAuthProviderConfigurationParametersQueryVariables , GraphQLService , isResourceKeyList , ResourceKey , ResourceKeyUtils } from '@cloudbeaver/core-sdk' ; @ injectable ( ) export class AuthConfigurationParametersResource extends CachedMapResource < string , AuthProviderConfigurationParametersFragment [ ] , GetAuthProviderConfigurationParametersQueryVariables > { constructor ( private readonly graphQLService , private readonly sessionDataResource , permissionsResource ) { super ( ) ; this . sessionDataResource . outdateResource ( this ) ; permissionsResource . require ( this , EAdminPermission . admin ) ; } protected async loader ( key ) { const values = [ ] ; await ResourceKeyUtils . forEachAsync ( key , async ( key ) => { const { parameters } = await this . graphQLService . sdk . getAuthProviderConfigurationParameters ( { providerId : key } ) ; values . push ( parameters ) ; } ) ; this . set ( key , isResourceKeyList ( key ) ? values : values [ 0 ] ) ; return this . data ; } }