import APP_CONFIG from '../config/app.json' ; import { DatabaseProvider } from '../../database/services/database.service' ; import { AppConfig , AppViewConfig , AppViewLayout } from '../types' ; import { DownloadFolderMethod } from '../../drive/types' ; export function getAppConfig ( ) { const config = { ... APP_CONFIG , ... { fileExplorer : { ... APP_CONFIG . fileExplorer , download : { ... APP_CONFIG . fileExplorer . download , folder : { ... APP_CONFIG . fileExplorer . download . folder , method : APP_CONFIG . fileExplorer . download . folder . method as DownloadFolderMethod , } , } , } , views : APP_CONFIG . views . map ( ( v ) => ( { ... v , layout : v . layout as AppViewLayout } ) ) , database : { ... APP_CONFIG . database , provider : APP_CONFIG . database . provider as DatabaseProvider } , } , } ; return config ; } export function getViewConfig ( filter ) { const config = getAppConfig ( ) ; return config . views . find ( ( v ) => Object . keys ( filter ) . reduce ( ( t , key ) => { return v [ key ] === filter [ key ] && t ; } , true ) ) ; } const configService = { getAppConfig , getViewConfig , } ; export default configService ;