@suveren/gateway 0.7.6 → 0.8.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.
- package/content/integrations/mollie.json +103 -28
- package/dist/mcp-server/http.mjs +228 -118
- package/dist/ui/assets/{index-CsrM6RQr.js → index-BFnSVa9N.js} +22 -22
- package/dist/ui/index.html +1 -1
- package/node_modules/@hap/core/dist/index.d.mts +29 -6
- package/node_modules/@hap/core/dist/index.d.ts +29 -6
- package/node_modules/@hap/core/dist/index.js +54 -8
- package/node_modules/@hap/core/dist/index.mjs +53 -8
- package/node_modules/@hap/core/package.json +2 -1
- package/node_modules/@hap/core/src/frame.ts +115 -14
- package/node_modules/@hap/core/src/gatekeeper.ts +26 -0
- package/node_modules/@hap/core/src/types.ts +7 -1
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/buffer.buffer.d.ts +5 -0
- package/node_modules/@types/node/crypto.d.ts +0 -2
- package/node_modules/@types/node/dgram.d.ts +119 -4
- package/node_modules/@types/node/ffi.d.ts +1 -1
- package/node_modules/@types/node/fs/promises.d.ts +61 -65
- package/node_modules/@types/node/fs.d.ts +86 -76
- package/node_modules/@types/node/http.d.ts +1 -1
- package/node_modules/@types/node/http2.d.ts +2 -2
- package/node_modules/@types/node/index.d.ts +1 -0
- package/node_modules/@types/node/inspector.d.ts +2 -1
- package/node_modules/@types/node/net.d.ts +108 -16
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/quic.d.ts +37 -11
- package/node_modules/@types/node/stream/iter.d.ts +4 -4
- package/node_modules/@types/node/tls.d.ts +24 -0
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +5 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +1 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +1 -0
- package/node_modules/@types/node/tty.d.ts +4 -3
- package/node_modules/@types/node/vfs.d.ts +210 -0
- package/node_modules/@types/node/vm.d.ts +1 -1
- package/node_modules/express-rate-limit/dist/index.cjs +6 -3
- package/node_modules/express-rate-limit/dist/index.d.cts +11 -0
- package/node_modules/express-rate-limit/dist/index.d.mts +11 -0
- package/node_modules/express-rate-limit/dist/index.d.ts +11 -0
- package/node_modules/express-rate-limit/dist/index.mjs +6 -3
- package/node_modules/express-rate-limit/{license.md → license} +7 -6
- package/node_modules/express-rate-limit/package.json +5 -5
- package/node_modules/express-rate-limit/readme.md +1 -0
- package/node_modules/fast-uri/index.js +20 -5
- package/node_modules/fast-uri/lib/utils.js +8 -1
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/component-safe-serialization.test.js +58 -0
- package/node_modules/fast-uri/test/ipv6-validation.test.js +34 -0
- package/node_modules/ip-address/README.md +92 -82
- package/node_modules/ip-address/dist/common.d.ts +20 -0
- package/node_modules/ip-address/dist/common.js +36 -0
- package/node_modules/ip-address/dist/common.js.map +1 -1
- package/node_modules/ip-address/dist/ipv4.d.ts +50 -0
- package/node_modules/ip-address/dist/ipv4.js +75 -0
- package/node_modules/ip-address/dist/ipv4.js.map +1 -1
- package/node_modules/ip-address/dist/ipv6.d.ts +79 -10
- package/node_modules/ip-address/dist/ipv6.js +120 -30
- package/node_modules/ip-address/dist/ipv6.js.map +1 -1
- package/node_modules/ip-address/dist/v4/constants.d.ts +12 -0
- package/node_modules/ip-address/dist/v4/constants.js +40 -1
- package/node_modules/ip-address/dist/v4/constants.js.map +1 -1
- package/node_modules/ip-address/dist/v6/constants.d.ts +14 -0
- package/node_modules/ip-address/dist/v6/constants.js +47 -1
- package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
- package/node_modules/ip-address/package.json +1 -1
- package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +7 -16
- package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +6 -17
- package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +7 -16
- package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +11 -34
- package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +7 -16
- package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +15 -35
- package/node_modules/jose/dist/types/jwk/embedded.d.ts +3 -8
- package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +5 -5
- package/node_modules/jose/dist/types/jwks/local.d.ts +6 -10
- package/node_modules/jose/dist/types/jwks/remote.d.ts +13 -24
- package/node_modules/jose/dist/types/jws/compact/sign.d.ts +5 -10
- package/node_modules/jose/dist/types/jws/compact/verify.d.ts +9 -18
- package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +7 -16
- package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +9 -18
- package/node_modules/jose/dist/types/jws/general/sign.d.ts +11 -21
- package/node_modules/jose/dist/types/jws/general/verify.d.ts +9 -18
- package/node_modules/jose/dist/types/jwt/decrypt.d.ts +10 -20
- package/node_modules/jose/dist/types/jwt/encrypt.d.ts +6 -13
- package/node_modules/jose/dist/types/jwt/sign.d.ts +5 -6
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +9 -14
- package/node_modules/jose/dist/types/jwt/verify.d.ts +9 -19
- package/node_modules/jose/dist/types/key/export.d.ts +4 -4
- package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +6 -8
- package/node_modules/jose/dist/types/key/generate_secret.d.ts +4 -11
- package/node_modules/jose/dist/types/key/import.d.ts +10 -17
- package/node_modules/jose/dist/types/types.d.ts +44 -84
- package/node_modules/jose/dist/types/util/base64url.d.ts +2 -2
- package/node_modules/jose/dist/types/util/decode_jwt.d.ts +3 -10
- package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +4 -4
- package/node_modules/jose/dist/types/util/errors.d.ts +26 -53
- package/node_modules/jose/dist/webapi/index.js +70 -32
- package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +7 -8
- package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +42 -48
- package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +14 -14
- package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +53 -64
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +38 -49
- package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +121 -169
- package/node_modules/jose/dist/webapi/jwk/embedded.js +30 -32
- package/node_modules/jose/dist/webapi/jwk/thumbprint.js +54 -70
- package/node_modules/jose/dist/webapi/jwks/local.js +47 -64
- package/node_modules/jose/dist/webapi/jwks/remote.js +88 -136
- package/node_modules/jose/dist/webapi/jws/compact/sign.js +21 -21
- package/node_modules/jose/dist/webapi/jws/compact/verify.js +7 -8
- package/node_modules/jose/dist/webapi/jws/flattened/sign.js +29 -31
- package/node_modules/jose/dist/webapi/jws/flattened/verify.js +21 -24
- package/node_modules/jose/dist/webapi/jws/general/sign.js +61 -72
- package/node_modules/jose/dist/webapi/jws/general/verify.js +45 -69
- package/node_modules/jose/dist/webapi/jwt/decrypt.js +13 -20
- package/node_modules/jose/dist/webapi/jwt/encrypt.js +57 -70
- package/node_modules/jose/dist/webapi/jwt/sign.js +17 -16
- package/node_modules/jose/dist/webapi/jwt/unsecured.js +32 -40
- package/node_modules/jose/dist/webapi/jwt/verify.js +12 -14
- package/node_modules/jose/dist/webapi/key/export.js +32 -37
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +40 -48
- package/node_modules/jose/dist/webapi/key/generate_secret.js +35 -40
- package/node_modules/jose/dist/webapi/key/import.js +52 -56
- package/node_modules/jose/dist/webapi/lib/asn1.js +130 -169
- package/node_modules/jose/dist/webapi/lib/base64.js +18 -20
- package/node_modules/jose/dist/webapi/lib/buffer_utils.js +34 -38
- package/node_modules/jose/dist/webapi/lib/content_encryption.js +79 -115
- package/node_modules/jose/dist/webapi/lib/crypto_key.js +24 -25
- package/node_modules/jose/dist/webapi/lib/deflate.js +45 -47
- package/node_modules/jose/dist/webapi/lib/helpers.js +40 -37
- package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +10 -24
- package/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -15
- package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +106 -93
- package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +207 -230
- package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +104 -138
- package/node_modules/jose/dist/webapi/lib/jwk_metadata.js +17 -18
- package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +9 -16
- package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +62 -61
- package/node_modules/jose/dist/webapi/lib/jws_sign.js +50 -75
- package/node_modules/jose/dist/webapi/lib/jws_verify.js +80 -125
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +123 -209
- package/node_modules/jose/dist/webapi/lib/key.js +84 -136
- package/node_modules/jose/dist/webapi/lib/key_algorithm.js +13 -8
- package/node_modules/jose/dist/webapi/lib/key_descriptor.js +8 -6
- package/node_modules/jose/dist/webapi/lib/key_management.js +200 -231
- package/node_modules/jose/dist/webapi/lib/key_options.js +7 -5
- package/node_modules/jose/dist/webapi/lib/options.js +55 -68
- package/node_modules/jose/dist/webapi/lib/signing.js +18 -22
- package/node_modules/jose/dist/webapi/lib/type_checks.js +26 -29
- package/node_modules/jose/dist/webapi/util/base64url.js +26 -35
- package/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -31
- package/node_modules/jose/dist/webapi/util/decode_protected_header.js +18 -23
- package/node_modules/jose/dist/webapi/util/errors.js +94 -84
- package/node_modules/jose/package.json +17 -81
- package/package.json +2 -2
- package/profiles/calendar/0.5.profile.json +190 -0
- package/profiles/charge/0.5.profile.json +210 -0
- package/profiles/customers/0.7.profile.json +157 -0
- package/profiles/deploy/0.9.profile.json +176 -0
- package/profiles/email/0.6.profile.json +208 -0
- package/profiles/index.json +9 -1
- package/profiles/publish/0.5.profile.json +186 -0
- package/profiles/purchase/0.5.profile.json +231 -0
- package/profiles/records/0.5.profile.json +117 -0
|
@@ -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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.4.1",
|
|
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": "463ff626c280fc7ad82097e8ff9ab6bd4a19fb2b4c56c8d56c2b8148cd872d0c",
|
|
154
154
|
"typeScriptVersion": "5.6"
|
|
155
155
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
declare module "node:quic" {
|
|
2
2
|
import { NonSharedBuffer } from "node:buffer";
|
|
3
|
-
import { KeyObject } from "node:crypto";
|
|
3
|
+
import { KeyObject, X509Certificate } from "node:crypto";
|
|
4
4
|
import { FileHandle } from "node:fs/promises";
|
|
5
5
|
import { BlockList, SocketAddress } from "node:net";
|
|
6
6
|
import { Writer } from "node:stream/iter";
|
|
7
|
-
import { EphemeralKeyInfo
|
|
7
|
+
import { EphemeralKeyInfo } from "node:tls";
|
|
8
8
|
/**
|
|
9
9
|
* @since v23.8.0
|
|
10
10
|
*/
|
|
@@ -25,6 +25,10 @@ declare module "node:quic" {
|
|
|
25
25
|
id: bigint,
|
|
26
26
|
status: "acknowledged" | "lost" | "abandoned",
|
|
27
27
|
) => void;
|
|
28
|
+
/**
|
|
29
|
+
* @since v23.8.0
|
|
30
|
+
*/
|
|
31
|
+
type OnApplicationCallback = (this: QuicSession, applicationoptions: SessionApplicationOptions) => void;
|
|
28
32
|
/**
|
|
29
33
|
* @since v23.8.0
|
|
30
34
|
*/
|
|
@@ -235,6 +239,7 @@ declare module "node:quic" {
|
|
|
235
239
|
*/
|
|
236
240
|
enableDatagrams?: boolean | undefined;
|
|
237
241
|
}
|
|
242
|
+
type SessionApplicationOptions = { [K in keyof ApplicationOptions]-?: ApplicationOptions[K] & (bigint | boolean) };
|
|
238
243
|
/**
|
|
239
244
|
* @since v23.8.0
|
|
240
245
|
*/
|
|
@@ -539,6 +544,7 @@ declare module "node:quic" {
|
|
|
539
544
|
ongoaway?: QuicSession["ongoaway"] | undefined;
|
|
540
545
|
onkeylog?: QuicSession["onkeylog"] | undefined;
|
|
541
546
|
onqlog?: QuicSession["onqlog"] | undefined;
|
|
547
|
+
onapplication?: QuicSession["onapplication"] | undefined;
|
|
542
548
|
onheaders?: QuicStream["onheaders"] | undefined;
|
|
543
549
|
ontrailers?: QuicStream["ontrailers"] | undefined;
|
|
544
550
|
oninfo?: QuicStream["oninfo"] | undefined;
|
|
@@ -608,6 +614,20 @@ declare module "node:quic" {
|
|
|
608
614
|
* @since v23.8.0
|
|
609
615
|
*/
|
|
610
616
|
function listen(onsession: OnSessionCallback, options?: SessionOptions): Promise<QuicEndpoint>;
|
|
617
|
+
interface ListEndpointsOptions {
|
|
618
|
+
/**
|
|
619
|
+
* If `true` (the default), only returns endpoints that are
|
|
620
|
+
* active (not destroyed, not closing, and not busy). If `false` returns all
|
|
621
|
+
* endpoints.
|
|
622
|
+
*/
|
|
623
|
+
active?: boolean | undefined;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Returns the list of all `QuicEndpoint` instances. By default, only active
|
|
627
|
+
* endpoints are returned.
|
|
628
|
+
* @since v26.4.0
|
|
629
|
+
*/
|
|
630
|
+
function listEndpoints(options?: ListEndpointsOptions): QuicEndpoint[];
|
|
611
631
|
/**
|
|
612
632
|
* The endpoint configuration options passed when constructing a new `QuicEndpoint` instance.
|
|
613
633
|
* @since v23.8.0
|
|
@@ -1172,7 +1192,7 @@ declare module "node:quic" {
|
|
|
1172
1192
|
* be negotiated separately from the transport parameters. Read only.
|
|
1173
1193
|
* @since v26.3.0
|
|
1174
1194
|
*/
|
|
1175
|
-
readonly applicationOptions:
|
|
1195
|
+
readonly applicationOptions: SessionApplicationOptions;
|
|
1176
1196
|
/**
|
|
1177
1197
|
* Initiate a graceful close of the session. Existing streams will be allowed
|
|
1178
1198
|
* to complete but no new streams will be opened. Once all streams have closed,
|
|
@@ -1226,6 +1246,11 @@ declare module "node:quic" {
|
|
|
1226
1246
|
* @since v23.8.0
|
|
1227
1247
|
*/
|
|
1228
1248
|
readonly endpoint: QuicEndpoint | null;
|
|
1249
|
+
/**
|
|
1250
|
+
* The callback to invoke when new application options, e.g. HTTP/3 settings arrived.
|
|
1251
|
+
* @since v26.4
|
|
1252
|
+
*/
|
|
1253
|
+
onapplication: OnApplicationCallback | undefined;
|
|
1229
1254
|
/**
|
|
1230
1255
|
* An optional callback invoked when the session is destroyed with an error.
|
|
1231
1256
|
* This includes errors caused by user callbacks that throw or reject (see
|
|
@@ -1412,19 +1437,20 @@ declare module "node:quic" {
|
|
|
1412
1437
|
encoding?: BufferEncoding,
|
|
1413
1438
|
): Promise<bigint>;
|
|
1414
1439
|
/**
|
|
1415
|
-
* The local certificate as
|
|
1416
|
-
*
|
|
1417
|
-
*
|
|
1440
|
+
* The local certificate as a `crypto.X509Certificate` instance. Server
|
|
1441
|
+
* sessions return the certificate configured for the negotiated SNI host.
|
|
1442
|
+
* Client sessions return `undefined` unless a client certificate was sent.
|
|
1443
|
+
* Returns `undefined` if the session is destroyed.
|
|
1418
1444
|
* @since v26.2.0
|
|
1419
1445
|
*/
|
|
1420
|
-
readonly certificate:
|
|
1446
|
+
readonly certificate: X509Certificate | undefined;
|
|
1421
1447
|
/**
|
|
1422
|
-
* The peer's certificate as
|
|
1423
|
-
* `
|
|
1424
|
-
*
|
|
1448
|
+
* The peer's certificate as a `crypto.X509Certificate` instance. Returns
|
|
1449
|
+
* `undefined` if the peer did not present a certificate or the session is
|
|
1450
|
+
* destroyed.
|
|
1425
1451
|
* @since v26.2.0
|
|
1426
1452
|
*/
|
|
1427
|
-
readonly peerCertificate:
|
|
1453
|
+
readonly peerCertificate: X509Certificate | undefined;
|
|
1428
1454
|
/**
|
|
1429
1455
|
* The ephemeral key information for the session, with properties such as
|
|
1430
1456
|
* `type`, `name`, and `size`. Only available on client sessions. Returns
|
|
@@ -271,8 +271,8 @@ declare module "node:stream/iter" {
|
|
|
271
271
|
*
|
|
272
272
|
* If the object implements the `toAsyncStreamable` protocol (as
|
|
273
273
|
* `stream.Readable` does), that protocol is used. Otherwise, the function
|
|
274
|
-
* duck-types on `read()` and `
|
|
275
|
-
* a batched async iterator.
|
|
274
|
+
* duck-types on `read()`, `on()`, and `off()` (EventEmitter) and wraps the
|
|
275
|
+
* stream with a batched async iterator.
|
|
276
276
|
*
|
|
277
277
|
* The result is cached per instance -- calling `fromReadable()` twice with the
|
|
278
278
|
* same stream returns the same iterable.
|
|
@@ -294,7 +294,7 @@ declare module "node:stream/iter" {
|
|
|
294
294
|
* @since v26.1.0
|
|
295
295
|
* @experimental
|
|
296
296
|
* @param readable A classic Readable stream or any object
|
|
297
|
-
* with `read()` and `
|
|
297
|
+
* with `read()`, `on()` and `off()` methods.
|
|
298
298
|
* @returns A stream/iter async iterable source.
|
|
299
299
|
*/
|
|
300
300
|
function fromReadable(readable: NodeJS.ReadableStream): ByteReadableStream;
|
|
@@ -389,7 +389,7 @@ declare module "node:stream/iter" {
|
|
|
389
389
|
*
|
|
390
390
|
* Each `_write()` / `_writev()` call attempts the Writer's synchronous method
|
|
391
391
|
* first (`writeSync` / `writevSync`), falling back to the async method if the
|
|
392
|
-
* sync path returns `false
|
|
392
|
+
* sync path returns `false`. Similarly, `_final()` tries `endSync()`
|
|
393
393
|
* before `end()`. When the sync path succeeds, the callback is deferred via
|
|
394
394
|
* `queueMicrotask` to preserve the async resolution contract.
|
|
395
395
|
*
|
|
@@ -746,6 +746,7 @@ declare module "node:tls" {
|
|
|
746
746
|
// #endregion
|
|
747
747
|
}
|
|
748
748
|
type SecureVersion = "TLSv1.3" | "TLSv1.2" | "TLSv1.1" | "TLSv1";
|
|
749
|
+
type CertificateCompressionAlgorithm = "zlib" | "brotli" | "zstd";
|
|
749
750
|
interface SecureContextOptions {
|
|
750
751
|
/**
|
|
751
752
|
* If set, this will be called when a client opens a connection using the ALPN extension.
|
|
@@ -782,6 +783,15 @@ declare module "node:tls" {
|
|
|
782
783
|
* able to validate the certificate, and the handshake will fail.
|
|
783
784
|
*/
|
|
784
785
|
cert?: string | Buffer | Array<string | Buffer> | undefined;
|
|
786
|
+
/**
|
|
787
|
+
* An array of supported certificate
|
|
788
|
+
* compression algorithm names, in preference order. Supported values are
|
|
789
|
+
* `'zlib'`, `'brotli'`, and `'zstd'`. When set, enables TLS certificate
|
|
790
|
+
* compression ([RFC 8879](https://tools.ietf.org/html/rfc8879)) which compresses certificates during the TLS
|
|
791
|
+
* handshake, reducing handshake size. Only effective with TLSv1.3.
|
|
792
|
+
* **Default:** `[]` (disabled).
|
|
793
|
+
*/
|
|
794
|
+
certificateCompression?: readonly CertificateCompressionAlgorithm[] | undefined;
|
|
785
795
|
/**
|
|
786
796
|
* Colon-separated list of supported signature algorithms. The list
|
|
787
797
|
* can contain digest algorithms (SHA256, MD5 etc.), public key
|
|
@@ -1110,6 +1120,20 @@ declare module "node:tls" {
|
|
|
1110
1120
|
* @since v0.10.2
|
|
1111
1121
|
*/
|
|
1112
1122
|
function getCiphers(): string[];
|
|
1123
|
+
/**
|
|
1124
|
+
* Returns an array with the names of the RFC 8879 certificate compression
|
|
1125
|
+
* algorithms supported by the current OpenSSL build, suitable for use in the
|
|
1126
|
+
* `certificateCompression` option of `tls.createSecureContext()`. Possible
|
|
1127
|
+
* values include `'zlib'`, `'brotli'`, and `'zstd'`.
|
|
1128
|
+
*
|
|
1129
|
+
* The array is empty when certificate compression is unavailable.
|
|
1130
|
+
*
|
|
1131
|
+
* ```js
|
|
1132
|
+
* console.log(tls.getCertificateCompressionAlgorithms()); // ['zlib', 'brotli', 'zstd']
|
|
1133
|
+
* ```
|
|
1134
|
+
* @since v26.4.0
|
|
1135
|
+
*/
|
|
1136
|
+
function getCertificateCompressionAlgorithms(): CertificateCompressionAlgorithm[];
|
|
1113
1137
|
/**
|
|
1114
1138
|
* Sets the default CA certificates used by Node.js TLS clients. If the provided
|
|
1115
1139
|
* certificates are parsed successfully, they will become the default CA
|
|
@@ -459,4 +459,9 @@ declare module "node:buffer" {
|
|
|
459
459
|
*/
|
|
460
460
|
type AllowSharedBuffer = Buffer;
|
|
461
461
|
}
|
|
462
|
+
/**
|
|
463
|
+
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
|
464
|
+
* TypeScript versions earlier than 5.7.
|
|
465
|
+
*/
|
|
466
|
+
type BufferView<T extends NodeJS.ArrayBufferView> = Buffer;
|
|
462
467
|
}
|
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
/// <reference path="../util.d.ts" />
|
|
111
111
|
/// <reference path="../util/types.d.ts" />
|
|
112
112
|
/// <reference path="../v8.d.ts" />
|
|
113
|
+
/// <reference path="../vfs.d.ts" />
|
|
113
114
|
/// <reference path="../vm.d.ts" />
|
|
114
115
|
/// <reference path="../wasi.d.ts" />
|
|
115
116
|
/// <reference path="../worker_threads.d.ts" />
|
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
/// <reference path="../util.d.ts" />
|
|
111
111
|
/// <reference path="../util/types.d.ts" />
|
|
112
112
|
/// <reference path="../v8.d.ts" />
|
|
113
|
+
/// <reference path="../vfs.d.ts" />
|
|
113
114
|
/// <reference path="../vm.d.ts" />
|
|
114
115
|
/// <reference path="../wasi.d.ts" />
|
|
115
116
|
/// <reference path="../worker_threads.d.ts" />
|
|
@@ -28,10 +28,11 @@ declare module "node:tty" {
|
|
|
28
28
|
* Allows configuration of `tty.ReadStream` so that it operates as a raw device.
|
|
29
29
|
*
|
|
30
30
|
* When in raw mode, input is always available character-by-character, not
|
|
31
|
-
* including modifiers. Additionally, all special processing of characters
|
|
32
|
-
* terminal is disabled, including echoing input
|
|
31
|
+
* including modifiers. Additionally, all special processing of input characters
|
|
32
|
+
* by the terminal is disabled, including echoing input
|
|
33
33
|
* characters. Ctrl+C will no longer cause a `SIGINT` when
|
|
34
|
-
* in this mode.
|
|
34
|
+
* in this mode. This mode does not affect terminal output processing, such as
|
|
35
|
+
* newline translation on Unix terminals.
|
|
35
36
|
* @since v0.7.7
|
|
36
37
|
* @param mode If `true`, configures the `tty.ReadStream` to operate as a raw device. If `false`, configures the `tty.ReadStream` to operate in its default mode. The `readStream.isRaw`
|
|
37
38
|
* property will be set to the resulting mode.
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
declare module "node:vfs" {
|
|
2
|
+
/**
|
|
3
|
+
* Convenience factory equivalent to `new VirtualFileSystem(provider, options)`.
|
|
4
|
+
*
|
|
5
|
+
* ```js
|
|
6
|
+
* const vfs = require('node:vfs');
|
|
7
|
+
*
|
|
8
|
+
* // Default in-memory provider
|
|
9
|
+
* const memoryVfs = vfs.create();
|
|
10
|
+
*
|
|
11
|
+
* // Explicit provider
|
|
12
|
+
* const realVfs = vfs.create(new vfs.RealFSProvider('/tmp/sandbox'));
|
|
13
|
+
* ```
|
|
14
|
+
* @since v26.4.0
|
|
15
|
+
* @param provider The provider to use. **Default:** `new MemoryProvider()`.
|
|
16
|
+
*/
|
|
17
|
+
function create(provider?: VirtualProvider, options?: VirtualFileSystemOptions): VirtualFileSystem;
|
|
18
|
+
function create(options: VirtualFileSystemOptions): VirtualFileSystem;
|
|
19
|
+
interface VirtualFileSystemOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Whether to emit the experimental warning. **Default:** `true`.
|
|
22
|
+
*/
|
|
23
|
+
emitExperimentalWarning?: boolean | undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A `VirtualFileSystem` wraps a {@link VirtualProvider} and exposes a
|
|
27
|
+
* `node:fs`-like API. Each instance maintains its own file tree.
|
|
28
|
+
* @since v26.4.0
|
|
29
|
+
*/
|
|
30
|
+
class VirtualFileSystem {
|
|
31
|
+
/**
|
|
32
|
+
* @param provider The provider to use. **Default:** `new MemoryProvider()`.
|
|
33
|
+
*/
|
|
34
|
+
constructor(provider?: VirtualProvider, options?: VirtualFileSystemOptions);
|
|
35
|
+
constructor(options: VirtualFileSystemOptions);
|
|
36
|
+
/**
|
|
37
|
+
* The provider backing this VFS instance.
|
|
38
|
+
* @since v26.4.0
|
|
39
|
+
*/
|
|
40
|
+
readonly provider: VirtualProvider;
|
|
41
|
+
/**
|
|
42
|
+
* `true` when the underlying provider is read-only.
|
|
43
|
+
* @since v26.4.0
|
|
44
|
+
*/
|
|
45
|
+
readonly readonly: boolean;
|
|
46
|
+
}
|
|
47
|
+
interface VirtualFileSystem extends
|
|
48
|
+
// Synchronous API
|
|
49
|
+
Pick<
|
|
50
|
+
typeof import("node:fs"),
|
|
51
|
+
| "existsSync"
|
|
52
|
+
| "statSync"
|
|
53
|
+
| "lstatSync"
|
|
54
|
+
| "readFileSync"
|
|
55
|
+
| "writeFileSync"
|
|
56
|
+
| "appendFileSync"
|
|
57
|
+
| "readdirSync"
|
|
58
|
+
| "mkdirSync"
|
|
59
|
+
| "rmdirSync"
|
|
60
|
+
| "unlinkSync"
|
|
61
|
+
| "renameSync"
|
|
62
|
+
| "copyFileSync"
|
|
63
|
+
| "realpathSync"
|
|
64
|
+
| "readlinkSync"
|
|
65
|
+
| "symlinkSync"
|
|
66
|
+
| "accessSync"
|
|
67
|
+
| "rmSync"
|
|
68
|
+
| "truncateSync"
|
|
69
|
+
| "ftruncateSync"
|
|
70
|
+
| "linkSync"
|
|
71
|
+
| "chmodSync"
|
|
72
|
+
| "chownSync"
|
|
73
|
+
| "utimesSync"
|
|
74
|
+
| "lutimesSync"
|
|
75
|
+
| "mkdtempSync"
|
|
76
|
+
| "opendirSync"
|
|
77
|
+
| "openAsBlob"
|
|
78
|
+
| "openSync"
|
|
79
|
+
| "closeSync"
|
|
80
|
+
| "readSync"
|
|
81
|
+
| "writeSync"
|
|
82
|
+
| "fstatSync"
|
|
83
|
+
| "createReadStream"
|
|
84
|
+
| "createWriteStream"
|
|
85
|
+
| "watch"
|
|
86
|
+
| "watchFile"
|
|
87
|
+
| "unwatchFile"
|
|
88
|
+
>,
|
|
89
|
+
// Callback API
|
|
90
|
+
Pick<
|
|
91
|
+
typeof import("node:fs"),
|
|
92
|
+
| "readFile"
|
|
93
|
+
| "writeFile"
|
|
94
|
+
| "stat"
|
|
95
|
+
| "lstat"
|
|
96
|
+
| "readdir"
|
|
97
|
+
| "realpath"
|
|
98
|
+
| "readlink"
|
|
99
|
+
| "access"
|
|
100
|
+
| "open"
|
|
101
|
+
| "close"
|
|
102
|
+
| "read"
|
|
103
|
+
| "write"
|
|
104
|
+
| "rm"
|
|
105
|
+
| "fstat"
|
|
106
|
+
| "truncate"
|
|
107
|
+
| "ftruncate"
|
|
108
|
+
| "link"
|
|
109
|
+
| "mkdtemp"
|
|
110
|
+
| "opendir"
|
|
111
|
+
>
|
|
112
|
+
{
|
|
113
|
+
// Promise API
|
|
114
|
+
readonly promises: Pick<
|
|
115
|
+
typeof import("node:fs/promises"),
|
|
116
|
+
| "readFile"
|
|
117
|
+
| "writeFile"
|
|
118
|
+
| "appendFile"
|
|
119
|
+
| "stat"
|
|
120
|
+
| "lstat"
|
|
121
|
+
| "readdir"
|
|
122
|
+
| "mkdir"
|
|
123
|
+
| "rmdir"
|
|
124
|
+
| "unlink"
|
|
125
|
+
| "rename"
|
|
126
|
+
| "copyFile"
|
|
127
|
+
| "realpath"
|
|
128
|
+
| "readlink"
|
|
129
|
+
| "symlink"
|
|
130
|
+
| "access"
|
|
131
|
+
| "rm"
|
|
132
|
+
| "truncate"
|
|
133
|
+
| "link"
|
|
134
|
+
| "mkdtemp"
|
|
135
|
+
| "chmod"
|
|
136
|
+
| "chown"
|
|
137
|
+
| "lchown"
|
|
138
|
+
| "utimes"
|
|
139
|
+
| "lutimes"
|
|
140
|
+
| "open"
|
|
141
|
+
| "lchmod"
|
|
142
|
+
| "watch"
|
|
143
|
+
>;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The base class for all VFS providers. Subclasses implement the essential
|
|
147
|
+
* primitives (such as `open`, `stat`, `readdir`, `mkdir`, `rmdir`, `unlink`,
|
|
148
|
+
* `rename`, etc.) and inherit default implementations of the derived
|
|
149
|
+
* methods (such as `readFile`, `writeFile`, `exists`, `copyFile`, `access`, etc.).
|
|
150
|
+
* @since v26.4.0
|
|
151
|
+
*/
|
|
152
|
+
abstract class VirtualProvider {
|
|
153
|
+
get readonly(): boolean;
|
|
154
|
+
get supportsSymlinks(): boolean;
|
|
155
|
+
get supportsWatch(): boolean;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* The default in-memory provider. Stores files, directories, and symbolic
|
|
159
|
+
* links in a `Map`-backed tree, supports symlinks (`supportsSymlinks ===
|
|
160
|
+
* true`), and supports watching (`supportsWatch === true`).
|
|
161
|
+
* @since v26.4.0
|
|
162
|
+
*/
|
|
163
|
+
class MemoryProvider extends VirtualProvider {
|
|
164
|
+
/**
|
|
165
|
+
* Locks the provider into read-only mode. Subsequent writes through any
|
|
166
|
+
* `VirtualFileSystem` using this provider throw `EROFS`. There is no
|
|
167
|
+
* way to revert the provider to writable.
|
|
168
|
+
*
|
|
169
|
+
* ```js
|
|
170
|
+
* const vfs = require('node:vfs');
|
|
171
|
+
*
|
|
172
|
+
* const provider = new vfs.MemoryProvider();
|
|
173
|
+
* const myVfs = vfs.create(provider);
|
|
174
|
+
* myVfs.writeFileSync('/seed.txt', 'initial');
|
|
175
|
+
*
|
|
176
|
+
* provider.setReadOnly();
|
|
177
|
+
*
|
|
178
|
+
* myVfs.writeFileSync('/x.txt', 'fail'); // throws EROFS
|
|
179
|
+
* ```
|
|
180
|
+
* @since v26.4.0
|
|
181
|
+
*/
|
|
182
|
+
setReadOnly(): void;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* A provider that wraps a directory (i.e. one on the actual file system) and exposes its
|
|
186
|
+
* contents through the VFS API. All VFS paths are resolved relative to
|
|
187
|
+
* the root and verified to stay inside it; symbolic links resolving
|
|
188
|
+
* outside the root are rejected.
|
|
189
|
+
* @since v26.4.0
|
|
190
|
+
*/
|
|
191
|
+
class RealFSProvider extends VirtualProvider {
|
|
192
|
+
/**
|
|
193
|
+
* ```js
|
|
194
|
+
* const vfs = require('node:vfs');
|
|
195
|
+
*
|
|
196
|
+
* const realVfs = vfs.create(new vfs.RealFSProvider('/tmp/sandbox'));
|
|
197
|
+
* realVfs.writeFileSync('/file.txt', 'hello'); // writes /tmp/sandbox/file.txt
|
|
198
|
+
* ```
|
|
199
|
+
* @since v26.4.0
|
|
200
|
+
* @param rootPath The absolute file-system path to use as the root.
|
|
201
|
+
* Must be a non-empty string.
|
|
202
|
+
*/
|
|
203
|
+
constructor(rootPath: string);
|
|
204
|
+
/**
|
|
205
|
+
* The resolved absolute path used as the root.
|
|
206
|
+
* @since v26.4.0
|
|
207
|
+
*/
|
|
208
|
+
readonly rootPath: string;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
@@ -741,7 +741,7 @@ declare module "node:vm" {
|
|
|
741
741
|
*/
|
|
742
742
|
status: ModuleStatus;
|
|
743
743
|
/**
|
|
744
|
-
* Evaluate the module and its
|
|
744
|
+
* Evaluate the module and its dependencies. Corresponds to the [Evaluate() concrete method](https://tc39.es/ecma262/#sec-moduleevaluation) field of
|
|
745
745
|
* [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records)s in the ECMAScript specification.
|
|
746
746
|
*
|
|
747
747
|
* If the module is a `vm.SourceTextModule`, `evaluate()` must be called after the module has been instantiated;
|
|
@@ -297,9 +297,9 @@ var setDraft8Headers = (response, info, windowMs, name, key) => {
|
|
|
297
297
|
response.append("RateLimit", `"${name}"; ${header}`);
|
|
298
298
|
response.append("RateLimit-Policy", `"${name}"; ${policy}`);
|
|
299
299
|
};
|
|
300
|
-
var setRetryAfterHeader = (response, info, windowMs) => {
|
|
300
|
+
var setRetryAfterHeader = (response, info, windowMs, retryAfter) => {
|
|
301
301
|
if (response.headersSent) return;
|
|
302
|
-
const resetSeconds = getResetSeconds(windowMs, info.resetTime);
|
|
302
|
+
const resetSeconds = retryAfter ?? getResetSeconds(windowMs, info.resetTime);
|
|
303
303
|
response.setHeader("Retry-After", resetSeconds.toString());
|
|
304
304
|
};
|
|
305
305
|
|
|
@@ -566,6 +566,7 @@ var validations = {
|
|
|
566
566
|
legacyHeaders: true,
|
|
567
567
|
standardHeaders: true,
|
|
568
568
|
identifier: true,
|
|
569
|
+
retryAfter: true,
|
|
569
570
|
requestPropertyName: true,
|
|
570
571
|
skipFailedRequests: true,
|
|
571
572
|
skipSuccessfulRequests: true,
|
|
@@ -1050,7 +1051,9 @@ var rateLimit = (passedOptions) => {
|
|
|
1050
1051
|
debug("limit exceeded");
|
|
1051
1052
|
if (config.legacyHeaders || config.standardHeaders) {
|
|
1052
1053
|
debug("set retry-after header");
|
|
1053
|
-
|
|
1054
|
+
const retrieveRetryAfter = typeof config.retryAfter === "function" ? config.retryAfter(request, response) : config.retryAfter;
|
|
1055
|
+
const retryAfter = await retrieveRetryAfter;
|
|
1056
|
+
setRetryAfterHeader(response, info, config.windowMs, retryAfter);
|
|
1054
1057
|
}
|
|
1055
1058
|
config.handler(request, response, next, options);
|
|
1056
1059
|
return;
|
|
@@ -408,6 +408,17 @@ export type Options = {
|
|
|
408
408
|
* Defaults to `{limit}-in-{window}`.
|
|
409
409
|
*/
|
|
410
410
|
identifier: string | ValueDeterminingMiddleware<string>;
|
|
411
|
+
/**
|
|
412
|
+
* Method to generate a custom `Retry-After` header value (in seconds) when
|
|
413
|
+
* a client is rate limited.
|
|
414
|
+
*
|
|
415
|
+
* This is advisory only, it customizes what the header says, it does not
|
|
416
|
+
* change how long the limiter actually keeps blocking the client for.
|
|
417
|
+
* That is still controlled by `windowMs`.
|
|
418
|
+
*
|
|
419
|
+
* By default, the number of seconds remaining until the window resets.
|
|
420
|
+
*/
|
|
421
|
+
retryAfter?: number | ValueDeterminingMiddleware<number>;
|
|
411
422
|
/**
|
|
412
423
|
* The name of the property on the request object to store the rate limit info.
|
|
413
424
|
*
|