Files
twenty/packages/twenty-shared/src/workflow/schemas/base-trigger-schema.ts
T
Guillim f60817a1e1 Morph many to one picker (#14155)
This PR follows the multiSelect PR merged previously. It will enable
morph relation Many to One to be handled from the table, using a
singleSelect picker

Main point : I decided to change the singleSelect API to take an array
of **objectMetadataName** instead of only one to deal with both our
usecases.

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2025-10-07 17:25:11 +02:00

30 lines
859 B
TypeScript

import { z } from 'zod';
export const baseTriggerSchema = z.object({
name: z
.string()
.optional()
.describe(
'Human-readable name for the trigger. Optional but recommended for clarity.',
),
type: z
.enum(['DATABASE_EVENT', 'MANUAL', 'CRON', 'WEBHOOK'])
.describe(
'Type of trigger. DATABASE_EVENT for record changes, MANUAL for user-initiated, CRON for scheduled, WEBHOOK for external calls.',
),
position: z
.object({ x: z.number(), y: z.number() })
.optional()
.nullable()
.describe(
'Position coordinates for the trigger in the workflow diagram. Use (0, 0) for the trigger step.',
),
nextStepIds: z
.array(z.string())
.optional()
.nullable()
.describe(
'Array of step IDs that the trigger connects to. These are the first steps in the workflow.',
),
});