feat: Implement webhook logic along with new entry typeform trigger
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import Context from '../../types/express/context';
|
||||
import flowQueue from '../../queues/flow';
|
||||
import { REMOVE_AFTER_30_DAYS_OR_150_JOBS, REMOVE_AFTER_7_DAYS_OR_50_JOBS } from '../../helpers/remove-job-configuration';
|
||||
import globalVariable from '../../helpers/global-variable';
|
||||
|
||||
type Params = {
|
||||
input: {
|
||||
@@ -50,12 +51,22 @@ const updateFlowStatus = async (
|
||||
jobName,
|
||||
{ flowId: flow.id },
|
||||
{
|
||||
repeat: repeatOptions,
|
||||
repeat: trigger.type === 'webhook' ? null : repeatOptions,
|
||||
jobId: flow.id,
|
||||
removeOnComplete: REMOVE_AFTER_7_DAYS_OR_50_JOBS,
|
||||
removeOnFail: REMOVE_AFTER_30_DAYS_OR_150_JOBS
|
||||
}
|
||||
);
|
||||
} else if (!flow.active && trigger.type === 'webhook') {
|
||||
const $ = await globalVariable({
|
||||
flow,
|
||||
connection: await triggerStep.$relatedQuery('connection'),
|
||||
app: await triggerStep.getApp(),
|
||||
step: triggerStep,
|
||||
testRun: false,
|
||||
});
|
||||
|
||||
await trigger.unregisterHook($);
|
||||
} else {
|
||||
const repeatableJobs = await flowQueue.getRepeatableJobs();
|
||||
const job = repeatableJobs.find((job) => job.id === flow.id);
|
||||
|
Reference in New Issue
Block a user