@rio-cloud/cdk-v2-constructs 8.2.0 → 8.2.1
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.
- package/.jsii +2 -2
- package/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/node/assert/strict.d.ts +105 -2
- package/node_modules/@types/node/assert.d.ts +211 -92
- package/node_modules/@types/node/async_hooks.d.ts +103 -19
- package/node_modules/@types/node/buffer.buffer.d.ts +472 -0
- package/node_modules/@types/node/buffer.d.ts +88 -516
- package/node_modules/@types/node/child_process.d.ts +167 -231
- package/node_modules/@types/node/cluster.d.ts +172 -26
- package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@types/node/console.d.ts +66 -28
- package/node_modules/@types/node/constants.d.ts +14 -12
- package/node_modules/@types/node/crypto.d.ts +1458 -497
- package/node_modules/@types/node/dgram.d.ts +44 -30
- package/node_modules/@types/node/diagnostics_channel.d.ts +389 -4
- package/node_modules/@types/node/dns/promises.d.ts +120 -42
- package/node_modules/@types/node/dns.d.ts +209 -95
- package/node_modules/@types/node/domain.d.ts +14 -18
- package/node_modules/@types/node/events.d.ts +245 -113
- package/node_modules/@types/node/fs/promises.d.ts +194 -96
- package/node_modules/@types/node/fs.d.ts +695 -270
- package/node_modules/@types/node/globals.d.ts +97 -308
- package/node_modules/@types/node/globals.typedarray.d.ts +41 -0
- package/node_modules/@types/node/http.d.ts +363 -97
- package/node_modules/@types/node/http2.d.ts +684 -231
- package/node_modules/@types/node/https.d.ts +122 -87
- package/node_modules/@types/node/index.d.ts +24 -11
- package/node_modules/@types/node/inspector.d.ts +220 -2690
- package/node_modules/@types/node/inspector.generated.d.ts +4239 -0
- package/node_modules/@types/node/module.d.ts +705 -149
- package/node_modules/@types/node/net.d.ts +178 -54
- package/node_modules/@types/node/os.d.ts +47 -17
- package/node_modules/@types/node/package.json +22 -97
- package/node_modules/@types/node/path.d.ts +12 -3
- package/node_modules/@types/node/perf_hooks.d.ts +500 -97
- package/node_modules/@types/node/process.d.ts +657 -87
- package/node_modules/@types/node/punycode.d.ts +5 -5
- package/node_modules/@types/node/querystring.d.ts +24 -13
- package/node_modules/@types/node/readline/promises.d.ts +25 -14
- package/node_modules/@types/node/readline.d.ts +102 -41
- package/node_modules/@types/node/repl.d.ts +38 -30
- package/node_modules/@types/node/sea.d.ts +162 -0
- package/node_modules/@types/node/sqlite.d.ts +1040 -0
- package/node_modules/@types/node/stream/consumers.d.ts +33 -7
- package/node_modules/@types/node/stream/promises.d.ts +8 -1
- package/node_modules/@types/node/stream/web.d.ts +251 -28
- package/node_modules/@types/node/stream.d.ts +1060 -1055
- package/node_modules/@types/node/string_decoder.d.ts +8 -8
- package/node_modules/@types/node/test.d.ts +2133 -1166
- package/node_modules/@types/node/timers/promises.d.ts +31 -16
- package/node_modules/@types/node/timers.d.ts +159 -114
- package/node_modules/@types/node/tls.d.ts +232 -163
- package/node_modules/@types/node/trace_events.d.ts +43 -28
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
- package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +103 -0
- package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +103 -0
- package/node_modules/@types/node/tty.d.ts +9 -9
- package/node_modules/@types/node/url.d.ts +236 -84
- package/node_modules/@types/node/util.d.ts +562 -412
- package/node_modules/@types/node/v8.d.ts +368 -21
- package/node_modules/@types/node/vm.d.ts +443 -149
- package/node_modules/@types/node/wasi.d.ts +62 -18
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/node_modules/@types/node/web-globals/events.d.ts +97 -0
- package/node_modules/@types/node/web-globals/fetch.d.ts +62 -0
- package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
- package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
- package/node_modules/@types/node/worker_threads.d.ts +310 -107
- package/node_modules/@types/node/zlib.d.ts +301 -73
- package/node_modules/undici-types/LICENSE +21 -0
- package/node_modules/undici-types/agent.d.ts +13 -12
- package/node_modules/undici-types/api.d.ts +26 -26
- package/node_modules/undici-types/balanced-pool.d.ts +19 -7
- package/node_modules/undici-types/cache-interceptor.d.ts +173 -0
- package/node_modules/undici-types/client-stats.d.ts +15 -0
- package/node_modules/undici-types/client.d.ts +26 -15
- package/node_modules/undici-types/connector.d.ts +2 -2
- package/node_modules/undici-types/cookies.d.ts +2 -0
- package/node_modules/undici-types/diagnostics-channel.d.ts +19 -12
- package/node_modules/undici-types/dispatcher.d.ts +148 -113
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
- package/node_modules/undici-types/errors.d.ts +79 -46
- package/node_modules/undici-types/eventsource.d.ts +66 -0
- package/node_modules/undici-types/fetch.d.ts +41 -39
- package/node_modules/undici-types/formdata.d.ts +8 -8
- package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
- package/node_modules/undici-types/global-origin.d.ts +5 -5
- package/node_modules/undici-types/h2c-client.d.ts +73 -0
- package/node_modules/undici-types/handlers.d.ts +11 -5
- package/node_modules/undici-types/header.d.ts +157 -1
- package/node_modules/undici-types/index.d.ts +68 -43
- package/node_modules/undici-types/interceptors.d.ts +71 -3
- package/node_modules/undici-types/mock-agent.d.ts +36 -18
- package/node_modules/undici-types/mock-call-history.d.ts +111 -0
- package/node_modules/undici-types/mock-client.d.ts +6 -4
- package/node_modules/undici-types/mock-errors.d.ts +3 -3
- package/node_modules/undici-types/mock-interceptor.d.ts +24 -23
- package/node_modules/undici-types/mock-pool.d.ts +6 -4
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/patch.d.ts +0 -42
- package/node_modules/undici-types/pool-stats.d.ts +8 -8
- package/node_modules/undici-types/pool.d.ts +21 -8
- package/node_modules/undici-types/proxy-agent.d.ts +5 -6
- package/node_modules/undici-types/readable.d.ts +24 -17
- package/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/node_modules/undici-types/retry-handler.d.ts +125 -0
- package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
- package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
- package/node_modules/undici-types/util.d.ts +18 -0
- package/node_modules/undici-types/utility.d.ts +7 -0
- package/node_modules/undici-types/webidl.d.ts +157 -36
- package/node_modules/undici-types/websocket.d.ts +67 -12
- package/package.json +9 -60
- package/version.json +1 -1
- package/node_modules/@types/node/dom-events.d.ts +0 -122
- package/node_modules/@types/node/globals.global.d.ts +0 -1
- package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
- package/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
- package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
- package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2362
- package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
- package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
- package/node_modules/@types/node/ts4.8/console.d.ts +0 -415
- package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
- package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4455
- package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -586
- package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -191
- package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
- package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
- package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
- package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
- package/node_modules/@types/node/ts4.8/events.d.ts +0 -796
- package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1232
- package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4289
- package/node_modules/@types/node/ts4.8/globals.d.ts +0 -381
- package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
- package/node_modules/@types/node/ts4.8/http.d.ts +0 -1888
- package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
- package/node_modules/@types/node/ts4.8/https.d.ts +0 -550
- package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
- package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
- package/node_modules/@types/node/ts4.8/module.d.ts +0 -287
- package/node_modules/@types/node/ts4.8/net.d.ts +0 -949
- package/node_modules/@types/node/ts4.8/os.d.ts +0 -477
- package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
- package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -639
- package/node_modules/@types/node/ts4.8/process.d.ts +0 -1532
- package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
- package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
- package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
- package/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
- package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
- package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
- package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
- package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -350
- package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
- package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
- package/node_modules/@types/node/ts4.8/test.d.ts +0 -1382
- package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
- package/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
- package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
- package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
- package/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
- package/node_modules/@types/node/ts4.8/url.d.ts +0 -927
- package/node_modules/@types/node/ts4.8/util.d.ts +0 -2186
- package/node_modules/@types/node/ts4.8/v8.d.ts +0 -635
- package/node_modules/@types/node/ts4.8/vm.d.ts +0 -901
- package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -158
- package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
- package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
- package/node_modules/argparse/CHANGELOG.md +0 -216
- package/node_modules/undici-types/file.d.ts +0 -39
- package/node_modules/undici-types/filereader.d.ts +0 -54
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `timers/promises` API provides an alternative set of timer functions
|
|
3
|
-
* that return `Promise` objects. The API is accessible via
|
|
3
|
+
* that return `Promise` objects. The API is accessible via
|
|
4
|
+
* `require('node:timers/promises')`.
|
|
4
5
|
*
|
|
5
6
|
* ```js
|
|
6
7
|
* import {
|
|
7
8
|
* setTimeout,
|
|
8
9
|
* setImmediate,
|
|
9
10
|
* setInterval,
|
|
10
|
-
* } from 'timers/promises';
|
|
11
|
+
* } from 'node:timers/promises';
|
|
11
12
|
* ```
|
|
12
13
|
* @since v15.0.0
|
|
14
|
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/timers/promises.js)
|
|
13
15
|
*/
|
|
14
16
|
declare module "timers/promises" {
|
|
15
17
|
import { TimerOptions } from "node:timers";
|
|
@@ -17,14 +19,15 @@ declare module "timers/promises" {
|
|
|
17
19
|
* ```js
|
|
18
20
|
* import {
|
|
19
21
|
* setTimeout,
|
|
20
|
-
* } from 'timers/promises';
|
|
22
|
+
* } from 'node:timers/promises';
|
|
21
23
|
*
|
|
22
24
|
* const res = await setTimeout(100, 'result');
|
|
23
25
|
*
|
|
24
26
|
* console.log(res); // Prints 'result'
|
|
25
27
|
* ```
|
|
26
28
|
* @since v15.0.0
|
|
27
|
-
* @param
|
|
29
|
+
* @param delay The number of milliseconds to wait before fulfilling the
|
|
30
|
+
* promise. **Default:** `1`.
|
|
28
31
|
* @param value A value with which the promise is fulfilled.
|
|
29
32
|
*/
|
|
30
33
|
function setTimeout<T = void>(delay?: number, value?: T, options?: TimerOptions): Promise<T>;
|
|
@@ -32,7 +35,7 @@ declare module "timers/promises" {
|
|
|
32
35
|
* ```js
|
|
33
36
|
* import {
|
|
34
37
|
* setImmediate,
|
|
35
|
-
* } from 'timers/promises';
|
|
38
|
+
* } from 'node:timers/promises';
|
|
36
39
|
*
|
|
37
40
|
* const res = await setImmediate('result');
|
|
38
41
|
*
|
|
@@ -50,7 +53,7 @@ declare module "timers/promises" {
|
|
|
50
53
|
* ```js
|
|
51
54
|
* import {
|
|
52
55
|
* setInterval,
|
|
53
|
-
* } from 'timers/promises';
|
|
56
|
+
* } from 'node:timers/promises';
|
|
54
57
|
*
|
|
55
58
|
* const interval = 100;
|
|
56
59
|
* for await (const startTime of setInterval(interval, Date.now())) {
|
|
@@ -62,29 +65,41 @@ declare module "timers/promises" {
|
|
|
62
65
|
* console.log(Date.now());
|
|
63
66
|
* ```
|
|
64
67
|
* @since v15.9.0
|
|
68
|
+
* @param delay The number of milliseconds to wait between iterations.
|
|
69
|
+
* **Default:** `1`.
|
|
70
|
+
* @param value A value with which the iterator returns.
|
|
65
71
|
*/
|
|
66
|
-
function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions):
|
|
72
|
+
function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): NodeJS.AsyncIterator<T>;
|
|
67
73
|
interface Scheduler {
|
|
68
74
|
/**
|
|
75
|
+
* An experimental API defined by the [Scheduling APIs](https://github.com/WICG/scheduling-apis) draft specification
|
|
76
|
+
* being developed as a standard Web Platform API.
|
|
77
|
+
*
|
|
78
|
+
* Calling `timersPromises.scheduler.wait(delay, options)` is roughly equivalent
|
|
79
|
+
* to calling `timersPromises.setTimeout(delay, undefined, options)` except that
|
|
80
|
+
* the `ref` option is not supported.
|
|
81
|
+
*
|
|
69
82
|
* ```js
|
|
70
83
|
* import { scheduler } from 'node:timers/promises';
|
|
71
84
|
*
|
|
72
85
|
* await scheduler.wait(1000); // Wait one second before continuing
|
|
73
86
|
* ```
|
|
74
|
-
*
|
|
75
|
-
* Calling timersPromises.scheduler.wait(delay, options) is roughly equivalent to calling timersPromises.setTimeout(delay, undefined, options) except that the ref option is not supported.
|
|
76
|
-
* @since v16.14.0
|
|
87
|
+
* @since v17.3.0, v16.14.0
|
|
77
88
|
* @experimental
|
|
78
|
-
* @param
|
|
89
|
+
* @param delay The number of milliseconds to wait before resolving the
|
|
90
|
+
* promise.
|
|
79
91
|
*/
|
|
80
|
-
wait
|
|
92
|
+
wait(delay: number, options?: { signal?: AbortSignal }): Promise<void>;
|
|
81
93
|
/**
|
|
82
|
-
* An experimental API defined by the Scheduling APIs draft specification
|
|
83
|
-
*
|
|
84
|
-
*
|
|
94
|
+
* An experimental API defined by the [Scheduling APIs](https://github.com/WICG/scheduling-apis) draft specification
|
|
95
|
+
* being developed as a standard Web Platform API.
|
|
96
|
+
*
|
|
97
|
+
* Calling `timersPromises.scheduler.yield()` is equivalent to calling
|
|
98
|
+
* `timersPromises.setImmediate()` with no arguments.
|
|
99
|
+
* @since v17.3.0, v16.14.0
|
|
85
100
|
* @experimental
|
|
86
101
|
*/
|
|
87
|
-
yield
|
|
102
|
+
yield(): Promise<void>;
|
|
88
103
|
}
|
|
89
104
|
const scheduler: Scheduler;
|
|
90
105
|
}
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `timer` module exposes a global API for scheduling functions to
|
|
3
3
|
* be called at some future period of time. Because the timer functions are
|
|
4
|
-
* globals, there is no need to
|
|
4
|
+
* globals, there is no need to import `node:timers` to use the API.
|
|
5
5
|
*
|
|
6
6
|
* The timer functions within Node.js implement a similar API as the timers API
|
|
7
7
|
* provided by Web Browsers but use a different internal implementation that is
|
|
8
8
|
* built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/timers.js)
|
|
10
10
|
*/
|
|
11
11
|
declare module "timers" {
|
|
12
12
|
import { Abortable } from "node:events";
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
setInterval as setIntervalPromise,
|
|
16
|
-
setTimeout as setTimeoutPromise,
|
|
17
|
-
} from "node:timers/promises";
|
|
18
|
-
interface TimerOptions extends Abortable {
|
|
13
|
+
import * as promises from "node:timers/promises";
|
|
14
|
+
export interface TimerOptions extends Abortable {
|
|
19
15
|
/**
|
|
20
16
|
* Set to `false` to indicate that the scheduled `Timeout`
|
|
21
17
|
* should not require the Node.js event loop to remain active.
|
|
@@ -23,38 +19,33 @@ declare module "timers" {
|
|
|
23
19
|
*/
|
|
24
20
|
ref?: boolean | undefined;
|
|
25
21
|
}
|
|
26
|
-
let setTimeout: typeof global.setTimeout;
|
|
27
|
-
let clearTimeout: typeof global.clearTimeout;
|
|
28
|
-
let setInterval: typeof global.setInterval;
|
|
29
|
-
let clearInterval: typeof global.clearInterval;
|
|
30
|
-
let setImmediate: typeof global.setImmediate;
|
|
31
|
-
let clearImmediate: typeof global.clearImmediate;
|
|
32
22
|
global {
|
|
33
23
|
namespace NodeJS {
|
|
34
|
-
// compatibility with older typings
|
|
35
|
-
interface Timer extends RefCounted {
|
|
36
|
-
hasRef(): boolean;
|
|
37
|
-
refresh(): this;
|
|
38
|
-
[Symbol.toPrimitive](): number;
|
|
39
|
-
}
|
|
40
24
|
/**
|
|
41
25
|
* This object is created internally and is returned from `setImmediate()`. It
|
|
42
26
|
* can be passed to `clearImmediate()` in order to cancel the scheduled
|
|
43
27
|
* actions.
|
|
44
28
|
*
|
|
45
29
|
* By default, when an immediate is scheduled, the Node.js event loop will continue
|
|
46
|
-
* running as long as the immediate is active. The `Immediate` object returned by
|
|
47
|
-
*
|
|
30
|
+
* running as long as the immediate is active. The `Immediate` object returned by
|
|
31
|
+
* `setImmediate()` exports both `immediate.ref()` and `immediate.unref()`
|
|
32
|
+
* functions that can be used to control this default behavior.
|
|
48
33
|
*/
|
|
49
|
-
|
|
34
|
+
interface Immediate extends RefCounted, Disposable {
|
|
35
|
+
/**
|
|
36
|
+
* If true, the `Immediate` object will keep the Node.js event loop active.
|
|
37
|
+
* @since v11.0.0
|
|
38
|
+
*/
|
|
39
|
+
hasRef(): boolean;
|
|
50
40
|
/**
|
|
51
|
-
* When called, requests that the Node.js event loop _not_ exit so long as the
|
|
41
|
+
* When called, requests that the Node.js event loop _not_ exit so long as the
|
|
42
|
+
* `Immediate` is active. Calling `immediate.ref()` multiple times will have no
|
|
52
43
|
* effect.
|
|
53
44
|
*
|
|
54
45
|
* By default, all `Immediate` objects are "ref'ed", making it normally unnecessary
|
|
55
46
|
* to call `immediate.ref()` unless `immediate.unref()` had been called previously.
|
|
56
47
|
* @since v9.7.0
|
|
57
|
-
* @
|
|
48
|
+
* @returns a reference to `immediate`
|
|
58
49
|
*/
|
|
59
50
|
ref(): this;
|
|
60
51
|
/**
|
|
@@ -63,53 +54,58 @@ declare module "timers" {
|
|
|
63
54
|
* running, the process may exit before the `Immediate` object's callback is
|
|
64
55
|
* invoked. Calling `immediate.unref()` multiple times will have no effect.
|
|
65
56
|
* @since v9.7.0
|
|
66
|
-
* @
|
|
57
|
+
* @returns a reference to `immediate`
|
|
67
58
|
*/
|
|
68
59
|
unref(): this;
|
|
69
|
-
/**
|
|
70
|
-
* If true, the `Immediate` object will keep the Node.js event loop active.
|
|
71
|
-
* @since v11.0.0
|
|
72
|
-
*/
|
|
73
|
-
hasRef(): boolean;
|
|
74
|
-
_onImmediate: Function; // to distinguish it from the Timeout class
|
|
75
60
|
/**
|
|
76
61
|
* Cancels the immediate. This is similar to calling `clearImmediate()`.
|
|
77
|
-
* @since v20.5.0
|
|
62
|
+
* @since v20.5.0, v18.18.0
|
|
78
63
|
*/
|
|
79
64
|
[Symbol.dispose](): void;
|
|
65
|
+
_onImmediate(...args: any[]): void;
|
|
66
|
+
}
|
|
67
|
+
// Legacy interface used in Node.js v9 and prior
|
|
68
|
+
// TODO: remove in a future major version bump
|
|
69
|
+
/** @deprecated Use `NodeJS.Timeout` instead. */
|
|
70
|
+
interface Timer extends RefCounted {
|
|
71
|
+
hasRef(): boolean;
|
|
72
|
+
refresh(): this;
|
|
73
|
+
[Symbol.toPrimitive](): number;
|
|
80
74
|
}
|
|
81
75
|
/**
|
|
82
|
-
* This object is created internally and is returned from `setTimeout()` and
|
|
83
|
-
*
|
|
76
|
+
* This object is created internally and is returned from `setTimeout()` and
|
|
77
|
+
* `setInterval()`. It can be passed to either `clearTimeout()` or
|
|
78
|
+
* `clearInterval()` in order to cancel the scheduled actions.
|
|
84
79
|
*
|
|
85
|
-
* By default, when a timer is scheduled using either `setTimeout()` or
|
|
80
|
+
* By default, when a timer is scheduled using either `setTimeout()` or
|
|
81
|
+
* `setInterval()`, the Node.js event loop will continue running as long as the
|
|
86
82
|
* timer is active. Each of the `Timeout` objects returned by these functions
|
|
87
83
|
* export both `timeout.ref()` and `timeout.unref()` functions that can be used to
|
|
88
84
|
* control this default behavior.
|
|
89
85
|
*/
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* When called, requests that the Node.js event loop _not_ exit so long as the`Timeout` is active. Calling `timeout.ref()` multiple times will have no effect.
|
|
93
|
-
*
|
|
94
|
-
* By default, all `Timeout` objects are "ref'ed", making it normally unnecessary
|
|
95
|
-
* to call `timeout.ref()` unless `timeout.unref()` had been called previously.
|
|
96
|
-
* @since v0.9.1
|
|
97
|
-
* @return a reference to `timeout`
|
|
98
|
-
*/
|
|
99
|
-
ref(): this;
|
|
86
|
+
interface Timeout extends RefCounted, Disposable, Timer {
|
|
100
87
|
/**
|
|
101
|
-
*
|
|
102
|
-
* to remain active. If there is no other activity keeping the event loop running,
|
|
103
|
-
* the process may exit before the `Timeout` object's callback is invoked. Calling`timeout.unref()` multiple times will have no effect.
|
|
88
|
+
* Cancels the timeout.
|
|
104
89
|
* @since v0.9.1
|
|
105
|
-
* @
|
|
90
|
+
* @legacy Use `clearTimeout()` instead.
|
|
91
|
+
* @returns a reference to `timeout`
|
|
106
92
|
*/
|
|
107
|
-
|
|
93
|
+
close(): this;
|
|
108
94
|
/**
|
|
109
95
|
* If true, the `Timeout` object will keep the Node.js event loop active.
|
|
110
96
|
* @since v11.0.0
|
|
111
97
|
*/
|
|
112
98
|
hasRef(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* When called, requests that the Node.js event loop _not_ exit so long as the
|
|
101
|
+
* `Timeout` is active. Calling `timeout.ref()` multiple times will have no effect.
|
|
102
|
+
*
|
|
103
|
+
* By default, all `Timeout` objects are "ref'ed", making it normally unnecessary
|
|
104
|
+
* to call `timeout.ref()` unless `timeout.unref()` had been called previously.
|
|
105
|
+
* @since v0.9.1
|
|
106
|
+
* @returns a reference to `timeout`
|
|
107
|
+
*/
|
|
108
|
+
ref(): this;
|
|
113
109
|
/**
|
|
114
110
|
* Sets the timer's start time to the current time, and reschedules the timer to
|
|
115
111
|
* call its callback at the previously specified duration adjusted to the current
|
|
@@ -119,121 +115,170 @@ declare module "timers" {
|
|
|
119
115
|
* Using this on a timer that has already called its callback will reactivate the
|
|
120
116
|
* timer.
|
|
121
117
|
* @since v10.2.0
|
|
122
|
-
* @
|
|
118
|
+
* @returns a reference to `timeout`
|
|
123
119
|
*/
|
|
124
120
|
refresh(): this;
|
|
121
|
+
/**
|
|
122
|
+
* When called, the active `Timeout` object will not require the Node.js event loop
|
|
123
|
+
* to remain active. If there is no other activity keeping the event loop running,
|
|
124
|
+
* the process may exit before the `Timeout` object's callback is invoked. Calling
|
|
125
|
+
* `timeout.unref()` multiple times will have no effect.
|
|
126
|
+
* @since v0.9.1
|
|
127
|
+
* @returns a reference to `timeout`
|
|
128
|
+
*/
|
|
129
|
+
unref(): this;
|
|
130
|
+
/**
|
|
131
|
+
* Coerce a `Timeout` to a primitive. The primitive can be used to
|
|
132
|
+
* clear the `Timeout`. The primitive can only be used in the
|
|
133
|
+
* same thread where the timeout was created. Therefore, to use it
|
|
134
|
+
* across `worker_threads` it must first be passed to the correct
|
|
135
|
+
* thread. This allows enhanced compatibility with browser
|
|
136
|
+
* `setTimeout()` and `setInterval()` implementations.
|
|
137
|
+
* @since v14.9.0, v12.19.0
|
|
138
|
+
*/
|
|
125
139
|
[Symbol.toPrimitive](): number;
|
|
126
140
|
/**
|
|
127
141
|
* Cancels the timeout.
|
|
128
|
-
* @since v20.5.0
|
|
142
|
+
* @since v20.5.0, v18.18.0
|
|
129
143
|
*/
|
|
130
144
|
[Symbol.dispose](): void;
|
|
145
|
+
_onTimeout(...args: any[]): void;
|
|
131
146
|
}
|
|
132
147
|
}
|
|
133
148
|
/**
|
|
134
|
-
* Schedules execution of
|
|
135
|
-
*
|
|
136
|
-
* The `callback` will likely not be invoked in precisely `delay` milliseconds.
|
|
137
|
-
* Node.js makes no guarantees about the exact timing of when callbacks will fire,
|
|
138
|
-
* nor of their ordering. The callback will be called as close as possible to the
|
|
139
|
-
* time specified.
|
|
149
|
+
* Schedules the "immediate" execution of the `callback` after I/O events'
|
|
150
|
+
* callbacks.
|
|
140
151
|
*
|
|
141
|
-
* When
|
|
152
|
+
* When multiple calls to `setImmediate()` are made, the `callback` functions are
|
|
153
|
+
* queued for execution in the order in which they are created. The entire callback
|
|
154
|
+
* queue is processed every event loop iteration. If an immediate timer is queued
|
|
155
|
+
* from inside an executing callback, that timer will not be triggered until the
|
|
156
|
+
* next event loop iteration.
|
|
142
157
|
*
|
|
143
158
|
* If `callback` is not a function, a `TypeError` will be thrown.
|
|
144
159
|
*
|
|
145
|
-
* This method has a custom variant for promises that is available using
|
|
146
|
-
*
|
|
147
|
-
* @
|
|
148
|
-
* @param
|
|
160
|
+
* This method has a custom variant for promises that is available using
|
|
161
|
+
* `timersPromises.setImmediate()`.
|
|
162
|
+
* @since v0.9.1
|
|
163
|
+
* @param callback The function to call at the end of this turn of
|
|
164
|
+
* the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout)
|
|
149
165
|
* @param args Optional arguments to pass when the `callback` is called.
|
|
150
|
-
* @
|
|
166
|
+
* @returns for use with `clearImmediate()`
|
|
151
167
|
*/
|
|
152
|
-
function
|
|
168
|
+
function setImmediate<TArgs extends any[]>(
|
|
153
169
|
callback: (...args: TArgs) => void,
|
|
154
|
-
ms?: number,
|
|
155
170
|
...args: TArgs
|
|
156
|
-
): NodeJS.
|
|
157
|
-
//
|
|
171
|
+
): NodeJS.Immediate;
|
|
172
|
+
// Allow a single void-accepting argument to be optional in arguments lists.
|
|
173
|
+
// Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258)
|
|
158
174
|
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
159
|
-
function
|
|
160
|
-
namespace
|
|
161
|
-
|
|
175
|
+
function setImmediate(callback: (_: void) => void): NodeJS.Immediate;
|
|
176
|
+
namespace setImmediate {
|
|
177
|
+
import __promisify__ = promises.setImmediate;
|
|
178
|
+
export { __promisify__ };
|
|
162
179
|
}
|
|
163
|
-
/**
|
|
164
|
-
* Cancels a `Timeout` object created by `setTimeout()`.
|
|
165
|
-
* @since v0.0.1
|
|
166
|
-
* @param timeout A `Timeout` object as returned by {@link setTimeout} or the `primitive` of the `Timeout` object as a string or a number.
|
|
167
|
-
*/
|
|
168
|
-
function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void;
|
|
169
180
|
/**
|
|
170
181
|
* Schedules repeated execution of `callback` every `delay` milliseconds.
|
|
171
182
|
*
|
|
172
|
-
* When `delay` is larger than `2147483647` or less than `1`, the `delay`
|
|
173
|
-
* set to `1`. Non-integer delays are truncated to an integer.
|
|
183
|
+
* When `delay` is larger than `2147483647` or less than `1` or `NaN`, the `delay`
|
|
184
|
+
* will be set to `1`. Non-integer delays are truncated to an integer.
|
|
174
185
|
*
|
|
175
186
|
* If `callback` is not a function, a `TypeError` will be thrown.
|
|
176
187
|
*
|
|
177
|
-
* This method has a custom variant for promises that is available using
|
|
188
|
+
* This method has a custom variant for promises that is available using
|
|
189
|
+
* `timersPromises.setInterval()`.
|
|
178
190
|
* @since v0.0.1
|
|
179
191
|
* @param callback The function to call when the timer elapses.
|
|
180
|
-
* @param
|
|
192
|
+
* @param delay The number of milliseconds to wait before calling the
|
|
193
|
+
* `callback`. **Default:** `1`.
|
|
181
194
|
* @param args Optional arguments to pass when the `callback` is called.
|
|
182
|
-
* @
|
|
195
|
+
* @returns for use with `clearInterval()`
|
|
183
196
|
*/
|
|
184
197
|
function setInterval<TArgs extends any[]>(
|
|
185
198
|
callback: (...args: TArgs) => void,
|
|
186
|
-
|
|
199
|
+
delay?: number,
|
|
187
200
|
...args: TArgs
|
|
188
201
|
): NodeJS.Timeout;
|
|
189
|
-
//
|
|
202
|
+
// Allow a single void-accepting argument to be optional in arguments lists.
|
|
203
|
+
// Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258)
|
|
190
204
|
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
191
|
-
function setInterval(callback: (
|
|
192
|
-
namespace setInterval {
|
|
193
|
-
const __promisify__: typeof setIntervalPromise;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Cancels a `Timeout` object created by `setInterval()`.
|
|
197
|
-
* @since v0.0.1
|
|
198
|
-
* @param timeout A `Timeout` object as returned by {@link setInterval} or the `primitive` of the `Timeout` object as a string or a number.
|
|
199
|
-
*/
|
|
200
|
-
function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void;
|
|
205
|
+
function setInterval(callback: (_: void) => void, delay?: number): NodeJS.Timeout;
|
|
201
206
|
/**
|
|
202
|
-
* Schedules
|
|
203
|
-
* callbacks.
|
|
207
|
+
* Schedules execution of a one-time `callback` after `delay` milliseconds.
|
|
204
208
|
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
209
|
+
* The `callback` will likely not be invoked in precisely `delay` milliseconds.
|
|
210
|
+
* Node.js makes no guarantees about the exact timing of when callbacks will fire,
|
|
211
|
+
* nor of their ordering. The callback will be called as close as possible to the
|
|
212
|
+
* time specified.
|
|
213
|
+
*
|
|
214
|
+
* When `delay` is larger than `2147483647` or less than `1` or `NaN`, the `delay`
|
|
215
|
+
* will be set to `1`. Non-integer delays are truncated to an integer.
|
|
210
216
|
*
|
|
211
217
|
* If `callback` is not a function, a `TypeError` will be thrown.
|
|
212
218
|
*
|
|
213
|
-
* This method has a custom variant for promises that is available using
|
|
214
|
-
*
|
|
215
|
-
* @
|
|
219
|
+
* This method has a custom variant for promises that is available using
|
|
220
|
+
* `timersPromises.setTimeout()`.
|
|
221
|
+
* @since v0.0.1
|
|
222
|
+
* @param callback The function to call when the timer elapses.
|
|
223
|
+
* @param delay The number of milliseconds to wait before calling the
|
|
224
|
+
* `callback`. **Default:** `1`.
|
|
216
225
|
* @param args Optional arguments to pass when the `callback` is called.
|
|
217
|
-
* @
|
|
226
|
+
* @returns for use with `clearTimeout()`
|
|
218
227
|
*/
|
|
219
|
-
function
|
|
228
|
+
function setTimeout<TArgs extends any[]>(
|
|
220
229
|
callback: (...args: TArgs) => void,
|
|
230
|
+
delay?: number,
|
|
221
231
|
...args: TArgs
|
|
222
|
-
): NodeJS.
|
|
223
|
-
//
|
|
232
|
+
): NodeJS.Timeout;
|
|
233
|
+
// Allow a single void-accepting argument to be optional in arguments lists.
|
|
234
|
+
// Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258)
|
|
224
235
|
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
225
|
-
function
|
|
226
|
-
namespace
|
|
227
|
-
|
|
236
|
+
function setTimeout(callback: (_: void) => void, delay?: number): NodeJS.Timeout;
|
|
237
|
+
namespace setTimeout {
|
|
238
|
+
import __promisify__ = promises.setTimeout;
|
|
239
|
+
export { __promisify__ };
|
|
228
240
|
}
|
|
229
241
|
/**
|
|
230
242
|
* Cancels an `Immediate` object created by `setImmediate()`.
|
|
231
243
|
* @since v0.9.1
|
|
232
|
-
* @param immediate An `Immediate` object as returned by
|
|
244
|
+
* @param immediate An `Immediate` object as returned by `setImmediate()`.
|
|
245
|
+
*/
|
|
246
|
+
function clearImmediate(immediate: NodeJS.Immediate | undefined): void;
|
|
247
|
+
/**
|
|
248
|
+
* Cancels a `Timeout` object created by `setInterval()`.
|
|
249
|
+
* @since v0.0.1
|
|
250
|
+
* @param timeout A `Timeout` object as returned by `setInterval()`
|
|
251
|
+
* or the primitive of the `Timeout` object as a string or a number.
|
|
252
|
+
*/
|
|
253
|
+
function clearInterval(timeout: NodeJS.Timeout | string | number | undefined): void;
|
|
254
|
+
/**
|
|
255
|
+
* Cancels a `Timeout` object created by `setTimeout()`.
|
|
256
|
+
* @since v0.0.1
|
|
257
|
+
* @param timeout A `Timeout` object as returned by `setTimeout()`
|
|
258
|
+
* or the primitive of the `Timeout` object as a string or a number.
|
|
259
|
+
*/
|
|
260
|
+
function clearTimeout(timeout: NodeJS.Timeout | string | number | undefined): void;
|
|
261
|
+
/**
|
|
262
|
+
* The `queueMicrotask()` method queues a microtask to invoke `callback`. If
|
|
263
|
+
* `callback` throws an exception, the `process` object `'uncaughtException'`
|
|
264
|
+
* event will be emitted.
|
|
265
|
+
*
|
|
266
|
+
* The microtask queue is managed by V8 and may be used in a similar manner to
|
|
267
|
+
* the `process.nextTick()` queue, which is managed by Node.js. The
|
|
268
|
+
* `process.nextTick()` queue is always processed before the microtask queue
|
|
269
|
+
* within each turn of the Node.js event loop.
|
|
270
|
+
* @since v11.0.0
|
|
271
|
+
* @param callback Function to be queued.
|
|
233
272
|
*/
|
|
234
|
-
function clearImmediate(immediateId: NodeJS.Immediate | undefined): void;
|
|
235
273
|
function queueMicrotask(callback: () => void): void;
|
|
236
274
|
}
|
|
275
|
+
import clearImmediate = globalThis.clearImmediate;
|
|
276
|
+
import clearInterval = globalThis.clearInterval;
|
|
277
|
+
import clearTimeout = globalThis.clearTimeout;
|
|
278
|
+
import setImmediate = globalThis.setImmediate;
|
|
279
|
+
import setInterval = globalThis.setInterval;
|
|
280
|
+
import setTimeout = globalThis.setTimeout;
|
|
281
|
+
export { clearImmediate, clearInterval, clearTimeout, promises, setImmediate, setInterval, setTimeout };
|
|
237
282
|
}
|
|
238
283
|
declare module "node:timers" {
|
|
239
284
|
export * from "timers";
|