diff --git a/types/pouchdb-adapter-cordova-sqlite/index.d.ts b/types/pouchdb-adapter-cordova-sqlite/index.d.ts new file mode 100644 index 0000000000..f77715d110 --- /dev/null +++ b/types/pouchdb-adapter-cordova-sqlite/index.d.ts @@ -0,0 +1,45 @@ +// Type definitions for pouchdb-adapter-sqlite 1.0 +// Project: https://pouchdb.com/, https://github.com/pouchdb/pouchdb, https://github.com/pouchdb-community/pouchdb-adapter-cordova-sqlite +// Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão , Matthew Paul +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +declare namespace PouchDB { + namespace AdapterCordovaSqlite { + interface Configuration extends Configuration.LocalDatabaseConfiguration { + /** + * Location of database e.g. 'Default'. + */ + location?: string; + + /** + * Location of database e.g. 'Default'. Only use 'location' or 'iosDatabaseLocation' not both. + */ + iosDatabaseLocation?: string; + + /** + * Version of android database to use. + */ + androidDatabaseImplementation?: number; + + /** + * Enable autocompation of database. + */ + auto_compaction?: boolean; + + adapter: 'cordova-sqlite'; + } + } + + interface Static { + new(name: string | null, + options: AdapterCordovaSqlite.Configuration): Database; + } +} + +declare module 'pouchdb-adapter-cordova-sqlite' { + const plugin: PouchDB.Plugin; + export = plugin; +} diff --git a/types/pouchdb-adapter-cordova-sqlite/pouchdb-adapter-cordova-sqlite-tests.ts b/types/pouchdb-adapter-cordova-sqlite/pouchdb-adapter-cordova-sqlite-tests.ts new file mode 100644 index 0000000000..c8db2974ac --- /dev/null +++ b/types/pouchdb-adapter-cordova-sqlite/pouchdb-adapter-cordova-sqlite-tests.ts @@ -0,0 +1,24 @@ +function testConstructor() { + let db = new PouchDB('basic'); + db = new PouchDB(null, { + adapter: 'cordova-sqlite' + }); + db = new PouchDB('location', { + adapter: 'cordova-sqlite', + location: 'default' + }); + db = new PouchDB('ioslocation', { + adapter: 'cordova-sqlite', + iosDatabaseLocation: 'default' + }); + db = new PouchDB('androidDatabaseImplementation', { + adapter: 'cordova-sqlite', + location: 'default', + androidDatabaseImplementation: 2 + }); + db = new PouchDB('auto_compaction', { + adapter: 'cordova-sqlite', + location: 'default', + auto_compaction: true + }); +} diff --git a/types/pouchdb-adapter-cordova-sqlite/tsconfig.json b/types/pouchdb-adapter-cordova-sqlite/tsconfig.json new file mode 100644 index 0000000000..697884588c --- /dev/null +++ b/types/pouchdb-adapter-cordova-sqlite/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "pouchdb-adapter-cordova-sqlite-tests.ts" + ] +} diff --git a/types/pouchdb-adapter-cordova-sqlite/tslint.json b/types/pouchdb-adapter-cordova-sqlite/tslint.json new file mode 100644 index 0000000000..7168e7758f --- /dev/null +++ b/types/pouchdb-adapter-cordova-sqlite/tslint.json @@ -0,0 +1,8 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-declare-current-package": false, + "no-unnecessary-generics": false, + "no-single-declare-module": false + } +} diff --git a/types/pouchdb/index.d.ts b/types/pouchdb/index.d.ts index 012c3059e3..100ef0e3fd 100644 --- a/types/pouchdb/index.d.ts +++ b/types/pouchdb/index.d.ts @@ -1,9 +1,10 @@ -// Type definitions for pouchdb 6.3 +// Type definitions for pouchdb 6.4 // Project: https://pouchdb.com/, https://github.com/pouchdb/pouchdb // Definitions by: Andy Brown , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 +/// /// /// ///