UNPKG

reshuffle

Version:

Reshuffle is a fast, unopinionated, minimalist integration framework

24 lines (23 loc) 1.19 kB
/// <reference types="node" /> import { RequestInfo, RequestInit } from 'node-fetch'; import { URL } from 'url'; import { Response, NextFunction } from 'express'; import { BaseHttpConnector, EventConfiguration } from 'reshuffle-base-connector'; export interface HttpConnectorConfigOptions { authKey?: string; authScript?: string; } export interface HttpConnectorEventOptions { method: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'; path: string; } export default class HttpConnector extends BaseHttpConnector<HttpConnectorConfigOptions, HttpConnectorEventOptions> { on(options: HttpConnectorEventOptions, handler: any, eventId?: string): EventConfiguration; handle(req: any, res: Response, next: NextFunction): Promise<boolean>; onStop(): void; fetch(url: RequestInfo, options?: RequestInit): Promise<import("node-fetch").Response>; fetchWithRetries(url: string, options?: RequestInit, retry?: Record<string, any>): Promise<unknown>; fetchWithTimeout(url: string, options: RequestInit, ms: number): Promise<unknown>; formatURL(components: Record<string, any>): string; parseURL(url: string): URL; }