diff --git a/types/pouchdb-adapter-fruitdown/index.d.ts b/types/pouchdb-adapter-fruitdown/index.d.ts index e1323d55bf..89fcd9d95b 100644 --- a/types/pouchdb-adapter-fruitdown/index.d.ts +++ b/types/pouchdb-adapter-fruitdown/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for pouchdb-adapter-fruitdown v5.4.4 +// Type definitions for pouchdb-adapter-fruitdown v6.1.2 // Project: https://pouchdb.com/ -// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão +// Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/pouchdb-adapter-http/index.d.ts b/types/pouchdb-adapter-http/index.d.ts index 44eeb955ac..f0125baf7c 100644 --- a/types/pouchdb-adapter-http/index.d.ts +++ b/types/pouchdb-adapter-http/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for pouchdb-http v5.4.4 +// Type definitions for pouchdb-http v6.1.2 // Project: https://pouchdb.com/ -// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão +// Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/pouchdb-adapter-idb/index.d.ts b/types/pouchdb-adapter-idb/index.d.ts index 196739f486..a62cef3654 100644 --- a/types/pouchdb-adapter-idb/index.d.ts +++ b/types/pouchdb-adapter-idb/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for pouchdb-adapter-idb v5.4.4 +// Type definitions for pouchdb-adapter-idb v6.1.2 // Project: https://pouchdb.com/ -// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão +// Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/pouchdb-adapter-leveldb/index.d.ts b/types/pouchdb-adapter-leveldb/index.d.ts index b335754619..6c89d0161e 100644 --- a/types/pouchdb-adapter-leveldb/index.d.ts +++ b/types/pouchdb-adapter-leveldb/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for pouchdb-adapter-leveldb v5.4.4 +// Type definitions for pouchdb-adapter-leveldb v6.1.2 // Project: https://pouchdb.com/ -// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão +// Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/pouchdb-adapter-localstorage/index.d.ts b/types/pouchdb-adapter-localstorage/index.d.ts index 207cda4899..9e71c05a77 100644 --- a/types/pouchdb-adapter-localstorage/index.d.ts +++ b/types/pouchdb-adapter-localstorage/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for pouchdb-adapter-localstorage v5.4.4 +// Type definitions for pouchdb-adapter-localstorage v6.1.2 // Project: https://pouchdb.com/ -// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão +// Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/pouchdb-adapter-memory/index.d.ts b/types/pouchdb-adapter-memory/index.d.ts index ae14dfdef8..647ce5b434 100644 --- a/types/pouchdb-adapter-memory/index.d.ts +++ b/types/pouchdb-adapter-memory/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for pouchdb-adapter-memory v5.4.4 +// Type definitions for pouchdb-adapter-memory v6.1.2 // Project: https://pouchdb.com/ -// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão +// Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/pouchdb-adapter-node-websql/index.d.ts b/types/pouchdb-adapter-node-websql/index.d.ts index f77a1ebd57..bec01a6d8b 100644 --- a/types/pouchdb-adapter-node-websql/index.d.ts +++ b/types/pouchdb-adapter-node-websql/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for pouchdb-adapter-node-websql v5.4.4 +// Type definitions for pouchdb-adapter-node-websql v6.1.2 // Project: https://pouchdb.com/ -// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão +// Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/pouchdb-adapter-websql/index.d.ts b/types/pouchdb-adapter-websql/index.d.ts index 4e0ee1cfe9..7148d65ea2 100644 --- a/types/pouchdb-adapter-websql/index.d.ts +++ b/types/pouchdb-adapter-websql/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for pouchdb-adapter-websql v5.4.4 +// Type definitions for pouchdb-adapter-websql v6.1.2 // Project: https://pouchdb.com/ -// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão +// Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/pouchdb-browser/index.d.ts b/types/pouchdb-browser/index.d.ts index cab27f1e94..94f942302c 100644 --- a/types/pouchdb-browser/index.d.ts +++ b/types/pouchdb-browser/index.d.ts @@ -1,10 +1,11 @@ -// Type definitions for pouchdb-browser v5.4.4 +// Type definitions for pouchdb-browser v6.1.2 // Project: https://pouchdb.com/ -// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão +// Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// /// +/// /// /// /// diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index f591e521ca..eccc2e00fb 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for pouchdb-core v6.0.7 +// Type definitions for pouchdb-core v6.1.2 // Project: https://pouchdb.com/ -// Definitions by: Jakub Navratil , Andy Brown , Brian Geppert , Frederico Galvão +// Definitions by: Simon Paulger , Jakub Navratil , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -55,6 +55,16 @@ declare namespace PouchDB { rev: RevisionId; status: Availability; } + interface RevisionDiffOptions { + [DocumentId : string]: string[]; + } + interface RevisionDiff { + missing?: string[]; + possible_ancestors?: string[]; + } + interface RevisionDiffResponse { + [DocumentId : string]: RevisionDiff + } interface IdMeta { _id: DocumentId; @@ -206,6 +216,13 @@ declare namespace PouchDB { new_edits?: boolean; } + interface BulkGetOptions extends Options { + docs: any, + revs?: boolean, + attachments?: boolean, + binary?: boolean + } + interface ChangesMeta { _conflicts?: RevisionId[]; _deleted?: boolean; @@ -320,6 +337,9 @@ declare namespace PouchDB { /** Return attachment data as Blobs/Buffers, instead of as base64-encoded strings. */ binary?: boolean; + + /** Forces retrieving latest “leaf” revision, no matter what rev was requested. */ + latest?: boolean; } interface GetOpenRevisions extends Options { @@ -332,7 +352,6 @@ declare namespace PouchDB { revs?: boolean; } - /** @todo does this have any other properties? */ interface PutOptions extends Options { } interface PostOptions extends PutOptions { @@ -342,9 +361,6 @@ declare namespace PouchDB { interval?: number; } - interface InfoOptions extends Options { - } - interface RemoveAttachmentResponse extends BasicResponse { rev: Core.RevisionId; } @@ -563,8 +579,6 @@ declare namespace PouchDB { * see inconsistent results. */ put(doc: Core.PutDocument, - id: Core.DocumentId | null, - revision: Core.RevisionId | null, options: Core.PutOptions | null, callback: Core.Callback): void; @@ -577,8 +591,6 @@ declare namespace PouchDB { * see inconsistent results. */ put(doc: Core.PutDocument, - id?: Core.DocumentId, - revision?: Core.RevisionId, options?: Core.PutOptions): Promise; /** Remove a doc from the database */ @@ -602,11 +614,10 @@ declare namespace PouchDB { options?: Core.Options): Promise; /** Get database information */ - info(options: Core.InfoOptions | null, - callback: Core.Callback): void; + info(callback: Core.Callback): void; /** Get database information */ - info(options?: Core.InfoOptions): Promise; + info(): Promise; /** * A list of changes made to documents in the database, in the order they were made. @@ -711,11 +722,18 @@ declare namespace PouchDB { rev: Core.RevisionId): Promise; /** Given a set of document/revision IDs, returns the document bodies (and, optionally, attachment data) for each ID/revision pair specified. */ - bulkGet(options: any, + bulkGet(options: Core.BulkGetOptions, callback: Core.Callback): void; /** Given a set of document/revision IDs, returns the document bodies (and, optionally, attachment data) for each ID/revision pair specified. */ - bulkGet(options: any): Promise; + bulkGet(options: Core.BulkGetOptions): Promise; + + /** Given a set of document/revision IDs, returns the subset of those that do not correspond to revisions stored in the database */ + revsDiff(diff : Core.RevisionDiffOptions, + callback: Core.Callback): void; + + /** Given a set of document/revision IDs, returns the subset of those that do not correspond to revisions stored in the database */ + revsDiff(diff : Core.RevisionDiffOptions): Promise; } } diff --git a/types/pouchdb-core/pouchdb-core-tests.ts b/types/pouchdb-core/pouchdb-core-tests.ts index 2f047d40d2..fd8ac57359 100644 --- a/types/pouchdb-core/pouchdb-core-tests.ts +++ b/types/pouchdb-core/pouchdb-core-tests.ts @@ -53,6 +53,18 @@ namespace PouchDBCoreTests { }); } + function testBulkGet() { + const db = new PouchDB<{}>(); + db.bulkGet({docs: [{id: 'a', rev: 'b'}, {id: 'b', rev: 'c'}, {id: 'c', rev: 'd'}]}).then((result) => {}); + db.bulkGet({docs: [{id: 'a', rev: 'b'}, {id: 'b', rev: 'c'}, {id: 'c', rev: 'd'}]}, (error, response) => {}); + } + + function testRevsDiff() { + const db = new PouchDB<{}>(); + db.revsDiff({'a': ['1-a', '2-b']}).then((result) => {}); + db.revsDiff({'a': ['1-a', '2-b']}, (error, response) => {}); + } + function testCompact() { const db = new PouchDB<{}>(); // Promise version @@ -92,12 +104,12 @@ namespace PouchDBCoreTests { db.put(model).then((error) => { }); - db.put(model, null, null, null, (error) => { + db.put(model, null, (error) => { }); db.info().then((info) => { }); - db.info({ ajax: { cache: true }}, (error, result) => { + db.info((error, result) => { }); PouchDB.debug.enable('*'); diff --git a/types/pouchdb-http/index.d.ts b/types/pouchdb-http/index.d.ts index e2e6043138..8dde8993e9 100644 --- a/types/pouchdb-http/index.d.ts +++ b/types/pouchdb-http/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for pouchdb-http v5.4.4 +// Type definitions for pouchdb-http v6.1.2 // Project: https://pouchdb.com/ -// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão +// Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/pouchdb-mapreduce/index.d.ts b/types/pouchdb-mapreduce/index.d.ts index 9d60fa40ef..401f70afb0 100644 --- a/types/pouchdb-mapreduce/index.d.ts +++ b/types/pouchdb-mapreduce/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for pouchdb-mapreduce v5.4.4 +// Type definitions for pouchdb-mapreduce v6.1.2 // Project: https://pouchdb.com/ -// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão +// Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -76,7 +76,7 @@ declare namespace PouchDB { * to take up space on disk. viewCleanup() removes these unnecessary * index files. */ - viewCleanup(callback: PouchDB.Core.Callback): void; + viewCleanup(callback: PouchDB.Core.Callback): void; /** * Cleans up any stale map/reduce indexes. * @@ -85,7 +85,7 @@ declare namespace PouchDB { * to take up space on disk. viewCleanup() removes these unnecessary * index files. */ - viewCleanup(): Promise; + viewCleanup(): Promise; /** * Invoke a map/reduce function, which allows you to perform more complex queries diff --git a/types/pouchdb-node/index.d.ts b/types/pouchdb-node/index.d.ts index fe25d5d7b3..aed20c7192 100644 --- a/types/pouchdb-node/index.d.ts +++ b/types/pouchdb-node/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for pouchdb-node v5.4.4 +// Type definitions for pouchdb-node v6.1.2 // Project: https://pouchdb.com/ -// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão +// Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/pouchdb-replication/index.d.ts b/types/pouchdb-replication/index.d.ts index b1f30a0360..057653bada 100644 --- a/types/pouchdb-replication/index.d.ts +++ b/types/pouchdb-replication/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for pouchdb-replication v6.0.7 +// Type definitions for pouchdb-replication v6.1.2 // Project: https://pouchdb.com/ // Definitions by: Jakub Navratil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/pouchdb/index.d.ts b/types/pouchdb/index.d.ts index 5822e631a8..e14e4c421f 100644 --- a/types/pouchdb/index.d.ts +++ b/types/pouchdb/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for pouchdb v5.4.4 +// Type definitions for pouchdb v6.1.2 // Project: https://pouchdb.com/ // Definitions by: Andy Brown , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/pouchdb/pouchdb-tests.ts b/types/pouchdb/pouchdb-tests.ts index 89f1c002db..3d580b9bff 100644 --- a/types/pouchdb/pouchdb-tests.ts +++ b/types/pouchdb/pouchdb-tests.ts @@ -92,12 +92,12 @@ namespace PouchDBTests { db.put(model).then((error) => { }); - db.put(model, null, null, null, (error) => { + db.put(model, null, (error) => { }); db.info().then((info) => { }); - db.info({ ajax: { cache: true }}, (error, result) => { + db.info((error, result) => { }); db.viewCleanup().catch((error) => {