From 097f69c5878da16b861f3e69870e79fe63559340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 8 May 2018 13:33:16 +0400 Subject: [PATCH 1/4] PouchDB: update options with find selector and others --- types/pouchdb-core/index.d.ts | 38 +++++++++++++++++++++++++++- types/pouchdb-replication/index.d.ts | 8 +++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index 4b1d56d860..c077051ffb 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -2,11 +2,12 @@ // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Jakub Navratil , // Brian Geppert , Frederico Galvão , -// Tobias Bales +// Tobias Bales , Sebastián Ramírez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /// +/// 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?: PouchDB.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 won’t need this unless you’re 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 { diff --git a/types/pouchdb-replication/index.d.ts b/types/pouchdb-replication/index.d.ts index b0611b840a..97dbc238a6 100644 --- a/types/pouchdb-replication/index.d.ts +++ b/types/pouchdb-replication/index.d.ts @@ -1,10 +1,11 @@ // Type definitions for pouchdb-replication 6.1 // Project: https://pouchdb.com/ -// Definitions by: Jakub Navratil +// Definitions by: Jakub Navratil , Sebastián Ramírez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /// +/// 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?: PouchDB.Find.Selector; + /** Replicate changes after the given sequence number. */ since?: any; From b76cc39de3e26cc3430b3ac6c8048e97207a1f47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 8 May 2018 13:44:13 +0400 Subject: [PATCH 2/4] Update versions of packages --- types/pouchdb-core/index.d.ts | 2 +- types/pouchdb-replication/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index c077051ffb..01c856fb57 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for pouchdb-core 6.1 +// Type definitions for pouchdb-core 6.4.3 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Jakub Navratil , // Brian Geppert , Frederico Galvão , diff --git a/types/pouchdb-replication/index.d.ts b/types/pouchdb-replication/index.d.ts index 97dbc238a6..b16256bff0 100644 --- a/types/pouchdb-replication/index.d.ts +++ b/types/pouchdb-replication/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for pouchdb-replication 6.1 +// Type definitions for pouchdb-replication 6.4.3 // Project: https://pouchdb.com/ // Definitions by: Jakub Navratil , Sebastián Ramírez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 44a334cfb920b9badbb95f16d38cdccdb04894be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 8 May 2018 14:06:13 +0400 Subject: [PATCH 3/4] PouchDB update version, remove PATCH --- types/pouchdb-core/index.d.ts | 2 +- types/pouchdb-replication/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index 01c856fb57..16758500e5 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for pouchdb-core 6.4.3 +// Type definitions for pouchdb-core 6.4 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Jakub Navratil , // Brian Geppert , Frederico Galvão , diff --git a/types/pouchdb-replication/index.d.ts b/types/pouchdb-replication/index.d.ts index b16256bff0..dab75401d5 100644 --- a/types/pouchdb-replication/index.d.ts +++ b/types/pouchdb-replication/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for pouchdb-replication 6.4.3 +// Type definitions for pouchdb-replication 6.4 // Project: https://pouchdb.com/ // Definitions by: Jakub Navratil , Sebastián Ramírez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 9fdadb327a9b42907ed416b1fd13b3f0a4dce025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 8 May 2018 14:12:01 +0400 Subject: [PATCH 4/4] PouchDB: remove unnecessary qualifier --- types/pouchdb-core/index.d.ts | 2 +- types/pouchdb-replication/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index 16758500e5..7534ad902c 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -418,7 +418,7 @@ declare namespace PouchDB { * 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?: PouchDB.Find.Selector; + selector?: Find.Selector; /** * (previously options.returnDocs): Is available for non-http databases and defaults to true. diff --git a/types/pouchdb-replication/index.d.ts b/types/pouchdb-replication/index.d.ts index dab75401d5..a0f581b40a 100644 --- a/types/pouchdb-replication/index.d.ts +++ b/types/pouchdb-replication/index.d.ts @@ -47,7 +47,7 @@ declare namespace PouchDB { /** * Filter using a query/pouchdb-find selector. Note: Selectors are not supported in CouchDB 1.x. */ - selector?: PouchDB.Find.Selector; + selector?: Find.Selector; /** Replicate changes after the given sequence number. */ since?: any;