Merge pull request #25598 from tiangolo/pouchdb-changes-selector

PouchDB: update options with find selector and others
This commit is contained in:
Ron Buckton
2018-05-15 12:08:30 -07:00
committed by GitHub
2 changed files with 46 additions and 4 deletions
+38 -2
View File
@@ -1,12 +1,13 @@
// Type definitions for pouchdb-core 6.1
// Type definitions for pouchdb-core 6.4
// Project: https://pouchdb.com/
// Definitions by: Simon Paulger <https://github.com/spaulg>, Jakub Navratil <https://github.com/trubit>,
// Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>,
// Tobias Bales <https://github.com/TobiasBales>
// Tobias Bales <https://github.com/TobiasBales>, Sebastián Ramírez <https://github.com/tiangolo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="debug" />
/// <reference types="pouchdb-find" />
interface Buffer extends Uint8Array {
write(string: string, offset?: number, length?: number, encoding?: string): number;
@@ -412,6 +413,41 @@ declare namespace PouchDB {
* Note: options.filter must be set to '_view' for this option to work.
*/
view?: string;
/**
* Filter using a query/pouchdb-find selector. Note: Selectors are not supported in CouchDB 1.x.
* Cannot be used in combination with the filter option.
*/
selector?: Find.Selector;
/**
* (previously options.returnDocs): Is available for non-http databases and defaults to true.
* Passing false prevents the changes feed from keeping all the documents in memory in other
* words complete always has an empty results array, and the change event is the only way to get the event.
* Useful for large change sets where otherwise you would run out of memory.
*/
return_docs?: boolean;
/**
* Only available for http databases, this configures how many changes to fetch at a time.
* Increasing this can reduce the number of requests made. Default is 25.
*/
batch_size?: number;
/**
* Specifies how many revisions are returned in the changes array.
* The default, 'main_only', will only return the current “winning” revision;
* 'all_docs' will return all leaf revisions (including conflicts and deleted former conflicts).
* Most likely you wont need this unless youre writing a replicator.
*/
style?: 'main_only' | 'all_docs';
/**
* Only available for http databases. Specifies that seq information only be generated every N changes.
* Larger values can improve changes throughput with CouchDB 2.0 and later.
* Note that last_seq is always populated regardless.
*/
seq_interval?: number;
}
interface ChangesResponseChange<Content extends {}> {
+8 -2
View File
@@ -1,10 +1,11 @@
// Type definitions for pouchdb-replication 6.1
// Type definitions for pouchdb-replication 6.4
// Project: https://pouchdb.com/
// Definitions by: Jakub Navratil <https://github.com/trubit>
// Definitions by: Jakub Navratil <https://github.com/trubit>, Sebastián Ramírez <https://github.com/tiangolo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="pouchdb-core" />
/// <reference types="pouchdb-find" />
declare namespace PouchDB {
namespace Replication {
@@ -43,6 +44,11 @@ declare namespace PouchDB {
*/
view?: string;
/**
* Filter using a query/pouchdb-find selector. Note: Selectors are not supported in CouchDB 1.x.
*/
selector?: Find.Selector;
/** Replicate changes after the given sequence number. */
since?: any;