feat: add defineTrigger and defineAction

This commit is contained in:
Ali BARIN
2022-10-15 22:16:10 +02:00
parent ee9d095454
commit 92a2d68a81
23 changed files with 147 additions and 131 deletions

View File

@@ -16,17 +16,13 @@ async function getFileContent<C>(
path: string,
stripFuncs: boolean
): Promise<C> {
try {
const fileContent = await getDefaultExport(path);
const fileContent = await getDefaultExport(path);
if (stripFuncs) {
return stripFunctions(fileContent);
}
return fileContent;
} catch (err) {
return null;
if (stripFuncs) {
return stripFunctions(fileContent);
}
return fileContent;
}
async function getChildrenContentInDirectory<C>(
@@ -55,10 +51,12 @@ async function getChildrenContentInDirectory<C>(
const getApp = async (appKey: string, stripFuncs = true) => {
const appData: IApp = await getDefaultExport(`../apps/${appKey}`);
appData.auth = await getFileContent<IAuth>(
`../apps/${appKey}/auth`,
stripFuncs
);
if (appData.supportsConnections) {
appData.auth = await getFileContent<IAuth>(
`../apps/${appKey}/auth`,
stripFuncs
);
}
appData.triggers = await getChildrenContentInDirectory<ITrigger>(
`${appKey}/triggers`,
stripFuncs