Socket
Socket
Sign inDemoInstall

idb

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idb - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

77

lib/idb.d.ts

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc