@nocobase/plugin-multi-app-manager 1.2.12-alpha → 1.3.0-alpha.20240710084543

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 (175) hide show
  1. package/package.json +2 -2
  2. package/dist/client/AppManager.d.ts +0 -10
  3. package/dist/client/AppNameInput.d.ts +0 -10
  4. package/dist/client/MultiAppManagerProvider.d.ts +0 -10
  5. package/dist/client/MultiAppManagerProvider.style.d.ts +0 -13
  6. package/dist/client/Settings.d.ts +0 -10
  7. package/dist/client/index.d.ts +0 -14
  8. package/dist/client/index.js +0 -10
  9. package/dist/client/settings/schemas/applications.d.ts +0 -18
  10. package/dist/client/utils.d.ts +0 -12
  11. package/dist/externalVersion.js +0 -25
  12. package/dist/index.d.ts +0 -10
  13. package/dist/index.js +0 -48
  14. package/dist/locale/en-US.json +0 -11
  15. package/dist/locale/es-ES.json +0 -9
  16. package/dist/locale/index.d.ts +0 -9
  17. package/dist/locale/index.js +0 -36
  18. package/dist/locale/ko_KR.json +0 -11
  19. package/dist/locale/pt-BR.json +0 -9
  20. package/dist/locale/zh-CN.json +0 -14
  21. package/dist/node_modules/mariadb/LICENSE +0 -502
  22. package/dist/node_modules/mariadb/callback.js +0 -41
  23. package/dist/node_modules/mariadb/lib/cmd/batch-bulk.js +0 -278
  24. package/dist/node_modules/mariadb/lib/cmd/batch-rewrite.js +0 -372
  25. package/dist/node_modules/mariadb/lib/cmd/change-user.js +0 -149
  26. package/dist/node_modules/mariadb/lib/cmd/class/ok-packet.js +0 -17
  27. package/dist/node_modules/mariadb/lib/cmd/column-definition.js +0 -102
  28. package/dist/node_modules/mariadb/lib/cmd/command.js +0 -168
  29. package/dist/node_modules/mariadb/lib/cmd/common-binary-cmd.js +0 -327
  30. package/dist/node_modules/mariadb/lib/cmd/common-text-cmd.js +0 -427
  31. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/caching-sha2-password-auth.js +0 -168
  32. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/clear-password-auth.js +0 -23
  33. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/ed25519-password-auth.js +0 -761
  34. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/native-password-auth.js +0 -55
  35. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/pam-password-auth.js +0 -58
  36. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/plugin-auth.js +0 -19
  37. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/sha256-password-auth.js +0 -142
  38. package/dist/node_modules/mariadb/lib/cmd/handshake/client-capabilities.js +0 -74
  39. package/dist/node_modules/mariadb/lib/cmd/handshake/client-handshake-response.js +0 -126
  40. package/dist/node_modules/mariadb/lib/cmd/handshake/handshake.js +0 -292
  41. package/dist/node_modules/mariadb/lib/cmd/handshake/initial-handshake.js +0 -74
  42. package/dist/node_modules/mariadb/lib/cmd/handshake/ssl-request.js +0 -29
  43. package/dist/node_modules/mariadb/lib/cmd/ping.js +0 -52
  44. package/dist/node_modules/mariadb/lib/cmd/query.js +0 -255
  45. package/dist/node_modules/mariadb/lib/cmd/quit.js +0 -28
  46. package/dist/node_modules/mariadb/lib/cmd/reset.js +0 -54
  47. package/dist/node_modules/mariadb/lib/cmd/resultset.js +0 -607
  48. package/dist/node_modules/mariadb/lib/cmd/stream.js +0 -45
  49. package/dist/node_modules/mariadb/lib/config/connection-options.js +0 -258
  50. package/dist/node_modules/mariadb/lib/config/pool-cluster-options.js +0 -19
  51. package/dist/node_modules/mariadb/lib/config/pool-options.js +0 -47
  52. package/dist/node_modules/mariadb/lib/connection-callback.js +0 -160
  53. package/dist/node_modules/mariadb/lib/connection.js +0 -1460
  54. package/dist/node_modules/mariadb/lib/const/capabilities.js +0 -64
  55. package/dist/node_modules/mariadb/lib/const/collations.js +0 -473
  56. package/dist/node_modules/mariadb/lib/const/connection_status.js +0 -13
  57. package/dist/node_modules/mariadb/lib/const/error-code.js +0 -1282
  58. package/dist/node_modules/mariadb/lib/const/field-detail.js +0 -35
  59. package/dist/node_modules/mariadb/lib/const/field-type.js +0 -71
  60. package/dist/node_modules/mariadb/lib/const/server-status.js +0 -30
  61. package/dist/node_modules/mariadb/lib/const/state-change.js +0 -12
  62. package/dist/node_modules/mariadb/lib/filtered-pool-cluster.js +0 -81
  63. package/dist/node_modules/mariadb/lib/io/bulk-packet.js +0 -590
  64. package/dist/node_modules/mariadb/lib/io/compression-input-stream.js +0 -141
  65. package/dist/node_modules/mariadb/lib/io/compression-output-stream.js +0 -171
  66. package/dist/node_modules/mariadb/lib/io/packet-input-stream.js +0 -193
  67. package/dist/node_modules/mariadb/lib/io/packet-node-encoded.js +0 -36
  68. package/dist/node_modules/mariadb/lib/io/packet-node-iconv.js +0 -37
  69. package/dist/node_modules/mariadb/lib/io/packet-output-stream.js +0 -502
  70. package/dist/node_modules/mariadb/lib/io/packet.js +0 -515
  71. package/dist/node_modules/mariadb/lib/io/rewrite-packet.js +0 -481
  72. package/dist/node_modules/mariadb/lib/misc/connection-information.js +0 -96
  73. package/dist/node_modules/mariadb/lib/misc/errors.js +0 -123
  74. package/dist/node_modules/mariadb/lib/misc/parse.js +0 -1033
  75. package/dist/node_modules/mariadb/lib/misc/utils.js +0 -298
  76. package/dist/node_modules/mariadb/lib/pool-base.js +0 -611
  77. package/dist/node_modules/mariadb/lib/pool-callback.js +0 -202
  78. package/dist/node_modules/mariadb/lib/pool-cluster-callback.js +0 -66
  79. package/dist/node_modules/mariadb/lib/pool-cluster.js +0 -407
  80. package/dist/node_modules/mariadb/lib/pool-promise.js +0 -108
  81. package/dist/node_modules/mariadb/node_modules/@types/node/assert/strict.d.ts +0 -8
  82. package/dist/node_modules/mariadb/node_modules/@types/node/assert.d.ts +0 -912
  83. package/dist/node_modules/mariadb/node_modules/@types/node/async_hooks.d.ts +0 -501
  84. package/dist/node_modules/mariadb/node_modules/@types/node/buffer.d.ts +0 -2232
  85. package/dist/node_modules/mariadb/node_modules/@types/node/child_process.d.ts +0 -1366
  86. package/dist/node_modules/mariadb/node_modules/@types/node/cluster.d.ts +0 -414
  87. package/dist/node_modules/mariadb/node_modules/@types/node/console.d.ts +0 -412
  88. package/dist/node_modules/mariadb/node_modules/@types/node/constants.d.ts +0 -18
  89. package/dist/node_modules/mariadb/node_modules/@types/node/crypto.d.ts +0 -3338
  90. package/dist/node_modules/mariadb/node_modules/@types/node/dgram.d.ts +0 -545
  91. package/dist/node_modules/mariadb/node_modules/@types/node/diagnostics_channel.d.ts +0 -152
  92. package/dist/node_modules/mariadb/node_modules/@types/node/dns/promises.d.ts +0 -370
  93. package/dist/node_modules/mariadb/node_modules/@types/node/dns.d.ts +0 -659
  94. package/dist/node_modules/mariadb/node_modules/@types/node/domain.d.ts +0 -169
  95. package/dist/node_modules/mariadb/node_modules/@types/node/events.d.ts +0 -651
  96. package/dist/node_modules/mariadb/node_modules/@types/node/fs/promises.d.ts +0 -1091
  97. package/dist/node_modules/mariadb/node_modules/@types/node/fs.d.ts +0 -3869
  98. package/dist/node_modules/mariadb/node_modules/@types/node/globals.d.ts +0 -294
  99. package/dist/node_modules/mariadb/node_modules/@types/node/globals.global.d.ts +0 -1
  100. package/dist/node_modules/mariadb/node_modules/@types/node/http.d.ts +0 -1396
  101. package/dist/node_modules/mariadb/node_modules/@types/node/http2.d.ts +0 -2101
  102. package/dist/node_modules/mariadb/node_modules/@types/node/https.d.ts +0 -391
  103. package/dist/node_modules/mariadb/node_modules/@types/node/index.d.ts +0 -129
  104. package/dist/node_modules/mariadb/node_modules/@types/node/inspector.d.ts +0 -2744
  105. package/dist/node_modules/mariadb/node_modules/@types/node/module.d.ts +0 -114
  106. package/dist/node_modules/mariadb/node_modules/@types/node/net.d.ts +0 -791
  107. package/dist/node_modules/mariadb/node_modules/@types/node/os.d.ts +0 -455
  108. package/dist/node_modules/mariadb/node_modules/@types/node/package.json +0 -220
  109. package/dist/node_modules/mariadb/node_modules/@types/node/path.d.ts +0 -180
  110. package/dist/node_modules/mariadb/node_modules/@types/node/perf_hooks.d.ts +0 -557
  111. package/dist/node_modules/mariadb/node_modules/@types/node/process.d.ts +0 -1481
  112. package/dist/node_modules/mariadb/node_modules/@types/node/punycode.d.ts +0 -117
  113. package/dist/node_modules/mariadb/node_modules/@types/node/querystring.d.ts +0 -131
  114. package/dist/node_modules/mariadb/node_modules/@types/node/readline.d.ts +0 -650
  115. package/dist/node_modules/mariadb/node_modules/@types/node/repl.d.ts +0 -424
  116. package/dist/node_modules/mariadb/node_modules/@types/node/stream/consumers.d.ts +0 -24
  117. package/dist/node_modules/mariadb/node_modules/@types/node/stream/promises.d.ts +0 -42
  118. package/dist/node_modules/mariadb/node_modules/@types/node/stream/web.d.ts +0 -330
  119. package/dist/node_modules/mariadb/node_modules/@types/node/stream.d.ts +0 -1249
  120. package/dist/node_modules/mariadb/node_modules/@types/node/string_decoder.d.ts +0 -67
  121. package/dist/node_modules/mariadb/node_modules/@types/node/timers/promises.d.ts +0 -68
  122. package/dist/node_modules/mariadb/node_modules/@types/node/timers.d.ts +0 -94
  123. package/dist/node_modules/mariadb/node_modules/@types/node/tls.d.ts +0 -1020
  124. package/dist/node_modules/mariadb/node_modules/@types/node/trace_events.d.ts +0 -161
  125. package/dist/node_modules/mariadb/node_modules/@types/node/tty.d.ts +0 -204
  126. package/dist/node_modules/mariadb/node_modules/@types/node/url.d.ts +0 -891
  127. package/dist/node_modules/mariadb/node_modules/@types/node/util.d.ts +0 -1594
  128. package/dist/node_modules/mariadb/node_modules/@types/node/v8.d.ts +0 -378
  129. package/dist/node_modules/mariadb/node_modules/@types/node/vm.d.ts +0 -507
  130. package/dist/node_modules/mariadb/node_modules/@types/node/wasi.d.ts +0 -158
  131. package/dist/node_modules/mariadb/node_modules/@types/node/worker_threads.d.ts +0 -649
  132. package/dist/node_modules/mariadb/node_modules/@types/node/zlib.d.ts +0 -517
  133. package/dist/node_modules/mariadb/node_modules/iconv-lite/.github/dependabot.yml +0 -11
  134. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/codeStyles/Project.xml +0 -47
  135. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml +0 -5
  136. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/iconv-lite.iml +0 -12
  137. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml +0 -6
  138. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/modules.xml +0 -8
  139. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/vcs.xml +0 -6
  140. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -597
  141. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/dbcs-data.js +0 -188
  142. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/index.js +0 -23
  143. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/internal.js +0 -198
  144. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -72
  145. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -451
  146. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-data.js +0 -179
  147. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/big5-added.json +0 -122
  148. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp936.json +0 -264
  149. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp949.json +0 -273
  150. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp950.json +0 -177
  151. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/eucjp.json +0 -182
  152. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +0 -1
  153. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/gbk-added.json +0 -56
  154. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/shiftjis.json +0 -125
  155. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf16.js +0 -197
  156. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf32.js +0 -319
  157. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf7.js +0 -290
  158. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/bom-handling.js +0 -52
  159. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/index.d.ts +0 -41
  160. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/index.js +0 -180
  161. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/streams.js +0 -109
  162. package/dist/node_modules/mariadb/node_modules/iconv-lite/package.json +0 -44
  163. package/dist/node_modules/mariadb/package.json +0 -1
  164. package/dist/node_modules/mariadb/promise.js +0 -34
  165. package/dist/node_modules/mariadb/types/index.d.ts +0 -870
  166. package/dist/server/collections/applications.d.ts +0 -10
  167. package/dist/server/collections/applications.js +0 -75
  168. package/dist/server/index.d.ts +0 -11
  169. package/dist/server/index.js +0 -40
  170. package/dist/server/models/application.d.ts +0 -18
  171. package/dist/server/models/application.js +0 -50
  172. package/dist/server/server.d.ts +0 -26
  173. package/dist/server/server.js +0 -310
  174. package/dist/swagger/index.d.ts +0 -195
  175. package/dist/swagger/index.js +0 -226
@@ -1,414 +0,0 @@
1
- /**
2
- * A single instance of Node.js runs in a single thread. To take advantage of
3
- * multi-core systems, the user will sometimes want to launch a cluster of Node.js
4
- * processes to handle the load.
5
- *
6
- * The cluster module allows easy creation of child processes that all share
7
- * server ports.
8
- *
9
- * ```js
10
- * import cluster from 'cluster';
11
- * import http from 'http';
12
- * import { cpus } from 'os';
13
- * import process from 'process';
14
- *
15
- * const numCPUs = cpus().length;
16
- *
17
- * if (cluster.isPrimary) {
18
- * console.log(`Primary ${process.pid} is running`);
19
- *
20
- * // Fork workers.
21
- * for (let i = 0; i < numCPUs; i++) {
22
- * cluster.fork();
23
- * }
24
- *
25
- * cluster.on('exit', (worker, code, signal) => {
26
- * console.log(`worker ${worker.process.pid} died`);
27
- * });
28
- * } else {
29
- * // Workers can share any TCP connection
30
- * // In this case it is an HTTP server
31
- * http.createServer((req, res) => {
32
- * res.writeHead(200);
33
- * res.end('hello world\n');
34
- * }).listen(8000);
35
- *
36
- * console.log(`Worker ${process.pid} started`);
37
- * }
38
- * ```
39
- *
40
- * Running Node.js will now share port 8000 between the workers:
41
- *
42
- * ```console
43
- * $ node server.js
44
- * Primary 3596 is running
45
- * Worker 4324 started
46
- * Worker 4520 started
47
- * Worker 6056 started
48
- * Worker 5644 started
49
- * ```
50
- *
51
- * On Windows, it is not yet possible to set up a named pipe server in a worker.
52
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/cluster.js)
53
- */
54
- declare module 'cluster' {
55
- import * as child from 'node:child_process';
56
- import EventEmitter = require('node:events');
57
- import * as net from 'node:net';
58
- export interface ClusterSettings {
59
- execArgv?: string[] | undefined; // default: process.execArgv
60
- exec?: string | undefined;
61
- args?: string[] | undefined;
62
- silent?: boolean | undefined;
63
- stdio?: any[] | undefined;
64
- uid?: number | undefined;
65
- gid?: number | undefined;
66
- inspectPort?: number | (() => number) | undefined;
67
- }
68
- export interface Address {
69
- address: string;
70
- port: number;
71
- addressType: number | 'udp4' | 'udp6'; // 4, 6, -1, "udp4", "udp6"
72
- }
73
- /**
74
- * A `Worker` object contains all public information and method about a worker.
75
- * In the primary it can be obtained using `cluster.workers`. In a worker
76
- * it can be obtained using `cluster.worker`.
77
- * @since v0.7.0
78
- */
79
- export class Worker extends EventEmitter {
80
- /**
81
- * Each new worker is given its own unique id, this id is stored in the`id`.
82
- *
83
- * While a worker is alive, this is the key that indexes it in`cluster.workers`.
84
- * @since v0.8.0
85
- */
86
- id: number;
87
- /**
88
- * All workers are created using `child_process.fork()`, the returned object
89
- * from this function is stored as `.process`. In a worker, the global `process`is stored.
90
- *
91
- * See: `Child Process module`.
92
- *
93
- * Workers will call `process.exit(0)` if the `'disconnect'` event occurs
94
- * on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
95
- * accidental disconnection.
96
- * @since v0.7.0
97
- */
98
- process: child.ChildProcess;
99
- /**
100
- * Send a message to a worker or primary, optionally with a handle.
101
- *
102
- * In the primary this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
103
- *
104
- * In a worker this sends a message to the primary. It is identical to`process.send()`.
105
- *
106
- * This example will echo back all messages from the primary:
107
- *
108
- * ```js
109
- * if (cluster.isPrimary) {
110
- * const worker = cluster.fork();
111
- * worker.send('hi there');
112
- *
113
- * } else if (cluster.isWorker) {
114
- * process.on('message', (msg) => {
115
- * process.send(msg);
116
- * });
117
- * }
118
- * ```
119
- * @since v0.7.0
120
- * @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:
121
- */
122
- send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
123
- send(message: child.Serializable, sendHandle: child.SendHandle, callback?: (error: Error | null) => void): boolean;
124
- send(message: child.Serializable, sendHandle: child.SendHandle, options?: child.MessageOptions, callback?: (error: Error | null) => void): boolean;
125
- /**
126
- * This function will kill the worker. In the primary, it does this
127
- * by disconnecting the `worker.process`, and once disconnected, killing
128
- * with `signal`. In the worker, it does it by disconnecting the channel,
129
- * and then exiting with code `0`.
130
- *
131
- * Because `kill()` attempts to gracefully disconnect the worker process, it is
132
- * susceptible to waiting indefinitely for the disconnect to complete. For example,
133
- * if the worker enters an infinite loop, a graceful disconnect will never occur.
134
- * If the graceful disconnect behavior is not needed, use `worker.process.kill()`.
135
- *
136
- * Causes `.exitedAfterDisconnect` to be set.
137
- *
138
- * This method is aliased as `worker.destroy()` for backward compatibility.
139
- *
140
- * In a worker, `process.kill()` exists, but it is not this function;
141
- * it is `kill()`.
142
- * @since v0.9.12
143
- * @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
144
- */
145
- kill(signal?: string): void;
146
- destroy(signal?: string): void;
147
- /**
148
- * In a worker, this function will close all servers, wait for the `'close'` event
149
- * on those servers, and then disconnect the IPC channel.
150
- *
151
- * In the primary, an internal message is sent to the worker causing it to call`.disconnect()` on itself.
152
- *
153
- * Causes `.exitedAfterDisconnect` to be set.
154
- *
155
- * After a server is closed, it will no longer accept new connections,
156
- * but connections may be accepted by any other listening worker. Existing
157
- * connections will be allowed to close as usual. When no more connections exist,
158
- * see `server.close()`, the IPC channel to the worker will close allowing it
159
- * to die gracefully.
160
- *
161
- * The above applies _only_ to server connections, client connections are not
162
- * automatically closed by workers, and disconnect does not wait for them to close
163
- * before exiting.
164
- *
165
- * In a worker, `process.disconnect` exists, but it is not this function;
166
- * it is `disconnect()`.
167
- *
168
- * Because long living server connections may block workers from disconnecting, it
169
- * may be useful to send a message, so application specific actions may be taken to
170
- * close them. It also may be useful to implement a timeout, killing a worker if
171
- * the `'disconnect'` event has not been emitted after some time.
172
- *
173
- * ```js
174
- * if (cluster.isPrimary) {
175
- * const worker = cluster.fork();
176
- * let timeout;
177
- *
178
- * worker.on('listening', (address) => {
179
- * worker.send('shutdown');
180
- * worker.disconnect();
181
- * timeout = setTimeout(() => {
182
- * worker.kill();
183
- * }, 2000);
184
- * });
185
- *
186
- * worker.on('disconnect', () => {
187
- * clearTimeout(timeout);
188
- * });
189
- *
190
- * } else if (cluster.isWorker) {
191
- * const net = require('net');
192
- * const server = net.createServer((socket) => {
193
- * // Connections never end
194
- * });
195
- *
196
- * server.listen(8000);
197
- *
198
- * process.on('message', (msg) => {
199
- * if (msg === 'shutdown') {
200
- * // Initiate graceful close of any connections to server
201
- * }
202
- * });
203
- * }
204
- * ```
205
- * @since v0.7.7
206
- * @return A reference to `worker`.
207
- */
208
- disconnect(): void;
209
- /**
210
- * This function returns `true` if the worker is connected to its primary via its
211
- * IPC channel, `false` otherwise. A worker is connected to its primary after it
212
- * has been created. It is disconnected after the `'disconnect'` event is emitted.
213
- * @since v0.11.14
214
- */
215
- isConnected(): boolean;
216
- /**
217
- * This function returns `true` if the worker's process has terminated (either
218
- * because of exiting or being signaled). Otherwise, it returns `false`.
219
- *
220
- * ```js
221
- * import cluster from 'cluster';
222
- * import http from 'http';
223
- * import { cpus } from 'os';
224
- * import process from 'process';
225
- *
226
- * const numCPUs = cpus().length;
227
- *
228
- * if (cluster.isPrimary) {
229
- * console.log(`Primary ${process.pid} is running`);
230
- *
231
- * // Fork workers.
232
- * for (let i = 0; i < numCPUs; i++) {
233
- * cluster.fork();
234
- * }
235
- *
236
- * cluster.on('fork', (worker) => {
237
- * console.log('worker is dead:', worker.isDead());
238
- * });
239
- *
240
- * cluster.on('exit', (worker, code, signal) => {
241
- * console.log('worker is dead:', worker.isDead());
242
- * });
243
- * } else {
244
- * // Workers can share any TCP connection. In this case, it is an HTTP server.
245
- * http.createServer((req, res) => {
246
- * res.writeHead(200);
247
- * res.end(`Current process\n ${process.pid}`);
248
- * process.kill(process.pid);
249
- * }).listen(8000);
250
- * }
251
- * ```
252
- * @since v0.11.14
253
- */
254
- isDead(): boolean;
255
- /**
256
- * This property is `true` if the worker exited due to `.kill()` or`.disconnect()`. If the worker exited any other way, it is `false`. If the
257
- * worker has not exited, it is `undefined`.
258
- *
259
- * The boolean `worker.exitedAfterDisconnect` allows distinguishing between
260
- * voluntary and accidental exit, the primary may choose not to respawn a worker
261
- * based on this value.
262
- *
263
- * ```js
264
- * cluster.on('exit', (worker, code, signal) => {
265
- * if (worker.exitedAfterDisconnect === true) {
266
- * console.log('Oh, it was just voluntary – no need to worry');
267
- * }
268
- * });
269
- *
270
- * // kill worker
271
- * worker.kill();
272
- * ```
273
- * @since v6.0.0
274
- */
275
- exitedAfterDisconnect: boolean;
276
- /**
277
- * events.EventEmitter
278
- * 1. disconnect
279
- * 2. error
280
- * 3. exit
281
- * 4. listening
282
- * 5. message
283
- * 6. online
284
- */
285
- addListener(event: string, listener: (...args: any[]) => void): this;
286
- addListener(event: 'disconnect', listener: () => void): this;
287
- addListener(event: 'error', listener: (error: Error) => void): this;
288
- addListener(event: 'exit', listener: (code: number, signal: string) => void): this;
289
- addListener(event: 'listening', listener: (address: Address) => void): this;
290
- 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.
291
- addListener(event: 'online', listener: () => void): this;
292
- emit(event: string | symbol, ...args: any[]): boolean;
293
- emit(event: 'disconnect'): boolean;
294
- emit(event: 'error', error: Error): boolean;
295
- emit(event: 'exit', code: number, signal: string): boolean;
296
- emit(event: 'listening', address: Address): boolean;
297
- emit(event: 'message', message: any, handle: net.Socket | net.Server): boolean;
298
- emit(event: 'online'): boolean;
299
- on(event: string, listener: (...args: any[]) => void): this;
300
- on(event: 'disconnect', listener: () => void): this;
301
- on(event: 'error', listener: (error: Error) => void): this;
302
- on(event: 'exit', listener: (code: number, signal: string) => void): this;
303
- on(event: 'listening', listener: (address: Address) => void): this;
304
- 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.
305
- on(event: 'online', listener: () => void): this;
306
- once(event: string, listener: (...args: any[]) => void): this;
307
- once(event: 'disconnect', listener: () => void): this;
308
- once(event: 'error', listener: (error: Error) => void): this;
309
- once(event: 'exit', listener: (code: number, signal: string) => void): this;
310
- once(event: 'listening', listener: (address: Address) => void): this;
311
- 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.
312
- once(event: 'online', listener: () => void): this;
313
- prependListener(event: string, listener: (...args: any[]) => void): this;
314
- prependListener(event: 'disconnect', listener: () => void): this;
315
- prependListener(event: 'error', listener: (error: Error) => void): this;
316
- prependListener(event: 'exit', listener: (code: number, signal: string) => void): this;
317
- prependListener(event: 'listening', listener: (address: Address) => void): this;
318
- 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.
319
- prependListener(event: 'online', listener: () => void): this;
320
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
321
- prependOnceListener(event: 'disconnect', listener: () => void): this;
322
- prependOnceListener(event: 'error', listener: (error: Error) => void): this;
323
- prependOnceListener(event: 'exit', listener: (code: number, signal: string) => void): this;
324
- prependOnceListener(event: 'listening', listener: (address: Address) => void): this;
325
- 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.
326
- prependOnceListener(event: 'online', listener: () => void): this;
327
- }
328
- export interface Cluster extends EventEmitter {
329
- disconnect(callback?: () => void): void;
330
- fork(env?: any): Worker;
331
- /** @deprecated since v16.0.0 - use isPrimary. */
332
- readonly isMaster: boolean;
333
- readonly isPrimary: boolean;
334
- readonly isWorker: boolean;
335
- schedulingPolicy: number;
336
- readonly settings: ClusterSettings;
337
- /** @deprecated since v16.0.0 - use setupPrimary. */
338
- setupMaster(settings?: ClusterSettings): void;
339
- /**
340
- * `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in cluster.settings.
341
- */
342
- setupPrimary(settings?: ClusterSettings): void;
343
- readonly worker?: Worker | undefined;
344
- readonly workers?: NodeJS.Dict<Worker> | undefined;
345
- readonly SCHED_NONE: number;
346
- readonly SCHED_RR: number;
347
- /**
348
- * events.EventEmitter
349
- * 1. disconnect
350
- * 2. exit
351
- * 3. fork
352
- * 4. listening
353
- * 5. message
354
- * 6. online
355
- * 7. setup
356
- */
357
- addListener(event: string, listener: (...args: any[]) => void): this;
358
- addListener(event: 'disconnect', listener: (worker: Worker) => void): this;
359
- addListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
360
- addListener(event: 'fork', listener: (worker: Worker) => void): this;
361
- addListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
362
- 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.
363
- addListener(event: 'online', listener: (worker: Worker) => void): this;
364
- addListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
365
- emit(event: string | symbol, ...args: any[]): boolean;
366
- emit(event: 'disconnect', worker: Worker): boolean;
367
- emit(event: 'exit', worker: Worker, code: number, signal: string): boolean;
368
- emit(event: 'fork', worker: Worker): boolean;
369
- emit(event: 'listening', worker: Worker, address: Address): boolean;
370
- emit(event: 'message', worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
371
- emit(event: 'online', worker: Worker): boolean;
372
- emit(event: 'setup', settings: ClusterSettings): boolean;
373
- on(event: string, listener: (...args: any[]) => void): this;
374
- on(event: 'disconnect', listener: (worker: Worker) => void): this;
375
- on(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
376
- on(event: 'fork', listener: (worker: Worker) => void): this;
377
- on(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
378
- 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.
379
- on(event: 'online', listener: (worker: Worker) => void): this;
380
- on(event: 'setup', listener: (settings: ClusterSettings) => void): this;
381
- once(event: string, listener: (...args: any[]) => void): this;
382
- once(event: 'disconnect', listener: (worker: Worker) => void): this;
383
- once(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
384
- once(event: 'fork', listener: (worker: Worker) => void): this;
385
- once(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
386
- 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.
387
- once(event: 'online', listener: (worker: Worker) => void): this;
388
- once(event: 'setup', listener: (settings: ClusterSettings) => void): this;
389
- prependListener(event: string, listener: (...args: any[]) => void): this;
390
- prependListener(event: 'disconnect', listener: (worker: Worker) => void): this;
391
- prependListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
392
- prependListener(event: 'fork', listener: (worker: Worker) => void): this;
393
- prependListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
394
- // the handle is a net.Socket or net.Server object, or undefined.
395
- prependListener(event: 'message', listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void): this;
396
- prependListener(event: 'online', listener: (worker: Worker) => void): this;
397
- prependListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
398
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
399
- prependOnceListener(event: 'disconnect', listener: (worker: Worker) => void): this;
400
- prependOnceListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
401
- prependOnceListener(event: 'fork', listener: (worker: Worker) => void): this;
402
- prependOnceListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
403
- // the handle is a net.Socket or net.Server object, or undefined.
404
- prependOnceListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this;
405
- prependOnceListener(event: 'online', listener: (worker: Worker) => void): this;
406
- prependOnceListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
407
- }
408
- const cluster: Cluster;
409
- export default cluster;
410
- }
411
- declare module 'node:cluster' {
412
- export * from 'cluster';
413
- export { default as default } from 'cluster';
414
- }