refactor: Redesign twitter trigger and actions

This commit is contained in:
Faruk AYDIN
2022-10-06 10:46:22 +03:00
parent 63ffd1f720
commit 77624acc01
18 changed files with 332 additions and 50 deletions

View File

@@ -1,29 +1,40 @@
import createHttpClient from './http-client';
import Connection from '../models/connection';
import Flow from '../models/flow';
import Step from '../models/step';
import { IJSONObject, IApp, IGlobalVariable } from '@automatisch/types';
const globalVariable = (
const globalVariable = async (
connection: Connection,
appData: IApp,
flow?: Flow
): IGlobalVariable => {
flow?: Flow,
currentStep?: Step
): Promise<IGlobalVariable> => {
const lastInternalId = await flow?.lastInternalId();
return {
auth: {
set: async (args: IJSONObject) => {
return await connection.$query().patchAndFetch({
await connection.$query().patchAndFetch({
formattedData: {
...connection.formattedData,
...args,
},
});
return null;
},
data: connection.formattedData,
},
app: appData,
http: createHttpClient({ baseURL: appData.baseUrl }),
db: {
flow: flow,
flow: {
lastInternalId,
},
step: {
parameters: currentStep?.parameters || {},
},
},
};
};