Merge branch 'main' into issue-553

This commit is contained in:
Ömer Faruk Aydın
2022-10-16 13:23:07 +02:00
committed by GitHub
37 changed files with 616 additions and 431 deletions

View File

@@ -9,10 +9,14 @@ const appInfoConverter = (rawAppData: IApp) => {
if (rawAppData.auth?.fields) {
rawAppData.auth.fields = rawAppData.auth.fields.map((field) => {
return {
...field,
value: field.value?.replace('{WEB_APP_URL}', appConfig.webAppUrl),
};
if (typeof field.value === 'string') {
return {
...field,
value: field.value.replace('{WEB_APP_URL}', appConfig.webAppUrl),
};
}
return field
});
}

View File

@@ -0,0 +1,5 @@
import { IAction } from '@automatisch/types';
export default function defineAction(actionDefinition: IAction): IAction {
return actionDefinition;
}

View File

@@ -0,0 +1,5 @@
import { ITrigger } from '@automatisch/types';
export default function defineTrigger(triggerDefinition: ITrigger): ITrigger {
return triggerDefinition;
}

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