import {isOAuth2Scope, OAuth2Scope, ScopeRepository} from '../types' import {Inject, Injectable} from '../../../di' import {Config} from '../../../service/Config' import {Awaitable, Maybe} from '../../../util' @Injectable() export class ConfigScopeRepository extends ScopeRepository { @Inject() protected readonly config!: Config find(id: string): Awaitable> { const scope = this.config.get(`oauth2.scopes.${id}`) if ( isOAuth2Scope(scope) ) { return scope } } findByName(name: string): Awaitable> { return this.find(name) } }