import { JsonValue , KvsStorage , kvsStorage } from "@kvs/storage" ; import { KVS , KVSOptions } from "@kvs/types" ; import localstorage from "./localstorage-memory" ; export type KvsMemoryStorageSchema = { [ index ] : JsonValue ; } ; export type KvsMemoryStorage < Schema extends KvsMemoryStorageSchema > = KVS < Schema > ; export type KvsMemoryStorageOptions < Schema extends KvsMemoryStorageSchema > = KVSOptions < Schema > & { kvsVersionKey ? : string ; } ; export const kvsMemoryStorage = async < Schema extends KvsMemoryStorageSchema > ( options ) : Promise < KvsStorage < Schema > > => { return kvsStorage ( { ... options , storage : localstorage } ) ; } ;