import { KVStore , KVStoreProvider } from "./interface" ; export class BaseKVStore implements KVStore { constructor ( private readonly provider , private readonly _prefix ) { } async get < T = unknown > ( key ) { const k = this . prefix ( ) + "/" + key ; const data = await this . provider . get ( ) ; return data [ k ] ; } set < T = unknown > ( key , data ) { const k = this . prefix ( ) + "/" + key ; return this . provider . set ( { [ k ] : data } ) ; } prefix ( ) { return this . _prefix ; } }