import { Observable } from 'rxjs'; export declare type AreaName = 'local' | 'sync' | 'managed'; export declare type CoreGetter = Extract | Extract[] | Partial; export declare type Getter = Extract | Extract[] | ((values: T) => any) | Partial; export declare type Changes = { [K in keyof T]?: { oldValue?: T[K]; newValue?: T[K]; }; }; export interface Bucket { /** * Get a value or values in the storage area using a key name, a key name array, or a getter function. * * A getter function receives a StorageValues object and can return anything. */ get(): Promise; get(getter: null): Promise; get

>(getter: P): Promise<{ [key in P]: T[P]; }>; get

[]>(getter: P): Promise>; get(getter: (values: T) => K): Promise; get>(getter: K): Promise; /** * Set a value or values in the storage area using an object with keys and default values, or a setter function. * * A setter function receives a StorageValues object and must return a StorageValues object. A setter function cannot be an async function. * * Synchronous calls to set will be composed into a single setter function for performance and reliability. */ set(setter: Partial): Promise; set(setter: (prev: T) => Partial): Promise; /** * Set a value or values in the storage area using an async setter function. * * An async setter function should return a Promise that contains a StorageValues object. * * `StorageArea#update` should be used if an async setter function is required. Syncronous calls to `set` will be more performant than calls to `update`. * * ```javascript * storage.local.update(async ({ text }) => { * const result = await asyncApiRequest(text) * * return { text: result } * }) * ``` */ update: (asyncSetter: (values: T) => Promise) => Promise; /** Remove a key from the storage area */ remove: (query: string | string[]) => Promise; /** Clear the storage area */ clear: () => Promise; /** Get the keys (or property names) of the storage area */ getKeys: () => Promise; /** Emits an object with changed storage keys and StorageChange values */ readonly changeStream: Observable>; /** Emits the current storage values immediately and when changeStream emits */ readonly valueStream: Observable; }