import { Logger } from '@n8n/backend-common'; import { EventService } from '@n8n/backend-services'; import { EndpointsConfig } from '@n8n/config'; import type { IExecutionResponse } from '@n8n/db'; import type { ExecutionSnapshot, ResumeTargetResponse } from '@n8n/engine'; import type express from 'express'; import { InstanceSettings } from 'n8n-core'; import { type INode, type IWorkflowBase, Workflow } from 'n8n-workflow'; import { WebhookService } from './webhook.service'; import type { IWebhookManager, IWebhookResponseCallbackData, WaitingWebhookRequest } from './webhook.types'; import { EngineV2ExecutionReader } from '../executions/engine-v2-execution-reader.service'; import { ExecutionPersistence } from '../executions/execution-persistence'; import { type ExecutionIdV2 } from '../executions/execution-id'; import type { EngineV2ResumeRequest } from '../interfaces'; import { NodeTypes } from '../node-types'; import { EngineDataPlaneProxyService } from '../services/engine-data-plane-proxy.service'; export declare function literalPathAndQuery(originalUrl: string): string; export declare class WaitingWebhooks implements IWebhookManager { protected readonly logger: Logger; protected readonly nodeTypes: NodeTypes; private readonly executionPersistence; private readonly webhookService; protected readonly instanceSettings: InstanceSettings; private readonly eventService; private readonly endpointsConfig; protected readonly dataPlane: EngineDataPlaneProxyService; private readonly executionReader; protected includeForms: boolean; constructor(logger: Logger, nodeTypes: NodeTypes, executionPersistence: ExecutionPersistence, webhookService: WebhookService, instanceSettings: InstanceSettings, eventService: EventService, endpointsConfig: EndpointsConfig, dataPlane: EngineDataPlaneProxyService, executionReader: EngineV2ExecutionReader); getWebhookMethods(executionId: string): Promise; findAccessControlOptions(): Promise<{ allowedOrigins: string; }>; protected logReceivedWebhook(method: string, executionId: string): void; protected disableNode(execution: IExecutionResponse, _method?: string): void; private isSendAndWaitRequest; private isOwnRestartWebhook; protected isFormResumeNode(node: Pick): boolean; private isFormResumeExecution; private redirectToFormWaiting; protected createWorkflow(workflowData: IWorkflowBase): Workflow; protected getExecution(executionId: string): Promise; private parseSignatureParam; protected validateToken(req: express.Request, execution: IExecutionResponse): { valid: boolean; webhookPath?: string; }; protected validateSignature(req: express.Request): { valid: boolean; webhookPath?: string; }; private stripTokenFromRequest; executeWebhook(req: WaitingWebhookRequest, res: express.Response): Promise; protected resumeEngineV2Execution(req: WaitingWebhookRequest, res: express.Response, pathId: ExecutionIdV2, routeSuffix: string | undefined): Promise; protected buildV1ResumeExecution(snapshot: ExecutionSnapshot, nodeId: string): Promise<{ execution: IExecutionResponse; node: INode; } | undefined>; protected respondInvalidToken(res: express.Response): IWebhookResponseCallbackData; protected answerEngineV2Status(_located: { snapshot: ExecutionSnapshot; target: ResumeTargetResponse['target']; suffix: string | undefined; req: WaitingWebhookRequest; res: express.Response; }): IWebhookResponseCallbackData | undefined; protected answerEngineV2WithoutTarget(executionId: string, snapshot: ExecutionSnapshot, suffix: string | undefined, res: express.Response): IWebhookResponseCallbackData; protected sanitizeEngineV2Request(req: WaitingWebhookRequest, _resumeNode: INode): void; private emitExecutionResumedEvent; protected getWebhookExecutionData({ execution, req, res, lastNodeExecuted, executionId, suffix, engineResume, }: { execution: IExecutionResponse; req: WaitingWebhookRequest; res: express.Response; lastNodeExecuted: string; executionId: string; suffix?: string; engineResume?: EngineV2ResumeRequest; }): Promise; }