Remove cron trigger implementation

- Remove cron-trigger.ts and cron-scheduler.ts files
- Clean up cron-related code from plugin index and workflow hooks
- Remove cron references from workflow executor types
- Add cron to NOT-IMPLEMENTING.md with webhook alternatives
- Update README with scheduled workflow documentation using external services
- Suggest GitHub Actions and Vercel Cron as reliable alternatives

Benefits of external scheduling:
- Better reliability and process isolation
- Easier debugging and monitoring
- Leverages existing cloud infrastructure
- Reduces plugin complexity and maintenance burden
This commit is contained in:
2025-09-10 14:04:11 +02:00
parent b18e2eaf49
commit cda349846a
10 changed files with 134 additions and 779 deletions

View File

@@ -2,16 +2,8 @@ import type {CollectionConfig, Field} from 'payload'
import type {WorkflowsPluginConfig} from "../plugin/config-types.js"
import {
collectionTrigger,
cronTrigger,
globalTrigger,
webhookTrigger
} from '../triggers/index.js'
import {trigger} from '../triggers/helpers.js'
export const createWorkflowCollection: <T extends string>(options: WorkflowsPluginConfig<T>) => CollectionConfig = (options) => {
const {steps, collectionTriggers} = options
const {steps} = options
const triggers = (options.triggers || []).map(t => t(options))
return {
slug: 'workflows',
@@ -72,11 +64,6 @@ export const createWorkflowCollection: <T extends string>(options: WorkflowsPlug
},
defaultValue: {}
},
// Virtual fields for built-in triggers
...trigger({slug: 'collection', fields: collectionTrigger(options).fields}).fields,
...trigger({slug: 'webhook', fields: webhookTrigger().fields}).fields,
...trigger({slug: 'global', fields: globalTrigger().fields}).fields,
...trigger({slug: 'cron', fields: cronTrigger().fields}).fields,
{
name: 'condition',
type: 'text',
@@ -86,8 +73,6 @@ export const createWorkflowCollection: <T extends string>(options: WorkflowsPlug
required: false
},
// Virtual fields for custom triggers
// Note: Custom trigger fields from trigger-helpers already have unique names
// We just need to pass them through without modification
...(triggers || []).flatMap(t => (t.fields || []))
]
},