import type { ISettingsSource } from '@cloudbeaver/core-settings' ; export class PluginSettings < T > implements ISettingsSource { constructor ( private source , private scope , private defaults ) { } has < TKey extends keyof T > ( key ) { return true ; } getValue < TKey extends keyof T > ( key ) { if ( this . source . has ( this . scopedKey ( key ) ) ) { return this . source . getValue ( this . scopedKey ( key ) ) ; } return this . defaults [ key ] ; } setValue < TKey extends keyof T > ( key , value ) { this . source . setValue ( this . scopedKey ( key ) , value ) ; } private scopedKey ( key ) { return `${ this . scope }.${ String ( key ) }` ; } clear ( ) { this . source . clear ( ) ; } }