Merge pull request #15711 from spaulg/pouchdb-6.1.2

Upgrade PouchDB support to v6.1.2 (applies to all pouchdb-* packages)
This commit is contained in:
Ryan Cavanaugh
2017-04-17 18:53:25 -07:00
committed by GitHub
17 changed files with 78 additions and 47 deletions

View File

@@ -1,6 +1,6 @@
// Type definitions for pouchdb-adapter-fruitdown v5.4.4
// Type definitions for pouchdb-adapter-fruitdown v6.1.2
// Project: https://pouchdb.com/
// Definitions by: Andy Brown <https://github.com/AGBrown>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions by: Simon Paulger <https://github.com/spaulg>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="pouchdb-core" />

View File

@@ -1,6 +1,6 @@
// Type definitions for pouchdb-http v5.4.4
// Type definitions for pouchdb-http v6.1.2
// Project: https://pouchdb.com/
// Definitions by: Andy Brown <https://github.com/AGBrown>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions by: Simon Paulger <https://github.com/spaulg>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="pouchdb-core" />

View File

@@ -1,6 +1,6 @@
// Type definitions for pouchdb-adapter-idb v5.4.4
// Type definitions for pouchdb-adapter-idb v6.1.2
// Project: https://pouchdb.com/
// Definitions by: Andy Brown <https://github.com/AGBrown>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions by: Simon Paulger <https://github.com/spaulg>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="pouchdb-core" />

View File

@@ -1,6 +1,6 @@
// Type definitions for pouchdb-adapter-leveldb v5.4.4
// Type definitions for pouchdb-adapter-leveldb v6.1.2
// Project: https://pouchdb.com/
// Definitions by: Andy Brown <https://github.com/AGBrown>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions by: Simon Paulger <https://github.com/spaulg>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="pouchdb-core" />

View File

@@ -1,6 +1,6 @@
// Type definitions for pouchdb-adapter-localstorage v5.4.4
// Type definitions for pouchdb-adapter-localstorage v6.1.2
// Project: https://pouchdb.com/
// Definitions by: Andy Brown <https://github.com/AGBrown>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions by: Simon Paulger <https://github.com/spaulg>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="pouchdb-core" />

View File

@@ -1,6 +1,6 @@
// Type definitions for pouchdb-adapter-memory v5.4.4
// Type definitions for pouchdb-adapter-memory v6.1.2
// Project: https://pouchdb.com/
// Definitions by: Andy Brown <https://github.com/AGBrown>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions by: Simon Paulger <https://github.com/spaulg>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="pouchdb-core" />

View File

@@ -1,6 +1,6 @@
// Type definitions for pouchdb-adapter-node-websql v5.4.4
// Type definitions for pouchdb-adapter-node-websql v6.1.2
// Project: https://pouchdb.com/
// Definitions by: Andy Brown <https://github.com/AGBrown>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions by: Simon Paulger <https://github.com/spaulg>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="pouchdb-core" />

View File

@@ -1,6 +1,6 @@
// Type definitions for pouchdb-adapter-websql v5.4.4
// Type definitions for pouchdb-adapter-websql v6.1.2
// Project: https://pouchdb.com/
// Definitions by: Andy Brown <https://github.com/AGBrown>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions by: Simon Paulger <https://github.com/spaulg>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="pouchdb-core" />

View File

@@ -1,10 +1,11 @@
// Type definitions for pouchdb-browser v5.4.4
// Type definitions for pouchdb-browser v6.1.2
// Project: https://pouchdb.com/
// Definitions by: Andy Brown <https://github.com/AGBrown>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions by: Simon Paulger <https://github.com/spaulg>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="pouchdb-core" />
/// <reference types="pouchdb-adapter-idb" />
/// <reference types="pouchdb-adapter-websql" />
/// <reference types="pouchdb-adapter-http" />
/// <reference types="pouchdb-mapreduce" />
/// <reference types="pouchdb-replication" />

View File

@@ -1,6 +1,6 @@
// Type definitions for pouchdb-core v6.0.7
// Type definitions for pouchdb-core v6.1.2
// Project: https://pouchdb.com/
// Definitions by: Jakub Navratil <https://github.com/trubit>, Andy Brown <https://github.com/AGBrown>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// 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>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -55,6 +55,16 @@ declare namespace PouchDB {
rev: RevisionId;
status: Availability;
}
interface RevisionDiffOptions {
[DocumentId : string]: string[];
}
interface RevisionDiff {
missing?: string[];
possible_ancestors?: string[];
}
interface RevisionDiffResponse {
[DocumentId : string]: RevisionDiff
}
interface IdMeta {
_id: DocumentId;
@@ -206,6 +216,13 @@ declare namespace PouchDB {
new_edits?: boolean;
}
interface BulkGetOptions extends Options {
docs: any,
revs?: boolean,
attachments?: boolean,
binary?: boolean
}
interface ChangesMeta {
_conflicts?: RevisionId[];
_deleted?: boolean;
@@ -320,6 +337,9 @@ declare namespace PouchDB {
/** Return attachment data as Blobs/Buffers, instead of as base64-encoded strings. */
binary?: boolean;
/** Forces retrieving latest “leaf” revision, no matter what rev was requested. */
latest?: boolean;
}
interface GetOpenRevisions extends Options {
@@ -332,7 +352,6 @@ declare namespace PouchDB {
revs?: boolean;
}
/** @todo does this have any other properties? */
interface PutOptions extends Options {
}
interface PostOptions extends PutOptions {
@@ -342,9 +361,6 @@ declare namespace PouchDB {
interval?: number;
}
interface InfoOptions extends Options {
}
interface RemoveAttachmentResponse extends BasicResponse {
rev: Core.RevisionId;
}
@@ -563,8 +579,6 @@ declare namespace PouchDB {
* see inconsistent results.
*/
put(doc: Core.PutDocument<Content>,
id: Core.DocumentId | null,
revision: Core.RevisionId | null,
options: Core.PutOptions | null,
callback: Core.Callback<Core.Error, Core.Response>): void;
@@ -577,8 +591,6 @@ declare namespace PouchDB {
* see inconsistent results.
*/
put(doc: Core.PutDocument<Content>,
id?: Core.DocumentId,
revision?: Core.RevisionId,
options?: Core.PutOptions): Promise<Core.Response>;
/** Remove a doc from the database */
@@ -602,11 +614,10 @@ declare namespace PouchDB {
options?: Core.Options): Promise<Core.Response>;
/** Get database information */
info(options: Core.InfoOptions | null,
callback: Core.Callback<any, Core.DatabaseInfo>): void;
info(callback: Core.Callback<any, Core.DatabaseInfo>): void;
/** Get database information */
info(options?: Core.InfoOptions): Promise<Core.DatabaseInfo>;
info(): Promise<Core.DatabaseInfo>;
/**
* A list of changes made to documents in the database, in the order they were made.
@@ -711,11 +722,18 @@ declare namespace PouchDB {
rev: Core.RevisionId): Promise<Core.RemoveAttachmentResponse>;
/** Given a set of document/revision IDs, returns the document bodies (and, optionally, attachment data) for each ID/revision pair specified. */
bulkGet(options: any,
bulkGet(options: Core.BulkGetOptions,
callback: Core.Callback<any, any>): void;
/** Given a set of document/revision IDs, returns the document bodies (and, optionally, attachment data) for each ID/revision pair specified. */
bulkGet(options: any): Promise<any>;
bulkGet(options: Core.BulkGetOptions): Promise<any>;
/** Given a set of document/revision IDs, returns the subset of those that do not correspond to revisions stored in the database */
revsDiff(diff : Core.RevisionDiffOptions,
callback: Core.Callback<Core.Error, Core.RevisionDiffResponse>): void;
/** Given a set of document/revision IDs, returns the subset of those that do not correspond to revisions stored in the database */
revsDiff(diff : Core.RevisionDiffOptions): Promise<Core.RevisionDiffResponse>;
}
}

View File

@@ -53,6 +53,18 @@ namespace PouchDBCoreTests {
});
}
function testBulkGet() {
const db = new PouchDB<{}>();
db.bulkGet({docs: [{id: 'a', rev: 'b'}, {id: 'b', rev: 'c'}, {id: 'c', rev: 'd'}]}).then((result) => {});
db.bulkGet({docs: [{id: 'a', rev: 'b'}, {id: 'b', rev: 'c'}, {id: 'c', rev: 'd'}]}, (error, response) => {});
}
function testRevsDiff() {
const db = new PouchDB<{}>();
db.revsDiff({'a': ['1-a', '2-b']}).then((result) => {});
db.revsDiff({'a': ['1-a', '2-b']}, (error, response) => {});
}
function testCompact() {
const db = new PouchDB<{}>();
// Promise version
@@ -92,12 +104,12 @@ namespace PouchDBCoreTests {
db.put(model).then((error) => {
});
db.put(model, null, null, null, (error) => {
db.put(model, null, (error) => {
});
db.info().then((info) => {
});
db.info({ ajax: { cache: true }}, (error, result) => {
db.info((error, result) => {
});
PouchDB.debug.enable('*');

View File

@@ -1,6 +1,6 @@
// Type definitions for pouchdb-http v5.4.4
// Type definitions for pouchdb-http v6.1.2
// Project: https://pouchdb.com/
// Definitions by: Andy Brown <https://github.com/AGBrown>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions by: Simon Paulger <https://github.com/spaulg>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="pouchdb-core" />

View File

@@ -1,6 +1,6 @@
// Type definitions for pouchdb-mapreduce v5.4.4
// Type definitions for pouchdb-mapreduce v6.1.2
// Project: https://pouchdb.com/
// Definitions by: Andy Brown <https://github.com/AGBrown>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions by: Simon Paulger <https://github.com/spaulg>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="pouchdb-core" />
@@ -76,7 +76,7 @@ declare namespace PouchDB {
* to take up space on disk. viewCleanup() removes these unnecessary
* index files.
*/
viewCleanup(callback: PouchDB.Core.Callback<any,void>): void;
viewCleanup(callback: PouchDB.Core.Callback<any,Core.BasicResponse>): void;
/**
* Cleans up any stale map/reduce indexes.
*
@@ -85,7 +85,7 @@ declare namespace PouchDB {
* to take up space on disk. viewCleanup() removes these unnecessary
* index files.
*/
viewCleanup(): Promise<void>;
viewCleanup(): Promise<Core.BasicResponse>;
/**
* Invoke a map/reduce function, which allows you to perform more complex queries

View File

@@ -1,6 +1,6 @@
// Type definitions for pouchdb-node v5.4.4
// Type definitions for pouchdb-node v6.1.2
// Project: https://pouchdb.com/
// Definitions by: Andy Brown <https://github.com/AGBrown>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions by: Simon Paulger <https://github.com/spaulg>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="pouchdb-core" />

View File

@@ -1,4 +1,4 @@
// Type definitions for pouchdb-replication v6.0.7
// Type definitions for pouchdb-replication v6.1.2
// Project: https://pouchdb.com/
// Definitions by: Jakub Navratil <https://github.com/trubit>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

View File

@@ -1,4 +1,4 @@
// Type definitions for pouchdb v5.4.4
// Type definitions for pouchdb v6.1.2
// Project: https://pouchdb.com/
// Definitions by: Andy Brown <https://github.com/AGBrown>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

View File

@@ -92,12 +92,12 @@ namespace PouchDBTests {
db.put(model).then((error) => {
});
db.put(model, null, null, null, (error) => {
db.put(model, null, (error) => {
});
db.info().then((info) => {
});
db.info({ ajax: { cache: true }}, (error, result) => {
db.info((error, result) => {
});
db.viewCleanup().catch((error) => {