@types/node 18.11.5 → 20.2.5
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 +2 -2
- node/assert.d.ts +86 -75
- node/async_hooks.d.ts +66 -37
- node/buffer.d.ts +193 -100
- node/child_process.d.ts +82 -56
- node/cluster.d.ts +12 -12
- node/console.d.ts +5 -5
- node/crypto.d.ts +233 -235
- node/dgram.d.ts +15 -15
- node/diagnostics_channel.d.ts +59 -21
- node/dns/promises.d.ts +50 -6
- node/dns.d.ts +26 -17
- node/domain.d.ts +4 -4
- node/events.d.ts +111 -65
- node/fs/promises.d.ts +99 -47
- node/fs.d.ts +244 -73
- node/globals.d.ts +6 -3
- node/http.d.ts +265 -148
- node/http2.d.ts +42 -47
- node/https.d.ts +53 -153
- node/index.d.ts +2 -1
- node/inspector.d.ts +10 -3
- node/module.d.ts +6 -4
- node/net.d.ts +32 -15
- node/os.d.ts +27 -16
- node/package.json +9 -4
- node/path.d.ts +4 -4
- node/perf_hooks.d.ts +28 -15
- node/process.d.ts +49 -46
- node/punycode.d.ts +1 -1
- node/querystring.d.ts +5 -5
- node/readline/promises.d.ts +65 -63
- node/readline.d.ts +32 -159
- node/repl.d.ts +20 -20
- node/stream/consumers.d.ts +1 -1
- node/stream.d.ts +950 -869
- node/string_decoder.d.ts +6 -6
- node/test.d.ts +877 -139
- node/timers/promises.d.ts +26 -1
- node/timers.d.ts +125 -4
- node/tls.d.ts +120 -29
- node/trace_events.d.ts +20 -9
- node/ts4.8/assert.d.ts +86 -75
- node/ts4.8/async_hooks.d.ts +66 -37
- node/ts4.8/buffer.d.ts +193 -101
- node/ts4.8/child_process.d.ts +82 -56
- node/ts4.8/cluster.d.ts +12 -12
- node/ts4.8/console.d.ts +5 -5
- node/ts4.8/crypto.d.ts +230 -233
- node/ts4.8/dgram.d.ts +15 -15
- node/ts4.8/diagnostics_channel.d.ts +59 -21
- node/ts4.8/dns/promises.d.ts +50 -6
- node/ts4.8/dns.d.ts +26 -17
- node/ts4.8/domain.d.ts +4 -4
- node/ts4.8/events.d.ts +111 -65
- node/ts4.8/fs/promises.d.ts +97 -46
- node/ts4.8/fs.d.ts +244 -73
- node/ts4.8/globals.d.ts +21 -12
- node/ts4.8/http.d.ts +265 -148
- node/ts4.8/http2.d.ts +42 -47
- node/ts4.8/https.d.ts +53 -153
- node/ts4.8/inspector.d.ts +10 -3
- node/ts4.8/module.d.ts +6 -4
- node/ts4.8/net.d.ts +33 -16
- node/ts4.8/os.d.ts +27 -16
- node/ts4.8/path.d.ts +4 -4
- node/ts4.8/perf_hooks.d.ts +28 -15
- node/ts4.8/process.d.ts +49 -46
- node/ts4.8/punycode.d.ts +1 -1
- node/ts4.8/querystring.d.ts +5 -5
- node/ts4.8/readline/promises.d.ts +65 -63
- node/ts4.8/readline.d.ts +32 -159
- node/ts4.8/repl.d.ts +20 -20
- node/ts4.8/stream/consumers.d.ts +1 -1
- node/ts4.8/stream.d.ts +192 -140
- node/ts4.8/string_decoder.d.ts +6 -6
- node/ts4.8/test.d.ts +877 -139
- node/ts4.8/timers/promises.d.ts +26 -1
- node/ts4.8/timers.d.ts +125 -4
- node/ts4.8/tls.d.ts +120 -29
- node/ts4.8/trace_events.d.ts +20 -9
- node/ts4.8/tty.d.ts +4 -5
- node/ts4.8/url.d.ts +46 -42
- node/ts4.8/util.d.ts +325 -123
- node/ts4.8/v8.d.ts +253 -14
- node/ts4.8/vm.d.ts +417 -32
- node/ts4.8/wasi.d.ts +13 -19
- node/ts4.8/worker_threads.d.ts +38 -34
- node/ts4.8/zlib.d.ts +11 -11
- node/tty.d.ts +4 -5
- node/url.d.ts +46 -42
- node/util.d.ts +325 -123
- node/v8.d.ts +253 -14
- node/vm.d.ts +417 -32
- node/wasi.d.ts +13 -19
- node/worker_threads.d.ts +38 -34
- node/zlib.d.ts +11 -11
node/timers/promises.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `timers/promises` API provides an alternative set of timer functions
|
|
3
|
-
* that return `Promise` objects. The API is accessible via`require('timers/promises')`.
|
|
3
|
+
* that return `Promise` objects. The API is accessible via`require('node:timers/promises')`.
|
|
4
4
|
*
|
|
5
5
|
* ```js
|
|
6
6
|
* import {
|
|
@@ -44,6 +44,8 @@ declare module 'timers/promises' {
|
|
|
44
44
|
function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
|
|
45
45
|
/**
|
|
46
46
|
* Returns an async iterator that generates values in an interval of `delay` ms.
|
|
47
|
+
* If `ref` is `true`, you need to call `next()` of async iterator explicitly
|
|
48
|
+
* or implicitly to keep the event loop alive.
|
|
47
49
|
*
|
|
48
50
|
* ```js
|
|
49
51
|
* import {
|
|
@@ -62,6 +64,29 @@ declare module 'timers/promises' {
|
|
|
62
64
|
* @since v15.9.0
|
|
63
65
|
*/
|
|
64
66
|
function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
|
|
67
|
+
interface Scheduler {
|
|
68
|
+
/**
|
|
69
|
+
* ```js
|
|
70
|
+
* import { scheduler } from 'node:timers/promises';
|
|
71
|
+
*
|
|
72
|
+
* await scheduler.wait(1000); // Wait one second before continuing
|
|
73
|
+
* ```
|
|
74
|
+
* An experimental API defined by the Scheduling APIs draft specification being developed as a standard Web Platform API.
|
|
75
|
+
* Calling timersPromises.scheduler.wait(delay, options) is roughly equivalent to calling timersPromises.setTimeout(delay, undefined, options) except that the ref option is not supported.
|
|
76
|
+
* @since v16.14.0
|
|
77
|
+
* @experimental
|
|
78
|
+
* @param [delay=1] The number of milliseconds to wait before fulfilling the promise.
|
|
79
|
+
*/
|
|
80
|
+
wait: (delay?: number, options?: TimerOptions) => Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* An experimental API defined by the Scheduling APIs draft specification being developed as a standard Web Platform API.
|
|
83
|
+
* Calling timersPromises.scheduler.yield() is equivalent to calling timersPromises.setImmediate() with no arguments.
|
|
84
|
+
* @since v16.14.0
|
|
85
|
+
* @experimental
|
|
86
|
+
*/
|
|
87
|
+
yield: () => Promise<void>;
|
|
88
|
+
}
|
|
89
|
+
const scheduler: Scheduler;
|
|
65
90
|
}
|
|
66
91
|
declare module 'node:timers/promises' {
|
|
67
92
|
export * from 'timers/promises';
|
node/timers.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `timer` module exposes a global API for scheduling functions to
|
|
3
3
|
* be called at some future period of time. Because the timer functions are
|
|
4
|
-
* globals, there is no need to call `require('timers')` to use the API.
|
|
4
|
+
* globals, there is no need to call `require('node:timers')` to use the API.
|
|
5
5
|
*
|
|
6
6
|
* The timer functions within Node.js implement a similar API as the timers API
|
|
7
7
|
* provided by Web Browsers but use a different internal implementation that is
|
|
8
8
|
* built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/timers.js)
|
|
10
10
|
*/
|
|
11
11
|
declare module 'timers' {
|
|
12
12
|
import { Abortable } from 'node:events';
|
|
@@ -33,7 +33,35 @@ declare module 'timers' {
|
|
|
33
33
|
refresh(): this;
|
|
34
34
|
[Symbol.toPrimitive](): number;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
* This object is created internally and is returned from `setImmediate()`. It
|
|
38
|
+
* can be passed to `clearImmediate()` in order to cancel the scheduled
|
|
39
|
+
* actions.
|
|
40
|
+
*
|
|
41
|
+
* By default, when an immediate is scheduled, the Node.js event loop will continue
|
|
42
|
+
* running as long as the immediate is active. The `Immediate` object returned by `setImmediate()` exports both `immediate.ref()` and `immediate.unref()`functions that can be used to
|
|
43
|
+
* control this default behavior.
|
|
44
|
+
*/
|
|
45
|
+
class Immediate implements RefCounted {
|
|
46
|
+
/**
|
|
47
|
+
* When called, requests that the Node.js event loop _not_ exit so long as the`Immediate` is active. Calling `immediate.ref()` multiple times will have no
|
|
48
|
+
* effect.
|
|
49
|
+
*
|
|
50
|
+
* By default, all `Immediate` objects are "ref'ed", making it normally unnecessary
|
|
51
|
+
* to call `immediate.ref()` unless `immediate.unref()` had been called previously.
|
|
52
|
+
* @since v9.7.0
|
|
53
|
+
* @return a reference to `immediate`
|
|
54
|
+
*/
|
|
55
|
+
ref(): this;
|
|
56
|
+
/**
|
|
57
|
+
* When called, the active `Immediate` object will not require the Node.js event
|
|
58
|
+
* loop to remain active. If there is no other activity keeping the event loop
|
|
59
|
+
* running, the process may exit before the `Immediate` object's callback is
|
|
60
|
+
* invoked. Calling `immediate.unref()` multiple times will have no effect.
|
|
61
|
+
* @since v9.7.0
|
|
62
|
+
* @return a reference to `immediate`
|
|
63
|
+
*/
|
|
64
|
+
unref(): this;
|
|
37
65
|
/**
|
|
38
66
|
* If true, the `Immediate` object will keep the Node.js event loop active.
|
|
39
67
|
* @since v11.0.0
|
|
@@ -41,7 +69,33 @@ declare module 'timers' {
|
|
|
41
69
|
hasRef(): boolean;
|
|
42
70
|
_onImmediate: Function; // to distinguish it from the Timeout class
|
|
43
71
|
}
|
|
44
|
-
|
|
72
|
+
/**
|
|
73
|
+
* This object is created internally and is returned from `setTimeout()` and `setInterval()`. It can be passed to either `clearTimeout()` or `clearInterval()` in order to cancel the
|
|
74
|
+
* scheduled actions.
|
|
75
|
+
*
|
|
76
|
+
* By default, when a timer is scheduled using either `setTimeout()` or `setInterval()`, the Node.js event loop will continue running as long as the
|
|
77
|
+
* timer is active. Each of the `Timeout` objects returned by these functions
|
|
78
|
+
* export both `timeout.ref()` and `timeout.unref()` functions that can be used to
|
|
79
|
+
* control this default behavior.
|
|
80
|
+
*/
|
|
81
|
+
class Timeout implements Timer {
|
|
82
|
+
/**
|
|
83
|
+
* When called, requests that the Node.js event loop _not_ exit so long as the`Timeout` is active. Calling `timeout.ref()` multiple times will have no effect.
|
|
84
|
+
*
|
|
85
|
+
* By default, all `Timeout` objects are "ref'ed", making it normally unnecessary
|
|
86
|
+
* to call `timeout.ref()` unless `timeout.unref()` had been called previously.
|
|
87
|
+
* @since v0.9.1
|
|
88
|
+
* @return a reference to `timeout`
|
|
89
|
+
*/
|
|
90
|
+
ref(): this;
|
|
91
|
+
/**
|
|
92
|
+
* When called, the active `Timeout` object will not require the Node.js event loop
|
|
93
|
+
* to remain active. If there is no other activity keeping the event loop running,
|
|
94
|
+
* the process may exit before the `Timeout` object's callback is invoked. Calling`timeout.unref()` multiple times will have no effect.
|
|
95
|
+
* @since v0.9.1
|
|
96
|
+
* @return a reference to `timeout`
|
|
97
|
+
*/
|
|
98
|
+
unref(): this;
|
|
45
99
|
/**
|
|
46
100
|
* If true, the `Timeout` object will keep the Node.js event loop active.
|
|
47
101
|
* @since v11.0.0
|
|
@@ -62,6 +116,25 @@ declare module 'timers' {
|
|
|
62
116
|
[Symbol.toPrimitive](): number;
|
|
63
117
|
}
|
|
64
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Schedules execution of a one-time `callback` after `delay` milliseconds.
|
|
121
|
+
*
|
|
122
|
+
* The `callback` will likely not be invoked in precisely `delay` milliseconds.
|
|
123
|
+
* Node.js makes no guarantees about the exact timing of when callbacks will fire,
|
|
124
|
+
* nor of their ordering. The callback will be called as close as possible to the
|
|
125
|
+
* time specified.
|
|
126
|
+
*
|
|
127
|
+
* When `delay` is larger than `2147483647` or less than `1`, the `delay`will be set to `1`. Non-integer delays are truncated to an integer.
|
|
128
|
+
*
|
|
129
|
+
* If `callback` is not a function, a `TypeError` will be thrown.
|
|
130
|
+
*
|
|
131
|
+
* This method has a custom variant for promises that is available using `timersPromises.setTimeout()`.
|
|
132
|
+
* @since v0.0.1
|
|
133
|
+
* @param callback The function to call when the timer elapses.
|
|
134
|
+
* @param [delay=1] The number of milliseconds to wait before calling the `callback`.
|
|
135
|
+
* @param args Optional arguments to pass when the `callback` is called.
|
|
136
|
+
* @return for use with {@link clearTimeout}
|
|
137
|
+
*/
|
|
65
138
|
function setTimeout<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
|
|
66
139
|
// util.promisify no rest args compability
|
|
67
140
|
// tslint:disable-next-line void-return
|
|
@@ -69,7 +142,27 @@ declare module 'timers' {
|
|
|
69
142
|
namespace setTimeout {
|
|
70
143
|
const __promisify__: typeof setTimeoutPromise;
|
|
71
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Cancels a `Timeout` object created by `setTimeout()`.
|
|
147
|
+
* @since v0.0.1
|
|
148
|
+
* @param timeout A `Timeout` object as returned by {@link setTimeout} or the `primitive` of the `Timeout` object as a string or a number.
|
|
149
|
+
*/
|
|
72
150
|
function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void;
|
|
151
|
+
/**
|
|
152
|
+
* Schedules repeated execution of `callback` every `delay` milliseconds.
|
|
153
|
+
*
|
|
154
|
+
* When `delay` is larger than `2147483647` or less than `1`, the `delay` will be
|
|
155
|
+
* set to `1`. Non-integer delays are truncated to an integer.
|
|
156
|
+
*
|
|
157
|
+
* If `callback` is not a function, a `TypeError` will be thrown.
|
|
158
|
+
*
|
|
159
|
+
* This method has a custom variant for promises that is available using `timersPromises.setInterval()`.
|
|
160
|
+
* @since v0.0.1
|
|
161
|
+
* @param callback The function to call when the timer elapses.
|
|
162
|
+
* @param [delay=1] The number of milliseconds to wait before calling the `callback`.
|
|
163
|
+
* @param args Optional arguments to pass when the `callback` is called.
|
|
164
|
+
* @return for use with {@link clearInterval}
|
|
165
|
+
*/
|
|
73
166
|
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
|
|
74
167
|
// util.promisify no rest args compability
|
|
75
168
|
// tslint:disable-next-line void-return
|
|
@@ -77,7 +170,30 @@ declare module 'timers' {
|
|
|
77
170
|
namespace setInterval {
|
|
78
171
|
const __promisify__: typeof setIntervalPromise;
|
|
79
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Cancels a `Timeout` object created by `setInterval()`.
|
|
175
|
+
* @since v0.0.1
|
|
176
|
+
* @param timeout A `Timeout` object as returned by {@link setInterval} or the `primitive` of the `Timeout` object as a string or a number.
|
|
177
|
+
*/
|
|
80
178
|
function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void;
|
|
179
|
+
/**
|
|
180
|
+
* Schedules the "immediate" execution of the `callback` after I/O events'
|
|
181
|
+
* callbacks.
|
|
182
|
+
*
|
|
183
|
+
* When multiple calls to `setImmediate()` are made, the `callback` functions are
|
|
184
|
+
* queued for execution in the order in which they are created. The entire callback
|
|
185
|
+
* queue is processed every event loop iteration. If an immediate timer is queued
|
|
186
|
+
* from inside an executing callback, that timer will not be triggered until the
|
|
187
|
+
* next event loop iteration.
|
|
188
|
+
*
|
|
189
|
+
* If `callback` is not a function, a `TypeError` will be thrown.
|
|
190
|
+
*
|
|
191
|
+
* This method has a custom variant for promises that is available using `timersPromises.setImmediate()`.
|
|
192
|
+
* @since v0.9.1
|
|
193
|
+
* @param callback The function to call at the end of this turn of the Node.js `Event Loop`
|
|
194
|
+
* @param args Optional arguments to pass when the `callback` is called.
|
|
195
|
+
* @return for use with {@link clearImmediate}
|
|
196
|
+
*/
|
|
81
197
|
function setImmediate<TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate;
|
|
82
198
|
// util.promisify no rest args compability
|
|
83
199
|
// tslint:disable-next-line void-return
|
|
@@ -85,6 +201,11 @@ declare module 'timers' {
|
|
|
85
201
|
namespace setImmediate {
|
|
86
202
|
const __promisify__: typeof setImmediatePromise;
|
|
87
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Cancels an `Immediate` object created by `setImmediate()`.
|
|
206
|
+
* @since v0.9.1
|
|
207
|
+
* @param immediate An `Immediate` object as returned by {@link setImmediate}.
|
|
208
|
+
*/
|
|
88
209
|
function clearImmediate(immediateId: NodeJS.Immediate | undefined): void;
|
|
89
210
|
function queueMicrotask(callback: () => void): void;
|
|
90
211
|
}
|
node/tls.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `tls` module provides an implementation of the Transport Layer Security
|
|
2
|
+
* The `node:tls` module provides an implementation of the Transport Layer Security
|
|
3
3
|
* (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL.
|
|
4
4
|
* The module can be accessed using:
|
|
5
5
|
*
|
|
6
6
|
* ```js
|
|
7
|
-
* const tls = require('tls');
|
|
7
|
+
* const tls = require('node:tls');
|
|
8
8
|
* ```
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/tls.js)
|
|
10
10
|
*/
|
|
11
11
|
declare module 'tls' {
|
|
12
12
|
import { X509Certificate } from 'node:crypto';
|
|
@@ -41,21 +41,100 @@ declare module 'tls' {
|
|
|
41
41
|
CN: string;
|
|
42
42
|
}
|
|
43
43
|
interface PeerCertificate {
|
|
44
|
+
/**
|
|
45
|
+
* `true` if a Certificate Authority (CA), `false` otherwise.
|
|
46
|
+
* @since v18.13.0
|
|
47
|
+
*/
|
|
48
|
+
ca: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* The DER encoded X.509 certificate data.
|
|
51
|
+
*/
|
|
52
|
+
raw: Buffer;
|
|
53
|
+
/**
|
|
54
|
+
* The certificate subject.
|
|
55
|
+
*/
|
|
44
56
|
subject: Certificate;
|
|
57
|
+
/**
|
|
58
|
+
* The certificate issuer, described in the same terms as the `subject`.
|
|
59
|
+
*/
|
|
45
60
|
issuer: Certificate;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
exponent: string;
|
|
61
|
+
/**
|
|
62
|
+
* The date-time the certificate is valid from.
|
|
63
|
+
*/
|
|
50
64
|
valid_from: string;
|
|
65
|
+
/**
|
|
66
|
+
* The date-time the certificate is valid to.
|
|
67
|
+
*/
|
|
51
68
|
valid_to: string;
|
|
69
|
+
/**
|
|
70
|
+
* The certificate serial number, as a hex string.
|
|
71
|
+
*/
|
|
72
|
+
serialNumber: string;
|
|
73
|
+
/**
|
|
74
|
+
* The SHA-1 digest of the DER encoded certificate.
|
|
75
|
+
* It is returned as a `:` separated hexadecimal string.
|
|
76
|
+
*/
|
|
52
77
|
fingerprint: string;
|
|
78
|
+
/**
|
|
79
|
+
* The SHA-256 digest of the DER encoded certificate.
|
|
80
|
+
* It is returned as a `:` separated hexadecimal string.
|
|
81
|
+
*/
|
|
53
82
|
fingerprint256: string;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
83
|
+
/**
|
|
84
|
+
* The SHA-512 digest of the DER encoded certificate.
|
|
85
|
+
* It is returned as a `:` separated hexadecimal string.
|
|
86
|
+
*/
|
|
87
|
+
fingerprint512: string;
|
|
88
|
+
/**
|
|
89
|
+
* The extended key usage, a set of OIDs.
|
|
90
|
+
*/
|
|
91
|
+
ext_key_usage?: string[];
|
|
92
|
+
/**
|
|
93
|
+
* A string containing concatenated names for the subject,
|
|
94
|
+
* an alternative to the `subject` names.
|
|
95
|
+
*/
|
|
96
|
+
subjectaltname?: string;
|
|
97
|
+
/**
|
|
98
|
+
* An array describing the AuthorityInfoAccess, used with OCSP.
|
|
99
|
+
*/
|
|
100
|
+
infoAccess?: NodeJS.Dict<string[]>;
|
|
101
|
+
/**
|
|
102
|
+
* For RSA keys: The RSA bit size.
|
|
103
|
+
*
|
|
104
|
+
* For EC keys: The key size in bits.
|
|
105
|
+
*/
|
|
106
|
+
bits?: number;
|
|
107
|
+
/**
|
|
108
|
+
* The RSA exponent, as a string in hexadecimal number notation.
|
|
109
|
+
*/
|
|
110
|
+
exponent?: string;
|
|
111
|
+
/**
|
|
112
|
+
* The RSA modulus, as a hexadecimal string.
|
|
113
|
+
*/
|
|
114
|
+
modulus?: string;
|
|
115
|
+
/**
|
|
116
|
+
* The public key.
|
|
117
|
+
*/
|
|
118
|
+
pubkey?: Buffer;
|
|
119
|
+
/**
|
|
120
|
+
* The ASN.1 name of the OID of the elliptic curve.
|
|
121
|
+
* Well-known curves are identified by an OID.
|
|
122
|
+
* While it is unusual, it is possible that the curve
|
|
123
|
+
* is identified by its mathematical properties,
|
|
124
|
+
* in which case it will not have an OID.
|
|
125
|
+
*/
|
|
126
|
+
asn1Curve?: string;
|
|
127
|
+
/**
|
|
128
|
+
* The NIST name for the elliptic curve,if it has one
|
|
129
|
+
* (not all well-known curves have been assigned names by NIST).
|
|
130
|
+
*/
|
|
131
|
+
nistCurve?: string;
|
|
57
132
|
}
|
|
58
133
|
interface DetailedPeerCertificate extends PeerCertificate {
|
|
134
|
+
/**
|
|
135
|
+
* The issuer certificate object.
|
|
136
|
+
* For self-signed certificates, this may be a circular reference.
|
|
137
|
+
*/
|
|
59
138
|
issuerCertificate: DetailedPeerCertificate;
|
|
60
139
|
}
|
|
61
140
|
interface CipherNameAndProtocol {
|
|
@@ -133,7 +212,7 @@ declare module 'tls' {
|
|
|
133
212
|
*
|
|
134
213
|
* Instances of `tls.TLSSocket` implement the duplex `Stream` interface.
|
|
135
214
|
*
|
|
136
|
-
* Methods that return TLS connection metadata (e.g.{@link TLSSocket.getPeerCertificate} will only return data while the
|
|
215
|
+
* Methods that return TLS connection metadata (e.g.{@link TLSSocket.getPeerCertificate}) will only return data while the
|
|
137
216
|
* connection is open.
|
|
138
217
|
* @since v0.11.4
|
|
139
218
|
*/
|
|
@@ -180,13 +259,13 @@ declare module 'tls' {
|
|
|
180
259
|
/**
|
|
181
260
|
* Returns an object containing information on the negotiated cipher suite.
|
|
182
261
|
*
|
|
183
|
-
* For example:
|
|
262
|
+
* For example, a TLSv1.2 protocol with AES256-SHA cipher:
|
|
184
263
|
*
|
|
185
264
|
* ```json
|
|
186
265
|
* {
|
|
187
|
-
* "name": "
|
|
188
|
-
* "standardName": "
|
|
189
|
-
* "version": "
|
|
266
|
+
* "name": "AES256-SHA",
|
|
267
|
+
* "standardName": "TLS_RSA_WITH_AES_256_CBC_SHA",
|
|
268
|
+
* "version": "SSLv3"
|
|
190
269
|
* }
|
|
191
270
|
* ```
|
|
192
271
|
*
|
|
@@ -558,7 +637,8 @@ declare module 'tls' {
|
|
|
558
637
|
* used.
|
|
559
638
|
* @since v0.5.3
|
|
560
639
|
* @param hostname A SNI host name or wildcard (e.g. `'*'`)
|
|
561
|
-
* @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc)
|
|
640
|
+
* @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc), or a TLS context object created
|
|
641
|
+
* with {@link createSecureContext} itself.
|
|
562
642
|
*/
|
|
563
643
|
addContext(hostname: string, context: SecureContextOptions): void;
|
|
564
644
|
/**
|
|
@@ -689,12 +769,9 @@ declare module 'tls' {
|
|
|
689
769
|
*/
|
|
690
770
|
crl?: string | Buffer | Array<string | Buffer> | undefined;
|
|
691
771
|
/**
|
|
692
|
-
* Diffie
|
|
693
|
-
*
|
|
694
|
-
*
|
|
695
|
-
* Although 1024 bits is permissible, use 2048 bits or larger for
|
|
696
|
-
* stronger security. If omitted or invalid, the parameters are
|
|
697
|
-
* silently discarded and DHE ciphers will not be available.
|
|
772
|
+
* `'auto'` or custom Diffie-Hellman parameters, required for non-ECDHE perfect forward secrecy.
|
|
773
|
+
* If omitted or invalid, the parameters are silently discarded and DHE ciphers will not be available.
|
|
774
|
+
* ECDHE-based perfect forward secrecy will still be available.
|
|
698
775
|
*/
|
|
699
776
|
dhparam?: string | Buffer | undefined;
|
|
700
777
|
/**
|
|
@@ -836,14 +913,14 @@ declare module 'tls' {
|
|
|
836
913
|
* Creates a new {@link Server}. The `secureConnectionListener`, if provided, is
|
|
837
914
|
* automatically set as a listener for the `'secureConnection'` event.
|
|
838
915
|
*
|
|
839
|
-
* The `ticketKeys` options is automatically shared between `cluster` module
|
|
916
|
+
* The `ticketKeys` options is automatically shared between `node:cluster` module
|
|
840
917
|
* workers.
|
|
841
918
|
*
|
|
842
919
|
* The following illustrates a simple echo server:
|
|
843
920
|
*
|
|
844
921
|
* ```js
|
|
845
|
-
* const tls = require('tls');
|
|
846
|
-
* const fs = require('fs');
|
|
922
|
+
* const tls = require('node:tls');
|
|
923
|
+
* const fs = require('node:fs');
|
|
847
924
|
*
|
|
848
925
|
* const options = {
|
|
849
926
|
* key: fs.readFileSync('server-key.pem'),
|
|
@@ -853,7 +930,7 @@ declare module 'tls' {
|
|
|
853
930
|
* requestCert: true,
|
|
854
931
|
*
|
|
855
932
|
* // This is necessary only if the client uses a self-signed certificate.
|
|
856
|
-
* ca: [ fs.readFileSync('client-cert.pem') ]
|
|
933
|
+
* ca: [ fs.readFileSync('client-cert.pem') ],
|
|
857
934
|
* };
|
|
858
935
|
*
|
|
859
936
|
* const server = tls.createServer(options, (socket) => {
|
|
@@ -888,8 +965,8 @@ declare module 'tls' {
|
|
|
888
965
|
*
|
|
889
966
|
* ```js
|
|
890
967
|
* // Assumes an echo server that is listening on port 8000.
|
|
891
|
-
* const tls = require('tls');
|
|
892
|
-
* const fs = require('fs');
|
|
968
|
+
* const tls = require('node:tls');
|
|
969
|
+
* const fs = require('node:fs');
|
|
893
970
|
*
|
|
894
971
|
* const options = {
|
|
895
972
|
* // Necessary only if the server requires client certificate authentication.
|
|
@@ -965,12 +1042,19 @@ declare module 'tls' {
|
|
|
965
1042
|
* APIs that create secure contexts have no default value.
|
|
966
1043
|
*
|
|
967
1044
|
* The `tls.createSecureContext()` method creates a `SecureContext` object. It is
|
|
968
|
-
* usable as an argument to several `tls` APIs, such as
|
|
1045
|
+
* usable as an argument to several `tls` APIs, such as `server.addContext()`,
|
|
1046
|
+
* but has no public methods. The {@link Server} constructor and the {@link createServer} method do not support the `secureContext` option.
|
|
969
1047
|
*
|
|
970
1048
|
* A key is _required_ for ciphers that use certificates. Either `key` or`pfx` can be used to provide it.
|
|
971
1049
|
*
|
|
972
1050
|
* If the `ca` option is not given, then Node.js will default to using [Mozilla's publicly trusted list of
|
|
973
1051
|
* CAs](https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt).
|
|
1052
|
+
*
|
|
1053
|
+
* Custom DHE parameters are discouraged in favor of the new `dhparam: 'auto'`option. When set to `'auto'`, well-known DHE parameters of sufficient strength
|
|
1054
|
+
* will be selected automatically. Otherwise, if necessary, `openssl dhparam` can
|
|
1055
|
+
* be used to create custom parameters. The key length must be greater than or
|
|
1056
|
+
* equal to 1024 bits or else an error will be thrown. Although 1024 bits is
|
|
1057
|
+
* permissible, use 2048 bits or larger for stronger security.
|
|
974
1058
|
* @since v0.11.13
|
|
975
1059
|
*/
|
|
976
1060
|
function createSecureContext(options?: SecureContextOptions): SecureContext;
|
|
@@ -1016,6 +1100,13 @@ declare module 'tls' {
|
|
|
1016
1100
|
* are provided, the lowest minimum is used.
|
|
1017
1101
|
*/
|
|
1018
1102
|
let DEFAULT_MIN_VERSION: SecureVersion;
|
|
1103
|
+
/**
|
|
1104
|
+
* The default value of the ciphers option of tls.createSecureContext().
|
|
1105
|
+
* It can be assigned any of the supported OpenSSL ciphers.
|
|
1106
|
+
* Defaults to the content of crypto.constants.defaultCoreCipherList, unless
|
|
1107
|
+
* changed using CLI options using --tls-default-ciphers.
|
|
1108
|
+
*/
|
|
1109
|
+
let DEFAULT_CIPHERS: string;
|
|
1019
1110
|
/**
|
|
1020
1111
|
* An immutable array of strings representing the root certificates (in PEM
|
|
1021
1112
|
* format) used for verifying peer certificates. This is the default value
|
node/trace_events.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `trace_events` module provides a mechanism to centralize tracing
|
|
3
|
-
* generated by V8, Node.js core, and userspace code.
|
|
2
|
+
* The `node:trace_events` module provides a mechanism to centralize tracing
|
|
3
|
+
* information generated by V8, Node.js core, and userspace code.
|
|
4
4
|
*
|
|
5
5
|
* Tracing can be enabled with the `--trace-event-categories` command-line flag
|
|
6
|
-
* or by using the `trace_events` module. The `--trace-event-categories` flag
|
|
6
|
+
* or by using the `node:trace_events` module. The `--trace-event-categories` flag
|
|
7
7
|
* accepts a list of comma-separated category names.
|
|
8
8
|
*
|
|
9
9
|
* The available categories are:
|
|
@@ -13,9 +13,19 @@
|
|
|
13
13
|
* The `async_hooks` events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property.
|
|
14
14
|
* * `node.bootstrap`: Enables capture of Node.js bootstrap milestones.
|
|
15
15
|
* * `node.console`: Enables capture of `console.time()` and `console.count()`output.
|
|
16
|
+
* * `node.threadpoolwork.sync`: Enables capture of trace data for threadpool
|
|
17
|
+
* synchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`.
|
|
18
|
+
* * `node.threadpoolwork.async`: Enables capture of trace data for threadpool
|
|
19
|
+
* asynchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`.
|
|
16
20
|
* * `node.dns.native`: Enables capture of trace data for DNS queries.
|
|
21
|
+
* * `node.net.native`: Enables capture of trace data for network.
|
|
17
22
|
* * `node.environment`: Enables capture of Node.js Environment milestones.
|
|
18
23
|
* * `node.fs.sync`: Enables capture of trace data for file system sync methods.
|
|
24
|
+
* * `node.fs_dir.sync`: Enables capture of trace data for file system sync
|
|
25
|
+
* directory methods.
|
|
26
|
+
* * `node.fs.async`: Enables capture of trace data for file system async methods.
|
|
27
|
+
* * `node.fs_dir.async`: Enables capture of trace data for file system async
|
|
28
|
+
* directory methods.
|
|
19
29
|
* * `node.perf`: Enables capture of `Performance API` measurements.
|
|
20
30
|
* * `node.perf.usertiming`: Enables capture of only Performance API User Timing
|
|
21
31
|
* measures and marks.
|
|
@@ -23,8 +33,9 @@
|
|
|
23
33
|
* measurements.
|
|
24
34
|
* * `node.promises.rejections`: Enables capture of trace data tracking the number
|
|
25
35
|
* of unhandled Promise rejections and handled-after-rejections.
|
|
26
|
-
* * `node.vm.script`: Enables capture of trace data for the `vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
|
|
36
|
+
* * `node.vm.script`: Enables capture of trace data for the `node:vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
|
|
27
37
|
* * `v8`: The `V8` events are GC, compiling, and execution related.
|
|
38
|
+
* * `node.http`: Enables capture of trace data for http request / response.
|
|
28
39
|
*
|
|
29
40
|
* By default the `node`, `node.async_hooks`, and `v8` categories are enabled.
|
|
30
41
|
*
|
|
@@ -43,10 +54,10 @@
|
|
|
43
54
|
* node --trace-event-categories v8,node,node.async_hooks
|
|
44
55
|
* ```
|
|
45
56
|
*
|
|
46
|
-
* Alternatively, trace events may be enabled using the `trace_events` module:
|
|
57
|
+
* Alternatively, trace events may be enabled using the `node:trace_events` module:
|
|
47
58
|
*
|
|
48
59
|
* ```js
|
|
49
|
-
* const trace_events = require('trace_events');
|
|
60
|
+
* const trace_events = require('node:trace_events');
|
|
50
61
|
* const tracing = trace_events.createTracing({ categories: ['node.perf'] });
|
|
51
62
|
* tracing.enable(); // Enable trace event capture for the 'node.perf' category
|
|
52
63
|
*
|
|
@@ -83,7 +94,7 @@
|
|
|
83
94
|
*
|
|
84
95
|
* The features from this module are not available in `Worker` threads.
|
|
85
96
|
* @experimental
|
|
86
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
97
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/trace_events.js)
|
|
87
98
|
*/
|
|
88
99
|
declare module 'trace_events' {
|
|
89
100
|
/**
|
|
@@ -132,7 +143,7 @@ declare module 'trace_events' {
|
|
|
132
143
|
* Creates and returns a `Tracing` object for the given set of `categories`.
|
|
133
144
|
*
|
|
134
145
|
* ```js
|
|
135
|
-
* const trace_events = require('trace_events');
|
|
146
|
+
* const trace_events = require('node:trace_events');
|
|
136
147
|
* const categories = ['node.perf', 'node.async_hooks'];
|
|
137
148
|
* const tracing = trace_events.createTracing({ categories });
|
|
138
149
|
* tracing.enable();
|
|
@@ -152,7 +163,7 @@ declare module 'trace_events' {
|
|
|
152
163
|
* Given the file `test.js` below, the command`node --trace-event-categories node.perf test.js` will print`'node.async_hooks,node.perf'` to the console.
|
|
153
164
|
*
|
|
154
165
|
* ```js
|
|
155
|
-
* const trace_events = require('trace_events');
|
|
166
|
+
* const trace_events = require('node:trace_events');
|
|
156
167
|
* const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] });
|
|
157
168
|
* const t2 = trace_events.createTracing({ categories: ['node.perf'] });
|
|
158
169
|
* const t3 = trace_events.createTracing({ categories: ['v8'] });
|