source: node_modules/agentkeepalive/index.d.ts@ 81bc7da

finki-main main
Last change on this file since 81bc7da was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago

Initial commit

  • Property mode set to 100644
File size: 2.1 KB
RevLine 
[81bc7da]1import * as http from 'http';
2import * as https from 'https';
3import * as net from 'net';
4
5interface PlainObject {
6 [key: string]: any;
7}
8
9declare class _HttpAgent extends http.Agent {
10 constructor(opts?: AgentKeepAlive.HttpOptions);
11 readonly statusChanged: boolean;
12 createConnection(options: net.NetConnectOpts, cb?: Function): net.Socket;
13 createSocket(req: http.IncomingMessage, options: http.RequestOptions, cb: Function): void;
14 getCurrentStatus(): AgentKeepAlive.AgentStatus;
15}
16
17interface Constants {
18 CURRENT_ID: Symbol;
19 CREATE_ID: Symbol;
20 INIT_SOCKET: Symbol;
21 CREATE_HTTPS_CONNECTION: Symbol;
22 SOCKET_CREATED_TIME: Symbol;
23 SOCKET_NAME: Symbol;
24 SOCKET_REQUEST_COUNT: Symbol;
25 SOCKET_REQUEST_FINISHED_COUNT: Symbol;
26}
27
28/**
29 * @deprecated instead use `import { HttpAgent } from 'agentkeepalive'; or `const HttpAgent = require('agentkeepalive').HttpAgent;`
30 */
31declare class AgentKeepAlive extends _HttpAgent {}
32
33declare namespace AgentKeepAlive {
34 export interface AgentStatus {
35 createSocketCount: number;
36 createSocketErrorCount: number;
37 closeSocketCount: number;
38 errorSocketCount: number;
39 timeoutSocketCount: number;
40 requestCount: number;
41 freeSockets: PlainObject;
42 sockets: PlainObject;
43 requests: PlainObject;
44 }
45
46 interface CommonHttpOption {
47 keepAlive?: boolean | undefined;
48 freeSocketTimeout?: number | undefined;
49 freeSocketKeepAliveTimeout?: number | undefined;
50 timeout?: number | undefined;
51 socketActiveTTL?: number | undefined;
52 }
53
54 export interface HttpOptions extends http.AgentOptions, CommonHttpOption { }
55 export interface HttpsOptions extends https.AgentOptions, CommonHttpOption { }
56
57 export class HttpAgent extends _HttpAgent {}
58 export class HttpsAgent extends https.Agent {
59 constructor(opts?: HttpsOptions);
60 readonly statusChanged: boolean;
61 createConnection(options: net.NetConnectOpts, cb?: Function): net.Socket;
62 createSocket(req: http.IncomingMessage, options: http.RequestOptions, cb: Function): void;
63 getCurrentStatus(): AgentStatus;
64 }
65
66 export const constants: Constants;
67}
68
69export = AgentKeepAlive;
Note: See TracBrowser for help on using the repository browser.