You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by gl...@apache.org on 2020/02/27 09:38:57 UTC
[couchdb-nano] 01/01: allow fetch to return errors as well as
successes - fixes issue #203
This is an automated email from the ASF dual-hosted git repository.
glynnbird pushed a commit to branch issue203
in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git
commit 7f978f1eea5c44df1a01e6c05e91bf15f220d7f9
Author: Glynn Bird <gl...@gmail.com>
AuthorDate: Thu Feb 27 09:38:37 2020 +0000
allow fetch to return errors as well as successes - fixes issue #203
---
lib/nano.d.ts | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/lib/nano.d.ts b/lib/nano.d.ts
index e287643..4009f48 100644
--- a/lib/nano.d.ts
+++ b/lib/nano.d.ts
@@ -181,13 +181,13 @@ declare namespace nano {
callback?: Callback<DocumentFetchResponse<D>>
): Promise<DocumentFetchResponse<D>>;
// http://docs.couchdb.org/en/latest/api/database/bulk-api.html#post--db-_all_docs
- fetchRevs(docnames: BulkFetchDocsWrapper, callback?: Callback<DocumentFetchRevsResponse>): Promise<DocumentFetchRevsResponse>;
+ fetchRevs(docnames: BulkFetchDocsWrapper, callback?: Callback<DocumentFetchRevsResponse<D>>): Promise<DocumentFetchRevsResponse<D>>;
// http://docs.couchdb.org/en/latest/api/database/bulk-api.html#post--db-_all_docs
fetchRevs(
docnames: BulkFetchDocsWrapper,
params: DocumentFetchParams,
- callback?: Callback<DocumentFetchRevsResponse>
- ): Promise<DocumentFetchRevsResponse>;
+ callback?: Callback<DocumentFetchRevsResponse<D>>
+ ): Promise<DocumentFetchRevsResponse<D>>;
// http://docs.couchdb.org/en/latest/api/database/find.html#db-index
createIndex(indexDef: CreateIndexRequest,
callback?: Callback<CreateIndexResponse>
@@ -1032,22 +1032,25 @@ declare namespace nano {
start_key_doc_id?: string;
update_seq?: boolean;
}
+ interface DocumentLookupFailure {
+ key: string;
+ error: string;
+ }
interface DocumentFetchResponse<D> {
offset: number;
- rows: Array<DocumentResponseRow<D>>;
+ rows: Array<DocumentResponseRow<D> | DocumentLookupFailure>;
total_rows: number;
update_seq?: number;
}
- interface DocumentFetchRevsResponse {
+ interface DocumentFetchRevsResponse<D> {
offset: number;
- rows: DocumentResponseRowMeta[];
+ rows: Array<DocumentResponseRow<D> | DocumentLookupFailure>;
total_rows: number;
update_seq?: number;
}
-
interface DocumentSearchResponse<V> {
// Array of search results