@node-red/editor-client 3.1.8 → 4.0.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 (149) hide show
  1. package/locales/de/editor.json +2 -0
  2. package/locales/en-US/editor.json +10 -1
  3. package/locales/fr/editor.json +8 -1
  4. package/locales/ja/editor.json +10 -3
  5. package/package.json +1 -1
  6. package/public/red/about +52 -0
  7. package/public/red/red.js +1433 -263
  8. package/public/red/red.min.js +3 -3
  9. package/public/red/style.min.css +2 -2
  10. package/public/red/tours/3.1/welcome.js +231 -0
  11. package/public/red/tours/images/nr4-auto-complete.png +0 -0
  12. package/public/red/tours/images/nr4-config-select.png +0 -0
  13. package/public/red/tours/images/nr4-multiplayer.png +0 -0
  14. package/public/red/tours/images/nr4-plugins.png +0 -0
  15. package/public/red/tours/images/nr4-sf-config.png +0 -0
  16. package/public/red/tours/images/nr4-timestamp-formatting.png +0 -0
  17. package/public/red/tours/welcome.js +105 -161
  18. package/public/types/node/assert/strict.d.ts +1 -1
  19. package/public/types/node/assert.d.ts +8 -9
  20. package/public/types/node/async_hooks.d.ts +9 -5
  21. package/public/types/node/buffer.d.ts +43 -18
  22. package/public/types/node/child_process.d.ts +8 -5
  23. package/public/types/node/cluster.d.ts +15 -19
  24. package/public/types/node/console.d.ts +2 -2
  25. package/public/types/node/crypto.d.ts +165 -70
  26. package/public/types/node/dgram.d.ts +4 -4
  27. package/public/types/node/diagnostics_channel.d.ts +8 -7
  28. package/public/types/node/dns/promises.d.ts +11 -9
  29. package/public/types/node/dns.d.ts +18 -13
  30. package/public/types/node/dom-events.d.ts +129 -0
  31. package/public/types/node/domain.d.ts +2 -2
  32. package/public/types/node/events.d.ts +49 -12
  33. package/public/types/node/fs/promises.d.ts +68 -24
  34. package/public/types/node/fs.d.ts +132 -59
  35. package/public/types/node/globals.d.ts +31 -17
  36. package/public/types/node/http.d.ts +138 -27
  37. package/public/types/node/http2.d.ts +38 -5
  38. package/public/types/node/https.d.ts +12 -3
  39. package/public/types/node/module.d.ts +1 -2
  40. package/public/types/node/net.d.ts +69 -28
  41. package/public/types/node/os.d.ts +16 -5
  42. package/public/types/node/path.d.ts +5 -5
  43. package/public/types/node/perf_hooks.d.ts +48 -9
  44. package/public/types/node/process.d.ts +18 -17
  45. package/public/types/node/querystring.d.ts +2 -2
  46. package/public/types/node/readline/promises.d.ts +146 -0
  47. package/public/types/node/readline.d.ts +141 -31
  48. package/public/types/node/stream/consumers.d.ts +2 -2
  49. package/public/types/node/stream/promises.d.ts +1 -1
  50. package/public/types/node/stream/web.d.ts +4 -66
  51. package/public/types/node/stream.d.ts +96 -118
  52. package/public/types/node/string_decoder.d.ts +2 -2
  53. package/public/types/node/test.d.ts +200 -16
  54. package/public/types/node/timers/promises.d.ts +1 -26
  55. package/public/types/node/timers.d.ts +2 -2
  56. package/public/types/node/tls.d.ts +21 -12
  57. package/public/types/node/trace_events.d.ts +12 -2
  58. package/public/types/node/ts4.8/assert/strict.d.ts +11 -0
  59. package/public/types/node/ts4.8/assert.d.ts +964 -0
  60. package/public/types/node/ts4.8/async_hooks.d.ts +504 -0
  61. package/public/types/node/ts4.8/buffer.d.ts +2262 -0
  62. package/public/types/node/ts4.8/child_process.d.ts +1372 -0
  63. package/public/types/node/ts4.8/cluster.d.ts +413 -0
  64. package/public/types/node/ts4.8/console.d.ts +415 -0
  65. package/public/types/node/ts4.8/crypto.d.ts +3967 -0
  66. package/public/types/node/ts4.8/dgram.d.ts +548 -0
  67. package/public/types/node/ts4.8/diagnostics_channel.d.ts +156 -0
  68. package/public/types/node/ts4.8/dns/promises.d.ts +373 -0
  69. package/public/types/node/ts4.8/dns.d.ts +662 -0
  70. package/public/types/node/ts4.8/dom-events.d.ts +129 -0
  71. package/public/types/node/ts4.8/domain.d.ts +173 -0
  72. package/public/types/node/ts4.8/events.d.ts +681 -0
  73. package/public/types/node/ts4.8/fs/promises.d.ts +1141 -0
  74. package/public/types/node/ts4.8/fs.d.ts +3875 -0
  75. package/public/types/node/ts4.8/globals.d.ts +297 -0
  76. package/public/types/node/ts4.8/http.d.ts +1617 -0
  77. package/public/types/node/ts4.8/http2.d.ts +2137 -0
  78. package/public/types/node/ts4.8/https.d.ts +544 -0
  79. package/public/types/node/ts4.8/module.d.ts +117 -0
  80. package/public/types/node/ts4.8/net.d.ts +872 -0
  81. package/public/types/node/ts4.8/os.d.ts +469 -0
  82. package/public/types/node/ts4.8/path.d.ts +194 -0
  83. package/public/types/node/ts4.8/perf_hooks.d.ts +628 -0
  84. package/public/types/node/ts4.8/process.d.ts +1485 -0
  85. package/public/types/node/ts4.8/querystring.d.ts +134 -0
  86. package/public/types/node/ts4.8/readline/promises.d.ts +146 -0
  87. package/public/types/node/ts4.8/readline.d.ts +656 -0
  88. package/public/types/node/ts4.8/stream/consumers.d.ts +15 -0
  89. package/public/types/node/ts4.8/stream/promises.d.ts +45 -0
  90. package/public/types/node/ts4.8/stream/web.d.ts +333 -0
  91. package/public/types/node/ts4.8/stream.d.ts +1343 -0
  92. package/public/types/node/ts4.8/string_decoder.d.ts +70 -0
  93. package/public/types/node/ts4.8/test.d.ts +377 -0
  94. package/public/types/node/ts4.8/timers/promises.d.ts +71 -0
  95. package/public/types/node/ts4.8/timers.d.ts +97 -0
  96. package/public/types/node/ts4.8/tls.d.ts +1031 -0
  97. package/public/types/node/ts4.8/trace_events.d.ts +174 -0
  98. package/public/types/node/ts4.8/tty.d.ts +209 -0
  99. package/public/types/node/ts4.8/url.d.ts +900 -0
  100. package/public/types/node/ts4.8/util.d.ts +1853 -0
  101. package/public/types/node/ts4.8/v8.d.ts +399 -0
  102. package/public/types/node/ts4.8/vm.d.ts +512 -0
  103. package/public/types/node/ts4.8/wasi.d.ts +161 -0
  104. package/public/types/node/ts4.8/worker_threads.d.ts +692 -0
  105. package/public/types/node/ts4.8/zlib.d.ts +520 -0
  106. package/public/types/node/tty.d.ts +5 -3
  107. package/public/types/node/url.d.ts +81 -39
  108. package/public/types/node/util.d.ts +269 -13
  109. package/public/types/node/v8.d.ts +22 -4
  110. package/public/types/node/vm.d.ts +7 -5
  111. package/public/types/node/wasi.d.ts +2 -2
  112. package/public/types/node/worker_threads.d.ts +51 -11
  113. package/public/types/node/zlib.d.ts +2 -2
  114. package/public/types/node-red/func.d.ts +26 -17
  115. package/public/vendor/ace/worker-jsonata.js +1 -1
  116. package/public/vendor/monaco/dist/{fa2cc0ab9f0bec2b3365.ttf → 0c718f5b7d2bce997c5f.ttf} +0 -0
  117. package/public/vendor/monaco/dist/css.worker.js +1 -1
  118. package/public/vendor/monaco/dist/css.worker.js.LICENSE.txt +1 -1
  119. package/public/vendor/monaco/dist/editor.js +1 -29
  120. package/public/vendor/monaco/dist/editor.js.LICENSE.txt +2 -2
  121. package/public/vendor/monaco/dist/editor.worker.js +1 -1
  122. package/public/vendor/monaco/dist/html.worker.js +1 -1
  123. package/public/vendor/monaco/dist/html.worker.js.LICENSE.txt +1 -1
  124. package/public/vendor/monaco/dist/json.worker.js +1 -1
  125. package/public/vendor/monaco/dist/json.worker.js.LICENSE.txt +1 -1
  126. package/public/vendor/monaco/dist/locale/cs.js +324 -106
  127. package/public/vendor/monaco/dist/locale/de.js +336 -118
  128. package/public/vendor/monaco/dist/locale/es.js +329 -111
  129. package/public/vendor/monaco/dist/locale/fr.js +334 -116
  130. package/public/vendor/monaco/dist/locale/it.js +327 -109
  131. package/public/vendor/monaco/dist/locale/ja.js +329 -111
  132. package/public/vendor/monaco/dist/locale/ko.js +330 -112
  133. package/public/vendor/monaco/dist/locale/pl.js +329 -111
  134. package/public/vendor/monaco/dist/locale/pt-br.js +329 -111
  135. package/public/vendor/monaco/dist/locale/qps-ploc.js +330 -112
  136. package/public/vendor/monaco/dist/locale/ru.js +331 -113
  137. package/public/vendor/monaco/dist/locale/tr.js +329 -111
  138. package/public/vendor/monaco/dist/locale/zh-hans.js +331 -113
  139. package/public/vendor/monaco/dist/locale/zh-hant.js +331 -113
  140. package/public/vendor/monaco/dist/ts.worker.js +2 -2
  141. package/public/vendor/vendor.js +1 -1
  142. package/public/vendor/monaco/dist/7064e66c3890a12c47b4.ttf +0 -0
  143. /package/public/red/tours/{images → 3.1/images}/context-menu.png +0 -0
  144. /package/public/red/tours/{images → 3.1/images}/global-env-vars.png +0 -0
  145. /package/public/red/tours/{images → 3.1/images}/hiding-flows.png +0 -0
  146. /package/public/red/tours/{images → 3.1/images}/locking-flows.png +0 -0
  147. /package/public/red/tours/{images → 3.1/images}/mermaid.png +0 -0
  148. /package/public/red/tours/{images → 3.1/images}/node-help.png +0 -0
  149. /package/public/red/tours/{images → 3.1/images}/tab-changes.png +0 -0
@@ -0,0 +1,413 @@
1
+
2
+ /* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
3
+
4
+ /**
5
+ * Clusters of Node.js processes can be used to run multiple instances of Node.js
6
+ * that can distribute workloads among their application threads. When process
7
+ * isolation is not needed, use the `worker_threads` module instead, which
8
+ * allows running multiple application threads within a single Node.js instance.
9
+ *
10
+ * The cluster module allows easy creation of child processes that all share
11
+ * server ports.
12
+ *
13
+ * ```js
14
+ * import cluster from 'cluster';
15
+ * import http from 'http';
16
+ * import { cpus } from 'os';
17
+ * import process from 'process';
18
+ *
19
+ * const numCPUs = cpus().length;
20
+ *
21
+ * if (cluster.isPrimary) {
22
+ * console.log(`Primary ${process.pid} is running`);
23
+ *
24
+ * // Fork workers.
25
+ * for (let i = 0; i < numCPUs; i++) {
26
+ * cluster.fork();
27
+ * }
28
+ *
29
+ * cluster.on('exit', (worker, code, signal) => {
30
+ * console.log(`worker ${worker.process.pid} died`);
31
+ * });
32
+ * } else {
33
+ * // Workers can share any TCP connection
34
+ * // In this case it is an HTTP server
35
+ * http.createServer((req, res) => {
36
+ * res.writeHead(200);
37
+ * res.end('hello world\n');
38
+ * }).listen(8000);
39
+ *
40
+ * console.log(`Worker ${process.pid} started`);
41
+ * }
42
+ * ```
43
+ *
44
+ * Running Node.js will now share port 8000 between the workers:
45
+ *
46
+ * ```console
47
+ * $ node server.js
48
+ * Primary 3596 is running
49
+ * Worker 4324 started
50
+ * Worker 4520 started
51
+ * Worker 6056 started
52
+ * Worker 5644 started
53
+ * ```
54
+ *
55
+ * On Windows, it is not yet possible to set up a named pipe server in a worker.
56
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/cluster.js)
57
+ */
58
+ declare module 'cluster' {
59
+ import * as child from 'node:child_process';
60
+ import EventEmitter = require('node:events');
61
+ import * as net from 'node:net';
62
+ export interface ClusterSettings {
63
+ execArgv?: string[] | undefined; // default: process.execArgv
64
+ exec?: string | undefined;
65
+ args?: string[] | undefined;
66
+ silent?: boolean | undefined;
67
+ stdio?: any[] | undefined;
68
+ uid?: number | undefined;
69
+ gid?: number | undefined;
70
+ inspectPort?: number | (() => number) | undefined;
71
+ }
72
+ export interface Address {
73
+ address: string;
74
+ port: number;
75
+ addressType: number | 'udp4' | 'udp6'; // 4, 6, -1, "udp4", "udp6"
76
+ }
77
+ /**
78
+ * A `Worker` object contains all public information and method about a worker.
79
+ * In the primary it can be obtained using `cluster.workers`. In a worker
80
+ * it can be obtained using `cluster.worker`.
81
+ * @since v0.7.0
82
+ */
83
+ export class Worker extends EventEmitter {
84
+ /**
85
+ * Each new worker is given its own unique id, this id is stored in the`id`.
86
+ *
87
+ * While a worker is alive, this is the key that indexes it in`cluster.workers`.
88
+ * @since v0.8.0
89
+ */
90
+ id: number;
91
+ /**
92
+ * All workers are created using `child_process.fork()`, the returned object
93
+ * from this function is stored as `.process`. In a worker, the global `process`is stored.
94
+ *
95
+ * See: `Child Process module`.
96
+ *
97
+ * Workers will call `process.exit(0)` if the `'disconnect'` event occurs
98
+ * on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
99
+ * accidental disconnection.
100
+ * @since v0.7.0
101
+ */
102
+ process: child.ChildProcess;
103
+ /**
104
+ * Send a message to a worker or primary, optionally with a handle.
105
+ *
106
+ * In the primary, this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
107
+ *
108
+ * In a worker, this sends a message to the primary. It is identical to`process.send()`.
109
+ *
110
+ * This example will echo back all messages from the primary:
111
+ *
112
+ * ```js
113
+ * if (cluster.isPrimary) {
114
+ * const worker = cluster.fork();
115
+ * worker.send('hi there');
116
+ *
117
+ * } else if (cluster.isWorker) {
118
+ * process.on('message', (msg) => {
119
+ * process.send(msg);
120
+ * });
121
+ * }
122
+ * ```
123
+ * @since v0.7.0
124
+ * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
125
+ */
126
+ send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
127
+ send(message: child.Serializable, sendHandle: child.SendHandle, callback?: (error: Error | null) => void): boolean;
128
+ send(message: child.Serializable, sendHandle: child.SendHandle, options?: child.MessageOptions, callback?: (error: Error | null) => void): boolean;
129
+ /**
130
+ * This function will kill the worker. In the primary worker, it does this by
131
+ * disconnecting the `worker.process`, and once disconnected, killing with`signal`. In the worker, it does it by killing the process with `signal`.
132
+ *
133
+ * The `kill()` function kills the worker process without waiting for a graceful
134
+ * disconnect, it has the same behavior as `worker.process.kill()`.
135
+ *
136
+ * This method is aliased as `worker.destroy()` for backwards compatibility.
137
+ *
138
+ * In a worker, `process.kill()` exists, but it is not this function;
139
+ * it is `kill()`.
140
+ * @since v0.9.12
141
+ * @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
142
+ */
143
+ kill(signal?: string): void;
144
+ destroy(signal?: string): void;
145
+ /**
146
+ * In a worker, this function will close all servers, wait for the `'close'` event
147
+ * on those servers, and then disconnect the IPC channel.
148
+ *
149
+ * In the primary, an internal message is sent to the worker causing it to call`.disconnect()` on itself.
150
+ *
151
+ * Causes `.exitedAfterDisconnect` to be set.
152
+ *
153
+ * After a server is closed, it will no longer accept new connections,
154
+ * but connections may be accepted by any other listening worker. Existing
155
+ * connections will be allowed to close as usual. When no more connections exist,
156
+ * see `server.close()`, the IPC channel to the worker will close allowing it
157
+ * to die gracefully.
158
+ *
159
+ * The above applies _only_ to server connections, client connections are not
160
+ * automatically closed by workers, and disconnect does not wait for them to close
161
+ * before exiting.
162
+ *
163
+ * In a worker, `process.disconnect` exists, but it is not this function;
164
+ * it is `disconnect()`.
165
+ *
166
+ * Because long living server connections may block workers from disconnecting, it
167
+ * may be useful to send a message, so application specific actions may be taken to
168
+ * close them. It also may be useful to implement a timeout, killing a worker if
169
+ * the `'disconnect'` event has not been emitted after some time.
170
+ *
171
+ * ```js
172
+ * if (cluster.isPrimary) {
173
+ * const worker = cluster.fork();
174
+ * let timeout;
175
+ *
176
+ * worker.on('listening', (address) => {
177
+ * worker.send('shutdown');
178
+ * worker.disconnect();
179
+ * timeout = setTimeout(() => {
180
+ * worker.kill();
181
+ * }, 2000);
182
+ * });
183
+ *
184
+ * worker.on('disconnect', () => {
185
+ * clearTimeout(timeout);
186
+ * });
187
+ *
188
+ * } else if (cluster.isWorker) {
189
+ * const net = require('net');
190
+ * const server = net.createServer((socket) => {
191
+ * // Connections never end
192
+ * });
193
+ *
194
+ * server.listen(8000);
195
+ *
196
+ * process.on('message', (msg) => {
197
+ * if (msg === 'shutdown') {
198
+ * // Initiate graceful close of any connections to server
199
+ * }
200
+ * });
201
+ * }
202
+ * ```
203
+ * @since v0.7.7
204
+ * @return A reference to `worker`.
205
+ */
206
+ disconnect(): void;
207
+ /**
208
+ * This function returns `true` if the worker is connected to its primary via its
209
+ * IPC channel, `false` otherwise. A worker is connected to its primary after it
210
+ * has been created. It is disconnected after the `'disconnect'` event is emitted.
211
+ * @since v0.11.14
212
+ */
213
+ isConnected(): boolean;
214
+ /**
215
+ * This function returns `true` if the worker's process has terminated (either
216
+ * because of exiting or being signaled). Otherwise, it returns `false`.
217
+ *
218
+ * ```js
219
+ * import cluster from 'cluster';
220
+ * import http from 'http';
221
+ * import { cpus } from 'os';
222
+ * import process from 'process';
223
+ *
224
+ * const numCPUs = cpus().length;
225
+ *
226
+ * if (cluster.isPrimary) {
227
+ * console.log(`Primary ${process.pid} is running`);
228
+ *
229
+ * // Fork workers.
230
+ * for (let i = 0; i < numCPUs; i++) {
231
+ * cluster.fork();
232
+ * }
233
+ *
234
+ * cluster.on('fork', (worker) => {
235
+ * console.log('worker is dead:', worker.isDead());
236
+ * });
237
+ *
238
+ * cluster.on('exit', (worker, code, signal) => {
239
+ * console.log('worker is dead:', worker.isDead());
240
+ * });
241
+ * } else {
242
+ * // Workers can share any TCP connection. In this case, it is an HTTP server.
243
+ * http.createServer((req, res) => {
244
+ * res.writeHead(200);
245
+ * res.end(`Current process\n ${process.pid}`);
246
+ * process.kill(process.pid);
247
+ * }).listen(8000);
248
+ * }
249
+ * ```
250
+ * @since v0.11.14
251
+ */
252
+ isDead(): boolean;
253
+ /**
254
+ * This property is `true` if the worker exited due to `.disconnect()`.
255
+ * If the worker exited any other way, it is `false`. If the
256
+ * worker has not exited, it is `undefined`.
257
+ *
258
+ * The boolean `worker.exitedAfterDisconnect` allows distinguishing between
259
+ * voluntary and accidental exit, the primary may choose not to respawn a worker
260
+ * based on this value.
261
+ *
262
+ * ```js
263
+ * cluster.on('exit', (worker, code, signal) => {
264
+ * if (worker.exitedAfterDisconnect === true) {
265
+ * console.log('Oh, it was just voluntary – no need to worry');
266
+ * }
267
+ * });
268
+ *
269
+ * // kill worker
270
+ * worker.kill();
271
+ * ```
272
+ * @since v6.0.0
273
+ */
274
+ exitedAfterDisconnect: boolean;
275
+ /**
276
+ * events.EventEmitter
277
+ * 1. disconnect
278
+ * 2. error
279
+ * 3. exit
280
+ * 4. listening
281
+ * 5. message
282
+ * 6. online
283
+ */
284
+ addListener(event: string, listener: (...args: any[]) => void): this;
285
+ addListener(event: 'disconnect', listener: () => void): this;
286
+ addListener(event: 'error', listener: (error: Error) => void): this;
287
+ addListener(event: 'exit', listener: (code: number, signal: string) => void): this;
288
+ addListener(event: 'listening', listener: (address: Address) => void): this;
289
+ addListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
290
+ addListener(event: 'online', listener: () => void): this;
291
+ emit(event: string | symbol, ...args: any[]): boolean;
292
+ emit(event: 'disconnect'): boolean;
293
+ emit(event: 'error', error: Error): boolean;
294
+ emit(event: 'exit', code: number, signal: string): boolean;
295
+ emit(event: 'listening', address: Address): boolean;
296
+ emit(event: 'message', message: any, handle: net.Socket | net.Server): boolean;
297
+ emit(event: 'online'): boolean;
298
+ on(event: string, listener: (...args: any[]) => void): this;
299
+ on(event: 'disconnect', listener: () => void): this;
300
+ on(event: 'error', listener: (error: Error) => void): this;
301
+ on(event: 'exit', listener: (code: number, signal: string) => void): this;
302
+ on(event: 'listening', listener: (address: Address) => void): this;
303
+ on(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
304
+ on(event: 'online', listener: () => void): this;
305
+ once(event: string, listener: (...args: any[]) => void): this;
306
+ once(event: 'disconnect', listener: () => void): this;
307
+ once(event: 'error', listener: (error: Error) => void): this;
308
+ once(event: 'exit', listener: (code: number, signal: string) => void): this;
309
+ once(event: 'listening', listener: (address: Address) => void): this;
310
+ once(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
311
+ once(event: 'online', listener: () => void): this;
312
+ prependListener(event: string, listener: (...args: any[]) => void): this;
313
+ prependListener(event: 'disconnect', listener: () => void): this;
314
+ prependListener(event: 'error', listener: (error: Error) => void): this;
315
+ prependListener(event: 'exit', listener: (code: number, signal: string) => void): this;
316
+ prependListener(event: 'listening', listener: (address: Address) => void): this;
317
+ prependListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
318
+ prependListener(event: 'online', listener: () => void): this;
319
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
320
+ prependOnceListener(event: 'disconnect', listener: () => void): this;
321
+ prependOnceListener(event: 'error', listener: (error: Error) => void): this;
322
+ prependOnceListener(event: 'exit', listener: (code: number, signal: string) => void): this;
323
+ prependOnceListener(event: 'listening', listener: (address: Address) => void): this;
324
+ prependOnceListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
325
+ prependOnceListener(event: 'online', listener: () => void): this;
326
+ }
327
+ export interface Cluster extends EventEmitter {
328
+ disconnect(callback?: () => void): void;
329
+ fork(env?: any): Worker;
330
+ /** @deprecated since v16.0.0 - use isPrimary. */
331
+ readonly isMaster: boolean;
332
+ readonly isPrimary: boolean;
333
+ readonly isWorker: boolean;
334
+ schedulingPolicy: number;
335
+ readonly settings: ClusterSettings;
336
+ /** @deprecated since v16.0.0 - use setupPrimary. */
337
+ setupMaster(settings?: ClusterSettings): void;
338
+ /**
339
+ * `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in cluster.settings.
340
+ */
341
+ setupPrimary(settings?: ClusterSettings): void;
342
+ readonly worker?: Worker | undefined;
343
+ readonly workers?: NodeJS.Dict<Worker> | undefined;
344
+ readonly SCHED_NONE: number;
345
+ readonly SCHED_RR: number;
346
+ /**
347
+ * events.EventEmitter
348
+ * 1. disconnect
349
+ * 2. exit
350
+ * 3. fork
351
+ * 4. listening
352
+ * 5. message
353
+ * 6. online
354
+ * 7. setup
355
+ */
356
+ addListener(event: string, listener: (...args: any[]) => void): this;
357
+ addListener(event: 'disconnect', listener: (worker: Worker) => void): this;
358
+ addListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
359
+ addListener(event: 'fork', listener: (worker: Worker) => void): this;
360
+ addListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
361
+ addListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
362
+ addListener(event: 'online', listener: (worker: Worker) => void): this;
363
+ addListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
364
+ emit(event: string | symbol, ...args: any[]): boolean;
365
+ emit(event: 'disconnect', worker: Worker): boolean;
366
+ emit(event: 'exit', worker: Worker, code: number, signal: string): boolean;
367
+ emit(event: 'fork', worker: Worker): boolean;
368
+ emit(event: 'listening', worker: Worker, address: Address): boolean;
369
+ emit(event: 'message', worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
370
+ emit(event: 'online', worker: Worker): boolean;
371
+ emit(event: 'setup', settings: ClusterSettings): boolean;
372
+ on(event: string, listener: (...args: any[]) => void): this;
373
+ on(event: 'disconnect', listener: (worker: Worker) => void): this;
374
+ on(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
375
+ on(event: 'fork', listener: (worker: Worker) => void): this;
376
+ on(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
377
+ on(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
378
+ on(event: 'online', listener: (worker: Worker) => void): this;
379
+ on(event: 'setup', listener: (settings: ClusterSettings) => void): this;
380
+ once(event: string, listener: (...args: any[]) => void): this;
381
+ once(event: 'disconnect', listener: (worker: Worker) => void): this;
382
+ once(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
383
+ once(event: 'fork', listener: (worker: Worker) => void): this;
384
+ once(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
385
+ once(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
386
+ once(event: 'online', listener: (worker: Worker) => void): this;
387
+ once(event: 'setup', listener: (settings: ClusterSettings) => void): this;
388
+ prependListener(event: string, listener: (...args: any[]) => void): this;
389
+ prependListener(event: 'disconnect', listener: (worker: Worker) => void): this;
390
+ prependListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
391
+ prependListener(event: 'fork', listener: (worker: Worker) => void): this;
392
+ prependListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
393
+ // the handle is a net.Socket or net.Server object, or undefined.
394
+ prependListener(event: 'message', listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void): this;
395
+ prependListener(event: 'online', listener: (worker: Worker) => void): this;
396
+ prependListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
397
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
398
+ prependOnceListener(event: 'disconnect', listener: (worker: Worker) => void): this;
399
+ prependOnceListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
400
+ prependOnceListener(event: 'fork', listener: (worker: Worker) => void): this;
401
+ prependOnceListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
402
+ // the handle is a net.Socket or net.Server object, or undefined.
403
+ prependOnceListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this;
404
+ prependOnceListener(event: 'online', listener: (worker: Worker) => void): this;
405
+ prependOnceListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
406
+ }
407
+ const cluster: Cluster;
408
+ export default cluster;
409
+ }
410
+ declare module 'node:cluster' {
411
+ export * from 'cluster';
412
+ export { default as default } from 'cluster';
413
+ }