Add output to workflow run (#7276)

Example of output stored for following workflow:

<img width="244" alt="Capture d’écran 2024-09-27 à 11 18 06"
src="https://github.com/user-attachments/assets/722bfa96-2dd1-41f7-ab87-d39584ac9efc">

Output:

```
{"steps": [
  {"type": "CODE", "result": {"email": "test@twenty.com"}}, 
  {"type": "SEND_EMAIL", "result": {"success": true}}
]}
```
This commit is contained in:
Thomas Trompette
2024-09-30 18:45:44 +02:00
committed by GitHub
parent 06d4ba92e5
commit ca027d6772
5 changed files with 88 additions and 35 deletions

View File

@ -27,6 +27,17 @@ export enum WorkflowRunStatus {
FAILED = 'FAILED',
}
export type WorkflowRunOutput = {
steps: {
id: string;
name: string;
type: string;
attemptCount: number;
result: object | undefined;
error: string | undefined;
}[];
};
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.workflowRun,
namePlural: 'workflowRuns',
@ -108,6 +119,15 @@ export class WorkflowRunWorkspaceEntity extends BaseWorkspaceEntity {
})
createdBy: ActorMetadata;
@WorkspaceField({
standardId: WORKFLOW_RUN_STANDARD_FIELD_IDS.output,
type: FieldMetadataType.RAW_JSON,
label: 'Output',
description: 'Json object to provide output of the workflow run',
})
@WorkspaceIsNullable()
output: WorkflowRunOutput | null;
// Relations
@WorkspaceRelation({
standardId: WORKFLOW_RUN_STANDARD_FIELD_IDS.workflowVersion,