import * as sqlite3 from 'sqlite3' ; export default class SqliteDatastore { database : sqlite3 . Database ; constructor ( database ) { this . database = database ; } run ( query , params ? ) { return new Promise < void > ( ( resolve , reject ) => { this . database . run ( query , params , error => { error ? reject ( error ) : resolve ( ) ; } ) ; } ) ; } close ( ) { return new Promise < void > ( ( resolve , reject ) => { this . database . close ( error => { error ? reject ( error ) : resolve ( ) ; } ) ; } ) ; } get < A > ( query , params ? ) { return new Promise < A > ( ( resolve , reject ) => { this . database . get ( query , params , ( error , row ) => { error ? reject ( error ) : resolve ( row ) ; } ) ; } ) ; } all < A > ( query , params ? ) { return new Promise < Array < A > > ( ( resolve , reject ) => { this . database . all ( query , params , ( error , rows ) => { error ? reject ( error ) : resolve ( rows ) ; } ) ; } ) ; } }