@types/node 26.2.0 → 26.4.0
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/buffer.buffer.d.ts +10 -5
- node/crypto.d.ts +2 -4
- node/dgram.d.ts +119 -4
- node/fs/promises.d.ts +61 -65
- node/fs.d.ts +86 -76
- node/http.d.ts +17 -1
- node/http2.d.ts +12 -4
- node/index.d.ts +1 -0
- node/inspector.d.ts +2 -1
- node/net.d.ts +108 -16
- node/package.json +2 -2
- node/process.d.ts +52 -0
- node/quic.d.ts +246 -38
- node/sqlite.d.ts +6 -2
- node/stream/iter.d.ts +4 -4
- node/test.d.ts +36 -0
- node/tls.d.ts +24 -0
- node/ts5.6/buffer.buffer.d.ts +5 -0
- node/ts5.6/index.d.ts +1 -0
- node/ts5.7/index.d.ts +1 -0
- node/tty.d.ts +4 -3
- node/vfs.d.ts +210 -0
- node/vm.d.ts +1 -1
node/http2.d.ts
CHANGED
|
@@ -433,7 +433,7 @@ declare module "node:http2" {
|
|
|
433
433
|
*
|
|
434
434
|
* When the `options.waitForTrailers` option is set, the `'wantTrailers'` event
|
|
435
435
|
* will be emitted immediately after queuing the last chunk of payload data to be
|
|
436
|
-
* sent. The `http2stream.sendTrailers()` method can then be used to
|
|
436
|
+
* sent. The `http2stream.sendTrailers()` method can then be used to send trailing
|
|
437
437
|
* header fields to the peer.
|
|
438
438
|
*
|
|
439
439
|
* When `options.waitForTrailers` is set, the `Http2Stream` will not automatically
|
|
@@ -548,7 +548,7 @@ declare module "node:http2" {
|
|
|
548
548
|
*
|
|
549
549
|
* When the `options.waitForTrailers` option is set, the `'wantTrailers'` event
|
|
550
550
|
* will be emitted immediately after queuing the last chunk of payload data to be
|
|
551
|
-
* sent. The `http2stream.sendTrailers()` method can then be used to
|
|
551
|
+
* sent. The `http2stream.sendTrailers()` method can then be used to send trailing
|
|
552
552
|
* header fields to the peer.
|
|
553
553
|
*
|
|
554
554
|
* When `options.waitForTrailers` is set, the `Http2Stream` will not automatically
|
|
@@ -840,9 +840,12 @@ declare module "node:http2" {
|
|
|
840
840
|
* HTTP/2 request to the connected server.
|
|
841
841
|
*
|
|
842
842
|
* When a `ClientHttp2Session` is first created, the socket may not yet be
|
|
843
|
-
* connected.
|
|
843
|
+
* connected. If `clienthttp2session.request()` is called during this time, the
|
|
844
844
|
* actual request will be deferred until the socket is ready to go.
|
|
845
|
-
*
|
|
845
|
+
*
|
|
846
|
+
* If the session becomes unavailable before the request can be created, the
|
|
847
|
+
* returned stream will emit `ERR_HTTP2_GOAWAY_SESSION` or
|
|
848
|
+
* `ERR_HTTP2_INVALID_SESSION` asynchronously.
|
|
846
849
|
*
|
|
847
850
|
* This method is only available if `http2session.type` is equal to `http2.constants.NGHTTP2_SESSION_CLIENT`.
|
|
848
851
|
*
|
|
@@ -1166,6 +1169,11 @@ declare module "node:http2" {
|
|
|
1166
1169
|
* @default 128
|
|
1167
1170
|
*/
|
|
1168
1171
|
maxHeaderListPairs?: number | undefined;
|
|
1172
|
+
/**
|
|
1173
|
+
* Sets the maximum number of uniq origin the sever
|
|
1174
|
+
* can send via ORIGIN frames. **Default:** `128`.
|
|
1175
|
+
*/
|
|
1176
|
+
maxOriginSetSize?: number | undefined;
|
|
1169
1177
|
/**
|
|
1170
1178
|
* Sets the maximum number of outstanding, unacknowledged pings.
|
|
1171
1179
|
* @default 10
|
node/index.d.ts
CHANGED
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
/// <reference path="util.d.ts" />
|
|
109
109
|
/// <reference path="util/types.d.ts" />
|
|
110
110
|
/// <reference path="v8.d.ts" />
|
|
111
|
+
/// <reference path="vfs.d.ts" />
|
|
111
112
|
/// <reference path="vm.d.ts" />
|
|
112
113
|
/// <reference path="wasi.d.ts" />
|
|
113
114
|
/// <reference path="worker_threads.d.ts" />
|
node/inspector.d.ts
CHANGED
|
@@ -43,7 +43,8 @@ declare module "node:inspector" {
|
|
|
43
43
|
*/
|
|
44
44
|
function open(port?: number, host?: string, wait?: boolean): Disposable;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* Deactivates the inspector. If there are active connections, they are forcibly
|
|
47
|
+
* terminated. Blocks until the inspector server has fully stopped.
|
|
47
48
|
*/
|
|
48
49
|
function close(): void;
|
|
49
50
|
/**
|
node/net.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ declare module "node:net" {
|
|
|
25
25
|
keepAliveInitialDelay?: number | undefined;
|
|
26
26
|
blockList?: BlockList | undefined;
|
|
27
27
|
typeOfService?: number | undefined;
|
|
28
|
+
handle?: BoundSocket | undefined;
|
|
28
29
|
}
|
|
29
30
|
interface OnReadOpts {
|
|
30
31
|
buffer: Uint8Array | (() => Uint8Array);
|
|
@@ -57,6 +58,12 @@ declare module "node:net" {
|
|
|
57
58
|
}
|
|
58
59
|
type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts;
|
|
59
60
|
type SocketReadyState = "opening" | "open" | "readOnly" | "writeOnly" | "closed";
|
|
61
|
+
interface SetKeepAliveOptions {
|
|
62
|
+
enable?: boolean | undefined;
|
|
63
|
+
initialDelay?: number | undefined;
|
|
64
|
+
interval?: number | undefined;
|
|
65
|
+
count?: number | undefined;
|
|
66
|
+
}
|
|
60
67
|
interface SocketEventMap extends Omit<stream.DuplexEventMap, "close"> {
|
|
61
68
|
"close": [hadError: boolean];
|
|
62
69
|
"connect": [];
|
|
@@ -199,25 +206,27 @@ declare module "node:net" {
|
|
|
199
206
|
*/
|
|
200
207
|
setNoDelay(noDelay?: boolean): this;
|
|
201
208
|
/**
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* Set `initialDelay` (in milliseconds) to set the delay between the last
|
|
206
|
-
* data packet received and the first keepalive probe. Setting `0` for`initialDelay` will leave the value unchanged from the default
|
|
207
|
-
* (or previous) setting.
|
|
208
|
-
*
|
|
209
|
-
* Enabling the keep-alive functionality will set the following socket options:
|
|
209
|
+
* Configure keep-alive using an options object. See `socket.setKeepAlive()`
|
|
210
|
+
* for a description of each property.
|
|
210
211
|
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
212
|
+
* ```js
|
|
213
|
+
* socket.setKeepAlive({ enable: true, initialDelay: 1000, interval: 1000, count: 10 });
|
|
214
|
+
* ```
|
|
215
|
+
* @since v26.4.0
|
|
216
|
+
* @returns The socket itself.
|
|
217
|
+
*/
|
|
218
|
+
setKeepAlive(options: SetKeepAliveOptions): this;
|
|
219
|
+
/**
|
|
220
|
+
* Configure keep-alive using positional arguments. See
|
|
221
|
+
* `socket.setKeepAlive()` for a description of each argument.
|
|
215
222
|
* @since v0.1.92
|
|
216
|
-
* @param
|
|
217
|
-
* @param
|
|
218
|
-
* @
|
|
223
|
+
* @param enable **Default:** `false`
|
|
224
|
+
* @param initialDelay **Default:** `0`
|
|
225
|
+
* @param interval **Default:** `1000`
|
|
226
|
+
* @param count **Default:** `10`
|
|
227
|
+
* @returns The socket itself.
|
|
219
228
|
*/
|
|
220
|
-
setKeepAlive(enable?: boolean, initialDelay?: number): this;
|
|
229
|
+
setKeepAlive(enable?: boolean, initialDelay?: number, interval?: number, count?: number): this;
|
|
221
230
|
/**
|
|
222
231
|
* Returns the current Type of Service (TOS) field for IPv4 packets or Traffic
|
|
223
232
|
* Class for IPv6 packets for this socket.
|
|
@@ -442,9 +451,92 @@ declare module "node:net" {
|
|
|
442
451
|
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
443
452
|
// #endregion
|
|
444
453
|
}
|
|
454
|
+
interface BoundSocketOptions {
|
|
455
|
+
/**
|
|
456
|
+
* Local address to bind. Must be a numeric IP literal; no DNS
|
|
457
|
+
* resolution is performed. **Default:** `'0.0.0.0'`, or `'::'` when
|
|
458
|
+
* `ipv6Only` is `true`.
|
|
459
|
+
*/
|
|
460
|
+
host?: string | undefined;
|
|
461
|
+
/**
|
|
462
|
+
* Local port. `0` requests an OS-assigned ephemeral port.
|
|
463
|
+
* **Default:** `0`.
|
|
464
|
+
*/
|
|
465
|
+
port?: number | undefined;
|
|
466
|
+
/**
|
|
467
|
+
* Sets `IPV6_V6ONLY`, disabling dual-stack support so the
|
|
468
|
+
* socket binds IPv6 only. Only meaningful for IPv6 binds. **Default:**
|
|
469
|
+
* `false`.
|
|
470
|
+
*/
|
|
471
|
+
ipv6Only?: boolean | undefined;
|
|
472
|
+
/**
|
|
473
|
+
* Sets `SO_REUSEPORT`, allowing multiple sockets to bind
|
|
474
|
+
* the same address and port for kernel-level load balancing. Support is
|
|
475
|
+
* platform-dependent. **Default:** `false`.
|
|
476
|
+
*/
|
|
477
|
+
reusePort?: boolean | undefined;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Allows for the synchronous creation of a pre-bound socket, that can be passed
|
|
481
|
+
* to `listen()` or `new net.Socket()` later on. For `listen()` this enables
|
|
482
|
+
* synchronous port reservation, while for `new net.Socket()`, it allows control
|
|
483
|
+
* over the local egress port/IP, via `bind(2)` semantics.
|
|
484
|
+
*
|
|
485
|
+
* Adoption transfers ownership of the socket; afterwards `address()` and `close()`
|
|
486
|
+
* throw `ERR_SOCKET_HANDLE_ADOPTED`. A handle that is never adopted must be
|
|
487
|
+
* closed to avoid leaking the socket.
|
|
488
|
+
*
|
|
489
|
+
* ```js
|
|
490
|
+
* import net from 'node:net';
|
|
491
|
+
*
|
|
492
|
+
* const bound = new net.BoundSocket();
|
|
493
|
+
* const { port } = bound.address();
|
|
494
|
+
* console.log(`Reserved port ${port} for server`);
|
|
495
|
+
*
|
|
496
|
+
* const server = net.createServer();
|
|
497
|
+
* server.listen(bound); // Adopt as a server, or pass to new net.Socket() instead.
|
|
498
|
+
* ```
|
|
499
|
+
* @since v26.4.0
|
|
500
|
+
*/
|
|
501
|
+
class BoundSocket {
|
|
502
|
+
/**
|
|
503
|
+
* @since v26.4.0
|
|
504
|
+
*/
|
|
505
|
+
constructor(options?: BoundSocketOptions);
|
|
506
|
+
/**
|
|
507
|
+
* Returns the bound local address. When bound with `port: 0`, `port` is the
|
|
508
|
+
* OS-assigned ephemeral port.
|
|
509
|
+
* @since v26.4.0
|
|
510
|
+
* @returns An object with `address`, `family`, and `port` properties,
|
|
511
|
+
* as `server.address()` returns.
|
|
512
|
+
*/
|
|
513
|
+
address(): AddressInfo;
|
|
514
|
+
/**
|
|
515
|
+
* Returns the file descriptor of the bound socket. Ownership remains with the
|
|
516
|
+
* `BoundSocket`, so the descriptor must not be closed by the caller. The
|
|
517
|
+
* descriptor is only available before the handle is adopted; afterwards it belongs
|
|
518
|
+
* to the adopting `net.Server` or `net.Socket` and `fd()` throws
|
|
519
|
+
* `ERR_SOCKET_HANDLE_ADOPTED`.
|
|
520
|
+
* @since v26.4.0
|
|
521
|
+
* @returns The underlying OS file descriptor, or `-1` on platforms
|
|
522
|
+
* that do not expose one for sockets (such as Windows).
|
|
523
|
+
*/
|
|
524
|
+
fd(): number;
|
|
525
|
+
/**
|
|
526
|
+
* Releases the bound socket. Only needed when the handle is never adopted.
|
|
527
|
+
* @since v26.4.0
|
|
528
|
+
*/
|
|
529
|
+
close(): void;
|
|
530
|
+
/**
|
|
531
|
+
* Closes the handle if it has not been adopted or closed; otherwise a no-op.
|
|
532
|
+
* @since v26.4.0
|
|
533
|
+
*/
|
|
534
|
+
[Symbol.dispose](): void;
|
|
535
|
+
}
|
|
445
536
|
interface ListenOptions extends Abortable {
|
|
446
537
|
backlog?: number | undefined;
|
|
447
538
|
exclusive?: boolean | undefined;
|
|
539
|
+
handle?: BoundSocket | undefined;
|
|
448
540
|
host?: string | undefined;
|
|
449
541
|
/**
|
|
450
542
|
* @default false
|
node/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.4.0",
|
|
4
4
|
"description": "TypeScript definitions for node",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -150,6 +150,6 @@
|
|
|
150
150
|
"undici-types": "~8.3.0"
|
|
151
151
|
},
|
|
152
152
|
"peerDependencies": {},
|
|
153
|
-
"typesPublisherContentHash": "
|
|
153
|
+
"typesPublisherContentHash": "0793b8d36264e159c56982e4bc1d7024a8a703b13431ee414c7feacfe570e674",
|
|
154
154
|
"typeScriptVersion": "5.6"
|
|
155
155
|
}
|
node/process.d.ts
CHANGED
|
@@ -549,6 +549,58 @@ declare module "node:process" {
|
|
|
549
549
|
* @since v20.0.0
|
|
550
550
|
*/
|
|
551
551
|
has(scope: string, reference?: string): boolean;
|
|
552
|
+
/**
|
|
553
|
+
* Drops the specified permission from the current process. This operation is
|
|
554
|
+
* **irreversible** — once a permission is dropped, it cannot be restored through
|
|
555
|
+
* any Node.js API.
|
|
556
|
+
*
|
|
557
|
+
* If no reference is provided, the entire scope is dropped. For example,
|
|
558
|
+
* `process.permission.drop('fs.read')` will revoke ALL file system read
|
|
559
|
+
* permissions.
|
|
560
|
+
*
|
|
561
|
+
* When a reference is provided, only the permission for that specific resource
|
|
562
|
+
* is dropped. For example, `process.permission.drop('fs.read', '/etc/myapp')`
|
|
563
|
+
* will revoke read access to that directory while keeping other read
|
|
564
|
+
* permissions intact.
|
|
565
|
+
*
|
|
566
|
+
* **Important:** You can only drop the exact resource that was explicitly
|
|
567
|
+
* granted. The reference passed to `drop()` must match the original grant:
|
|
568
|
+
*
|
|
569
|
+
* * If a permission was granted using a wildcard (`*`), such as
|
|
570
|
+
* `--allow-fs-read=*`, individual paths cannot be dropped - only the entire
|
|
571
|
+
* scope can be dropped (by calling `drop()` without a reference).
|
|
572
|
+
* * If a directory was granted (e.g. `--allow-fs-read=/my/folder`), you cannot
|
|
573
|
+
* drop access to individual files inside it. You must drop the same directory
|
|
574
|
+
* that was granted. Any remaining grants continue to apply.
|
|
575
|
+
*
|
|
576
|
+
* The available scopes are the same as [`process.permission.has()`][]:
|
|
577
|
+
*
|
|
578
|
+
* `fs` - All File System (drops both read and write)
|
|
579
|
+
* * `fs.read` - File System read operations
|
|
580
|
+
* * `fs.write` - File System write operations
|
|
581
|
+
* * `child` - Child process spawning operations
|
|
582
|
+
* * `worker` - Worker thread spawning operation
|
|
583
|
+
* * `net` - Network operations
|
|
584
|
+
* * `inspector` - Inspector operations
|
|
585
|
+
* * `wasi` - WASI operations
|
|
586
|
+
* * `addon` - Native addon operations
|
|
587
|
+
*
|
|
588
|
+
* ```js
|
|
589
|
+
* const fs = require('node:fs');
|
|
590
|
+
*
|
|
591
|
+
* // Read configuration during startup
|
|
592
|
+
* const config = fs.readFileSync('/etc/myapp/config.json', 'utf8');
|
|
593
|
+
*
|
|
594
|
+
* // Drop read access to the config directory after initialization
|
|
595
|
+
* process.permission.drop('fs.read', '/etc/myapp');
|
|
596
|
+
*
|
|
597
|
+
* // This will now throw ERR_ACCESS_DENIED
|
|
598
|
+
* fs.readFileSync('/etc/myapp/config.json');
|
|
599
|
+
* ```
|
|
600
|
+
* @since v26.3.0
|
|
601
|
+
* @experimental
|
|
602
|
+
*/
|
|
603
|
+
drop(scope: string, reference?: string): void;
|
|
552
604
|
}
|
|
553
605
|
interface ProcessReport {
|
|
554
606
|
/**
|