mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Type for Cordova SQLite pouchdb adapter (#36395)
* Types for pouchdb cordova sqlite adapter * Tests * Remove empty interface * Formatting tweak * Fix whitespace * Link to specific package * Corrected heading comment * Matching version number style from build * Missing reference from main index * Increment version
This commit is contained in:
45
types/pouchdb-adapter-cordova-sqlite/index.d.ts
vendored
Normal file
45
types/pouchdb-adapter-cordova-sqlite/index.d.ts
vendored
Normal file
@@ -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 <https://github.com/spaulg>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>, Matthew Paul <https://github.com/coffeymatt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="pouchdb-core" />
|
||||
|
||||
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<Content extends {}>(name: string | null,
|
||||
options: AdapterCordovaSqlite.Configuration): Database<Content>;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'pouchdb-adapter-cordova-sqlite' {
|
||||
const plugin: PouchDB.Plugin;
|
||||
export = plugin;
|
||||
}
|
||||
@@ -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
|
||||
});
|
||||
}
|
||||
24
types/pouchdb-adapter-cordova-sqlite/tsconfig.json
Normal file
24
types/pouchdb-adapter-cordova-sqlite/tsconfig.json
Normal file
@@ -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"
|
||||
]
|
||||
}
|
||||
8
types/pouchdb-adapter-cordova-sqlite/tslint.json
Normal file
8
types/pouchdb-adapter-cordova-sqlite/tslint.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-declare-current-package": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-single-declare-module": false
|
||||
}
|
||||
}
|
||||
3
types/pouchdb/index.d.ts
vendored
3
types/pouchdb/index.d.ts
vendored
@@ -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 <https://github.com/AGBrown>, Brian Geppert <https://github.com/geppy>, Frederico Galvão <https://github.com/fredgalvao>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types='pouchdb-adapter-cordova-sqlite' />
|
||||
/// <reference types='pouchdb-adapter-fruitdown' />
|
||||
/// <reference types='pouchdb-adapter-http' />
|
||||
/// <reference types='pouchdb-adapter-idb' />
|
||||
|
||||
Reference in New Issue
Block a user