refactor: Redesign twitter trigger and actions
This commit is contained in:
@@ -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 || {},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user