roccomuso / node-webhooks

:arrow_right_hook: Node.js module to create and trigger your own webHooks.
190 stars 47 forks source link

Adicionar arquivo de tipagem do typescript #28

Open jhownpaixao opened 11 months ago

jhownpaixao commented 11 months ago

adicionar suporte ao typescript:

declare module 'node-webhooks' { import type { EventEmitter2 } from 'eventemitter2';

interface WebHookOptions { db: string | Record<string, string[]>; httpSuccessCodes?: number[]; }

type WebHookCallback = ( shortname: string, jsonData: any, headersData?: Record<string, string> ) => void;

class WebHooks { constructor(options: WebHookOptions);

trigger(shortname: string, jsonData: any, headersData?: Record<string, string>): void;

add(shortname: string, url: string): Promise<boolean>;

remove(shortname: string, url?: string): Promise<boolean>;

getDB(): Promise<Record<string, string[]>>;

getWebHook(shortname: string): Promise<string[]>;

getListeners(): Record<string, WebHookCallback>;

getEmitter(): EventEmitter2;

}

export = WebHooks; }