Comparing version 2.0.1 to 2.0.2
@@ -95,4 +95,33 @@ /** This is your entry point to the API. It's exposed to the global scope unless you're using a module system such as browserify, in which case it's the exported object. */ | ||
/** Common interface for ObjectStore and Index, since bothe provide these cursor methods */ | ||
export interface HasCursor { | ||
/** Returns a Promise of an IDBRequest object that (in a separate thread) resolves a new cursor object. | ||
* Used for iterating through an object store by primary key with a cursor. | ||
* @param range Optional. A key or IDBKeyRange to be queried. If a single valid key is passed, this will default to a range containing only that key. If nothing is passed, this will default to a key range that selects all the records in this object store. | ||
* @param direction Optional. An IDBCursorDirection telling the cursor what direction to travel. Defaults to "next". | ||
* @returns A promise that resolves with the cursor once it has been opened. */ | ||
openCursor(range?: IDBKeyRange | IDBValidKey, direction?: 'next' | 'nextunique' | 'prev' | 'prevunique'): Promise<Cursor>; | ||
/** Returns a Promise of an IDBRequest object that (in a separate thread) resolves a new cursor object. | ||
* Used for iterating through an object store with a key. | ||
* @param range Optional. A key or IDBKeyRange to be queried. If a single valid key is passed, this will default to a range containing only that key. If nothing is passed, this will default to a key range that selects all the records in this object store. | ||
* @param direction Optional. An IDBCursorDirection telling the cursor what direction to travel. Defaults to "next". | ||
* @returns A promise that resolves with the cursor once it has been opened. */ | ||
openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: 'next' | 'nextunique' | 'prev' | 'prevunique'): Promise<Cursor>; | ||
/** Due to the microtask issues in some browsers, iterating over a cursor using promises doesn't always work. | ||
* So in the mean time, iterateCursor maps to openCursor, takes identical arguments, plus an additional callback that receives an IDBCursor */ | ||
iterateCursor(callback: (c: Cursor) => void): void; | ||
iterateCursor(range: IDBKeyRange | IDBValidKey, callback: (c: Cursor) => void): void; | ||
iterateCursor(range: IDBKeyRange | IDBValidKey, direction: 'next' | 'nextunique' | 'prev' | 'prevunique', callback: (c: Cursor) => void): void; | ||
/** Due to the microtask issues in some browsers, iterating over a cursor using promises doesn't always work. | ||
* So in the mean time, iterateKeyCursor maps to openKeyCursor, takes identical arguments, plus an additional callback that receives an IDBCursor */ | ||
iterateKeyCursor(callback: (c: Cursor) => void): void; | ||
iterateKeyCursor(range: IDBKeyRange | IDBValidKey, callback: (c: Cursor) => void): void; | ||
iterateKeyCursor(range: IDBKeyRange | IDBValidKey, direction: 'next' | 'nextunique' | 'prev' | 'prevunique', callback: (c: Cursor) => void): void; | ||
} | ||
/** Wrapper of IDBObjectStore that presents the asynchronous operations as Promises. */ | ||
export interface ObjectStore { | ||
export interface ObjectStore : HasCursor { | ||
/** The name of this object store. Settable only during upgrades. */ | ||
@@ -164,16 +193,2 @@ name: string; | ||
/** Returns a Promise of an IDBRequest object that (in a separate thread) resolves a new cursor object. | ||
* Used for iterating through an object store by primary key with a cursor. | ||
* @param range Optional. A key or IDBKeyRange to be queried. If a single valid key is passed, this will default to a range containing only that key. If nothing is passed, this will default to a key range that selects all the records in this object store. | ||
* @param direction Optional. An IDBCursorDirection telling the cursor what direction to travel. Defaults to "next". | ||
* @returns A promise that resolves with the cursor once it has been opened. */ | ||
openCursor(range?: IDBKeyRange | IDBValidKey, direction?: 'next' | 'nextunique' | 'prev' | 'prevunique'): Promise<Cursor>; | ||
/** Returns a Promise of an IDBRequest object that (in a separate thread) resolves a new cursor object. | ||
* Used for iterating through an object store with a key. | ||
* @param range Optional. A key or IDBKeyRange to be queried. If a single valid key is passed, this will default to a range containing only that key. If nothing is passed, this will default to a key range that selects all the records in this object store. | ||
* @param direction Optional. An IDBCursorDirection telling the cursor what direction to travel. Defaults to "next". | ||
* @returns A promise that resolves with the cursor once it has been opened. */ | ||
openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: 'next' | 'nextunique' | 'prev' | 'prevunique'): Promise<Cursor>; | ||
/** Creates a new index during a version upgrade, returning a new Index object in the connected database. | ||
@@ -194,14 +209,6 @@ * @param name The name of the index to create. It is possible to create an index with an empty name. | ||
index(name: string): Index; | ||
/** Due to the microtask issues in some browsers, iterating over a cursor using promises doesn't always work. | ||
* So in the mean time, iterateCursor maps to openCursor, takes identical arguments, plus an additional callback that receives an IDBCursor */ | ||
iterateCursor(callback: (c: Cursor) => void): void; | ||
/** Due to the microtask issues in some browsers, iterating over a cursor using promises doesn't always work. | ||
* So in the mean time, iterateKeyCursor maps to openKeyCursor, takes identical arguments, plus an additional callback that receives an IDBCursor */ | ||
iterateKeyCursor(callback: (c: Cursor) => void): void; | ||
} | ||
/** Wrapper of IDBIndex that presents the asynchronous operations as Promises. */ | ||
export interface Index { | ||
export interface Index : HasCursor { | ||
/** The name of this index. */ | ||
@@ -249,24 +256,2 @@ readonly name: string; | ||
getAllKeys(query?: IDBKeyRange, count?: number): Promise<any[]>; | ||
/** Returns a Promise of an IDBRequest object that (in a separate thread) resolves a new cursor object. | ||
* Used for iterating through an object store by primary key with a cursor. | ||
* @param range Optional. A key or IDBKeyRange to be queried. If a single valid key is passed, this will default to a range containing only that key. If nothing is passed, this will default to a key range that selects all the records in this object store. | ||
* @param direction Optional. An IDBCursorDirection telling the cursor what direction to travel. Defaults to "next". | ||
* @returns A promise that resolves with the cursor once it has been opened. */ | ||
openCursor(range?: IDBKeyRange | IDBValidKey, direction?: 'next' | 'nextunique' | 'prev' | 'prevunique'): Promise<Cursor>; | ||
/** Returns a Promise of an IDBRequest object that (in a separate thread) resolves a new cursor object. | ||
* Used for iterating through an object store with a key. | ||
* @param range Optional. A key or IDBKeyRange to be queried. If a single valid key is passed, this will default to a range containing only that key. If nothing is passed, this will default to a key range that selects all the records in this object store. | ||
* @param direction Optional. An IDBCursorDirection telling the cursor what direction to travel. Defaults to "next". | ||
* @returns A promise that resolves with the cursor once it has been opened. */ | ||
openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: 'next' | 'nextunique' | 'prev' | 'prevunique'): Promise<Cursor>; | ||
/** Due to the microtask issues in some browsers, iterating over a cursor using promises doesn't always work. | ||
* So in the mean time, iterateCursor maps to openCursor, takes identical arguments, plus an additional callback that receives an IDBCursor */ | ||
iterateCursor(callback: (c: Cursor) => void): void; | ||
/** Due to the microtask issues in some browsers, iterating over a cursor using promises doesn't always work. | ||
* So in the mean time, iterateKeyCursor maps to openKeyCursor, takes identical arguments, plus an additional callback that receives an IDBCursor */ | ||
iterateKeyCursor(callback: (c: Cursor) => void): void; | ||
} | ||
@@ -273,0 +258,0 @@ |
{ | ||
"name": "idb", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "IndexedDB but with promises", | ||
@@ -5,0 +5,0 @@ "main": "lib/node.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
192708
693