import type http from 'http'; import type { Headers, Dispatch, AuthenticateExternal } from 'integreat'; export interface HttpChallenge { scheme: string; realm?: string; params: Record; } export interface IncomingOptions { host?: string | string[]; path?: string | string[]; port?: number; sourceService?: string; challenges?: HttpChallenge[]; caseSensitivePath?: boolean; } export interface ServiceOptions extends Record { baseUri?: string; uri?: string; method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; queryParams?: Record; headers?: Headers; incoming?: IncomingOptions; responseFormat?: string; timeout?: number; authAsQuery?: boolean; authInData?: boolean; rateLimit?: { retry: number; maxDelay?: number; }; throttle?: { limit: number; interval: number; }; } export interface HandlerCase { options: ConnectionIncomingOptions; dispatch: Dispatch; authenticate: AuthenticateExternal; } export type PortHandlers = Map>; export interface ConnectionIncomingOptions { host: string[]; path: string[]; port: number; sourceService?: string; challenges?: HttpChallenge[]; caseSensitivePath?: boolean; } export interface Connection extends Record { status: string; server?: http.Server; incoming?: ConnectionIncomingOptions; handlerCase?: HandlerCase; waitFn?: () => Promise; }