feat: workflow delay action (Pause - Wait/Sleep/Delay) (#14915)

## Description

- This PR focuses on issue
https://github.com/orgs/twentyhq/projects/1/views/33?pane=issue&itemId=93150683&issue=twentyhq%7Ccore-team-issues%7C20
- added Workflow delay as a Flow action
- for V1 added Type 1: Resume at a specific date or time


## Visual Appearance
<img width="1792" height="1038" alt="Screenshot 2025-10-09 at 5 46
18 PM"
src="https://github.com/user-attachments/assets/e62980e9-59c7-4e5a-b8ec-1e848a462d3f"
/>

<img width="1792" height="1037" alt="Screenshot 2025-10-09 at 5 46
35 PM"
src="https://github.com/user-attachments/assets/7c3f4e39-ab0a-40ed-97a8-4f0cdb86f295"
/>

---------

Co-authored-by: Thomas Trompette <thomas.trompette@sfr.fr>
This commit is contained in:
Harshit Singh
2025-10-20 18:45:55 +05:30
committed by GitHub
parent 11564f135e
commit 4e5783eaf4
33 changed files with 643 additions and 12 deletions
@@ -43,6 +43,8 @@ export { workflowUpdateRecordActionSchema } from './schemas/update-record-action
export { workflowUpdateRecordActionSettingsSchema } from './schemas/update-record-action-settings-schema';
export { workflowWebhookTriggerSchema } from './schemas/webhook-trigger-schema';
export { workflowActionSchema } from './schemas/workflow-action-schema';
export { workflowDelayActionSchema } from './schemas/workflow-delay-action-schema';
export { workflowDelayActionSettingsSchema } from './schemas/workflow-delay-action-settings-schema';
export { workflowRunSchema } from './schemas/workflow-run-schema';
export { workflowRunStateSchema } from './schemas/workflow-run-state-schema';
export { workflowRunStateStepInfoSchema } from './schemas/workflow-run-state-step-info-schema';
@@ -11,6 +11,7 @@ import { workflowHttpRequestActionSchema } from './http-request-action-schema';
import { workflowIteratorActionSchema } from './iterator-action-schema';
import { workflowSendEmailActionSchema } from './send-email-action-schema';
import { workflowUpdateRecordActionSchema } from './update-record-action-schema';
import { workflowDelayActionSchema } from './workflow-delay-action-schema';
export const workflowActionSchema = z.discriminatedUnion('type', [
workflowCodeActionSchema,
@@ -24,5 +25,6 @@ export const workflowActionSchema = z.discriminatedUnion('type', [
workflowAiAgentActionSchema,
workflowFilterActionSchema,
workflowIteratorActionSchema,
workflowDelayActionSchema,
workflowEmptyActionSchema,
]);
@@ -0,0 +1,8 @@
import { z } from 'zod';
import { baseWorkflowActionSchema } from './base-workflow-action-schema';
import { workflowDelayActionSettingsSchema } from './workflow-delay-action-settings-schema';
export const workflowDelayActionSchema = baseWorkflowActionSchema.extend({
type: z.literal('DELAY'),
settings: workflowDelayActionSettingsSchema,
});
@@ -0,0 +1,18 @@
import { z } from 'zod';
import { baseWorkflowActionSettingsSchema } from './base-workflow-action-settings-schema';
export const workflowDelayActionSettingsSchema =
baseWorkflowActionSettingsSchema.extend({
input: z.object({
delayType: z.enum(['SCHEDULED_DATE', 'DURATION']),
scheduledDateTime: z.string().nullable().optional(),
duration: z
.object({
days: z.union([z.number().min(0), z.string()]).optional(),
hours: z.union([z.number().min(0), z.string()]).optional(),
minutes: z.union([z.number().min(0), z.string()]).optional(),
seconds: z.union([z.number().min(0), z.string()]).optional(),
})
.optional(),
}),
});