import { IWappStorage, StorageChangeHandler } from './util/types'; /** * Initializes a WappStorage instance with the given name. * * @param name - The name of the WappStorage instance. If not provided, the default name will be used. * @return A promise that resolves to the initialized WappStorage instance. */ export declare function wappStorage>(name?: string): Promise>; /** * Class representing a WappStorage instance. * * @satisfies IWappStorage * @template T - The type of the stored data. */ export declare class WappStorage = Record> implements IWappStorage { #private; name: string; id: string; /** * Initializes a WappStorage instance with the provided name. * * @param name - The name of the WappStorage instance. */ constructor(name: string); /** * Initializes the WappStorage instance by fetching data based on the provided name. * * @return A Promise that resolves once the initialization is complete. */ init(): Promise; /** * Sets the value of a key-value pair in the storage. * * @param name - The name of the key or an object containing multiple key-value pairs. * @param item - The value to set for the specified key. This parameter is optional when setting multiple key-value pairs. * @return A Promise that resolves to true if the value was successfully set, and false otherwise. */ set(name: K | T, item?: T[K]): Promise; /** * Sets the secret value of a key-value pair in the storage. * * @param name - The name of the key or an object containing multiple key-value pairs. * @param item - The value to set as a secret for the specified key. This parameter is optional when setting multiple key-value pairs. * @return A Promise that resolves to true if the secret value was successfully set, and false otherwise. */ setSecret(name: K | T, item?: T[K]): Promise; /** * Retrieves the value associated with the given name. * * @param name - The name of the value to retrieve. * @return The value associated with the given name. */ get(name: K): T[K] | undefined; get(name: K[]): (T[K] | undefined)[]; /** * Retrieves the secret value associated with the given name. * * @param name - The name of the secret value to retrieve. * @return The secret value associated with the given name, or undefined if the value is not found. */ getSecret(name: K): T[K] | undefined; getSecret(name: K[]): (T[K] | undefined)[]; /** * Returns an array of all the keys in the storage. * * @return An array of keys. */ keys(): Array; /** * Returns an array of all the values in the storage * * @return An array of values. */ values(): T[keyof T][]; /** * Retrieves an iterator of all the key-value pairs in the storage. * * @return An iterator of key-value pairs. */ entries(): [K, T[K]][]; /** * Removes the specified name(s) from the storage. * * @param name - The name or an array of names to be removed. * @return A promise that resolves to true if the name(s) were successfully removed, and false otherwise. */ remove(name: string | string[]): Promise; /** * Removes a secret value from the storage. * * @param name - The name of the secret value to remove, or an array of names. * @return A promise that resolves to true if the secret value was successfully removed, and false otherwise. */ removeSecret(name: string | string[]): Promise; /** * Updates the data and returns a promise that resolves to a boolean indicating whether the update was successful. * * @return A promise that resolves to true if the update was successful, and false otherwise. */ update(): Promise; /** * Registers a callback function to be invoked when the storage changes. * * @param cb - The callback function to be invoked. * @return A promise that resolves to true if the callback was successfully registered, and false otherwise. */ onChange(cb: StorageChangeHandler): Promise; /** * Unregister the callback function that was previously registered with onChange. * * @return A promise that resolves to true if the callback was successfully unregistered, and false otherwise. */ cancelOnChange(): Promise; /** * Reloads the data from the server. * * @return A promise that resolves to a boolean indicating whether the reload was successful. */ reload(): Promise; /** * Resets the state of the wapp storage. * * @return A promise that resolves when the reset is complete. */ reset(): Promise; }