mirror of
https://github.com/xtr-dev/payload-automation.git
synced 2025-12-10 00:43:23 +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,4 +1,6 @@
|
||||
import type {Field, TaskConfig} from "payload"
|
||||
import type {TaskConfig} from "payload"
|
||||
|
||||
import type {Trigger} from "../triggers/types.js"
|
||||
|
||||
export type CollectionTriggerConfigCrud = {
|
||||
create?: true
|
||||
@@ -9,10 +11,7 @@ export type CollectionTriggerConfigCrud = {
|
||||
|
||||
export type CollectionTriggerConfig = CollectionTriggerConfigCrud | true
|
||||
|
||||
export type CustomTriggerConfig = {
|
||||
inputs?: Field[]
|
||||
slug: string,
|
||||
}
|
||||
export type TriggerConfig = <T extends string>(config: WorkflowsPluginConfig<T>) => Trigger
|
||||
|
||||
export type WorkflowsPluginConfig<TSlug extends string> = {
|
||||
collectionTriggers: {
|
||||
@@ -20,6 +19,6 @@ export type WorkflowsPluginConfig<TSlug extends string> = {
|
||||
}
|
||||
enabled?: boolean
|
||||
steps: TaskConfig<string>[],
|
||||
triggers?: CustomTriggerConfig[]
|
||||
triggers?: TriggerConfig[]
|
||||
webhookPrefix?: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user