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 { Flow, FlowApprovalRequest, FlowApprovalRequestState, FlowVersion, Platform, Project, User } from '@activepieces/shared'
import { EntitySchema } from 'typeorm'
import { ApIdSchema, BaseColumnSchemaPart } from '../../../database/database-common'
export type FlowApprovalRequestSchema = FlowApprovalRequest & {
flow: Flow
flowVersion: FlowVersion
project: Project
platform: Platform
submitter: User | null
approver: User | null
}
export const FlowApprovalRequestEntity = new EntitySchema<FlowApprovalRequestSchema>({
name: 'flow_approval_request',
columns: {
...BaseColumnSchemaPart,
flowId: {
...ApIdSchema,
nullable: false,
},
flowVersionId: {
...ApIdSchema,
nullable: false,
},
projectId: {
...ApIdSchema,
nullable: false,
},
platformId: {
...ApIdSchema,
nullable: false,
},
submitterId: {
...ApIdSchema,
nullable: true,
},
submittedAt: {
type: 'timestamp with time zone',
nullable: false,
},
approverId: {
...ApIdSchema,
nullable: true,
},
decidedAt: {
type: 'timestamp with time zone',
nullable: true,
},
state: {
type: String,
enum: FlowApprovalRequestState,
nullable: false,
},
requestedStatus: {
type: String,
nullable: false,
},
rejectionReason: {
type: 'text',
nullable: true,
},
},
indices: [
{
name: 'idx_flow_approval_request_flow_version_id',
columns: ['flowVersionId'],
},
{
name: 'idx_flow_approval_request_flow_id_pending',
columns: ['flowId'],
unique: true,
where: '"state" = \'PENDING\'',
},
{
name: 'idx_flow_approval_request_project_id_state_created',
columns: ['projectId', 'state', 'created'],
},
{
name: 'idx_flow_approval_request_flow_id_state',
columns: ['flowId', 'state'],
},
{
name: 'idx_flow_approval_request_platform_id_state',
columns: ['platformId', 'state'],
},
],
relations: {
flow: {
type: 'many-to-one',
target: 'flow',
onDelete: 'CASCADE',
joinColumn: {
name: 'flowId',
foreignKeyConstraintName: 'fk_flow_approval_request_flow_id',
},
},
flowVersion: {
type: 'many-to-one',
target: 'flow_version',
onDelete: 'CASCADE',
joinColumn: {
name: 'flowVersionId',
foreignKeyConstraintName: 'fk_flow_approval_request_flow_version_id',
},
},
submitter: {
type: 'many-to-one',
target: 'user',
onDelete: 'SET NULL',
nullable: true,
joinColumn: {
name: 'submitterId',
foreignKeyConstraintName: 'fk_flow_approval_request_submitter_id',
},
},
approver: {
type: 'many-to-one',
target: 'user',
onDelete: 'SET NULL',
nullable: true,
joinColumn: {
name: 'approverId',
foreignKeyConstraintName: 'fk_flow_approval_request_approver_id',
},
},
},
})