@types/node 20.12.7 → 20.12.9
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/assert.d.ts +41 -44
- node/async_hooks.d.ts +17 -15
- node/buffer.d.ts +7 -7
- node/child_process.d.ts +1 -1
- node/cluster.d.ts +1 -1
- node/console.d.ts +1 -1
- node/crypto.d.ts +38 -3
- node/dgram.d.ts +13 -13
- node/diagnostics_channel.d.ts +3 -3
- node/dns.d.ts +1 -1
- node/domain.d.ts +4 -4
- node/events.d.ts +29 -37
- node/fs/promises.d.ts +12 -12
- node/fs.d.ts +37 -37
- node/http.d.ts +4 -4
- node/http2.d.ts +77 -47
- node/https.d.ts +1 -1
- node/inspector.d.ts +4 -4
- node/net.d.ts +50 -8
- node/os.d.ts +28 -11
- node/package.json +2 -2
- node/path.d.ts +1 -1
- node/perf_hooks.d.ts +3 -3
- node/process.d.ts +214 -43
- node/punycode.d.ts +4 -4
- node/querystring.d.ts +18 -6
- node/readline/promises.d.ts +9 -9
- node/readline.d.ts +21 -20
- node/repl.d.ts +7 -7
- node/stream/web.d.ts +2 -2
- node/stream.d.ts +8 -6
- node/string_decoder.d.ts +3 -3
- node/test.d.ts +25 -23
- node/timers/promises.d.ts +10 -6
- node/timers.d.ts +5 -5
- node/tls.d.ts +39 -32
- node/trace_events.d.ts +40 -25
- node/tty.d.ts +8 -8
- node/url.d.ts +5 -5
- node/util.d.ts +115 -22
- node/v8.d.ts +6 -6
- node/vm.d.ts +35 -17
- node/wasi.d.ts +1 -1
- node/worker_threads.d.ts +16 -16
- node/zlib.d.ts +16 -3
node/http2.d.ts
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
* const http2 = require('node:http2');
|
7
7
|
* ```
|
8
8
|
* @since v8.4.0
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.2
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/http2.js)
|
10
10
|
*/
|
11
11
|
declare module "http2" {
|
12
12
|
import EventEmitter = require("node:events");
|
@@ -96,7 +96,7 @@ declare module "http2" {
|
|
96
96
|
*/
|
97
97
|
readonly endAfterHeaders: boolean;
|
98
98
|
/**
|
99
|
-
* The numeric stream identifier of this `Http2Stream` instance. Set to `undefined`if the stream identifier has not yet been assigned.
|
99
|
+
* The numeric stream identifier of this `Http2Stream` instance. Set to `undefined` if the stream identifier has not yet been assigned.
|
100
100
|
* @since v8.4.0
|
101
101
|
*/
|
102
102
|
readonly id?: number | undefined;
|
@@ -109,7 +109,7 @@ declare module "http2" {
|
|
109
109
|
/**
|
110
110
|
* Set to the `RST_STREAM` `error code` reported when the `Http2Stream` is
|
111
111
|
* destroyed after either receiving an `RST_STREAM` frame from the connected peer,
|
112
|
-
* calling `http2stream.close()`, or `http2stream.destroy()`. Will be`undefined` if the `Http2Stream` has not been closed.
|
112
|
+
* calling `http2stream.close()`, or `http2stream.destroy()`. Will be `undefined` if the `Http2Stream` has not been closed.
|
113
113
|
* @since v8.4.0
|
114
114
|
*/
|
115
115
|
readonly rstCode: number;
|
@@ -136,7 +136,7 @@ declare module "http2" {
|
|
136
136
|
*/
|
137
137
|
readonly session: Http2Session | undefined;
|
138
138
|
/**
|
139
|
-
* Provides miscellaneous information about the current state of the`Http2Stream`.
|
139
|
+
* Provides miscellaneous information about the current state of the `Http2Stream`.
|
140
140
|
*
|
141
141
|
* A current state of this `Http2Stream`.
|
142
142
|
* @since v8.4.0
|
@@ -355,7 +355,7 @@ declare module "http2" {
|
|
355
355
|
/**
|
356
356
|
* Read-only property mapped to the `SETTINGS_ENABLE_PUSH` flag of the remote
|
357
357
|
* client's most recent `SETTINGS` frame. Will be `true` if the remote peer
|
358
|
-
* accepts push streams, `false` otherwise. Settings are the same for every`Http2Stream` in the same `Http2Session`.
|
358
|
+
* accepts push streams, `false` otherwise. Settings are the same for every `Http2Stream` in the same `Http2Session`.
|
359
359
|
* @since v8.4.0
|
360
360
|
*/
|
361
361
|
readonly pushAllowed: boolean;
|
@@ -365,7 +365,7 @@ declare module "http2" {
|
|
365
365
|
*/
|
366
366
|
additionalHeaders(headers: OutgoingHttpHeaders): void;
|
367
367
|
/**
|
368
|
-
* Initiates a push stream. The callback is invoked with the new `Http2Stream`instance created for the push stream passed as the second argument, or an`Error` passed as the first argument.
|
368
|
+
* Initiates a push stream. The callback is invoked with the new `Http2Stream` instance created for the push stream passed as the second argument, or an `Error` passed as the first argument.
|
369
369
|
*
|
370
370
|
* ```js
|
371
371
|
* const http2 = require('node:http2');
|
@@ -382,7 +382,7 @@ declare module "http2" {
|
|
382
382
|
* ```
|
383
383
|
*
|
384
384
|
* Setting the weight of a push stream is not allowed in the `HEADERS` frame. Pass
|
385
|
-
* a `weight` value to `http2stream.priority` with the `silent` option set to`true` to enable server-side bandwidth balancing between concurrent streams.
|
385
|
+
* a `weight` value to `http2stream.priority` with the `silent` option set to `true` to enable server-side bandwidth balancing between concurrent streams.
|
386
386
|
*
|
387
387
|
* Calling `http2stream.pushStream()` from within a pushed stream is not permitted
|
388
388
|
* and will throw an error.
|
@@ -413,7 +413,7 @@ declare module "http2" {
|
|
413
413
|
* used to sent trailing header fields to the peer.
|
414
414
|
*
|
415
415
|
* When `options.waitForTrailers` is set, the `Http2Stream` will not automatically
|
416
|
-
* close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`.
|
416
|
+
* close when the final `DATA` frame is transmitted. User code must call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`.
|
417
417
|
*
|
418
418
|
* ```js
|
419
419
|
* const http2 = require('node:http2');
|
@@ -459,7 +459,7 @@ 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 perform an `fs.fstat()` call to
|
462
|
+
* of the given fd. If the `statCheck` function is provided, the `http2stream.respondWithFD()` method will perform an `fs.fstat()` call to
|
463
463
|
* 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
|
@@ -478,7 +478,7 @@ 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()` or `http2stream.close()` to close the`Http2Stream`.
|
481
|
+
* close when the final `DATA` frame is transmitted. User code _must_ call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`.
|
482
482
|
*
|
483
483
|
* ```js
|
484
484
|
* const http2 = require('node:http2');
|
@@ -521,7 +521,7 @@ declare module "http2" {
|
|
521
521
|
* an opportunity to set additional content headers based on the `fs.Stat` details
|
522
522
|
* of the given file:
|
523
523
|
*
|
524
|
-
* If an error occurs while attempting to read the file data, the `Http2Stream`will be closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR`code. If the `onError` callback is
|
524
|
+
* If an error occurs while attempting to read the file data, the `Http2Stream` will be closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR` code. If the `onError` callback is
|
525
525
|
* defined, then it will be called. Otherwise
|
526
526
|
* the stream will be destroyed.
|
527
527
|
*
|
@@ -559,7 +559,7 @@ declare module "http2" {
|
|
559
559
|
*
|
560
560
|
* The `options.statCheck` function may also be used to cancel the send operation
|
561
561
|
* by returning `false`. For instance, a conditional request may check the stat
|
562
|
-
* results to determine if the file has been modified to return an appropriate`304` response:
|
562
|
+
* results to determine if the file has been modified to return an appropriate `304` response:
|
563
563
|
*
|
564
564
|
* ```js
|
565
565
|
* const http2 = require('node:http2');
|
@@ -647,18 +647,18 @@ declare module "http2" {
|
|
647
647
|
/**
|
648
648
|
* Value will be `undefined` if the `Http2Session` is not yet connected to a
|
649
649
|
* socket, `h2c` if the `Http2Session` is not connected to a `TLSSocket`, or
|
650
|
-
* will return the value of the connected `TLSSocket`'s own `alpnProtocol`property.
|
650
|
+
* will return the value of the connected `TLSSocket`'s own `alpnProtocol` property.
|
651
651
|
* @since v9.4.0
|
652
652
|
*/
|
653
653
|
readonly alpnProtocol?: string | undefined;
|
654
654
|
/**
|
655
|
-
* Will be `true` if this `Http2Session` instance has been closed, otherwise`false`.
|
655
|
+
* Will be `true` if this `Http2Session` instance has been closed, otherwise `false`.
|
656
656
|
* @since v9.4.0
|
657
657
|
*/
|
658
658
|
readonly closed: boolean;
|
659
659
|
/**
|
660
660
|
* Will be `true` if this `Http2Session` instance is still connecting, will be set
|
661
|
-
* to `false` before emitting `connect` event and/or calling the `http2.connect`callback.
|
661
|
+
* to `false` before emitting `connect` event and/or calling the `http2.connect` callback.
|
662
662
|
* @since v10.0.0
|
663
663
|
*/
|
664
664
|
readonly connecting: boolean;
|
@@ -677,7 +677,7 @@ declare module "http2" {
|
|
677
677
|
*/
|
678
678
|
readonly encrypted?: boolean | undefined;
|
679
679
|
/**
|
680
|
-
* A prototype-less object describing the current local settings of this`Http2Session`. The local settings are local to _this_`Http2Session` instance.
|
680
|
+
* A prototype-less object describing the current local settings of this `Http2Session`. The local settings are local to _this_`Http2Session` instance.
|
681
681
|
* @since v8.4.0
|
682
682
|
*/
|
683
683
|
readonly localSettings: Settings;
|
@@ -692,7 +692,7 @@ declare module "http2" {
|
|
692
692
|
readonly originSet?: string[] | undefined;
|
693
693
|
/**
|
694
694
|
* Indicates whether the `Http2Session` is currently waiting for acknowledgment of
|
695
|
-
* a sent `SETTINGS` frame. Will be `true` after calling the`http2session.settings()` method. Will be `false` once all sent `SETTINGS`frames have been acknowledged.
|
695
|
+
* a sent `SETTINGS` frame. Will be `true` after calling the `http2session.settings()` method. Will be `false` once all sent `SETTINGS` frames have been acknowledged.
|
696
696
|
* @since v8.4.0
|
697
697
|
*/
|
698
698
|
readonly pendingSettingsAck: boolean;
|
@@ -722,7 +722,7 @@ declare module "http2" {
|
|
722
722
|
*/
|
723
723
|
readonly state: SessionState;
|
724
724
|
/**
|
725
|
-
* The `http2session.type` will be equal to`http2.constants.NGHTTP2_SESSION_SERVER` if this `Http2Session` instance is a
|
725
|
+
* The `http2session.type` will be equal to `http2.constants.NGHTTP2_SESSION_SERVER` if this `Http2Session` instance is a
|
726
726
|
* server, and `http2.constants.NGHTTP2_SESSION_CLIENT` if the instance is a
|
727
727
|
* client.
|
728
728
|
* @since v8.4.0
|
@@ -739,11 +739,11 @@ declare module "http2" {
|
|
739
739
|
*/
|
740
740
|
close(callback?: () => void): void;
|
741
741
|
/**
|
742
|
-
* Immediately terminates the `Http2Session` and the associated `net.Socket` or`tls.TLSSocket`.
|
742
|
+
* Immediately terminates the `Http2Session` and the associated `net.Socket` or `tls.TLSSocket`.
|
743
743
|
*
|
744
|
-
* Once destroyed, the `Http2Session` will emit the `'close'` event. If `error`is not undefined, an `'error'` event will be emitted immediately before the`'close'` event.
|
744
|
+
* Once destroyed, the `Http2Session` will emit the `'close'` event. If `error` is not undefined, an `'error'` event will be emitted immediately before the `'close'` event.
|
745
745
|
*
|
746
|
-
* If there are any remaining open `Http2Streams` associated with the`Http2Session`, those will also be destroyed.
|
746
|
+
* If there are any remaining open `Http2Streams` associated with the `Http2Session`, those will also be destroyed.
|
747
747
|
* @since v8.4.0
|
748
748
|
* @param error An `Error` object if the `Http2Session` is being destroyed due to an error.
|
749
749
|
* @param code The HTTP/2 error code to send in the final `GOAWAY` frame. If unspecified, and `error` is not undefined, the default is `INTERNAL_ERROR`, otherwise defaults to `NO_ERROR`.
|
@@ -759,17 +759,17 @@ declare module "http2" {
|
|
759
759
|
goaway(code?: number, lastStreamID?: number, opaqueData?: NodeJS.ArrayBufferView): void;
|
760
760
|
/**
|
761
761
|
* Sends a `PING` frame to the connected HTTP/2 peer. A `callback` function must
|
762
|
-
* be provided. The method will return `true` if the `PING` was sent, `false`otherwise.
|
762
|
+
* be provided. The method will return `true` if the `PING` was sent, `false` otherwise.
|
763
763
|
*
|
764
|
-
* The maximum number of outstanding (unacknowledged) pings is determined by the`maxOutstandingPings` configuration option. The default maximum is 10.
|
764
|
+
* The maximum number of outstanding (unacknowledged) pings is determined by the `maxOutstandingPings` configuration option. The default maximum is 10.
|
765
765
|
*
|
766
|
-
* If provided, the `payload` must be a `Buffer`, `TypedArray`, or `DataView`containing 8 bytes of data that will be transmitted with the `PING` and
|
766
|
+
* If provided, the `payload` must be a `Buffer`, `TypedArray`, or `DataView` containing 8 bytes of data that will be transmitted with the `PING` and
|
767
767
|
* returned with the ping acknowledgment.
|
768
768
|
*
|
769
769
|
* The callback will be invoked with three arguments: an error argument that will
|
770
770
|
* be `null` if the `PING` was successfully acknowledged, a `duration` argument
|
771
771
|
* that reports the number of milliseconds elapsed since the ping was sent and the
|
772
|
-
* acknowledgment was received, and a `Buffer` containing the 8-byte `PING`payload.
|
772
|
+
* acknowledgment was received, and a `Buffer` containing the 8-byte `PING` payload.
|
773
773
|
*
|
774
774
|
* ```js
|
775
775
|
* session.ping(Buffer.from('abcdefgh'), (err, duration, payload) => {
|
@@ -791,7 +791,7 @@ declare module "http2" {
|
|
791
791
|
callback: (err: Error | null, duration: number, payload: Buffer) => void,
|
792
792
|
): boolean;
|
793
793
|
/**
|
794
|
-
* Calls `ref()` on this `Http2Session`instance's underlying `net.Socket`.
|
794
|
+
* Calls `ref()` on this `Http2Session` instance's underlying `net.Socket`.
|
795
795
|
* @since v9.4.0
|
796
796
|
*/
|
797
797
|
ref(): void;
|
@@ -822,9 +822,9 @@ declare module "http2" {
|
|
822
822
|
*/
|
823
823
|
setTimeout(msecs: number, callback?: () => void): void;
|
824
824
|
/**
|
825
|
-
* Updates the current local settings for this `Http2Session` and sends a new`SETTINGS` frame to the connected HTTP/2 peer.
|
825
|
+
* Updates the current local settings for this `Http2Session` and sends a new `SETTINGS` frame to the connected HTTP/2 peer.
|
826
826
|
*
|
827
|
-
* Once called, the `http2session.pendingSettingsAck` property will be `true`while the session is waiting for the remote peer to acknowledge the new
|
827
|
+
* Once called, the `http2session.pendingSettingsAck` property will be `true` while the session is waiting for the remote peer to acknowledge the new
|
828
828
|
* settings.
|
829
829
|
*
|
830
830
|
* The new settings will not become effective until the `SETTINGS` acknowledgment
|
@@ -917,15 +917,15 @@ declare module "http2" {
|
|
917
917
|
}
|
918
918
|
export interface ClientHttp2Session extends Http2Session {
|
919
919
|
/**
|
920
|
-
* For HTTP/2 Client `Http2Session` instances only, the `http2session.request()`creates and returns an `Http2Stream` instance that can be used to send an
|
920
|
+
* For HTTP/2 Client `Http2Session` instances only, the `http2session.request()` creates and returns an `Http2Stream` instance that can be used to send an
|
921
921
|
* HTTP/2 request to the connected server.
|
922
922
|
*
|
923
923
|
* When a `ClientHttp2Session` is first created, the socket may not yet be
|
924
924
|
* connected. if `clienthttp2session.request()` is called during this time, the
|
925
925
|
* actual request will be deferred until the socket is ready to go.
|
926
|
-
* If the `session` is closed before the actual request be executed, an`ERR_HTTP2_GOAWAY_SESSION` is thrown.
|
926
|
+
* If the `session` is closed before the actual request be executed, an `ERR_HTTP2_GOAWAY_SESSION` is thrown.
|
927
927
|
*
|
928
|
-
* This method is only available if `http2session.type` is equal to`http2.constants.NGHTTP2_SESSION_CLIENT`.
|
928
|
+
* This method is only available if `http2session.type` is equal to `http2.constants.NGHTTP2_SESSION_CLIENT`.
|
929
929
|
*
|
930
930
|
* ```js
|
931
931
|
* const http2 = require('node:http2');
|
@@ -1108,7 +1108,7 @@ declare module "http2" {
|
|
1108
1108
|
* ```
|
1109
1109
|
*
|
1110
1110
|
* When a string is passed as an `origin`, it will be parsed as a URL and the
|
1111
|
-
* origin will be derived. For instance, the origin for the HTTP URL`'https://example.org/foo/bar'` is the ASCII string`'https://example.org'`. An error will be thrown if either the given
|
1111
|
+
* origin will be derived. For instance, the origin for the HTTP URL `'https://example.org/foo/bar'` is the ASCII string` 'https://example.org'`. An error will be thrown if either the given
|
1112
1112
|
* string
|
1113
1113
|
* cannot be parsed as a URL or if a valid origin cannot be derived.
|
1114
1114
|
*
|
@@ -1198,6 +1198,7 @@ declare module "http2" {
|
|
1198
1198
|
paddingStrategy?: number | undefined;
|
1199
1199
|
peerMaxConcurrentStreams?: number | undefined;
|
1200
1200
|
settings?: Settings | undefined;
|
1201
|
+
remoteCustomSettings?: number[] | undefined;
|
1201
1202
|
/**
|
1202
1203
|
* Specifies a timeout in milliseconds that
|
1203
1204
|
* a server should wait when an [`'unknownProtocol'`][] is emitted. If the
|
@@ -1426,7 +1427,7 @@ declare module "http2" {
|
|
1426
1427
|
readonly aborted: boolean;
|
1427
1428
|
/**
|
1428
1429
|
* The request authority pseudo header field. Because HTTP/2 allows requests
|
1429
|
-
* to set either `:authority` or `host`, this value is derived from`req.headers[':authority']` if present. Otherwise, it is derived from`req.headers['host']`.
|
1430
|
+
* to set either `:authority` or `host`, this value is derived from `req.headers[':authority']` if present. Otherwise, it is derived from `req.headers['host']`.
|
1430
1431
|
* @since v8.4.0
|
1431
1432
|
*/
|
1432
1433
|
readonly authority: string;
|
@@ -1473,9 +1474,9 @@ declare module "http2" {
|
|
1473
1474
|
readonly headers: IncomingHttpHeaders;
|
1474
1475
|
/**
|
1475
1476
|
* In case of server request, the HTTP version sent by the client. In the case of
|
1476
|
-
* client response, the HTTP version of the connected-to server. Returns`'2.0'`.
|
1477
|
+
* client response, the HTTP version of the connected-to server. Returns `'2.0'`.
|
1477
1478
|
*
|
1478
|
-
* Also `message.httpVersionMajor` is the first integer and`message.httpVersionMinor` is the second.
|
1479
|
+
* Also `message.httpVersionMajor` is the first integer and `message.httpVersionMinor` is the second.
|
1479
1480
|
* @since v8.4.0
|
1480
1481
|
*/
|
1481
1482
|
readonly httpVersion: string;
|
@@ -1530,11 +1531,11 @@ declare module "http2" {
|
|
1530
1531
|
* `destroyed`, `readable`, and `writable` properties will be retrieved from and
|
1531
1532
|
* set on `request.stream`.
|
1532
1533
|
*
|
1533
|
-
* `destroy`, `emit`, `end`, `on` and `once` methods will be called on`request.stream`.
|
1534
|
+
* `destroy`, `emit`, `end`, `on` and `once` methods will be called on `request.stream`.
|
1534
1535
|
*
|
1535
1536
|
* `setTimeout` method will be called on `request.stream.session`.
|
1536
1537
|
*
|
1537
|
-
* `pause`, `read`, `resume`, and `write` will throw an error with code`ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for
|
1538
|
+
* `pause`, `read`, `resume`, and `write` will throw an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for
|
1538
1539
|
* more information.
|
1539
1540
|
*
|
1540
1541
|
* All other interactions will be routed directly to the socket. With TLS support,
|
@@ -1597,7 +1598,7 @@ declare module "http2" {
|
|
1597
1598
|
* the response object.
|
1598
1599
|
*
|
1599
1600
|
* If no `'timeout'` listener is added to the request, the response, or
|
1600
|
-
* the server, then `Http2Stream`
|
1601
|
+
* the server, then `Http2Stream`s are destroyed when they time out. If a
|
1601
1602
|
* handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly.
|
1602
1603
|
* @since v8.4.0
|
1603
1604
|
*/
|
@@ -1659,6 +1660,28 @@ declare module "http2" {
|
|
1659
1660
|
* @deprecated Since v13.0.0 - Use `socket`.
|
1660
1661
|
*/
|
1661
1662
|
readonly connection: net.Socket | tls.TLSSocket;
|
1663
|
+
/**
|
1664
|
+
* Append a single header value to the header object.
|
1665
|
+
*
|
1666
|
+
* If the value is an array, this is equivalent to calling this method multiple times.
|
1667
|
+
*
|
1668
|
+
* If there were no previous values for the header, this is equivalent to calling {@link setHeader}.
|
1669
|
+
*
|
1670
|
+
* Attempting to set a header field name or value that contains invalid characters will result in a
|
1671
|
+
* [TypeError](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-typeerror) being thrown.
|
1672
|
+
*
|
1673
|
+
* ```js
|
1674
|
+
* // Returns headers including "set-cookie: a" and "set-cookie: b"
|
1675
|
+
* const server = http2.createServer((req, res) => {
|
1676
|
+
* res.setHeader('set-cookie', 'a');
|
1677
|
+
* res.appendHeader('set-cookie', 'b');
|
1678
|
+
* res.writeHead(200);
|
1679
|
+
* res.end('ok');
|
1680
|
+
* });
|
1681
|
+
* ```
|
1682
|
+
* @since v20.12.0
|
1683
|
+
*/
|
1684
|
+
appendHeader(name: string, value: string | string[]): void;
|
1662
1685
|
/**
|
1663
1686
|
* Boolean value that indicates whether the response has completed. Starts
|
1664
1687
|
* as `false`. After `response.end()` executes, the value will be `true`.
|
@@ -1683,11 +1706,11 @@ declare module "http2" {
|
|
1683
1706
|
* `destroyed`, `readable`, and `writable` properties will be retrieved from and
|
1684
1707
|
* set on `response.stream`.
|
1685
1708
|
*
|
1686
|
-
* `destroy`, `emit`, `end`, `on` and `once` methods will be called on`response.stream`.
|
1709
|
+
* `destroy`, `emit`, `end`, `on` and `once` methods will be called on `response.stream`.
|
1687
1710
|
*
|
1688
1711
|
* `setTimeout` method will be called on `response.stream.session`.
|
1689
1712
|
*
|
1690
|
-
* `pause`, `read`, `resume`, and `write` will throw an error with code`ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for
|
1713
|
+
* `pause`, `read`, `resume`, and `write` will throw an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for
|
1691
1714
|
* more information.
|
1692
1715
|
*
|
1693
1716
|
* All other interactions will be routed directly to the socket.
|
@@ -1791,7 +1814,7 @@ declare module "http2" {
|
|
1791
1814
|
* header names and the values are the respective header values. All header names
|
1792
1815
|
* are lowercase.
|
1793
1816
|
*
|
1794
|
-
* The object returned by the `response.getHeaders()` method _does
|
1817
|
+
* The object returned by the `response.getHeaders()` method _does not_ prototypically inherit from the JavaScript `Object`. This means that typical `Object` methods such as `obj.toString()`,
|
1795
1818
|
* `obj.hasOwnProperty()`, and others
|
1796
1819
|
* are not defined and _will not work_.
|
1797
1820
|
*
|
@@ -1865,7 +1888,7 @@ declare module "http2" {
|
|
1865
1888
|
*
|
1866
1889
|
* If no `'timeout'` listener is added to the request, the response, or
|
1867
1890
|
* the server, then `Http2Stream` s are destroyed when they time out. If a
|
1868
|
-
* handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly.
|
1891
|
+
* handler is assigned to the request, the response, or the server's `'timeout'` events, timed out sockets must be handled explicitly.
|
1869
1892
|
* @since v8.4.0
|
1870
1893
|
*/
|
1871
1894
|
setTimeout(msecs: number, callback?: () => void): void;
|
@@ -1901,7 +1924,7 @@ declare module "http2" {
|
|
1901
1924
|
write(chunk: string | Uint8Array, encoding: BufferEncoding, callback?: (err: Error) => void): boolean;
|
1902
1925
|
/**
|
1903
1926
|
* Sends a status `100 Continue` to the client, indicating that the request body
|
1904
|
-
* should be sent. See the `'checkContinue'` event on `Http2Server` and`Http2SecureServer`.
|
1927
|
+
* should be sent. See the `'checkContinue'` event on `Http2Server` and `Http2SecureServer`.
|
1905
1928
|
* @since v8.4.0
|
1906
1929
|
*/
|
1907
1930
|
writeContinue(): void;
|
@@ -1952,7 +1975,7 @@ declare module "http2" {
|
|
1952
1975
|
* `Content-Length` is given in bytes not characters. The`Buffer.byteLength()` API may be used to determine the number of bytes in a
|
1953
1976
|
* given encoding. On outbound messages, Node.js does not check if Content-Length
|
1954
1977
|
* and the length of the body being transmitted are equal or not. However, when
|
1955
|
-
* receiving messages, Node.js will automatically reject messages when the`Content-Length` does not match the actual payload size.
|
1978
|
+
* receiving messages, Node.js will automatically reject messages when the `Content-Length` does not match the actual payload size.
|
1956
1979
|
*
|
1957
1980
|
* This method may be called at most one time on a message before `response.end()` is called.
|
1958
1981
|
*
|
@@ -2258,7 +2281,7 @@ declare module "http2" {
|
|
2258
2281
|
*/
|
2259
2282
|
export const sensitiveHeaders: symbol;
|
2260
2283
|
/**
|
2261
|
-
* Returns an object containing the default settings for an `Http2Session`instance. This method returns a new object instance every time it is called
|
2284
|
+
* Returns an object containing the default settings for an `Http2Session` instance. This method returns a new object instance every time it is called
|
2262
2285
|
* so instances returned may be safely modified for use.
|
2263
2286
|
* @since v8.4.0
|
2264
2287
|
*/
|
@@ -2287,7 +2310,7 @@ declare module "http2" {
|
|
2287
2310
|
*/
|
2288
2311
|
export function getUnpackedSettings(buf: Uint8Array): Settings;
|
2289
2312
|
/**
|
2290
|
-
* Returns a `net.Server` instance that creates and manages `Http2Session`instances.
|
2313
|
+
* Returns a `net.Server` instance that creates and manages `Http2Session` instances.
|
2291
2314
|
*
|
2292
2315
|
* Since there are no browsers known that support [unencrypted HTTP/2](https://http2.github.io/faq/#does-http2-require-encryption), the use of {@link createSecureServer} is necessary when
|
2293
2316
|
* communicating
|
@@ -2323,7 +2346,7 @@ declare module "http2" {
|
|
2323
2346
|
onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
2324
2347
|
): Http2Server;
|
2325
2348
|
/**
|
2326
|
-
* Returns a `tls.Server` instance that creates and manages `Http2Session`instances.
|
2349
|
+
* Returns a `tls.Server` instance that creates and manages `Http2Session` instances.
|
2327
2350
|
*
|
2328
2351
|
* ```js
|
2329
2352
|
* const http2 = require('node:http2');
|
@@ -2382,6 +2405,13 @@ declare module "http2" {
|
|
2382
2405
|
options?: ClientSessionOptions | SecureClientSessionOptions,
|
2383
2406
|
listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
|
2384
2407
|
): ClientHttp2Session;
|
2408
|
+
/**
|
2409
|
+
* Create an HTTP/2 server session from an existing socket.
|
2410
|
+
* @param socket A Duplex Stream
|
2411
|
+
* @param options Any `{@link createServer}` options can be provided.
|
2412
|
+
* @since v20.12.0
|
2413
|
+
*/
|
2414
|
+
export function performServerHandshake(socket: stream.Duplex, options?: ServerOptions): ServerHttp2Session;
|
2385
2415
|
}
|
2386
2416
|
declare module "node:http2" {
|
2387
2417
|
export * from "http2";
|
node/https.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
|
3
3
|
* separate module.
|
4
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.2
|
4
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/https.js)
|
5
5
|
*/
|
6
6
|
declare module "https" {
|
7
7
|
import { Duplex } from "node:stream";
|
node/inspector.d.ts
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
* ```js
|
21
21
|
* import * as inspector from 'node:inspector';
|
22
22
|
* ```
|
23
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.2
|
23
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/inspector.js)
|
24
24
|
*/
|
25
25
|
declare module 'inspector' {
|
26
26
|
import EventEmitter = require('node:events');
|
@@ -2694,13 +2694,13 @@ declare module 'inspector' {
|
|
2694
2694
|
prependOnceListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this;
|
2695
2695
|
}
|
2696
2696
|
/**
|
2697
|
-
* Activate inspector on host and port. Equivalent to`node --inspect=[[host:]port]`, but can be done programmatically after node has
|
2697
|
+
* Activate inspector on host and port. Equivalent to `node --inspect=[[host:]port]`, but can be done programmatically after node has
|
2698
2698
|
* started.
|
2699
2699
|
*
|
2700
2700
|
* If wait is `true`, will block until a client has connected to the inspect port
|
2701
2701
|
* and flow control has been passed to the debugger client.
|
2702
2702
|
*
|
2703
|
-
* See the `security warning` regarding the `host`parameter usage.
|
2703
|
+
* See the `security warning` regarding the `host` parameter usage.
|
2704
2704
|
* @param [port='what was specified on the CLI'] Port to listen on for inspector connections. Optional.
|
2705
2705
|
* @param [host='what was specified on the CLI'] Host to listen on for inspector connections. Optional.
|
2706
2706
|
* @param [wait=false] Block until a client has connected. Optional.
|
@@ -2731,7 +2731,7 @@ declare module 'inspector' {
|
|
2731
2731
|
*/
|
2732
2732
|
function url(): string | undefined;
|
2733
2733
|
/**
|
2734
|
-
* Blocks until a client (existing or connected later) has sent`Runtime.runIfWaitingForDebugger` command.
|
2734
|
+
* Blocks until a client (existing or connected later) has sent `Runtime.runIfWaitingForDebugger` command.
|
2735
2735
|
*
|
2736
2736
|
* An exception will be thrown if there is no active inspector.
|
2737
2737
|
* @since v12.7.0
|
node/net.d.ts
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
* ```js
|
11
11
|
* const net = require('node:net');
|
12
12
|
* ```
|
13
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.2
|
13
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/net.js)
|
14
14
|
*/
|
15
15
|
declare module "net" {
|
16
16
|
import * as stream from "node:stream";
|
@@ -363,17 +363,29 @@ declare module "net" {
|
|
363
363
|
* events.EventEmitter
|
364
364
|
* 1. close
|
365
365
|
* 2. connect
|
366
|
-
* 3.
|
367
|
-
* 4.
|
368
|
-
* 5.
|
369
|
-
* 6.
|
370
|
-
* 7.
|
371
|
-
* 8.
|
372
|
-
* 9.
|
366
|
+
* 3. connectionAttempt
|
367
|
+
* 4. connectionAttemptFailed
|
368
|
+
* 5. connectionAttemptTimeout
|
369
|
+
* 6. data
|
370
|
+
* 7. drain
|
371
|
+
* 8. end
|
372
|
+
* 9. error
|
373
|
+
* 10. lookup
|
374
|
+
* 11. ready
|
375
|
+
* 12. timeout
|
373
376
|
*/
|
374
377
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
375
378
|
addListener(event: "close", listener: (hadError: boolean) => void): this;
|
376
379
|
addListener(event: "connect", listener: () => void): this;
|
380
|
+
addListener(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
|
381
|
+
addListener(
|
382
|
+
event: "connectionAttemptFailed",
|
383
|
+
listener: (ip: string, port: number, family: number) => void,
|
384
|
+
): this;
|
385
|
+
addListener(
|
386
|
+
event: "connectionAttemptTimeout",
|
387
|
+
listener: (ip: string, port: number, family: number) => void,
|
388
|
+
): this;
|
377
389
|
addListener(event: "data", listener: (data: Buffer) => void): this;
|
378
390
|
addListener(event: "drain", listener: () => void): this;
|
379
391
|
addListener(event: "end", listener: () => void): this;
|
@@ -387,6 +399,9 @@ declare module "net" {
|
|
387
399
|
emit(event: string | symbol, ...args: any[]): boolean;
|
388
400
|
emit(event: "close", hadError: boolean): boolean;
|
389
401
|
emit(event: "connect"): boolean;
|
402
|
+
emit(event: "connectionAttempt", ip: string, port: number, family: number): boolean;
|
403
|
+
emit(event: "connectionAttemptFailed", ip: string, port: number, family: number): boolean;
|
404
|
+
emit(event: "connectionAttemptTimeout", ip: string, port: number, family: number): boolean;
|
390
405
|
emit(event: "data", data: Buffer): boolean;
|
391
406
|
emit(event: "drain"): boolean;
|
392
407
|
emit(event: "end"): boolean;
|
@@ -397,6 +412,9 @@ declare module "net" {
|
|
397
412
|
on(event: string, listener: (...args: any[]) => void): this;
|
398
413
|
on(event: "close", listener: (hadError: boolean) => void): this;
|
399
414
|
on(event: "connect", listener: () => void): this;
|
415
|
+
on(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
|
416
|
+
on(event: "connectionAttemptFailed", listener: (ip: string, port: number, family: number) => void): this;
|
417
|
+
on(event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void): this;
|
400
418
|
on(event: "data", listener: (data: Buffer) => void): this;
|
401
419
|
on(event: "drain", listener: () => void): this;
|
402
420
|
on(event: "end", listener: () => void): this;
|
@@ -409,6 +427,9 @@ declare module "net" {
|
|
409
427
|
on(event: "timeout", listener: () => void): this;
|
410
428
|
once(event: string, listener: (...args: any[]) => void): this;
|
411
429
|
once(event: "close", listener: (hadError: boolean) => void): this;
|
430
|
+
once(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
|
431
|
+
once(event: "connectionAttemptFailed", listener: (ip: string, port: number, family: number) => void): this;
|
432
|
+
once(event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void): this;
|
412
433
|
once(event: "connect", listener: () => void): this;
|
413
434
|
once(event: "data", listener: (data: Buffer) => void): this;
|
414
435
|
once(event: "drain", listener: () => void): this;
|
@@ -423,6 +444,15 @@ declare module "net" {
|
|
423
444
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
424
445
|
prependListener(event: "close", listener: (hadError: boolean) => void): this;
|
425
446
|
prependListener(event: "connect", listener: () => void): this;
|
447
|
+
prependListener(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
|
448
|
+
prependListener(
|
449
|
+
event: "connectionAttemptFailed",
|
450
|
+
listener: (ip: string, port: number, family: number) => void,
|
451
|
+
): this;
|
452
|
+
prependListener(
|
453
|
+
event: "connectionAttemptTimeout",
|
454
|
+
listener: (ip: string, port: number, family: number) => void,
|
455
|
+
): this;
|
426
456
|
prependListener(event: "data", listener: (data: Buffer) => void): this;
|
427
457
|
prependListener(event: "drain", listener: () => void): this;
|
428
458
|
prependListener(event: "end", listener: () => void): this;
|
@@ -436,6 +466,18 @@ declare module "net" {
|
|
436
466
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
437
467
|
prependOnceListener(event: "close", listener: (hadError: boolean) => void): this;
|
438
468
|
prependOnceListener(event: "connect", listener: () => void): this;
|
469
|
+
prependOnceListener(
|
470
|
+
event: "connectionAttempt",
|
471
|
+
listener: (ip: string, port: number, family: number) => void,
|
472
|
+
): this;
|
473
|
+
prependOnceListener(
|
474
|
+
event: "connectionAttemptFailed",
|
475
|
+
listener: (ip: string, port: number, family: number) => void,
|
476
|
+
): this;
|
477
|
+
prependOnceListener(
|
478
|
+
event: "connectionAttemptTimeout",
|
479
|
+
listener: (ip: string, port: number, family: number) => void,
|
480
|
+
): this;
|
439
481
|
prependOnceListener(event: "data", listener: (data: Buffer) => void): this;
|
440
482
|
prependOnceListener(event: "drain", listener: () => void): this;
|
441
483
|
prependOnceListener(event: "end", listener: () => void): this;
|