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:
2025-09-10 13:48:26 +02:00
parent 9a3b94ef60
commit b18e2eaf49
9 changed files with 208 additions and 225 deletions

View File

@@ -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'
],
})
}
]
}
})