Sign In

@dedot/storage

Package Overview
Dependencies
Maintainers
1
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dedot/storage - npm Package Compare versions

Comparing version
0.15.3-next.65898ecf.10
to
0.16.0
+35
-1
IStorage.d.ts
/**
* Generic storage interface
* Generic storage interface for persistent key-value data storage.
*
* This interface provides an abstraction layer for storage mechanisms used by Dedot clients,
* primarily for caching blockchain metadata to improve performance and reduce network calls.
*/
export interface IStorage {
/**
* Retrieves a value from storage by its key.
*
* @param key - The storage key to look up
* @returns A promise that resolves to the stored value, or null if the key doesn't exist
*/
get(key: string): Promise<string | null>;
/**
* Stores a key-value pair in the storage.
*
* @param key - The storage key to set
* @param value - The string value to store
* @returns A promise that resolves to the stored value
* @throws May throw if storage quota is exceeded or storage is unavailable
*/
set(key: string, value: string): Promise<string>;
/**
* Removes a specific key and its value from storage.
*
* @param key - The storage key to remove
* @returns A promise that resolves when the removal is complete
*/
remove(key: string): Promise<void>;
/**
* Removes all keys and values from storage.
*/
clear(): Promise<void>;
/**
* Returns the number of key-value pairs currently in storage.
*/
length(): Promise<number>;
/**
* Returns an array of all keys currently in storage.
*
* @returns A promise that resolves to an array of storage keys
*/
keys(): Promise<string[]>;
}
+2
-2
{
"name": "@dedot/storage",
"version": "0.15.3-next.65898ecf.10+65898ecf",
"version": "0.16.0",
"description": "Storage for different purposes (caching...)",

@@ -27,3 +27,3 @@ "author": "Thang X. Vu <thang@dedot.dev>",

"license": "Apache-2.0",
"gitHead": "65898ecf2226162fc6632d3f4f64ad5fe1179643",
"gitHead": "3e78a8eebb8977de0c5fb956154e5b09c4448f31",
"module": "./index.js",

@@ -30,0 +30,0 @@ "types": "./index.d.ts",