mirror of
https://github.com/xtr-dev/payload-automation.git
synced 2025-12-10 17:03:22 +00:00
WIP: Refactor triggers to TriggerConfig pattern
- Convert webhook, global, and cron triggers to use TriggerConfig pattern like collectionTrigger - Simplify trigger slug names (remove '-trigger' suffix) - Update validation to use new slug names - Add perfectionist/sort-exports rule disable - Note: Workflow.ts integration still needs fixes for type compatibility
This commit is contained in:
@@ -1,28 +1,25 @@
|
||||
import type {Field} from 'payload'
|
||||
import type {TriggerConfig} from '../plugin/config-types.js'
|
||||
|
||||
import {triggerField} from "./helpers.js"
|
||||
|
||||
export function getGlobalTriggerFields(): Field[] {
|
||||
return [
|
||||
triggerField({
|
||||
export const globalTrigger: TriggerConfig = () => ({
|
||||
slug: 'global',
|
||||
fields: [
|
||||
{
|
||||
name: 'global',
|
||||
type: 'select',
|
||||
admin: {
|
||||
condition: (_, siblingData) => siblingData?.type === 'global-trigger',
|
||||
description: 'Global that triggers the workflow',
|
||||
},
|
||||
options: [], // Will be populated dynamically based on available globals
|
||||
}),
|
||||
triggerField({
|
||||
},
|
||||
{
|
||||
name: 'globalOperation',
|
||||
type: 'select',
|
||||
admin: {
|
||||
condition: (_, siblingData) => siblingData?.type === 'global-trigger',
|
||||
description: 'Global operation that triggers the workflow',
|
||||
},
|
||||
options: [
|
||||
'update'
|
||||
],
|
||||
})
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user