6b4c79ff0d
- add workflow runner module
- add an endpoint to trigger a workflow via api
- improve error handling for serverless functions
## Testing
- create 2 serverless functions
- create a workflow
- create this workflow Version
```
{
"type": "MANUAL",
"input": {"b": "bb"},
"nextAction": {
"name": "step_1",
"displayName": "Code",
"type": "CODE",
"valid": true,
"settings": {
"serverlessFunctionId": "Serverless function 1 Id",
"errorHandlingOptions": {
"retryOnFailure": {
"value": false
},
"continueOnFailure": {
"value": false
}
}
},
"nextAction": {
"name": "step_1",
"displayName": "Code",
"type": "CODE",
"valid": true,
"settings": {
"serverlessFunctionId": "Serverless function 1 Id",
"errorHandlingOptions": {
"retryOnFailure": {
"value": false
},
"continueOnFailure": {
"value": false
}
}
},
"nextAction": {
"name": "step_1",
"displayName": "Code",
"type": "CODE",
"valid": true,
"settings": {
"serverlessFunctionId": "Serverless function 2 Id",
"errorHandlingOptions": {
"retryOnFailure": {
"value": false
},
"continueOnFailure": {
"value": false
}
}
}
}
}
}
}
`
``
- call
```
mutation Trigger {
triggerWorkflow(workflowVersionId: "WORKFLOW_VERSION_ID") {
result
}
}
```
- try when errors are injected in serverless function
19 lines
570 B
TypeScript
19 lines
570 B
TypeScript
import { createState } from 'twenty-ui';
|
|
import { ServerlessFunctionExecutionStatus } from '~/generated-metadata/graphql';
|
|
|
|
type settingsServerlessFunctionOutput = {
|
|
data?: string;
|
|
duration?: number;
|
|
status?: ServerlessFunctionExecutionStatus;
|
|
error?: string;
|
|
};
|
|
|
|
export const DEFAULT_OUTPUT_VALUE =
|
|
'Enter an input above then press "run Function"';
|
|
|
|
export const settingsServerlessFunctionOutputState =
|
|
createState<settingsServerlessFunctionOutput>({
|
|
key: 'settingsServerlessFunctionOutputState',
|
|
defaultValue: { data: DEFAULT_OUTPUT_VALUE },
|
|
});
|