From 298ab70a69b73e0beca8975f42aa0e41d04d5ccd Mon Sep 17 00:00:00 2001 From: Lorenz Date: Mon, 29 Sep 2025 19:42:20 +0200 Subject: [PATCH 1/3] feat: add types for variables in workflow defintion and workflow --- lib/entities/workflow-definition.ts | 19 +++++++++++++++++++ lib/entities/workflow.ts | 2 ++ 2 files changed, 21 insertions(+) diff --git a/lib/entities/workflow-definition.ts b/lib/entities/workflow-definition.ts index e3b3f93ce1..dba63561fa 100644 --- a/lib/entities/workflow-definition.ts +++ b/lib/entities/workflow-definition.ts @@ -106,12 +106,31 @@ export type WorkflowDefinitionSysProps = Pick< isLocked: boolean } +export type WorkflowVariablePresetValue = { + variable: Link<'WorkflowVariable'>; + value: string | Link<'User'> | Link<'Team'>; +}; + +export type WorkflowVariablePreset = { + id?: string; + name: string; + variableValues: WorkflowVariablePresetValue[]; +}; + +export type WorkflowVariable = { + id: string; + name: string; + type: 'subject' | 'locale'; +}; + export type WorkflowDefinitionValidationLink = { type: 'Link' validations: Array<{ linkContentType: string[] }> linkType: 'Entry' + variables?: WorkflowVariable[]; + variableValuePresets?: WorkflowVariablePreset[]; } export type WorkflowDefinitionProps = { diff --git a/lib/entities/workflow.ts b/lib/entities/workflow.ts index cbbb013301..9f745676e0 100644 --- a/lib/entities/workflow.ts +++ b/lib/entities/workflow.ts @@ -26,6 +26,7 @@ export type WorkflowSysProps = Pick< deletedAt?: string entity: Link<'Entry'> workflowDefinition: Link<'WorkflowDefinition'> + variableValuePreset?: Link<'WorkflowVariableValuePreset'> } export type WorkflowProps = { @@ -36,6 +37,7 @@ export type WorkflowProps = { export type CreateWorkflowProps = Omit & { entity: Link<'Entry'> workflowDefinition: Link<'WorkflowDefinition'> + variableValuePreset?: Link<'WorkflowVariableValuePreset'> } export type UpdateWorkflowProps = Omit & { sys: Pick From 39976a9b16be47748e8766df6445a6a5f1bb2c70 Mon Sep 17 00:00:00 2001 From: Lorenz Date: Mon, 29 Sep 2025 20:11:23 +0200 Subject: [PATCH 2/3] fix: prettier --- lib/entities/workflow-definition.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/entities/workflow-definition.ts b/lib/entities/workflow-definition.ts index dba63561fa..31b0e024d3 100644 --- a/lib/entities/workflow-definition.ts +++ b/lib/entities/workflow-definition.ts @@ -107,21 +107,21 @@ export type WorkflowDefinitionSysProps = Pick< } export type WorkflowVariablePresetValue = { - variable: Link<'WorkflowVariable'>; - value: string | Link<'User'> | Link<'Team'>; -}; + variable: Link<'WorkflowVariable'> + value: string | Link<'User'> | Link<'Team'> +} export type WorkflowVariablePreset = { - id?: string; - name: string; - variableValues: WorkflowVariablePresetValue[]; -}; + id?: string + name: string + variableValues: WorkflowVariablePresetValue[] +} export type WorkflowVariable = { - id: string; - name: string; - type: 'subject' | 'locale'; -}; + id: string + name: string + type: 'subject' | 'locale' +} export type WorkflowDefinitionValidationLink = { type: 'Link' @@ -129,8 +129,8 @@ export type WorkflowDefinitionValidationLink = { linkContentType: string[] }> linkType: 'Entry' - variables?: WorkflowVariable[]; - variableValuePresets?: WorkflowVariablePreset[]; + variables?: WorkflowVariable[] + variableValuePresets?: WorkflowVariablePreset[] } export type WorkflowDefinitionProps = { From f153218c90fcf2f8c69c5d36cb3593e98f29e3d1 Mon Sep 17 00:00:00 2001 From: Lorenz Date: Mon, 29 Sep 2025 20:18:08 +0200 Subject: [PATCH 3/3] feat: export variable types --- lib/export-types.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/export-types.ts b/lib/export-types.ts index 20635fd17f..54464fb4d9 100644 --- a/lib/export-types.ts +++ b/lib/export-types.ts @@ -252,6 +252,9 @@ export type { WorkflowDefinitionSysProps, // Property: appliesTo WorkflowDefinitionValidationLink, + WorkflowVariable, + WorkflowVariablePreset, + WorkflowVariablePresetValue, // Property: step.actions WorkflowStepAction, WorkflowStepActionType,