import * as AbstractLevel from 'abstract-level' import * as ClassicLevel from 'classic-level' import * as BrowserLevel from 'browser-level' /** * Universal {@link AbstractLevel} database for Node.js and browsers. * * @template KDefault The default type of keys if not overridden on operations. * @template VDefault The default type of values if not overridden on operations. */ export class Level extends AbstractLevel.AbstractLevel { /** * Database constructor. * * @param location Directory path (relative or absolute) where LevelDB will store its * files, or in browsers, the name of the * [`IDBDatabase`](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase) to be * opened. * @param options Options, of which some will be forwarded to {@link open}. */ constructor (location: string, options?: DatabaseOptions | undefined) /** * Location that was passed to the constructor. */ get location (): string open (): Promise open (options: OpenOptions): Promise open (callback: AbstractLevel.NodeCallback): void open (options: OpenOptions, callback: AbstractLevel.NodeCallback): void get (key: KDefault): Promise get (key: KDefault, callback: AbstractLevel.NodeCallback): void get (key: K, options: GetOptions): Promise get (key: K, options: GetOptions, callback: AbstractLevel.NodeCallback): void getMany (keys: KDefault[]): Promise getMany (keys: KDefault[], callback: AbstractLevel.NodeCallback): void getMany (keys: K[], options: GetManyOptions): Promise getMany (keys: K[], options: GetManyOptions, callback: AbstractLevel.NodeCallback): void put (key: KDefault, value: VDefault): Promise put (key: KDefault, value: VDefault, callback: AbstractLevel.NodeCallback): void put (key: K, value: V, options: PutOptions): Promise put (key: K, value: V, options: PutOptions, callback: AbstractLevel.NodeCallback): void del (key: KDefault): Promise del (key: KDefault, callback: AbstractLevel.NodeCallback): void del (key: K, options: DelOptions): Promise del (key: K, options: DelOptions, callback: AbstractLevel.NodeCallback): void batch (operations: Array>): Promise batch (operations: Array>, callback: AbstractLevel.NodeCallback): void batch (operations: Array>, options: BatchOptions): Promise batch (operations: Array>, options: BatchOptions, callback: AbstractLevel.NodeCallback): void batch (): ChainedBatch iterator (): Iterator iterator (options: IteratorOptions): Iterator keys (): KeyIterator keys (options: KeyIteratorOptions): KeyIterator values (): ValueIterator values (options: ValueIteratorOptions): ValueIterator } export type DatabaseOptions = ClassicLevel.DatabaseOptions & BrowserLevel.DatabaseOptions export type OpenOptions = ClassicLevel.OpenOptions & BrowserLevel.OpenOptions export type GetOptions = ClassicLevel.GetOptions & BrowserLevel.GetOptions export type GetManyOptions = ClassicLevel.GetManyOptions & BrowserLevel.GetManyOptions export type PutOptions = ClassicLevel.PutOptions & BrowserLevel.PutOptions export type DelOptions = ClassicLevel.DelOptions & BrowserLevel.DelOptions export type BatchOptions = ClassicLevel.BatchOptions & BrowserLevel.BatchOptions export type BatchOperation = ClassicLevel.BatchOperation & BrowserLevel.BatchOperation export type ChainedBatch = ClassicLevel.ChainedBatch & BrowserLevel.ChainedBatch export type Iterator = ClassicLevel.Iterator & BrowserLevel.Iterator export type KeyIterator = ClassicLevel.KeyIterator & BrowserLevel.KeyIterator export type ValueIterator = ClassicLevel.ValueIterator & BrowserLevel.ValueIterator export type IteratorOptions = ClassicLevel.IteratorOptions & BrowserLevel.IteratorOptions export type KeyIteratorOptions = ClassicLevel.KeyIteratorOptions & BrowserLevel.KeyIteratorOptions export type ValueIteratorOptions = ClassicLevel.ValueIteratorOptions & BrowserLevel.ValueIteratorOptions