@types/node 22.6.1 → 22.6.2
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.
- node/README.md +1 -1
- node/globals.d.ts +17 -1
- node/http.d.ts +5 -5
- node/http2.d.ts +214 -77
- node/https.d.ts +8 -14
- node/package.json +2 -2
node/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated:
|
11
|
+
* Last updated: Wed, 25 Sep 2024 00:29:50 GMT
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
13
13
|
|
14
14
|
# Credits
|
node/globals.d.ts
CHANGED
@@ -168,10 +168,26 @@ declare global {
|
|
168
168
|
// Same as module.exports
|
169
169
|
var exports: any;
|
170
170
|
|
171
|
+
interface GCFunction {
|
172
|
+
(options: {
|
173
|
+
execution?: "sync";
|
174
|
+
flavor?: "regular" | "last-resort";
|
175
|
+
type?: "major-snapshot" | "major" | "minor";
|
176
|
+
filename?: string;
|
177
|
+
}): void;
|
178
|
+
(options: {
|
179
|
+
execution: "async";
|
180
|
+
flavor?: "regular" | "last-resort";
|
181
|
+
type?: "major-snapshot" | "major" | "minor";
|
182
|
+
filename?: string;
|
183
|
+
}): Promise<void>;
|
184
|
+
(options?: boolean): void;
|
185
|
+
}
|
186
|
+
|
171
187
|
/**
|
172
188
|
* Only available if `--expose-gc` is passed to the process.
|
173
189
|
*/
|
174
|
-
var gc: undefined |
|
190
|
+
var gc: undefined | GCFunction;
|
175
191
|
|
176
192
|
// #region borrowed
|
177
193
|
// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
|
node/http.d.ts
CHANGED
@@ -231,7 +231,7 @@ declare module "http" {
|
|
231
231
|
}
|
232
232
|
interface ServerOptions<
|
233
233
|
Request extends typeof IncomingMessage = typeof IncomingMessage,
|
234
|
-
Response extends typeof ServerResponse = typeof ServerResponse,
|
234
|
+
Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
|
235
235
|
> {
|
236
236
|
/**
|
237
237
|
* Specifies the `IncomingMessage` class to be used. Useful for extending the original `IncomingMessage`.
|
@@ -315,14 +315,14 @@ declare module "http" {
|
|
315
315
|
}
|
316
316
|
type RequestListener<
|
317
317
|
Request extends typeof IncomingMessage = typeof IncomingMessage,
|
318
|
-
Response extends typeof ServerResponse = typeof ServerResponse,
|
318
|
+
Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
|
319
319
|
> = (req: InstanceType<Request>, res: InstanceType<Response> & { req: InstanceType<Request> }) => void;
|
320
320
|
/**
|
321
321
|
* @since v0.1.17
|
322
322
|
*/
|
323
323
|
class Server<
|
324
324
|
Request extends typeof IncomingMessage = typeof IncomingMessage,
|
325
|
-
Response extends typeof ServerResponse = typeof ServerResponse,
|
325
|
+
Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
|
326
326
|
> extends NetServer {
|
327
327
|
constructor(requestListener?: RequestListener<Request, Response>);
|
328
328
|
constructor(options: ServerOptions<Request, Response>, requestListener?: RequestListener<Request, Response>);
|
@@ -1553,11 +1553,11 @@ declare module "http" {
|
|
1553
1553
|
*/
|
1554
1554
|
function createServer<
|
1555
1555
|
Request extends typeof IncomingMessage = typeof IncomingMessage,
|
1556
|
-
Response extends typeof ServerResponse = typeof ServerResponse,
|
1556
|
+
Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
|
1557
1557
|
>(requestListener?: RequestListener<Request, Response>): Server<Request, Response>;
|
1558
1558
|
function createServer<
|
1559
1559
|
Request extends typeof IncomingMessage = typeof IncomingMessage,
|
1560
|
-
Response extends typeof ServerResponse = typeof ServerResponse,
|
1560
|
+
Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
|
1561
1561
|
>(
|
1562
1562
|
options: ServerOptions<Request, Response>,
|
1563
1563
|
requestListener?: RequestListener<Request, Response>,
|
node/http2.d.ts
CHANGED
@@ -408,9 +408,9 @@ declare module "http2" {
|
|
408
408
|
* });
|
409
409
|
* ```
|
410
410
|
*
|
411
|
-
* Initiates a response. When the `options.waitForTrailers` option is set, the`'wantTrailers'` event
|
412
|
-
* of payload data to be sent.
|
413
|
-
* used to
|
411
|
+
* Initiates a response. When the `options.waitForTrailers` option is set, the `'wantTrailers'` event
|
412
|
+
* will be emitted immediately after queuing the last chunk of payload data to be sent.
|
413
|
+
* The `http2stream.sendTrailers()` method can then be used to send trailing header fields to the peer.
|
414
414
|
*
|
415
415
|
* When `options.waitForTrailers` is set, the `Http2Stream` will not automatically
|
416
416
|
* close when the final `DATA` frame is transmitted. User code must call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`.
|
@@ -459,8 +459,8 @@ declare module "http2" {
|
|
459
459
|
*
|
460
460
|
* The optional `options.statCheck` function may be specified to give user code
|
461
461
|
* an opportunity to set additional content headers based on the `fs.Stat` details
|
462
|
-
* of the given fd. If the `statCheck` function is provided, the `http2stream.respondWithFD()` method will
|
463
|
-
* collect details on the provided file descriptor.
|
462
|
+
* of the given fd. If the `statCheck` function is provided, the `http2stream.respondWithFD()` method will
|
463
|
+
* perform an `fs.fstat()` call to collect details on the provided file descriptor.
|
464
464
|
*
|
465
465
|
* The `offset` and `length` options may be used to limit the response to a
|
466
466
|
* specific range subset. This can be used, for instance, to support HTTP Range
|
@@ -478,7 +478,8 @@ declare module "http2" {
|
|
478
478
|
* header fields to the peer.
|
479
479
|
*
|
480
480
|
* When `options.waitForTrailers` is set, the `Http2Stream` will not automatically
|
481
|
-
* close when the final `DATA` frame is transmitted. User code _must_ call either `http2stream.sendTrailers()`
|
481
|
+
* close when the final `DATA` frame is transmitted. User code _must_ call either `http2stream.sendTrailers()`
|
482
|
+
* or `http2stream.close()` to close the `Http2Stream`.
|
482
483
|
*
|
483
484
|
* ```js
|
484
485
|
* const http2 = require('node:http2');
|
@@ -521,9 +522,9 @@ declare module "http2" {
|
|
521
522
|
* an opportunity to set additional content headers based on the `fs.Stat` details
|
522
523
|
* of the given file:
|
523
524
|
*
|
524
|
-
* If an error occurs while attempting to read the file data, the `Http2Stream` will be closed using an
|
525
|
-
*
|
526
|
-
* the stream will be destroyed.
|
525
|
+
* If an error occurs while attempting to read the file data, the `Http2Stream` will be closed using an
|
526
|
+
* `RST_STREAM` frame using the standard `INTERNAL_ERROR` code.
|
527
|
+
* If the `onError` callback is defined, then it will be called. Otherwise, the stream will be destroyed.
|
527
528
|
*
|
528
529
|
* Example using a file path:
|
529
530
|
*
|
@@ -677,7 +678,8 @@ declare module "http2" {
|
|
677
678
|
*/
|
678
679
|
readonly encrypted?: boolean | undefined;
|
679
680
|
/**
|
680
|
-
* A prototype-less object describing the current local settings of this `Http2Session`.
|
681
|
+
* A prototype-less object describing the current local settings of this `Http2Session`.
|
682
|
+
* The local settings are local to _this_`Http2Session` instance.
|
681
683
|
* @since v8.4.0
|
682
684
|
*/
|
683
685
|
readonly localSettings: Settings;
|
@@ -692,12 +694,14 @@ declare module "http2" {
|
|
692
694
|
readonly originSet?: string[] | undefined;
|
693
695
|
/**
|
694
696
|
* Indicates whether the `Http2Session` is currently waiting for acknowledgment of
|
695
|
-
* a sent `SETTINGS` frame. Will be `true` after calling the `http2session.settings()` method.
|
697
|
+
* a sent `SETTINGS` frame. Will be `true` after calling the `http2session.settings()` method.
|
698
|
+
* Will be `false` once all sent `SETTINGS` frames have been acknowledged.
|
696
699
|
* @since v8.4.0
|
697
700
|
*/
|
698
701
|
readonly pendingSettingsAck: boolean;
|
699
702
|
/**
|
700
|
-
* A prototype-less object describing the current remote settings of this`Http2Session`.
|
703
|
+
* A prototype-less object describing the current remote settings of this`Http2Session`.
|
704
|
+
* The remote settings are set by the _connected_ HTTP/2 peer.
|
701
705
|
* @since v8.4.0
|
702
706
|
*/
|
703
707
|
readonly remoteSettings: Settings;
|
@@ -1048,8 +1052,15 @@ declare module "http2" {
|
|
1048
1052
|
export interface AlternativeServiceOptions {
|
1049
1053
|
origin: number | string | url.URL;
|
1050
1054
|
}
|
1051
|
-
export interface ServerHttp2Session
|
1052
|
-
|
1055
|
+
export interface ServerHttp2Session<
|
1056
|
+
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
1057
|
+
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
1058
|
+
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
1059
|
+
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
1060
|
+
> extends Http2Session {
|
1061
|
+
readonly server:
|
1062
|
+
| Http2Server<Http1Request, Http1Response, Http2Request, Http2Response>
|
1063
|
+
| Http2SecureServer<Http1Request, Http1Response, Http2Request, Http2Response>;
|
1053
1064
|
/**
|
1054
1065
|
* Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client.
|
1055
1066
|
*
|
@@ -1144,17 +1155,30 @@ declare module "http2" {
|
|
1144
1155
|
): void;
|
1145
1156
|
addListener(
|
1146
1157
|
event: "connect",
|
1147
|
-
listener: (
|
1158
|
+
listener: (
|
1159
|
+
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
1160
|
+
socket: net.Socket | tls.TLSSocket,
|
1161
|
+
) => void,
|
1148
1162
|
): this;
|
1149
1163
|
addListener(
|
1150
1164
|
event: "stream",
|
1151
1165
|
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
1152
1166
|
): this;
|
1153
1167
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
1154
|
-
emit(
|
1168
|
+
emit(
|
1169
|
+
event: "connect",
|
1170
|
+
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
1171
|
+
socket: net.Socket | tls.TLSSocket,
|
1172
|
+
): boolean;
|
1155
1173
|
emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
|
1156
1174
|
emit(event: string | symbol, ...args: any[]): boolean;
|
1157
|
-
on(
|
1175
|
+
on(
|
1176
|
+
event: "connect",
|
1177
|
+
listener: (
|
1178
|
+
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
1179
|
+
socket: net.Socket | tls.TLSSocket,
|
1180
|
+
) => void,
|
1181
|
+
): this;
|
1158
1182
|
on(
|
1159
1183
|
event: "stream",
|
1160
1184
|
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
@@ -1162,7 +1186,10 @@ declare module "http2" {
|
|
1162
1186
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
1163
1187
|
once(
|
1164
1188
|
event: "connect",
|
1165
|
-
listener: (
|
1189
|
+
listener: (
|
1190
|
+
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
1191
|
+
socket: net.Socket | tls.TLSSocket,
|
1192
|
+
) => void,
|
1166
1193
|
): this;
|
1167
1194
|
once(
|
1168
1195
|
event: "stream",
|
@@ -1171,7 +1198,10 @@ declare module "http2" {
|
|
1171
1198
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
1172
1199
|
prependListener(
|
1173
1200
|
event: "connect",
|
1174
|
-
listener: (
|
1201
|
+
listener: (
|
1202
|
+
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
1203
|
+
socket: net.Socket | tls.TLSSocket,
|
1204
|
+
) => void,
|
1175
1205
|
): this;
|
1176
1206
|
prependListener(
|
1177
1207
|
event: "stream",
|
@@ -1180,7 +1210,10 @@ declare module "http2" {
|
|
1180
1210
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
1181
1211
|
prependOnceListener(
|
1182
1212
|
event: "connect",
|
1183
|
-
listener: (
|
1213
|
+
listener: (
|
1214
|
+
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
1215
|
+
socket: net.Socket | tls.TLSSocket,
|
1216
|
+
) => void,
|
1184
1217
|
): this;
|
1185
1218
|
prependOnceListener(
|
1186
1219
|
event: "stream",
|
@@ -1213,16 +1246,36 @@ declare module "http2" {
|
|
1213
1246
|
createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined;
|
1214
1247
|
protocol?: "http:" | "https:" | undefined;
|
1215
1248
|
}
|
1216
|
-
export interface ServerSessionOptions
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1249
|
+
export interface ServerSessionOptions<
|
1250
|
+
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
1251
|
+
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
1252
|
+
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
1253
|
+
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
1254
|
+
> extends SessionOptions {
|
1255
|
+
Http1IncomingMessage?: Http1Request | undefined;
|
1256
|
+
Http1ServerResponse?: Http1Response | undefined;
|
1257
|
+
Http2ServerRequest?: Http2Request | undefined;
|
1258
|
+
Http2ServerResponse?: Http2Response | undefined;
|
1221
1259
|
}
|
1222
1260
|
export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {}
|
1223
|
-
export interface SecureServerSessionOptions
|
1224
|
-
|
1225
|
-
|
1261
|
+
export interface SecureServerSessionOptions<
|
1262
|
+
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
1263
|
+
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
1264
|
+
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
1265
|
+
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
1266
|
+
> extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response>, tls.TlsOptions {}
|
1267
|
+
export interface ServerOptions<
|
1268
|
+
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
1269
|
+
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
1270
|
+
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
1271
|
+
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
1272
|
+
> extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {}
|
1273
|
+
export interface SecureServerOptions<
|
1274
|
+
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
1275
|
+
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
1276
|
+
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
1277
|
+
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
1278
|
+
> extends SecureServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {
|
1226
1279
|
allowHTTP1?: boolean | undefined;
|
1227
1280
|
origins?: string[] | undefined;
|
1228
1281
|
}
|
@@ -1234,16 +1287,24 @@ declare module "http2" {
|
|
1234
1287
|
*/
|
1235
1288
|
updateSettings(settings: Settings): void;
|
1236
1289
|
}
|
1237
|
-
export interface Http2Server
|
1290
|
+
export interface Http2Server<
|
1291
|
+
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
1292
|
+
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
1293
|
+
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
1294
|
+
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
1295
|
+
> extends net.Server, HTTP2ServerCommon {
|
1238
1296
|
addListener(
|
1239
1297
|
event: "checkContinue",
|
1240
|
-
listener: (request:
|
1298
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1241
1299
|
): this;
|
1242
1300
|
addListener(
|
1243
1301
|
event: "request",
|
1244
|
-
listener: (request:
|
1302
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1303
|
+
): this;
|
1304
|
+
addListener(
|
1305
|
+
event: "session",
|
1306
|
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
1245
1307
|
): this;
|
1246
|
-
addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
1247
1308
|
addListener(event: "sessionError", listener: (err: Error) => void): this;
|
1248
1309
|
addListener(
|
1249
1310
|
event: "stream",
|
@@ -1251,19 +1312,32 @@ declare module "http2" {
|
|
1251
1312
|
): this;
|
1252
1313
|
addListener(event: "timeout", listener: () => void): this;
|
1253
1314
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
1254
|
-
emit(
|
1255
|
-
|
1256
|
-
|
1315
|
+
emit(
|
1316
|
+
event: "checkContinue",
|
1317
|
+
request: InstanceType<Http2Request>,
|
1318
|
+
response: InstanceType<Http2Response>,
|
1319
|
+
): boolean;
|
1320
|
+
emit(event: "request", request: InstanceType<Http2Request>, response: InstanceType<Http2Response>): boolean;
|
1321
|
+
emit(
|
1322
|
+
event: "session",
|
1323
|
+
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
1324
|
+
): boolean;
|
1257
1325
|
emit(event: "sessionError", err: Error): boolean;
|
1258
1326
|
emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
|
1259
1327
|
emit(event: "timeout"): boolean;
|
1260
1328
|
emit(event: string | symbol, ...args: any[]): boolean;
|
1261
1329
|
on(
|
1262
1330
|
event: "checkContinue",
|
1263
|
-
listener: (request:
|
1331
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1332
|
+
): this;
|
1333
|
+
on(
|
1334
|
+
event: "request",
|
1335
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1336
|
+
): this;
|
1337
|
+
on(
|
1338
|
+
event: "session",
|
1339
|
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
1264
1340
|
): this;
|
1265
|
-
on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
1266
|
-
on(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
1267
1341
|
on(event: "sessionError", listener: (err: Error) => void): this;
|
1268
1342
|
on(
|
1269
1343
|
event: "stream",
|
@@ -1273,10 +1347,16 @@ declare module "http2" {
|
|
1273
1347
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
1274
1348
|
once(
|
1275
1349
|
event: "checkContinue",
|
1276
|
-
listener: (request:
|
1350
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1351
|
+
): this;
|
1352
|
+
once(
|
1353
|
+
event: "request",
|
1354
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1355
|
+
): this;
|
1356
|
+
once(
|
1357
|
+
event: "session",
|
1358
|
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
1277
1359
|
): this;
|
1278
|
-
once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
1279
|
-
once(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
1280
1360
|
once(event: "sessionError", listener: (err: Error) => void): this;
|
1281
1361
|
once(
|
1282
1362
|
event: "stream",
|
@@ -1286,13 +1366,16 @@ declare module "http2" {
|
|
1286
1366
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
1287
1367
|
prependListener(
|
1288
1368
|
event: "checkContinue",
|
1289
|
-
listener: (request:
|
1369
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1290
1370
|
): this;
|
1291
1371
|
prependListener(
|
1292
1372
|
event: "request",
|
1293
|
-
listener: (request:
|
1373
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1374
|
+
): this;
|
1375
|
+
prependListener(
|
1376
|
+
event: "session",
|
1377
|
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
1294
1378
|
): this;
|
1295
|
-
prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
1296
1379
|
prependListener(event: "sessionError", listener: (err: Error) => void): this;
|
1297
1380
|
prependListener(
|
1298
1381
|
event: "stream",
|
@@ -1302,13 +1385,16 @@ declare module "http2" {
|
|
1302
1385
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
1303
1386
|
prependOnceListener(
|
1304
1387
|
event: "checkContinue",
|
1305
|
-
listener: (request:
|
1388
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1306
1389
|
): this;
|
1307
1390
|
prependOnceListener(
|
1308
1391
|
event: "request",
|
1309
|
-
listener: (request:
|
1392
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1393
|
+
): this;
|
1394
|
+
prependOnceListener(
|
1395
|
+
event: "session",
|
1396
|
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
1310
1397
|
): this;
|
1311
|
-
prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
1312
1398
|
prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
|
1313
1399
|
prependOnceListener(
|
1314
1400
|
event: "stream",
|
@@ -1317,16 +1403,24 @@ declare module "http2" {
|
|
1317
1403
|
prependOnceListener(event: "timeout", listener: () => void): this;
|
1318
1404
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
1319
1405
|
}
|
1320
|
-
export interface Http2SecureServer
|
1406
|
+
export interface Http2SecureServer<
|
1407
|
+
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
1408
|
+
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
1409
|
+
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
1410
|
+
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
1411
|
+
> extends tls.Server, HTTP2ServerCommon {
|
1321
1412
|
addListener(
|
1322
1413
|
event: "checkContinue",
|
1323
|
-
listener: (request:
|
1414
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1324
1415
|
): this;
|
1325
1416
|
addListener(
|
1326
1417
|
event: "request",
|
1327
|
-
listener: (request:
|
1418
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1419
|
+
): this;
|
1420
|
+
addListener(
|
1421
|
+
event: "session",
|
1422
|
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
1328
1423
|
): this;
|
1329
|
-
addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
1330
1424
|
addListener(event: "sessionError", listener: (err: Error) => void): this;
|
1331
1425
|
addListener(
|
1332
1426
|
event: "stream",
|
@@ -1335,9 +1429,16 @@ declare module "http2" {
|
|
1335
1429
|
addListener(event: "timeout", listener: () => void): this;
|
1336
1430
|
addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
|
1337
1431
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
1338
|
-
emit(
|
1339
|
-
|
1340
|
-
|
1432
|
+
emit(
|
1433
|
+
event: "checkContinue",
|
1434
|
+
request: InstanceType<Http2Request>,
|
1435
|
+
response: InstanceType<Http2Response>,
|
1436
|
+
): boolean;
|
1437
|
+
emit(event: "request", request: InstanceType<Http2Request>, response: InstanceType<Http2Response>): boolean;
|
1438
|
+
emit(
|
1439
|
+
event: "session",
|
1440
|
+
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
1441
|
+
): boolean;
|
1341
1442
|
emit(event: "sessionError", err: Error): boolean;
|
1342
1443
|
emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
|
1343
1444
|
emit(event: "timeout"): boolean;
|
@@ -1345,10 +1446,16 @@ declare module "http2" {
|
|
1345
1446
|
emit(event: string | symbol, ...args: any[]): boolean;
|
1346
1447
|
on(
|
1347
1448
|
event: "checkContinue",
|
1348
|
-
listener: (request:
|
1449
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1450
|
+
): this;
|
1451
|
+
on(
|
1452
|
+
event: "request",
|
1453
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1454
|
+
): this;
|
1455
|
+
on(
|
1456
|
+
event: "session",
|
1457
|
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
1349
1458
|
): this;
|
1350
|
-
on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
1351
|
-
on(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
1352
1459
|
on(event: "sessionError", listener: (err: Error) => void): this;
|
1353
1460
|
on(
|
1354
1461
|
event: "stream",
|
@@ -1359,10 +1466,16 @@ declare module "http2" {
|
|
1359
1466
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
1360
1467
|
once(
|
1361
1468
|
event: "checkContinue",
|
1362
|
-
listener: (request:
|
1469
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1470
|
+
): this;
|
1471
|
+
once(
|
1472
|
+
event: "request",
|
1473
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1474
|
+
): this;
|
1475
|
+
once(
|
1476
|
+
event: "session",
|
1477
|
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
1363
1478
|
): this;
|
1364
|
-
once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
|
1365
|
-
once(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
1366
1479
|
once(event: "sessionError", listener: (err: Error) => void): this;
|
1367
1480
|
once(
|
1368
1481
|
event: "stream",
|
@@ -1373,13 +1486,16 @@ declare module "http2" {
|
|
1373
1486
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
1374
1487
|
prependListener(
|
1375
1488
|
event: "checkContinue",
|
1376
|
-
listener: (request:
|
1489
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1377
1490
|
): this;
|
1378
1491
|
prependListener(
|
1379
1492
|
event: "request",
|
1380
|
-
listener: (request:
|
1493
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1494
|
+
): this;
|
1495
|
+
prependListener(
|
1496
|
+
event: "session",
|
1497
|
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
1381
1498
|
): this;
|
1382
|
-
prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
1383
1499
|
prependListener(event: "sessionError", listener: (err: Error) => void): this;
|
1384
1500
|
prependListener(
|
1385
1501
|
event: "stream",
|
@@ -1390,13 +1506,16 @@ declare module "http2" {
|
|
1390
1506
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
1391
1507
|
prependOnceListener(
|
1392
1508
|
event: "checkContinue",
|
1393
|
-
listener: (request:
|
1509
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1394
1510
|
): this;
|
1395
1511
|
prependOnceListener(
|
1396
1512
|
event: "request",
|
1397
|
-
listener: (request:
|
1513
|
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
1514
|
+
): this;
|
1515
|
+
prependOnceListener(
|
1516
|
+
event: "session",
|
1517
|
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
1398
1518
|
): this;
|
1399
|
-
prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
|
1400
1519
|
prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
|
1401
1520
|
prependOnceListener(
|
1402
1521
|
event: "stream",
|
@@ -1652,7 +1771,7 @@ declare module "http2" {
|
|
1652
1771
|
* passed as the second parameter to the `'request'` event.
|
1653
1772
|
* @since v8.4.0
|
1654
1773
|
*/
|
1655
|
-
export class Http2ServerResponse extends stream.Writable {
|
1774
|
+
export class Http2ServerResponse<Request extends Http2ServerRequest = Http2ServerRequest> extends stream.Writable {
|
1656
1775
|
constructor(stream: ServerHttp2Stream);
|
1657
1776
|
/**
|
1658
1777
|
* See `response.socket`.
|
@@ -1698,7 +1817,7 @@ declare module "http2" {
|
|
1698
1817
|
* A reference to the original HTTP2 `request` object.
|
1699
1818
|
* @since v15.7.0
|
1700
1819
|
*/
|
1701
|
-
readonly req:
|
1820
|
+
readonly req: Request;
|
1702
1821
|
/**
|
1703
1822
|
* Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but
|
1704
1823
|
* applies getters, setters, and methods based on HTTP/2 logic.
|
@@ -2341,10 +2460,15 @@ declare module "http2" {
|
|
2341
2460
|
export function createServer(
|
2342
2461
|
onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
2343
2462
|
): Http2Server;
|
2344
|
-
export function createServer
|
2345
|
-
|
2346
|
-
|
2347
|
-
|
2463
|
+
export function createServer<
|
2464
|
+
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
2465
|
+
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
2466
|
+
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
2467
|
+
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
2468
|
+
>(
|
2469
|
+
options: ServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
|
2470
|
+
onRequestHandler?: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
2471
|
+
): Http2Server<Http1Request, Http1Response, Http2Request, Http2Response>;
|
2348
2472
|
/**
|
2349
2473
|
* Returns a `tls.Server` instance that creates and manages `Http2Session` instances.
|
2350
2474
|
*
|
@@ -2376,10 +2500,15 @@ declare module "http2" {
|
|
2376
2500
|
export function createSecureServer(
|
2377
2501
|
onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
2378
2502
|
): Http2SecureServer;
|
2379
|
-
export function createSecureServer
|
2380
|
-
|
2381
|
-
|
2382
|
-
|
2503
|
+
export function createSecureServer<
|
2504
|
+
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
2505
|
+
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
2506
|
+
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
2507
|
+
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
2508
|
+
>(
|
2509
|
+
options: SecureServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
|
2510
|
+
onRequestHandler?: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
2511
|
+
): Http2SecureServer<Http1Request, Http1Response, Http2Request, Http2Response>;
|
2383
2512
|
/**
|
2384
2513
|
* Returns a `ClientHttp2Session` instance.
|
2385
2514
|
*
|
@@ -2411,7 +2540,15 @@ declare module "http2" {
|
|
2411
2540
|
* @param options Any `{@link createServer}` options can be provided.
|
2412
2541
|
* @since v20.12.0
|
2413
2542
|
*/
|
2414
|
-
export function performServerHandshake
|
2543
|
+
export function performServerHandshake<
|
2544
|
+
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
2545
|
+
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
2546
|
+
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
2547
|
+
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
2548
|
+
>(
|
2549
|
+
socket: stream.Duplex,
|
2550
|
+
options?: ServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
|
2551
|
+
): ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>;
|
2415
2552
|
}
|
2416
2553
|
declare module "node:http2" {
|
2417
2554
|
export * from "http2";
|
node/https.d.ts
CHANGED
@@ -10,7 +10,7 @@ declare module "https" {
|
|
10
10
|
import { URL } from "node:url";
|
11
11
|
type ServerOptions<
|
12
12
|
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
|
13
|
-
Response extends typeof http.ServerResponse = typeof http.ServerResponse,
|
13
|
+
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
|
14
14
|
> = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions<Request, Response>;
|
15
15
|
type RequestOptions =
|
16
16
|
& http.RequestOptions
|
@@ -34,7 +34,7 @@ declare module "https" {
|
|
34
34
|
}
|
35
35
|
interface Server<
|
36
36
|
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
|
37
|
-
Response extends typeof http.ServerResponse = typeof http.ServerResponse,
|
37
|
+
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
|
38
38
|
> extends http.Server<Request, Response> {}
|
39
39
|
/**
|
40
40
|
* See `http.Server` for more information.
|
@@ -42,7 +42,7 @@ declare module "https" {
|
|
42
42
|
*/
|
43
43
|
class Server<
|
44
44
|
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
|
45
|
-
Response extends typeof http.ServerResponse = typeof http.ServerResponse,
|
45
|
+
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
|
46
46
|
> extends tls.Server {
|
47
47
|
constructor(requestListener?: http.RequestListener<Request, Response>);
|
48
48
|
constructor(
|
@@ -119,25 +119,19 @@ declare module "https" {
|
|
119
119
|
emit(
|
120
120
|
event: "checkContinue",
|
121
121
|
req: InstanceType<Request>,
|
122
|
-
res: InstanceType<Response
|
123
|
-
req: InstanceType<Request>;
|
124
|
-
},
|
122
|
+
res: InstanceType<Response>,
|
125
123
|
): boolean;
|
126
124
|
emit(
|
127
125
|
event: "checkExpectation",
|
128
126
|
req: InstanceType<Request>,
|
129
|
-
res: InstanceType<Response
|
130
|
-
req: InstanceType<Request>;
|
131
|
-
},
|
127
|
+
res: InstanceType<Response>,
|
132
128
|
): boolean;
|
133
129
|
emit(event: "clientError", err: Error, socket: Duplex): boolean;
|
134
130
|
emit(event: "connect", req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
|
135
131
|
emit(
|
136
132
|
event: "request",
|
137
133
|
req: InstanceType<Request>,
|
138
|
-
res: InstanceType<Response
|
139
|
-
req: InstanceType<Request>;
|
140
|
-
},
|
134
|
+
res: InstanceType<Response>,
|
141
135
|
): boolean;
|
142
136
|
emit(event: "upgrade", req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
|
143
137
|
on(event: string, listener: (...args: any[]) => void): this;
|
@@ -312,11 +306,11 @@ declare module "https" {
|
|
312
306
|
*/
|
313
307
|
function createServer<
|
314
308
|
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
|
315
|
-
Response extends typeof http.ServerResponse = typeof http.ServerResponse,
|
309
|
+
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
|
316
310
|
>(requestListener?: http.RequestListener<Request, Response>): Server<Request, Response>;
|
317
311
|
function createServer<
|
318
312
|
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
|
319
|
-
Response extends typeof http.ServerResponse = typeof http.ServerResponse,
|
313
|
+
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
|
320
314
|
>(
|
321
315
|
options: ServerOptions<Request, Response>,
|
322
316
|
requestListener?: http.RequestListener<Request, Response>,
|
node/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/node",
|
3
|
-
"version": "22.6.
|
3
|
+
"version": "22.6.2",
|
4
4
|
"description": "TypeScript definitions for node",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
6
6
|
"license": "MIT",
|
@@ -212,6 +212,6 @@
|
|
212
212
|
"dependencies": {
|
213
213
|
"undici-types": "~6.19.2"
|
214
214
|
},
|
215
|
-
"typesPublisherContentHash": "
|
215
|
+
"typesPublisherContentHash": "5c58d0641c703edff00e37cac52ad14a29ce2497ca7aec435a6c69201dfb7419",
|
216
216
|
"typeScriptVersion": "4.8"
|
217
217
|
}
|