pouchdb-core improvements [bulkDocs, changes, get with open revs] (#13410)

* pouchdb-core [BulkDocsOptions, GetOpenRevisions, query, changes promise]

* Removed query function to be added in mapreduce.

* Added _conflicts to ChangesMeta.
This commit is contained in:
Francis Filion
2016-12-27 19:04:25 -05:00
committed by Andy
parent 00d7a667b0
commit 646a9b58d3
2 changed files with 13 additions and 3 deletions
+11 -3
View File
@@ -201,7 +201,12 @@ declare namespace PouchDB {
}[];
}
interface BulkDocsOptions extends PutOptions {
new_edits?: boolean;
}
interface ChangesMeta {
_conflicts?: RevisionId[];
_deleted?: boolean;
_attachments?: Attachments;
}
@@ -286,7 +291,7 @@ declare namespace PouchDB {
results: ChangesResponseChange<Content>[];
}
interface Changes<Content extends Core.Encodable> extends EventEmitter {
interface Changes<Content extends Core.Encodable> extends EventEmitter, Promise<ChangesResponse<Content>> {
on(event: 'change', listener: (value: ChangesResponseChange<Content>) => any): this;
on(event: 'complete', listener: (value: ChangesResponse<Content>) => any): this;
on(event: 'error', listener: (value: any) => any): this;
@@ -320,6 +325,9 @@ declare namespace PouchDB {
* revisions specified in open_revs array. Leaves will be returned
* in the same order as specified in input array. */
open_revs: 'all' | Core.RevisionId[];
/** Include revision history of the document. */
revs?: boolean;
}
/** @todo does this have any other properties? */
@@ -465,7 +473,7 @@ declare namespace PouchDB {
* Finally, to delete a document, include a _deleted parameter with the value true.
*/
bulkDocs(docs: Core.PutDocument<Content>[],
options: Core.PutOptions | null,
options: Core.BulkDocsOptions | null,
callback: Core.Callback<Core.Error, Core.Response[]>): void;
/**
@@ -476,7 +484,7 @@ declare namespace PouchDB {
* Finally, to delete a document, include a _deleted parameter with the value true.
*/
bulkDocs(docs: Core.PutDocument<Content>[],
options?: Core.PutOptions): Promise<Core.Response[]>;
options?: Core.BulkDocsOptions): Promise<Core.Response[]>;
/** Compact the database */
compact(options?: Core.CompactOptions): Promise<Core.Response>;
+2
View File
@@ -175,5 +175,7 @@ namespace PouchDBCoreTests {
heartbeat: false,
filter: (doc: any, params: any) => {}
});
db.changes({ limit: 50 }).then(() => {});
}
}