refactor(trigger): Unify the Trigger Debug interface and event handling and enhance error management

- Updated `DraftWorkflowTriggerNodeApi` to utilize the new `TriggerDebugEvent` and `TriggerDebugEventPoller` for improved event polling.
- Removed deprecated `poll_debug_event` methods from `TriggerService`, `ScheduleService`, and `WebhookService`, consolidating functionality into the new event structure.
- Enhanced error handling in `invoke_trigger_event` to utilize `TriggerPluginInvokeError` for better clarity on invocation issues.
- Updated frontend API routes to reflect changes in trigger event handling, ensuring consistency across the application.
This commit is contained in:
Harry
2025-10-15 14:41:53 +08:00
parent dab4e521af
commit 06c91fbcbd
23 changed files with 622 additions and 753 deletions

View File

@ -170,21 +170,7 @@ export const useWorkflowRun = () => {
const isInWorkflowDebug = appDetail?.mode === 'workflow'
let url = ''
if (runMode === 'schedule') {
if (!appDetail?.id) {
console.error('handleRun: missing app id for schedule trigger run')
return
}
url = `/apps/${appDetail.id}/workflows/draft/trigger/schedule/run`
}
else if (runMode === 'webhook') {
if (!appDetail?.id) {
console.error('handleRun: missing app id for webhook trigger run')
return
}
url = `/apps/${appDetail.id}/workflows/draft/trigger/webhook/run`
}
else if (runMode === 'plugin') {
if (runMode === 'plugin' || runMode === 'webhook' || runMode === 'schedule') {
if (!appDetail?.id) {
console.error('handleRun: missing app id for trigger plugin run')
return

View File

@ -264,7 +264,7 @@ const useOneStepRun = <T>({
}, [])
const runWebhookSingleRun = useCallback(async (): Promise<any | null> => {
const urlPath = `/apps/${flowId}/workflows/draft/nodes/${id}/debug/webhook/run`
const urlPath = `/apps/${flowId}/workflows/draft/nodes/${id}/trigger/run`
const urlWithPrefix = `${API_PREFIX}${urlPath.startsWith('/') ? urlPath : `/${urlPath}`}`
webhookSingleRunActiveRef.current = true
@ -364,7 +364,7 @@ const useOneStepRun = <T>({
}, [flowId, id, data, handleNodeDataUpdate, cancelWebhookSingleRun])
const runPluginSingleRun = useCallback(async (): Promise<any | null> => {
const urlPath = `/apps/${flowId}/workflows/draft/nodes/${id}/trigger`
const urlPath = `/apps/${flowId}/workflows/draft/nodes/${id}/trigger/run`
const urlWithPrefix = `${API_PREFIX}${urlPath.startsWith('/') ? urlPath : `/${urlPath}`}`
webhookSingleRunActiveRef.current = true