UNPKG

n8n

Version:

n8n Workflow Automation Tool

84 lines (83 loc) 4.12 kB
import { Logger } from '@n8n/backend-common'; import { ExecutionsConfig } from '@n8n/config'; import type { User } from '@n8n/db'; import { EvaluationCollectionRepository, TestCaseExecutionRepository, TestRun, TestRunRepository, WorkflowRepository } from '@n8n/db'; import { ErrorReporter, InstanceSettings } from 'n8n-core'; import { ConcurrencyControlService } from '../../concurrency/concurrency-control.service'; import { Publisher } from '../../scaling/pubsub/publisher.service'; import { WorkflowHistoryService } from '../../workflows/workflow-history/workflow-history.service'; import type { IDataObject, IRun, IWorkflowBase } from 'n8n-workflow'; import { ActiveExecutions } from '../../active-executions'; import { EventService } from '../../events/event.service'; import { License } from '../../license'; import { Telemetry } from '../../telemetry'; import { WorkflowRunner } from '../../workflow-runner'; export interface TestRunMetadata { testRunId: string; userId: string; } export interface TestCaseExecutionResult { executionData: IRun; executionId: string; } export declare class TestRunnerService { private readonly logger; private readonly telemetry; private readonly workflowRepository; private readonly workflowRunner; private readonly activeExecutions; private readonly testRunRepository; private readonly testCaseExecutionRepository; private readonly errorReporter; private readonly executionsConfig; private readonly eventService; private readonly publisher; private readonly instanceSettings; private readonly concurrencyControlService; private readonly license; private readonly workflowHistoryService; private readonly evaluationCollectionRepository; private abortControllers; constructor(logger: Logger, telemetry: Telemetry, workflowRepository: WorkflowRepository, workflowRunner: WorkflowRunner, activeExecutions: ActiveExecutions, testRunRepository: TestRunRepository, testCaseExecutionRepository: TestCaseExecutionRepository, errorReporter: ErrorReporter, executionsConfig: ExecutionsConfig, eventService: EventService, publisher: Publisher, instanceSettings: InstanceSettings, concurrencyControlService: ConcurrencyControlService, license: License, workflowHistoryService: WorkflowHistoryService, evaluationCollectionRepository: EvaluationCollectionRepository); private findEvaluationTriggerNode; private validateEvaluationTriggerNode; private hasModelNodeConnected; private validateSetMetricsNodes; private validateSetOutputsNodes; private validateWorkflowConfiguration; private runTestCase; private runDatasetTrigger; static getEvaluationNodes(workflow: IWorkflowBase, operation: 'setMetrics' | 'setOutputs' | 'setInputs', { isDefaultOperation }?: { isDefaultOperation: boolean; }): import("n8n-workflow").INode[]; static getEvaluationMetricsNodes(workflow: IWorkflowBase): import("n8n-workflow").INode[]; static getEvaluationSetOutputsNodes(workflow: IWorkflowBase): import("n8n-workflow").INode[]; private extractDatasetTriggerOutput; private getEvaluationData; private extractUserDefinedMetrics; private extractPredefinedMetrics; runTest(user: User, workflowId: string, concurrency?: number): Promise<void>; startTestRun(user: User, workflowId: string, concurrency?: number, options?: { collectionId?: string; workflowVersionId?: string; evaluationConfigId?: string; evaluationConfigSnapshot?: IDataObject; }): Promise<{ testRun: TestRun; finished: Promise<void>; }>; private executeTestRun; canBeCancelled(testRun: TestRun): boolean; private cancelTestRunLocally; handleCancelTestRunCommand({ testRunId }: { testRunId: string; }): void; handleCancelCollectionCommand({ collectionId }: { collectionId: string; }): Promise<void>; private cancelCollectionLocally; cancelCollection(collectionId: string): Promise<{ cancelledRunIds: string[]; }>; cancelTestRun(testRunId: string): Promise<void>; }