AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { CancelTestTriggerRequestBody, PrincipalType, TestTriggerRequestBody } from '@activepieces/shared'
import { FastifyPluginAsyncZod } from 'fastify-type-provider-zod'
import { ProjectResourceType } from '../../core/security/authorization/common'
import { securityAccess } from '../../core/security/authorization/fastify-security'
import { testTriggerService } from '../../trigger/test-trigger/test-trigger-service'
export const testTriggerController: FastifyPluginAsyncZod = async (app) => {
app.post('/', TestTriggerRequest, async (req) => {
const { flowId, flowVersionId, testStrategy } = req.body
const logWithContext = req.log.child({
flow: { id: flowId },
flowVersion: { id: flowVersionId },
project: { id: req.projectId },
testStrategy,
})
return testTriggerService(logWithContext).test({
flowId,
flowVersionId,
projectId: req.projectId,
testStrategy,
})
})
app.delete('/', CancelTestTriggerRequest, async (req) => {
const { flowId } = req.body
return testTriggerService(req.log).cancel({
flowId,
projectId: req.projectId,
})
})
}
const TestTriggerRequest = {
schema: {
body: TestTriggerRequestBody,
},
config: {
security: securityAccess.project([PrincipalType.USER], undefined, {
type: ProjectResourceType.BODY,
}),
},
}
const CancelTestTriggerRequest = {
schema: {
body: CancelTestTriggerRequestBody,
},
config: {
security: securityAccess.project([PrincipalType.USER], undefined, {
type: ProjectResourceType.BODY,
}),
},
}