feat: add create or update workflow trigger (#14708)

### Description

This PR focuses on
https://github.com/twentyhq/core-team-issues/issues/1476

- introduces the handling of upserted events in the workflow trigger
system


## Visual Appearance
<img width="1792" height="1039" alt="Screenshot 2025-09-21 at 11 40
28 PM"
src="https://github.com/user-attachments/assets/d926b566-f7d3-412b-b1ab-ed2064425f3d"
/>

<img width="501" height="1025" alt="Screenshot 2025-09-21 at 11 40
39 PM"
src="https://github.com/user-attachments/assets/13c3031a-0762-4c80-8df1-fa74ca70a540"
/>


### Changes
- Added `UPSERTED` action to the `DatabaseEventAction` enum.
- Updated the `WorkflowEditTriggerDatabaseEventForm` to support upserted
events.

---------

Co-authored-by: Thomas Trompette <thomas.trompette@sfr.fr>
This commit is contained in:
Harshit Singh
2025-10-01 18:47:05 +05:30
committed by GitHub
parent b5e6703f35
commit ae4a93c993
22 changed files with 213 additions and 16 deletions
@@ -8,11 +8,11 @@ export const workflowDatabaseEventTriggerSchema = baseTriggerSchema
eventName: z
.string()
.regex(
/^[a-z][a-zA-Z0-9_]*\.(created|updated|deleted)$/,
'Event name must follow the pattern: objectName.action (e.g., "company.created", "person.updated")',
/^[a-z][a-zA-Z0-9_]*\.(created|updated|deleted|upserted)$/,
'Event name must follow the pattern: objectName.action (e.g., "company.created", "person.updated", "company.upserted")',
)
.describe(
'Event name in format: objectName.action (e.g., "company.created", "person.updated", "task.deleted"). Use lowercase object names.',
'Event name in format: objectName.action (e.g., "company.created", "person.updated", "task.deleted", "company.upserted"). Use lowercase object names.',
),
input: z.looseObject({}).optional(),
outputSchema: z
@@ -25,5 +25,5 @@ export const workflowDatabaseEventTriggerSchema = baseTriggerSchema
}),
})
.describe(
'Database event trigger that fires when a record is created, updated, or deleted. The triggered record is accessible in workflow steps via {{trigger.object.fieldName}}.',
'Database event trigger that fires when a record is created, updated, deleted, or upserted. The triggered record is accessible in workflow steps via {{trigger.object.fieldName}}.',
);