diff --git a/pouchDB/pouch-tests.ts b/pouchDB/pouch-tests.ts
deleted file mode 100644
index 976a8b0e5f..0000000000
--- a/pouchDB/pouch-tests.ts
+++ /dev/null
@@ -1,142 +0,0 @@
-///
-
-window.alert = function (thing?: string) {
- var div = document.createElement('div');
- div.appendChild(document.createTextNode(thing));
- document.getElementsByTagName('body')[0].appendChild(div);
-}
-
-var pouch: PouchDB;
-
-function pouchTests() {
- new PouchDB('testdb', function (err: PouchError, res: PouchDB) {
- if (err) {
- alert('Error ' + err.status + ' occurred ' + err.error + ' - ' + err.reason);
- }
- else {
- pouch = res;
- alert("database opened");
- runTests();
- }
- });
-}
-
-var tests = [
- setupTests,
- testId,
- testAllDocs,
- testGet,
- testUpdate,
- testDelete,
- deleteDb
-];
-
-var testIndex;
-
-var revs: any = {};
-
-function runTests() {
- testIndex = 0;
- tests[testIndex++]();
-}
-
-// each test function except the last one needs to call nextTest when it is finished doing its thing.
-function nextTest() {
- alert("starting test " + testIndex);
- tests[testIndex++]();
-}
-
-function setupTests() {
- alert('setupTests');
- pouch.bulkDocs({
- docs: [{ _id: '1', name: 'record 1' },
- { _id: '2', name: 'record 2' },
- { _id: '3', name: 'record 3' }
- ]
- }, function (err: PouchError, res: PouchUpdateResponse[]) {
- if (err) {
- alert('Error ' + err.status + ' occurred ' + err.error + ' - ' + err.reason);
- }
- else {
- for (var i = 0; i < res.length; i++) {
- if (res[i].ok) {
- revs[res[i].id] = res[i].rev;
- }
- }
- alert("test records loaded");
- }
- nextTest();
- });
-}
-
-function testId() {
- alert('testId');
- var id = pouch.id();
- alert('Database Id = ' + id);
- nextTest();
-}
-
-function testGet() {
- alert('testGet');
- pouch.get('1', function (err: PouchError, res: PouchGetResponse) {
- if (err) {
- alert('Error ' + err.status + ' occurred ' + err.error + ' - ' + err.reason);
- }
- else {
- alert('Retrieved record with id=1, name=[' + res['name'] + ']');
- }
- nextTest();
- });
-}
-
-function testAllDocs() {
- alert('testAllDocs');
- pouch.allDocs(function (err: PouchError, res: PouchAllDocsResponse) {
- alert('allDocs resulted in ' + res.total_rows + ' results');
- for (var i = 0; i < res.total_rows; i++) {
- alert('Retrieved record with id=' + res.rows[i].id + ', rev=[' + res.rows[i].value.rev + ']');
- }
- nextTest();
- });
-}
-
-function testUpdate() {
- alert('testUpdate');
- pouch.put({ _id: '2', _rev: revs['2'], name: 'record 2 updated' }, function (err: PouchError, res: PouchUpdateResponse) {
- if (err) {
- alert('Error ' + err.status + ' occurred ' + err.error + ' - ' + err.reason);
- }
- else {
- alert('record updated id=' + res.id + ', rev=[' + res.rev + ']');
- }
- testAllDocs(); // spit out the db contents and then go on
- });
-}
-
-function testDelete() {
- alert('testDelete');
- pouch.remove({ _id: '3', _rev: revs['3'] }, function (err: PouchError, res: PouchUpdateResponse) {
- if (err) {
- alert('Error ' + err.status + ' occurred ' + err.error + ' - ' + err.reason);
- }
- else {
- alert('record deleted id=' + res.id + ', rev=[' + res.rev + ']');
- }
- testAllDocs(); // spit out the db contents and then go on
- });
-}
-
-function deleteDb() {
- alert('deleteDb');
- if (pouch) {
- pouch = null;
- PouchDB.destroy('testdb', function (err: PouchError) {
- if (err) {
- alert('Error ' + err.status + ' occurred ' + err.error + ' - ' + err.reason);
- }
- else {
- alert("database destroyed");
- }
- });
- }
-}
diff --git a/pouchDB/pouch-tests.ts.tscparams b/pouchDB/pouch-tests.ts.tscparams
deleted file mode 100644
index 8b13789179..0000000000
--- a/pouchDB/pouch-tests.ts.tscparams
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pouchDB/pouch.d.ts b/pouchDB/pouch.d.ts
deleted file mode 100644
index e601bcaa53..0000000000
--- a/pouchDB/pouch.d.ts
+++ /dev/null
@@ -1,232 +0,0 @@
-// Type definitions for Pouch 0.1
-// Project: http://pouchdb.com
-// Definitions by: Bill Sears
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-
-interface PouchError {
- status: number;
- error: string;
- reason: string;
-}
-
-interface PouchApi {
- type(): string;
- id(): string;
- close(callback: () => void): void;
-}
-
-interface PouchInfoResponse {
- db_name: string;
- doc_count: number;
- update_seq: string;
-}
-
-interface PouchApi {
- info(callback: (err: PouchError, res: PouchInfoResponse) => void): void;
-}
-
-interface PouchGetOptions {
- rev?: string;
- revs?: boolean;
- revs_info?: boolean;
- conflicts?: boolean;
- attachments?: boolean;
-}
-
-interface PouchGetResponse {
- _id: string;
- _rev: string;
- _attachments: any;
-}
-
-interface PouchAllDocsOptions {
- startkey?: string;
- endKey?: string;
- descending?: boolean;
- include_docs?: boolean;
- conflicts?: boolean;
-}
-
-interface PouchAllDocsItem {
- id: string;
- key: string;
- value: any;
- doc: any;
-}
-
-interface PouchAllDocsResponse {
- total_rows: number;
- rows: PouchAllDocsItem[];
-}
-
-interface PouchApi {
- //
- // get == select by id
- //
- get(id: string, opts: PouchGetOptions, callback: (err: PouchError, res: PouchGetResponse) => void): void;
- get(id: string, callback: (err: PouchError, res: PouchGetResponse) => void): void;
- allDocs(opts: PouchAllDocsOptions, callback: (err: PouchError, res: PouchAllDocsResponse) => void): void;
- allDocs(callback: (err: PouchError, res: PouchAllDocsResponse) => void): void;
-}
-
-interface PouchBulkDocsRequest {
- docs: any[];
-}
-
-interface PouchUpdateOptions {
- new_edits?: boolean;
-}
-
-interface PouchUpdateResponse {
- ok: boolean;
- id: string;
- rev: string;
-}
-
-interface PouchApi {
- bulkDocs(req: PouchBulkDocsRequest, opts: PouchUpdateOptions, callback: (err: PouchError, res: PouchUpdateResponse[]) => void): void;
- bulkDocs(req: PouchBulkDocsRequest, callback: (err: PouchError, res: PouchUpdateResponse[]) => void): void;
- //
- // post == insert (doc does not contain an _id)
- //
- post(doc: any, opts: PouchUpdateOptions, callback: (err: PouchError, res: PouchUpdateResponse) => void): void;
- post(doc: any, callback: (err: PouchError, res: PouchUpdateResponse) => void): void;
- //
- // put == update (doc DOES contain an _id)
- //
- put(doc: any, opts: PouchUpdateOptions, callback: (err: PouchError, res: PouchUpdateResponse) => void): void;
- put(doc: any, callback: (err: PouchError, res: PouchUpdateResponse) => void): void;
- //
- // remove == delete
- //
- remove(doc: any, opts: PouchUpdateOptions, callback: (err: PouchError, res: PouchUpdateResponse) => void): void;
- remove(doc: any, callback: (err: PouchError, res: PouchUpdateResponse) => void): void;
-}
-
-interface PouchFilter {
- map: (doc: any) => void;
- reduce?: (key: string, value: any) => any;
-}
-
-interface PouchQueryOptions {
- complete?: any;
- include_docs?: boolean;
- error?: (err: PouchError) => void;
- descending?: boolean;
- reduce?: boolean;
-}
-
-interface PouchQueryResponse {
- rows: any[];
-}
-
-interface PouchApi {
- //
- // query == select by other criteria
- //
- query(fun: string, opts: PouchQueryOptions, callback: (err: PouchError, res: PouchQueryResponse) => void): void;
- query(fun: string, callback: (err: PouchError, res: PouchQueryResponse) => void): void;
- query(fun: PouchFilter, opts: PouchQueryOptions, callback: (err: PouchError, res: PouchQueryResponse) => void): void;
- query(fun: PouchFilter, callback: (err: PouchError, res: PouchQueryResponse) => void): void;
-}
-
-interface PouchAttachmentOptions {
- decode?: boolean;
-}
-
-interface PouchApi {
- getAttachment(id: string, opts: PouchAttachmentOptions, callback: (err: PouchError, res: any) => void): void;
- getAttachment(id: string, callback: (err: PouchError, res: any) => void): void;
- putAttachment(id: string, rev: string, doc: any, type: string, callback: (err: PouchError, res: PouchUpdateResponse) => void): void;
- removeAttachment(id: string, rev: string, callback: (err: PouchError, res: PouchUpdateResponse) => void): void;
-}
-
-interface PouchCancellable {
- cancel: () => void;
-}
-
-interface PouchChangesOptions {
- onChange: (change: PouchChange) => void;
- complete?: (err: PouchError, res: PouchChanges) => void;
- seq?: number;
- since?: number;
- descending?: boolean;
- filter?: PouchFilter;
- continuous?: boolean;
- include_docs?: boolean;
- conflicts?: boolean;
-}
-
-interface PouchChange {
- changes: any;
- doc: PouchGetResponse;
- id: string;
- seq: number;
-}
-
-interface PouchChanges {
- results: PouchChange[];
-}
-
-interface PouchApi {
- changes(opts: PouchChangesOptions, callback: (err: PouchError, res: PouchChanges) => void): PouchCancellable;
- changes(callback: (err: PouchError, res: PouchChanges) => void): PouchCancellable;
-}
-
-interface PouchRevsDiffOptions {
-}
-
-interface PouchReplicateOptions {
- continuous?: boolean;
- onChange?: (e: any) => void;
- filter?: any; // Can be either string or PouchFilter
- complete?: (err: PouchError, res: PouchChanges) => void;
-}
-
-interface PouchReplicateResponse {
- ok: boolean;
- start_time: Date;
- end_time: Date;
- docs_read: number;
- docs_written: number;
-}
-
-interface PouchReplicate {
- from(url: string, opts: PouchReplicateOptions, callback: (err: PouchError, res: PouchReplicateResponse) => void): PouchCancellable;
- from(url: string, callback: (err: PouchError, res: PouchReplicateResponse) => void): PouchCancellable;
- to(dbName: string, opts: PouchReplicateOptions, callback: (err: PouchError, res: PouchReplicateResponse) => void): PouchCancellable;
- to(dbName: string, callback: (err: PouchError, res: PouchReplicateResponse) => void): PouchCancellable;
-}
-
-interface PouchApi {
- revsDiff(req: any, opts: PouchRevsDiffOptions, callback: (missing: any) => void): void;
- revsDiff(req: any, callback: (missing: any) => void): void;
- replicate: PouchReplicate;
-}
-
-interface PouchOptions {
- name?: string;
- adapter?: string;
- skip_setup?: boolean;
-}
-
-interface PouchDB extends PouchApi {
- new (name: string, opts: PouchOptions, callback: (err: PouchError, res: PouchDB) => void): PouchDB;
- new (name: string, callback: (err: PouchError, res: PouchDB) => void): PouchDB;
- new (name: string, opts: PouchOptions): PouchDB;
- new (name: string): PouchDB;
- destroy(name: string, callback: (err: PouchError) => void): void;
-}
-
-declare var PouchDB: PouchDB;
-
-// Support AMD require
-declare module 'pouchdb' {
- export = PouchDB;
-}
-
-//
-// emit is the function that the PouchFilter.map function should call in order to add a particular item to
-// a filter view.
-//
-declare function emit(key: any, value: any): void;
diff --git a/pouchDB/pouch.d.ts.tscparams b/pouchDB/pouch.d.ts.tscparams
deleted file mode 100644
index 8b13789179..0000000000
--- a/pouchDB/pouch.d.ts.tscparams
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pouchdb-adapter-fruitdown/pouchdb-adapter-fruitdown-tests.ts b/pouchdb-adapter-fruitdown/pouchdb-adapter-fruitdown-tests.ts
new file mode 100644
index 0000000000..ee6f70c59b
--- /dev/null
+++ b/pouchdb-adapter-fruitdown/pouchdb-adapter-fruitdown-tests.ts
@@ -0,0 +1,18 @@
+///
+///
+
+namespace PouchDBAdapterFruitdownTests {
+ function testConstructor() {
+ type MyModel = { numericProperty: number };
+ let model: PouchDB.Core.Document;
+
+ let db = new PouchDB(null, {
+ adapter: 'fruitdown',
+ });
+ db.get('model').then((result) => model);
+ db = new PouchDB('myDb', {
+ adapter: 'fruitdown',
+ });
+ db.get('model').then((result) => model);
+ }
+}
diff --git a/pouchdb-adapter-fruitdown/pouchdb-adapter-fruitdown.d.ts b/pouchdb-adapter-fruitdown/pouchdb-adapter-fruitdown.d.ts
new file mode 100644
index 0000000000..e818121543
--- /dev/null
+++ b/pouchdb-adapter-fruitdown/pouchdb-adapter-fruitdown.d.ts
@@ -0,0 +1,26 @@
+// Type definitions for pouchdb-adapter-fruitdown v5.4.4
+// Project: https://pouchdb.com/
+// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare namespace PouchDB {
+ namespace FruitDOWNAdapter {
+ interface FruitDOWNAdapterConfiguration
+ extends Configuration.LocalDatabaseConfiguration {
+ adapter: 'fruitdown';
+ }
+ }
+
+ interface Static {
+ new(name: string | void,
+ options: FruitDOWNAdapter.FruitDOWNAdapterConfiguration
+ ): Database;
+ }
+}
+
+declare module 'pouchdb-adapter-fruitdown' {
+ const plugin: PouchDB.Plugin;
+ export = plugin;
+}
diff --git a/pouchdb-adapter-http/pouchdb-adapter-http-tests.ts b/pouchdb-adapter-http/pouchdb-adapter-http-tests.ts
new file mode 100644
index 0000000000..bbd1b5ec69
--- /dev/null
+++ b/pouchdb-adapter-http/pouchdb-adapter-http-tests.ts
@@ -0,0 +1,8 @@
+///
+///
+
+function testHttpDbCreation() {
+ const basicDB = new PouchDB('basic', {
+ adapter: 'http'
+ });
+}
diff --git a/pouchdb-adapter-http/pouchdb-adapter-http.d.ts b/pouchdb-adapter-http/pouchdb-adapter-http.d.ts
new file mode 100644
index 0000000000..f1a535be5e
--- /dev/null
+++ b/pouchdb-adapter-http/pouchdb-adapter-http.d.ts
@@ -0,0 +1,26 @@
+// Type definitions for pouchdb-http v5.4.4
+// Project: https://pouchdb.com/
+// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare namespace PouchDB {
+ namespace HttpAdapter {
+ interface HttpAdapterConfiguration
+ extends Configuration.RemoteDatabaseConfiguration {
+ adapter: 'http';
+ }
+ }
+
+ interface Static {
+ new(name: string | void,
+ options: HttpAdapter.HttpAdapterConfiguration
+ ): Database;
+ }
+}
+
+declare module 'pouchdb-adapter-http' {
+ const plugin: PouchDB.Plugin;
+ export = plugin;
+}
diff --git a/pouchdb-adapter-idb/pouchdb-adapter-idb-tests.ts b/pouchdb-adapter-idb/pouchdb-adapter-idb-tests.ts
new file mode 100644
index 0000000000..2256bfc6bc
--- /dev/null
+++ b/pouchdb-adapter-idb/pouchdb-adapter-idb-tests.ts
@@ -0,0 +1,16 @@
+///
+///
+
+function testIdbDbCreation() {
+ const basicDB = new PouchDB('basic', {
+ adapter: 'idb'
+ });
+ const persistentDb = new PouchDB('persistent', {
+ adapter: 'idb',
+ storage: 'persistent'
+ });
+ const temporaryDb = new PouchDB('temporary', {
+ adapter: 'idb',
+ storage: 'temporary'
+ });
+}
diff --git a/pouchdb-adapter-idb/pouchdb-adapter-idb.d.ts b/pouchdb-adapter-idb/pouchdb-adapter-idb.d.ts
new file mode 100644
index 0000000000..34e75f6bdf
--- /dev/null
+++ b/pouchdb-adapter-idb/pouchdb-adapter-idb.d.ts
@@ -0,0 +1,38 @@
+// Type definitions for pouchdb-adapter-idb v5.4.4
+// Project: https://pouchdb.com/
+// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare namespace PouchDB {
+ namespace Core {
+ interface DatabaseInfo {
+ idb_attachment_format?: 'base64' | 'binary';
+ }
+ }
+
+ namespace IdbAdapter {
+ interface IdbAdapterConfiguration
+ extends Configuration.LocalDatabaseConfiguration {
+ /**
+ * Configures storage persistence.
+ *
+ * Only works in Firefox 26+.
+ */
+ storage?: 'persistent' | 'temporary';
+ adapter: 'idb';
+ }
+ }
+
+ interface Static {
+ new(name: string | void,
+ options: IdbAdapter.IdbAdapterConfiguration
+ ): Database;
+ }
+}
+
+declare module 'pouchdb-adapter-idb' {
+ const plugin: PouchDB.Plugin;
+ export = plugin;
+}
diff --git a/pouchdb-adapter-leveldb/pouchdb-adapter-leveldb-tests.ts b/pouchdb-adapter-leveldb/pouchdb-adapter-leveldb-tests.ts
new file mode 100644
index 0000000000..a9a66df854
--- /dev/null
+++ b/pouchdb-adapter-leveldb/pouchdb-adapter-leveldb-tests.ts
@@ -0,0 +1,15 @@
+///
+///
+
+namespace PouchDBAdapterLevelDBTests {
+ function testConstructor() {
+ type MyModel = { numericProperty: number };
+
+ let db = new PouchDB(null, {
+ adapter: 'leveldb',
+ });
+ db = new PouchDB('myDb', {
+ adapter: 'leveldb',
+ });
+ }
+}
diff --git a/pouchdb-adapter-leveldb/pouchdb-adapter-leveldb.d.ts b/pouchdb-adapter-leveldb/pouchdb-adapter-leveldb.d.ts
new file mode 100644
index 0000000000..fcdaaea65b
--- /dev/null
+++ b/pouchdb-adapter-leveldb/pouchdb-adapter-leveldb.d.ts
@@ -0,0 +1,25 @@
+// Type definitions for pouchdb-adapter-leveldb v5.4.4
+// Project: https://pouchdb.com/
+// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare namespace PouchDB {
+ namespace LevelDbAdapter {
+ interface LevelDbAdapterConfiguration extends Configuration.LocalDatabaseConfiguration {
+ adapter: 'leveldb';
+ }
+ }
+
+ interface Static {
+ new(name: string | void,
+ options: LevelDbAdapter.LevelDbAdapterConfiguration
+ ): Database;
+ }
+}
+
+declare module 'pouchdb-adapter-leveldb' {
+ const plugin: PouchDB.Plugin;
+ export = plugin;
+}
diff --git a/pouchdb-adapter-localstorage/pouchdb-adapter-localstorage-tests.ts b/pouchdb-adapter-localstorage/pouchdb-adapter-localstorage-tests.ts
new file mode 100644
index 0000000000..06fe1f9a0b
--- /dev/null
+++ b/pouchdb-adapter-localstorage/pouchdb-adapter-localstorage-tests.ts
@@ -0,0 +1,15 @@
+///
+///
+
+namespace PouchDBAdapterLocalStorageyTests {
+ function testConstructor() {
+ type MyModel = { numericProperty: number };
+
+ let db = new PouchDB(null, {
+ adapter: 'localstorage',
+ });
+ db = new PouchDB('myDb', {
+ adapter: 'localstorage',
+ });
+ }
+}
diff --git a/pouchdb-adapter-localstorage/pouchdb-adapter-localstorage.d.ts b/pouchdb-adapter-localstorage/pouchdb-adapter-localstorage.d.ts
new file mode 100644
index 0000000000..92f9b17752
--- /dev/null
+++ b/pouchdb-adapter-localstorage/pouchdb-adapter-localstorage.d.ts
@@ -0,0 +1,26 @@
+// Type definitions for pouchdb-adapter-localstorage v5.4.4
+// Project: https://pouchdb.com/
+// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare namespace PouchDB {
+ namespace LocalStorageAdapter {
+ interface LocalStorageAdapterConfiguration
+ extends Configuration.LocalDatabaseConfiguration {
+ adapter: 'localstorage';
+ }
+ }
+
+ interface Static {
+ new(name: string | void,
+ options: LocalStorageAdapter.LocalStorageAdapterConfiguration
+ ): Database;
+ }
+}
+
+declare module 'pouchdb-adapter-localstorage' {
+ const plugin: PouchDB.Plugin;
+ export = plugin;
+}
diff --git a/pouchdb-adapter-memory/pouchdb-adapter-memory-tests.ts b/pouchdb-adapter-memory/pouchdb-adapter-memory-tests.ts
new file mode 100644
index 0000000000..b234915648
--- /dev/null
+++ b/pouchdb-adapter-memory/pouchdb-adapter-memory-tests.ts
@@ -0,0 +1,15 @@
+///
+///
+
+namespace PouchDBAdapterMemoryTests {
+ function testConstructor() {
+ type MyModel = { numericProperty: number };
+
+ let db = new PouchDB(null, {
+ adapter: 'memory',
+ });
+ db = new PouchDB('myDb', {
+ adapter: 'memory',
+ });
+ }
+}
diff --git a/pouchdb-adapter-memory/pouchdb-adapter-memory.d.ts b/pouchdb-adapter-memory/pouchdb-adapter-memory.d.ts
new file mode 100644
index 0000000000..75c89509ba
--- /dev/null
+++ b/pouchdb-adapter-memory/pouchdb-adapter-memory.d.ts
@@ -0,0 +1,26 @@
+// Type definitions for pouchdb-adapter-memory v5.4.4
+// Project: https://pouchdb.com/
+// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare namespace PouchDB {
+ namespace MemoryAdapter {
+ interface MemoryAdapterConfiguration
+ extends Configuration.LocalDatabaseConfiguration {
+ adapter: 'memory';
+ }
+ }
+
+ interface Static {
+ new(name: string | void,
+ options: MemoryAdapter.MemoryAdapterConfiguration
+ ): Database;
+ }
+}
+
+declare module 'pouchdb-adapter-memory' {
+ const plugin: PouchDB.Plugin;
+ export = plugin;
+}
diff --git a/pouchdb-adapter-node-websql/pouchdb-adapter-node-websql-tests.ts b/pouchdb-adapter-node-websql/pouchdb-adapter-node-websql-tests.ts
new file mode 100644
index 0000000000..4f751d3395
--- /dev/null
+++ b/pouchdb-adapter-node-websql/pouchdb-adapter-node-websql-tests.ts
@@ -0,0 +1,28 @@
+///
+///
+
+namespace PouchDBAdapterNodeWebSQLTests {
+ function isBoolean(someBoolean: boolean) {
+ }
+ function isNumber(someNumber: number) {
+ }
+ function isString(someString: string) {
+ }
+
+ function testConstructor() {
+ type MyModel = { numericProperty: number };
+
+ let db = new PouchDB(null, {
+ adapter: 'websql',
+ size: 5,
+ });
+ db = new PouchDB('myDb', {
+ adapter: 'websql',
+ });
+
+ db.info().then((info) => {
+ isBoolean(info.sqlite_plugin);
+ isString(info.websql_encoding);
+ });
+ }
+}
diff --git a/pouchdb-adapter-node-websql/pouchdb-adapter-node-websql.d.ts b/pouchdb-adapter-node-websql/pouchdb-adapter-node-websql.d.ts
new file mode 100644
index 0000000000..57a0407a5e
--- /dev/null
+++ b/pouchdb-adapter-node-websql/pouchdb-adapter-node-websql.d.ts
@@ -0,0 +1,12 @@
+// Type definitions for pouchdb-adapter-node-websql v5.4.4
+// Project: https://pouchdb.com/
+// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+///
+
+declare module 'pouchdb-adapter-node-websql' {
+ const plugin: PouchDB.Plugin;
+ export = plugin;
+}
diff --git a/pouchdb-adapter-websql/pouchdb-adapter-websql-tests.ts b/pouchdb-adapter-websql/pouchdb-adapter-websql-tests.ts
new file mode 100644
index 0000000000..1c0242a17c
--- /dev/null
+++ b/pouchdb-adapter-websql/pouchdb-adapter-websql-tests.ts
@@ -0,0 +1,29 @@
+///
+///
+
+namespace PouchDBAdapterWebSQLTests {
+ function isBoolean(someBoolean: boolean) {
+ }
+ function isNumber(someNumber: number) {
+ }
+ function isString(someString: string) {
+ }
+
+ function testConstructor() {
+ type MyModel = { numericProperty: number };
+
+ let db = new PouchDB('basic');
+ db = new PouchDB(null, {
+ adapter: 'websql'
+ });
+ db = new PouchDB('sized', {
+ adapter: 'websql',
+ size: 10
+ });
+
+ db.info().then((info) => {
+ isBoolean(info.sqlite_plugin);
+ isString(info.websql_encoding);
+ });
+ }
+}
diff --git a/pouchdb-adapter-websql/pouchdb-adapter-websql.d.ts b/pouchdb-adapter-websql/pouchdb-adapter-websql.d.ts
new file mode 100644
index 0000000000..64b732d482
--- /dev/null
+++ b/pouchdb-adapter-websql/pouchdb-adapter-websql.d.ts
@@ -0,0 +1,36 @@
+// Type definitions for pouchdb-adapter-websql v5.4.4
+// Project: https://pouchdb.com/
+// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare namespace PouchDB {
+ namespace Core {
+ interface DatabaseInfo {
+ sqlite_plugin?: boolean;
+ websql_encoding?: 'UTF-8' | 'UTF-16';
+ }
+ }
+
+ namespace AdapterWebSql {
+ interface Configuration
+ extends Configuration.LocalDatabaseConfiguration {
+ /**
+ * Amount in MB to request for storage.
+ */
+ size?: number;
+ adapter: 'websql';
+ }
+ }
+
+ interface Static {
+ new(name: string | void,
+ options: AdapterWebSql.Configuration): Database;
+ }
+}
+
+declare module 'pouchdb-adapter-websql' {
+ const plugin: PouchDB.Plugin;
+ export = plugin;
+}
diff --git a/pouchdb-browser/pouchdb-browser-tests.ts b/pouchdb-browser/pouchdb-browser-tests.ts
new file mode 100644
index 0000000000..82575efada
--- /dev/null
+++ b/pouchdb-browser/pouchdb-browser-tests.ts
@@ -0,0 +1,19 @@
+///
+///
+
+namespace PouchDBBrowserTests {
+ function testConstructor() {
+ type MyModel = { numericProperty: number };
+ let model: PouchDB.Core.Document;
+
+ let db = new PouchDB(null, {
+ adapter: 'idb',
+ });
+ db = new PouchDB('myDb', {
+ adapter: 'http',
+ });
+ db.get('model').then((result) => model);
+ db.viewCleanup().catch((error) => {
+ });
+ }
+}
diff --git a/pouchdb-browser/pouchdb-browser.d.ts b/pouchdb-browser/pouchdb-browser.d.ts
new file mode 100644
index 0000000000..3fb6dc9f2e
--- /dev/null
+++ b/pouchdb-browser/pouchdb-browser.d.ts
@@ -0,0 +1,15 @@
+// Type definitions for pouchdb-browser v5.4.4
+// Project: https://pouchdb.com/
+// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+///
+///
+///
+///
+
+declare module 'pouchdb-browser' {
+ const PouchDb: PouchDB.Static;
+ export = PouchDb;
+}
diff --git a/pouchdb-core/pouchdb-core-tests.ts b/pouchdb-core/pouchdb-core-tests.ts
new file mode 100644
index 0000000000..ac7a6c3e69
--- /dev/null
+++ b/pouchdb-core/pouchdb-core-tests.ts
@@ -0,0 +1,78 @@
+///
+
+namespace PouchDBCoreTests {
+ function isString(someString: string) {
+ }
+ function isNumber(someNumber: number) {
+ }
+
+ function testAllDocs() {
+ const db = new PouchDB<{ foo: number }>();
+
+ db.allDocs().then(({ offset, total_rows, rows }) => {
+ isNumber(offset);
+ isNumber(total_rows);
+
+ rows.forEach(({ id, key, value, doc }) => {
+ isString(id);
+ isString(key);
+ isString(value.rev);
+
+ // check document property
+ isNumber(doc.foo);
+ })
+ });
+
+ db.allDocs({ startkey: "a", endkey: "b" });
+ db.allDocs({ startkey: "a", endkey: "b", inclusive_end: true });
+ db.allDocs({ keys: ["a", "b", "c" ]});
+ db.allDocs({ key: "a" });
+ db.allDocs({
+ attachments: true,
+ binary: true,
+ conflicts: true,
+ descending: true,
+ include_docs: true,
+ limit: 5,
+ skip: 1
+ });
+ }
+
+ function testDestroy() {
+ const db = new PouchDB<{}>();
+
+ db.destroy({}, (error) => {
+ });
+ db.destroy().then(() => {
+ }).catch((error) => {
+ });
+ }
+
+ function testBasics() {
+ type MyModel = { property: 'someProperty '};
+ let model: PouchDB.Core.Document;
+ const id = 'model';
+
+ const db = new PouchDB();
+
+ db.post(model).then((result) => {
+ isString(result.id);
+ });
+ db.post(model, null, (error, response) => {
+ });
+
+ db.get(id).then((result) => model = result);
+ db.get(id, null, (error, result) => {
+ });
+
+ db.put(model).then((error) => {
+ });
+ db.put(model, null, null, null, (error) => {
+ });
+
+ db.info().then((info) => {
+ });
+ db.info({ ajax: { cache: true }}, (error, result) => {
+ });
+ }
+}
diff --git a/pouchdb-core/pouchdb-core.d.ts b/pouchdb-core/pouchdb-core.d.ts
new file mode 100644
index 0000000000..a8b6418510
--- /dev/null
+++ b/pouchdb-core/pouchdb-core.d.ts
@@ -0,0 +1,334 @@
+// Type definitions for pouchdb-core v5.4.4
+// Project: https://pouchdb.com/
+// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare namespace PouchDB {
+ namespace Core {
+ interface Error {
+ }
+ interface Callback {
+ (error: E | void, result: R | void): void;
+ }
+ type AnyCallback = Callback;
+ type DocumentId = string;
+ type DocumentKey = string;
+ type RevisionId = string;
+ type Availability = 'available' | 'compacted' | 'not compacted' | 'missing';
+ type Attachment = string | ArrayBuffer;
+ type Encodable = { [propertyName: string]: any };
+
+ interface Options {
+ ajax?: Configuration.RemoteRequesterConfiguration;
+ }
+
+ interface BasicResponse {
+ /** `true` if the operation was successful; `false` otherwise */
+ ok: boolean;
+ }
+ interface Response extends BasicResponse {
+ /** id of the targeted document */
+ id: DocumentId;
+ /** resulting revision of the targeted document */
+ rev: RevisionId;
+ }
+
+ interface DatabaseInfo {
+ }
+
+ interface Revision {
+ ok: Document & RevisionIdMeta;
+ }
+ interface RevisionInfo {
+ rev: RevisionId;
+ status: Availability;
+ }
+
+ interface IdMeta {
+ _id: DocumentId;
+ }
+ interface RevisionIdMeta {
+ _rev: RevisionId;
+ }
+ interface GetMeta {
+ /** Conflicting leaf revisions.
+ *
+ * Only present if `GetOptions.conflicts` is `true`
+ */
+ _conflicts?: RevisionId[];
+ _rev?: RevisionId;
+ /** Only present if `GetOptions.revs` is `true` */
+ _revs_info?: RevisionInfo[];
+ /** Only present if `GetOptions.revs_info` is `true` */
+ _revisions?: {
+ ids: RevisionId[];
+ start: number;
+ }
+ }
+ type NewDocument = Content;
+ type Document = Content & IdMeta;
+ type ExistingDocument =
+ Document & RevisionIdMeta;
+
+ interface AllDocsOptions extends Options {
+ /** Include attachment data for each document.
+ *
+ * Requires `include_docs` to be `true`.
+ *
+ * By default, attachments are Base64-encoded.
+ * @see binary
+ */
+ attachments?: boolean;
+ /** Return attachments as Buffers.
+ *
+ * Requires `include_docs` to be `true`.
+ * Requires `attachments` to be `true`. */
+ binary?: boolean;
+ /** Include conflict information for each document.
+ *
+ * Requires `include_docs` to be `true`. */
+ conflicts?: boolean;
+ /** Reverse ordering of results. */
+ descending?: boolean;
+ /** Include contents for each document. */
+ include_docs?: boolean;
+ /** Maximum number of documents to return. */
+ limit?: number;
+ /** Number of documents to skip before returning.
+ *
+ * Causes poor performance on IndexedDB and LevelDB. */
+ skip?: number;
+ }
+ interface AllDocsWithKeyOptions extends AllDocsOptions {
+ /** Constrain results to documents matching this key. */
+ key: DocumentKey;
+ }
+ interface AllDocsWithKeysOptions extends AllDocsOptions {
+ /** Constrains results to documents matching any of these keys. */
+ keys: DocumentId[];
+ }
+ interface AllDocsWithinRangeOptions extends AllDocsOptions {
+ /** Low end of range, or high end if `descending` is `true`. */
+ startkey: DocumentKey;
+ /** High end of range, or low end if `descending` is `true`. */
+ endkey: DocumentKey;
+ /** Include any documents identified by `endkey`.
+ *
+ * Defaults to `true`. */
+ inclusive_end?: boolean;
+ }
+ interface AllDocsMeta {
+ _attachments?: {
+ [attachmentId: string]: Attachment;
+ };
+ }
+ interface AllDocsResponse {
+ /** The `skip` if provided, or in CouchDB the actual offset */
+ offset: number;
+ total_rows: number;
+ rows: {
+ /** Only present if `include_docs` was `true`. */
+ doc?: Document;
+ id: DocumentId;
+ key: DocumentKey;
+ value: {
+ rev: RevisionId;
+ }
+ }[];
+ }
+
+ interface DestroyOptions extends Options {
+ }
+
+ interface GetOptions extends Options {
+ /** Include list of conflicting leaf revisions. */
+ conflicts?: boolean;
+ /** Specific revision to fetch */
+ rev?: RevisionId;
+ /** Include revision history of the document. */
+ revs?: boolean;
+ /** Include a list of revisions of the document, and their
+ * availability. */
+ revs_info?: boolean;
+ }
+ interface GetOpenRevisions extends Options {
+ /** Fetch all leaf revisions if open_revs="all" or fetch all leaf
+ * revisions specified in open_revs array. Leaves will be returned
+ * in the same order as specified in input array. */
+ open_revs: 'all' | Core.RevisionId[];
+ }
+
+ /** @todo does this have any other properties? */
+ interface PutOptions extends Options {
+ }
+ interface PostOptions extends PutOptions {
+ }
+
+ interface InfoOptions extends Options {
+ }
+ }
+
+ /**
+ * Pass this to `PouchDB.plugin()`.
+ */
+ export type Plugin = 'This should be passed to PouchDB.plugin()';
+
+ namespace Configuration {
+ interface CommonDatabaseConfiguration {
+ /**
+ * Database name.
+ */
+ name?: string;
+ /**
+ * Database adapter to use.
+ *
+ * If unspecified, PouchDB will infer this automatically, preferring
+ * IndexedDB to WebSQL in browsers that support both (i.e. Chrome,
+ * Opera and Android 4.4+).
+ */
+ adapter?: string;
+ }
+
+ interface LocalDatabaseConfiguration extends CommonDatabaseConfiguration {
+ /**
+ * Enables auto compaction, which means compact() is called after
+ * every change to the database.
+ *
+ * Defaults to false.
+ */
+ auto_compaction?: boolean;
+ /**
+ * How many old revisions we keep track (not a copy) of.
+ */
+ revs_limit?: number;
+ }
+
+ interface RemoteRequesterConfiguration {
+ /**
+ * Time before HTTP requests time out (in ms).
+ */
+ timeout?: number;
+ /**
+ * Appends a random string to the end of all HTTP GET requests to avoid
+ * them being cached on IE. Set this to true to prevent this happening.
+ */
+ cache?: boolean;
+ /**
+ * HTTP headers to add to requests.
+ */
+ headers?: {
+ [name: string]: string;
+ }
+ username?: string;
+ password?: string;
+ /**
+ * Enables transferring cookies and HTTP Authorization information.
+ *
+ * Defaults to true.
+ */
+ withCredentials?: boolean;
+ /**
+ * Disables automatic creation of databases.
+ */
+ skip_setup?: boolean;
+ }
+
+ interface RemoteDatabaseConfiguration extends CommonDatabaseConfiguration {
+ ajax?: RemoteRequesterConfiguration;
+ }
+
+ type DatabaseConfiguration = LocalDatabaseConfiguration |
+ RemoteDatabaseConfiguration;
+ }
+
+
+
+ interface Static {
+ plugin(plugin: Plugin): Static;
+
+ new(name?: string,
+ options?: Configuration.DatabaseConfiguration): Database;
+ }
+
+ interface Database {
+ /** Fetch all documents matching the given key. */
+ allDocs(options: Core.AllDocsWithKeyOptions):
+ Promise>;
+ /** Fetch all documents matching any of the given keys. */
+ allDocs(options: Core.AllDocsWithKeysOptions):
+ Promise>;
+ /** Fetch all documents matching the given key range. */
+ allDocs(options: Core.AllDocsWithinRangeOptions):
+ Promise>;
+ /** Fetch all documents. */
+ allDocs(options?: Core.AllDocsOptions):
+ Promise>;
+
+ /** Destroy the database */
+ destroy(options: Core.DestroyOptions | void,
+ callback: Core.AnyCallback): void;
+ destroy(options?: Core.DestroyOptions | void): Promise;
+
+ /** Fetch a document */
+ get(docId: Core.DocumentId,
+ options: Core.GetOpenRevisions): Promise[]>;
+ get(docId: Core.DocumentId,
+ options: Core.GetOpenRevisions,
+ callback: Core.Callback[]>): void;
+ get(docId: Core.DocumentId,
+ options: Core.GetOptions
+ ): Promise & Core.GetMeta>;
+ get(docId: Core.DocumentId,
+ options: Core.GetOptions,
+ callback: Core.Callback & Core.GetMeta>
+ ): void;
+ get(docId: Core.DocumentId,
+ options: void,
+ callback: Core.Callback>): void;
+ get(docId: Core.DocumentId): Promise>;
+
+ /** Create a new document without providing an id.
+ *
+ * You should prefer put() to post(), because when you post(), you are
+ * missing an opportunity to use allDocs() to sort documents by _id
+ * (because your _ids are random).
+ *
+ * @see {@link https://pouchdb.com/2014/06/17/12-pro-tips-for-better-code-with-pouchdb.html|PouchDB Pro Tips}
+ * */
+ post(doc: Core.NewDocument,
+ options: Core.PostOptions | void,
+ callback: Core.Callback): void;
+ post(doc: Core.NewDocument,
+ options?: Core.PostOptions): Promise;
+
+ /** Create a new document or update an existing document.
+ *
+ * If the document already exists, you must specify its revision _rev,
+ * otherwise a conflict will occur.
+ * There are some restrictions on valid property names of the documents.
+ * If you try to store non-JSON data (for instance Date objects) you may
+ * see inconsistent results. */
+ put(doc: Core.Document,
+ id: Core.DocumentId | void,
+ revision: Core.RevisionId | void,
+ options: Core.PutOptions | void,
+ callback: Core.Callback): void;
+ put(doc: Core.Document,
+ id?: Core.DocumentId,
+ revision?: Core.RevisionId,
+ options?: Core.PutOptions): Promise;
+
+ /** Get database information */
+ info(options: Core.InfoOptions | void,
+ callback: Core.Callback): void;
+ info(options?: Core.InfoOptions): Promise;
+ }
+}
+
+declare module 'pouchdb-core' {
+ const PouchDb: PouchDB.Static;
+ export = PouchDb;
+}
+
+declare var PouchDB: PouchDB.Static;
diff --git a/pouchdb-http/pouchdb-http-tests.ts b/pouchdb-http/pouchdb-http-tests.ts
new file mode 100644
index 0000000000..b3378e68b1
--- /dev/null
+++ b/pouchdb-http/pouchdb-http-tests.ts
@@ -0,0 +1,14 @@
+///
+///
+
+namespace PouchDBHttpTests {
+ function testConstructor() {
+ type MyModel = { numericProperty: number };
+ let model: PouchDB.Core.Document;
+
+ let db = new PouchDB('myDb', {
+ adapter: 'http',
+ });
+ db.get('model').then((result) => model);
+ }
+}
diff --git a/pouchdb-http/pouchdb-http.d.ts b/pouchdb-http/pouchdb-http.d.ts
new file mode 100644
index 0000000000..0fb6d2963c
--- /dev/null
+++ b/pouchdb-http/pouchdb-http.d.ts
@@ -0,0 +1,12 @@
+// Type definitions for pouchdb-http v5.4.4
+// Project: https://pouchdb.com/
+// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+///
+
+declare module 'pouchdb-http' {
+ const PouchDb: PouchDB.Static;
+ export = PouchDb;
+}
diff --git a/pouchdb-mapreduce/pouchdb-mapreduce-tests.ts b/pouchdb-mapreduce/pouchdb-mapreduce-tests.ts
new file mode 100644
index 0000000000..a42f8178ee
--- /dev/null
+++ b/pouchdb-mapreduce/pouchdb-mapreduce-tests.ts
@@ -0,0 +1,12 @@
+///
+
+namespace PouchDBBrowserTests {
+ function testConstructor() {
+ type MyModel = { numericProperty: number };
+ let model: PouchDB.Core.Document;
+
+ let db = new PouchDB('mydb');
+ db.viewCleanup().catch((error) => {
+ });
+ }
+}
diff --git a/pouchdb-mapreduce/pouchdb-mapreduce.d.ts b/pouchdb-mapreduce/pouchdb-mapreduce.d.ts
new file mode 100644
index 0000000000..1c04ddceaf
--- /dev/null
+++ b/pouchdb-mapreduce/pouchdb-mapreduce.d.ts
@@ -0,0 +1,26 @@
+// Type definitions for pouchdb-mapreduce v5.4.4
+// Project: https://pouchdb.com/
+// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare namespace PouchDB {
+ export interface Database {
+ /**
+ * Cleans up any stale map/reduce indexes.
+ *
+ * As design docs are deleted or modified, their associated index
+ * files(in CouchDB) or companion databases (in local PouchDBs) continue
+ * to take up space on disk. viewCleanup() removes these unnecessary
+ * index files.
+ */
+ viewCleanup(callback: PouchDB.Core.Callback): void;
+ viewCleanup(): Promise;
+ }
+}
+
+declare module 'pouchdb-adapter-mapreduce' {
+ const plugin: PouchDB.Plugin;
+ export = plugin;
+}
diff --git a/pouchdb-node/pouchdb-node-tests.ts b/pouchdb-node/pouchdb-node-tests.ts
new file mode 100644
index 0000000000..ec9c338092
--- /dev/null
+++ b/pouchdb-node/pouchdb-node-tests.ts
@@ -0,0 +1,19 @@
+///
+///
+
+namespace PouchDBBrowserTests {
+ function testConstructor() {
+ type MyModel = { numericProperty: number };
+ let model: PouchDB.Core.Document;
+
+ let db = new PouchDB('myDb', {
+ adapter: 'http',
+ });
+ db = new PouchDB('myDb', {
+ adapter: 'leveldb',
+ });
+ db.get('model').then((result) => model);
+ db.viewCleanup().catch((error) => {
+ });
+ }
+}
diff --git a/pouchdb-node/pouchdb-node.d.ts b/pouchdb-node/pouchdb-node.d.ts
new file mode 100644
index 0000000000..deac5a0140
--- /dev/null
+++ b/pouchdb-node/pouchdb-node.d.ts
@@ -0,0 +1,24 @@
+// Type definitions for pouchdb-node v5.4.4
+// Project: https://pouchdb.com/
+// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+///
+///
+///
+///
+
+declare namespace PouchDB {
+ namespace Core {
+ interface DatabaseInfo {
+ /** The backend *DOWN adapter being used (MemDOWN, RiakDOWN, …). */
+ backend_adapter?: string;
+ }
+ }
+}
+
+declare module 'pouchdb-node' {
+ const PouchDb: PouchDB.Static;
+ export = PouchDb;
+}
diff --git a/pouchdb-replication/pouchdb-replication-tests.ts b/pouchdb-replication/pouchdb-replication-tests.ts
new file mode 100644
index 0000000000..4e51bdea95
--- /dev/null
+++ b/pouchdb-replication/pouchdb-replication-tests.ts
@@ -0,0 +1 @@
+///
diff --git a/pouchdb-replication/pouchdb-replication.d.ts b/pouchdb-replication/pouchdb-replication.d.ts
new file mode 100644
index 0000000000..3dddb04f85
--- /dev/null
+++ b/pouchdb-replication/pouchdb-replication.d.ts
@@ -0,0 +1,23 @@
+// Type definitions for pouchdb-replication v5.4.4
+// Project: https://pouchdb.com/
+// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare namespace PouchDB {
+ namespace Replication {
+ /** @todo When is this present? */
+ interface ReplicationMeta {
+ _replication_id: string;
+ _replication_state: string;
+ _replication_state_time: number;
+ _replication_stats: {};
+ }
+ }
+}
+
+declare module 'pouchdb-replication' {
+ const plugin: PouchDB.Plugin;
+ export = plugin;
+}
diff --git a/pouchdb/pouchdb-tests.ts b/pouchdb/pouchdb-tests.ts
new file mode 100644
index 0000000000..4dddcfe50d
--- /dev/null
+++ b/pouchdb/pouchdb-tests.ts
@@ -0,0 +1,106 @@
+///
+
+namespace PouchDBTests {
+ function isString(someString: string) {
+ }
+ function isNumber(someNumber: number) {
+ }
+
+ function testAllDocs() {
+ const db = new PouchDB<{ foo: number }>();
+
+ db.allDocs().then(({ offset, total_rows, rows }) => {
+ isNumber(offset);
+ isNumber(total_rows);
+
+ rows.forEach(({ id, key, value, doc }) => {
+ isString(id);
+ isString(key);
+ isString(value.rev);
+
+ // check document property
+ isNumber(doc.foo);
+ })
+ });
+
+ db.allDocs({ startkey: "a", endkey: "b" });
+ db.allDocs({ startkey: "a", endkey: "b", inclusive_end: true });
+ db.allDocs({ keys: ["a", "b", "c" ]});
+ db.allDocs({ key: "a" });
+ db.allDocs({
+ attachments: true,
+ binary: true,
+ conflicts: true,
+ descending: true,
+ include_docs: true,
+ limit: 5,
+ skip: 1
+ });
+ }
+
+ function testDestroy() {
+ const db = new PouchDB<{}>();
+
+ db.destroy({}, (error) => {
+ });
+ db.destroy().then(() => {
+ }).catch((error) => {
+ });
+ }
+
+ function testBasics() {
+ type MyModel = { property: 'someProperty '};
+ let model: PouchDB.Core.Document;
+ const id = 'model';
+
+ let db = new PouchDB();
+ db = new PouchDB(null, {
+ adapter: 'fruitdown'
+ });
+ db = new PouchDB(null, {
+ adapter: 'http'
+ });
+ db = new PouchDB(null, {
+ adapter: 'idb'
+ });
+ db = new PouchDB(null, {
+ adapter: 'leveldb'
+ });
+ db = new PouchDB(null, {
+ adapter: 'localstorage'
+ });
+ db = new PouchDB(null, {
+ adapter: 'memory'
+ });
+ db = new PouchDB(null, {
+ adapter: 'websql'
+ });
+ db = new PouchDB(null, {
+ adapter: 'websql',
+ size: 100
+ });
+
+ db.post(model).then((result) => {
+ isString(result.id);
+ });
+ db.post(model, null, (error, response) => {
+ });
+
+ db.get(id).then((result) => model = result);
+ db.get(id, null, (error, result) => {
+ });
+
+ db.put(model).then((error) => {
+ });
+ db.put(model, null, null, null, (error) => {
+ });
+
+ db.info().then((info) => {
+ });
+ db.info({ ajax: { cache: true }}, (error, result) => {
+ });
+
+ db.viewCleanup().catch((error) => {
+ });
+ }
+}
diff --git a/pouchdb/pouchdb.d.ts b/pouchdb/pouchdb.d.ts
new file mode 100644
index 0000000000..2d40feb2ec
--- /dev/null
+++ b/pouchdb/pouchdb.d.ts
@@ -0,0 +1,24 @@
+// Type definitions for pouchdb v5.4.4
+// Project: https://pouchdb.com/
+// Definitions by: Andy Brown , Brian Geppert , Frederico Galvão
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+
+declare module 'pouchdb' {
+ const plugin: PouchDB.Static;
+ export = plugin;
+}