@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.
Files changed (161) hide show
  1. package/content/integrations/mollie.json +103 -28
  2. package/dist/mcp-server/http.mjs +228 -118
  3. package/dist/ui/assets/{index-CsrM6RQr.js → index-BFnSVa9N.js} +22 -22
  4. package/dist/ui/index.html +1 -1
  5. package/node_modules/@hap/core/dist/index.d.mts +29 -6
  6. package/node_modules/@hap/core/dist/index.d.ts +29 -6
  7. package/node_modules/@hap/core/dist/index.js +54 -8
  8. package/node_modules/@hap/core/dist/index.mjs +53 -8
  9. package/node_modules/@hap/core/package.json +2 -1
  10. package/node_modules/@hap/core/src/frame.ts +115 -14
  11. package/node_modules/@hap/core/src/gatekeeper.ts +26 -0
  12. package/node_modules/@hap/core/src/types.ts +7 -1
  13. package/node_modules/@types/node/README.md +1 -1
  14. package/node_modules/@types/node/buffer.buffer.d.ts +5 -0
  15. package/node_modules/@types/node/crypto.d.ts +0 -2
  16. package/node_modules/@types/node/dgram.d.ts +119 -4
  17. package/node_modules/@types/node/ffi.d.ts +1 -1
  18. package/node_modules/@types/node/fs/promises.d.ts +61 -65
  19. package/node_modules/@types/node/fs.d.ts +86 -76
  20. package/node_modules/@types/node/http.d.ts +1 -1
  21. package/node_modules/@types/node/http2.d.ts +2 -2
  22. package/node_modules/@types/node/index.d.ts +1 -0
  23. package/node_modules/@types/node/inspector.d.ts +2 -1
  24. package/node_modules/@types/node/net.d.ts +108 -16
  25. package/node_modules/@types/node/package.json +2 -2
  26. package/node_modules/@types/node/quic.d.ts +37 -11
  27. package/node_modules/@types/node/stream/iter.d.ts +4 -4
  28. package/node_modules/@types/node/tls.d.ts +24 -0
  29. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +5 -0
  30. package/node_modules/@types/node/ts5.6/index.d.ts +1 -0
  31. package/node_modules/@types/node/ts5.7/index.d.ts +1 -0
  32. package/node_modules/@types/node/tty.d.ts +4 -3
  33. package/node_modules/@types/node/vfs.d.ts +210 -0
  34. package/node_modules/@types/node/vm.d.ts +1 -1
  35. package/node_modules/express-rate-limit/dist/index.cjs +6 -3
  36. package/node_modules/express-rate-limit/dist/index.d.cts +11 -0
  37. package/node_modules/express-rate-limit/dist/index.d.mts +11 -0
  38. package/node_modules/express-rate-limit/dist/index.d.ts +11 -0
  39. package/node_modules/express-rate-limit/dist/index.mjs +6 -3
  40. package/node_modules/express-rate-limit/{license.md → license} +7 -6
  41. package/node_modules/express-rate-limit/package.json +5 -5
  42. package/node_modules/express-rate-limit/readme.md +1 -0
  43. package/node_modules/fast-uri/index.js +20 -5
  44. package/node_modules/fast-uri/lib/utils.js +8 -1
  45. package/node_modules/fast-uri/package.json +1 -1
  46. package/node_modules/fast-uri/test/component-safe-serialization.test.js +58 -0
  47. package/node_modules/fast-uri/test/ipv6-validation.test.js +34 -0
  48. package/node_modules/ip-address/README.md +92 -82
  49. package/node_modules/ip-address/dist/common.d.ts +20 -0
  50. package/node_modules/ip-address/dist/common.js +36 -0
  51. package/node_modules/ip-address/dist/common.js.map +1 -1
  52. package/node_modules/ip-address/dist/ipv4.d.ts +50 -0
  53. package/node_modules/ip-address/dist/ipv4.js +75 -0
  54. package/node_modules/ip-address/dist/ipv4.js.map +1 -1
  55. package/node_modules/ip-address/dist/ipv6.d.ts +79 -10
  56. package/node_modules/ip-address/dist/ipv6.js +120 -30
  57. package/node_modules/ip-address/dist/ipv6.js.map +1 -1
  58. package/node_modules/ip-address/dist/v4/constants.d.ts +12 -0
  59. package/node_modules/ip-address/dist/v4/constants.js +40 -1
  60. package/node_modules/ip-address/dist/v4/constants.js.map +1 -1
  61. package/node_modules/ip-address/dist/v6/constants.d.ts +14 -0
  62. package/node_modules/ip-address/dist/v6/constants.js +47 -1
  63. package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
  64. package/node_modules/ip-address/package.json +1 -1
  65. package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +7 -16
  66. package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +6 -17
  67. package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +7 -16
  68. package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +11 -34
  69. package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +7 -16
  70. package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +15 -35
  71. package/node_modules/jose/dist/types/jwk/embedded.d.ts +3 -8
  72. package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +5 -5
  73. package/node_modules/jose/dist/types/jwks/local.d.ts +6 -10
  74. package/node_modules/jose/dist/types/jwks/remote.d.ts +13 -24
  75. package/node_modules/jose/dist/types/jws/compact/sign.d.ts +5 -10
  76. package/node_modules/jose/dist/types/jws/compact/verify.d.ts +9 -18
  77. package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +7 -16
  78. package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +9 -18
  79. package/node_modules/jose/dist/types/jws/general/sign.d.ts +11 -21
  80. package/node_modules/jose/dist/types/jws/general/verify.d.ts +9 -18
  81. package/node_modules/jose/dist/types/jwt/decrypt.d.ts +10 -20
  82. package/node_modules/jose/dist/types/jwt/encrypt.d.ts +6 -13
  83. package/node_modules/jose/dist/types/jwt/sign.d.ts +5 -6
  84. package/node_modules/jose/dist/types/jwt/unsecured.d.ts +9 -14
  85. package/node_modules/jose/dist/types/jwt/verify.d.ts +9 -19
  86. package/node_modules/jose/dist/types/key/export.d.ts +4 -4
  87. package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +6 -8
  88. package/node_modules/jose/dist/types/key/generate_secret.d.ts +4 -11
  89. package/node_modules/jose/dist/types/key/import.d.ts +10 -17
  90. package/node_modules/jose/dist/types/types.d.ts +44 -84
  91. package/node_modules/jose/dist/types/util/base64url.d.ts +2 -2
  92. package/node_modules/jose/dist/types/util/decode_jwt.d.ts +3 -10
  93. package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +4 -4
  94. package/node_modules/jose/dist/types/util/errors.d.ts +26 -53
  95. package/node_modules/jose/dist/webapi/index.js +70 -32
  96. package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +7 -8
  97. package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +42 -48
  98. package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +14 -14
  99. package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +53 -64
  100. package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +38 -49
  101. package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +121 -169
  102. package/node_modules/jose/dist/webapi/jwk/embedded.js +30 -32
  103. package/node_modules/jose/dist/webapi/jwk/thumbprint.js +54 -70
  104. package/node_modules/jose/dist/webapi/jwks/local.js +47 -64
  105. package/node_modules/jose/dist/webapi/jwks/remote.js +88 -136
  106. package/node_modules/jose/dist/webapi/jws/compact/sign.js +21 -21
  107. package/node_modules/jose/dist/webapi/jws/compact/verify.js +7 -8
  108. package/node_modules/jose/dist/webapi/jws/flattened/sign.js +29 -31
  109. package/node_modules/jose/dist/webapi/jws/flattened/verify.js +21 -24
  110. package/node_modules/jose/dist/webapi/jws/general/sign.js +61 -72
  111. package/node_modules/jose/dist/webapi/jws/general/verify.js +45 -69
  112. package/node_modules/jose/dist/webapi/jwt/decrypt.js +13 -20
  113. package/node_modules/jose/dist/webapi/jwt/encrypt.js +57 -70
  114. package/node_modules/jose/dist/webapi/jwt/sign.js +17 -16
  115. package/node_modules/jose/dist/webapi/jwt/unsecured.js +32 -40
  116. package/node_modules/jose/dist/webapi/jwt/verify.js +12 -14
  117. package/node_modules/jose/dist/webapi/key/export.js +32 -37
  118. package/node_modules/jose/dist/webapi/key/generate_key_pair.js +40 -48
  119. package/node_modules/jose/dist/webapi/key/generate_secret.js +35 -40
  120. package/node_modules/jose/dist/webapi/key/import.js +52 -56
  121. package/node_modules/jose/dist/webapi/lib/asn1.js +130 -169
  122. package/node_modules/jose/dist/webapi/lib/base64.js +18 -20
  123. package/node_modules/jose/dist/webapi/lib/buffer_utils.js +34 -38
  124. package/node_modules/jose/dist/webapi/lib/content_encryption.js +79 -115
  125. package/node_modules/jose/dist/webapi/lib/crypto_key.js +24 -25
  126. package/node_modules/jose/dist/webapi/lib/deflate.js +45 -47
  127. package/node_modules/jose/dist/webapi/lib/helpers.js +40 -37
  128. package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +10 -24
  129. package/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -15
  130. package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +106 -93
  131. package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +207 -230
  132. package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +104 -138
  133. package/node_modules/jose/dist/webapi/lib/jwk_metadata.js +17 -18
  134. package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +9 -16
  135. package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +62 -61
  136. package/node_modules/jose/dist/webapi/lib/jws_sign.js +50 -75
  137. package/node_modules/jose/dist/webapi/lib/jws_verify.js +80 -125
  138. package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +123 -209
  139. package/node_modules/jose/dist/webapi/lib/key.js +84 -136
  140. package/node_modules/jose/dist/webapi/lib/key_algorithm.js +13 -8
  141. package/node_modules/jose/dist/webapi/lib/key_descriptor.js +8 -6
  142. package/node_modules/jose/dist/webapi/lib/key_management.js +200 -231
  143. package/node_modules/jose/dist/webapi/lib/key_options.js +7 -5
  144. package/node_modules/jose/dist/webapi/lib/options.js +55 -68
  145. package/node_modules/jose/dist/webapi/lib/signing.js +18 -22
  146. package/node_modules/jose/dist/webapi/lib/type_checks.js +26 -29
  147. package/node_modules/jose/dist/webapi/util/base64url.js +26 -35
  148. package/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -31
  149. package/node_modules/jose/dist/webapi/util/decode_protected_header.js +18 -23
  150. package/node_modules/jose/dist/webapi/util/errors.js +94 -84
  151. package/node_modules/jose/package.json +17 -81
  152. package/package.json +2 -2
  153. package/profiles/calendar/0.5.profile.json +190 -0
  154. package/profiles/charge/0.5.profile.json +210 -0
  155. package/profiles/customers/0.7.profile.json +157 -0
  156. package/profiles/deploy/0.9.profile.json +176 -0
  157. package/profiles/email/0.6.profile.json +208 -0
  158. package/profiles/index.json +9 -1
  159. package/profiles/publish/0.5.profile.json +186 -0
  160. package/profiles/purchase/0.5.profile.json +231 -0
  161. package/profiles/records/0.5.profile.json +117 -0
@@ -15,6 +15,10 @@ declare module "node:dgram" {
15
15
  exclusive?: boolean | undefined;
16
16
  fd?: number | undefined;
17
17
  }
18
+ interface BindSyncOptions {
19
+ port?: number | undefined;
20
+ address?: string | undefined;
21
+ }
18
22
  type SocketType = "udp4" | "udp6";
19
23
  interface SocketOptions extends Abortable {
20
24
  type: SocketType;
@@ -117,10 +121,12 @@ declare module "node:dgram" {
117
121
  * messages on a named `port` and optional `address`. If `port` is not
118
122
  * specified or is `0`, the operating system will attempt to bind to a
119
123
  * random port. If `address` is not specified, the operating system will
120
- * attempt to listen on all addresses. Once binding is complete, a `'listening'` event is emitted and the optional `callback` function is
124
+ * attempt to listen on all addresses. Once binding is complete, a
125
+ * `'listening'` event is emitted and the optional `callback` function is
121
126
  * called.
122
127
  *
123
- * Specifying both a `'listening'` event listener and passing a `callback` to the `socket.bind()` method is not harmful but not very
128
+ * Specifying both a `'listening'` event listener and passing a
129
+ * `callback` to the `socket.bind()` method is not harmful but not very
124
130
  * useful.
125
131
  *
126
132
  * A bound datagram socket keeps the Node.js process running to receive
@@ -157,9 +163,82 @@ declare module "node:dgram" {
157
163
  * @param callback with no parameters. Called when binding is complete.
158
164
  */
159
165
  bind(port?: number, address?: string, callback?: () => void): this;
160
- bind(port?: number, callback?: () => void): this;
161
- bind(callback?: () => void): this;
166
+ bind(port: number, callback: () => void): this;
167
+ bind(callback: () => void): this;
168
+ /**
169
+ * For UDP sockets, causes the `dgram.Socket` to listen for datagram
170
+ * messages on a named `port` and optional `address` that are passed as
171
+ * properties of an `options` object passed as the first argument. If
172
+ * `port` is not specified or is `0`, the operating system will attempt
173
+ * to bind to a random port. If `address` is not specified, the operating
174
+ * system will attempt to listen on all addresses. Once binding is
175
+ * complete, a `'listening'` event is emitted and the optional `callback`
176
+ * function is called.
177
+ *
178
+ * The `options` object may contain a `fd` property. When a `fd` greater
179
+ * than `0` is set, it will wrap around an existing socket with the given
180
+ * file descriptor. In this case, the properties of `port` and `address`
181
+ * will be ignored.
182
+ *
183
+ * Specifying both a `'listening'` event listener and passing a
184
+ * `callback` to the `socket.bind()` method is not harmful but not very
185
+ * useful.
186
+ *
187
+ * The `options` object may contain an additional `exclusive` property that is
188
+ * used when using `dgram.Socket` objects with the [`cluster`](https://nodejs.org/docs/latest-v26.x/api/cluster.html) module. When
189
+ * `exclusive` is set to `false` (the default), cluster workers will use the same
190
+ * underlying socket handle allowing connection handling duties to be shared.
191
+ * When `exclusive` is `true`, however, the handle is not shared and attempted
192
+ * port sharing results in an error. Creating a `dgram.Socket` with the `reusePort`
193
+ * option set to `true` causes `exclusive` to always be `true` when `socket.bind()`
194
+ * is called.
195
+ *
196
+ * A bound datagram socket keeps the Node.js process running to receive
197
+ * datagram messages.
198
+ *
199
+ * If binding fails, an `'error'` event is generated. In rare case (e.g.
200
+ * attempting to bind with a closed socket), an `Error` may be thrown.
201
+ *
202
+ * An example socket listening on an exclusive port is shown below.
203
+ *
204
+ * ```js
205
+ * socket.bind({
206
+ * address: 'localhost',
207
+ * port: 8000,
208
+ * exclusive: true,
209
+ * });
210
+ * ```
211
+ * @since v0.11.14
212
+ * @param options Required. Supports the following properties:
213
+ */
162
214
  bind(options: BindOptions, callback?: () => void): this;
215
+ /**
216
+ * The synchronous counterpart of `socket.bind()`. `bind(2)` is a local,
217
+ * non-blocking system call, so the bind is performed inline and the resolved
218
+ * address is returned immediately, including the operating-system-assigned
219
+ * ephemeral port when `port` is `0`:
220
+ *
221
+ * ```js
222
+ * const dgram = require('node:dgram');
223
+ *
224
+ * const socket = dgram.createSocket('udp4');
225
+ * const address = socket.bindSync({ address: '0.0.0.0', port: 0 });
226
+ * console.log(address); // e.g. { address: '0.0.0.0', family: 'IPv4', port: 53124 }
227
+ * ```
228
+ *
229
+ * A bind failure such as `EADDRINUSE` is thrown synchronously rather than emitted
230
+ * as an `'error'` event. After `bindSync()` returns, `socket.address()` is
231
+ * valid synchronously and the `'listening'` event is emitted on the next tick.
232
+ *
233
+ * `address` must be a numeric IP literal; `bindSync()` never performs DNS
234
+ * resolution (asynchronous name resolution being the only genuinely blocking part
235
+ * of binding). Incoming datagrams continue to be delivered asynchronously via the
236
+ * `'message'` event. `bindSync()` always binds the socket's own handle and
237
+ * does not participate in [`cluster`](https://nodejs.org/docs/latest-v26.x/api/cluster.html) handle sharing.
238
+ * @since v26.4.0
239
+ * @returns The bound address as returned by `socket.address()`.
240
+ */
241
+ bindSync(options?: BindSyncOptions): AddressInfo;
163
242
  /**
164
243
  * Close the underlying socket and stop listening for data on it. If a callback is
165
244
  * provided, it is added as a listener for the `'close'` event.
@@ -182,6 +261,42 @@ declare module "node:dgram" {
182
261
  */
183
262
  connect(port: number, address?: string, callback?: () => void): void;
184
263
  connect(port: number, callback: () => void): void;
264
+ /**
265
+ * The synchronous counterpart of `socket.connect()`. For a UDP socket
266
+ * `connect(2)` only records the default peer address and is a local, non-blocking
267
+ * system call, so the association is performed inline. Any error raised by the
268
+ * call itself (for example `EAFNOSUPPORT` for a mismatched address family) is
269
+ * thrown synchronously rather than reported via the `'error'` event. Because
270
+ * `connect(2)` does not probe reachability, errors such as `ECONNREFUSED` are
271
+ * still surfaced asynchronously on a later send or receive, exactly as for
272
+ * `socket.connect()`:
273
+ *
274
+ * ```js
275
+ * const dgram = require('node:dgram');
276
+ *
277
+ * const socket = dgram.createSocket('udp4');
278
+ * socket.connectSync(41234, '127.0.0.1');
279
+ * console.log(socket.remoteAddress()); // { address: '127.0.0.1', family: 'IPv4', port: 41234 }
280
+ * ```
281
+ *
282
+ * If the socket is still unbound it is bound synchronously first. After
283
+ * `connectSync()` returns, `socket.remoteAddress()` is valid synchronously
284
+ * and the `'connect'` event is emitted on the next tick. Trying to call
285
+ * `connectSync()` on an already connected socket throws an
286
+ * `ERR_SOCKET_DGRAM_IS_CONNECTED` exception, and calling it while an
287
+ * asynchronous [`socket.bind()`][] is still in progress throws an
288
+ * `ERR_SOCKET_ALREADY_BOUND` exception.
289
+ *
290
+ * `address` must be a numeric IP literal; `connectSync()` never performs DNS
291
+ * resolution (asynchronous name resolution being the only genuinely blocking part
292
+ * of connecting).
293
+ * @since v26.4.0
294
+ * @param address A numeric IP address to connect to. Unlike
295
+ * `socket.connect()`, no DNS resolution is performed, so a host name is not
296
+ * accepted. If omitted, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for
297
+ * `udp6` sockets) is used.
298
+ */
299
+ connectSync(port: number, address?: string): void;
185
300
  /**
186
301
  * A synchronous function that disassociates a connected `dgram.Socket` from
187
302
  * its remote address. Trying to call `disconnect()` on an unbound or already
@@ -459,7 +459,7 @@ declare module "node:ffi" {
459
459
  "void": void;
460
460
  "number": number;
461
461
  "bigint": bigint;
462
- "pointer": bigint | null;
462
+ "pointer": bigint;
463
463
  }
464
464
  enum types {
465
465
  VOID = "void",
@@ -1,5 +1,5 @@
1
1
  declare module "node:fs/promises" {
2
- import { NonSharedBuffer } from "node:buffer";
2
+ import { BufferView, NonSharedBuffer } from "node:buffer";
3
3
  import { Abortable } from "node:events";
4
4
  import { Interface as ReadlineInterface } from "node:readline";
5
5
  import {
@@ -20,6 +20,10 @@ declare module "node:fs/promises" {
20
20
  OpenDirOptions,
21
21
  OpenMode,
22
22
  PathLike,
23
+ ReadFileOptions,
24
+ ReadFileOptionsWithBuffer,
25
+ ReadFileOptionsWithBufferEncoding,
26
+ ReadFileOptionsWithStringEncoding,
23
27
  ReadOptions,
24
28
  ReadOptionsWithBuffer,
25
29
  ReadPosition,
@@ -36,7 +40,6 @@ declare module "node:fs/promises" {
36
40
  WriteStream,
37
41
  WriteVResult,
38
42
  } from "node:fs";
39
- import { Stream } from "node:stream";
40
43
  import { ByteReadableStream, Transform, Writer } from "node:stream/iter";
41
44
  import { ReadableStream } from "node:stream/web";
42
45
  interface FileChangeInfo<T extends string | Buffer> {
@@ -357,39 +360,61 @@ declare module "node:fs/promises" {
357
360
  *
358
361
  * If `options` is a string, then it specifies the `encoding`.
359
362
  *
363
+ * If `buffer` is provided and no encoding is specified, the returned {Buffer} is
364
+ * a view over the supplied buffer containing only the bytes read. If the
365
+ * supplied buffer is too small to contain the entire file, the operation will
366
+ * fail.
367
+ *
360
368
  * The `FileHandle` has to support reading.
361
369
  *
362
- * If one or more `filehandle.read()` calls are made on a file handle and then a `filehandle.readFile()` call is made, the data will be read from the current
370
+ * If one or more `filehandle.read()` calls are made on a file handle and then a
371
+ * `filehandle.readFile()` call is made, the data will be read from the current
363
372
  * position till the end of the file. It doesn't always read from the beginning
364
373
  * of the file.
374
+ *
375
+ * An example using the `buffer` option with a pre-allocated buffer:
376
+ *
377
+ * ```js
378
+ * import { Buffer } from 'node:buffer';
379
+ * import { open } from 'node:fs/promises';
380
+ *
381
+ * const file = await open('./some/file/to/read');
382
+ * try {
383
+ * const buf = Buffer.alloc(16384);
384
+ * const contents = await file.readFile({ buffer: buf });
385
+ * console.log(contents); // A view over `buf` containing only the bytes read
386
+ * } finally {
387
+ * await file.close();
388
+ * }
389
+ * ```
390
+ *
391
+ * An example using the `buffer` option with a function returning a buffer:
392
+ *
393
+ * ```js
394
+ * import { Buffer } from 'node:buffer';
395
+ * import { open } from 'node:fs/promises';
396
+ *
397
+ * const file = await open('./some/file/to/read');
398
+ * try {
399
+ * const contents = await file.readFile({
400
+ * buffer: (size) => Buffer.alloc(size),
401
+ * });
402
+ * console.log(contents);
403
+ * } finally {
404
+ * await file.close();
405
+ * }
406
+ * ```
365
407
  * @since v10.0.0
366
- * @return Fulfills upon a successful read with the contents of the file. If no encoding is specified (using `options.encoding`), the data is returned as a {Buffer} object. Otherwise, the
367
- * data will be a string.
368
- */
369
- readFile(
370
- options?:
371
- | ({ encoding?: null | undefined } & Abortable)
372
- | null,
373
- ): Promise<NonSharedBuffer>;
374
- /**
375
- * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
376
- * The `FileHandle` must have been opened for reading.
408
+ * @returns Fulfills upon a successful read with the contents of the
409
+ * file. If no encoding is specified (using `options.encoding`), the data is
410
+ * returned as a `Buffer` object. Otherwise, the data will be a string.
377
411
  */
378
- readFile(
379
- options:
380
- | ({ encoding: BufferEncoding } & Abortable)
381
- | BufferEncoding,
382
- ): Promise<string>;
383
- /**
384
- * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
385
- * The `FileHandle` must have been opened for reading.
386
- */
387
- readFile(
388
- options?:
389
- | (ObjectEncodingOptions & Abortable)
390
- | BufferEncoding
391
- | null,
392
- ): Promise<string | NonSharedBuffer>;
412
+ readFile<T extends NodeJS.ArrayBufferView>(
413
+ options: Omit<ReadFileOptionsWithBuffer<T>, "flag">,
414
+ ): Promise<BufferView<T>>;
415
+ readFile(options?: Omit<ReadFileOptionsWithBufferEncoding, "flag"> | null): Promise<NonSharedBuffer>;
416
+ readFile(options: Omit<ReadFileOptionsWithStringEncoding, "flag"> | BufferEncoding): Promise<string>;
417
+ readFile(options: Omit<ReadFileOptions, "flag"> | BufferEncoding | null): Promise<string | NonSharedBuffer>;
393
418
  /**
394
419
  * Convenience method to create a `readline` interface and stream over the file.
395
420
  * See `filehandle.createReadStream()` for the options.
@@ -1310,50 +1335,21 @@ declare module "node:fs/promises" {
1310
1335
  * @param path filename or `FileHandle`
1311
1336
  * @return Fulfills with the contents of the file.
1312
1337
  */
1338
+ function readFile<T extends NodeJS.ArrayBufferView>(
1339
+ path: PathLike | FileHandle,
1340
+ options: ReadFileOptionsWithBuffer<T>,
1341
+ ): Promise<BufferView<T>>;
1313
1342
  function readFile(
1314
1343
  path: PathLike | FileHandle,
1315
- options?:
1316
- | ({
1317
- encoding?: null | undefined;
1318
- flag?: OpenMode | undefined;
1319
- } & Abortable)
1320
- | null,
1344
+ options?: ReadFileOptionsWithBufferEncoding | null,
1321
1345
  ): Promise<NonSharedBuffer>;
1322
- /**
1323
- * Asynchronously reads the entire contents of a file.
1324
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1325
- * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
1326
- * @param options An object that may contain an optional flag.
1327
- * If a flag is not provided, it defaults to `'r'`.
1328
- */
1329
1346
  function readFile(
1330
1347
  path: PathLike | FileHandle,
1331
- options:
1332
- | ({
1333
- encoding: BufferEncoding;
1334
- flag?: OpenMode | undefined;
1335
- } & Abortable)
1336
- | BufferEncoding,
1348
+ options: ReadFileOptionsWithStringEncoding | BufferEncoding,
1337
1349
  ): Promise<string>;
1338
- /**
1339
- * Asynchronously reads the entire contents of a file.
1340
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1341
- * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
1342
- * @param options An object that may contain an optional flag.
1343
- * If a flag is not provided, it defaults to `'r'`.
1344
- */
1345
1350
  function readFile(
1346
1351
  path: PathLike | FileHandle,
1347
- options?:
1348
- | (
1349
- & ObjectEncodingOptions
1350
- & Abortable
1351
- & {
1352
- flag?: OpenMode | undefined;
1353
- }
1354
- )
1355
- | BufferEncoding
1356
- | null,
1352
+ options: ReadFileOptions | BufferEncoding | null,
1357
1353
  ): Promise<string | NonSharedBuffer>;
1358
1354
  /**
1359
1355
  * Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail.
@@ -1,5 +1,5 @@
1
1
  declare module "node:fs" {
2
- import { NonSharedBuffer } from "node:buffer";
2
+ import { BufferView, NonSharedBuffer } from "node:buffer";
3
3
  import { Abortable, EventEmitter, InternalEventEmitter } from "node:events";
4
4
  import { FileHandle } from "node:fs/promises";
5
5
  import * as stream from "node:stream";
@@ -3029,6 +3029,19 @@ declare module "node:fs" {
3029
3029
  * If no `options` object is specified, it will default with the above values.
3030
3030
  */
3031
3031
  function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadOptions): number;
3032
+ interface ReadFileOptions extends Abortable {
3033
+ encoding?: BufferEncoding | null | undefined;
3034
+ flag?: OpenMode | undefined;
3035
+ }
3036
+ interface ReadFileOptionsWithStringEncoding extends ReadFileOptions {
3037
+ encoding: BufferEncoding;
3038
+ }
3039
+ interface ReadFileOptionsWithBufferEncoding extends ReadFileOptions {
3040
+ encoding?: null | undefined;
3041
+ }
3042
+ interface ReadFileOptionsWithBuffer<T extends NodeJS.ArrayBufferView> extends ReadFileOptionsWithBufferEncoding {
3043
+ buffer: T | ((size: number) => T);
3044
+ }
3032
3045
  /**
3033
3046
  * Asynchronously reads the entire contents of a file.
3034
3047
  *
@@ -3046,6 +3059,11 @@ declare module "node:fs" {
3046
3059
  *
3047
3060
  * If no encoding is specified, then the raw buffer is returned.
3048
3061
  *
3062
+ * If `buffer` is provided and no encoding is specified, the returned `Buffer` is
3063
+ * a view over the supplied buffer containing only the bytes read. If the
3064
+ * supplied buffer is too small to contain the entire file, the callback is
3065
+ * called with an error.
3066
+ *
3049
3067
  * If `options` is a string, then it specifies the encoding:
3050
3068
  *
3051
3069
  * ```js
@@ -3054,7 +3072,8 @@ declare module "node:fs" {
3054
3072
  * readFile('/etc/passwd', 'utf8', callback);
3055
3073
  * ```
3056
3074
  *
3057
- * When the path is a directory, the behavior of `fs.readFile()` and {@link readFileSync} is platform-specific. On macOS, Linux, and Windows, an
3075
+ * When the path is a directory, the behavior of `fs.readFile()` and
3076
+ * `fs.readFileSync()` is platform-specific. On macOS, Linux, and Windows, an
3058
3077
  * error will be returned. On FreeBSD, a representation of the directory's contents
3059
3078
  * will be returned.
3060
3079
  *
@@ -3092,60 +3111,56 @@ declare module "node:fs" {
3092
3111
  *
3093
3112
  * Aborting an ongoing request does not abort individual operating
3094
3113
  * system requests but rather the internal buffering `fs.readFile` performs.
3114
+ *
3115
+ * An example using the `buffer` option with a pre-allocated buffer:
3116
+ *
3117
+ * ```js
3118
+ * import { Buffer } from 'node:buffer';
3119
+ * import { readFile } from 'node:fs';
3120
+ *
3121
+ * const buf = Buffer.alloc(16384);
3122
+ * readFile('/path/to/file', { buffer: buf }, (err, data) => {
3123
+ * if (err) throw err;
3124
+ * console.log(data); // A view over `buf` containing only the bytes read
3125
+ * });
3126
+ * ```
3127
+ *
3128
+ * An example using the `buffer` option with a function returning a buffer:
3129
+ *
3130
+ * ```js
3131
+ * import { Buffer } from 'node:buffer';
3132
+ * import { readFile } from 'node:fs';
3133
+ *
3134
+ * readFile('/path/to/file', {
3135
+ * buffer: (size) => Buffer.alloc(size),
3136
+ * }, (err, data) => {
3137
+ * if (err) throw err;
3138
+ * console.log(data);
3139
+ * });
3140
+ * ```
3095
3141
  * @since v0.1.29
3096
3142
  * @param path filename or file descriptor
3097
3143
  */
3144
+ function readFile<T extends NodeJS.ArrayBufferView>(
3145
+ path: PathOrFileDescriptor,
3146
+ options: ReadFileOptionsWithBuffer<T>,
3147
+ callback: (err: NodeJS.ErrnoException | null, data: BufferView<T>) => void,
3148
+ ): void;
3098
3149
  function readFile(
3099
3150
  path: PathOrFileDescriptor,
3100
- options:
3101
- | ({
3102
- encoding?: null | undefined;
3103
- flag?: string | undefined;
3104
- } & Abortable)
3105
- | undefined
3106
- | null,
3151
+ options: ReadFileOptionsWithBufferEncoding | null | undefined,
3107
3152
  callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void,
3108
3153
  ): void;
3109
- /**
3110
- * Asynchronously reads the entire contents of a file.
3111
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
3112
- * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
3113
- * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
3114
- * If a flag is not provided, it defaults to `'r'`.
3115
- */
3116
3154
  function readFile(
3117
3155
  path: PathOrFileDescriptor,
3118
- options:
3119
- | ({
3120
- encoding: BufferEncoding;
3121
- flag?: string | undefined;
3122
- } & Abortable)
3123
- | BufferEncoding,
3156
+ options: ReadFileOptionsWithStringEncoding | BufferEncoding,
3124
3157
  callback: (err: NodeJS.ErrnoException | null, data: string) => void,
3125
3158
  ): void;
3126
- /**
3127
- * Asynchronously reads the entire contents of a file.
3128
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
3129
- * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
3130
- * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
3131
- * If a flag is not provided, it defaults to `'r'`.
3132
- */
3133
3159
  function readFile(
3134
3160
  path: PathOrFileDescriptor,
3135
- options:
3136
- | (ObjectEncodingOptions & {
3137
- flag?: string | undefined;
3138
- } & Abortable)
3139
- | BufferEncoding
3140
- | undefined
3141
- | null,
3161
+ options: ReadFileOptions | BufferEncoding | null | undefined,
3142
3162
  callback: (err: NodeJS.ErrnoException | null, data: string | NonSharedBuffer) => void,
3143
3163
  ): void;
3144
- /**
3145
- * Asynchronously reads the entire contents of a file.
3146
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
3147
- * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
3148
- */
3149
3164
  function readFile(
3150
3165
  path: PathOrFileDescriptor,
3151
3166
  callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void,
@@ -3200,16 +3215,37 @@ declare module "node:fs" {
3200
3215
  | null,
3201
3216
  ): Promise<string | NonSharedBuffer>;
3202
3217
  }
3218
+ interface ReadFileSyncOptions {
3219
+ encoding?: BufferEncoding | null | undefined;
3220
+ flag?: OpenMode | undefined;
3221
+ }
3222
+ interface ReadFileSyncOptionsWithStringEncoding extends ReadFileSyncOptions {
3223
+ encoding: BufferEncoding;
3224
+ }
3225
+ interface ReadFileSyncOptionsWithBufferEncoding extends ReadFileSyncOptions {
3226
+ encoding?: null | undefined;
3227
+ }
3228
+ interface ReadFileSyncOptionsWithBuffer<T extends NodeJS.ArrayBufferView>
3229
+ extends ReadFileSyncOptionsWithBufferEncoding
3230
+ {
3231
+ buffer: T | ((size: number) => T);
3232
+ }
3203
3233
  /**
3204
3234
  * Returns the contents of the `path`.
3205
3235
  *
3206
3236
  * For detailed information, see the documentation of the asynchronous version of
3207
- * this API: {@link readFile}.
3237
+ * this API: `fs.readFile()`.
3208
3238
  *
3209
3239
  * If the `encoding` option is specified then this function returns a
3210
3240
  * string. Otherwise it returns a buffer.
3211
3241
  *
3212
- * Similar to {@link readFile}, when the path is a directory, the behavior of `fs.readFileSync()` is platform-specific.
3242
+ * If `buffer` is provided and no encoding is specified, the returned {Buffer} is
3243
+ * a view over the supplied buffer containing only the bytes read. If the
3244
+ * supplied buffer is too small to contain the entire file, an error will be
3245
+ * thrown.
3246
+ *
3247
+ * Similar to `fs.readFile()`, when the path is a directory, the behavior of
3248
+ * `fs.readFileSync()` is platform-specific.
3213
3249
  *
3214
3250
  * ```js
3215
3251
  * import { readFileSync } from 'node:fs';
@@ -3224,45 +3260,19 @@ declare module "node:fs" {
3224
3260
  * @since v0.1.8
3225
3261
  * @param path filename or file descriptor
3226
3262
  */
3263
+ function readFileSync<T extends NodeJS.ArrayBufferView>(
3264
+ path: PathOrFileDescriptor,
3265
+ options: ReadFileSyncOptionsWithBuffer<T>,
3266
+ ): BufferView<T>;
3227
3267
  function readFileSync(
3228
3268
  path: PathOrFileDescriptor,
3229
- options?: {
3230
- encoding?: null | undefined;
3231
- flag?: string | undefined;
3232
- } | null,
3269
+ options?: ReadFileSyncOptionsWithBufferEncoding | null,
3233
3270
  ): NonSharedBuffer;
3234
- /**
3235
- * Synchronously reads the entire contents of a file.
3236
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
3237
- * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
3238
- * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
3239
- * If a flag is not provided, it defaults to `'r'`.
3240
- */
3241
3271
  function readFileSync(
3242
3272
  path: PathOrFileDescriptor,
3243
- options:
3244
- | {
3245
- encoding: BufferEncoding;
3246
- flag?: string | undefined;
3247
- }
3248
- | BufferEncoding,
3273
+ options: ReadFileSyncOptionsWithStringEncoding | BufferEncoding,
3249
3274
  ): string;
3250
- /**
3251
- * Synchronously reads the entire contents of a file.
3252
- * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
3253
- * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
3254
- * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
3255
- * If a flag is not provided, it defaults to `'r'`.
3256
- */
3257
- function readFileSync(
3258
- path: PathOrFileDescriptor,
3259
- options?:
3260
- | (ObjectEncodingOptions & {
3261
- flag?: string | undefined;
3262
- })
3263
- | BufferEncoding
3264
- | null,
3265
- ): string | NonSharedBuffer;
3275
+ function readFileSync(path: PathOrFileDescriptor, options: ReadFileSyncOptions): string | NonSharedBuffer;
3266
3276
  type WriteFileOptions =
3267
3277
  | (
3268
3278
  & ObjectEncodingOptions
@@ -299,7 +299,7 @@ declare module "node:http" {
299
299
  requireHostHeader?: boolean | undefined;
300
300
  /**
301
301
  * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received,
302
- * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`.
302
+ * similarly on what is done in `socket.setKeepAlive()`.
303
303
  * @default false
304
304
  * @since v16.5.0
305
305
  */
@@ -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 sent trailing
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 sent trailing
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
@@ -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" />
@@ -43,7 +43,8 @@ declare module "node:inspector" {
43
43
  */
44
44
  function open(port?: number, host?: string, wait?: boolean): Disposable;
45
45
  /**
46
- * Deactivate the inspector. Blocks until there are no active connections.
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
  /**