feat: Convert service folder to js files

This commit is contained in:
Faruk AYDIN
2023-12-28 13:19:46 +01:00
parent c6c02d7c18
commit 40ae83ed6a
4 changed files with 7 additions and 31 deletions

View File

@@ -9,13 +9,7 @@ import HttpError from '../errors/http';
import EarlyExitError from '../errors/early-exit';
import AlreadyProcessedError from '../errors/already-processed';
type ProcessActionOptions = {
flowId: string;
executionId: string;
stepId: string;
};
export const processAction = async (options: ProcessActionOptions) => {
export const processAction = async (options) => {
const { flowId, stepId, executionId } = options;
const flow = await Flow.query().findById(flowId).throwIfNotFound();

View File

@@ -5,12 +5,7 @@ import AlreadyProcessedError from '../errors/already-processed';
import HttpError from '../errors/http';
import { logger } from '../helpers/logger';
type ProcessFlowOptions = {
flowId: string;
testRun?: boolean;
};
export const processFlow = async (options: ProcessFlowOptions) => {
export const processFlow = async (options) => {
const { testRun, flowId } = options;
const flow = await Flow.query().findById(flowId).throwIfNotFound();
const triggerStep = await flow.getTriggerStep();

View File

@@ -1,13 +1,9 @@
import Step from '../models/step';
import { processFlow } from '../services/flow';
import { processTrigger } from '../services/trigger';
import { processAction } from '../services/action';
import { processFlow } from './flow';
import { processTrigger } from './trigger';
import { processAction } from './action';
type TestRunOptions = {
stepId: string;
};
const testRun = async (options: TestRunOptions) => {
const testRun = async (options) => {
const untilStep = await Step.query()
.findById(options.stepId)
.throwIfNotFound();

View File

@@ -1,18 +1,9 @@
import { IJSONObject, ITriggerItem } from '@automatisch/types';
import Step from '../models/step';
import Flow from '../models/flow';
import Execution from '../models/execution';
import globalVariable from '../helpers/global-variable';
type ProcessTriggerOptions = {
flowId: string;
stepId: string;
triggerItem?: ITriggerItem;
error?: IJSONObject;
testRun?: boolean;
};
export const processTrigger = async (options: ProcessTriggerOptions) => {
export const processTrigger = async (options) => {
const { flowId, stepId, triggerItem, error, testRun } = options;
const step = await Step.query().findById(stepId).throwIfNotFound();