Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | import { store } from "../../../store/index.ts"; import * as Injectors from "../../workflow/injectors/index.ts"; import stateToGlobalVariable from "./stateToGlobalVariable.ts"; export const stateToWorkflow = () => { const workflow: any = store.getState().workflows.currentWorkflow; const responseBody: any = { workflow: { id: workflow.id, type: workflow.type, name: workflow.name, schedule: { type: workflow.schedule?.toUpperCase(), [workflow.schedule]: Injectors.handleScheduleInjector(), }, playbooks: [ { id: parseInt(workflow.playbookId, 10), }, ], entry_points: [ { type: workflow.workflowType?.toUpperCase(), [workflow.workflowType]: Injectors.handleEntryPointsInjector(), }, ], actions: workflow.notification ? [ { type: workflow.notification?.toUpperCase(), [workflow.notification]: Injectors.handleActionsInjector(), }, ] : [], configuration: { generate_summary: workflow?.generateSummary ?? false, global_variable_set: stateToGlobalVariable(workflow.globalVariables), transformer_lambda_function: workflow.useTransformer ? { definition: workflow.transformerCode, } : undefined, evaluation_window_in_seconds: workflow.evaluation_window_in_seconds, }, }, }; return responseBody; }; |