22 branches data migration (#13006)

This PR does not produce any functional change

First step of the workflow branch feature

- add gather `workflowRun.output` and `workflowRun.context` into one
column `workflowRun.runContext`
- add a command to fill `runContext` from `output` and `context` in
existing records
- maintain `runContext` up to date during workflow runs
This commit is contained in:
martmull
2025-07-03 10:18:33 +02:00
committed by GitHub
parent 29dbd3fc25
commit 51cb35a27a
11 changed files with 387 additions and 6 deletions
@@ -31,6 +31,7 @@ import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-ob
import { WorkflowExecutorOutput } from 'src/modules/workflow/workflow-executor/types/workflow-executor-output.type';
import { WorkflowAction } from 'src/modules/workflow/workflow-executor/workflow-actions/types/workflow-action.type';
import { WorkflowTrigger } from 'src/modules/workflow/workflow-trigger/types/workflow-trigger.type';
import { WorkflowRunStepInfo } from 'src/modules/workflow/workflow-executor/types/workflow-run-step-info.type';
export enum WorkflowRunStatus {
NOT_STARTED = 'NOT_STARTED',
@@ -54,6 +55,15 @@ export type WorkflowRunOutput = {
error?: string;
};
export type WorkflowRunState = {
flow: {
trigger: WorkflowTrigger;
steps: WorkflowAction[];
};
stepInfos: Record<string, WorkflowRunStepInfo>;
workflowRunError?: string;
};
const NAME_FIELD_NAME = 'name';
export const SEARCH_FIELDS_FOR_WORKFLOW_RUNS: FieldTypeAndNameMetadata[] = [
@@ -172,6 +182,16 @@ export class WorkflowRunWorkspaceEntity extends BaseWorkspaceEntity {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
context: Record<string, any> | null;
@WorkspaceField({
standardId: WORKFLOW_RUN_STANDARD_FIELD_IDS.state,
type: FieldMetadataType.RAW_JSON,
label: msg`State`,
description: msg`State of the workflow run`,
icon: 'IconHierarchy2',
})
@WorkspaceIsNullable()
state: WorkflowRunState | null;
@WorkspaceField({
standardId: WORKFLOW_RUN_STANDARD_FIELD_IDS.position,
type: FieldMetadataType.POSITION,