export declare class Storage { config: StorageConfigInterface; key: StorageKey; ready: boolean; methods: StorageMethodsInterface; /** * A Storage is an interface to an external Storage, * and allows the easy interaction with that Storage. * * Due to the Storage, AgileTs can easily persist its Instances in almost any Storage * without a huge overhead. * * @public * @param config - Configuration object */ constructor(config: CreateStorageConfigInterface); /** * Returns a boolean indicating whether the Storage is valid * and can be used to persist Instances in it or not. * * @public */ validate(): boolean; /** * Synchronously retrieves the stored value * at the specified Storage Item key from the external Storage. * * When the retrieved value is a JSON-String it is parsed automatically. * * @public * @param key - Key/Name identifier of the value to be retrieved. */ normalGet(key: StorageItemKey): GetTpe | undefined; /** * Asynchronously retrieves the stored value * at the specified Storage Item key from the external Storage. * * When the retrieved value is a JSON-String it is parsed automatically. * * @public * @param key - Key/Name identifier of the value to be retrieved. */ get(key: StorageItemKey): Promise; /** * Stores or updates the value at the specified Storage Item key * in the external Storage. * * @public * @param key - Key/Name identifier of the value to be stored or updated. * @param value - Value to be stored. */ set(key: StorageItemKey, value: any): void; /** * Removes the value at the specified Storage Item key * from the external Storage. * * @public * @param key - Key/Name identifier of the value to be removed. */ remove(key: StorageItemKey): void; /** * Generates and returns a valid Storage key based on the specified key. * * @internal * @param key - Key to be converted into a valid Storage key. */ getStorageKey(key: StorageItemKey): string; } export declare type StorageKey = string | number; export declare type StorageItemKey = string | number; export interface CreateStorageConfigInterface extends StorageConfigInterface { /** * Key/Name identifier of the Storage. * @default undefined */ key: string; /** * Storage methods for interacting with the external Storage. * @default undefined */ methods: StorageMethodsInterface; } export interface StorageMethodsInterface { /** * Method to retrieve a value at the specified key from the external Storage. * * @param key - Key/Name identifier of the value to be retrieved. */ get: (key: string) => any; /** * Method to store or update a value at the specified key in the external Storage. * * @param key - Key/Name identifier of the value to be stored or updated. * @param value - Value to be stored. */ set: (key: string, value: any) => void; /** * Method to remove a value at the specified key from the external Storage. * * @param key - Key/Name identifier of the value to be removed. */ remove: (key: string) => void; } export interface StorageConfigInterface { /** * Whether the external Storage represented by the Storage Class works async. * @default Automatically detected via the `isAsyncFunction()` method */ async?: boolean; /** * Prefix to be added before each persisted value key/name identifier. * @default 'agile' */ prefix?: string; }