/** * Builds a storage key from a prefix, optional namespace and key. * * @example * ```ts * createKey('app', 'token', 'auth'); // 'app/auth/token' * ``` */ declare const createKey: (prefix: string, key: string, namespace?: string) => string; type StorageType = 'session' | 'local'; interface SetToStorageConfig extends Omit, 'fallback'> { value: V; } interface UnsetFromStorageConfig extends Omit, 'fallback'> { } interface GetFromStorageConfig { /** * Storage key used to retrieve the value. * The full key is extended with the project namespace. */ key: string; /** * Storage type. */ type: StorageType; /** * Default value used when there is no value in storage. */ fallback?: V; /** * Optional namespace segment used in the generated key. */ namespace?: string; /** * Optional key prefix. */ prefix?: string; } type SetToStorageWrappedConfig = Omit, Extract, keyof BaseConfig>> & Partial, Extract, keyof BaseConfig>>> & Pick>>; type UnsetFromStorageWrappedConfig = Omit> & Partial>> & Pick>; type GetFromStorageWrappedConfig = Omit, Extract, keyof BaseConfig>> & Partial, Extract, keyof BaseConfig>>> & Pick>>; type StorageConfigBase = Partial, 'prefix' | 'type'>>; interface StorageApi { set(config: SetToStorageWrappedConfig): void; unset(config: UnsetFromStorageWrappedConfig): void; get(config: GetFromStorageWrappedConfig): Value | null; } /** * Creates an interface for working with storage (`localStorage`, `sessionStorage`). */ declare function createStorage(storageConfig: BaseConfig): StorageApi; export { createKey, createStorage }; export type { GetFromStorageConfig, GetFromStorageWrappedConfig, SetToStorageConfig, SetToStorageWrappedConfig, StorageApi, StorageConfigBase, StorageType, UnsetFromStorageConfig, UnsetFromStorageWrappedConfig };