Skip to content

Commit

Permalink
refactor: Improve typings for webhook methods (no-changelog) (#5713)
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy authored Mar 17, 2023
1 parent a28396e commit 6a8c9b7
Show file tree
Hide file tree
Showing 43 changed files with 10 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export class ActiveCampaignTrigger implements INodeType {
},
};

// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ export class AcuitySchedulingTrigger implements INodeType {
],
};

// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Affinity/AffinityTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ export class AffinityTrigger implements INodeType {
],
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Asana/AsanaTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ export class AsanaTrigger implements INodeType {
},
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export class AutopilotTrigger implements INodeType {
],
};

// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ export class BitbucketTrigger implements INodeType {
},
};

// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Box/BoxTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ export class BoxTrigger implements INodeType {
],
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Calendly/CalendlyTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export class CalendlyTrigger implements INodeType {
],
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ export class CiscoWebexTrigger implements INodeType {
],
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/ClickUp/ClickUpTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ export class ClickUpTrigger implements INodeType {
},
};

// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ export class ConvertKitTrigger implements INodeType {
},
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Copper/CopperTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ export class CopperTrigger implements INodeType {
],
};

// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ export class CustomerIoTrigger implements INodeType {
],
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ export class EventbriteTrigger implements INodeType {
},
};

// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Facebook/FacebookTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ export class FacebookTrigger implements INodeType {
},
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Figma/FigmaTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export class FigmaTrigger implements INodeType {
],
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Flow/FlowTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export class FlowTrigger implements INodeType {
],
};

// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/FormIo/FormIoTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ export class FormIoTrigger implements INodeType {
},
};

// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export class FormstackTrigger implements INodeType {
},
};

// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ export class GetResponseTrigger implements INodeType {
},
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Gitlab/GitlabTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ export class GitlabTrigger implements INodeType {
],
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Gumroad/GumroadTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export class GumroadTrigger implements INodeType {
],
};

// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export class HelpScoutTrigger implements INodeType {
],
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Hubspot/HubspotTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ export class HubspotTrigger implements INodeType {
},
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export class InvoiceNinjaTrigger implements INodeType {
],
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/JotForm/JotFormTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ export class JotFormTrigger implements INodeType {
},
};

// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Keap/KeapTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export class KeapTrigger implements INodeType {
},
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Lemlist/LemlistTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export class LemlistTrigger implements INodeType {
},
};

// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Linear/LinearTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ export class LinearTrigger implements INodeType {
},
};

//@ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ export class MailchimpTrigger implements INodeType {
},
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export class MailerLiteTrigger implements INodeType {
],
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Mailjet/MailjetTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export class MailjetTrigger implements INodeType {
],
};

// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Mautic/MauticTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ export class MauticTrigger implements INodeType {
},
};

// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Pushcut/PushcutTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export class PushcutTrigger implements INodeType {
],
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ export class SendInBlueTrigger implements INodeType {
],
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Strava/StravaTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export class StravaTrigger implements INodeType {
],
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Taiga/TaigaTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ export class TaigaTrigger implements INodeType {
},
};

// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/TheHive/TheHiveTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export class TheHiveTrigger implements INodeType {
properties: [...eventsDescription],
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Trello/TrelloTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export class TrelloTrigger implements INodeType {
],
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Typeform/TypeformTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ export class TypeformTrigger implements INodeType {
},
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
1 change: 0 additions & 1 deletion packages/nodes-base/nodes/Workable/WorkableTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ export class WorkableTrigger implements INodeType {
},
};

// @ts-ignore (because of request)
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
Expand Down
20 changes: 6 additions & 14 deletions packages/workflow/src/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,8 @@ export interface ITriggerResponse {
manualTriggerResponse?: Promise<INodeExecutionData[][]>;
}

export type WebhookSetupMethodNames = 'checkExists' | 'create' | 'delete';

export interface INodeType {
description: INodeTypeDescription;
execute?(
Expand All @@ -1172,9 +1174,6 @@ export interface INodeType {
poll?(this: IPollFunctions): Promise<INodeExecutionData[][] | null>;
trigger?(this: ITriggerFunctions): Promise<ITriggerResponse | undefined>;
webhook?(this: IWebhookFunctions): Promise<IWebhookResponseData>;
hooks?: {
[key: string]: (this: IHookFunctions) => Promise<boolean>;
};
methods?: {
loadOptions?: {
[key: string]: (this: ILoadOptionsFunctions) => Promise<INodePropertyOptions[]>;
Expand All @@ -1192,7 +1191,9 @@ export interface INodeType {
};
};
webhookMethods?: {
[key: string]: IWebhookSetupMethods;
[name in IWebhookDescription['name']]?: {
[method in WebhookSetupMethodNames]: (this: IHookFunctions) => Promise<boolean>;
};
};
}

Expand All @@ -1213,15 +1214,6 @@ export interface INodeCredentialTestRequest {
credentials: ICredentialsDecrypted;
}

export type WebhookSetupMethodNames = 'checkExists' | 'create' | 'delete';

export interface IWebhookSetupMethods {
[key: string]: ((this: IHookFunctions) => Promise<boolean>) | undefined;
checkExists?: (this: IHookFunctions) => Promise<boolean>;
create?: (this: IHookFunctions) => Promise<boolean>;
delete?: (this: IHookFunctions) => Promise<boolean>;
}

export interface INodeCredentialDescription {
name: string;
required?: boolean;
Expand Down Expand Up @@ -1436,7 +1428,7 @@ export interface IWebhookDescription {
[key: string]: WebhookHttpMethod | WebhookResponseMode | boolean | string | undefined;
httpMethod: WebhookHttpMethod | string;
isFullPath?: boolean;
name: string;
name: 'default' | 'setup';
path: string;
responseBinaryPropertyName?: string;
responseContentType?: string;
Expand Down
Loading

0 comments on commit 6a8c9b7

Please sign in to comment.