@node-red/editor-client 3.0.2 → 3.1.0-beta.2

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 (127) hide show
  1. package/locales/de/editor.json +2 -0
  2. package/locales/de/infotips.json +0 -0
  3. package/locales/de/jsonata.json +0 -0
  4. package/locales/en-US/editor.json +37 -6
  5. package/locales/en-US/infotips.json +0 -0
  6. package/locales/en-US/jsonata.json +0 -0
  7. package/locales/fr/editor.json +1238 -0
  8. package/locales/fr/infotips.json +23 -0
  9. package/locales/fr/jsonata.json +274 -0
  10. package/locales/ja/editor.json +48 -9
  11. package/locales/ko/editor.json +233 -31
  12. package/locales/ko/infotips.json +0 -0
  13. package/locales/ko/jsonata.json +0 -0
  14. package/locales/pt-BR/editor.json +1208 -0
  15. package/locales/pt-BR/infotips.json +23 -0
  16. package/locales/pt-BR/jsonata.json +274 -0
  17. package/locales/ru/editor.json +2 -0
  18. package/locales/ru/infotips.json +0 -0
  19. package/locales/ru/jsonata.json +0 -0
  20. package/locales/zh-CN/editor.json +1175 -1049
  21. package/locales/zh-TW/editor.json +3 -0
  22. package/package.json +1 -1
  23. package/public/red/about +140 -0
  24. package/public/red/red.js +2699 -1397
  25. package/public/red/red.min.js +4 -3
  26. package/public/red/style.min.css +1 -1
  27. package/public/red/tours/3.0/images/context-menu.png +0 -0
  28. package/public/red/tours/3.0/welcome.js +155 -0
  29. package/public/red/tours/images/context-menu.png +0 -0
  30. package/public/red/tours/images/global-env-vars.png +0 -0
  31. package/public/red/tours/images/hiding-flows.png +0 -0
  32. package/public/red/tours/images/locking-flows.png +0 -0
  33. package/public/red/tours/images/mermaid.png +0 -0
  34. package/public/red/tours/images/node-help.png +0 -0
  35. package/public/red/tours/images/tab-changes.png +0 -0
  36. package/public/red/tours/welcome.js +111 -94
  37. package/public/types/node/assert/strict.d.ts +11 -0
  38. package/public/types/node/assert.d.ts +898 -64
  39. package/public/types/node/async_hooks.d.ts +362 -94
  40. package/public/types/node/buffer.d.ts +2158 -14
  41. package/public/types/node/child_process.d.ts +1109 -257
  42. package/public/types/node/cluster.d.ts +349 -200
  43. package/public/types/node/console.d.ts +313 -43
  44. package/public/types/node/crypto.d.ts +3329 -656
  45. package/public/types/node/dgram.d.ts +459 -58
  46. package/public/types/node/diagnostics_channel.d.ts +155 -0
  47. package/public/types/node/dns/promises.d.ts +371 -0
  48. package/public/types/node/dns.d.ts +532 -265
  49. package/public/types/node/domain.d.ts +159 -16
  50. package/public/types/node/events.d.ts +589 -30
  51. package/public/types/node/fs/promises.d.ts +1097 -0
  52. package/public/types/node/fs.d.ts +2484 -958
  53. package/public/types/node/globals.d.ts +43 -503
  54. package/public/types/node/http.d.ts +1156 -145
  55. package/public/types/node/http2.d.ts +1610 -470
  56. package/public/types/node/https.d.ts +462 -72
  57. package/public/types/node/module.d.ts +72 -13
  58. package/public/types/node/net.d.ts +663 -131
  59. package/public/types/node/os.d.ts +238 -25
  60. package/public/types/node/path.d.ts +57 -23
  61. package/public/types/node/perf_hooks.d.ts +424 -112
  62. package/public/types/node/process.d.ts +1261 -193
  63. package/public/types/node/querystring.d.ts +107 -7
  64. package/public/types/node/readline.d.ts +443 -74
  65. package/public/types/node/stream/consumers.d.ts +15 -0
  66. package/public/types/node/stream/promises.d.ts +45 -0
  67. package/public/types/node/stream/web.d.ts +395 -0
  68. package/public/types/node/stream.d.ts +1081 -177
  69. package/public/types/node/string_decoder.d.ts +57 -0
  70. package/public/types/node/test.d.ts +193 -0
  71. package/public/types/node/timers/promises.d.ts +96 -0
  72. package/public/types/node/timers.d.ts +87 -12
  73. package/public/types/node/tls.d.ts +457 -222
  74. package/public/types/node/trace_events.d.ts +107 -10
  75. package/public/types/node/tty.d.ts +158 -23
  76. package/public/types/node/url.d.ts +734 -28
  77. package/public/types/node/util.d.ts +1542 -164
  78. package/public/types/node/v8.d.ts +261 -73
  79. package/public/types/node/vm.d.ts +384 -32
  80. package/public/types/node/wasi.d.ts +92 -23
  81. package/public/types/node/worker_threads.d.ts +531 -123
  82. package/public/types/node/zlib.d.ts +216 -63
  83. package/public/types/node-red/func.d.ts +3 -0
  84. package/public/vendor/jquery/css/base/images/ui-icons_444444_256x240.png +0 -0
  85. package/public/vendor/jquery/css/base/images/ui-icons_555555_256x240.png +0 -0
  86. package/public/vendor/jquery/css/base/images/ui-icons_777620_256x240.png +0 -0
  87. package/public/vendor/jquery/css/base/images/ui-icons_777777_256x240.png +0 -0
  88. package/public/vendor/jquery/css/base/images/ui-icons_cc0000_256x240.png +0 -0
  89. package/public/vendor/jquery/css/base/images/ui-icons_ffffff_256x240.png +0 -0
  90. package/public/vendor/jquery/css/base/jquery-ui.min.css +4 -4
  91. package/public/vendor/mermaid/mermaid.min.js +1284 -0
  92. package/public/vendor/monaco/dist/{ade705761eb7e702770d.ttf → 7064e66c3890a12c47b4.ttf} +0 -0
  93. package/public/vendor/monaco/dist/css.worker.js +1 -1
  94. package/public/vendor/monaco/dist/css.worker.js.LICENSE.txt +1 -1
  95. package/public/vendor/monaco/dist/editor.js +1 -1
  96. package/public/vendor/monaco/dist/editor.js.LICENSE.txt +5 -1
  97. package/public/vendor/monaco/dist/editor.worker.js +1 -1
  98. package/public/vendor/monaco/dist/html.worker.js +1 -1
  99. package/public/vendor/monaco/dist/html.worker.js.LICENSE.txt +1 -1
  100. package/public/vendor/monaco/dist/json.worker.js +1 -1
  101. package/public/vendor/monaco/dist/json.worker.js.LICENSE.txt +1 -1
  102. package/public/vendor/monaco/dist/locale/cs.js +319 -71
  103. package/public/vendor/monaco/dist/locale/de.js +323 -75
  104. package/public/vendor/monaco/dist/locale/es.js +318 -70
  105. package/public/vendor/monaco/dist/locale/fr.js +327 -79
  106. package/public/vendor/monaco/dist/locale/it.js +325 -77
  107. package/public/vendor/monaco/dist/locale/ja.js +337 -89
  108. package/public/vendor/monaco/dist/locale/ko.js +324 -76
  109. package/public/vendor/monaco/dist/locale/pl.js +322 -74
  110. package/public/vendor/monaco/dist/locale/pt-br.js +321 -73
  111. package/public/vendor/monaco/dist/locale/qps-ploc.js +1580 -1332
  112. package/public/vendor/monaco/dist/locale/ru.js +324 -76
  113. package/public/vendor/monaco/dist/locale/tr.js +326 -78
  114. package/public/vendor/monaco/dist/locale/zh-hans.js +328 -80
  115. package/public/vendor/monaco/dist/locale/zh-hant.js +321 -73
  116. package/public/vendor/monaco/dist/theme/forge.json +236 -0
  117. package/public/vendor/monaco/dist/theme/github-dark.json +348 -0
  118. package/public/vendor/monaco/dist/theme/github-light.json +348 -0
  119. package/public/vendor/monaco/dist/theme/nord.json +93 -0
  120. package/public/vendor/monaco/dist/ts.worker.js +1 -1
  121. package/public/vendor/monaco/dist/ts.worker.js.LICENSE.txt +14 -6
  122. package/public/vendor/vendor.js +9 -15
  123. /package/public/red/tours/{images → 3.0/images}/continuous-search.png +0 -0
  124. /package/public/red/tours/{images → 3.0/images}/debug-path-tooltip.png +0 -0
  125. /package/public/red/tours/{images → 3.0/images}/junction-quick-add.png +0 -0
  126. /package/public/red/tours/{images → 3.0/images}/junction-slice.gif +0 -0
  127. /package/public/red/tours/{images → 3.0/images}/split-wire-with-links.gif +0 -0
@@ -1,28 +1,51 @@
1
1
 
2
2
  /* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/Steve-Mcl/monaco-editor-esm-i18n */
3
3
 
4
+ /**
5
+ * The `dgram` module provides an implementation of UDP datagram sockets.
6
+ *
7
+ * ```js
8
+ * import dgram from 'dgram';
9
+ *
10
+ * const server = dgram.createSocket('udp4');
11
+ *
12
+ * server.on('error', (err) => {
13
+ * console.log(`server error:\n${err.stack}`);
14
+ * server.close();
15
+ * });
16
+ *
17
+ * server.on('message', (msg, rinfo) => {
18
+ * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
19
+ * });
20
+ *
21
+ * server.on('listening', () => {
22
+ * const address = server.address();
23
+ * console.log(`server listening ${address.address}:${address.port}`);
24
+ * });
25
+ *
26
+ * server.bind(41234);
27
+ * // Prints: server listening 0.0.0.0:41234
28
+ * ```
29
+ * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/dgram.js)
30
+ */
4
31
  declare module 'dgram' {
5
- import { AddressInfo } from 'net';
6
- import * as dns from 'dns';
7
- import EventEmitter = require('events');
8
-
32
+ import { AddressInfo } from 'node:net';
33
+ import * as dns from 'node:dns';
34
+ import { EventEmitter, Abortable } from 'node:events';
9
35
  interface RemoteInfo {
10
36
  address: string;
11
37
  family: 'IPv4' | 'IPv6';
12
38
  port: number;
13
39
  size: number;
14
40
  }
15
-
16
41
  interface BindOptions {
17
42
  port?: number | undefined;
18
43
  address?: string | undefined;
19
44
  exclusive?: boolean | undefined;
20
45
  fd?: number | undefined;
21
46
  }
22
-
23
- type SocketType = "udp4" | "udp6";
24
-
25
- interface SocketOptions {
47
+ type SocketType = 'udp4' | 'udp6';
48
+ interface SocketOptions extends Abortable {
26
49
  type: SocketType;
27
50
  reuseAddr?: boolean | undefined;
28
51
  /**
@@ -33,64 +56,447 @@ declare module 'dgram' {
33
56
  sendBufferSize?: number | undefined;
34
57
  lookup?: ((hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void) | undefined;
35
58
  }
36
-
59
+ /**
60
+ * Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram
61
+ * messages. When `address` and `port` are not passed to `socket.bind()` the
62
+ * method will bind the socket to the "all interfaces" address on a random port
63
+ * (it does the right thing for both `udp4` and `udp6` sockets). The bound address
64
+ * and port can be retrieved using `socket.address().address` and `socket.address().port`.
65
+ *
66
+ * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.close()` on the socket:
67
+ *
68
+ * ```js
69
+ * const controller = new AbortController();
70
+ * const { signal } = controller;
71
+ * const server = dgram.createSocket({ type: 'udp4', signal });
72
+ * server.on('message', (msg, rinfo) => {
73
+ * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
74
+ * });
75
+ * // Later, when you want to close the server.
76
+ * controller.abort();
77
+ * ```
78
+ * @since v0.11.13
79
+ * @param options Available options are:
80
+ * @param callback Attached as a listener for `'message'` events. Optional.
81
+ */
37
82
  function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
38
83
  function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
39
-
84
+ /**
85
+ * Encapsulates the datagram functionality.
86
+ *
87
+ * New instances of `dgram.Socket` are created using {@link createSocket}.
88
+ * The `new` keyword is not to be used to create `dgram.Socket` instances.
89
+ * @since v0.1.99
90
+ */
40
91
  class Socket extends EventEmitter {
92
+ /**
93
+ * Tells the kernel to join a multicast group at the given `multicastAddress` and`multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the`multicastInterface` argument is not
94
+ * specified, the operating system will choose
95
+ * one interface and will add membership to it. To add membership to every
96
+ * available interface, call `addMembership` multiple times, once per interface.
97
+ *
98
+ * When called on an unbound socket, this method will implicitly bind to a random
99
+ * port, listening on all interfaces.
100
+ *
101
+ * When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur:
102
+ *
103
+ * ```js
104
+ * import cluster from 'cluster';
105
+ * import dgram from 'dgram';
106
+ *
107
+ * if (cluster.isPrimary) {
108
+ * cluster.fork(); // Works ok.
109
+ * cluster.fork(); // Fails with EADDRINUSE.
110
+ * } else {
111
+ * const s = dgram.createSocket('udp4');
112
+ * s.bind(1234, () => {
113
+ * s.addMembership('224.0.0.114');
114
+ * });
115
+ * }
116
+ * ```
117
+ * @since v0.6.9
118
+ */
41
119
  addMembership(multicastAddress: string, multicastInterface?: string): void;
120
+ /**
121
+ * Returns an object containing the address information for a socket.
122
+ * For UDP sockets, this object will contain `address`, `family` and `port`properties.
123
+ *
124
+ * This method throws `EBADF` if called on an unbound socket.
125
+ * @since v0.1.99
126
+ */
42
127
  address(): AddressInfo;
128
+ /**
129
+ * For UDP sockets, causes the `dgram.Socket` to listen for datagram
130
+ * messages on a named `port` and optional `address`. If `port` is not
131
+ * specified or is `0`, the operating system will attempt to bind to a
132
+ * random port. If `address` is not specified, the operating system will
133
+ * attempt to listen on all addresses. Once binding is complete, a`'listening'` event is emitted and the optional `callback` function is
134
+ * called.
135
+ *
136
+ * Specifying both a `'listening'` event listener and passing a`callback` to the `socket.bind()` method is not harmful but not very
137
+ * useful.
138
+ *
139
+ * A bound datagram socket keeps the Node.js process running to receive
140
+ * datagram messages.
141
+ *
142
+ * If binding fails, an `'error'` event is generated. In rare case (e.g.
143
+ * attempting to bind with a closed socket), an `Error` may be thrown.
144
+ *
145
+ * Example of a UDP server listening on port 41234:
146
+ *
147
+ * ```js
148
+ * import dgram from 'dgram';
149
+ *
150
+ * const server = dgram.createSocket('udp4');
151
+ *
152
+ * server.on('error', (err) => {
153
+ * console.log(`server error:\n${err.stack}`);
154
+ * server.close();
155
+ * });
156
+ *
157
+ * server.on('message', (msg, rinfo) => {
158
+ * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
159
+ * });
160
+ *
161
+ * server.on('listening', () => {
162
+ * const address = server.address();
163
+ * console.log(`server listening ${address.address}:${address.port}`);
164
+ * });
165
+ *
166
+ * server.bind(41234);
167
+ * // Prints: server listening 0.0.0.0:41234
168
+ * ```
169
+ * @since v0.1.99
170
+ * @param callback with no parameters. Called when binding is complete.
171
+ */
43
172
  bind(port?: number, address?: string, callback?: () => void): this;
44
173
  bind(port?: number, callback?: () => void): this;
45
174
  bind(callback?: () => void): this;
46
175
  bind(options: BindOptions, callback?: () => void): this;
176
+ /**
177
+ * Close the underlying socket and stop listening for data on it. If a callback is
178
+ * provided, it is added as a listener for the `'close'` event.
179
+ * @since v0.1.99
180
+ * @param callback Called when the socket has been closed.
181
+ */
47
182
  close(callback?: () => void): this;
183
+ /**
184
+ * Associates the `dgram.Socket` to a remote address and port. Every
185
+ * message sent by this handle is automatically sent to that destination. Also,
186
+ * the socket will only receive messages from that remote peer.
187
+ * Trying to call `connect()` on an already connected socket will result
188
+ * in an `ERR_SOCKET_DGRAM_IS_CONNECTED` exception. If `address` is not
189
+ * provided, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets)
190
+ * will be used by default. Once the connection is complete, a `'connect'` event
191
+ * is emitted and the optional `callback` function is called. In case of failure,
192
+ * the `callback` is called or, failing this, an `'error'` event is emitted.
193
+ * @since v12.0.0
194
+ * @param callback Called when the connection is completed or on error.
195
+ */
48
196
  connect(port: number, address?: string, callback?: () => void): void;
49
197
  connect(port: number, callback: () => void): void;
198
+ /**
199
+ * A synchronous function that disassociates a connected `dgram.Socket` from
200
+ * its remote address. Trying to call `disconnect()` on an unbound or already
201
+ * disconnected socket will result in an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception.
202
+ * @since v12.0.0
203
+ */
50
204
  disconnect(): void;
205
+ /**
206
+ * Instructs the kernel to leave a multicast group at `multicastAddress` using the`IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the
207
+ * kernel when the socket is closed or the process terminates, so most apps will
208
+ * never have reason to call this.
209
+ *
210
+ * If `multicastInterface` is not specified, the operating system will attempt to
211
+ * drop membership on all valid interfaces.
212
+ * @since v0.6.9
213
+ */
51
214
  dropMembership(multicastAddress: string, multicastInterface?: string): void;
215
+ /**
216
+ * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
217
+ * @since v8.7.0
218
+ * @return the `SO_RCVBUF` socket receive buffer size in bytes.
219
+ */
52
220
  getRecvBufferSize(): number;
221
+ /**
222
+ * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
223
+ * @since v8.7.0
224
+ * @return the `SO_SNDBUF` socket send buffer size in bytes.
225
+ */
53
226
  getSendBufferSize(): number;
227
+ /**
228
+ * By default, binding a socket will cause it to block the Node.js process from
229
+ * exiting as long as the socket is open. The `socket.unref()` method can be used
230
+ * to exclude the socket from the reference counting that keeps the Node.js
231
+ * process active. The `socket.ref()` method adds the socket back to the reference
232
+ * counting and restores the default behavior.
233
+ *
234
+ * Calling `socket.ref()` multiples times will have no additional effect.
235
+ *
236
+ * The `socket.ref()` method returns a reference to the socket so calls can be
237
+ * chained.
238
+ * @since v0.9.1
239
+ */
54
240
  ref(): this;
241
+ /**
242
+ * Returns an object containing the `address`, `family`, and `port` of the remote
243
+ * endpoint. This method throws an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception
244
+ * if the socket is not connected.
245
+ * @since v12.0.0
246
+ */
55
247
  remoteAddress(): AddressInfo;
248
+ /**
249
+ * Broadcasts a datagram on the socket.
250
+ * For connectionless sockets, the destination `port` and `address` must be
251
+ * specified. Connected sockets, on the other hand, will use their associated
252
+ * remote endpoint, so the `port` and `address` arguments must not be set.
253
+ *
254
+ * The `msg` argument contains the message to be sent.
255
+ * Depending on its type, different behavior can apply. If `msg` is a `Buffer`,
256
+ * any `TypedArray` or a `DataView`,
257
+ * the `offset` and `length` specify the offset within the `Buffer` where the
258
+ * message begins and the number of bytes in the message, respectively.
259
+ * If `msg` is a `String`, then it is automatically converted to a `Buffer`with `'utf8'` encoding. With messages that
260
+ * contain multi-byte characters, `offset` and `length` will be calculated with
261
+ * respect to `byte length` and not the character position.
262
+ * If `msg` is an array, `offset` and `length` must not be specified.
263
+ *
264
+ * The `address` argument is a string. If the value of `address` is a host name,
265
+ * DNS will be used to resolve the address of the host. If `address` is not
266
+ * provided or otherwise falsy, `'127.0.0.1'` (for `udp4` sockets) or `'::1'`(for `udp6` sockets) will be used by default.
267
+ *
268
+ * If the socket has not been previously bound with a call to `bind`, the socket
269
+ * is assigned a random port number and is bound to the "all interfaces" address
270
+ * (`'0.0.0.0'` for `udp4` sockets, `'::0'` for `udp6` sockets.)
271
+ *
272
+ * An optional `callback` function may be specified to as a way of reporting
273
+ * DNS errors or for determining when it is safe to reuse the `buf` object.
274
+ * DNS lookups delay the time to send for at least one tick of the
275
+ * Node.js event loop.
276
+ *
277
+ * The only way to know for sure that the datagram has been sent is by using a`callback`. If an error occurs and a `callback` is given, the error will be
278
+ * passed as the first argument to the `callback`. If a `callback` is not given,
279
+ * the error is emitted as an `'error'` event on the `socket` object.
280
+ *
281
+ * Offset and length are optional but both _must_ be set if either are used.
282
+ * They are supported only when the first argument is a `Buffer`, a `TypedArray`,
283
+ * or a `DataView`.
284
+ *
285
+ * This method throws `ERR_SOCKET_BAD_PORT` if called on an unbound socket.
286
+ *
287
+ * Example of sending a UDP packet to a port on `localhost`;
288
+ *
289
+ * ```js
290
+ * import dgram from 'dgram';
291
+ * import { Buffer } from 'buffer';
292
+ *
293
+ * const message = Buffer.from('Some bytes');
294
+ * const client = dgram.createSocket('udp4');
295
+ * client.send(message, 41234, 'localhost', (err) => {
296
+ * client.close();
297
+ * });
298
+ * ```
299
+ *
300
+ * Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`;
301
+ *
302
+ * ```js
303
+ * import dgram from 'dgram';
304
+ * import { Buffer } from 'buffer';
305
+ *
306
+ * const buf1 = Buffer.from('Some ');
307
+ * const buf2 = Buffer.from('bytes');
308
+ * const client = dgram.createSocket('udp4');
309
+ * client.send([buf1, buf2], 41234, (err) => {
310
+ * client.close();
311
+ * });
312
+ * ```
313
+ *
314
+ * Sending multiple buffers might be faster or slower depending on the
315
+ * application and operating system. Run benchmarks to
316
+ * determine the optimal strategy on a case-by-case basis. Generally speaking,
317
+ * however, sending multiple buffers is faster.
318
+ *
319
+ * Example of sending a UDP packet using a socket connected to a port on`localhost`:
320
+ *
321
+ * ```js
322
+ * import dgram from 'dgram';
323
+ * import { Buffer } from 'buffer';
324
+ *
325
+ * const message = Buffer.from('Some bytes');
326
+ * const client = dgram.createSocket('udp4');
327
+ * client.connect(41234, 'localhost', (err) => {
328
+ * client.send(message, (err) => {
329
+ * client.close();
330
+ * });
331
+ * });
332
+ * ```
333
+ * @since v0.1.99
334
+ * @param msg Message to be sent.
335
+ * @param offset Offset in the buffer where the message starts.
336
+ * @param length Number of bytes in the message.
337
+ * @param port Destination port.
338
+ * @param address Destination host name or IP address.
339
+ * @param callback Called when the message has been sent.
340
+ */
56
341
  send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
57
342
  send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
58
343
  send(msg: string | Uint8Array | ReadonlyArray<any>, callback?: (error: Error | null, bytes: number) => void): void;
59
344
  send(msg: string | Uint8Array, offset: number, length: number, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
60
345
  send(msg: string | Uint8Array, offset: number, length: number, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
61
346
  send(msg: string | Uint8Array, offset: number, length: number, callback?: (error: Error | null, bytes: number) => void): void;
347
+ /**
348
+ * Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP
349
+ * packets may be sent to a local interface's broadcast address.
350
+ *
351
+ * This method throws `EBADF` if called on an unbound socket.
352
+ * @since v0.6.9
353
+ */
62
354
  setBroadcast(flag: boolean): void;
355
+ /**
356
+ * _All references to scope in this section are referring to [IPv6 Zone Indices](https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses), which are defined by [RFC
357
+ * 4007](https://tools.ietf.org/html/rfc4007). In string form, an IP_
358
+ * _with a scope index is written as `'IP%scope'` where scope is an interface name_
359
+ * _or interface number._
360
+ *
361
+ * Sets the default outgoing multicast interface of the socket to a chosen
362
+ * interface or back to system interface selection. The `multicastInterface` must
363
+ * be a valid string representation of an IP from the socket's family.
364
+ *
365
+ * For IPv4 sockets, this should be the IP configured for the desired physical
366
+ * interface. All packets sent to multicast on the socket will be sent on the
367
+ * interface determined by the most recent successful use of this call.
368
+ *
369
+ * For IPv6 sockets, `multicastInterface` should include a scope to indicate the
370
+ * interface as in the examples that follow. In IPv6, individual `send` calls can
371
+ * also use explicit scope in addresses, so only packets sent to a multicast
372
+ * address without specifying an explicit scope are affected by the most recent
373
+ * successful use of this call.
374
+ *
375
+ * This method throws `EBADF` if called on an unbound socket.
376
+ *
377
+ * #### Example: IPv6 outgoing multicast interface
378
+ *
379
+ * On most systems, where scope format uses the interface name:
380
+ *
381
+ * ```js
382
+ * const socket = dgram.createSocket('udp6');
383
+ *
384
+ * socket.bind(1234, () => {
385
+ * socket.setMulticastInterface('::%eth1');
386
+ * });
387
+ * ```
388
+ *
389
+ * On Windows, where scope format uses an interface number:
390
+ *
391
+ * ```js
392
+ * const socket = dgram.createSocket('udp6');
393
+ *
394
+ * socket.bind(1234, () => {
395
+ * socket.setMulticastInterface('::%2');
396
+ * });
397
+ * ```
398
+ *
399
+ * #### Example: IPv4 outgoing multicast interface
400
+ *
401
+ * All systems use an IP of the host on the desired physical interface:
402
+ *
403
+ * ```js
404
+ * const socket = dgram.createSocket('udp4');
405
+ *
406
+ * socket.bind(1234, () => {
407
+ * socket.setMulticastInterface('10.0.0.2');
408
+ * });
409
+ * ```
410
+ * @since v8.6.0
411
+ */
63
412
  setMulticastInterface(multicastInterface: string): void;
413
+ /**
414
+ * Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`,
415
+ * multicast packets will also be received on the local interface.
416
+ *
417
+ * This method throws `EBADF` if called on an unbound socket.
418
+ * @since v0.3.8
419
+ */
64
420
  setMulticastLoopback(flag: boolean): boolean;
421
+ /**
422
+ * Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for
423
+ * "Time to Live", in this context it specifies the number of IP hops that a
424
+ * packet is allowed to travel through, specifically for multicast traffic. Each
425
+ * router or gateway that forwards a packet decrements the TTL. If the TTL is
426
+ * decremented to 0 by a router, it will not be forwarded.
427
+ *
428
+ * The `ttl` argument may be between 0 and 255\. The default on most systems is `1`.
429
+ *
430
+ * This method throws `EBADF` if called on an unbound socket.
431
+ * @since v0.3.8
432
+ */
65
433
  setMulticastTTL(ttl: number): number;
434
+ /**
435
+ * Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer
436
+ * in bytes.
437
+ *
438
+ * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
439
+ * @since v8.7.0
440
+ */
66
441
  setRecvBufferSize(size: number): void;
442
+ /**
443
+ * Sets the `SO_SNDBUF` socket option. Sets the maximum socket send buffer
444
+ * in bytes.
445
+ *
446
+ * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
447
+ * @since v8.7.0
448
+ */
67
449
  setSendBufferSize(size: number): void;
450
+ /**
451
+ * Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live",
452
+ * in this context it specifies the number of IP hops that a packet is allowed to
453
+ * travel through. Each router or gateway that forwards a packet decrements the
454
+ * TTL. If the TTL is decremented to 0 by a router, it will not be forwarded.
455
+ * Changing TTL values is typically done for network probes or when multicasting.
456
+ *
457
+ * The `ttl` argument may be between between 1 and 255\. The default on most systems
458
+ * is 64.
459
+ *
460
+ * This method throws `EBADF` if called on an unbound socket.
461
+ * @since v0.1.101
462
+ */
68
463
  setTTL(ttl: number): number;
464
+ /**
465
+ * By default, binding a socket will cause it to block the Node.js process from
466
+ * exiting as long as the socket is open. The `socket.unref()` method can be used
467
+ * to exclude the socket from the reference counting that keeps the Node.js
468
+ * process active, allowing the process to exit even if the socket is still
469
+ * listening.
470
+ *
471
+ * Calling `socket.unref()` multiple times will have no addition effect.
472
+ *
473
+ * The `socket.unref()` method returns a reference to the socket so calls can be
474
+ * chained.
475
+ * @since v0.9.1
476
+ */
69
477
  unref(): this;
70
478
  /**
71
- * Tells the kernel to join a source-specific multicast channel at the given
72
- * `sourceAddress` and `groupAddress`, using the `multicastInterface` with the
73
- * `IP_ADD_SOURCE_MEMBERSHIP` socket option.
74
- * If the `multicastInterface` argument
479
+ * Tells the kernel to join a source-specific multicast channel at the given`sourceAddress` and `groupAddress`, using the `multicastInterface` with the`IP_ADD_SOURCE_MEMBERSHIP` socket
480
+ * option. If the `multicastInterface` argument
75
481
  * is not specified, the operating system will choose one interface and will add
76
- * membership to it.
77
- * To add membership to every available interface, call
78
- * `socket.addSourceSpecificMembership()` multiple times, once per interface.
482
+ * membership to it. To add membership to every available interface, call`socket.addSourceSpecificMembership()` multiple times, once per interface.
483
+ *
484
+ * When called on an unbound socket, this method will implicitly bind to a random
485
+ * port, listening on all interfaces.
486
+ * @since v13.1.0, v12.16.0
79
487
  */
80
488
  addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
81
-
82
489
  /**
83
- * Instructs the kernel to leave a source-specific multicast channel at the given
84
- * `sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP`
85
- * socket option. This method is automatically called by the kernel when the
490
+ * Instructs the kernel to leave a source-specific multicast channel at the given`sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP`socket option. This method is
491
+ * automatically called by the kernel when the
86
492
  * socket is closed or the process terminates, so most apps will never have
87
493
  * reason to call this.
88
494
  *
89
495
  * If `multicastInterface` is not specified, the operating system will attempt to
90
496
  * drop membership on all valid interfaces.
497
+ * @since v13.1.0, v12.16.0
91
498
  */
92
499
  dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
93
-
94
500
  /**
95
501
  * events.EventEmitter
96
502
  * 1. close
@@ -100,46 +506,41 @@ declare module 'dgram' {
100
506
  * 5. message
101
507
  */
102
508
  addListener(event: string, listener: (...args: any[]) => void): this;
103
- addListener(event: "close", listener: () => void): this;
104
- addListener(event: "connect", listener: () => void): this;
105
- addListener(event: "error", listener: (err: Error) => void): this;
106
- addListener(event: "listening", listener: () => void): this;
107
- addListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
108
-
509
+ addListener(event: 'close', listener: () => void): this;
510
+ addListener(event: 'connect', listener: () => void): this;
511
+ addListener(event: 'error', listener: (err: Error) => void): this;
512
+ addListener(event: 'listening', listener: () => void): this;
513
+ addListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
109
514
  emit(event: string | symbol, ...args: any[]): boolean;
110
- emit(event: "close"): boolean;
111
- emit(event: "connect"): boolean;
112
- emit(event: "error", err: Error): boolean;
113
- emit(event: "listening"): boolean;
114
- emit(event: "message", msg: Buffer, rinfo: RemoteInfo): boolean;
115
-
515
+ emit(event: 'close'): boolean;
516
+ emit(event: 'connect'): boolean;
517
+ emit(event: 'error', err: Error): boolean;
518
+ emit(event: 'listening'): boolean;
519
+ emit(event: 'message', msg: Buffer, rinfo: RemoteInfo): boolean;
116
520
  on(event: string, listener: (...args: any[]) => void): this;
117
- on(event: "close", listener: () => void): this;
118
- on(event: "connect", listener: () => void): this;
119
- on(event: "error", listener: (err: Error) => void): this;
120
- on(event: "listening", listener: () => void): this;
121
- on(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
122
-
521
+ on(event: 'close', listener: () => void): this;
522
+ on(event: 'connect', listener: () => void): this;
523
+ on(event: 'error', listener: (err: Error) => void): this;
524
+ on(event: 'listening', listener: () => void): this;
525
+ on(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
123
526
  once(event: string, listener: (...args: any[]) => void): this;
124
- once(event: "close", listener: () => void): this;
125
- once(event: "connect", listener: () => void): this;
126
- once(event: "error", listener: (err: Error) => void): this;
127
- once(event: "listening", listener: () => void): this;
128
- once(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
129
-
527
+ once(event: 'close', listener: () => void): this;
528
+ once(event: 'connect', listener: () => void): this;
529
+ once(event: 'error', listener: (err: Error) => void): this;
530
+ once(event: 'listening', listener: () => void): this;
531
+ once(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
130
532
  prependListener(event: string, listener: (...args: any[]) => void): this;
131
- prependListener(event: "close", listener: () => void): this;
132
- prependListener(event: "connect", listener: () => void): this;
133
- prependListener(event: "error", listener: (err: Error) => void): this;
134
- prependListener(event: "listening", listener: () => void): this;
135
- prependListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
136
-
533
+ prependListener(event: 'close', listener: () => void): this;
534
+ prependListener(event: 'connect', listener: () => void): this;
535
+ prependListener(event: 'error', listener: (err: Error) => void): this;
536
+ prependListener(event: 'listening', listener: () => void): this;
537
+ prependListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
137
538
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
138
- prependOnceListener(event: "close", listener: () => void): this;
139
- prependOnceListener(event: "connect", listener: () => void): this;
140
- prependOnceListener(event: "error", listener: (err: Error) => void): this;
141
- prependOnceListener(event: "listening", listener: () => void): this;
142
- prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
539
+ prependOnceListener(event: 'close', listener: () => void): this;
540
+ prependOnceListener(event: 'connect', listener: () => void): this;
541
+ prependOnceListener(event: 'error', listener: (err: Error) => void): this;
542
+ prependOnceListener(event: 'listening', listener: () => void): this;
543
+ prependOnceListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
143
544
  }
144
545
  }
145
546
  declare module 'node:dgram' {