Merge pull request #11329 from nohira/master

Add bulkDocs types
This commit is contained in:
Andy
2016-09-22 06:15:40 -07:00
committed by GitHub
2 changed files with 23 additions and 0 deletions

View File

@@ -38,6 +38,23 @@ namespace PouchDBCoreTests {
});
}
function testBulkDocs() {
const db = new PouchDB<MyModel>();
type MyModel = { property: 'someProperty '};
let model: PouchDB.Core.Document<MyModel>;
let model2: PouchDB.Core.Document<MyModel>;
db.bulkDocs([model, model2]).then((result) => {
result.forEach(({ ok, id, rev }) => {
isString(id);
isString(rev);
});
});
db.bulkDocs([model, model2], null, (error, response) => {
});
}
function testCompact() {
const db = new PouchDB<{}>();
// Promise version

View File

@@ -268,6 +268,12 @@ declare namespace PouchDB {
allDocs(options?: Core.AllDocsOptions):
Promise<Core.AllDocsResponse<Content>>;
bulkDocs(docs: Core.Document<Content>[],
options: Core.PutOptions | void,
callback: Core.Callback<Core.Error, Core.Response[]>): void;
bulkDocs(docs: Core.Document<Content>[],
options?: Core.PutOptions): Promise<Core.Response[]>;
/** Compact the database */
compact(options?: Core.CompactOptions): Promise<Core.Response>;
compact(options: Core.CompactOptions,