UNPKG

n8n

Version:

n8n Workflow Automation Tool

298 lines (297 loc) • 16 kB
import type { GlobalConfig } from '@n8n/config'; import { type User, type SharedWorkflowRepository } from '@n8n/db'; import z from 'zod'; import type { ToolDefinition } from '../../mcp.types'; import type { CollaborationService } from '../../../../collaboration/collaboration.service'; import type { CredentialsService } from '../../../../credentials/credentials.service'; import type { SubworkflowPolicyChecker } from '../../../../executions/pre-execution-checks/subworkflow-policy-checker'; import type { WorkflowPublishedDataService } from '../../../../workflows/workflow-published-data.service'; import type { DataTableUserOperations } from '../../../../modules/data-table/data-table-proxy.service'; import type { NodeTypes } from '../../../../node-types'; import type { TagService } from '../../../../services/tag.service'; import type { AiGatewayService } from '../../../../services/ai-gateway.service'; import type { UrlService } from '../../../../services/url.service'; import type { Telemetry } from '../../../../telemetry'; import type { WorkflowFinderService } from '../../../../workflows/workflow-finder.service'; import type { WorkflowService } from '../../../../workflows/workflow.service'; declare const buildInputSchema: (canvasGroupsEnabled: boolean) => { workflowId: z.ZodString; skillsUsed: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; operations: z.ZodArray<z.ZodObject<{ type: z.ZodEnum<["updateNodeParameters", "setNodeParameter", "addNode", "removeNode", "renameNode", "addConnection", "removeConnection", "setNodeCredential", "setNodePosition", "setNodeDisabled", "setNodeSettings", "setWorkflowMetadata", "setWorkflowSettings", "addTags", "removeTags", "setNodeGroups"]> | z.ZodEnum<["updateNodeParameters", "setNodeParameter", "addNode", "removeNode", "renameNode", "addConnection", "removeConnection", "setNodeCredential", "setNodePosition", "setNodeDisabled", "setNodeSettings", "setWorkflowMetadata", "setWorkflowSettings", "addTags", "removeTags", "setNodeGroups", "addNodeGroup", "removeNodeGroup", "updateNodeGroup"]>; nodeName: z.ZodOptional<z.ZodString>; node: z.ZodOptional<z.ZodObject<{ name: z.ZodString; type: z.ZodString; typeVersion: z.ZodNumber; parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; position: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>; credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{ id: z.ZodOptional<z.ZodString>; name: z.ZodString; }, "strip", z.ZodTypeAny, { id?: string | undefined; name: string; }, { id?: string | undefined; name: string; }>>>; disabled: z.ZodOptional<z.ZodBoolean>; notes: z.ZodOptional<z.ZodString>; id: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { name: string; type: string; typeVersion: number; parameters?: Record<string, unknown> | undefined; position?: number[] | undefined; credentials?: Record<string, { id?: string | undefined; name: string; }> | undefined; disabled?: boolean | undefined; notes?: string | undefined; id?: string | undefined; }, { name: string; type: string; typeVersion: number; parameters?: Record<string, unknown> | undefined; position?: number[] | undefined; credentials?: Record<string, { id?: string | undefined; name: string; }> | undefined; disabled?: boolean | undefined; notes?: string | undefined; id?: string | undefined; }>>; parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; replace: z.ZodOptional<z.ZodBoolean>; path: z.ZodOptional<z.ZodString>; value: z.ZodOptional<z.ZodUnknown>; oldName: z.ZodOptional<z.ZodString>; newName: z.ZodOptional<z.ZodString>; source: z.ZodOptional<z.ZodString>; target: z.ZodOptional<z.ZodString>; sourceIndex: z.ZodOptional<z.ZodNumber>; targetIndex: z.ZodOptional<z.ZodNumber>; connectionType: z.ZodOptional<z.ZodString>; credentialKey: z.ZodOptional<z.ZodString>; credentialId: z.ZodOptional<z.ZodString>; credentialName: z.ZodOptional<z.ZodString>; position: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>; disabled: z.ZodOptional<z.ZodBoolean>; settings: z.ZodOptional<z.ZodObject<{ errorWorkflow: z.ZodOptional<z.ZodString>; timezone: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>; executionOrder: z.ZodOptional<z.ZodEnum<["v0", "v1"]>>; saveExecutionProgress: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"DEFAULT">]>>; saveManualExecutions: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"DEFAULT">]>>; saveDataErrorExecution: z.ZodOptional<z.ZodEnum<["DEFAULT", "all", "none"]>>; saveDataSuccessExecution: z.ZodOptional<z.ZodEnum<["DEFAULT", "all", "none"]>>; executionTimeout: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>; timeSavedPerExecution: z.ZodOptional<z.ZodNumber>; callerPolicy: z.ZodOptional<z.ZodEnum<["any", "none", "workflowsFromAList", "workflowsFromSameOwner"]>>; callerIds: z.ZodOptional<z.ZodString>; onError: z.ZodOptional<z.ZodEnum<["stopWorkflow", "continueRegularOutput", "continueErrorOutput"]>>; retryOnFail: z.ZodOptional<z.ZodBoolean>; maxTries: z.ZodOptional<z.ZodNumber>; waitBetweenTries: z.ZodOptional<z.ZodNumber>; alwaysOutputData: z.ZodOptional<z.ZodBoolean>; executeOnce: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { errorWorkflow?: string | undefined; timezone?: string | undefined; executionOrder?: "v0" | "v1" | undefined; saveExecutionProgress?: "DEFAULT" | boolean | undefined; saveManualExecutions?: "DEFAULT" | boolean | undefined; saveDataErrorExecution?: "DEFAULT" | "all" | "none" | undefined; saveDataSuccessExecution?: "DEFAULT" | "all" | "none" | undefined; executionTimeout?: number | undefined; timeSavedPerExecution?: number | undefined; callerPolicy?: "any" | "none" | "workflowsFromAList" | "workflowsFromSameOwner" | undefined; callerIds?: string | undefined; onError?: "continueErrorOutput" | "continueRegularOutput" | "stopWorkflow" | undefined; retryOnFail?: boolean | undefined; maxTries?: number | undefined; waitBetweenTries?: number | undefined; alwaysOutputData?: boolean | undefined; executeOnce?: boolean | undefined; }, { errorWorkflow?: string | undefined; timezone?: string | undefined; executionOrder?: "v0" | "v1" | undefined; saveExecutionProgress?: "DEFAULT" | boolean | undefined; saveManualExecutions?: "DEFAULT" | boolean | undefined; saveDataErrorExecution?: "DEFAULT" | "all" | "none" | undefined; saveDataSuccessExecution?: "DEFAULT" | "all" | "none" | undefined; executionTimeout?: number | undefined; timeSavedPerExecution?: number | undefined; callerPolicy?: "any" | "none" | "workflowsFromAList" | "workflowsFromSameOwner" | undefined; callerIds?: string | undefined; onError?: "continueErrorOutput" | "continueRegularOutput" | "stopWorkflow" | undefined; retryOnFail?: boolean | undefined; maxTries?: number | undefined; waitBetweenTries?: number | undefined; alwaysOutputData?: boolean | undefined; executeOnce?: boolean | undefined; }>>; name: z.ZodOptional<z.ZodString>; description: z.ZodOptional<z.ZodString>; names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; nodeGroups: z.ZodOptional<z.ZodArray<z.ZodObject<{ id: z.ZodOptional<z.ZodString>; name: z.ZodString; nodeNames: z.ZodArray<z.ZodString, "many">; description: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { id?: string | undefined; name: string; nodeNames: string[]; description?: string | undefined; }, { id?: string | undefined; name: string; nodeNames: string[]; description?: string | undefined; }>, "many">>; groupName?: z.ZodOptional<z.ZodString> | undefined; nodeNames?: z.ZodOptional<z.ZodArray<z.ZodString, "many">> | undefined; id?: z.ZodOptional<z.ZodString> | undefined; }, "strip", z.ZodTypeAny, { type: "addConnection" | "addNode" | "addNodeGroup" | "addTags" | "removeConnection" | "removeNode" | "removeNodeGroup" | "removeTags" | "renameNode" | "setNodeCredential" | "setNodeDisabled" | "setNodeGroups" | "setNodeParameter" | "setNodePosition" | "setNodeSettings" | "setWorkflowMetadata" | "setWorkflowSettings" | "updateNodeGroup" | "updateNodeParameters"; nodeName?: string | undefined; node?: { name: string; type: string; typeVersion: number; parameters?: Record<string, unknown> | undefined; position?: number[] | undefined; credentials?: Record<string, { id?: string | undefined; name: string; }> | undefined; disabled?: boolean | undefined; notes?: string | undefined; id?: string | undefined; } | undefined; parameters?: Record<string, unknown> | undefined; replace?: boolean | undefined; path?: string | undefined; value?: unknown; oldName?: string | undefined; newName?: string | undefined; source?: string | undefined; target?: string | undefined; sourceIndex?: number | undefined; targetIndex?: number | undefined; connectionType?: string | undefined; credentialKey?: string | undefined; credentialId?: string | undefined; credentialName?: string | undefined; position?: number[] | undefined; disabled?: boolean | undefined; settings?: { errorWorkflow?: string | undefined; timezone?: string | undefined; executionOrder?: "v0" | "v1" | undefined; saveExecutionProgress?: "DEFAULT" | boolean | undefined; saveManualExecutions?: "DEFAULT" | boolean | undefined; saveDataErrorExecution?: "DEFAULT" | "all" | "none" | undefined; saveDataSuccessExecution?: "DEFAULT" | "all" | "none" | undefined; executionTimeout?: number | undefined; timeSavedPerExecution?: number | undefined; callerPolicy?: "any" | "none" | "workflowsFromAList" | "workflowsFromSameOwner" | undefined; callerIds?: string | undefined; onError?: "continueErrorOutput" | "continueRegularOutput" | "stopWorkflow" | undefined; retryOnFail?: boolean | undefined; maxTries?: number | undefined; waitBetweenTries?: number | undefined; alwaysOutputData?: boolean | undefined; executeOnce?: boolean | undefined; } | undefined; name?: string | undefined; description?: string | undefined; names?: string[] | undefined; nodeGroups?: { id?: string | undefined; name: string; nodeNames: string[]; description?: string | undefined; }[] | undefined; groupName?: unknown; nodeNames?: unknown; id?: unknown; }, { type: "addConnection" | "addNode" | "addNodeGroup" | "addTags" | "removeConnection" | "removeNode" | "removeNodeGroup" | "removeTags" | "renameNode" | "setNodeCredential" | "setNodeDisabled" | "setNodeGroups" | "setNodeParameter" | "setNodePosition" | "setNodeSettings" | "setWorkflowMetadata" | "setWorkflowSettings" | "updateNodeGroup" | "updateNodeParameters"; nodeName?: string | undefined; node?: { name: string; type: string; typeVersion: number; parameters?: Record<string, unknown> | undefined; position?: number[] | undefined; credentials?: Record<string, { id?: string | undefined; name: string; }> | undefined; disabled?: boolean | undefined; notes?: string | undefined; id?: string | undefined; } | undefined; parameters?: Record<string, unknown> | undefined; replace?: boolean | undefined; path?: string | undefined; value?: unknown; oldName?: string | undefined; newName?: string | undefined; source?: string | undefined; target?: string | undefined; sourceIndex?: number | undefined; targetIndex?: number | undefined; connectionType?: string | undefined; credentialKey?: string | undefined; credentialId?: string | undefined; credentialName?: string | undefined; position?: number[] | undefined; disabled?: boolean | undefined; settings?: { errorWorkflow?: string | undefined; timezone?: string | undefined; executionOrder?: "v0" | "v1" | undefined; saveExecutionProgress?: "DEFAULT" | boolean | undefined; saveManualExecutions?: "DEFAULT" | boolean | undefined; saveDataErrorExecution?: "DEFAULT" | "all" | "none" | undefined; saveDataSuccessExecution?: "DEFAULT" | "all" | "none" | undefined; executionTimeout?: number | undefined; timeSavedPerExecution?: number | undefined; callerPolicy?: "any" | "none" | "workflowsFromAList" | "workflowsFromSameOwner" | undefined; callerIds?: string | undefined; onError?: "continueErrorOutput" | "continueRegularOutput" | "stopWorkflow" | undefined; retryOnFail?: boolean | undefined; maxTries?: number | undefined; waitBetweenTries?: number | undefined; alwaysOutputData?: boolean | undefined; executeOnce?: boolean | undefined; } | undefined; name?: string | undefined; description?: string | undefined; names?: string[] | undefined; nodeGroups?: { id?: string | undefined; name: string; nodeNames: string[]; description?: string | undefined; }[] | undefined; groupName?: unknown; nodeNames?: unknown; id?: unknown; }>, "many">; versionName: z.ZodOptional<z.ZodString>; versionDescription: z.ZodOptional<z.ZodString>; }; export declare const createUpdateWorkflowTool: (user: User, workflowFinderService: WorkflowFinderService, workflowService: WorkflowService, urlService: UrlService, telemetry: Telemetry, nodeTypes: NodeTypes, credentialsService: CredentialsService, sharedWorkflowRepository: SharedWorkflowRepository, collaborationService: CollaborationService, dataTableOps: DataTableUserOperations, tagService: TagService, globalConfig: GlobalConfig, subworkflowPolicyChecker: SubworkflowPolicyChecker, workflowPublishedDataService: WorkflowPublishedDataService, aiGatewayService: AiGatewayService, options?: { canvasGroupsEnabled?: boolean; }) => ToolDefinition<ReturnType<typeof buildInputSchema>>; export {};