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 { SeekPage } from '@activepieces/core-utils'
import { FlowVersionMetadata, ListFlowVersionRequest, PrincipalType } from '@activepieces/shared'
import { FastifyPluginAsyncZod } from 'fastify-type-provider-zod'
import { StatusCodes } from 'http-status-codes'
import { z } from 'zod'
import { ProjectResourceType } from '../../core/security/authorization/common'
import { securityAccess } from '../../core/security/authorization/fastify-security'
import { flowVersionService } from '../flow-version/flow-version.service'
import { FlowEntity } from './flow.entity'
import { flowService } from './flow.service'
const DEFAULT_PAGE_SIZE = 10
export const flowVersionController: FastifyPluginAsyncZod = async (fastify) => {
fastify.get('/:flowId/versions', ListVersionParams, async (request) => {
const flow = await flowService(request.log).getOneOrThrow({
id: request.params.flowId,
projectId: request.projectId,
})
return flowVersionService(request.log).list({
flowId: flow.id,
limit: request.query.limit ?? DEFAULT_PAGE_SIZE,
cursorRequest: request.query.cursor ?? null,
})
},
)
}
const ListVersionParams = {
config: {
security: securityAccess.project([PrincipalType.USER], undefined, {
type: ProjectResourceType.TABLE,
tableName: FlowEntity,
lookup: {
paramKey: 'flowId',
entityField: 'id',
},
}),
},
schema: {
params: z.object({
flowId: z.string(),
}),
querystring: ListFlowVersionRequest,
response: {
[StatusCodes.OK]: SeekPage(FlowVersionMetadata),
},
},
}