@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,10 +1,67 @@
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 `string_decoder` module provides an API for decoding `Buffer` objects into
6
+ * strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16
7
+ * characters. It can be accessed using:
8
+ *
9
+ * ```js
10
+ * const { StringDecoder } = require('string_decoder');
11
+ * ```
12
+ *
13
+ * The following example shows the basic use of the `StringDecoder` class.
14
+ *
15
+ * ```js
16
+ * const { StringDecoder } = require('string_decoder');
17
+ * const decoder = new StringDecoder('utf8');
18
+ *
19
+ * const cent = Buffer.from([0xC2, 0xA2]);
20
+ * console.log(decoder.write(cent));
21
+ *
22
+ * const euro = Buffer.from([0xE2, 0x82, 0xAC]);
23
+ * console.log(decoder.write(euro));
24
+ * ```
25
+ *
26
+ * When a `Buffer` instance is written to the `StringDecoder` instance, an
27
+ * internal buffer is used to ensure that the decoded string does not contain
28
+ * any incomplete multibyte characters. These are held in the buffer until the
29
+ * next call to `stringDecoder.write()` or until `stringDecoder.end()` is called.
30
+ *
31
+ * In the following example, the three UTF-8 encoded bytes of the European Euro
32
+ * symbol (`€`) are written over three separate operations:
33
+ *
34
+ * ```js
35
+ * const { StringDecoder } = require('string_decoder');
36
+ * const decoder = new StringDecoder('utf8');
37
+ *
38
+ * decoder.write(Buffer.from([0xE2]));
39
+ * decoder.write(Buffer.from([0x82]));
40
+ * console.log(decoder.end(Buffer.from([0xAC])));
41
+ * ```
42
+ * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/string_decoder.js)
43
+ */
4
44
  declare module 'string_decoder' {
5
45
  class StringDecoder {
6
46
  constructor(encoding?: BufferEncoding);
47
+ /**
48
+ * Returns a decoded string, ensuring that any incomplete multibyte characters at
49
+ * the end of the `Buffer`, or `TypedArray`, or `DataView` are omitted from the
50
+ * returned string and stored in an internal buffer for the next call to`stringDecoder.write()` or `stringDecoder.end()`.
51
+ * @since v0.1.99
52
+ * @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode.
53
+ */
7
54
  write(buffer: Buffer): string;
55
+ /**
56
+ * Returns any remaining input stored in the internal buffer as a string. Bytes
57
+ * representing incomplete UTF-8 and UTF-16 characters will be replaced with
58
+ * substitution characters appropriate for the character encoding.
59
+ *
60
+ * If the `buffer` argument is provided, one final call to `stringDecoder.write()`is performed before returning the remaining input.
61
+ * After `end()` is called, the `stringDecoder` object can be reused for new input.
62
+ * @since v0.9.3
63
+ * @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode.
64
+ */
8
65
  end(buffer?: Buffer): string;
9
66
  }
10
67
  }
@@ -0,0 +1,193 @@
1
+
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
+
4
+ /**
5
+ * The `node:test` module provides a standalone testing module.
6
+ * @see [source](https://github.com/nodejs/node/blob/v16.17.0/lib/test.js)
7
+ */
8
+ declare module 'node:test' {
9
+ /**
10
+ * The `test()` function is the value imported from the test module. Each invocation of this
11
+ * function results in the creation of a test point in the TAP output.
12
+ *
13
+ * The {@link TestContext} object passed to the fn argument can be used to perform actions
14
+ * related to the current test. Examples include skipping the test, adding additional TAP
15
+ * diagnostic information, or creating subtests.
16
+ *
17
+ * `test()` returns a {@link Promise} that resolves once the test completes. The return value
18
+ * can usually be discarded for top level tests. However, the return value from subtests should
19
+ * be used to prevent the parent test from finishing first and cancelling the subtest as shown
20
+ * in the following example.
21
+ *
22
+ * ```js
23
+ * test('top level test', async (t) => {
24
+ * // The setTimeout() in the following subtest would cause it to outlive its
25
+ * // parent test if 'await' is removed on the next line. Once the parent test
26
+ * // completes, it will cancel any outstanding subtests.
27
+ * await t.test('longer running subtest', async (t) => {
28
+ * return new Promise((resolve, reject) => {
29
+ * setTimeout(resolve, 1000);
30
+ * });
31
+ * });
32
+ * });
33
+ * ```
34
+ * @since v16.17.0
35
+ * @param name The name of the test, which is displayed when reporting test results.
36
+ * Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
37
+ * @param options Configuration options for the test
38
+ * @param fn The function under test. The first argument to this function is a
39
+ * {@link TestContext} object. If the test uses callbacks, the callback function is
40
+ * passed as the second argument. Default: A no-op function.
41
+ * @returns A {@link Promise} resolved with `undefined` once the test completes.
42
+ */
43
+ function test(name?: string, fn?: TestFn): Promise<void>;
44
+ function test(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
45
+ function test(options?: TestOptions, fn?: TestFn): Promise<void>;
46
+ function test(fn?: TestFn): Promise<void>;
47
+
48
+ /**
49
+ * @since v16.17.0
50
+ * @param name The name of the suite, which is displayed when reporting suite results.
51
+ * Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
52
+ * @param options Configuration options for the suite
53
+ * @param fn The function under suite. Default: A no-op function.
54
+ */
55
+ function describe(name?: string, options?: TestOptions, fn?: SuiteFn): void;
56
+ function describe(name?: string, fn?: SuiteFn): void;
57
+ function describe(options?: TestOptions, fn?: SuiteFn): void;
58
+ function describe(fn?: SuiteFn): void;
59
+
60
+ /**
61
+ * @since v16.17.0
62
+ * @param name The name of the test, which is displayed when reporting test results.
63
+ * Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
64
+ * @param options Configuration options for the test
65
+ * @param fn The function under test. If the test uses callbacks, the callback function is
66
+ * passed as the second argument. Default: A no-op function.
67
+ */
68
+ function it(name?: string, options?: TestOptions, fn?: ItFn): void;
69
+ function it(name?: string, fn?: ItFn): void;
70
+ function it(options?: TestOptions, fn?: ItFn): void;
71
+ function it(fn?: ItFn): void;
72
+
73
+ /**
74
+ * The type of a function under test. The first argument to this function is a
75
+ * {@link TestContext} object. If the test uses callbacks, the callback function is passed as
76
+ * the second argument.
77
+ */
78
+ type TestFn = (t: TestContext, done: (result?: any) => void) => any;
79
+
80
+ /**
81
+ * The type of a function under Suite.
82
+ * If the test uses callbacks, the callback function is passed as an argument
83
+ */
84
+ type SuiteFn = (done: (result?: any) => void) => void;
85
+
86
+ /**
87
+ * The type of a function under test.
88
+ * If the test uses callbacks, the callback function is passed as an argument
89
+ */
90
+ type ItFn = (done: (result?: any) => void) => any;
91
+
92
+ /**
93
+ * An instance of `TestContext` is passed to each test function in order to interact with the
94
+ * test runner. However, the `TestContext` constructor is not exposed as part of the API.
95
+ * @since v16.17.0
96
+ */
97
+ interface TestContext {
98
+ /**
99
+ * This function is used to write TAP diagnostics to the output. Any diagnostic information is
100
+ * included at the end of the test's results. This function does not return a value.
101
+ * @param message Message to be displayed as a TAP diagnostic.
102
+ * @since v16.17.0
103
+ */
104
+ diagnostic(message: string): void;
105
+
106
+ /**
107
+ * If `shouldRunOnlyTests` is truthy, the test context will only run tests that have the `only`
108
+ * option set. Otherwise, all tests are run. If Node.js was not started with the `--test-only`
109
+ * command-line option, this function is a no-op.
110
+ * @param shouldRunOnlyTests Whether or not to run `only` tests.
111
+ * @since v16.17.0
112
+ */
113
+ runOnly(shouldRunOnlyTests: boolean): void;
114
+
115
+ /**
116
+ * This function causes the test's output to indicate the test as skipped. If `message` is
117
+ * provided, it is included in the TAP output. Calling `skip()` does not terminate execution of
118
+ * the test function. This function does not return a value.
119
+ * @param message Optional skip message to be displayed in TAP output.
120
+ * @since v16.17.0
121
+ */
122
+ skip(message?: string): void;
123
+
124
+ /**
125
+ * This function adds a `TODO` directive to the test's output. If `message` is provided, it is
126
+ * included in the TAP output. Calling `todo()` does not terminate execution of the test
127
+ * function. This function does not return a value.
128
+ * @param message Optional `TODO` message to be displayed in TAP output.
129
+ * @since v16.17.0
130
+ */
131
+ todo(message?: string): void;
132
+
133
+ /**
134
+ * This function is used to create subtests under the current test. This function behaves in
135
+ * the same fashion as the top level {@link test} function.
136
+ * @since v16.17.0
137
+ * @param name The name of the test, which is displayed when reporting test results.
138
+ * Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
139
+ * @param options Configuration options for the test
140
+ * @param fn The function under test. This first argument to this function is a
141
+ * {@link TestContext} object. If the test uses callbacks, the callback function is
142
+ * passed as the second argument. Default: A no-op function.
143
+ * @returns A {@link Promise} resolved with `undefined` once the test completes.
144
+ */
145
+ test: typeof test;
146
+ }
147
+
148
+ interface TestOptions {
149
+ /**
150
+ * The number of tests that can be run at the same time. If unspecified, subtests inherit this
151
+ * value from their parent.
152
+ * @default 1
153
+ */
154
+ concurrency?: number;
155
+
156
+ /**
157
+ * If truthy, and the test context is configured to run `only` tests, then this test will be
158
+ * run. Otherwise, the test is skipped.
159
+ * @default false
160
+ */
161
+ only?: boolean;
162
+
163
+ /**
164
+ * Allows aborting an in-progress test.
165
+ * @since v16.17.0
166
+ */
167
+ signal?: AbortSignal;
168
+
169
+ /**
170
+ * If truthy, the test is skipped. If a string is provided, that string is displayed in the
171
+ * test results as the reason for skipping the test.
172
+ * @default false
173
+ */
174
+ skip?: boolean | string;
175
+
176
+ /**
177
+ * A number of milliseconds the test will fail after. If unspecified, subtests inherit this
178
+ * value from their parent.
179
+ * @default Infinity
180
+ * @since v16.17.0
181
+ */
182
+ timeout?: number;
183
+
184
+ /**
185
+ * If truthy, the test marked as `TODO`. If a string is provided, that string is displayed in
186
+ * the test results as the reason why the test is `TODO`.
187
+ * @default false
188
+ */
189
+ todo?: boolean | string;
190
+ }
191
+
192
+ export { test as default, test, describe, it };
193
+ }
@@ -0,0 +1,96 @@
1
+
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
+
4
+ /**
5
+ * The `timers/promises` API provides an alternative set of timer functions
6
+ * that return `Promise` objects. The API is accessible via`require('timers/promises')`.
7
+ *
8
+ * ```js
9
+ * import {
10
+ * setTimeout,
11
+ * setImmediate,
12
+ * setInterval,
13
+ * } from 'timers/promises';
14
+ * ```
15
+ * @since v15.0.0
16
+ */
17
+ declare module 'timers/promises' {
18
+ import { TimerOptions } from 'node:timers';
19
+ /**
20
+ * ```js
21
+ * import {
22
+ * setTimeout,
23
+ * } from 'timers/promises';
24
+ *
25
+ * const res = await setTimeout(100, 'result');
26
+ *
27
+ * console.log(res); // Prints 'result'
28
+ * ```
29
+ * @since v15.0.0
30
+ * @param [delay=1] The number of milliseconds to wait before fulfilling the promise.
31
+ * @param value A value with which the promise is fulfilled.
32
+ */
33
+ function setTimeout<T = void>(delay?: number, value?: T, options?: TimerOptions): Promise<T>;
34
+ /**
35
+ * ```js
36
+ * import {
37
+ * setImmediate,
38
+ * } from 'timers/promises';
39
+ *
40
+ * const res = await setImmediate('result');
41
+ *
42
+ * console.log(res); // Prints 'result'
43
+ * ```
44
+ * @since v15.0.0
45
+ * @param value A value with which the promise is fulfilled.
46
+ */
47
+ function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
48
+ /**
49
+ * Returns an async iterator that generates values in an interval of `delay` ms.
50
+ *
51
+ * ```js
52
+ * import {
53
+ * setInterval,
54
+ * } from 'timers/promises';
55
+ *
56
+ * const interval = 100;
57
+ * for await (const startTime of setInterval(interval, Date.now())) {
58
+ * const now = Date.now();
59
+ * console.log(now);
60
+ * if ((now - startTime) > 1000)
61
+ * break;
62
+ * }
63
+ * console.log(Date.now());
64
+ * ```
65
+ * @since v15.9.0
66
+ */
67
+ function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
68
+
69
+ interface Scheduler {
70
+ /**
71
+ * ```js
72
+ * import { scheduler } from 'node:timers/promises';
73
+ *
74
+ * await scheduler.wait(1000); // Wait one second before continuing
75
+ * ```
76
+ * An experimental API defined by the Scheduling APIs draft specification being developed as a standard Web Platform API.
77
+ * Calling timersPromises.scheduler.wait(delay, options) is roughly equivalent to calling timersPromises.setTimeout(delay, undefined, options) except that the ref option is not supported.
78
+ * @since v16.14.0
79
+ * @experimental
80
+ * @param [delay=1] The number of milliseconds to wait before fulfilling the promise.
81
+ */
82
+ wait: (delay?: number, options?: TimerOptions) => Promise<void>;
83
+ /**
84
+ * An experimental API defined by the Scheduling APIs draft specification being developed as a standard Web Platform API.
85
+ * Calling timersPromises.scheduler.yield() is equivalent to calling timersPromises.setImmediate() with no arguments.
86
+ * @since v16.14.0
87
+ * @experimental
88
+ */
89
+ yield: () => Promise<void>;
90
+ }
91
+
92
+ const scheduler: Scheduler;
93
+ }
94
+ declare module 'node:timers/promises' {
95
+ export * from 'timers/promises';
96
+ }
@@ -1,21 +1,96 @@
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 `timer` module exposes a global API for scheduling functions to
6
+ * be called at some future period of time. Because the timer functions are
7
+ * globals, there is no need to call `require('timers')` to use the API.
8
+ *
9
+ * The timer functions within Node.js implement a similar API as the timers API
10
+ * provided by Web Browsers but use a different internal implementation that is
11
+ * built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
12
+ * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/timers.js)
13
+ */
4
14
  declare module 'timers' {
5
- function setTimeout(callback: (...args: any[]) => void, ms?: number, ...args: any[]): NodeJS.Timeout;
6
- namespace setTimeout {
7
- function __promisify__(ms: number): Promise<void>;
8
- function __promisify__<T>(ms: number, value: T): Promise<T>;
15
+ import { Abortable } from 'node:events';
16
+ import { setTimeout as setTimeoutPromise, setImmediate as setImmediatePromise, setInterval as setIntervalPromise } from 'node:timers/promises';
17
+ interface TimerOptions extends Abortable {
18
+ /**
19
+ * Set to `false` to indicate that the scheduled `Timeout`
20
+ * should not require the Node.js event loop to remain active.
21
+ * @default true
22
+ */
23
+ ref?: boolean | undefined;
9
24
  }
10
- function clearTimeout(timeoutId: NodeJS.Timeout): void;
11
- function setInterval(callback: (...args: any[]) => void, ms?: number, ...args: any[]): NodeJS.Timeout;
12
- function clearInterval(intervalId: NodeJS.Timeout): void;
13
- function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate;
14
- namespace setImmediate {
15
- function __promisify__(): Promise<void>;
16
- function __promisify__<T>(value: T): Promise<T>;
25
+ let setTimeout: typeof global.setTimeout;
26
+ let clearTimeout: typeof global.clearTimeout;
27
+ let setInterval: typeof global.setInterval;
28
+ let clearInterval: typeof global.clearInterval;
29
+ let setImmediate: typeof global.setImmediate;
30
+ let clearImmediate: typeof global.clearImmediate;
31
+ global {
32
+ namespace NodeJS {
33
+ // compatibility with older typings
34
+ interface Timer extends RefCounted {
35
+ hasRef(): boolean;
36
+ refresh(): this;
37
+ [Symbol.toPrimitive](): number;
38
+ }
39
+ interface Immediate extends RefCounted {
40
+ /**
41
+ * If true, the `Immediate` object will keep the Node.js event loop active.
42
+ * @since v11.0.0
43
+ */
44
+ hasRef(): boolean;
45
+ _onImmediate: Function; // to distinguish it from the Timeout class
46
+ }
47
+ interface Timeout extends Timer {
48
+ /**
49
+ * If true, the `Timeout` object will keep the Node.js event loop active.
50
+ * @since v11.0.0
51
+ */
52
+ hasRef(): boolean;
53
+ /**
54
+ * Sets the timer's start time to the current time, and reschedules the timer to
55
+ * call its callback at the previously specified duration adjusted to the current
56
+ * time. This is useful for refreshing a timer without allocating a new
57
+ * JavaScript object.
58
+ *
59
+ * Using this on a timer that has already called its callback will reactivate the
60
+ * timer.
61
+ * @since v10.2.0
62
+ * @return a reference to `timeout`
63
+ */
64
+ refresh(): this;
65
+ [Symbol.toPrimitive](): number;
66
+ }
67
+ }
68
+ function setTimeout<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
69
+ // util.promisify no rest args compability
70
+ // tslint:disable-next-line void-return
71
+ function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
72
+ namespace setTimeout {
73
+ const __promisify__: typeof setTimeoutPromise;
74
+ }
75
+ function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void;
76
+ function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
77
+ // util.promisify no rest args compability
78
+ // tslint:disable-next-line void-return
79
+ function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timer;
80
+ namespace setInterval {
81
+ const __promisify__: typeof setIntervalPromise;
82
+ }
83
+ function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void;
84
+ function setImmediate<TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate;
85
+ // util.promisify no rest args compability
86
+ // tslint:disable-next-line void-return
87
+ function setImmediate(callback: (args: void) => void): NodeJS.Immediate;
88
+ namespace setImmediate {
89
+ const __promisify__: typeof setImmediatePromise;
90
+ }
91
+ function clearImmediate(immediateId: NodeJS.Immediate | undefined): void;
92
+ function queueMicrotask(callback: () => void): void;
17
93
  }
18
- function clearImmediate(immediateId: NodeJS.Immediate): void;
19
94
  }
20
95
  declare module 'node:timers' {
21
96
  export * from 'timers';