refactor: Generate authentication steps from auth properties

This commit is contained in:
Faruk AYDIN
2022-11-10 18:49:49 +01:00
parent 6d3606abf0
commit 10e2794ff9
15 changed files with 115 additions and 599 deletions

View File

@@ -8,14 +8,12 @@ import {
ITrigger,
} from '@automatisch/types';
import { omit, cloneDeep } from 'lodash';
import addAuthenticationSteps from './add-authentication-steps';
import addReconnectionSteps from './add-reconnection-steps';
type TApps = Record<string, Promise<{ default: IApp }>>;
const apps = fs
.readdirSync(
path.resolve(__dirname, `../apps/`),
{ withFileTypes: true }
)
.readdirSync(path.resolve(__dirname, `../apps/`), { withFileTypes: true })
.reduce((apps, dirent) => {
if (!dirent.isDirectory()) return apps;
@@ -36,6 +34,7 @@ const getApp = async (appKey: string, stripFuncs = true) => {
let appData: IApp = cloneDeep(await getDefaultExport(appKey));
if (appData.auth) {
appData = addAuthenticationSteps(appData);
appData = addReconnectionSteps(appData);
}