refactor(core): Reorganize webhook related components under src/webhooks (no-changelog) (#10296)

This commit is contained in:
Tomi Turtiainen
2024-08-07 11:23:44 +03:00
committed by GitHub
parent 2a8f1753e8
commit c8d322a9ba
23 changed files with 118 additions and 104 deletions

View File

@@ -1,4 +1,4 @@
import type { Application, Request, Response } from 'express';
import type { Application } from 'express';
import type {
ExecutionError,
ICredentialDataDecryptedObject,
@@ -22,7 +22,6 @@ import type {
FeatureFlags,
INodeProperties,
IUserSettings,
IHttpRequestMethods,
StartNodeData,
} from 'n8n-workflow';
@@ -239,34 +238,6 @@ export interface IExternalHooksFunctions {
};
}
export type WebhookCORSRequest = Request & { method: 'OPTIONS' };
export type WebhookRequest = Request<{ path: string }> & {
method: IHttpRequestMethods;
params: Record<string, string>;
};
export type WaitingWebhookRequest = WebhookRequest & {
params: WebhookRequest['path'] & { suffix?: string };
};
export interface WebhookAccessControlOptions {
allowedOrigins?: string;
}
export interface IWebhookManager {
/** Gets all request methods associated with a webhook path*/
getWebhookMethods?: (path: string) => Promise<IHttpRequestMethods[]>;
/** Find the CORS options matching a path and method */
findAccessControlOptions?: (
path: string,
httpMethod: IHttpRequestMethods,
) => Promise<WebhookAccessControlOptions | undefined>;
executeWebhook(req: WebhookRequest, res: Response): Promise<IResponseCallbackData>;
}
export interface IVersionNotificationSettings {
enabled: boolean;
endpoint: string;
@@ -466,13 +437,6 @@ export interface IPushDataWorkerStatusPayload {
version: string;
}
export interface IResponseCallbackData {
data?: IDataObject | IDataObject[];
headers?: object;
noWebhookResponse?: boolean;
responseCode?: number;
}
export interface INodesTypeData {
[key: string]: {
className: string;