import Logger from 'js-logger' ; import { EventEmitter } from 'events' ; import { Util } from '../util/Util' ; export type ProviderTypes = 'mongodb' | 'keyv' | 'lrucache' | 'prismaio' | 'firestore' | string ; export interface ProviderEvents { connected : ( client ? : any ) => void ; } export declare interface Provider { on < U extends keyof ProviderEvents > ( event , listener ) : this ; emit < U extends keyof ProviderEvents > ( event , ... args ) : boolean ; client : any ; init ( ) : Promise < void > | void ; insert ( ... args ) : Promise < any > | any ; get ( ... args ) : Promise < any > | any ; update ( ... args ) : Promise < any > | any ; delete ( ... args ) : Promise < any > | any ; } const throwError = ( error , name ) => { const trace = Util . resolveValidationErrorTrace ( [ name ] ) ; Logger . error ( error , trace ) ; } ; export class Provider extends EventEmitter { init ( ) { throwError ( 'Init method is not implemented!' , this . constructor . name ) ; return ; } insert ( ... args ) { throwError ( 'Insert method is not implemented!' , this . constructor . name ) ; return ; } get ( ... args ) { throwError ( 'Get method is not implemented!' , this . constructor . name ) ; return ; } update ( ... args ) { throwError ( 'Update method is not implemented!' , this . constructor . name ) ; return ; } delete ( ... args ) { throwError ( 'Delete method is not implemented!' , this . constructor . name ) ; return ; } }