@wbce/projen-d9 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/.jsii +552 -0
  2. package/API.md +8472 -0
  3. package/CHANGELOG.md +189 -0
  4. package/LICENSE +674 -0
  5. package/README.md +82 -0
  6. package/lib/cli/commands/init.d.ts +1 -0
  7. package/lib/cli/commands/init.js +8 -0
  8. package/lib/cli/commands/save/apply-snapshot.d.ts +7 -0
  9. package/lib/cli/commands/save/apply-snapshot.js +278 -0
  10. package/lib/cli/commands/save/cli.d.ts +8 -0
  11. package/lib/cli/commands/save/cli.js +33 -0
  12. package/lib/cli/commands/save/draft.d.ts +0 -0
  13. package/lib/cli/commands/save/draft.js +2 -0
  14. package/lib/cli/commands/save/utils.d.ts +9 -0
  15. package/lib/cli/commands/save/utils.js +123 -0
  16. package/lib/cli/commands/sync.d.ts +5 -0
  17. package/lib/cli/commands/sync.js +13 -0
  18. package/lib/cli/index.d.ts +2 -0
  19. package/lib/cli/index.js +44 -0
  20. package/lib/index.d.ts +59 -0
  21. package/lib/index.js +322 -0
  22. package/node_modules/@types/node/LICENSE +21 -0
  23. package/node_modules/@types/node/README.md +16 -0
  24. package/node_modules/@types/node/assert.d.ts +117 -0
  25. package/node_modules/@types/node/async_hooks.d.ts +246 -0
  26. package/node_modules/@types/node/buffer.d.ts +22 -0
  27. package/node_modules/@types/node/child_process.d.ts +507 -0
  28. package/node_modules/@types/node/cluster.d.ts +260 -0
  29. package/node_modules/@types/node/console.d.ts +3 -0
  30. package/node_modules/@types/node/constants.d.ts +448 -0
  31. package/node_modules/@types/node/crypto.d.ts +1183 -0
  32. package/node_modules/@types/node/dgram.d.ts +118 -0
  33. package/node_modules/@types/node/dns.d.ts +372 -0
  34. package/node_modules/@types/node/domain.d.ts +16 -0
  35. package/node_modules/@types/node/events.d.ts +47 -0
  36. package/node_modules/@types/node/fs.d.ts +2567 -0
  37. package/node_modules/@types/node/globals.d.ts +1351 -0
  38. package/node_modules/@types/node/globals.global.d.ts +1 -0
  39. package/node_modules/@types/node/http.d.ts +456 -0
  40. package/node_modules/@types/node/http2.d.ts +952 -0
  41. package/node_modules/@types/node/https.d.ts +156 -0
  42. package/node_modules/@types/node/index.d.ts +91 -0
  43. package/node_modules/@types/node/inspector.d.ts +3040 -0
  44. package/node_modules/@types/node/module.d.ts +3 -0
  45. package/node_modules/@types/node/net.d.ts +290 -0
  46. package/node_modules/@types/node/os.d.ts +263 -0
  47. package/node_modules/@types/node/package.json +195 -0
  48. package/node_modules/@types/node/path.d.ts +159 -0
  49. package/node_modules/@types/node/perf_hooks.d.ts +259 -0
  50. package/node_modules/@types/node/process.d.ts +15 -0
  51. package/node_modules/@types/node/punycode.d.ts +75 -0
  52. package/node_modules/@types/node/querystring.d.ts +29 -0
  53. package/node_modules/@types/node/readline.d.ts +158 -0
  54. package/node_modules/@types/node/repl.d.ts +390 -0
  55. package/node_modules/@types/node/stream.d.ts +334 -0
  56. package/node_modules/@types/node/string_decoder.d.ts +7 -0
  57. package/node_modules/@types/node/timers.d.ts +16 -0
  58. package/node_modules/@types/node/tls.d.ts +713 -0
  59. package/node_modules/@types/node/trace_events.d.ts +61 -0
  60. package/node_modules/@types/node/tty.d.ts +66 -0
  61. package/node_modules/@types/node/url.d.ts +147 -0
  62. package/node_modules/@types/node/util.d.ts +200 -0
  63. package/node_modules/@types/node/v8.d.ts +197 -0
  64. package/node_modules/@types/node/vm.d.ts +112 -0
  65. package/node_modules/@types/node/wasi.d.ts +55 -0
  66. package/node_modules/@types/node/worker_threads.d.ts +207 -0
  67. package/node_modules/@types/node/zlib.d.ts +356 -0
  68. package/node_modules/@types/pg/LICENSE +21 -0
  69. package/node_modules/@types/pg/README.md +15 -0
  70. package/node_modules/@types/pg/index.d.mts +56 -0
  71. package/node_modules/@types/pg/index.d.ts +360 -0
  72. package/node_modules/@types/pg/lib/connection-parameters.d.ts +58 -0
  73. package/node_modules/@types/pg/lib/type-overrides.d.ts +77 -0
  74. package/node_modules/@types/pg/package.json +38 -0
  75. package/node_modules/@types/pg-copy-streams/LICENSE +21 -0
  76. package/node_modules/@types/pg-copy-streams/README.md +38 -0
  77. package/node_modules/@types/pg-copy-streams/index.d.ts +19 -0
  78. package/node_modules/@types/pg-copy-streams/package.json +28 -0
  79. package/node_modules/commander/LICENSE +22 -0
  80. package/node_modules/commander/Readme.md +1176 -0
  81. package/node_modules/commander/esm.mjs +16 -0
  82. package/node_modules/commander/index.js +24 -0
  83. package/node_modules/commander/lib/argument.js +150 -0
  84. package/node_modules/commander/lib/command.js +2777 -0
  85. package/node_modules/commander/lib/error.js +39 -0
  86. package/node_modules/commander/lib/help.js +747 -0
  87. package/node_modules/commander/lib/option.js +380 -0
  88. package/node_modules/commander/lib/suggestSimilar.js +101 -0
  89. package/node_modules/commander/package-support.json +19 -0
  90. package/node_modules/commander/package.json +82 -0
  91. package/node_modules/commander/typings/esm.d.mts +3 -0
  92. package/node_modules/commander/typings/index.d.ts +1113 -0
  93. package/node_modules/pg/LICENSE +21 -0
  94. package/node_modules/pg/README.md +95 -0
  95. package/node_modules/pg/esm/index.mjs +20 -0
  96. package/node_modules/pg/lib/client.js +743 -0
  97. package/node_modules/pg/lib/connection-parameters.js +171 -0
  98. package/node_modules/pg/lib/connection.js +221 -0
  99. package/node_modules/pg/lib/crypto/cert-signatures.js +122 -0
  100. package/node_modules/pg/lib/crypto/sasl.js +212 -0
  101. package/node_modules/pg/lib/crypto/utils-legacy.js +43 -0
  102. package/node_modules/pg/lib/crypto/utils-webcrypto.js +89 -0
  103. package/node_modules/pg/lib/crypto/utils.js +9 -0
  104. package/node_modules/pg/lib/defaults.js +91 -0
  105. package/node_modules/pg/lib/index.js +73 -0
  106. package/node_modules/pg/lib/native/client.js +323 -0
  107. package/node_modules/pg/lib/native/index.js +2 -0
  108. package/node_modules/pg/lib/native/query.js +165 -0
  109. package/node_modules/pg/lib/query.js +252 -0
  110. package/node_modules/pg/lib/result.js +109 -0
  111. package/node_modules/pg/lib/stream.js +83 -0
  112. package/node_modules/pg/lib/type-overrides.js +35 -0
  113. package/node_modules/pg/lib/utils.js +217 -0
  114. package/node_modules/pg/package.json +76 -0
  115. package/node_modules/pg-copy-streams/Makefile +19 -0
  116. package/node_modules/pg-copy-streams/README.md +315 -0
  117. package/node_modules/pg-copy-streams/copy-both.js +267 -0
  118. package/node_modules/pg-copy-streams/copy-from.js +173 -0
  119. package/node_modules/pg-copy-streams/copy-to.js +177 -0
  120. package/node_modules/pg-copy-streams/eslint.config.js +55 -0
  121. package/node_modules/pg-copy-streams/index.js +17 -0
  122. package/node_modules/pg-copy-streams/message-formats.js +27 -0
  123. package/node_modules/pg-copy-streams/obuf.js +376 -0
  124. package/node_modules/pg-copy-streams/package.json +51 -0
  125. package/package.json +136 -0
@@ -0,0 +1 @@
1
+ declare var global: NodeJS.Global & typeof globalThis;
@@ -0,0 +1,456 @@
1
+ declare module 'http' {
2
+ import * as stream from 'stream';
3
+ import { URL } from 'url';
4
+ import { Socket, Server as NetServer, LookupFunction } from 'net';
5
+
6
+ // incoming headers will never contain number
7
+ interface IncomingHttpHeaders {
8
+ 'accept'?: string | undefined;
9
+ 'accept-language'?: string | undefined;
10
+ 'accept-patch'?: string | undefined;
11
+ 'accept-ranges'?: string | undefined;
12
+ 'access-control-allow-credentials'?: string | undefined;
13
+ 'access-control-allow-headers'?: string | undefined;
14
+ 'access-control-allow-methods'?: string | undefined;
15
+ 'access-control-allow-origin'?: string | undefined;
16
+ 'access-control-expose-headers'?: string | undefined;
17
+ 'access-control-max-age'?: string | undefined;
18
+ 'access-control-request-headers'?: string | undefined;
19
+ 'access-control-request-method'?: string | undefined;
20
+ 'age'?: string | undefined;
21
+ 'allow'?: string | undefined;
22
+ 'alt-svc'?: string | undefined;
23
+ 'authorization'?: string | undefined;
24
+ 'cache-control'?: string | undefined;
25
+ 'connection'?: string | undefined;
26
+ 'content-disposition'?: string | undefined;
27
+ 'content-encoding'?: string | undefined;
28
+ 'content-language'?: string | undefined;
29
+ 'content-length'?: string | undefined;
30
+ 'content-location'?: string | undefined;
31
+ 'content-range'?: string | undefined;
32
+ 'content-type'?: string | undefined;
33
+ 'cookie'?: string | undefined;
34
+ 'date'?: string | undefined;
35
+ 'etag'?: string | undefined;
36
+ 'expect'?: string | undefined;
37
+ 'expires'?: string | undefined;
38
+ 'forwarded'?: string | undefined;
39
+ 'from'?: string | undefined;
40
+ 'host'?: string | undefined;
41
+ 'if-match'?: string | undefined;
42
+ 'if-modified-since'?: string | undefined;
43
+ 'if-none-match'?: string | undefined;
44
+ 'if-unmodified-since'?: string | undefined;
45
+ 'last-modified'?: string | undefined;
46
+ 'location'?: string | undefined;
47
+ 'origin'?: string | undefined;
48
+ 'pragma'?: string | undefined;
49
+ 'proxy-authenticate'?: string | undefined;
50
+ 'proxy-authorization'?: string | undefined;
51
+ 'public-key-pins'?: string | undefined;
52
+ 'range'?: string | undefined;
53
+ 'referer'?: string | undefined;
54
+ 'retry-after'?: string | undefined;
55
+ 'set-cookie'?: string[] | undefined;
56
+ 'strict-transport-security'?: string | undefined;
57
+ 'tk'?: string | undefined;
58
+ 'trailer'?: string | undefined;
59
+ 'transfer-encoding'?: string | undefined;
60
+ 'upgrade'?: string | undefined;
61
+ 'user-agent'?: string | undefined;
62
+ 'vary'?: string | undefined;
63
+ 'via'?: string | undefined;
64
+ 'warning'?: string | undefined;
65
+ 'www-authenticate'?: string | undefined;
66
+ [header: string]: string | string[] | undefined;
67
+ }
68
+
69
+ // outgoing headers allows numbers (as they are converted internally to strings)
70
+ interface OutgoingHttpHeaders {
71
+ [header: string]: number | string | string[] | undefined;
72
+ }
73
+
74
+ interface ClientRequestArgs {
75
+ protocol?: string | null | undefined;
76
+ host?: string | null | undefined;
77
+ hostname?: string | null | undefined;
78
+ family?: number | undefined;
79
+ port?: number | string | null | undefined;
80
+ defaultPort?: number | string | undefined;
81
+ localAddress?: string | undefined;
82
+ socketPath?: string | undefined;
83
+ method?: string | undefined;
84
+ path?: string | null | undefined;
85
+ headers?: OutgoingHttpHeaders | undefined;
86
+ auth?: string | null | undefined;
87
+ agent?: Agent | boolean | undefined;
88
+ _defaultAgent?: Agent | undefined;
89
+ timeout?: number | undefined;
90
+ setHost?: boolean | undefined;
91
+ // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278
92
+ createConnection?: ((options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket) | undefined;
93
+ lookup?: LookupFunction | undefined;
94
+ }
95
+
96
+ interface ServerOptions {
97
+ IncomingMessage?: typeof IncomingMessage | undefined;
98
+ ServerResponse?: typeof ServerResponse | undefined;
99
+ }
100
+
101
+ type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
102
+
103
+ class Server extends NetServer {
104
+ constructor(requestListener?: RequestListener);
105
+ constructor(options: ServerOptions, requestListener?: RequestListener);
106
+
107
+ setTimeout(msecs?: number, callback?: () => void): this;
108
+ setTimeout(callback: () => void): this;
109
+ /**
110
+ * Limits maximum incoming headers count. If set to 0, no limit will be applied.
111
+ * @default 2000
112
+ * {@link https://nodejs.org/api/http.html#http_server_maxheaderscount}
113
+ */
114
+ maxHeadersCount: number | null;
115
+ timeout: number;
116
+ /**
117
+ * Limit the amount of time the parser will wait to receive the complete HTTP headers.
118
+ * @default 40000
119
+ * {@link https://nodejs.org/api/http.html#http_server_headerstimeout}
120
+ */
121
+ headersTimeout: number;
122
+ keepAliveTimeout: number;
123
+ addListener(event: string, listener: (...args: any[]) => void): this;
124
+ addListener(event: 'close', listener: () => void): this;
125
+ addListener(event: 'connection', listener: (socket: Socket) => void): this;
126
+ addListener(event: 'error', listener: (err: Error) => void): this;
127
+ addListener(event: 'listening', listener: () => void): this;
128
+ addListener(event: 'checkContinue', listener: RequestListener): this;
129
+ addListener(event: 'checkExpectation', listener: RequestListener): this;
130
+ addListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
131
+ addListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
132
+ addListener(event: 'request', listener: RequestListener): this;
133
+ addListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
134
+ emit(event: string, ...args: any[]): boolean;
135
+ emit(event: 'close'): boolean;
136
+ emit(event: 'connection', socket: Socket): boolean;
137
+ emit(event: 'error', err: Error): boolean;
138
+ emit(event: 'listening'): boolean;
139
+ emit(event: 'checkContinue', req: IncomingMessage, res: ServerResponse): boolean;
140
+ emit(event: 'checkExpectation', req: IncomingMessage, res: ServerResponse): boolean;
141
+ emit(event: 'clientError', err: Error, socket: stream.Duplex): boolean;
142
+ emit(event: 'connect', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
143
+ emit(event: 'request', req: IncomingMessage, res: ServerResponse): boolean;
144
+ emit(event: 'upgrade', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
145
+ on(event: string, listener: (...args: any[]) => void): this;
146
+ on(event: 'close', listener: () => void): this;
147
+ on(event: 'connection', listener: (socket: Socket) => void): this;
148
+ on(event: 'error', listener: (err: Error) => void): this;
149
+ on(event: 'listening', listener: () => void): this;
150
+ on(event: 'checkContinue', listener: RequestListener): this;
151
+ on(event: 'checkExpectation', listener: RequestListener): this;
152
+ on(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
153
+ on(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
154
+ on(event: 'request', listener: RequestListener): this;
155
+ on(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
156
+ once(event: string, listener: (...args: any[]) => void): this;
157
+ once(event: 'close', listener: () => void): this;
158
+ once(event: 'connection', listener: (socket: Socket) => void): this;
159
+ once(event: 'error', listener: (err: Error) => void): this;
160
+ once(event: 'listening', listener: () => void): this;
161
+ once(event: 'checkContinue', listener: RequestListener): this;
162
+ once(event: 'checkExpectation', listener: RequestListener): this;
163
+ once(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
164
+ once(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
165
+ once(event: 'request', listener: RequestListener): this;
166
+ once(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
167
+ prependListener(event: string, listener: (...args: any[]) => void): this;
168
+ prependListener(event: 'close', listener: () => void): this;
169
+ prependListener(event: 'connection', listener: (socket: Socket) => void): this;
170
+ prependListener(event: 'error', listener: (err: Error) => void): this;
171
+ prependListener(event: 'listening', listener: () => void): this;
172
+ prependListener(event: 'checkContinue', listener: RequestListener): this;
173
+ prependListener(event: 'checkExpectation', listener: RequestListener): this;
174
+ prependListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
175
+ prependListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
176
+ prependListener(event: 'request', listener: RequestListener): this;
177
+ prependListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
178
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
179
+ prependOnceListener(event: 'close', listener: () => void): this;
180
+ prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this;
181
+ prependOnceListener(event: 'error', listener: (err: Error) => void): this;
182
+ prependOnceListener(event: 'listening', listener: () => void): this;
183
+ prependOnceListener(event: 'checkContinue', listener: RequestListener): this;
184
+ prependOnceListener(event: 'checkExpectation', listener: RequestListener): this;
185
+ prependOnceListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
186
+ prependOnceListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
187
+ prependOnceListener(event: 'request', listener: RequestListener): this;
188
+ prependOnceListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
189
+ }
190
+
191
+ // https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js
192
+ class OutgoingMessage extends stream.Writable {
193
+ upgrading: boolean;
194
+ chunkedEncoding: boolean;
195
+ shouldKeepAlive: boolean;
196
+ useChunkedEncodingByDefault: boolean;
197
+ sendDate: boolean;
198
+ finished: boolean;
199
+ headersSent: boolean;
200
+ connection: Socket;
201
+
202
+ constructor();
203
+
204
+ setTimeout(msecs: number, callback?: () => void): this;
205
+ setHeader(name: string, value: number | string | ReadonlyArray<string>): void;
206
+ getHeader(name: string): number | string | string[] | undefined;
207
+ getHeaders(): OutgoingHttpHeaders;
208
+ getHeaderNames(): string[];
209
+ hasHeader(name: string): boolean;
210
+ removeHeader(name: string): void;
211
+ addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void;
212
+ flushHeaders(): void;
213
+ }
214
+
215
+ // https://github.com/nodejs/node/blob/master/lib/_http_server.js#L108-L256
216
+ class ServerResponse extends OutgoingMessage {
217
+ statusCode: number;
218
+ statusMessage: string;
219
+ writableFinished: boolean;
220
+
221
+ constructor(req: IncomingMessage);
222
+
223
+ assignSocket(socket: Socket): void;
224
+ detachSocket(socket: Socket): void;
225
+ // https://github.com/nodejs/node/blob/master/test/parallel/test-http-write-callbacks.js#L53
226
+ // no args in writeContinue callback
227
+ writeContinue(callback?: () => void): void;
228
+ writeHead(statusCode: number, statusMessage?: string, headers?: OutgoingHttpHeaders): this;
229
+ writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this;
230
+ writeProcessing(): void;
231
+ }
232
+
233
+ interface InformationEvent {
234
+ statusCode: number;
235
+ statusMessage: string;
236
+ httpVersion: string;
237
+ httpVersionMajor: number;
238
+ httpVersionMinor: number;
239
+ headers: IncomingHttpHeaders;
240
+ rawHeaders: string[];
241
+ }
242
+
243
+ // https://github.com/nodejs/node/blob/v12.20.0/lib/_http_client.js#L85
244
+ class ClientRequest extends OutgoingMessage {
245
+ connection: Socket;
246
+ socket: Socket;
247
+ aborted: boolean;
248
+ host: string;
249
+ protocol: string;
250
+ reusedSocket: boolean;
251
+ maxHeadersCount: number;
252
+
253
+ constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void);
254
+
255
+ method: string;
256
+ readonly path: string;
257
+ abort(): void;
258
+ onSocket(socket: Socket): void;
259
+ setTimeout(timeout: number, callback?: () => void): this;
260
+ setNoDelay(noDelay?: boolean): void;
261
+ setSocketKeepAlive(enable?: boolean, initialDelay?: number): void;
262
+
263
+ addListener(event: 'abort', listener: () => void): this;
264
+ addListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
265
+ addListener(event: 'continue', listener: () => void): this;
266
+ addListener(event: 'information', listener: (info: InformationEvent) => void): this;
267
+ addListener(event: 'response', listener: (response: IncomingMessage) => void): this;
268
+ addListener(event: 'socket', listener: (socket: Socket) => void): this;
269
+ addListener(event: 'timeout', listener: () => void): this;
270
+ addListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
271
+ addListener(event: 'close', listener: () => void): this;
272
+ addListener(event: 'drain', listener: () => void): this;
273
+ addListener(event: 'error', listener: (err: Error) => void): this;
274
+ addListener(event: 'finish', listener: () => void): this;
275
+ addListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
276
+ addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
277
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
278
+
279
+ on(event: 'abort', listener: () => void): this;
280
+ on(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
281
+ on(event: 'continue', listener: () => void): this;
282
+ on(event: 'information', listener: (info: InformationEvent) => void): this;
283
+ on(event: 'response', listener: (response: IncomingMessage) => void): this;
284
+ on(event: 'socket', listener: (socket: Socket) => void): this;
285
+ on(event: 'timeout', listener: () => void): this;
286
+ on(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
287
+ on(event: 'close', listener: () => void): this;
288
+ on(event: 'drain', listener: () => void): this;
289
+ on(event: 'error', listener: (err: Error) => void): this;
290
+ on(event: 'finish', listener: () => void): this;
291
+ on(event: 'pipe', listener: (src: stream.Readable) => void): this;
292
+ on(event: 'unpipe', listener: (src: stream.Readable) => void): this;
293
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
294
+
295
+ once(event: 'abort', listener: () => void): this;
296
+ once(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
297
+ once(event: 'continue', listener: () => void): this;
298
+ once(event: 'information', listener: (info: InformationEvent) => void): this;
299
+ once(event: 'response', listener: (response: IncomingMessage) => void): this;
300
+ once(event: 'socket', listener: (socket: Socket) => void): this;
301
+ once(event: 'timeout', listener: () => void): this;
302
+ once(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
303
+ once(event: 'close', listener: () => void): this;
304
+ once(event: 'drain', listener: () => void): this;
305
+ once(event: 'error', listener: (err: Error) => void): this;
306
+ once(event: 'finish', listener: () => void): this;
307
+ once(event: 'pipe', listener: (src: stream.Readable) => void): this;
308
+ once(event: 'unpipe', listener: (src: stream.Readable) => void): this;
309
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
310
+
311
+ prependListener(event: 'abort', listener: () => void): this;
312
+ prependListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
313
+ prependListener(event: 'continue', listener: () => void): this;
314
+ prependListener(event: 'information', listener: (info: InformationEvent) => void): this;
315
+ prependListener(event: 'response', listener: (response: IncomingMessage) => void): this;
316
+ prependListener(event: 'socket', listener: (socket: Socket) => void): this;
317
+ prependListener(event: 'timeout', listener: () => void): this;
318
+ prependListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
319
+ prependListener(event: 'close', listener: () => void): this;
320
+ prependListener(event: 'drain', listener: () => void): this;
321
+ prependListener(event: 'error', listener: (err: Error) => void): this;
322
+ prependListener(event: 'finish', listener: () => void): this;
323
+ prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
324
+ prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
325
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
326
+
327
+ prependOnceListener(event: 'abort', listener: () => void): this;
328
+ prependOnceListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
329
+ prependOnceListener(event: 'continue', listener: () => void): this;
330
+ prependOnceListener(event: 'information', listener: (info: InformationEvent) => void): this;
331
+ prependOnceListener(event: 'response', listener: (response: IncomingMessage) => void): this;
332
+ prependOnceListener(event: 'socket', listener: (socket: Socket) => void): this;
333
+ prependOnceListener(event: 'timeout', listener: () => void): this;
334
+ prependOnceListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
335
+ prependOnceListener(event: 'close', listener: () => void): this;
336
+ prependOnceListener(event: 'drain', listener: () => void): this;
337
+ prependOnceListener(event: 'error', listener: (err: Error) => void): this;
338
+ prependOnceListener(event: 'finish', listener: () => void): this;
339
+ prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
340
+ prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
341
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
342
+ }
343
+
344
+ class IncomingMessage extends stream.Readable {
345
+ constructor(socket: Socket);
346
+
347
+ aborted: boolean;
348
+ httpVersion: string;
349
+ httpVersionMajor: number;
350
+ httpVersionMinor: number;
351
+ complete: boolean;
352
+ connection: Socket;
353
+ headers: IncomingHttpHeaders;
354
+ rawHeaders: string[];
355
+ trailers: { [key: string]: string | undefined };
356
+ rawTrailers: string[];
357
+ setTimeout(msecs: number, callback?: () => void): this;
358
+ /**
359
+ * Only valid for request obtained from http.Server.
360
+ */
361
+ method?: string | undefined;
362
+ /**
363
+ * Only valid for request obtained from http.Server.
364
+ */
365
+ url?: string | undefined;
366
+ /**
367
+ * Only valid for response obtained from http.ClientRequest.
368
+ */
369
+ statusCode?: number | undefined;
370
+ /**
371
+ * Only valid for response obtained from http.ClientRequest.
372
+ */
373
+ statusMessage?: string | undefined;
374
+ socket: Socket;
375
+ destroy(error?: Error): this;
376
+ }
377
+
378
+ interface AgentOptions {
379
+ /**
380
+ * Keep sockets around in a pool to be used by other requests in the future. Default = false
381
+ */
382
+ keepAlive?: boolean | undefined;
383
+ /**
384
+ * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000.
385
+ * Only relevant if keepAlive is set to true.
386
+ */
387
+ keepAliveMsecs?: number | undefined;
388
+ /**
389
+ * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
390
+ */
391
+ maxSockets?: number | undefined;
392
+ /**
393
+ * Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity.
394
+ */
395
+ maxTotalSockets?: number | undefined;
396
+ /**
397
+ * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256.
398
+ */
399
+ maxFreeSockets?: number | undefined;
400
+ /**
401
+ * Socket timeout in milliseconds. This will set the timeout after the socket is connected.
402
+ */
403
+ timeout?: number | undefined;
404
+ /**
405
+ * Scheduling strategy to apply when picking the next free socket to use. Default: 'fifo'.
406
+ */
407
+ scheduling?: 'fifo' | 'lifo' | undefined;
408
+ }
409
+
410
+ class Agent {
411
+ maxFreeSockets: number;
412
+ maxSockets: number;
413
+ maxTotalSockets: number;
414
+ readonly sockets: {
415
+ readonly [key: string]: Socket[];
416
+ };
417
+ readonly requests: {
418
+ readonly [key: string]: IncomingMessage[];
419
+ };
420
+
421
+ constructor(opts?: AgentOptions);
422
+
423
+ /**
424
+ * Destroy any sockets that are currently in use by the agent.
425
+ * It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled,
426
+ * then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise,
427
+ * sockets may hang open for quite a long time before the server terminates them.
428
+ */
429
+ destroy(): void;
430
+ }
431
+
432
+ const METHODS: string[];
433
+
434
+ const STATUS_CODES: {
435
+ [errorCode: number]: string | undefined;
436
+ [errorCode: string]: string | undefined;
437
+ };
438
+
439
+ function createServer(requestListener?: RequestListener): Server;
440
+ function createServer(options: ServerOptions, requestListener?: RequestListener): Server;
441
+
442
+ // although RequestOptions are passed as ClientRequestArgs to ClientRequest directly,
443
+ // create interface RequestOptions would make the naming more clear to developers
444
+ interface RequestOptions extends ClientRequestArgs { }
445
+ function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
446
+ function request(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
447
+ function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
448
+ function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
449
+ let globalAgent: Agent;
450
+
451
+ /**
452
+ * Read-only property specifying the maximum allowed size of HTTP headers in bytes.
453
+ * Defaults to 8KB. Configurable using the [`--max-http-header-size`][] CLI option.
454
+ */
455
+ const maxHeaderSize: number;
456
+ }