import { LicenseState, Logger } from '@n8n/backend-common';
import { GlobalConfig } from '@n8n/config';
import type { ExecutionSummaries, IExecutionResponse, User } from '@n8n/db';
import { AnnotationTagMappingRepository, ExecutionAnnotationRepository, ExecutionRepository, WorkflowHistoryRepository, WorkflowRepository } from '@n8n/db';
import { type Scope } from '@n8n/permissions';
import type { ExecutionError, INode, IWorkflowBase, WorkflowExecuteMode } from 'n8n-workflow';
import { Workflow } from 'n8n-workflow';
import { ActiveExecutions } from '../active-executions';
import { ConcurrencyControlService } from '../concurrency/concurrency-control.service';
import { EventService } from '../events/event.service';
import type { IExecutionFlattedResponse } from '../interfaces';
import { License } from '../license';
import { NodeTypes } from '../node-types';
import { RoleService } from '../services/role.service';
import { WaitTracker } from '../wait-tracker';
import { WorkflowRunner } from '../workflow-runner';
import { WorkflowSharingService } from '../workflows/workflow-sharing.service';
import { ExecutionPersistence } from './execution-persistence';
import { ExecutionRedactionServiceProxy } from './execution-redaction-proxy.service';
import type { ExecutionRequest, StopResult } from './execution.types';
export declare const schemaGetExecutionsQueryFilter: {
    $id: string;
    type: string;
    properties: {
        id: {
            type: string;
        };
        finished: {
            type: string;
        };
        mode: {
            type: string;
        };
        retryOf: {
            type: string;
        };
        retrySuccessId: {
            type: string;
        };
        status: {
            type: string;
            items: {
                type: string;
            };
        };
        waitTill: {
            type: string;
        };
        workflowId: {
            anyOf: {
                type: string;
            }[];
        };
        metadata: {
            type: string;
            items: {
                $ref: string;
            };
        };
        startedAfter: {
            type: string;
        };
        startedBefore: {
            type: string;
        };
        annotationTags: {
            type: string;
            items: {
                type: string;
            };
        };
        vote: {
            type: string;
        };
        projectId: {
            type: string;
        };
        workflowVersionId: {
            type: string;
        };
    };
    $defs: {
        metadata: {
            type: string;
            required: string[];
            properties: {
                key: {
                    type: string;
                };
                value: {
                    type: string;
                };
                exactMatch: {
                    type: string;
                    default: boolean;
                };
            };
        };
    };
};
export declare const allowedExecutionsQueryFilterFields: string[];
export declare class ExecutionService {
    private readonly globalConfig;
    private readonly logger;
    private readonly activeExecutions;
    private readonly executionAnnotationRepository;
    private readonly annotationTagMappingRepository;
    private readonly executionRepository;
    private readonly executionPersistence;
    private readonly workflowHistoryRepository;
    private readonly workflowRepository;
    private readonly nodeTypes;
    private readonly waitTracker;
    private readonly workflowRunner;
    private readonly concurrencyControl;
    private readonly license;
    private readonly licenseState;
    private readonly roleService;
    private readonly workflowSharingService;
    private readonly eventService;
    private readonly executionRedactionServiceProxy;
    constructor(globalConfig: GlobalConfig, logger: Logger, activeExecutions: ActiveExecutions, executionAnnotationRepository: ExecutionAnnotationRepository, annotationTagMappingRepository: AnnotationTagMappingRepository, executionRepository: ExecutionRepository, executionPersistence: ExecutionPersistence, workflowHistoryRepository: WorkflowHistoryRepository, workflowRepository: WorkflowRepository, nodeTypes: NodeTypes, waitTracker: WaitTracker, workflowRunner: WorkflowRunner, concurrencyControl: ConcurrencyControlService, license: License, licenseState: LicenseState, roleService: RoleService, workflowSharingService: WorkflowSharingService, eventService: EventService, executionRedactionServiceProxy: ExecutionRedactionServiceProxy);
    buildSharingOptions(scope: Scope): Promise<ExecutionSummaries.RangeQuery['sharingOptions']>;
    findOne(req: ExecutionRequest.GetOne | ExecutionRequest.Update, sharedWorkflowIds: string[]): Promise<IExecutionFlattedResponse | undefined>;
    getLastSuccessfulExecution(workflowId: string, user: User, redactExecutionData?: boolean): Promise<IExecutionResponse | undefined>;
    retry(req: ExecutionRequest.Retry, sharedWorkflowIds: string[]): Promise<Omit<IExecutionResponse, 'createdAt'>>;
    delete(req: ExecutionRequest.Delete, sharedWorkflowIds: string[]): Promise<void>;
    createErrorExecution(error: ExecutionError, node: INode, workflowData: IWorkflowBase, workflow: Workflow, mode: WorkflowExecuteMode): Promise<void>;
    findRangeWithCount(query: ExecutionSummaries.RangeQuery): Promise<{
        count: number;
        estimated: boolean;
        results: import("n8n-workflow").ExecutionSummary[];
    }>;
    findLatestCurrentAndCompleted(query: ExecutionSummaries.RangeQuery): Promise<{
        results: import("n8n-workflow").ExecutionSummary[];
        count: number;
        estimated: boolean;
    }>;
    getConcurrentExecutionsCount(): Promise<number>;
    private isConcurrentExecutionsCountSupported;
    private getExecutionsCountForQuery;
    findAllEnqueuedExecutions(): Promise<IExecutionResponse[]>;
    stop(executionId: string, sharedWorkflowIds: string[]): Promise<StopResult>;
    stopMany(query: ExecutionSummaries.StopExecutionFilterQuery, sharedWorkflowIds: string[]): Promise<number>;
    private assertStoppable;
    private stopInRegularMode;
    private stopInScalingMode;
    addScopes(user: User, summaries: ExecutionSummaries.ExecutionSummaryWithScopes[]): Promise<void>;
    annotate(executionId: string, updateData: ExecutionRequest.ExecutionUpdatePayload, sharedWorkflowIds: string[]): Promise<void>;
    getExecutedVersions(workflowId: string): Promise<Array<{
        versionId: string;
        name: string | null;
        createdAt: Date;
    }>>;
}
