chore: Remove temporary app list from app model

This commit is contained in:
Faruk AYDIN
2022-10-24 18:32:19 +02:00
committed by Ali BARIN
parent ea76b5b762
commit b2caea9b9b

View File

@@ -6,29 +6,20 @@ import getApp from '../helpers/get-app';
class App { class App {
static folderPath = join(__dirname, '../apps'); static folderPath = join(__dirname, '../apps');
static list = fs.readdirSync(this.folderPath); static list = fs
.readdirSync(this.folderPath)
// Temporaryly restrict the apps we expose until .filter((file) => fs.statSync(this.folderPath + '/' + file).isDirectory());
// their actions/triggers are implemented!
static temporaryList = [
'flickr',
'github',
'scheduler',
'slack',
'twitter',
'smtp',
];
static async findAll(name?: string, stripFuncs = true): Promise<IApp[]> { static async findAll(name?: string, stripFuncs = true): Promise<IApp[]> {
if (!name) if (!name)
return Promise.all( return Promise.all(
this.temporaryList.map( this.list.map(
async (name) => await this.findOneByName(name, stripFuncs) async (name) => await this.findOneByName(name, stripFuncs)
) )
); );
return Promise.all( return Promise.all(
this.temporaryList this.list
.filter((app) => app.includes(name.toLowerCase())) .filter((app) => app.includes(name.toLowerCase()))
.map((name) => this.findOneByName(name, stripFuncs)) .map((name) => this.findOneByName(name, stripFuncs))
); );